aboutsummaryrefslogtreecommitdiff
path: root/src-qt5
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5')
-rw-r--r--src-qt5/core-utils/lumina-config/AppDialog.h34
-rw-r--r--src-qt5/core-utils/lumina-config/AppDialog.ui42
-rw-r--r--src-qt5/core-utils/lumina-config/pages/page_interface_panels.cpp35
3 files changed, 58 insertions, 53 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
diff --git a/src-qt5/core-utils/lumina-config/AppDialog.ui b/src-qt5/core-utils/lumina-config/AppDialog.ui
index 63323f7d..ec7de974 100644
--- a/src-qt5/core-utils/lumina-config/AppDialog.ui
+++ b/src-qt5/core-utils/lumina-config/AppDialog.ui
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>348</width>
- <height>91</height>
+ <height>300</height>
</rect>
</property>
<property name="windowTitle">
@@ -15,46 +15,14 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
- <spacer name="verticalSpacer_2">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QComboBox" name="comboBox">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="iconSize">
- <size>
- <width>32</width>
- <height>32</height>
- </size>
+ <widget class="QLineEdit" name="lineSearch">
+ <property name="placeholderText">
+ <string>Search for....</string>
</property>
</widget>
</item>
<item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
+ <widget class="QListWidget" name="listApps"/>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
diff --git a/src-qt5/core-utils/lumina-config/pages/page_interface_panels.cpp b/src-qt5/core-utils/lumina-config/pages/page_interface_panels.cpp
index 827061af..3c355aa7 100644
--- a/src-qt5/core-utils/lumina-config/pages/page_interface_panels.cpp
+++ b/src-qt5/core-utils/lumina-config/pages/page_interface_panels.cpp
@@ -21,6 +21,13 @@ page_interface_panels::page_interface_panels(QWidget *parent) : PageWidget(paren
connect(ui->tool_panels_add, SIGNAL(clicked()), this, SLOT(newPanel()) );
updateIcons();
setupProfiles();
+
+ //Create panels container
+ QHBoxLayout *panels_layout = new QHBoxLayout();
+ panels_layout->setContentsMargins(0,0,0,0);
+ panels_layout->setAlignment(Qt::AlignLeft);
+ panels_layout->addStretch();
+ ui->scroll_panels->widget()->setLayout(panels_layout);
}
page_interface_panels::~page_interface_panels(){
@@ -53,28 +60,30 @@ void page_interface_panels::LoadSettings(int screennum){
QString screenID = QApplication::screens().at(cscreen)->name();
QString DPrefix = "desktop-"+screenID+"/";
int panelnumber = settings->value(DPrefix+"panels",-1).toInt();
+ QBoxLayout *panels_layout = static_cast<QHBoxLayout*>(ui->scroll_panels->widget()->layout());
-//First clean any current panels
- for(int i=0; i<PANELS.length(); i++){ delete PANELS.takeAt(i); i--; }
- //Now create new panels
- if(ui->scroll_panels->widget()->layout()==0){
- ui->scroll_panels->widget()->setLayout( new QHBoxLayout() );
- ui->scroll_panels->widget()->layout()->setContentsMargins(0,0,0,0);
+ //Remove extra panels (if any)
+ for(int i=panelnumber; i<PANELS.length(); i++){
+ PanelWidget *tmp = PANELS.takeAt(i);
+ delete tmp;
+ i--;
}
- ui->scroll_panels->widget()->layout()->setAlignment(Qt::AlignLeft);
- //Clear anything left over in the layout
- for(int i=0; i<ui->scroll_panels->widget()->layout()->count(); i++){
- delete ui->scroll_panels->widget()->layout()->takeAt(i);
+
+ int current_count = panels_layout->count()-1;
+
+ //Update current panels
+ for(int i=0; i<current_count; i++) {
+ PANELS[i]->LoadSettings(settings, cscreen, i);
}
- for(int i=0; i<panelnumber; i++){
+ //Create new panels
+ for(int i=current_count; i<panelnumber; i++){
PanelWidget *tmp = new PanelWidget(ui->scroll_panels->widget(), this, PINFO);
tmp->LoadSettings(settings, cscreen, i);
PANELS << tmp;
connect(tmp, SIGNAL(PanelChanged()), this, SLOT(panelValChanged()) );
connect(tmp, SIGNAL(PanelRemoved(int)), this, SLOT(removePanel(int)) );
- ui->scroll_panels->widget()->layout()->addWidget(tmp);
+ panels_layout->insertWidget(panels_layout->count()-1, tmp);
}
- static_cast<QHBoxLayout*>(ui->scroll_panels->widget()->layout())->addStretch();
QApplication::processEvents();
loading = false;
bgstack15