diff options
Diffstat (limited to 'lumina-desktop')
-rw-r--r-- | lumina-desktop/LDesktop.cpp | 33 | ||||
-rw-r--r-- | lumina-desktop/LDesktop.h | 11 | ||||
-rw-r--r-- | lumina-desktop/LWinInfo.h (renamed from lumina-desktop/panel-plugins/taskmanager/LWinInfo.h) | 10 | ||||
-rw-r--r-- | lumina-desktop/lumina-desktop.pro | 2 | ||||
-rw-r--r-- | lumina-desktop/panel-plugins/taskmanager/LTaskButton.cpp | 8 | ||||
-rw-r--r-- | lumina-desktop/panel-plugins/taskmanager/LTaskButton.h | 2 |
6 files changed, 50 insertions, 16 deletions
diff --git a/lumina-desktop/LDesktop.cpp b/lumina-desktop/LDesktop.cpp index c64f327f..5e1fb3bf 100644 --- a/lumina-desktop/LDesktop.cpp +++ b/lumina-desktop/LDesktop.cpp @@ -8,7 +8,8 @@ #include "LSession.h" #include <LuminaOS.h> -//#include "../global.h" +#include <LuminaX11.h> +#include "LWinInfo.h" LDesktop::LDesktop(int deskNum) : QObject(){ @@ -22,7 +23,12 @@ LDesktop::LDesktop(int deskNum) : QObject(){ qDebug() << "Desktop #"<<deskNum<<" -> "<< desktop->screenGeometry(desktopnumber).x() << desktop->screenGeometry(desktopnumber).y() << desktop->screenGeometry(desktopnumber).width() << desktop->screenGeometry(desktopnumber).height(); deskMenu = new QMenu(0); connect(deskMenu, SIGNAL(triggered(QAction*)), this, SLOT(SystemApplication(QAction*)) ); - appmenu = new AppMenu(0); + winMenu = new QMenu(0); + winMenu->setTitle(tr("Window List")); + winMenu->setIcon( LXDG::findIcon("preferences-system-windows","") ); + usewinmenu=false; + connect(winMenu, SIGNAL(triggered(QAction*)), this, SLOT(winClicked(QAction*)) ); + //appmenu = new AppMenu(0); workspacelabel = new QLabel(0); workspacelabel->setAlignment(Qt::AlignCenter); wkspaceact = new QWidgetAction(0); @@ -60,7 +66,8 @@ LDesktop::LDesktop(int deskNum) : QObject(){ LDesktop::~LDesktop(){ delete deskMenu; - delete appmenu; + //delete appmenu; + delete winMenu; delete bgWindow; delete workspacelabel; delete wkspaceact; @@ -140,18 +147,21 @@ void LDesktop::UpdateMenu(bool fast){ //qDebug() << "Found desktop number:" << num; if(num < 0){ workspacelabel->setText( "<b>"+tr("Lumina Desktop")+"</b>"); } else{ workspacelabel->setText( "<b>"+QString(tr("Workspace %1")).arg(QString::number(num+1))+"</b>"); } + if(fast && usewinmenu){ UpdateWinMenu(); } if(fast){ return; } //already done deskMenu->clear(); //clear it for refresh deskMenu->addAction(wkspaceact); deskMenu->addSeparator(); //Now load the user's menu setup and fill the menu QStringList items = settings->value("menu/itemlist", QStringList()<< "terminal" << "filemanager" <<"applications" << "line" << "settings" ).toStringList(); + usewinmenu=false; for(int i=0; i<items.length(); i++){ if(items[i]=="terminal"){ deskMenu->addAction(LXDG::findIcon("utilities-terminal",""), tr("Terminal"), this, SLOT(SystemTerminal()) ); } else if(items[i]=="filemanager"){ deskMenu->addAction( LXDG::findIcon("Insight-FileManager",""), tr("Browse System"), this, SLOT(SystemFileManager()) ); } else if(items[i]=="applications"){ deskMenu->addMenu( LSession::applicationMenu() ); } else if(items[i]=="line"){ deskMenu->addSeparator(); } else if(items[i]=="settings"){ deskMenu->addMenu( LSession::settingsMenu() ); } + else if(items[i]=="windowlist"){ deskMenu->addMenu( winMenu); usewinmenu=true;} else if(items[i].startsWith("app::::") && items[i].endsWith(".desktop")){ //Custom *.desktop application QString file = items[i].section("::::",1,1).simplified(); @@ -174,6 +184,23 @@ void LDesktop::UpdateMenu(bool fast){ deskMenu->addAction(LXDG::findIcon("system-log-out",""), tr("Log Out"), this, SLOT(SystemLogout()) ); } +void LDesktop::UpdateWinMenu(){ + winMenu->clear(); + //Get the current list of windows + QList<WId> wins = LX11::WindowList(); + //Now add them to the menu + for(int i=0; i<wins.length(); i++){ + LWinInfo info(wins[i]); + bool junk; + QAction *act = winMenu->addAction( info.icon(junk), info.text() ); + act->setData( QString::number(wins[i]) ); + } +} + +void LDesktop::winClicked(QAction* act){ + LX11::ActivateWindow( act->data().toString().toULong() ); +} + void LDesktop::UpdateDesktop(){ qDebug() << " - Update Desktop Plugins for screen:" << desktopnumber; static bool loading = false; diff --git a/lumina-desktop/LDesktop.h b/lumina-desktop/LDesktop.h index 503a820f..4843808d 100644 --- a/lumina-desktop/LDesktop.h +++ b/lumina-desktop/LDesktop.h @@ -25,7 +25,7 @@ #include <LuminaXDG.h> #include "LPanel.h" -#include "Globals.h" +//#include "Globals.h" #include "AppMenu.h" #include "desktop-plugins/LDPlugin.h" #include "desktop-plugins/LDPluginContainer.h" @@ -54,12 +54,12 @@ private: QString DPREFIX; int desktopnumber; //int xoffset; - bool defaultdesktop, desktoplocked, changingsettings, issyncing; + bool defaultdesktop, desktoplocked, changingsettings, issyncing, usewinmenu; QList<LPanel*> PANELS; QMdiArea *bgDesktop; //desktop widget area QWidget *bgWindow; //full screen background - QMenu *deskMenu; - AppMenu *appmenu; + QMenu *deskMenu, *winMenu; + //AppMenu *appmenu; QLabel *workspacelabel; QWidgetAction *wkspaceact; QList<LDPlugin*> PLUGINS; @@ -71,11 +71,14 @@ private: private slots: void SettingsChanged(); void UnlockSettings(){ issyncing=false; } + //Menu functions void UpdateMenu(bool fast = false); void ShowMenu(){ UpdateMenu(true); //run the fast version deskMenu->popup(QCursor::pos()); } + void UpdateWinMenu(); + void winClicked(QAction*); //Desktop plugin system functions void UpdateDesktop(); diff --git a/lumina-desktop/panel-plugins/taskmanager/LWinInfo.h b/lumina-desktop/LWinInfo.h index 1084e6e3..750ab508 100644 --- a/lumina-desktop/panel-plugins/taskmanager/LWinInfo.h +++ b/lumina-desktop/LWinInfo.h @@ -18,7 +18,7 @@ #include <LuminaXDG.h> // Local includes -#include "../../Globals.h" //For the STATES enumeration definition +#include "Globals.h" //For the STATES enumeration definition class LWinInfo{ @@ -47,12 +47,14 @@ public: return nm; } - QIcon icon(){ - if(window==0){ return QIcon(); } + QIcon icon(bool &noicon){ + if(window==0){ noicon = true; return QIcon();} //qDebug() << "Check for Window Icon:" << window; + noicon = false; QIcon ico = LX11::WindowIcon(window); //Check for a null icon, and supply one if necessary - //if(ico.isNull()){ ico = LXDG::findIcon("preferences-system-windows",""); } + if(ico.isNull()){ ico = LXDG::findIcon( this->Class().toLower(),""); } + if(ico.isNull()){ ico = LXDG::findIcon("preferences-system-windows",""); noicon=true;} return ico; } diff --git a/lumina-desktop/lumina-desktop.pro b/lumina-desktop/lumina-desktop.pro index 7dca44c0..f2cb7cb2 100644 --- a/lumina-desktop/lumina-desktop.pro +++ b/lumina-desktop/lumina-desktop.pro @@ -51,6 +51,7 @@ HEADERS += Globals.h \ LSession.h \ LDesktop.h \ LPanel.h \ + LWinInfo.h \ AppMenu.h \ SettingsMenu.h \ SystemWindow.h \ @@ -70,7 +71,6 @@ HEADERS += Globals.h \ panel-plugins/clock/LClock.h \ panel-plugins/battery/LBattery.h \ panel-plugins/desktopswitcher/LDesktopSwitcher.h \ - panel-plugins/taskmanager/LWinInfo.h \ panel-plugins/taskmanager/LTaskManagerPlugin.h \ panel-plugins/taskmanager/LTaskButton.h \ panel-plugins/systemdashboard/LSysDashboard.h \ diff --git a/lumina-desktop/panel-plugins/taskmanager/LTaskButton.cpp b/lumina-desktop/panel-plugins/taskmanager/LTaskButton.cpp index a605ae86..6ea7854e 100644 --- a/lumina-desktop/panel-plugins/taskmanager/LTaskButton.cpp +++ b/lumina-desktop/panel-plugins/taskmanager/LTaskButton.cpp @@ -80,7 +80,7 @@ void LTaskButton::UpdateButton(){ } if(i==0 && !statusOnly){ //Update the button visuals from the first window - this->setIcon(WINLIST[i].icon()); + this->setIcon(WINLIST[i].icon(noicon)); cname = WINLIST[i].Class(); if(cname.isEmpty()){ //Special case (chrome/chromium does not register *any* information with X except window title) @@ -88,6 +88,7 @@ void LTaskButton::UpdateButton(){ if(cname.contains(" - ")){ cname = cname.section(" - ",-1); } } this->setToolTip(cname); + /* if(this->icon().isNull()){ this->setIcon( LXDG::findIcon(cname.toLower(),"") ); if(this->icon().isNull()){ @@ -98,9 +99,10 @@ void LTaskButton::UpdateButton(){ } }else{ noicon = false; - } + }*/ } - QAction *tmp = winMenu->addAction( WINLIST[i].icon(), WINLIST[i].text() ); + bool junk; + QAction *tmp = winMenu->addAction( WINLIST[i].icon(junk), WINLIST[i].text() ); tmp->setData(i); //save which number in the WINLIST this entry is for Lumina::STATES stat = WINLIST[i].status(); if(stat==Lumina::NOTIFICATION){ showstate = stat; } //highest priority diff --git a/lumina-desktop/panel-plugins/taskmanager/LTaskButton.h b/lumina-desktop/panel-plugins/taskmanager/LTaskButton.h index 22278eba..0b2ffb05 100644 --- a/lumina-desktop/panel-plugins/taskmanager/LTaskButton.h +++ b/lumina-desktop/panel-plugins/taskmanager/LTaskButton.h @@ -21,7 +21,7 @@ #include <LuminaX11.h> // Local includes -#include "LWinInfo.h" +#include "../../LWinInfo.h" #include "../LTBWidget.h" class LTaskButton : public LTBWidget{ |