1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-30 16:15:31 +00:00

[Browser] Disable refresh button when action in progress

This commit is contained in:
Koncord 2017-05-27 11:44:55 +08:00
parent ec5d1b7a86
commit 9f0ec849a0
3 changed files with 7 additions and 0 deletions

View file

@ -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()));

View file

@ -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()

View file

@ -18,6 +18,9 @@ public:
public slots:
void refresh();
void terminate();
signals:
void finished();
void started();
private:
QThread *queryThread;
};