diff options
Diffstat (limited to 'src-qt5')
-rw-r--r-- | src-qt5/core/libLumina/LIconCache.cpp | 60 | ||||
-rw-r--r-- | src-qt5/core/libLumina/LIconCache.h | 8 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop/AppMenu.cpp | 18 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop/panel-plugins/systemstart/ItemWidget.cpp | 86 |
4 files changed, 120 insertions, 52 deletions
diff --git a/src-qt5/core/libLumina/LIconCache.cpp b/src-qt5/core/libLumina/LIconCache.cpp index cf2204a1..947429f9 100644 --- a/src-qt5/core/libLumina/LIconCache.cpp +++ b/src-qt5/core/libLumina/LIconCache.cpp @@ -25,6 +25,7 @@ LIconCache::~LIconCache(){ // === PUBLIC === //Icon Checks bool LIconCache::exists(QString icon){ + if(icon.isEmpty()){ return false; } if(HASH.contains(icon)){ return true; } //already else if(!icon.startsWith("/")){ //relative path to file (from icon theme?) @@ -38,6 +39,7 @@ bool LIconCache::exists(QString icon){ } bool LIconCache::isLoaded(QString icon){ + if(icon.isEmpty()){ return false; } if(HASH.contains(icon)){ return !HASH[icon].icon.isNull(); } @@ -113,6 +115,7 @@ QString LIconCache::findFile(QString icon){ void LIconCache::loadIcon(QAbstractButton *button, QString icon, bool noThumb){ + if(icon.isEmpty()){ return; } //See if the icon has already been loaded into the HASH bool needload = !HASH.contains(icon); if(!needload){ @@ -123,12 +126,13 @@ void LIconCache::loadIcon(QAbstractButton *button, QString icon, bool noThumb){ icon_data idata; if(HASH.contains(icon)){ idata = HASH.value(icon); } else { idata = createData(icon); } - idata.pendingButtons << button; //save this button for later + idata.pendingButtons << QPointer<QAbstractButton>(button); //save this button for later HASH.insert(icon, idata); - if(needload){ QtConcurrent::run(this, &LIconCache::ReadFile, this, icon, idata.fullpath); } + if(needload){ startReadFile(icon, idata.fullpath); } } void LIconCache::loadIcon(QAction *action, QString icon, bool noThumb){ + if(icon.isEmpty()){ return; } //See if the icon has already been loaded into the HASH bool needload = !HASH.contains(icon); if(!needload){ @@ -139,12 +143,13 @@ void LIconCache::loadIcon(QAction *action, QString icon, bool noThumb){ icon_data idata; if(HASH.contains(icon)){ idata = HASH.value(icon); } else { idata = createData(icon); } - idata.pendingActions << action; //save this button for later + idata.pendingActions << QPointer<QAction>(action); //save this button for later HASH.insert(icon, idata); - if(needload){ QtConcurrent::run(this, &LIconCache::ReadFile, this, icon, idata.fullpath); } + if(needload){ startReadFile(icon, idata.fullpath); } } void LIconCache::loadIcon(QLabel *label, QString icon, bool noThumb){ + if(icon.isEmpty()){ return; } //See if the icon has already been loaded into the HASH bool needload = !HASH.contains(icon); if(!needload){ @@ -154,10 +159,12 @@ void LIconCache::loadIcon(QLabel *label, QString icon, bool noThumb){ //Need to load the icon icon_data idata; if(HASH.contains(icon)){ idata = HASH.value(icon); } - else { idata = createData(icon); } - idata.pendingLabels << label; //save this QLabel for later + else { idata = createData(icon); + if(idata.fullpath.isEmpty()){ return; } //nothing to do + } + idata.pendingLabels << QPointer<QLabel>(label); //save this QLabel for later HASH.insert(icon, idata); - if(needload){ QtConcurrent::run(this, &LIconCache::ReadFile, this, icon, idata.fullpath); } + if(needload){ startReadFile(icon, idata.fullpath); } } void LIconCache::clearIconTheme(){ @@ -170,6 +177,7 @@ void LIconCache::clearIconTheme(){ } QIcon LIconCache::loadIcon(QString icon, bool noThumb){ + if(icon.isEmpty()){ return QIcon(); } if(HASH.contains(icon)){ if(!HASH[icon].icon.isNull()){ return HASH[icon].icon; } else if(!HASH[icon].thumbnail.isNull() && !noThumb){ return HASH[icon].thumbnail; } @@ -178,6 +186,7 @@ QIcon LIconCache::loadIcon(QString icon, bool noThumb){ icon_data idat; if(HASH.contains(icon)){ idat = HASH[icon]; } else{ idat = createData(icon); } + if(idat.fullpath.isEmpty()){ return QIcon(); } //non-existant file idat.icon = QIcon(idat.fullpath); //Now save into the hash and return HASH.insert(icon, idat); @@ -242,14 +251,36 @@ QStringList LIconCache::getIconThemeDepChain(QString theme, QStringList paths){ return results; } +void LIconCache::startReadFile(QString id, QString path){ + if(path.endsWith(".svg")){ + //Special handling - need to read QIcon directly to have the SVG icon scale up appropriately + icon_data idat = HASH[id]; + idat.lastread = QDateTime::currentDateTime(); + idat.icon = QIcon(path); + for(int i=0; i<idat.pendingButtons.length(); i++){ if(!idat.pendingButtons[i].isNull()){ idat.pendingButtons[i]->setIcon(idat.icon); } } + idat.pendingButtons.clear(); + for(int i=0; i<idat.pendingLabels.length(); i++){ if(!idat.pendingLabels[i].isNull()){ idat.pendingLabels[i]->setPixmap(idat.icon.pixmap(idat.pendingLabels[i]->sizeHint())); } } + idat.pendingLabels.clear(); + for(int i=0; i<idat.pendingActions.length(); i++){ if(!idat.pendingActions[i].isNull()){ idat.pendingActions[i]->setIcon(idat.icon); } } + idat.pendingActions.clear(); + //Now update the hash and let the world know it is available now + HASH.insert(id, idat); + this->emit IconAvailable(id); + }else{ + QtConcurrent::run(this, &LIconCache::ReadFile, this, id, path); + } +} + void LIconCache::ReadFile(LIconCache *obj, QString id, QString path){ qDebug() << "Start Reading File:" << id << path; QByteArray *BA = new QByteArray(); QDateTime cdt = QDateTime::currentDateTime(); - QFile file(path); - if(file.open(QIODevice::ReadOnly)){ - BA->append(file.readAll()); - file.close(); + if(!path.isEmpty()){ + QFile file(path); + if(file.open(QIODevice::ReadOnly)){ + BA->append(file.readAll()); + file.close(); + } } obj->emit InternalIconLoaded(id, cdt, BA); } @@ -266,11 +297,14 @@ void LIconCache::IconLoaded(QString id, QDateTime sync, QByteArray *data){ icon_data idat = HASH[id]; idat.lastread = sync; idat.icon.addPixmap(pix); + if(pix.width() < 64){ idat.icon.addPixmap( pix.scaled( QSize(64,64), Qt::KeepAspectRatio, Qt::SmoothTransformation) ); } //also add a version which has been scaled up a bit //Now throw this icon into any pending objects - for(int i=0; i<idat.pendingButtons.length(); i++){ idat.pendingButtons[i]->setIcon(idat.icon); } + for(int i=0; i<idat.pendingButtons.length(); i++){ if(!idat.pendingButtons[i].isNull()){ idat.pendingButtons[i]->setIcon(idat.icon); } } idat.pendingButtons.clear(); - for(int i=0; i<idat.pendingLabels.length(); i++){ idat.pendingLabels[i]->setPixmap(pix.scaled(idat.pendingLabels[i]->sizeHint(), Qt::KeepAspectRatio, Qt::SmoothTransformation)); } + for(int i=0; i<idat.pendingLabels.length(); i++){ if(!idat.pendingLabels[i].isNull()){ idat.pendingLabels[i]->setPixmap(pix.scaled(idat.pendingLabels[i]->sizeHint(), Qt::KeepAspectRatio, Qt::SmoothTransformation)); } } idat.pendingLabels.clear(); + for(int i=0; i<idat.pendingActions.length(); i++){ if(!idat.pendingActions[i].isNull()){ idat.pendingActions[i]->setIcon(idat.icon); } } + idat.pendingActions.clear(); //Now update the hash and let the world know it is available now HASH.insert(id, idat); this->emit IconAvailable(id); diff --git a/src-qt5/core/libLumina/LIconCache.h b/src-qt5/core/libLumina/LIconCache.h index 4a8f3442..cf585675 100644 --- a/src-qt5/core/libLumina/LIconCache.h +++ b/src-qt5/core/libLumina/LIconCache.h @@ -17,14 +17,15 @@ #include <QAbstractButton> #include <QLabel> #include <QAction> +#include <QPointer> //Data structure for saving the icon/information internally struct icon_data{ QString fullpath; QDateTime lastread; - QList<QLabel*> pendingLabels; - QList<QAbstractButton*> pendingButtons; - QList<QAction*> pendingActions; + QList<QPointer<QLabel> > pendingLabels; + QList<QPointer<QAbstractButton> > pendingButtons; + QList<QPointer<QAction> > pendingActions; QIcon icon; QIcon thumbnail; }; @@ -57,6 +58,7 @@ private: QStringList getChildIconDirs(QString path); //recursive function to find directories with icons in them QStringList getIconThemeDepChain(QString theme, QStringList paths); + void startReadFile(QString id, QString path); void ReadFile(LIconCache *obj, QString id, QString path); private slots: diff --git a/src-qt5/core/lumina-desktop/AppMenu.cpp b/src-qt5/core/lumina-desktop/AppMenu.cpp index 798d8b6d..c3c52375 100644 --- a/src-qt5/core/lumina-desktop/AppMenu.cpp +++ b/src-qt5/core/lumina-desktop/AppMenu.cpp @@ -7,6 +7,9 @@ #include "AppMenu.h" #include "LSession.h" #include <LuminaOS.h> +#include <LIconCache.h> + +extern LIconCache *ICONS; AppMenu::AppMenu(QWidget* parent) : QMenu(parent){ appstorelink = LOS::AppStoreShortcut(); //Default application "store" to display (AppCafe in TrueOS) @@ -109,13 +112,15 @@ void AppMenu::updateAppList(){ else{ name = tr("Unsorted"); icon = "applications-other"; } QMenu *menu = new QMenu(name, this); - menu->setIcon(LXDG::findIcon(icon,"")); + menu->setIcon( ICONS->loadIcon(icon) ); + //menu->setIcon(LXDG::findIcon(icon,"")); connect(menu, SIGNAL(triggered(QAction*)), this, SLOT(launchApp(QAction*)) ); QList<XDGDesktop*> appL = APPS.value(cats[i]); for( int a=0; a<appL.length(); a++){ if(appL[a]->actions.isEmpty()){ //Just a single entry point - no extra actions - QAction *act = new QAction(LXDG::findIcon(appL[a]->icon, ""), appL[a]->name, this); + QAction *act = new QAction(appL[a]->name, this); + ICONS->loadIcon(act, appL[a]->icon); act->setToolTip(appL[a]->comment); act->setWhatsThis(appL[a]->filePath); menu->addAction(act); @@ -123,15 +128,18 @@ void AppMenu::updateAppList(){ //This app has additional actions - make this a sub menu // - first the main menu/action QMenu *submenu = new QMenu(appL[a]->name, this); - submenu->setIcon( LXDG::findIcon(appL[a]->icon,"") ); + submenu->setIcon( ICONS->loadIcon(appL[a]->icon )); //This is the normal behavior - not a special sub-action (although it needs to be at the top of the new menu) - QAction *act = new QAction(LXDG::findIcon(appL[a]->icon, ""), appL[a]->name, this); + QAction *act = new QAction(appL[a]->name, this); + ICONS->loadIcon(act, appL[a]->icon); act->setToolTip(appL[a]->comment); act->setWhatsThis(appL[a]->filePath); submenu->addAction(act); //Now add entries for every sub-action listed for(int sa=0; sa<appL[a]->actions.length(); sa++){ - QAction *sact = new QAction(LXDG::findIcon(appL[a]->actions[sa].icon, appL[a]->icon), appL[a]->actions[sa].name, this); + QAction *sact = new QAction( appL[a]->actions[sa].name, this); + if(ICONS->exists(appL[a]->actions[sa].icon)){ ICONS->loadIcon(sact, appL[a]->actions[sa].icon); } + else{ ICONS->loadIcon(sact, appL[a]->icon); } sact->setToolTip(appL[a]->comment); sact->setWhatsThis("-action \""+appL[a]->actions[sa].ID+"\" \""+appL[a]->filePath+"\""); submenu->addAction(sact); diff --git a/src-qt5/core/lumina-desktop/panel-plugins/systemstart/ItemWidget.cpp b/src-qt5/core/lumina-desktop/panel-plugins/systemstart/ItemWidget.cpp index ea074a59..bdc54212 100644 --- a/src-qt5/core/lumina-desktop/panel-plugins/systemstart/ItemWidget.cpp +++ b/src-qt5/core/lumina-desktop/panel-plugins/systemstart/ItemWidget.cpp @@ -9,6 +9,9 @@ #include <QMenu> #include "../../LSession.h" +#include <LIconCache.h> + +extern LIconCache *ICONS; ItemWidget::ItemWidget(QWidget *parent, QString itemPath, QString type, bool goback) : QFrame(parent){ createWidget(); @@ -20,7 +23,9 @@ ItemWidget::ItemWidget(QWidget *parent, QString itemPath, QString type, bool gob gooditem = item.isValid(); //qDebug() << "Good Item:" << gooditem << itemPath; if(gooditem){ - icon->setPixmap( LXDG::findIcon(item.icon, "preferences-system-windows-actions").pixmap(32,32) ); + //if(ICONS->exists(item.icon)){ ICONS->loadIcon(icon, item.icon); } + //else{ ICONS->loadIcon(icon, "preferences-system-windows-actions"); } + //icon->setPixmap( LXDG::findIcon(item.icon, "preferences-system-windows-actions").pixmap(32,32) ); iconPath = item.icon; text = item.name; if(!item.genericName.isEmpty() && item.name!=item.genericName){ text.append("<br><i> -- "+item.genericName+"</i>"); } @@ -34,12 +39,12 @@ ItemWidget::ItemWidget(QWidget *parent, QString itemPath, QString type, bool gob actButton->setVisible(false); if(itemPath.endsWith("/")){ itemPath.chop(1); } if(goback){ - icon->setPixmap( LXDG::findIcon("go-previous","").pixmap(64,64) ); + //ICONS->loadIcon(icon, "go-previous"); //icon->setPixmap( LXDG::findIcon("go-previous","").pixmap(64,64) ); iconPath = "go-previous"; text = tr("Go Back"); name->setText( text ); }else{ - icon->setPixmap( LXDG::findIcon("folder","").pixmap(64,64) ); + //icon->setPixmap( LXDG::findIcon("folder","").pixmap(64,64) ); iconPath = "folder"; name->setText( itemPath.section("/",-1)); text = itemPath.section("/",-1); @@ -49,7 +54,7 @@ ItemWidget::ItemWidget(QWidget *parent, QString itemPath, QString type, bool gob actButton->setVisible(false); iconPath = LXDG::DesktopCatToIcon(type.section("::::",1,50)); if(goback){ iconPath = "go-previous"; type = "chcat::::"; itemPath = "<B>("+itemPath+")</B>"; } - icon->setPixmap( LXDG::findIcon(iconPath,"applications-other").pixmap(64,64) ); + //icon->setPixmap( LXDG::findIcon(iconPath,"applications-other").pixmap(64,64) ); name->setText(itemPath); text = itemPath; icon->setWhatsThis(type); @@ -59,17 +64,21 @@ ItemWidget::ItemWidget(QWidget *parent, QString itemPath, QString type, bool gob if(itemPath.endsWith("/")){ itemPath.chop(1); } if(QFileInfo(itemPath).isDir()){ type = "dir"; - icon->setPixmap( LXDG::findIcon("folder","").pixmap(64,64) ); + //icon->setPixmap( LXDG::findIcon("folder","").pixmap(64,64) ); iconPath = "folder"; }else if(LUtils::imageExtensions().contains(itemPath.section("/",-1).section(".",-1).toLower()) ){ - icon->setPixmap( QIcon(itemPath).pixmap(64,64) ); + iconPath = itemPath; + //icon->setPixmap( QIcon(itemPath).pixmap(64,64) ); }else{ - if( LUtils::isValidBinary(itemPath) ){ icon->setPixmap( LXDG::findIcon(type, "application-x-executable").pixmap(64,64) ); } - else{ icon->setPixmap( LXDG::findMimeIcon(itemPath.section("/",-1)).pixmap(64,64) ); } + if( LUtils::isValidBinary(itemPath) ){ + if(ICONS->exists(type)){ iconPath = type; } + else{ iconPath = "application-x-executable"; } + }else{ iconPath = LXDG::findAppMimeForFile(itemPath.section("/",-1)).replace("/","-"); } } name->setText( itemPath.section("/",-1) ); //this->fontMetrics().elidedText(itemPath.section("/",-1), Qt::ElideRight, TEXTCUTOFF) ); text = itemPath.section("/",-1) ; } + ICONS->loadIcon(icon, iconPath); icon->setWhatsThis(itemPath); if(!goback){ this->setWhatsThis(name->text()); } isDirectory = (type=="dir"); //save this for later @@ -105,7 +114,7 @@ ItemWidget::ItemWidget(QWidget *parent, XDGDesktop *item) : QFrame(parent){ name->setToolTip(icon->whatsThis()); //also allow the user to see the full shortcut path } //Now fill it appropriately - icon->setPixmap( LXDG::findIcon(item->icon,"preferences-system-windows-actions").pixmap(64,64) ); + //icon->setPixmap( LXDG::findIcon(item->icon,"preferences-system-windows-actions").pixmap(64,64) ); text = item->name; if(!item->genericName.isEmpty() && item->name!=item->genericName){ text.append("<br><i> -- "+item->genericName+"</i>"); } name->setText(text); @@ -113,26 +122,27 @@ ItemWidget::ItemWidget(QWidget *parent, XDGDesktop *item) : QFrame(parent){ this->setWhatsThis(item->name); icon->setWhatsThis(item->filePath); iconPath = item->icon; + ICONS->loadIcon(icon, iconPath); //Now setup the buttons appropriately setupContextMenu(); setupActions(item); } ItemWidget::~ItemWidget(){ - icon->setPixmap(QPixmap()); //make sure the pixmap is cleared from memory too - actButton->deleteLater(); + //icon->setPixmap(QPixmap()); //make sure the pixmap is cleared from memory too + //actButton->deleteLater(); contextMenu->clear(); - contextMenu->deleteLater(); + //contextMenu->deleteLater(); if(actButton->menu()!=0){ for(int i=0; i<actButton->menu()->actions().length(); i++){ actButton->menu()->actions().at(i)->deleteLater(); } actButton->menu()->deleteLater(); } - actButton->deleteLater(); - icon->deleteLater(); - name->deleteLater(); - menureset->deleteLater(); + //actButton->deleteLater(); + //icon->deleteLater(); + //name->deleteLater(); + //menureset->deleteLater(); linkPath.clear(); iconPath.clear(); text.clear(); } @@ -155,6 +165,8 @@ void ItemWidget::createWidget(){ actButton->setPopupMode(QToolButton::InstantPopup); actButton->setArrowType(Qt::DownArrow); icon = new QLabel(this); + int H = 64; //(2.3*this->fontMetrics().height() ) -4; //make sure the height is large enough for two lines + icon->setFixedSize( QSize(H,H) ); name = new QLabel(this); name->setWordWrap(true); name->setTextFormat(Qt::RichText); @@ -172,23 +184,29 @@ void ItemWidget::createWidget(){ void ItemWidget::setupContextMenu(){ //Now refresh the context menu contextMenu->clear(); + QAction *tmp = 0; if(!QFile::exists(QDir::homePath()+"/Desktop/"+icon->whatsThis().section("/",-1)) ){ //Does not have a desktop link - contextMenu->addAction( LXDG::findIcon("preferences-desktop-icons",""), tr("Pin to Desktop"), this, SLOT(PinToDesktop()) ); + tmp = contextMenu->addAction( tr("Pin to Desktop"), this, SLOT(PinToDesktop()) ); + ICONS->loadIcon(tmp, "preferences-desktop-icons"); } //Favorite Item if( LDesktopUtils::isFavorite(icon->whatsThis()) ){ //Favorite Item - can always remove this - contextMenu->addAction( LXDG::findIcon("edit-delete",""), tr("Remove from Favorites"), this, SLOT(RemoveFavorite()) ); + tmp = contextMenu->addAction(tr("Remove from Favorites"), this, SLOT(RemoveFavorite()) ); + ICONS->loadIcon(tmp, "edit-delete"); }else{ //This file does not have a shortcut yet -- allow the user to add it - contextMenu->addAction( LXDG::findIcon("bookmark-toolbar",""), tr("Add to Favorites"), this, SLOT(AddFavorite()) ); + tmp = contextMenu->addAction( tr("Add to Favorites"), this, SLOT(AddFavorite()) ); + ICONS->loadIcon(tmp, "bookmark-toolbar"); } //QuickLaunch Item if(LSession::handle()->sessionSettings()->value("QuicklaunchApps",QStringList()).toStringList().contains(icon->whatsThis()) ){ //Favorite Item - can always remove this - contextMenu->addAction( LXDG::findIcon("edit-delete",""), tr("Remove from Quicklaunch"), this, SLOT(RemoveQL()) ); + tmp = contextMenu->addAction( tr("Remove from Quicklaunch"), this, SLOT(RemoveQL()) ); + ICONS->loadIcon(tmp, "edit-delete"); }else{ //This file does not have a shortcut yet -- allow the user to add it - contextMenu->addAction( LXDG::findIcon("quickopen",""), tr("Add to Quicklaunch"), this, SLOT(AddQL()) ); + tmp = contextMenu->addAction( tr("Add to Quicklaunch"), this, SLOT(AddQL()) ); + ICONS->loadIcon(tmp, "quickopen"); } } @@ -197,10 +215,12 @@ void ItemWidget::setupActions(XDGDesktop *app){ //Actions Available - go ahead and list them all actButton->setMenu( new QMenu(this) ); for(int i=0; i<app->actions.length(); i++){ - QAction *act = new QAction(LXDG::findIcon(app->actions[i].icon, app->icon), app->actions[i].name, this); - act->setToolTip(app->actions[i].ID); - act->setWhatsThis(app->actions[i].ID); - actButton->menu()->addAction(act); + QAction *act = new QAction(app->actions[i].name, this); + if(ICONS->exists(app->actions[i].icon)){ ICONS->loadIcon(act, app->actions[i].icon); } + else{ ICONS->loadIcon(act, app->icon); } + act->setToolTip(app->actions[i].ID); + act->setWhatsThis(app->actions[i].ID); + actButton->menu()->addAction(act); } connect(actButton->menu(), SIGNAL(triggered(QAction*)), this, SLOT(actionClicked(QAction*)) ); connect(actButton->menu(), SIGNAL(aboutToShow()), this, SLOT(actionMenuOpen()) ); @@ -210,9 +230,9 @@ void ItemWidget::setupActions(XDGDesktop *app){ void ItemWidget::updateItems(){ //update the text/icon to match sizes - int H = 2.3*name->fontMetrics().height(); //make sure the height is large enough for two lines - icon->setFixedSize(QSize(H-4, H-4)); - actButton->setFixedSize( QSize( (H-4)/2, H-4) ); + int H = 64; //(2.3*name->fontMetrics().height() ) -4; //make sure the height is large enough for two lines + icon->setFixedSize(QSize(H, H)); + actButton->setFixedSize( QSize( H/2, H) ); QStringList newname = text.split("<br>"); for(int i=0; i<newname.length(); i++){ newname[i] = name->fontMetrics().elidedText(newname[i], Qt::ElideRight, name->width()); } name->setText( newname.join("<br>") ); @@ -222,12 +242,16 @@ void ItemWidget::updateItems(){ if(iconPath.isEmpty()){ //Use item path (thumbnail or mimetype) if(LUtils::imageExtensions().contains(icon->whatsThis().section("/",-1).section(".",-1).toLower()) ){ - icon->setPixmap( QIcon(icon->whatsThis()).pixmap(H-4,H-4).scaledToHeight(H-4,Qt::SmoothTransformation) ); + ICONS->loadIcon(icon, icon->whatsThis()); + //icon->setPixmap( QIcon(icon->whatsThis()).pixmap(H-4,H-4).scaledToHeight(H-4,Qt::SmoothTransformation) ); }else{ - icon->setPixmap( LXDG::findMimeIcon(icon->whatsThis().section("/",-1)).pixmap(H-4,H-4).scaledToHeight(H-4,Qt::SmoothTransformation) ); + ICONS->loadIcon(icon, LXDG::findAppMimeForFile(icon->whatsThis()).replace("/","-") ); + //icon->setPixmap( LXDG::findMimeIcon(icon->whatsThis().section("/",-1)).pixmap(H-4,H-4).scaledToHeight(H-4,Qt::SmoothTransformation) ); } }else{ - icon->setPixmap( LXDG::findIcon(iconPath,"preferences-system-windows-actions").pixmap(H-4,H-4).scaledToHeight(H-4,Qt::SmoothTransformation) ); + if(ICONS->exists(iconPath)){ ICONS->loadIcon(icon, iconPath); } + else{ ICONS->loadIcon(icon, "preferences-system-windows-actions"); } + //icon->setPixmap( LXDG::findIcon(iconPath,"preferences-system-windows-actions").pixmap(H-4,H-4).scaledToHeight(H-4,Qt::SmoothTransformation) ); } }else if(icon->pixmap()->size().height() > (H-4) ){ icon->setPixmap( icon->pixmap()->scaled(H-4, H-4, Qt::IgnoreAspectRatio, Qt::SmoothTransformation) ); |