summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--application/pages/ModFolderPage.cpp11
-rw-r--r--application/pages/ModFolderPage.h2
-rw-r--r--logic/minecraft/ModList.cpp1
3 files changed, 13 insertions, 1 deletions
diff --git a/application/pages/ModFolderPage.cpp b/application/pages/ModFolderPage.cpp
index f070098f..16272653 100644
--- a/application/pages/ModFolderPage.cpp
+++ b/application/pages/ModFolderPage.cpp
@@ -47,12 +47,21 @@ ModFolderPage::ModFolderPage(BaseInstance *inst, std::shared_ptr<ModList> mods,
m_helpName = helpPage;
ui->modTreeView->setModel(m_mods.get());
ui->modTreeView->installEventFilter(this);
- m_mods->startWatching();
auto smodel = ui->modTreeView->selectionModel();
connect(smodel, SIGNAL(currentChanged(QModelIndex, QModelIndex)),
SLOT(modCurrent(QModelIndex, QModelIndex)));
}
+void ModFolderPage::opened()
+{
+ m_mods->startWatching();
+}
+
+void ModFolderPage::closed()
+{
+ m_mods->stopWatching();
+}
+
CoreModFolderPage::CoreModFolderPage(BaseInstance *inst, std::shared_ptr<ModList> mods,
QString id, QString iconName, QString displayName,
QString helpPage, QWidget *parent)
diff --git a/application/pages/ModFolderPage.h b/application/pages/ModFolderPage.h
index 864125be..6bfbf1d0 100644
--- a/application/pages/ModFolderPage.h
+++ b/application/pages/ModFolderPage.h
@@ -54,6 +54,8 @@ public:
}
virtual bool shouldDisplay() const;
+ virtual void opened();
+ virtual void closed();
protected:
bool eventFilter(QObject *obj, QEvent *ev);
bool modListFilter(QKeyEvent *ev);
diff --git a/logic/minecraft/ModList.cpp b/logic/minecraft/ModList.cpp
index c943c254..a77c5890 100644
--- a/logic/minecraft/ModList.cpp
+++ b/logic/minecraft/ModList.cpp
@@ -38,6 +38,7 @@ ModList::ModList(const QString &dir, const QString &list_file)
void ModList::startWatching()
{
+ update();
is_watching = m_watcher->addPath(m_dir.absolutePath());
if (is_watching)
{