Show whether filesystem watcher active

This commit is contained in:
Martchus 2018-09-15 18:18:15 +02:00
parent 7611ad1c8e
commit de9259e545
8 changed files with 49 additions and 14 deletions

View File

@ -528,7 +528,7 @@ void Application::printDir(const RelevantDir &relevantDir) const
printProperty("Type", dir->dirTypeString()); printProperty("Type", dir->dirTypeString());
printProperty("Ignore permissions", dir->ignorePermissions); printProperty("Ignore permissions", dir->ignorePermissions);
printProperty("Auto-normalize", dir->autoNormalize); printProperty("Auto-normalize", dir->autoNormalize);
printProperty("Rescan interval", rescanIntervalString(dir->rescanInterval)); printProperty("Rescan interval", rescanIntervalString(dir->rescanInterval, dir->fileSystemWatcherEnabled));
printProperty("Min. free disk percentage", dir->minDiskFreePercentage); printProperty("Min. free disk percentage", dir->minDiskFreePercentage);
printProperty("Error", dir->globalError); printProperty("Error", dir->globalError);
if (!dir->itemErrors.empty()) { if (!dir->itemErrors.empty()) {

View File

@ -9,7 +9,7 @@ Directories
Type Send & Receive Type Send & Receive
Ignore permissions no Ignore permissions no
Auto-normalize yes Auto-normalize yes
Rescan interval 365 d Rescan interval 365 d, file system watcher disabled
- test1 - test1
Path /tmp/some/path/1/ Path /tmp/some/path/1/
@ -22,7 +22,7 @@ Directories
Type Send & Receive Type Send & Receive
Ignore permissions no Ignore permissions no
Auto-normalize yes Auto-normalize yes
Rescan interval 2 h Rescan interval 2 h, file system watcher disabled
Devices Devices
- Test dev 1 - Test dev 1

View File

@ -172,7 +172,7 @@ void ApplicationTests::test()
cout << stdout; cout << stdout;
CPPUNIT_ASSERT(stdout.find("test1") != string::npos); CPPUNIT_ASSERT(stdout.find("test1") != string::npos);
CPPUNIT_ASSERT(stdout.find("test2") == string::npos); CPPUNIT_ASSERT(stdout.find("test2") == string::npos);
CPPUNIT_ASSERT(stdout.find("Rescan interval rescan disabled") != string::npos); CPPUNIT_ASSERT(stdout.find("Rescan interval file system watcher and periodic rescan disabled") != string::npos);
#endif #endif
// test rescan: create new file, trigger rescan, check status // test rescan: create new file, trigger rescan, check status

View File

@ -333,9 +333,24 @@
</translation> </translation>
</message> </message>
<message> <message>
<location filename="../utils.cpp" line="96"/> <location filename="../utils.cpp" line="97"/>
<source>rescan disabled</source> <source>file system watcher and periodic rescan disabled</source>
<translation>deaktiviert</translation> <translation>Dateisystemüberwachung und periodischer Scan deaktiviert</translation>
</message>
<message>
<location filename="../utils.cpp" line="99"/>
<source>file system watcher active, periodic rescan disabled</source>
<translation>Dateisystemüberwachung aktiv, periodischer Scan deaktiviert</translation>
</message>
<message>
<location filename="../utils.cpp" line="102"/>
<source>, file system watcher enabled</source>
<translation>, Dateisystemüberwachung aktiviert</translation>
</message>
<message>
<location filename="../utils.cpp" line="103"/>
<source>, file system watcher disabled</source>
<translation>, Dateisystemüberwachung deaktiviert</translation>
</message> </message>
<message> <message>
<location filename="../utils.cpp" line="78"/> <location filename="../utils.cpp" line="78"/>

View File

@ -332,8 +332,23 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../utils.cpp" line="96"/> <location filename="../utils.cpp" line="97"/>
<source>rescan disabled</source> <source>file system watcher and periodic rescan disabled</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../utils.cpp" line="99"/>
<source>file system watcher active, periodic rescan disabled</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../utils.cpp" line="102"/>
<source>, file system watcher enabled</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../utils.cpp" line="103"/>
<source>, file system watcher disabled</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>

View File

@ -90,12 +90,17 @@ QString syncCompleteString(const std::vector<const SyncthingDir *> &completedDir
/*! /*!
* \brief Returns the string representation of the specified \a rescanInterval. * \brief Returns the string representation of the specified \a rescanInterval.
*/ */
QString rescanIntervalString(int rescanInterval) QString rescanIntervalString(int rescanInterval, bool fileSystemWatcherEnabled)
{ {
if (!rescanInterval) { if (!rescanInterval) {
return QCoreApplication::translate("Data::Utils", "rescan disabled"); if (!fileSystemWatcherEnabled) {
return QCoreApplication::translate("Data::Utils", "file system watcher and periodic rescan disabled");
} }
return QString::fromLatin1(TimeSpan::fromSeconds(rescanInterval).toString(TimeSpanOutputFormat::WithMeasures, true).data()); return QCoreApplication::translate("Data::Utils", "file system watcher active, periodic rescan disabled");
}
return QString::fromLatin1(TimeSpan::fromSeconds(rescanInterval).toString(TimeSpanOutputFormat::WithMeasures, true).data())
+ (fileSystemWatcherEnabled ? QCoreApplication::translate("Data::Utils", ", file system watcher enabled")
: QCoreApplication::translate("Data::Utils", ", file system watcher disabled"));
} }
/*! /*!

View File

@ -30,7 +30,7 @@ QString LIB_SYNCTHING_CONNECTOR_EXPORT trafficString(uint64 total, double rate);
QString LIB_SYNCTHING_CONNECTOR_EXPORT directoryStatusString(const Data::SyncthingStatistics &stats); QString LIB_SYNCTHING_CONNECTOR_EXPORT directoryStatusString(const Data::SyncthingStatistics &stats);
QString LIB_SYNCTHING_CONNECTOR_EXPORT syncCompleteString( QString LIB_SYNCTHING_CONNECTOR_EXPORT syncCompleteString(
const std::vector<const SyncthingDir *> &completedDirs, const SyncthingDev *remoteDevice = nullptr); const std::vector<const SyncthingDir *> &completedDirs, const SyncthingDev *remoteDevice = nullptr);
QString LIB_SYNCTHING_CONNECTOR_EXPORT rescanIntervalString(int rescanInterval); QString LIB_SYNCTHING_CONNECTOR_EXPORT rescanIntervalString(int rescanInterval, bool fileSystemWatcherEnabled);
bool LIB_SYNCTHING_CONNECTOR_EXPORT isLocal(const QUrl &url); bool LIB_SYNCTHING_CONNECTOR_EXPORT isLocal(const QUrl &url);
bool LIB_SYNCTHING_CONNECTOR_EXPORT setDirectoriesPaused(QJsonObject &syncthingConfig, const QStringList &dirIds, bool paused); bool LIB_SYNCTHING_CONNECTOR_EXPORT setDirectoriesPaused(QJsonObject &syncthingConfig, const QStringList &dirIds, bool paused);
bool LIB_SYNCTHING_CONNECTOR_EXPORT setDevicesPaused(QJsonObject &syncthingConfig, const QStringList &dirs, bool paused); bool LIB_SYNCTHING_CONNECTOR_EXPORT setDevicesPaused(QJsonObject &syncthingConfig, const QStringList &dirs, bool paused);

View File

@ -159,7 +159,7 @@ QVariant SyncthingDirectoryModel::data(const QModelIndex &index, int role) const
case 5: case 5:
return dir.dirTypeString(); return dir.dirTypeString();
case 6: case 6:
return rescanIntervalString(dir.rescanInterval); return rescanIntervalString(dir.rescanInterval, dir.fileSystemWatcherEnabled);
case 7: case 7:
return dir.lastScanTime.isNull() return dir.lastScanTime.isNull()
? tr("unknown") ? tr("unknown")