]> git.lyx.org Git - lyx.git/commitdiff
Fix compilation with 5 <= qt < 5.4
authorGuillaume Munch <gm@lyx.org>
Sat, 11 Mar 2017 21:21:11 +0000 (22:21 +0100)
committerGuillaume Munch <gm@lyx.org>
Sat, 11 Mar 2017 21:22:27 +0000 (22:22 +0100)
src/support/FileMonitor.cpp

index 051bbbbe0fac5f61e0ab7b236d7f7bbe3f9c62ca..bf53f379edacd5580cca9b1544fdd09da0895418 100644 (file)
@@ -106,19 +106,13 @@ void FileMonitorGuard::refresh(bool new_file)
                bool exists = QFile(qfilename).exists();
 #if (QT_VERSION >= 0x050000)
                if (!exists || !qwatcher_->addPath(qfilename)) {
-                       if (exists)
-                               LYXERR(Debug::FILES,
-                                      "Could not add path to QFileSystemWatcher: "
-                                      << filename_);
-                       QTimer::singleShot(1000, this, [=](){
-                                       refresh(new_file || !exists);
-                               });
 #else
                auto add_path = [&]() {
                        qwatcher_->addPath(qfilename);
                        return qwatcher_->files().contains(qfilename);
                };
                if (!exists || !add_path()) {
+#endif
                        if (exists)
                                LYXERR(Debug::FILES,
                                       "Could not add path to QFileSystemWatcher: "
@@ -127,7 +121,10 @@ void FileMonitorGuard::refresh(bool new_file)
                                QTimer::singleShot(1000, this, SLOT(refreshTrue()));
                        else
                                QTimer::singleShot(1000, this, SLOT(refreshFalse()));
-#endif
+                       // Better (qt>=5.4):
+                       /*QTimer::singleShot(1000, this, [=](){
+                                       refresh(new_file || !exists);
+                               });*/
                } else if (exists && new_file)
                        Q_EMIT fileChanged();
        }