aboutsummaryrefslogtreecommitdiff
path: root/lumina-desktop/panel-plugins/userbutton
diff options
context:
space:
mode:
authorKen Moore <ken@pcbsd.org>2014-09-15 12:31:25 -0400
committerKen Moore <ken@pcbsd.org>2014-09-15 12:31:25 -0400
commit13c418eadd33bbbeb91146c0d3e3008fc1bcfe59 (patch)
tree9ac7d683e3557342c35feaf648e8bb4b3793ca57 /lumina-desktop/panel-plugins/userbutton
parentHave lumina-fm save/remember the last-used size and open itself with that siz... (diff)
downloadlumina-13c418eadd33bbbeb91146c0d3e3008fc1bcfe59.tar.gz
lumina-13c418eadd33bbbeb91146c0d3e3008fc1bcfe59.tar.bz2
lumina-13c418eadd33bbbeb91146c0d3e3008fc1bcfe59.zip
Update the Lumina user button a bit:
1) Add a new "All" category that is shown by default for listing applications. 2) Speed up the time to open the user menu by only reloading if more than 30 seconds have passed since the previous time it was opened.
Diffstat (limited to 'lumina-desktop/panel-plugins/userbutton')
-rw-r--r--lumina-desktop/panel-plugins/userbutton/UserWidget.cpp30
-rw-r--r--lumina-desktop/panel-plugins/userbutton/UserWidget.h2
2 files changed, 20 insertions, 12 deletions
diff --git a/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp b/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp
index 8b49ed43..1571760b 100644
--- a/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp
+++ b/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp
@@ -75,7 +75,8 @@ UserWidget::UserWidget(QWidget* parent) : QWidget(parent), ui(new Ui::UserWidget
}else{
ui->tool_qtconfig->setVisible(false);
}
-
+ lastUpdate = QDateTime::currentDateTime().addSecs(-30); //make sure it refreshes
+ QTimer::singleShot(10,this, SLOT(UpdateMenu())); //make sure to load this once after initialization
}
UserWidget::~UserWidget(){
@@ -100,15 +101,19 @@ void UserWidget::ClearScrollArea(QScrollArea *area){
// PRIVATE SLOTS
//============
void UserWidget::UpdateMenu(){
- ui->tabWidget->setCurrentWidget(ui->tab_fav);
- ui->tool_fav_apps->setChecked(true);
- ui->tool_fav_dirs->setChecked(false);
- ui->tool_fav_files->setChecked(false);
- cfav = 0; //favorite apps
- updateFavItems();
- updateHome();
- updateAppCategories();
- updateApps();
+ if(QDateTime::currentDateTime() > lastUpdate.addSecs(30)){
+ //Only re-arrange/reload things if not rapidly re-run
+ ui->tabWidget->setCurrentWidget(ui->tab_fav);
+ ui->tool_fav_apps->setChecked(true);
+ ui->tool_fav_dirs->setChecked(false);
+ ui->tool_fav_files->setChecked(false);
+ cfav = 0; //favorite apps
+ updateFavItems();
+ updateHome();
+ updateAppCategories();
+ updateApps();
+ }
+ lastUpdate = QDateTime::currentDateTime();
}
void UserWidget::LaunchItem(QString cmd){
@@ -170,7 +175,8 @@ void UserWidget::updateAppCategories(){
cats.sort();
for(int i=0; i<cats.length(); i++){
QString name, icon;
- if(cats[i] == "Multimedia"){ name = tr("Multimedia"); icon = "applications-multimedia"; }
+ if(cats[i] == "All"){ name = tr("All"); icon = "application-x-executable"; }
+ else if(cats[i] == "Multimedia"){ name = tr("Multimedia"); icon = "applications-multimedia"; }
else if(cats[i] == "Development"){ name = tr("Development"); icon = "applications-development"; }
else if(cats[i] == "Education"){ name = tr("Education"); icon = "applications-education"; }
else if(cats[i] == "Game"){ name = tr("Games"); icon = "applications-games"; }
@@ -180,7 +186,7 @@ void UserWidget::updateAppCategories(){
else if(cats[i] == "Science"){ name = tr("Science"); icon = "applications-science"; }
else if(cats[i] == "Settings"){ name = tr("Settings"); icon = "preferences-system"; }
else if(cats[i] == "System"){ name = tr("System"); icon = "applications-system"; }
- else if(cats[i] == "Utility"){ name = tr("Utility"); icon = "applications-utilities"; }
+ else if(cats[i] == "Utility"){ name = tr("Utilities"); icon = "applications-utilities"; }
else{ name = tr("Unsorted"); icon = "applications-other"; }
ui->combo_app_cats->addItem( LXDG::findIcon(icon,""), name, cats[i] );
}
diff --git a/lumina-desktop/panel-plugins/userbutton/UserWidget.h b/lumina-desktop/panel-plugins/userbutton/UserWidget.h
index b9eaffbe..0b42bff8 100644
--- a/lumina-desktop/panel-plugins/userbutton/UserWidget.h
+++ b/lumina-desktop/panel-plugins/userbutton/UserWidget.h
@@ -15,6 +15,7 @@
#include <QHash>
#include <QVBoxLayout>
#include <QScrollArea>
+#include <QDateTime>
#include <LuminaXDG.h>
#include <LuminaOS.h>
@@ -40,6 +41,7 @@ public:
private:
Ui::UserWidget *ui;
QHash<QString, QList<XDGDesktop> > *sysapps;
+ QDateTime lastUpdate;
int cfav; //current favorite category
void ClearScrollArea(QScrollArea *area);
bgstack15