MCPcopy Create free account
hub / github.com/Martchus/syncthingtray / syncCompleteString

Function syncCompleteString

syncthingconnector/utils.cpp:82–103  ·  view source on GitHub ↗

! * \brief Returns the "sync complete" notification message for the specified directories. */

Source from the content-addressed store, hash-verified

80 * \brief Returns the "sync complete" notification message for the specified directories.
81 */
82QString syncCompleteString(const std::vector<const SyncthingDir *> &completedDirs, const SyncthingDev *remoteDevice)
83{
84 const auto devName(remoteDevice ? remoteDevice->displayName() : QString());
85 switch (completedDirs.size()) {
86 case 0:
87 return QString();
88 case 1:
89 if (devName.isEmpty()) {
90 return QCoreApplication::translate("Data::Utils", "Synchronization of local folder %1 complete")
91 .arg(completedDirs.front()->displayName());
92 }
93 return QCoreApplication::translate("Data::Utils", "Synchronization of %1 on %2 complete").arg(completedDirs.front()->displayName(), devName);
94 default:;
95 }
96 const auto names(things(completedDirs, [](const auto *dir) { return dir->displayName(); }));
97 if (devName.isEmpty()) {
98 return QCoreApplication::translate("Data::Utils", "Synchronization of the following local folders complete:\n")
99 + names.join(QStringLiteral(", "));
100 }
101 return QCoreApplication::translate("Data::Utils", "Synchronization of the following folders on %1 complete:\n").arg(devName)
102 + names.join(QStringLiteral(", "));
103}
104
105/*!
106 * \brief Returns the string representation of the specified \a rescanInterval.

Callers 1

emitSyncCompleteMethod · 0.85

Calls 2

displayNameMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected