diff options
Diffstat (limited to 'lumina-desktop/panel-plugins')
10 files changed, 125 insertions, 81 deletions
diff --git a/lumina-desktop/panel-plugins/LPPlugin.h b/lumina-desktop/panel-plugins/LPPlugin.h index dd869bf6..8d1c0024 100644 --- a/lumina-desktop/panel-plugins/LPPlugin.h +++ b/lumina-desktop/panel-plugins/LPPlugin.h @@ -15,6 +15,7 @@ #include <QWidget> #include <QString> #include <QBoxLayout> +#include <QApplication> class LPPlugin : public QWidget{ Q_OBJECT @@ -34,6 +35,7 @@ public: LY->setContentsMargins(0,0,0,0); LY->setSpacing(1); this->setLayout(LY); + connect(QApplication::instance(), SIGNAL(LocaleChanged()), this, SLOT(LocaleChange()) ); } ~LPPlugin(){ diff --git a/lumina-desktop/panel-plugins/battery/LBattery.h b/lumina-desktop/panel-plugins/battery/LBattery.h index a4586b37..3d31faad 100644 --- a/lumina-desktop/panel-plugins/battery/LBattery.h +++ b/lumina-desktop/panel-plugins/battery/LBattery.h @@ -36,6 +36,10 @@ private slots: QString getRemainingTime(); public slots: + void LocaleChange(){ + updateBattery(true); + } + void OrientationChange(){ if(this->layout()->direction()==QBoxLayout::LeftToRight){ label->setFixedSize( QSize(this->height(), this->height()) ); diff --git a/lumina-desktop/panel-plugins/desktopbar/LDeskBar.cpp b/lumina-desktop/panel-plugins/desktopbar/LDeskBar.cpp index 71eaa8c4..d95ae2f5 100644 --- a/lumina-desktop/panel-plugins/desktopbar/LDeskBar.cpp +++ b/lumina-desktop/panel-plugins/desktopbar/LDeskBar.cpp @@ -53,9 +53,7 @@ LDeskBarPlugin::~LDeskBarPlugin(){ void LDeskBarPlugin::initializeDesktop(){ //Applications on the desktop appB = new QToolButton(this); - appB->setIcon( LXDG::findIcon("favorites", "") ); appB->setToolButtonStyle(Qt::ToolButtonIconOnly); - appB->setToolTip(tr("Favorite Applications")); appB->setAutoRaise(true); appB->setPopupMode(QToolButton::InstantPopup); appM = new QMenu(this); @@ -64,9 +62,7 @@ void LDeskBarPlugin::initializeDesktop(){ connect(appM,SIGNAL(triggered(QAction*)),this,SLOT(ActionTriggered(QAction*)) ); //Directories on the desktop dirB = new QToolButton(this); - dirB->setIcon( LXDG::findIcon("folder", "") ); dirB->setToolButtonStyle(Qt::ToolButtonIconOnly); - dirB->setToolTip(tr("Favorite Folders")); dirB->setAutoRaise(true); dirB->setPopupMode(QToolButton::InstantPopup); dirM = new QMenu(this); @@ -74,34 +70,29 @@ void LDeskBarPlugin::initializeDesktop(){ this->layout()->addWidget(dirB); connect(dirM,SIGNAL(triggered(QAction*)),this,SLOT(ActionTriggered(QAction*)) ); //Audio Files on the desktop - audioM = new QMenu(tr("Audio"), this); + audioM = new QMenu(this); connect(audioM,SIGNAL(triggered(QAction*)),this,SLOT(ActionTriggered(QAction*)) ); - audioM->setIcon( LXDG::findIcon("audio-x-generic","") ); //Video Files on the desktop - videoM = new QMenu(tr("Video"), this); + videoM = new QMenu(this); connect(videoM,SIGNAL(triggered(QAction*)),this,SLOT(ActionTriggered(QAction*)) ); - videoM->setIcon( LXDG::findIcon("video-x-generic","") ); //Picture Files on the desktop - pictureM = new QMenu(tr("Pictures"), this); + pictureM = new QMenu(this); connect(pictureM,SIGNAL(triggered(QAction*)),this,SLOT(ActionTriggered(QAction*)) ); - pictureM->setIcon( LXDG::findIcon("image-x-generic","") ); //Other Files on the desktop - otherM = new QMenu(tr("Other Files"), this); + otherM = new QMenu(this); connect(otherM,SIGNAL(triggered(QAction*)),this,SLOT(ActionTriggered(QAction*)) ); - otherM->setIcon( LXDG::findIcon("unknown","") ); - docM = new QMenu(tr("Documents"), this); + docM = new QMenu(this); connect(docM,SIGNAL(triggered(QAction*)), this,SLOT(ActionTriggered(QAction*)) ); - docM->setIcon( LXDG::findIcon("x-office-document","") ); //All Files Button fileB = new QToolButton(this); - fileB->setIcon( LXDG::findIcon("document-multiple", "") ); fileB->setToolButtonStyle(Qt::ToolButtonIconOnly); - fileB->setToolTip(tr("Favorite Files") ); fileB->setAutoRaise(true); fileB->setPopupMode(QToolButton::InstantPopup); fileM = new QMenu(this); fileB->setMenu(fileM); this->layout()->addWidget(fileB); + + updateIcons(); //set all the text/icons } QAction* LDeskBarPlugin::newAction(QString filepath, QString name, QString iconpath){ @@ -231,3 +222,22 @@ void LDeskBarPlugin::desktopChanged(){ fileB->setVisible( !fileM->isEmpty() ); } +void LDeskBarPlugin::updateIcons(){ + //Set all the text/icons + appB->setIcon( LXDG::findIcon("favorites", "") ); + appB->setToolTip(tr("Favorite Applications")); + dirB->setIcon( LXDG::findIcon("folder", "") ); + dirB->setToolTip(tr("Favorite Folders")); + audioM->setTitle( tr("Audio") ); + audioM->setIcon( LXDG::findIcon("audio-x-generic","") ); + videoM->setTitle( tr("Video") ); + videoM->setIcon( LXDG::findIcon("video-x-generic","") ); + pictureM->setTitle( tr("Pictures") ); + pictureM->setIcon( LXDG::findIcon("image-x-generic","") ); + otherM->setTitle( tr("Other Files") ); + otherM->setIcon( LXDG::findIcon("unknown","") ); + docM->setTitle( tr("Documents") ); + docM->setIcon( LXDG::findIcon("x-office-document","") ); + fileB->setIcon( LXDG::findIcon("document-multiple", "") ); + fileB->setToolTip(tr("Favorite Files") ); +}
\ No newline at end of file diff --git a/lumina-desktop/panel-plugins/desktopbar/LDeskBar.h b/lumina-desktop/panel-plugins/desktopbar/LDeskBar.h index 8e624dc2..57d40e4c 100644 --- a/lumina-desktop/panel-plugins/desktopbar/LDeskBar.h +++ b/lumina-desktop/panel-plugins/desktopbar/LDeskBar.h @@ -61,8 +61,14 @@ private: private slots: void ActionTriggered(QAction* act); void desktopChanged(); - + void updateIcons(); + public slots: + void LocaleChange(){ + updateIcons(); + desktopChanged(); + } + void OrientationChange(){ QSize sz; if(this->layout()->direction()==QBoxLayout::LeftToRight){ diff --git a/lumina-desktop/panel-plugins/desktopswitcher/LDesktopSwitcher.h b/lumina-desktop/panel-plugins/desktopswitcher/LDesktopSwitcher.h index bd23d8e9..5dd5a785 100644 --- a/lumina-desktop/panel-plugins/desktopswitcher/LDesktopSwitcher.h +++ b/lumina-desktop/panel-plugins/desktopswitcher/LDesktopSwitcher.h @@ -50,6 +50,10 @@ private slots: void menuActionTriggered(QAction*); public slots: + void LocaleChange(){ + createMenu(); + } + void OrientationChange(){ QSize sz; if(this->layout()->direction()==QBoxLayout::LeftToRight){ diff --git a/lumina-desktop/panel-plugins/systemdashboard/LSysDashboard.h b/lumina-desktop/panel-plugins/systemdashboard/LSysDashboard.h index 9f1c5d18..7910f452 100644 --- a/lumina-desktop/panel-plugins/systemdashboard/LSysDashboard.h +++ b/lumina-desktop/panel-plugins/systemdashboard/LSysDashboard.h @@ -50,6 +50,11 @@ private slots: void closeMenu(); public slots: + void LocaleChange(){ + updateIcon(true); + sysmenu->UpdateMenu(); + } + void OrientationChange(){ if(this->layout()->direction()==QBoxLayout::LeftToRight){ this->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding); diff --git a/lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.cpp b/lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.cpp index 0e5867c2..c45687cd 100644 --- a/lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.cpp +++ b/lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.cpp @@ -40,6 +40,7 @@ LSysMenuQuick::~LSysMenuQuick(){ } void LSysMenuQuick::UpdateMenu(){ + ui->retranslateUi(this); //Audio Volume int val = LOS::audioVolume(); QIcon ico; diff --git a/lumina-desktop/panel-plugins/userbutton/LUserButton.h b/lumina-desktop/panel-plugins/userbutton/LUserButton.h index fd87fe5e..31bafa78 100644 --- a/lumina-desktop/panel-plugins/userbutton/LUserButton.h +++ b/lumina-desktop/panel-plugins/userbutton/LUserButton.h @@ -62,6 +62,7 @@ public slots: void LocaleChange(){ updateButtonVisuals(); + usermenu->UpdateAll(); } void ThemeChange(){ diff --git a/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp b/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp index 1ea1a864..92f6178b 100644 --- a/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp +++ b/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp @@ -14,29 +14,7 @@ UserWidget::UserWidget(QWidget* parent) : QTabWidget(parent), ui(new Ui::UserWid if(parent!=0){ parent->setMouseTracking(true); } this->setMouseTracking(true); sysapps = LSession::handle()->applicationMenu()->currentAppHash(); //get the raw info - //Setup the Icons - // - favorites tab - this->setTabIcon(0, rotateIcon(LXDG::findIcon("folder-favorites","")) ); - this->setTabText(0,""); - // - apps tab - this->setTabIcon(1, rotateIcon(LXDG::findIcon("system-run","")) ); - this->setTabText(1,""); - // - home tab - this->setTabIcon(2, rotateIcon(LXDG::findIcon("user-home","")) ); - this->setTabText(2,""); - // - config tab - this->setTabIcon(3, rotateIcon(LXDG::findIcon("preferences-system","")) ); - this->setTabText(3,""); - ui->tool_fav_apps->setIcon( LXDG::findIcon("system-run","") ); - ui->tool_fav_dirs->setIcon( LXDG::findIcon("folder","") ); - ui->tool_fav_files->setIcon( LXDG::findIcon("document-multiple","") ); - ui->tool_desktopsettings->setIcon( LXDG::findIcon("preferences-desktop","") ); - ui->tool_config_screensaver->setIcon( LXDG::findIcon("preferences-desktop-screensaver","") ); - ui->tool_config_screensettings->setIcon( LXDG::findIcon("preferences-other","") ); - ui->tool_home_gohome->setIcon( LXDG::findIcon("go-home","") ); - ui->tool_home_browse->setIcon( LXDG::findIcon("document-open","") ); - ui->tool_home_search->setIcon( LXDG::findIcon("system-search","") ); - ui->tool_config_about->setIcon( LXDG::findIcon("lumina","") ); + //Connect the signals/slots connect(ui->tool_desktopsettings, SIGNAL(clicked()), this, SLOT(openDeskSettings()) ); connect(ui->tool_config_screensaver, SIGNAL(clicked()), this, SLOT(openScreenSaverConfig()) ); @@ -51,46 +29,15 @@ UserWidget::UserWidget(QWidget* parent) : QTabWidget(parent), ui(new Ui::UserWid connect(ui->tool_config_about, SIGNAL(clicked()), this, SLOT(openLuminaInfo()) ); //Setup the special buttons - QString APPSTORE = LOS::AppStoreShortcut(); - if(QFile::exists(APPSTORE) && !APPSTORE.isEmpty()){ - //Now load the info - bool ok = false; - XDGDesktop store = LXDG::loadDesktopFile(APPSTORE, ok); - if(ok){ - ui->tool_app_store->setIcon( LXDG::findIcon(store.icon, "") ); - ui->tool_app_store->setText( store.name ); - connect(ui->tool_app_store, SIGNAL(clicked()), this, SLOT(openStore()) ); - } - ui->tool_app_store->setVisible(ok); //availability - }else{ - ui->tool_app_store->setVisible(false); //not available - } - QString CONTROLPANEL = LOS::ControlPanelShortcut(); - if(QFile::exists(CONTROLPANEL) && !CONTROLPANEL.isEmpty()){ - //Now load the info - bool ok = false; - XDGDesktop cpan = LXDG::loadDesktopFile(CONTROLPANEL, ok); - if(ok){ - ui->tool_controlpanel->setIcon( LXDG::findIcon(cpan.icon, "") ); - connect(ui->tool_controlpanel, SIGNAL(clicked()), this, SLOT(openControlPanel()) ); - } - ui->tool_controlpanel->setVisible(ok); //availability - }else{ - ui->tool_controlpanel->setVisible(false); //not available - } - QString QTCONFIG = LOS::QtConfigShortcut(); - if(QFile::exists(QTCONFIG) && !QTCONFIG.isEmpty()){ - ui->tool_qtconfig->setVisible(true); - ui->tool_qtconfig->setIcon( LXDG::findIcon("preferences-desktop-theme","") ); - connect(ui->tool_qtconfig, SIGNAL(clicked()), this, SLOT(openQtConfig()) ); - }else{ - ui->tool_qtconfig->setVisible(false); - } + connect(ui->tool_app_store, SIGNAL(clicked()), this, SLOT(openStore()) ); + connect(ui->tool_controlpanel, SIGNAL(clicked()), this, SLOT(openControlPanel()) ); + connect(ui->tool_qtconfig, SIGNAL(clicked()), this, SLOT(openQtConfig()) ); + lastUpdate = QDateTime(); //make sure it refreshes connect(LSession::handle()->applicationMenu(), SIGNAL(AppMenuUpdated()), this, SLOT(UpdateMenu()) ); connect(QApplication::instance(), SIGNAL(DesktopFilesChanged()), this, SLOT(updateFavItems()) ); - QTimer::singleShot(10,this, SLOT(UpdateMenu())); //make sure to load this once after initialization + QTimer::singleShot(10,this, SLOT(UpdateAll())); //make sure to load this once after initialization } UserWidget::~UserWidget(){ @@ -152,7 +99,70 @@ QIcon UserWidget::rotateIcon(QIcon ico){ //============ // PRIVATE SLOTS //============ -void UserWidget::UpdateMenu(){ +void UserWidget::UpdateAll(){ + ui->retranslateUi(this); + //Setup the Icons + // - favorites tab + this->setTabIcon(0, rotateIcon(LXDG::findIcon("folder-favorites","")) ); + this->setTabText(0,""); + // - apps tab + this->setTabIcon(1, rotateIcon(LXDG::findIcon("system-run","")) ); + this->setTabText(1,""); + // - home tab + this->setTabIcon(2, rotateIcon(LXDG::findIcon("user-home","")) ); + this->setTabText(2,""); + // - config tab + this->setTabIcon(3, rotateIcon(LXDG::findIcon("preferences-system","")) ); + this->setTabText(3,""); + ui->tool_fav_apps->setIcon( LXDG::findIcon("system-run","") ); + ui->tool_fav_dirs->setIcon( LXDG::findIcon("folder","") ); + ui->tool_fav_files->setIcon( LXDG::findIcon("document-multiple","") ); + ui->tool_desktopsettings->setIcon( LXDG::findIcon("preferences-desktop","") ); + ui->tool_config_screensaver->setIcon( LXDG::findIcon("preferences-desktop-screensaver","") ); + ui->tool_config_screensettings->setIcon( LXDG::findIcon("preferences-other","") ); + ui->tool_home_gohome->setIcon( LXDG::findIcon("go-home","") ); + ui->tool_home_browse->setIcon( LXDG::findIcon("document-open","") ); + ui->tool_home_search->setIcon( LXDG::findIcon("system-search","") ); + ui->tool_config_about->setIcon( LXDG::findIcon("lumina","") ); + + //Setup the special buttons + QString APPSTORE = LOS::AppStoreShortcut(); + if(QFile::exists(APPSTORE) && !APPSTORE.isEmpty()){ + //Now load the info + bool ok = false; + XDGDesktop store = LXDG::loadDesktopFile(APPSTORE, ok); + if(ok){ + ui->tool_app_store->setIcon( LXDG::findIcon(store.icon, "") ); + ui->tool_app_store->setText( store.name ); + } + ui->tool_app_store->setVisible(ok); //availability + }else{ + ui->tool_app_store->setVisible(false); //not available + } + QString CONTROLPANEL = LOS::ControlPanelShortcut(); + if(QFile::exists(CONTROLPANEL) && !CONTROLPANEL.isEmpty()){ + //Now load the info + bool ok = false; + XDGDesktop cpan = LXDG::loadDesktopFile(CONTROLPANEL, ok); + if(ok){ + ui->tool_controlpanel->setIcon( LXDG::findIcon(cpan.icon, "") ); + } + ui->tool_controlpanel->setVisible(ok); //availability + }else{ + ui->tool_controlpanel->setVisible(false); //not available + } + QString QTCONFIG = LOS::QtConfigShortcut(); + if(QFile::exists(QTCONFIG) && !QTCONFIG.isEmpty()){ + ui->tool_qtconfig->setVisible(true); + ui->tool_qtconfig->setIcon( LXDG::findIcon("preferences-desktop-theme","") ); + }else{ + ui->tool_qtconfig->setVisible(false); + } + //Now update the menus + UpdateMenu(); +} + +void UserWidget::UpdateMenu(bool forceall){ this->setCurrentWidget(ui->tab_fav); ui->tool_fav_apps->setChecked(true); ui->tool_fav_dirs->setChecked(false); @@ -160,15 +170,15 @@ void UserWidget::UpdateMenu(){ cfav = 0; //favorite apps updateFavItems(); QString cdir = ui->label_home_dir->whatsThis(); - if(cdir.isEmpty() || !QFile::exists(cdir) ){ + if(cdir.isEmpty() || !QFile::exists(cdir)){ //Directory deleted or nothing loaded yet ui->label_home_dir->setWhatsThis(QDir::homePath()); QTimer::singleShot(0,this, SLOT(updateHome()) ); - }else if( lastUpdate < QFileInfo(cdir).lastModified() ){ + }else if( lastUpdate < QFileInfo(cdir).lastModified() || forceall){ //Directory contents changed - reload it QTimer::singleShot(0,this, SLOT(updateHome()) ); } - if(lastUpdate < LSession::handle()->applicationMenu()->lastHashUpdate || lastUpdate.isNull()){ + if(lastUpdate < LSession::handle()->applicationMenu()->lastHashUpdate || lastUpdate.isNull() || forceall){ updateAppCategories(); QTimer::singleShot(0,this, SLOT(updateApps()) ); } diff --git a/lumina-desktop/panel-plugins/userbutton/UserWidget.h b/lumina-desktop/panel-plugins/userbutton/UserWidget.h index c2df10bf..6d01e940 100644 --- a/lumina-desktop/panel-plugins/userbutton/UserWidget.h +++ b/lumina-desktop/panel-plugins/userbutton/UserWidget.h @@ -37,7 +37,8 @@ public: ~UserWidget(); public slots: - void UpdateMenu(); + void UpdateAll(); //for re-translation/icon changes + void UpdateMenu(bool forceall = false); //for item changes private: Ui::UserWidget *ui; |