From 159d8e678880551fd77e63509e29f6f48b733535 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Sat, 26 Jan 2019 10:34:38 -0500 Subject: 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. --- src-qt5/core/libLumina/LuminaXDG.cpp | 11 ++++++++-- src-qt5/core/libLumina/LuminaXDG.h | 4 +++- .../panel-plugins/systemstart/StartMenu.cpp | 23 ++++++++++++--------- .../panel-plugins/systemstart/StartMenu.h | 4 +++- .../build-lumina-pdf-Desktop-Debug/lumina-pdf | Bin 9565048 -> 0 bytes 5 files changed, 28 insertions(+), 14 deletions(-) delete mode 100755 src-qt5/desktop-utils/build-lumina-pdf-Desktop-Debug/lumina-pdf 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 XDGDesktopList::apps(bool showAll, bool showHidden){ //showAll: include invalid files, showHidden: include NoShow/Hidden files + //hashmutex.lock(); QStringList keys = files.keys(); QList out; for(int i=0; i 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 #include #include +#include // ====================== // 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: [::::::::] @@ -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 #include #include +#include #include @@ -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 deleted file mode 100755 index a63b6a41..00000000 Binary files a/src-qt5/desktop-utils/build-lumina-pdf-Desktop-Debug/lumina-pdf and /dev/null differ -- cgit