diff options
author | Ken Moore <ken@ixsystems.com> | 2017-11-15 10:28:13 -0500 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2017-11-15 10:28:13 -0500 |
commit | 55d00fe0de302191307fde6af8e1b291bf6c91a8 (patch) | |
tree | 3016e5dbbcf9a3cd2ae91a14e35a3061dd1cf487 /src-qt5 | |
parent | Finish cleaning up the new LFileInfo class/file. (diff) | |
download | lumina-55d00fe0de302191307fde6af8e1b291bf6c91a8.tar.gz lumina-55d00fe0de302191307fde6af8e1b291bf6c91a8.tar.bz2 lumina-55d00fe0de302191307fde6af8e1b291bf6c91a8.zip |
Ensure that the Browser backend is also contained in a background thread.
This prevents it from delaying the UI from updating.
Diffstat (limited to 'src-qt5')
4 files changed, 26 insertions, 13 deletions
diff --git a/src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp b/src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp index 4d8ae44c..978992c1 100644 --- a/src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp +++ b/src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp @@ -19,9 +19,11 @@ BrowserWidget::BrowserWidget(QString objID, QWidget *parent) : QWidget(parent){ //Setup the Widget/UI this->setLayout( new QVBoxLayout(this) ); ID = objID; - //BROWSER = 0; //Setup the backend browser object - BROWSER = new Browser(this); + bThread = new QThread(); + BROWSER = new Browser(); + BROWSER->moveToThread(bThread); + bThread->start(); connect(BROWSER, SIGNAL(clearItems()), this, SLOT(clearItems()) ); connect(BROWSER, SIGNAL(itemRemoved(QString)), this, SLOT(itemRemoved(QString)) ); connect(BROWSER, SIGNAL(itemDataAvailable(QIcon, LFileInfo*)), this, SLOT(itemDataAvailable(QIcon, LFileInfo*)) ); @@ -37,14 +39,18 @@ BrowserWidget::BrowserWidget(QString objID, QWidget *parent) : QWidget(parent){ BrowserWidget::~BrowserWidget(){ BROWSER->deleteLater(); + bThread->exit(); + bThread->deleteLater(); } void BrowserWidget::changeDirectory(QString dir){ - QStringList vids = videoMap.keys(); - for(int i=0; i<vids.length(); i++){ videoMap.take(vids[i]).second->deleteLater(); } - //videoMap.clear(); + if(USE_VIDEO_LABEL){ + QStringList vids = videoMap.keys(); + for(int i=0; i<vids.length(); i++){ videoMap.take(vids[i]).second->deleteLater(); } + //videoMap.clear(); + } if(BROWSER->currentDirectory()==dir){ return; } //already on this directory - //qDebug() << "Change Directory:" << dir << historyList; + qDebug() << "Change Directory:" << dir << historyList; if( !dir.contains("/.zfs/snapshot/") ){ if(historyList.isEmpty() || !dir.isEmpty()){ historyList << dir; } @@ -281,7 +287,7 @@ void BrowserWidget::clearItems(){ if(listWidget!=0){ listWidget->clear(); } else if(treeWidget!=0){ treeWidget->clear(); } freshload = true; - videoMap.clear(); + //videoMap.clear(); } void BrowserWidget::itemRemoved(QString item){ diff --git a/src-qt5/desktop-utils/lumina-fm/BrowserWidget.h b/src-qt5/desktop-utils/lumina-fm/BrowserWidget.h index b88d8d2e..38e7b10c 100644 --- a/src-qt5/desktop-utils/lumina-fm/BrowserWidget.h +++ b/src-qt5/desktop-utils/lumina-fm/BrowserWidget.h @@ -22,7 +22,7 @@ class BrowserWidget : public QWidget{ Q_OBJECT private: Browser *BROWSER; - //QThread *bThread; //browserThread + QThread *bThread; //browserThread int numItems; //used for checking if all the items have loaded yet QString ID, statustip; QStringList date_format, historyList; diff --git a/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp b/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp index 6e69adda..ccae4087 100644 --- a/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp +++ b/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp @@ -63,7 +63,7 @@ DirWidget::DirWidget(QString objID, QSettings *settings, QWidget *parent) : QWid RCBW = 0; //right column browser is unavailable initially BW = new BrowserWidget("", this); ui->browser_layout->addWidget(BW); - connect(BW, SIGNAL(dirChange(QString, bool)), this, SLOT(currentDirectoryChanged()) ); + connect(BW, SIGNAL(dirChange(QString, bool)), this, SLOT(currentDirectoryChanged(QString)) ); connect(BW, SIGNAL(itemsActivated()), this, SLOT(runFiles()) ); connect(BW, SIGNAL(DataDropped(QString, QStringList)), this, SIGNAL(PasteFiles(QString, QStringList)) ); connect(BW, SIGNAL(contextMenuRequested()), this, SLOT(OpenContextMenu()) ); @@ -478,7 +478,7 @@ void DirWidget::on_actionDualColumn_triggered(bool checked){ if(RCBW!=0){ return; } //nothing to do RCBW = new BrowserWidget("rc", this); ui->browser_layout->addWidget(RCBW); - connect(RCBW, SIGNAL(dirChange(QString, bool)), this, SLOT(currentDirectoryChanged()) ); + connect(RCBW, SIGNAL(dirChange(QString, bool)), this, SLOT(currentDirectoryChanged(QString)) ); connect(RCBW, SIGNAL(itemsActivated()), this, SLOT(runFiles()) ); connect(RCBW, SIGNAL(DataDropped(QString, QStringList)), this, SIGNAL(PasteFiles(QString, QStringList)) ); connect(RCBW, SIGNAL(contextMenuRequested()), this, SLOT(OpenContextMenu()) ); @@ -627,8 +627,8 @@ void DirWidget::UpdateContextMenu(){ cOpenWithMenu->addAction(LXDG::findIcon("system-run-with",""), tr("Other..."), this, SLOT(runWithFiles()) ); } -void DirWidget::currentDirectoryChanged(bool widgetonly){ - QString cur = currentBrowser()->currentDirectory(); +void DirWidget::currentDirectoryChanged(QString cur, bool widgetonly){ + qDebug() << "Got current directory changed:" << cur << widgetonly; QFileInfo info(cur); canmodify = info.isWritable(); if(widgetonly){ ui->label_status->setText(currentBrowser()->status()); } @@ -650,7 +650,13 @@ void DirWidget::currentDirectoryChanged(bool widgetonly){ emit TabNameChanged(ID, normalbasedir.section("/",-1)); QModelIndex index = dirtreeModel->index(normalbasedir,0); ui->folderViewPane->setCurrentIndex( index ); - ui->folderViewPane->scrollTo(index); + ui->folderViewPane->scrollTo(index, QAbstractItemView::PositionAtCenter); +} + +void DirWidget::currentDirectoryChanged(bool widgetonly){ + //overload for the more expansive slot above + QString cur = currentBrowser()->currentDirectory(); + currentDirectoryChanged(cur, widgetonly); } void DirWidget::dirStatusChanged(QString stat){ diff --git a/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.h b/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.h index a8e535d0..5c39d262 100644 --- a/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.h +++ b/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.h @@ -135,6 +135,7 @@ private slots: //Browser Functions void OpenContextMenu(); void UpdateContextMenu(); + void currentDirectoryChanged(QString dir, bool widgetonly = false); void currentDirectoryChanged(bool widgetonly = false); void dirStatusChanged(QString); void setCurrentBrowser(QString); |