mirror of
https://github.com/fergalmoran/flameshot.git
synced 2025-12-22 09:51:06 +00:00
FileSystemWatcher: update after file deletion only
This commit is contained in:
@@ -38,12 +38,11 @@ ConfigWindow::ConfigWindow(QWidget *parent) : QTabWidget(parent) {
|
|||||||
setWindowTitle(tr("Configuration"));
|
setWindowTitle(tr("Configuration"));
|
||||||
|
|
||||||
auto changedSlot = [this](QString s){
|
auto changedSlot = [this](QString s){
|
||||||
Q_UNUSED(s);
|
QStringList files = m_configWatcher->files();
|
||||||
this->m_configWatcher->removePath(s);
|
if (!files.contains(s)) {
|
||||||
this->m_configWatcher->addPath(s);
|
this->m_configWatcher->addPath(s);
|
||||||
if(!this->hasFocus()) {
|
|
||||||
Q_EMIT updateComponents();
|
|
||||||
}
|
}
|
||||||
|
Q_EMIT updateChildren();
|
||||||
};
|
};
|
||||||
m_configWatcher = new QFileSystemWatcher(this);
|
m_configWatcher = new QFileSystemWatcher(this);
|
||||||
m_configWatcher->addPath(ConfigHandler().configFilePath());
|
m_configWatcher->addPath(ConfigHandler().configFilePath());
|
||||||
@@ -97,10 +96,6 @@ ConfigWindow::ConfigWindow(QWidget *parent) : QTabWidget(parent) {
|
|||||||
m_generalConfig, &GeneneralConf::updateComponents);
|
m_generalConfig, &GeneneralConf::updateComponents);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigWindow::updateComponents() {
|
|
||||||
Q_EMIT updateChildren();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConfigWindow::keyPressEvent(QKeyEvent *e) {
|
void ConfigWindow::keyPressEvent(QKeyEvent *e) {
|
||||||
if (e->key() == Qt::Key_Escape) {
|
if (e->key() == Qt::Key_Escape) {
|
||||||
close();
|
close();
|
||||||
|
|||||||
@@ -31,9 +31,6 @@ class ConfigWindow : public QTabWidget {
|
|||||||
public:
|
public:
|
||||||
explicit ConfigWindow(QWidget *parent = nullptr);
|
explicit ConfigWindow(QWidget *parent = nullptr);
|
||||||
|
|
||||||
public slots:
|
|
||||||
void updateComponents();
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void updateChildren();
|
void updateChildren();
|
||||||
|
|
||||||
|
|||||||
@@ -147,6 +147,6 @@ void Controller::sendTrayNotification(
|
|||||||
|
|
||||||
void Controller::updateConfigComponents() {
|
void Controller::updateConfigComponents() {
|
||||||
if (m_configWindow) {
|
if (m_configWindow) {
|
||||||
m_configWindow->updateComponents();
|
m_configWindow->updateChildren();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user