diff options
Diffstat (limited to 'src-qt5/core-utils/lumina-config')
-rw-r--r-- | src-qt5/core-utils/lumina-config/KeyCatch.h | 106 | ||||
-rw-r--r-- | src-qt5/core-utils/lumina-config/KeyCatch.ui | 88 | ||||
-rw-r--r-- | src-qt5/core-utils/lumina-config/lumina-config.pro | 4 | ||||
-rw-r--r-- | src-qt5/core-utils/lumina-config/main.cpp | 4 | ||||
-rw-r--r-- | src-qt5/core-utils/lumina-config/pages/page_main.cpp | 21 | ||||
-rw-r--r-- | src-qt5/core-utils/lumina-config/pages/page_main.h | 1 | ||||
-rw-r--r-- | src-qt5/core-utils/lumina-config/pages/page_main.ui | 14 |
7 files changed, 31 insertions, 207 deletions
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 <QDialog> -#include <QKeyEvent> -#include <QString> -#include <QDebug> - -#include "ui_KeyCatch.h" - -namespace Ui{ - class KeyCatch; -}; - -class KeyCatch : public QDialog{ - Q_OBJECT - -private: - Ui::KeyCatch *ui; - QList<int> 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; i<mod.length(); i++){ - QString key = mod[i].toLower(); - if(key=="shift"){} //this is also a valid fluxbox code - else if(key=="meta"){ key = "Mod4"; } - else if(key=="ctrl"){ key = "control"; } - else if(key=="alt"){ key = "Mod1"; } - else{ key.clear(); } //unknown fluxbox modifier - if(!key.isEmpty()){ xkeys.append(key+" "); } - } - }*/ - - } - //Now get the main key - qkeys.replace("+"," "); - if(event->key()==0){ - if(qkeys.isEmpty()){ qkeys="None "; } //For Fluxbox, need "None <X Key number>" - 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 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>KeyCatch</class> - <widget class="QDialog" name="KeyCatch"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>439</width> - <height>147</height> - </rect> - </property> - <property name="windowTitle"> - <string>Key Press Detection</string> - </property> - <property name="modal"> - <bool>false</bool> - </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="QLabel" name="label"> - <property name="font"> - <font> - <weight>75</weight> - <bold>true</bold> - </font> - </property> - <property name="text"> - <string>Press the keys you wish to assign.</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </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> - </item> - <item> - <widget class="QLabel" name="label_2"> - <property name="text"> - <string>Notes: -Special keys can only be detected if the proper keyboard driver is in use. -Current keyboard bindings will also be ignored.</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - <property name="wordWrap"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QDialogButtonBox" name="buttonBox"> - <property name="standardButtons"> - <set>QDialogButtonBox::Cancel</set> - </property> - </widget> - </item> - </layout> - </widget> - <resources/> - <connections/> -</ui> 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; i<INFO.length(); i++){ if(!search.isEmpty() ){ //See if this item needs to be included or not QStringList info; info << INFO[i].name.split(" ") << INFO[i].title.split(" ") << INFO[i].comment.split(" ") << INFO[i].search_tags; info.removeDuplicates(); //remove any duplicate terms/info first - info << search.split(" "); //add the terms we want to search for - if(0<info.removeDuplicates()){ continue; } //no duplicates between search terms and available info + bool ok = true; + for(int s=0; s<SL.length() && ok; s++){ + ok = !info.filter(SL[s]).isEmpty(); + } + if(!ok){ continue; } //no duplicates between search terms and available info } qDebug() << "Item Found:" << INFO[i].id << INFO[i].title; QTreeWidgetItem *it = new QTreeWidgetItem(); @@ -58,10 +63,10 @@ void page_main::UpdateItems(QString search){ else{ ui->treeWidget->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 @@ </property> <layout class="QVBoxLayout" name="verticalLayout"> <property name="leftMargin"> - <number>0</number> + <number>2</number> </property> <property name="topMargin"> <number>0</number> </property> <property name="rightMargin"> - <number>0</number> + <number>2</number> </property> <property name="bottomMargin"> <number>0</number> </property> <item> + <widget class="QLineEdit" name="lineEdit"> + <property name="placeholderText"> + <string>Search for....</string> + </property> + </widget> + </item> + <item> <widget class="QTreeWidget" name="treeWidget"> + <property name="focusPolicy"> + <enum>Qt::NoFocus</enum> + </property> <property name="styleSheet"> <string notr="true">QTreeWidget{background: transparent; }</string> </property> |