mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 03:15:32 +00:00
[Browser] Disable refresh button when action in progress
This commit is contained in:
parent
ec5d1b7a86
commit
9f0ec849a0
3 changed files with 7 additions and 0 deletions
|
@ -36,6 +36,8 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
|
||||
PingHelper::Get().SetModel((ServerModel*)proxyModel->sourceModel());
|
||||
queryHelper = new QueryHelper(proxyModel->sourceModel());
|
||||
connect(queryHelper, &QueryHelper::started, [this](){actionRefresh->setEnabled(false);});
|
||||
connect(queryHelper, &QueryHelper::finished, [this](){actionRefresh->setEnabled(true);});
|
||||
|
||||
connect(tabWidget, SIGNAL(currentChanged(int)), this, SLOT(tabSwitched(int)));
|
||||
connect(actionAdd, SIGNAL(triggered(bool)), this, SLOT(addServer()));
|
||||
|
|
|
@ -16,12 +16,14 @@ QueryHelper::QueryHelper(QAbstractItemModel *model)
|
|||
queryUpdate->_model = model;
|
||||
connect(queryThread, SIGNAL(started()), queryUpdate, SLOT(process()));
|
||||
connect(queryUpdate, SIGNAL(finished()), queryThread, SLOT(quit()));
|
||||
connect(queryUpdate, &QueryUpdate::finished, [this](){emit finished();});
|
||||
queryUpdate->moveToThread(queryThread);
|
||||
}
|
||||
|
||||
void QueryHelper::refresh()
|
||||
{
|
||||
queryThread->start();
|
||||
emit started();
|
||||
}
|
||||
|
||||
void QueryHelper::terminate()
|
||||
|
|
|
@ -18,6 +18,9 @@ public:
|
|||
public slots:
|
||||
void refresh();
|
||||
void terminate();
|
||||
signals:
|
||||
void finished();
|
||||
void started();
|
||||
private:
|
||||
QThread *queryThread;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue