diff options
author | Ken Moore <ken@pcbsd.org> | 2015-03-27 16:48:31 -0400 |
---|---|---|
committer | Ken Moore <ken@pcbsd.org> | 2015-03-27 16:48:31 -0400 |
commit | df64525b92c1220c0b3950e57d73d6dc729d3388 (patch) | |
tree | a4b0b97e94f43304c8ad1122b5204a2d43d73e43 /lumina-desktop/desktop-plugins | |
parent | Update the system tray to use the QScreen->grabWindow() routine instead of th... (diff) | |
download | lumina-df64525b92c1220c0b3950e57d73d6dc729d3388.tar.gz lumina-df64525b92c1220c0b3950e57d73d6dc729d3388.tar.bz2 lumina-df64525b92c1220c0b3950e57d73d6dc729d3388.zip |
Add thumbnail support for image files in the desktopview plugin.
Also update the port makefile for FreeBSD so that has the proper gstreamer plugins installed for audio support.
Diffstat (limited to 'lumina-desktop/desktop-plugins')
-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 |