aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/lumina-desktop/panel-plugins
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2019-01-26 10:34:38 -0500
committerKen Moore <ken@ixsystems.com>2019-01-26 10:34:38 -0500
commit159d8e678880551fd77e63509e29f6f48b733535 (patch)
tree8c4f6230bbd342d1ee706a7789932f876df52f59 /src-qt5/core/lumina-desktop/panel-plugins
parentFix up the minimum size of the shortcut buttons. (diff)
downloadlumina-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.
Diffstat (limited to 'src-qt5/core/lumina-desktop/panel-plugins')
-rw-r--r--src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.cpp23
-rw-r--r--src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.h4
2 files changed, 16 insertions, 11 deletions
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);
bgstack15