Skip to content

Commit

Permalink
update if module manager is open
Browse files Browse the repository at this point in the history
  • Loading branch information
Edru2 committed Mar 23, 2020
1 parent f9cef16 commit f970c8f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions src/TLuaInterpreter.cpp
Expand Up @@ -54,6 +54,7 @@
#include <QCoreApplication>
#include <QDesktopServices>
#include <QFileDialog>
#include <QTableWidget>
#include <QVector>
#ifdef QT_TEXTTOSPEECH_LIB
#include <QTextToSpeech>
Expand Down Expand Up @@ -13091,6 +13092,13 @@ int TLuaInterpreter::enableModuleSync(lua_State* L)
return 2;
}

auto moduleTable = mudlet::self()->moduleTable;
if (moduleTable && !moduleTable->findItems(module, Qt::MatchExactly).isEmpty()) {
int row = moduleTable->findItems(module, Qt::MatchExactly)[0]->row();
auto checkItem = moduleTable->item(row, 2);
checkItem->setCheckState(Qt::Checked);
}

lua_pushboolean(L, true);
return 1;
}
Expand All @@ -13111,6 +13119,14 @@ int TLuaInterpreter::disableModuleSync(lua_State* L)
lua_pushfstring(L, message.toUtf8().constData());
return 2;
}

auto moduleTable = mudlet::self()->moduleTable;
if (moduleTable && !moduleTable->findItems(module, Qt::MatchExactly).isEmpty()) {
int row = moduleTable->findItems(module, Qt::MatchExactly)[0]->row();
auto checkItem = moduleTable->item(row, 2);
checkItem->setCheckState(Qt::Unchecked);
}

lua_pushboolean(L, true);
return 1;
}
Expand Down
2 changes: 1 addition & 1 deletion src/mudlet.h
Expand Up @@ -426,6 +426,7 @@ class mudlet : public QMainWindow, public Ui::main_window
void scanForQtTranslations(const QString&);
void layoutModules();
void startAutoLogin();
QPointer<QTableWidget> moduleTable;


#if defined(INCLUDE_UPDATER)
Expand Down Expand Up @@ -653,7 +654,6 @@ private slots:
QPointer<QPushButton> installButton;

QPointer<Host> mpModuleTableHost;
QPointer<QTableWidget> moduleTable;
QPointer<QPushButton> moduleUninstallButton;
QPointer<QPushButton> moduleInstallButton;
QPointer<QPushButton> moduleHelpButton;
Expand Down

0 comments on commit f970c8f

Please sign in to comment.