Skip to content

Commit

Permalink
Enable GUI during DB load but disable inputting spell during it
Browse files Browse the repository at this point in the history
  • Loading branch information
killerwife committed May 23, 2022
1 parent 857560f commit 52cc4ac
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
20 changes: 17 additions & 3 deletions QSW/MainForm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "mpq/MPQ.h"

MainForm::MainForm(QWidget* parent)
: QMainWindow(parent)
: QMainWindow(parent), m_pluginLoading(false)
{
QElapsedTimer m_time;
m_time.start();
Expand Down Expand Up @@ -420,7 +420,8 @@ void MainForm::hideProgressBar()

void MainForm::onPluginLoadingInit()
{
setEnabled(false);
// setEnabled(false);
m_pluginLoading = true;
updatePlguinButton();
}

Expand All @@ -433,7 +434,8 @@ void MainForm::onPluginLoadingFail()

void MainForm::onPluginLoaded()
{
setEnabled(true);
// setEnabled(true);
m_pluginLoading = false;
updatePlguinButton();
update();
}
Expand Down Expand Up @@ -562,6 +564,9 @@ void MainForm::slotFilterSearch()

void MainForm::slotCompareSearch()
{
if (m_pluginLoading)
return;

if (!compareSpell_1->text().isEmpty() && !compareSpell_2->text().isEmpty())
{
m_sw->showInfo(compareSpell_1->text().toInt(), QSW::PAGE_CLEFT);
Expand All @@ -572,6 +577,9 @@ void MainForm::slotCompareSearch()

void MainForm::slotSearch(quint8 type)
{
if (m_pluginLoading)
return;

SpellListSortedModel* smodel = static_cast<SpellListSortedModel*>(SpellList->model());
SpellListModel* model = static_cast<SpellListModel*>(smodel->sourceModel());
delete model;
Expand All @@ -582,6 +590,9 @@ void MainForm::slotSearch(quint8 type)

void MainForm::slotSearchResult()
{
if (m_pluginLoading)
return;

SearchResultWatcher* watcher = (SearchResultWatcher*)QObject::sender();

EventList eventList = watcher->future().result();
Expand All @@ -591,6 +602,9 @@ void MainForm::slotSearchResult()

void MainForm::slotSearchFromList(const QModelIndex &index)
{
if (m_pluginLoading)
return;

QVariant var = SpellList->model()->data(SpellList->model()->index(index.row(), 0));
m_sw->showInfo(var.toInt());
SpellList->setFocus();
Expand Down
2 changes: 2 additions & 0 deletions QSW/MainForm.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,4 +201,6 @@ class MainForm : public QMainWindow, public Ui::main
ScriptFilter* m_scriptFilter;

QSWPage* m_pages[QSW::PAGE_MAX];

bool m_pluginLoading;
};

0 comments on commit 52cc4ac

Please sign in to comment.