diff --git a/src/config/configwindow.cpp b/src/config/configwindow.cpp index aedb5cb5..c78baf73 100644 --- a/src/config/configwindow.cpp +++ b/src/config/configwindow.cpp @@ -38,12 +38,11 @@ ConfigWindow::ConfigWindow(QWidget *parent) : QTabWidget(parent) { setWindowTitle(tr("Configuration")); auto changedSlot = [this](QString s){ - Q_UNUSED(s); - this->m_configWatcher->removePath(s); - this->m_configWatcher->addPath(s); - if(!this->hasFocus()) { - Q_EMIT updateComponents(); + QStringList files = m_configWatcher->files(); + if (!files.contains(s)) { + this->m_configWatcher->addPath(s); } + Q_EMIT updateChildren(); }; m_configWatcher = new QFileSystemWatcher(this); m_configWatcher->addPath(ConfigHandler().configFilePath()); @@ -97,10 +96,6 @@ ConfigWindow::ConfigWindow(QWidget *parent) : QTabWidget(parent) { m_generalConfig, &GeneneralConf::updateComponents); } -void ConfigWindow::updateComponents() { - Q_EMIT updateChildren(); -} - void ConfigWindow::keyPressEvent(QKeyEvent *e) { if (e->key() == Qt::Key_Escape) { close(); diff --git a/src/config/configwindow.h b/src/config/configwindow.h index 660e600a..d15aee1e 100644 --- a/src/config/configwindow.h +++ b/src/config/configwindow.h @@ -31,9 +31,6 @@ class ConfigWindow : public QTabWidget { public: explicit ConfigWindow(QWidget *parent = nullptr); -public slots: - void updateComponents(); - signals: void updateChildren(); diff --git a/src/core/controller.cpp b/src/core/controller.cpp index 707ecd77..e10625fa 100644 --- a/src/core/controller.cpp +++ b/src/core/controller.cpp @@ -147,6 +147,6 @@ void Controller::sendTrayNotification( void Controller::updateConfigComponents() { if (m_configWindow) { - m_configWindow->updateComponents(); + m_configWindow->updateChildren(); } }