diff options
Diffstat (limited to 'src-qt5/core-utils')
4 files changed, 91 insertions, 34 deletions
diff --git a/src-qt5/core-utils/lumina-config/pages/getPage.h b/src-qt5/core-utils/lumina-config/pages/getPage.h index f77a72c8..fba3998b 100644 --- a/src-qt5/core-utils/lumina-config/pages/getPage.h +++ b/src-qt5/core-utils/lumina-config/pages/getPage.h @@ -26,19 +26,30 @@ static QList<PAGEINFO> KnownPages(){ // Valid Groups: ["appearance", "interface", "session", "user"] QList<PAGEINFO> list; //Reminder: <ID>, <name>, <title>, <icon>, <comment>, <category>, <server subsytem list>, <search tags> - list << PageInfo("wallpaper", QObject::tr("Change Wallpaper"), QObject::tr("Wallpaper Settings"), "preferences-desktop-wallpaper",QObject::tr("Change background image(s)"), "appearance", QStringList(), QStringList() << "background" << "wallpaper" << "color" << "image"); - list << PageInfo("theme", QObject::tr("Change Desktop Theme"), QObject::tr("Theme Settings"), "preferences-desktop-theme",QObject::tr("Change interface fonts and colors"), "appearance", QStringList(), QStringList() << "background" << "interface" << "color" << "theme" << "plugins"); + list << PageInfo("wallpaper", QObject::tr("Wallpaper"), QObject::tr("Wallpaper Settings"), "preferences-desktop-wallpaper",QObject::tr("Change background image(s)"), "appearance", QStringList(), QStringList() << "background" << "wallpaper" << "color" << "image"); + list << PageInfo("theme", QObject::tr("Theme"), QObject::tr("Theme Settings"), "preferences-desktop-theme",QObject::tr("Change interface fonts and colors"), "appearance", QStringList(), QStringList() << "background" << "interface" << "color" << "theme" << "plugins"); list << PageInfo("compton", QObject::tr("Window Effects"), QObject::tr("Window Effects"), "window-duplicate",QObject::tr("Adjust transparency levels and window effects"), "appearance", QStringList(), QStringList() << "background" << "interface" << "color" << "transparency" << "windows" << "compositing"); - list << PageInfo("autostart", QObject::tr("Startup Services and Applications"), QObject::tr("Startup Settings"), "preferences-system-session-services",QObject::tr("Automatically start applications or services"), "session", QStringList(), QStringList() << "apps" << "autostart" << "services" << "xdg" << "startup" << "session"); - list << PageInfo("defaultapps", QObject::tr("Default Applications for File Type"), QObject::tr("Mimetype Settings"), "preferences-desktop-default-applications",QObject::tr("Change default applications"), "session", QStringList(), QStringList() << "apps" << "default" << "services" << "xdg" << "session"); + list << PageInfo("autostart", QObject::tr("Autostart"), QObject::tr("Startup Settings"), "preferences-system-session-services",QObject::tr("Automatically start applications or services"), "session", QStringList(), QStringList() << "apps" << "autostart" << "services" << "xdg" << "startup" << "session"); + list << PageInfo("defaultapps", QObject::tr("Applications"), QObject::tr("Mimetype Settings"), "preferences-desktop-default-applications",QObject::tr("Change default applications"), "session", QStringList(), QStringList() << "apps" << "default" << "services" << "xdg" << "session"); list << PageInfo("fluxbox-keys", QObject::tr("Keyboard Shortcuts"), QObject::tr("Keyboard Shortcuts"), "preferences-desktop-keyboard",QObject::tr("Change keyboard shortcuts"), "session", QStringList(), QStringList() << "apps" << "fluxbox" << "keys" << "keyboard" << "session" << "launch"); list << PageInfo("fluxbox-settings", QObject::tr("Window Manager"), QObject::tr("Window Settings"), "preferences-system-windows-actions",QObject::tr("Change window settings and appearances"), "appearance", QStringList(), QStringList() << "window" << "frame" << "border" << "workspace" << "theme" << "fluxbox" << "session"); - list << PageInfo("interface-desktop", QObject::tr("Desktop Icons and Plugins"), QObject::tr("Desktop Plugins"), "preferences-desktop-icons",QObject::tr("Change what icons or tools are embedded on the desktop"), "interface", QStringList(), QStringList() << "desktop" << "plugins" << "embed" << "icons" << "utilities"); - list << PageInfo("interface-panel", QObject::tr("Floating Panels and Plugins"), QObject::tr("Panels and Plugins"), "configure-toolbars",QObject::tr("Change any floating panels and what they show"), "interface", QStringList(), QStringList() << "desktop" << "toolbar" << "panel" << "floating" << "plugins"); - list << PageInfo("interface-menu", QObject::tr("Context Menu and Plugins"), QObject::tr("Menu Plugins"), "preferences-plugin",QObject::tr("Change what options are shown on the desktop context menu"), "interface", QStringList(), QStringList() << "desktop" << "menu" << "plugins" << "shortcuts"); - list << PageInfo("session-locale", QObject::tr("Localization Options"), QObject::tr("Locale Settings"), "preferences-desktop-locale",QObject::tr("Change the default locale settings for this user"), "user", QStringList(), QStringList() << "user"<<"locale"<<"language"<<"translations"); + list << PageInfo("interface-desktop", QObject::tr("Desktop"), QObject::tr("Desktop Plugins"), "preferences-desktop-icons",QObject::tr("Change what icons or tools are embedded on the desktop"), "interface", QStringList(), QStringList() << "desktop" << "plugins" << "embed" << "icons" << "utilities"); + list << PageInfo("interface-panel", QObject::tr("Panels"), QObject::tr("Panels and Plugins"), "configure-toolbars",QObject::tr("Change any floating panels and what they show"), "interface", QStringList(), QStringList() << "desktop" << "toolbar" << "panel" << "floating" << "plugins"); + list << PageInfo("interface-menu", QObject::tr("Menu"), QObject::tr("Menu Plugins"), "preferences-plugin",QObject::tr("Change what options are shown on the desktop context menu"), "interface", QStringList(), QStringList() << "desktop" << "menu" << "plugins" << "shortcuts"); + list << PageInfo("session-locale", QObject::tr("Localization"), QObject::tr("Locale Settings"), "preferences-desktop-locale",QObject::tr("Change the default locale settings for this user"), "user", QStringList(), QStringList() << "user"<<"locale"<<"language"<<"translations"); list << PageInfo("session-options", QObject::tr("General Options"), QObject::tr("User Settings"), "configure",QObject::tr("Change basic user settings such as time/date formats"), "user", QStringList(), QStringList() << "user"<<"settings"<<"time"<<"date"<<"icon"<<"reset"<<"numlock"<<"clock"); - return list; + + //Now sort the items according to the translated name + QStringList names; + for(int i=0; i<list.length(); i++){ names << list[i].name; } + names.sort(Qt::CaseInsensitive); + QList<PAGEINFO> sorted; + for(int i=0; i<names.length(); i++){ + for(int j=0; j<list.length(); j++){ + if(list[j].name==names[i]){ sorted << list.takeAt(j); break; } + } + } + return sorted; } //Add any sub-pages here 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 1bdd3107..69b32c09 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_main.cpp +++ b/src-qt5/core-utils/lumina-config/pages/page_main.cpp @@ -13,10 +13,12 @@ //========== page_main::page_main(QWidget *parent) : PageWidget(parent), ui(new Ui::page_main()){ ui->setupUi(this); + findShort = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_F), this, SLOT(showFind())); ui->treeWidget->setMouseTracking(true); ui->treeWidget->setSortingEnabled(false); //the QTreeView sort flag always puts them in backwards (reverse-alphabetical) - connect(ui->treeWidget, SIGNAL(itemActivated(QTreeWidgetItem*,int)), this, SLOT(itemTriggered(QTreeWidgetItem*)) ); - connect(ui->treeWidget, SIGNAL(itemClicked(QTreeWidgetItem*,int)), this, SLOT(itemTriggered(QTreeWidgetItem*)) ); + connect(ui->treeWidget, SIGNAL(itemActivated(QTreeWidgetItem*,int)), this, SLOT(itemTriggered(QTreeWidgetItem*, int)) ); + connect(ui->treeWidget, SIGNAL(itemPressed(QTreeWidgetItem*,int)), this, SLOT(itemTriggered(QTreeWidgetItem*, int)) ); + connect(ui->lineEdit, SIGNAL(textChanged(QString)), this, SLOT(searchChanged(QString)) ); } @@ -25,10 +27,15 @@ page_main::~page_main(){ } void page_main::setPreviousPage(QString id){ + if(id.isEmpty()){ return; } for(int i=0; i<ui->treeWidget->topLevelItemCount(); i++){ for(int j=0; j<ui->treeWidget->topLevelItem(i)->childCount(); j++){ if(ui->treeWidget->topLevelItem(i)->child(j)->whatsThis(0)==id){ - ui->treeWidget->setCurrentItem(ui->treeWidget->topLevelItem(i)->child(j)); + ui->treeWidget->setCurrentItem(ui->treeWidget->topLevelItem(i)->child(j), 0); + ui->treeWidget->scrollToItem(ui->treeWidget->topLevelItem(i)->child(j)); + return; //found item - done + }else if(ui->treeWidget->topLevelItem(i)->child(j)->whatsThis(1)==id){ + ui->treeWidget->setCurrentItem(ui->treeWidget->topLevelItem(i)->child(j), 1); ui->treeWidget->scrollToItem(ui->treeWidget->topLevelItem(i)->child(j)); return; //found item - done } @@ -39,19 +46,24 @@ void page_main::setPreviousPage(QString id){ void page_main::UpdateItems(QString search){ ui->treeWidget->clear(); + ui->treeWidget->setColumnCount(2); //First create the categories QTreeWidgetItem *interface = new QTreeWidgetItem(); interface->setIcon(0, LXDG::findIcon("preferences-desktop","")); interface->setText(0, tr("Interface Configuration")); + interface->setFirstColumnSpanned(true); QTreeWidgetItem *appearance = new QTreeWidgetItem(); appearance->setIcon(0, LXDG::findIcon("preferences-desktop-color","")); appearance->setText(0, tr("Appearance")); + appearance->setFirstColumnSpanned(true); QTreeWidgetItem *session = new QTreeWidgetItem(); session->setIcon(0, LXDG::findIcon("preferences-system-session-services","")); - session->setText(0, tr("Desktop Session Options")); + session->setText(0, tr("Desktop Defaults")); + session->setFirstColumnSpanned(true); QTreeWidgetItem *user = new QTreeWidgetItem(); user->setIcon(0, LXDG::findIcon("preferences-desktop-user","")); user->setText(0, tr("User Settings")); + user->setFirstColumnSpanned(true); //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++){ @@ -66,24 +78,40 @@ void page_main::UpdateItems(QString search){ if(!ok){ continue; } //no duplicates between search terms and available info } //qDebug() << "Item Found:" << INFO[i].id << INFO[i].title; - QTreeWidgetItem *it = new QTreeWidgetItem(); - it->setIcon(0, LXDG::findIcon(INFO[i].icon,"") ); - it->setText(0, INFO[i].name); - it->setStatusTip(0, INFO[i].comment); - it->setToolTip(0, INFO[i].comment); - it->setWhatsThis(0, INFO[i].id); - if(INFO[i].category=="interface"){ interface->addChild(it); } - else if(INFO[i].category=="appearance"){ appearance->addChild(it); } - else if(INFO[i].category=="session"){ session->addChild(it); } - else if(INFO[i].category=="user"){ user->addChild(it); } - else{ ui->treeWidget->addTopLevelItem(it); } + int col = 0; + QTreeWidgetItem *lastIt = 0; + if(INFO[i].category=="interface" && interface->childCount()>0 ){ + if( interface->child( interface->childCount()-1)->text(1).isEmpty() ){ lastIt = interface->child(interface->childCount()-1); } + }else if(INFO[i].category=="appearance" && appearance->childCount()>0 ){ + if( appearance->child(appearance->childCount()-1)->text(1).isEmpty() ){ lastIt = appearance->child(appearance->childCount()-1); } + }else if(INFO[i].category=="session" && session->childCount()>0 ){ + if( session->child( session->childCount()-1)->text(1).isEmpty() ){ lastIt = session->child(session->childCount()-1); } + }else if(INFO[i].category=="user" && user->childCount()>0 ){ + if( user->child( user->childCount()-1)->text(1).isEmpty() ){ lastIt = user->child(user->childCount()-1); } + } + if(lastIt==0){ lastIt = new QTreeWidgetItem(); col = 0;} + else{ col = 1; } + lastIt->setIcon(col, LXDG::findIcon(INFO[i].icon,"") ); + lastIt->setText(col, INFO[i].name); + lastIt->setStatusTip(col, INFO[i].comment); + lastIt->setToolTip(col, INFO[i].comment); + lastIt->setWhatsThis(col, INFO[i].id); + if(col==0){ + if(INFO[i].category=="interface"){ interface->addChild(lastIt); } + else if(INFO[i].category=="appearance"){ appearance->addChild(lastIt); } + else if(INFO[i].category=="session"){ session->addChild(lastIt); } + else if(INFO[i].category=="user"){ user->addChild(lastIt); } + else{ ui->treeWidget->addTopLevelItem(lastIt); } + } } //Now add the categories to the tree widget if they are non-empty - if(interface->childCount()>0){ ui->treeWidget->addTopLevelItem(interface); interface->setExpanded(!search.isEmpty()); } - if(appearance->childCount()>0){ ui->treeWidget->addTopLevelItem(appearance); appearance->setExpanded(!search.isEmpty()); } - if(session->childCount()>0){ ui->treeWidget->addTopLevelItem(session); session->setExpanded(!search.isEmpty()); } - if(user->childCount()>0){ ui->treeWidget->addTopLevelItem(user); user->setExpanded(!search.isEmpty()); } + 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(user->childCount()>0){ ui->treeWidget->addTopLevelItem(user); user->setExpanded(true); } ui->treeWidget->sortItems(0, Qt::AscendingOrder); + ui->treeWidget->resizeColumnToContents(0); + ui->treeWidget->resizeColumnToContents(1); } //================ @@ -109,11 +137,19 @@ void page_main::updateIcons(){ //================= // PRIVATE SLOTS //================= -void page_main::itemTriggered(QTreeWidgetItem *it){ +void page_main::showFind(){ + ui->lineEdit->setFocus(); + ui->treeWidget->setCurrentItem(0); +} + +void page_main::itemTriggered(QTreeWidgetItem *it, int col){ if(it->childCount()>0){ it->setExpanded( !it->isExpanded() ); - }else if(!it->whatsThis(0).isEmpty()){ - emit ChangePage(it->whatsThis(0)); + it->setSelected(false); + }else if(!it->whatsThis(col).isEmpty()){ + emit ChangePage(it->whatsThis(col)); + }else{ + it->setSelected(false); } } 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 7c7539a3..e4bfeafd 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_main.h +++ b/src-qt5/core-utils/lumina-config/pages/page_main.h @@ -29,11 +29,12 @@ public slots: private: Ui::page_main *ui; QList<PAGEINFO> INFO; - + QShortcut *findShort; void UpdateItems(QString search); private slots: - void itemTriggered(QTreeWidgetItem*); + void showFind(); + void itemTriggered(QTreeWidgetItem*, int); 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 2331152b..34033d39 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_main.ui +++ b/src-qt5/core-utils/lumina-config/pages/page_main.ui @@ -36,7 +36,7 @@ <item> <widget class="QTreeWidget" name="treeWidget"> <property name="focusPolicy"> - <enum>Qt::NoFocus</enum> + <enum>Qt::TabFocus</enum> </property> <property name="styleSheet"> <string notr="true">QTreeWidget{background: transparent; }</string> @@ -44,6 +44,15 @@ <property name="editTriggers"> <set>QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked</set> </property> + <property name="tabKeyNavigation"> + <bool>true</bool> + </property> + <property name="showDropIndicator" stdset="0"> + <bool>false</bool> + </property> + <property name="selectionBehavior"> + <enum>QAbstractItemView::SelectItems</enum> + </property> <property name="iconSize"> <size> <width>32</width> |