| 86 | } |
| 87 | |
| 88 | void DxccColorProvider::setAutoReload(bool on, const QString& path) |
| 89 | { |
| 90 | // Remove any existing watched file and directory paths |
| 91 | if (!m_fileWatcher.files().isEmpty()) |
| 92 | m_fileWatcher.removePaths(m_fileWatcher.files()); |
| 93 | if (!m_fileWatcher.directories().isEmpty()) |
| 94 | m_fileWatcher.removePaths(m_fileWatcher.directories()); |
| 95 | m_debounceTimer.stop(); |
| 96 | |
| 97 | if (on && !path.isEmpty()) { |
| 98 | m_watchedPath = path; |
| 99 | m_fileWatcher.addPath(path); // watch the file (exists now) |
| 100 | // Watch the parent directory so we catch delete-then-recreate: |
| 101 | // if the file is removed and a new one dropped in later, the directory |
| 102 | // watcher fires and re-arms the file watcher when the file reappears. |
| 103 | const QString dir = QFileInfo(path).absolutePath(); |
| 104 | m_fileWatcher.addPath(dir); |
| 105 | } else { |
| 106 | m_watchedPath.clear(); |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | void DxccColorProvider::onParseFinished(QVector<QsoRecord> records) |
| 111 | { |
no test coverage detected