aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core-utils/lumina-config/AppDialog.h
diff options
context:
space:
mode:
authorArnar Mar Sig <antab@antab.is>2017-02-03 21:08:23 +0000
committerArnar Mar Sig <antab@antab.is>2017-02-03 21:08:23 +0000
commitf08f30ab10bd67bb97db480cbac062d1dfc57c85 (patch)
tree0a0e923668a586cea2834f5b42ef496676a8779a /src-qt5/core-utils/lumina-config/AppDialog.h
parentAnother large batch of work on Lumina2: (diff)
downloadlumina-f08f30ab10bd67bb97db480cbac062d1dfc57c85.tar.gz
lumina-f08f30ab10bd67bb97db480cbac062d1dfc57c85.tar.bz2
lumina-f08f30ab10bd67bb97db480cbac062d1dfc57c85.zip
Change the app selection comboBox to list and add search feature.
Allow double clicking the app to select it.
Diffstat (limited to 'src-qt5/core-utils/lumina-config/AppDialog.h')
-rw-r--r--src-qt5/core-utils/lumina-config/AppDialog.h34
1 files changed, 31 insertions, 3 deletions
diff --git a/src-qt5/core-utils/lumina-config/AppDialog.h b/src-qt5/core-utils/lumina-config/AppDialog.h
index ea7615e2..4eb6471c 100644
--- a/src-qt5/core-utils/lumina-config/AppDialog.h
+++ b/src-qt5/core-utils/lumina-config/AppDialog.h
@@ -26,10 +26,15 @@ public:
AppDialog(QWidget *parent = 0) : QDialog(parent), ui(new Ui::AppDialog){
ui->setupUi(this); //load the designer file
appreset = false;
- ui->comboBox->clear();
+ ui->listApps->clear();
QList<XDGDesktop*> APPS = LXDG::sortDesktopNames(APPSLIST->apps(false,false)); //Don't show all/hidden
for(int i=0; i<APPS.length(); i++){
- ui->comboBox->addItem( LXDG::findIcon(APPS[i]->icon,"application-x-executable"), APPS[i]->name, APPS[i]->filePath);
+ QListWidgetItem *app = new QListWidgetItem(LXDG::findIcon(APPS[i]->icon,"application-x-executable"), APPS[i]->name);
+ app->setData(Qt::UserRole, APPS[i]->filePath);
+ ui->listApps->addItem(app);
+ }
+ if(ui->listApps->count()){
+ ui->listApps->setCurrentItem(ui->listApps->item(0));
}
this->setWindowIcon( LXDG::findIcon("system-search","") );
if(parent!=0){
@@ -56,7 +61,10 @@ public:
private slots:
void on_buttonBox_accepted(){
- appselected = ui->comboBox->currentData().toString();
+ QListWidgetItem *item = ui->listApps->currentItem();
+ if(item != nullptr){
+ appselected = item->data(Qt::UserRole).toString();
+ }
this->close();
}
void on_buttonBox_rejected(){
@@ -68,6 +76,26 @@ private slots:
this->close();
}
}
+ void on_listApps_itemDoubleClicked(QListWidgetItem *item){
+ appselected = item->data(Qt::UserRole).toString();
+ this->close();
+ }
+ void on_lineSearch_textChanged(const QString &term){
+ QListWidgetItem *first_visible = nullptr;
+ for(int i = 0; i < ui->listApps->count(); i++){
+ QListWidgetItem *item = ui->listApps->item(i);
+ bool visible = item->text().contains(term, Qt::CaseInsensitive);
+ item->setHidden(!visible);
+ if(visible && first_visible == nullptr){
+ first_visible = item;
+ }
+ }
+ //Select the first app
+ ui->listApps->setCurrentItem(first_visible);
+ if(first_visible != nullptr){
+ ui->listApps->scrollToItem(first_visible);
+ }
+ }
};
#endif
bgstack15