diff options
author | Ken Moore <ken@ixsystems.com> | 2019-01-26 10:34:38 -0500 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2019-01-26 10:34:38 -0500 |
commit | 159d8e678880551fd77e63509e29f6f48b733535 (patch) | |
tree | 8c4f6230bbd342d1ee706a7789932f876df52f59 | |
parent | Fix up the minimum size of the shortcut buttons. (diff) | |
download | lumina-159d8e678880551fd77e63509e29f6f48b733535.tar.gz lumina-159d8e678880551fd77e63509e29f6f48b733535.tar.bz2 lumina-159d8e678880551fd77e63509e29f6f48b733535.zip |
Try to fix the start menu search lockup.
Seems to fix it here, although I get a little bit of graphical artifacting while replacing the app menu items.
-rw-r--r-- | src-qt5/core/libLumina/LuminaXDG.cpp | 11 | ||||
-rw-r--r-- | src-qt5/core/libLumina/LuminaXDG.h | 4 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.cpp | 23 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.h | 4 | ||||
-rwxr-xr-x | src-qt5/desktop-utils/build-lumina-pdf-Desktop-Debug/lumina-pdf | bin | 9565048 -> 0 bytes |
5 files changed, 28 insertions, 14 deletions
diff --git a/src-qt5/core/libLumina/LuminaXDG.cpp b/src-qt5/core/libLumina/LuminaXDG.cpp index 7726eed3..aad63a5e 100644 --- a/src-qt5/core/libLumina/LuminaXDG.cpp +++ b/src-qt5/core/libLumina/LuminaXDG.cpp @@ -517,6 +517,7 @@ void XDGDesktopList::watcherChanged(){ void XDGDesktopList::updateList(){ //run the check routine if(synctimer->isActive()){ synctimer->stop(); } + hashmutex.lock(); QStringList appDirs = LXDG::systemApplicationDirs(); //get all system directories QStringList found, newfiles; //for avoiding duplicate apps (might be files with same name in different priority directories) QStringList oldkeys = files.keys(); @@ -569,10 +570,12 @@ void XDGDesktopList::updateList(){ synctimer->setInterval(60000); //Update in 1 minute if nothing changes before then synctimer->start(); } + hashmutex.unlock(); } QList<XDGDesktop*> XDGDesktopList::apps(bool showAll, bool showHidden){ //showAll: include invalid files, showHidden: include NoShow/Hidden files + //hashmutex.lock(); QStringList keys = files.keys(); QList<XDGDesktop*> out; for(int i=0; i<keys.length(); i++){ @@ -582,17 +585,21 @@ QList<XDGDesktop*> XDGDesktopList::apps(bool showAll, bool showHidden){ } } } + //hashmutex.unlock(); return out; } XDGDesktop* XDGDesktopList::findAppFile(QString filename){ + //hashmutex.lock(); QStringList keys = files.keys().filter(filename); QString chk = filename.section("/",-1); + XDGDesktop *found = 0; for(int i=0; i<keys.length(); i++){ - if(keys[i] == filename || keys[i].endsWith("/"+chk)){ return files[keys[i]]; } + if(keys[i] == filename || keys[i].endsWith("/"+chk)){ found = files[keys[i]]; } } + //hashmutex.unlock(); //No matches - return 0; + return found; } void XDGDesktopList::populateMenu(QMenu *topmenu, bool byCategory){ diff --git a/src-qt5/core/libLumina/LuminaXDG.h b/src-qt5/core/libLumina/LuminaXDG.h index 066f0462..c1e25b36 100644 --- a/src-qt5/core/libLumina/LuminaXDG.h +++ b/src-qt5/core/libLumina/LuminaXDG.h @@ -1,6 +1,6 @@ //=========================================== // Lumina-DE source code -// Copyright (c) 2013, Ken Moore +// Copyright (c) 2013-2019, Ken Moore // Available under the 3-clause BSD license // See the LICENSE file for full details //=========================================== @@ -30,6 +30,7 @@ #include <QDebug> #include <QMenu> #include <QAction> +#include <QMutex> // ====================== // FreeDesktop Desktop Actions Framework (data structure) @@ -117,6 +118,7 @@ private: QFileSystemWatcher *watcher; QTimer *synctimer; bool keepsynced; + QMutex hashmutex; private slots: void watcherChanged(); diff --git a/src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.cpp b/src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.cpp index e0ac6639..997d2377 100644 --- a/src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.cpp +++ b/src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.cpp @@ -221,21 +221,22 @@ void StartMenu::SortScrollArea(QScrollArea *area){ } } -void StartMenu::do_search(QString search, bool force){ +void StartMenu::do_search(QString search, bool force, Ui::StartMenu *tui){ search = search.simplified(); //remove unneccesary whitespace if(search == CSearch && !force){ //nothing new - just ensure the page is visible - if(ui->stackedWidget->currentWidget()!=ui->page_search ){ ui->stackedWidget->setCurrentWidget(ui->page_search); } + if(tui->stackedWidget->currentWidget()!=tui->page_search ){ tui->stackedWidget->setCurrentWidget(tui->page_search); } return; }else if(search.isEmpty()){ CSearch.clear(); - if(ui->stackedWidget->currentWidget()==ui->page_search ){ on_tool_back_clicked(); } + if(tui->stackedWidget->currentWidget()==tui->page_search ){ on_tool_back_clicked(); } return; } + searchmutex.lock(); //Got a search term - check it CSearch = search; //save this for comparison later //qDebug() << "Search for term:" << search; - ClearScrollArea(ui->scroll_search); + ClearScrollArea(tui->scroll_search); topsearch.clear(); //Now find any items which match the search QStringList found; //syntax: [<sorter>::::<mimetype>::::<filepath>] @@ -264,23 +265,24 @@ void StartMenu::do_search(QString search, bool force){ ItemWidget *it = 0; if( found[i].section("::::",2,-1).endsWith(".desktop")){ XDGDesktop item(found[i].section("::::",2,-1)); - if(item.isValid()){ it = new ItemWidget(ui->scroll_favs->widget(), &item); } + if(item.isValid()){ it = new ItemWidget(tui->scroll_favs->widget(), &item); } }else{ - it = new ItemWidget(ui->scroll_favs->widget(), found[i].section("::::",2,-1), found[i].section("::::",1,1) ); + it = new ItemWidget(tui->scroll_favs->widget(), found[i].section("::::",2,-1), found[i].section("::::",1,1) ); } if(it==0){ continue; } if(!it->gooditem){ it->deleteLater(); continue; } //invalid for some reason - ui->scroll_search->widget()->layout()->addWidget(it); + tui->scroll_search->widget()->layout()->addWidget(it); connect(it, SIGNAL(NewShortcut()), this, SLOT(UpdateFavs()) ); connect(it, SIGNAL(RemovedShortcut()), this, SLOT(UpdateFavs()) ); connect(it, SIGNAL(RunItem(QString)), this, SLOT(LaunchItem(QString)) ); connect(it, SIGNAL(toggleQuickLaunch(QString, bool)), this, SLOT(UpdateQuickLaunch(QString, bool)) ); if(i%3==0){ QApplication::processEvents(); - if(searchTimer->isActive()){ return; } //search changed - go ahead and stop here + if(searchTimer->isActive()){ searchmutex.unlock(); return; } //search changed - go ahead and stop here } } - ui->stackedWidget->setCurrentWidget(ui->page_search); + tui->stackedWidget->setCurrentWidget(tui->page_search); + searchmutex.unlock(); } bool StartMenu::promptAboutUpdates(bool &skip){ @@ -692,7 +694,8 @@ void StartMenu::on_line_search_textEdited(QString){ void StartMenu::startSearch(){ if(!this->isVisible()){ return; } //menu closed while timer was active - do_search(ui->line_search->text(),false); //auto-launched + //QtConcurrent::run(this, &StartMenu::do_search, ui->line_search->text(),false, ui); //auto-launched + do_search(ui->line_search->text(), false, ui); } void StartMenu::on_line_search_returnPressed(){ diff --git a/src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.h b/src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.h index 0a90311d..c6a2812b 100644 --- a/src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.h +++ b/src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.h @@ -10,6 +10,7 @@ #include <QWidget> #include <QScrollArea> #include <QMouseEvent> +#include <QMutex> #include <LuminaXDG.h> @@ -35,12 +36,13 @@ private: QStringList favs; QString CCat, CSearch, topsearch; //current category/search QTimer *searchTimer; + QMutex searchmutex; //Simple utility functions //void deleteChildren(QWidget *obj); //recursive function void ClearScrollArea(QScrollArea *area); void SortScrollArea(QScrollArea *area); - void do_search(QString search, bool force); + void do_search(QString search, bool force, Ui::StartMenu *tui); bool promptAboutUpdates(bool &skip); diff --git a/src-qt5/desktop-utils/build-lumina-pdf-Desktop-Debug/lumina-pdf b/src-qt5/desktop-utils/build-lumina-pdf-Desktop-Debug/lumina-pdf Binary files differdeleted file mode 100755 index a63b6a41..00000000 --- a/src-qt5/desktop-utils/build-lumina-pdf-Desktop-Debug/lumina-pdf +++ /dev/null |