From 190781e33b6a94b0708a76fa3a2b8d6a50bf7107 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Mon, 27 Jun 2016 13:03:08 -0400 Subject: Add in the search capabilities within the new lumina-config UI. --- src-qt5/core-utils/lumina-config/KeyCatch.h | 106 --------------------- src-qt5/core-utils/lumina-config/KeyCatch.ui | 88 ----------------- src-qt5/core-utils/lumina-config/lumina-config.pro | 4 +- src-qt5/core-utils/lumina-config/main.cpp | 4 +- .../core-utils/lumina-config/pages/page_main.cpp | 21 ++-- src-qt5/core-utils/lumina-config/pages/page_main.h | 1 + .../core-utils/lumina-config/pages/page_main.ui | 14 ++- 7 files changed, 31 insertions(+), 207 deletions(-) delete mode 100644 src-qt5/core-utils/lumina-config/KeyCatch.h delete mode 100644 src-qt5/core-utils/lumina-config/KeyCatch.ui (limited to 'src-qt5/core-utils') diff --git a/src-qt5/core-utils/lumina-config/KeyCatch.h b/src-qt5/core-utils/lumina-config/KeyCatch.h deleted file mode 100644 index 03193972..00000000 --- a/src-qt5/core-utils/lumina-config/KeyCatch.h +++ /dev/null @@ -1,106 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2014, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -// This is the dialog for catching keyboard events and converting them to X11 keycodes -//=========================================== -#ifndef _LUMINA_FILE_MANAGER_KEY_CATCH_DIALOG_H -#define _LUMINA_FILE_MANAGER_KEY_CATCH_DIALOG_H - -// Qt includes -#include -#include -#include -#include - -#include "ui_KeyCatch.h" - -namespace Ui{ - class KeyCatch; -}; - -class KeyCatch : public QDialog{ - Q_OBJECT - -private: - Ui::KeyCatch *ui; - QList mods; -public: - QString xkeys, qkeys; - bool cancelled; - - KeyCatch(QWidget *parent = 0) : QDialog(parent), ui(new Ui::KeyCatch){ - ui->setupUi(this); - mods << Qt::Key_Escape << Qt::Key_Tab << Qt::Key_Enter << Qt::Key_Return << Qt::Key_Shift << Qt::Key_Control << Qt::Key_Meta << Qt::Key_Alt; - cancelled=true; //assume cancelled in case the user closes the window - this->show(); - this->grabKeyboard(); //will automatically release when the window closes - } - ~KeyCatch(){} - -private slots: - void on_buttonBox_rejected(){ - cancelled=true; - this->close(); - } - -protected: - void keyPressEvent(QKeyEvent *event){ - //Don't catch if the main key is a modifier (shift,ctrl,alt,other..) - if(event->key()==0 && event->nativeVirtualKey()==0){ return; } //invalid "special" key - else if( !mods.contains(event->key()) ){ - //Get the modifiers first (if any) - if(!QKeySequence(event->modifiers()).toString().isEmpty()){// && event->nativeModifiers()!=16){ - if(event->modifiers()!=Qt::KeypadModifier){ - qkeys = QKeySequence(event->modifiers()).toString(); - } - - /*//Ignore modifiers that result in a different keycode entirely (shift+a != (shift) + (a) ) - if(event->modifiers()!=Qt::ShiftModifier && event->modifiers()!=Qt::KeypadModifier){ - //Convert the modifier to the fluxbox equivilent - QStringList mod = qkeys.split("+"); - for(int i=0; ikey()==0){ - if(qkeys.isEmpty()){ qkeys="None "; } //For Fluxbox, need "None " - qkeys.append( QString::number(event->nativeVirtualKey()) ); - }else{ - qkeys.append( QKeySequence(event->key()).toString() ); //also save the text version (for display) - } - //Remove the modifier if it is only "shift", and the main key is not a symbol - xkeys = qkeys; - qkeys.remove("None "); //The display/Qt keycode does not need to show this - if(!xkeys.section(" ",-1).isEmpty() && xkeys.contains("Shift ")){ - if(!xkeys.section(" ",-1).at(0).isLetter()){ - xkeys.remove("Shift "); //The symbol/keycode is already different - qkeys.remove("Shift "); - } - } - qDebug() << "Found Key Press:"; - qDebug() << " - Native Virtual Key:" << event->nativeVirtualKey(); - qDebug() << " - Qt Key Sequence:" << QKeySequence(event->key()).toString(); - qDebug() << " - Full Detected Sequence (Display):" << qkeys; - qDebug() << " - Full Detected Sequence (backend):" << xkeys; - //Now close the dialog - cancelled=false; - this->close(); - } - } - -}; - -#endif diff --git a/src-qt5/core-utils/lumina-config/KeyCatch.ui b/src-qt5/core-utils/lumina-config/KeyCatch.ui deleted file mode 100644 index 99f4095d..00000000 --- a/src-qt5/core-utils/lumina-config/KeyCatch.ui +++ /dev/null @@ -1,88 +0,0 @@ - - - KeyCatch - - - - 0 - 0 - 439 - 147 - - - - Key Press Detection - - - false - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - 75 - true - - - - Press the keys you wish to assign. - - - Qt::AlignCenter - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Notes: -Special keys can only be detected if the proper keyboard driver is in use. -Current keyboard bindings will also be ignored. - - - Qt::AlignCenter - - - true - - - - - - - QDialogButtonBox::Cancel - - - - - - - - diff --git a/src-qt5/core-utils/lumina-config/lumina-config.pro b/src-qt5/core-utils/lumina-config/lumina-config.pro index 4560036c..f7359df9 100644 --- a/src-qt5/core-utils/lumina-config/lumina-config.pro +++ b/src-qt5/core-utils/lumina-config/lumina-config.pro @@ -22,7 +22,6 @@ SOURCES += main.cpp \ HEADERS += mainUI.h \ mainWindow.h \ LPlugins.h \ - KeyCatch.h \ AppDialog.h \ ColorDialog.h \ ThemeDialog.h \ @@ -31,7 +30,6 @@ HEADERS += mainUI.h \ FORMS += mainUI.ui \ mainWindow.ui \ - KeyCatch.ui \ AppDialog.ui \ ColorDialog.ui \ ThemeDialog.ui \ @@ -45,7 +43,7 @@ include("pages/pages.pri") LIBS += -lLuminaUtils -DEPENDPATH += ../libLumina +DEPENDPATH += ../../core/libLumina TRANSLATIONS = i18n/lumina-config_af.ts \ i18n/lumina-config_ar.ts \ diff --git a/src-qt5/core-utils/lumina-config/main.cpp b/src-qt5/core-utils/lumina-config/main.cpp index a63e0fbe..20d517b2 100644 --- a/src-qt5/core-utils/lumina-config/main.cpp +++ b/src-qt5/core-utils/lumina-config/main.cpp @@ -19,8 +19,8 @@ int main(int argc, char ** argv) LuminaThemeEngine theme(&a); - MainUI w; - //mainWindow w; + //MainUI w; + mainWindow w; QObject::connect(&a, SIGNAL(InputsAvailable(QStringList)), &w, SLOT(slotSingleInstance()) ); QObject::connect(&theme, SIGNAL(updateIcons()), &w, SLOT(setupIcons()) ); w.show(); diff --git a/src-qt5/core-utils/lumina-config/pages/page_main.cpp b/src-qt5/core-utils/lumina-config/pages/page_main.cpp index c853f06c..02065b78 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_main.cpp +++ b/src-qt5/core-utils/lumina-config/pages/page_main.cpp @@ -14,6 +14,7 @@ page_main::page_main(QWidget *parent) : PageWidget(parent), ui(new Ui::page_main()){ ui->setupUi(this); connect(ui->treeWidget, SIGNAL(itemActivated(QTreeWidgetItem*,int)), this, SLOT(itemTriggered(QTreeWidgetItem*)) ); + connect(ui->lineEdit, SIGNAL(textChanged(QString)), this, SLOT(searchChanged(QString)) ); } page_main::~page_main(){ @@ -36,13 +37,17 @@ void page_main::UpdateItems(QString search){ apps->setIcon(0, LXDG::findIcon("preferences-desktop-filetype-association","")); apps->setText(0, tr("Application Settings")); //Now go through and add in the known pages for each category + QStringList SL = search.split(" "); //search list for(int i=0; itreeWidget->addTopLevelItem(it); } } //Now add the categories to the tree widget if they are non-empty - if(interface->childCount()>0){ ui->treeWidget->addTopLevelItem(interface); } - if(appearance->childCount()>0){ ui->treeWidget->addTopLevelItem(appearance); } - if(session->childCount()>0){ ui->treeWidget->addTopLevelItem(session); } - if(apps->childCount()>0){ ui->treeWidget->addTopLevelItem(apps); } + if(interface->childCount()>0){ ui->treeWidget->addTopLevelItem(interface); interface->setExpanded(true); } + if(appearance->childCount()>0){ ui->treeWidget->addTopLevelItem(appearance); appearance->setExpanded(true); } + if(session->childCount()>0){ ui->treeWidget->addTopLevelItem(session); session->setExpanded(true); } + if(apps->childCount()>0){ ui->treeWidget->addTopLevelItem(apps); apps->setExpanded(true); } } //================ @@ -93,3 +98,7 @@ void page_main::itemTriggered(QTreeWidgetItem *it){ emit ChangePage(it->whatsThis(0)); } } + +void page_main::searchChanged(QString txt){ + UpdateItems(txt.simplified()); +} diff --git a/src-qt5/core-utils/lumina-config/pages/page_main.h b/src-qt5/core-utils/lumina-config/pages/page_main.h index 0b24b6da..2e38eb64 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_main.h +++ b/src-qt5/core-utils/lumina-config/pages/page_main.h @@ -32,5 +32,6 @@ private: private slots: void itemTriggered(QTreeWidgetItem*); + void searchChanged(QString); }; #endif diff --git a/src-qt5/core-utils/lumina-config/pages/page_main.ui b/src-qt5/core-utils/lumina-config/pages/page_main.ui index 3d9626c1..2331152b 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_main.ui +++ b/src-qt5/core-utils/lumina-config/pages/page_main.ui @@ -15,19 +15,29 @@ - 0 + 2 0 - 0 + 2 0 + + + + Search for.... + + + + + Qt::NoFocus + QTreeWidget{background: transparent; } -- cgit