aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Moore <ken@pcbsd.org>2015-05-28 09:56:15 -0400
committerKen Moore <ken@pcbsd.org>2015-05-28 09:56:15 -0400
commitd0fb463abb9e79606c9eb75b3a94331127cd5060 (patch)
tree2ffe3c0cb2e6dee36e56fef82bf49eb5e17d5b47
parentFix up the display of directories in the user button plugin. (diff)
downloadlumina-d0fb463abb9e79606c9eb75b3a94331127cd5060.tar.gz
lumina-d0fb463abb9e79606c9eb75b3a94331127cd5060.tar.bz2
lumina-d0fb463abb9e79606c9eb75b3a94331127cd5060.zip
Add a new LUtils::imageExtensions() function, and setup the lumina-desktop plugins to all use that for checking whether a thumbnail can be shown. Also add thumbnail support into the user button for favorite files.
-rw-r--r--libLumina/LuminaUtils.cpp11
-rw-r--r--libLumina/LuminaUtils.h3
-rw-r--r--lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp6
-rw-r--r--lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.h2
-rw-r--r--lumina-desktop/panel-plugins/desktopbar/LDeskBar.cpp6
-rw-r--r--lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp9
6 files changed, 31 insertions, 6 deletions
diff --git a/libLumina/LuminaUtils.cpp b/libLumina/LuminaUtils.cpp
index 6660f65c..61194f10 100644
--- a/libLumina/LuminaUtils.cpp
+++ b/libLumina/LuminaUtils.cpp
@@ -13,6 +13,7 @@
#include <QTextCodec>
#include <QDebug>
#include <QDesktopWidget>
+#include <QImageReader>
#include <LuminaOS.h>
#include <LuminaThemes.h>
@@ -117,6 +118,16 @@ QStringList LUtils::listSubDirectories(QString dir, bool recursive){
return out;
}
+QStringList LUtils::imageExtensions(){
+ //Note that all the image extensions are lowercase!!
+ static QStringList imgExtensions;
+ if(imgExtensions.isEmpty()){
+ QList<QByteArray> fmt = QImageReader::supportedImageFormats();
+ for(int i=0; i<fmt.length(); i++){ imgExtensions << QString::fromLocal8Bit(fmt[i]); }
+ }
+ return imgExtensions;
+}
+
void LUtils::LoadTranslation(QApplication *app, QString appname){
//Get the current localization
QString langEnc = "UTF-8"; //default value
diff --git a/libLumina/LuminaUtils.h b/libLumina/LuminaUtils.h
index 74a72465..434970ef 100644
--- a/libLumina/LuminaUtils.h
+++ b/libLumina/LuminaUtils.h
@@ -45,6 +45,9 @@ public:
//List all the sub-directories of a parent dir (recursive)
static QStringList listSubDirectories(QString dir, bool recursive = true);
+ //Get the list of all file extensions which Qt can read (lowercase)
+ static QStringList imageExtensions();
+
//Load a translation file for a Lumina Project
static void LoadTranslation(QApplication *app, QString appname);
diff --git a/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp b/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp
index e86f2853..467b802b 100644
--- a/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp
+++ b/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp
@@ -132,10 +132,10 @@ void DesktopViewPlugin::decreaseIconSize(){
void DesktopViewPlugin::updateContents(){
list->clear();
- if(imgExtensions.isEmpty()){
+ /*if(imgExtensions.isEmpty()){
QList<QByteArray> fmt = QImageReader::supportedImageFormats();
for(int i=0; i<fmt.length(); i++){ imgExtensions << QString::fromLocal8Bit(fmt[i]); }
- }
+ }*/
int icosize = settings->value("IconSize",64).toInt();
QSize gridSZ = QSize(icosize+8,icosize+4+(2*this->fontMetrics().height()) );
//qDebug() << "Icon Size:" << icosize <<"Grid Size:" << gridSZ.width() << gridSZ.height();
@@ -166,7 +166,7 @@ void DesktopViewPlugin::updateContents(){
it->setIcon( LXDG::findMimeIcon(files[i].fileName()) );
txt = files[i].fileName();
}
- }else if(imgExtensions.contains(files[i].suffix().toLower()) ){
+ }else if(LUtils::imageExtensions().contains(files[i].suffix().toLower()) ){
it->setIcon( QIcon( QPixmap(files[i].absoluteFilePath()).scaled(icosize,icosize,Qt::IgnoreAspectRatio, Qt::SmoothTransformation) ) );
txt = files[i].fileName();
}else{
diff --git a/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.h b/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.h
index 90bc20eb..d8f217f0 100644
--- a/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.h
+++ b/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.h
@@ -27,7 +27,7 @@ private:
QListWidget *list;
QFileSystemWatcher *watcher;
QMenu *menu;
- QStringList imgExtensions;
+ //QStringList imgExtensions;
private slots:
void runItems();
diff --git a/lumina-desktop/panel-plugins/desktopbar/LDeskBar.cpp b/lumina-desktop/panel-plugins/desktopbar/LDeskBar.cpp
index d29d4354..163f7c0a 100644
--- a/lumina-desktop/panel-plugins/desktopbar/LDeskBar.cpp
+++ b/lumina-desktop/panel-plugins/desktopbar/LDeskBar.cpp
@@ -191,7 +191,11 @@ void LDeskBarPlugin::desktopChanged(){
videoM->addAction( newAction(path, name, LXDG::findMimeIcon(type)) );
}else if(type.startsWith("image/")){
//Add it to pictureM
- pictureM->addAction( newAction(path, name, LXDG::findMimeIcon(type)) );
+ if(LUtils::imageExtensions().contains(path.section("/",-1).section(".",-1).toLower()) ){
+ pictureM->addAction( newAction(path, name, QIcon(path)) );
+ }else{
+ pictureM->addAction( newAction(path, name, LXDG::findMimeIcon(type)) );
+ }
}else if(type.startsWith("text/")){
//Add it to docM
docM->addAction( newAction(path, name, LXDG::findMimeIcon(type)) );
diff --git a/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp b/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp
index 4a274cdf..1cceb5e2 100644
--- a/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp
+++ b/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp
@@ -33,7 +33,11 @@ UserItemWidget::UserItemWidget(QWidget *parent, QString itemPath, QString type,
}
}else{
if(itemPath.endsWith("/")){ itemPath.chop(1); }
- icon->setPixmap( LXDG::findMimeIcon(type).pixmap(32,32) );
+ if(LUtils::imageExtensions().contains(itemPath.section("/",-1).section(".",-1).toLower()) ){
+ icon->setPixmap( QIcon(itemPath).pixmap(32,32) );
+ }else{
+ icon->setPixmap( LXDG::findMimeIcon(type).pixmap(32,32) );
+ }
name->setText( this->fontMetrics().elidedText(itemPath.section("/",-1), Qt::ElideRight, 180) );
}
icon->setWhatsThis(itemPath);
@@ -123,6 +127,9 @@ void UserItemWidget::setupButton(bool disable){
//This already has a desktop shortcut -- no special actions
button->setVisible(false);
}
+ if(isShortcut){
+ name->setToolTip(icon->whatsThis()); //also allow the user to see the full shortcut path
+ }
}
void UserItemWidget::buttonClicked(){
bgstack15