diff options
author | Ken Moore <ken@ixsystems.com> | 2017-08-31 21:59:44 -0400 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2017-08-31 21:59:44 -0400 |
commit | aa64ef84cd104cc9364ebf480117174540f69a88 (patch) | |
tree | 756030b17e2df6995875283ba144dd3d308f2a9f /src-qt5/core/libLumina/LIconCache.cpp | |
parent | A bit more cleanup. Nothing too special. (diff) | |
download | lumina-aa64ef84cd104cc9364ebf480117174540f69a88.tar.gz lumina-aa64ef84cd104cc9364ebf480117174540f69a88.tar.bz2 lumina-aa64ef84cd104cc9364ebf480117174540f69a88.zip |
Some more cleanup on Lumina2:
1) Get the JsonMenu plugin up and running again for the context menu
2) Get the LIconCache integrated into the context menu (replacing the old LXDG::findIcon calls).
3) Get the window property events working!!! (finally)
4) Start getting some automatic window-verification put in place (for snapping windows to various places and such).
Diffstat (limited to 'src-qt5/core/libLumina/LIconCache.cpp')
-rw-r--r-- | src-qt5/core/libLumina/LIconCache.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src-qt5/core/libLumina/LIconCache.cpp b/src-qt5/core/libLumina/LIconCache.cpp index 70c360fb..84428546 100644 --- a/src-qt5/core/libLumina/LIconCache.cpp +++ b/src-qt5/core/libLumina/LIconCache.cpp @@ -184,6 +184,27 @@ void LIconCache::loadIcon(QLabel *label, QString icon, bool noThumb){ if(needload){ startReadFile(icon, idata.fullpath); } } +void LIconCache::loadIcon(QMenu *action, QString icon, bool noThumb){ + if(icon.isEmpty()){ return; } + if(isThemeIcon(icon)){ + action->setIcon( iconFromTheme(icon)); + return ; + } + //See if the icon has already been loaded into the HASH + bool needload = !HASH.contains(icon); + if(!needload){ + if(!noThumb && !HASH[icon].thumbnail.isNull()){ action->setIcon( HASH[icon].thumbnail ); return; } + else if(!HASH[icon].icon.isNull()){ action->setIcon( HASH[icon].icon ); return; } + } + //Need to load the icon + icon_data idata; + if(HASH.contains(icon)){ idata = HASH.value(icon); } + else { idata = createData(icon); } + idata.pendingMenus << QPointer<QMenu>(action); //save this button for later + HASH.insert(icon, idata); + if(needload){ startReadFile(icon, idata.fullpath); } +} + void LIconCache::clearIconTheme(){ //use when the icon theme changes to refresh all requested icons QStringList keys = HASH.keys(); @@ -282,6 +303,8 @@ void LIconCache::startReadFile(QString id, QString path){ 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(); + for(int i=0; i<idat.pendingMenus.length(); i++){ if(!idat.pendingMenus[i].isNull()){ idat.pendingMenus[i]->setIcon(idat.icon); } } + idat.pendingMenus.clear(); //Now update the hash and let the world know it is available now HASH.insert(id, idat); this->emit IconAvailable(id); |