diff options
Diffstat (limited to 'lumina-desktop/desktop-plugins/desktopview')
-rw-r--r-- | lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp | 8 | ||||
-rw-r--r-- | lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.h | 14 |
2 files changed, 9 insertions, 13 deletions
diff --git a/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp b/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp index 0aa4a3de..273f1958 100644 --- a/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp +++ b/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp @@ -4,6 +4,7 @@ #include <QDir> #include <QClipboard> #include <QMimeData> +#include <QImageReader> #include <LuminaXDG.h> #include "LSession.h" @@ -126,6 +127,10 @@ void DesktopViewPlugin::decreaseIconSize(){ void DesktopViewPlugin::updateContents(){ list->clear(); + 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(); list->setGridSize(QSize(icosize+8,icosize+4+this->fontMetrics().height())); QDir dir(QDir::homePath()+"/Desktop"); @@ -151,6 +156,9 @@ void DesktopViewPlugin::updateContents(){ it->setIcon( LXDG::findMimeIcon(files[i].fileName()) ); it->setText( files[i].fileName() ); } + }else if(imgExtensions.contains(files[i].suffix().toLower()) ){ + it->setIcon( QIcon( QPixmap(files[i].absoluteFilePath()).scaled(icosize,icosize,Qt::IgnoreAspectRatio, Qt::SmoothTransformation) ) ); + it->setText( files[i].fileName() ); }else{ it->setIcon( LXDG::findMimeIcon( files[i].fileName() ) ); it->setText( files[i].fileName() ); diff --git a/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.h b/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.h index 61e1caf9..09cb7bcf 100644 --- a/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.h +++ b/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.h @@ -27,6 +27,7 @@ private: QListWidget *list; QFileSystemWatcher *watcher; QMenu *menu; + QStringList imgExtensions; private slots: void runItems(); @@ -46,19 +47,6 @@ public slots: void ThemeChange(){ QTimer::singleShot(0,this, SLOT(updateContents())); } - -/*protected: - void mousePressEvent(QMouseEvent *ev){ - if(ev->button()==Qt::RightButton){ - qDebug() << " - got mouse event"; - //Only show the context menu if an item is under the mouse (don't block the desktop menu) - if(list->itemAt( ev->globalPos()) !=0){ - ev->accept(); - showMenu(ev->globalPos()); - } - } - } - */ }; #endif |