diff options
author | Ken Moore <moorekou@gmail.com> | 2015-07-09 12:36:54 -0400 |
---|---|---|
committer | Ken Moore <moorekou@gmail.com> | 2015-07-09 12:36:54 -0400 |
commit | b97033197ab9de92981890ab823a6e18ab5039dd (patch) | |
tree | f7813999f5296a23fe5e0bfe3c35ac5c5c96cd60 /lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp | |
parent | Update the lumina themes and the PC-BSD color scheme a bit, and a couple more... (diff) | |
download | lumina-b97033197ab9de92981890ab823a6e18ab5039dd.tar.gz lumina-b97033197ab9de92981890ab823a6e18ab5039dd.tar.bz2 lumina-b97033197ab9de92981890ab823a6e18ab5039dd.zip |
Large update to the usermanager:
1) Fix alphabetizing the list of favorites
2) Make all the menu updates happen in a non-blocking fashion (the user will see the items appear as they are loaded)
3) In the home dir browser, also load any files within the directory (and launch them when clicked)
4) Remember which dir was loaded in the browser last, and only refresh/change it as necessary on next menu open.
Diffstat (limited to 'lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp')
-rw-r--r-- | lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp b/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp index 689bd8eb..ff77121e 100644 --- a/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp +++ b/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp @@ -7,6 +7,7 @@ #include "UserItemWidget.h" #include <LuminaUtils.h> +#define TEXTCUTOFF 165 UserItemWidget::UserItemWidget(QWidget *parent, QString itemPath, QString type, bool goback) : QFrame(parent){ createWidget(); //Now fill it appropriately @@ -17,10 +18,10 @@ UserItemWidget::UserItemWidget(QWidget *parent, QString itemPath, QString type, XDGDesktop item = LXDG::loadDesktopFile(itemPath, ok); if(ok){ icon->setPixmap( LXDG::findIcon(item.icon, "preferences-system-windows-actions").pixmap(32,32) ); - name->setText( this->fontMetrics().elidedText(item.name, Qt::ElideRight, 180) ); + name->setText( this->fontMetrics().elidedText(item.name, Qt::ElideRight, TEXTCUTOFF) ); }else{ icon->setPixmap( LXDG::findIcon("unknown","").pixmap(32,32) ); - name->setText( this->fontMetrics().elidedText(itemPath.section("/",-1), Qt::ElideRight, 180) ); + name->setText( this->fontMetrics().elidedText(itemPath.section("/",-1), Qt::ElideRight, TEXTCUTOFF) ); } }else if(type=="dir"){ if(itemPath.endsWith("/")){ itemPath.chop(1); } @@ -29,18 +30,22 @@ UserItemWidget::UserItemWidget(QWidget *parent, QString itemPath, QString type, name->setText( tr("Go Back") ); }else{ icon->setPixmap( LXDG::findIcon("folder","").pixmap(32,32) ); - name->setText( this->fontMetrics().elidedText(itemPath.section("/",-1), Qt::ElideRight, 180) ); + name->setText( this->fontMetrics().elidedText(itemPath.section("/",-1), Qt::ElideRight, TEXTCUTOFF) ); } }else{ if(itemPath.endsWith("/")){ itemPath.chop(1); } - if(LUtils::imageExtensions().contains(itemPath.section("/",-1).section(".",-1).toLower()) ){ + if(QFileInfo(itemPath).isDir()){ + type = "dir"; + icon->setPixmap( LXDG::findIcon("folder","").pixmap(32,32) ); + }else 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) ); + name->setText( this->fontMetrics().elidedText(itemPath.section("/",-1), Qt::ElideRight, TEXTCUTOFF) ); } icon->setWhatsThis(itemPath); + if(!goback){ this->setWhatsThis(name->text()); } isDirectory = (type=="dir"); //save this for later if(LUtils::isFavorite(itemPath)){ linkPath = itemPath; @@ -67,7 +72,8 @@ UserItemWidget::UserItemWidget(QWidget *parent, XDGDesktop item) : QFrame(parent } //Now fill it appropriately icon->setPixmap( LXDG::findIcon(item.icon,"preferences-system-windows-actions").pixmap(32,32) ); - name->setText( this->fontMetrics().elidedText(item.name, Qt::ElideRight, 180) ); + name->setText( this->fontMetrics().elidedText(item.name, Qt::ElideRight, TEXTCUTOFF) ); + this->setWhatsThis(name->text()); icon->setWhatsThis(item.filePath); //Now setup the button appropriately setupButton(); @@ -154,5 +160,4 @@ void UserItemWidget::buttonClicked(){ void UserItemWidget::ItemClicked(){ if(!linkPath.isEmpty()){ emit RunItem(linkPath); } else{ emit RunItem(icon->whatsThis()); } - } |