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:
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());
|
PingHelper::Get().SetModel((ServerModel*)proxyModel->sourceModel());
|
||||||
queryHelper = new QueryHelper(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(tabWidget, SIGNAL(currentChanged(int)), this, SLOT(tabSwitched(int)));
|
||||||
connect(actionAdd, SIGNAL(triggered(bool)), this, SLOT(addServer()));
|
connect(actionAdd, SIGNAL(triggered(bool)), this, SLOT(addServer()));
|
||||||
|
|
|
@ -16,12 +16,14 @@ QueryHelper::QueryHelper(QAbstractItemModel *model)
|
||||||
queryUpdate->_model = model;
|
queryUpdate->_model = model;
|
||||||
connect(queryThread, SIGNAL(started()), queryUpdate, SLOT(process()));
|
connect(queryThread, SIGNAL(started()), queryUpdate, SLOT(process()));
|
||||||
connect(queryUpdate, SIGNAL(finished()), queryThread, SLOT(quit()));
|
connect(queryUpdate, SIGNAL(finished()), queryThread, SLOT(quit()));
|
||||||
|
connect(queryUpdate, &QueryUpdate::finished, [this](){emit finished();});
|
||||||
queryUpdate->moveToThread(queryThread);
|
queryUpdate->moveToThread(queryThread);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QueryHelper::refresh()
|
void QueryHelper::refresh()
|
||||||
{
|
{
|
||||||
queryThread->start();
|
queryThread->start();
|
||||||
|
emit started();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QueryHelper::terminate()
|
void QueryHelper::terminate()
|
||||||
|
|
|
@ -18,6 +18,9 @@ public:
|
||||||
public slots:
|
public slots:
|
||||||
void refresh();
|
void refresh();
|
||||||
void terminate();
|
void terminate();
|
||||||
|
signals:
|
||||||
|
void finished();
|
||||||
|
void started();
|
||||||
private:
|
private:
|
||||||
QThread *queryThread;
|
QThread *queryThread;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue