NOISSUE only watch mod folders when the user is looking at them
This commit is contained in:
parent
11c376f6f1
commit
88f975eff7
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user