Improve doc
This commit is contained in:
parent
14e0b3801b
commit
d863858bff
|
@ -156,6 +156,7 @@ include(WindowsResources)
|
||||||
include(WebViewProviderConfig)
|
include(WebViewProviderConfig)
|
||||||
include(AppTarget)
|
include(AppTarget)
|
||||||
include(ShellCompletion)
|
include(ShellCompletion)
|
||||||
|
include(Doxygen)
|
||||||
include(ConfigHeader)
|
include(ConfigHeader)
|
||||||
|
|
||||||
# create desktop file using previously defined meta data
|
# create desktop file using previously defined meta data
|
||||||
|
|
|
@ -40,7 +40,7 @@ QNetworkAccessManager &networkAccessManager()
|
||||||
* \brief Assigns the status from the specified status string.
|
* \brief Assigns the status from the specified status string.
|
||||||
* \returns Returns whether the status has actually changed.
|
* \returns Returns whether the status has actually changed.
|
||||||
*/
|
*/
|
||||||
bool SyncthingDir::assignStatus(const QString &statusStr, DateTime time)
|
bool SyncthingDir::assignStatus(const QString &statusStr, ChronoUtilities::DateTime time)
|
||||||
{
|
{
|
||||||
if(lastStatusUpdate > time) {
|
if(lastStatusUpdate > time) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -124,6 +124,7 @@ SyncthingItemDownloadProgress::SyncthingItemDownloadProgress(const QString &cont
|
||||||
/*!
|
/*!
|
||||||
* \class SyncthingConnection
|
* \class SyncthingConnection
|
||||||
* \brief The SyncthingConnection class allows Qt applications to access Syncthing.
|
* \brief The SyncthingConnection class allows Qt applications to access Syncthing.
|
||||||
|
* \remarks All requests are performed asynchronously.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -282,13 +283,23 @@ void SyncthingConnection::continueReconnecting()
|
||||||
requestStatus();
|
requestStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SyncthingConnection::pause(const QString &dev)
|
/*!
|
||||||
|
* \brief Requests pausing the device with the specified ID.
|
||||||
|
*
|
||||||
|
* The signal error() is emitted when the request was not successful.
|
||||||
|
*/
|
||||||
|
void SyncthingConnection::pause(const QString &devId)
|
||||||
{
|
{
|
||||||
QUrlQuery query;
|
QUrlQuery query;
|
||||||
query.addQueryItem(QStringLiteral("device"), dev);
|
query.addQueryItem(QStringLiteral("device"), devId);
|
||||||
QObject::connect(postData(QStringLiteral("system/pause"), query), &QNetworkReply::finished, this, &SyncthingConnection::readPauseResume);
|
QObject::connect(postData(QStringLiteral("system/pause"), query), &QNetworkReply::finished, this, &SyncthingConnection::readPauseResume);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Requests pausing all devices.
|
||||||
|
*
|
||||||
|
* The signal error() is emitted when the request was not successful.
|
||||||
|
*/
|
||||||
void SyncthingConnection::pauseAllDevs()
|
void SyncthingConnection::pauseAllDevs()
|
||||||
{
|
{
|
||||||
for(const SyncthingDev &dev : m_devs) {
|
for(const SyncthingDev &dev : m_devs) {
|
||||||
|
@ -296,13 +307,23 @@ void SyncthingConnection::pauseAllDevs()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SyncthingConnection::resume(const QString &dev)
|
/*!
|
||||||
|
* \brief Requests resuming the device with the specified ID.
|
||||||
|
*
|
||||||
|
* The signal error() is emitted when the request was not successful.
|
||||||
|
*/
|
||||||
|
void SyncthingConnection::resume(const QString &devId)
|
||||||
{
|
{
|
||||||
QUrlQuery query;
|
QUrlQuery query;
|
||||||
query.addQueryItem(QStringLiteral("device"), dev);
|
query.addQueryItem(QStringLiteral("device"), devId);
|
||||||
QObject::connect(postData(QStringLiteral("system/resume"), query), &QNetworkReply::finished, this, &SyncthingConnection::readPauseResume);
|
QObject::connect(postData(QStringLiteral("system/resume"), query), &QNetworkReply::finished, this, &SyncthingConnection::readPauseResume);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Requests resuming all devices.
|
||||||
|
*
|
||||||
|
* The signal error() is emitted when the request was not successful.
|
||||||
|
*/
|
||||||
void SyncthingConnection::resumeAllDevs()
|
void SyncthingConnection::resumeAllDevs()
|
||||||
{
|
{
|
||||||
for(const SyncthingDev &dev : m_devs) {
|
for(const SyncthingDev &dev : m_devs) {
|
||||||
|
@ -315,13 +336,18 @@ void SyncthingConnection::resumeAllDevs()
|
||||||
*
|
*
|
||||||
* The signal error() is emitted when the request was not successful.
|
* The signal error() is emitted when the request was not successful.
|
||||||
*/
|
*/
|
||||||
void SyncthingConnection::rescan(const QString &dir)
|
void SyncthingConnection::rescan(const QString &dirId)
|
||||||
{
|
{
|
||||||
QUrlQuery query;
|
QUrlQuery query;
|
||||||
query.addQueryItem(QStringLiteral("folder"), dir);
|
query.addQueryItem(QStringLiteral("folder"), dirId);
|
||||||
QObject::connect(postData(QStringLiteral("db/scan"), query), &QNetworkReply::finished, this, &SyncthingConnection::readRescan);
|
QObject::connect(postData(QStringLiteral("db/scan"), query), &QNetworkReply::finished, this, &SyncthingConnection::readRescan);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Requests rescanning all directories.
|
||||||
|
*
|
||||||
|
* The signal error() is emitted when the request was not successful.
|
||||||
|
*/
|
||||||
void SyncthingConnection::rescanAllDirs()
|
void SyncthingConnection::rescanAllDirs()
|
||||||
{
|
{
|
||||||
for(const SyncthingDir &dir : m_dirs) {
|
for(const SyncthingDir &dir : m_dirs) {
|
||||||
|
@ -329,12 +355,20 @@ void SyncthingConnection::rescanAllDirs()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Requests Syncthing to restart.
|
||||||
|
*
|
||||||
|
* The signal error() is emitted when the request was not successful.
|
||||||
|
*/
|
||||||
void SyncthingConnection::restart()
|
void SyncthingConnection::restart()
|
||||||
{
|
{
|
||||||
QObject::connect(postData(QStringLiteral("system/restart"), QUrlQuery()), &QNetworkReply::finished, this, &SyncthingConnection::readRestart);
|
QObject::connect(postData(QStringLiteral("system/restart"), QUrlQuery()), &QNetworkReply::finished, this, &SyncthingConnection::readRestart);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SyncthingConnection::notificationsRead()
|
/*!
|
||||||
|
* \brief Considers all notifications as read; hence might trigger a status update.
|
||||||
|
*/
|
||||||
|
void SyncthingConnection::considerAllNotificationsRead()
|
||||||
{
|
{
|
||||||
m_unreadNotifications = false;
|
m_unreadNotifications = false;
|
||||||
setStatus(status());
|
setStatus(status());
|
||||||
|
@ -375,11 +409,16 @@ QNetworkReply *SyncthingConnection::postData(const QString &path, const QUrlQuer
|
||||||
return reply;
|
return reply;
|
||||||
}
|
}
|
||||||
|
|
||||||
SyncthingDir *SyncthingConnection::findDirInfo(const QString &dir, int &row)
|
/*!
|
||||||
|
* \brief Returns the directory info object for the directory with the specified ID.
|
||||||
|
* \returns Returns a pointer to the object or nullptr if not found.
|
||||||
|
* \remarks The returned object becomes invalid when the newDirs() signal is emitted or the connection is destroyed.
|
||||||
|
*/
|
||||||
|
SyncthingDir *SyncthingConnection::findDirInfo(const QString &dirId, int &row)
|
||||||
{
|
{
|
||||||
row = 0;
|
row = 0;
|
||||||
for(SyncthingDir &d : m_dirs) {
|
for(SyncthingDir &d : m_dirs) {
|
||||||
if(d.id == dir) {
|
if(d.id == dirId) {
|
||||||
return &d;
|
return &d;
|
||||||
}
|
}
|
||||||
++row;
|
++row;
|
||||||
|
@ -387,11 +426,16 @@ SyncthingDir *SyncthingConnection::findDirInfo(const QString &dir, int &row)
|
||||||
return nullptr; // TODO: dir is unknown, trigger refreshing the config
|
return nullptr; // TODO: dir is unknown, trigger refreshing the config
|
||||||
}
|
}
|
||||||
|
|
||||||
SyncthingDev *SyncthingConnection::findDevInfo(const QString &dev, int &row)
|
/*!
|
||||||
|
* \brief Returns the device info object for the device with the specified ID.
|
||||||
|
* \returns Returns a pointer to the object or nullptr if not found.
|
||||||
|
* \remarks The returned object becomes invalid when the newConfig() signal is emitted or the connection is destroyed.
|
||||||
|
*/
|
||||||
|
SyncthingDev *SyncthingConnection::findDevInfo(const QString &devId, int &row)
|
||||||
{
|
{
|
||||||
row = 0;
|
row = 0;
|
||||||
for(SyncthingDev &d : m_devs) {
|
for(SyncthingDev &d : m_devs) {
|
||||||
if(d.id == dev) {
|
if(d.id == devId) {
|
||||||
return &d;
|
return &d;
|
||||||
}
|
}
|
||||||
++row;
|
++row;
|
||||||
|
|
|
@ -201,14 +201,14 @@ public Q_SLOTS:
|
||||||
void disconnect();
|
void disconnect();
|
||||||
void reconnect();
|
void reconnect();
|
||||||
void reconnect(Settings::ConnectionSettings &connectionSettings);
|
void reconnect(Settings::ConnectionSettings &connectionSettings);
|
||||||
void pause(const QString &dev);
|
void pause(const QString &devId);
|
||||||
void pauseAllDevs();
|
void pauseAllDevs();
|
||||||
void resume(const QString &dev);
|
void resume(const QString &devId);
|
||||||
void resumeAllDevs();
|
void resumeAllDevs();
|
||||||
void rescan(const QString &dir);
|
void rescan(const QString &dirId);
|
||||||
void rescanAllDirs();
|
void rescanAllDirs();
|
||||||
void restart();
|
void restart();
|
||||||
void notificationsRead();
|
void considerAllNotificationsRead();
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
/*!
|
/*!
|
||||||
|
@ -322,8 +322,8 @@ private:
|
||||||
QNetworkRequest prepareRequest(const QString &path, const QUrlQuery &query, bool rest = true);
|
QNetworkRequest prepareRequest(const QString &path, const QUrlQuery &query, bool rest = true);
|
||||||
QNetworkReply *requestData(const QString &path, const QUrlQuery &query, bool rest = true);
|
QNetworkReply *requestData(const QString &path, const QUrlQuery &query, bool rest = true);
|
||||||
QNetworkReply *postData(const QString &path, const QUrlQuery &query, const QByteArray &data = QByteArray());
|
QNetworkReply *postData(const QString &path, const QUrlQuery &query, const QByteArray &data = QByteArray());
|
||||||
SyncthingDir *findDirInfo(const QString &dir, int &row);
|
SyncthingDir *findDirInfo(const QString &dirId, int &row);
|
||||||
SyncthingDev *findDevInfo(const QString &dev, int &row);
|
SyncthingDev *findDevInfo(const QString &devId, int &row);
|
||||||
|
|
||||||
QString m_syncthingUrl;
|
QString m_syncthingUrl;
|
||||||
QByteArray m_apiKey;
|
QByteArray m_apiKey;
|
||||||
|
@ -516,7 +516,7 @@ inline double SyncthingConnection::totalOutgoingRate() const
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Returns all available directory info.
|
* \brief Returns all available directory information.
|
||||||
* \remarks The returned object container object is persistent. However, the contained
|
* \remarks The returned object container object is persistent. However, the contained
|
||||||
* info objects are invalidated when the newConfig() signal is emitted.
|
* info objects are invalidated when the newConfig() signal is emitted.
|
||||||
*/
|
*/
|
||||||
|
@ -526,7 +526,7 @@ inline const std::vector<SyncthingDir> &SyncthingConnection::dirInfo() const
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Returns all available device info.
|
* \brief Returns all available device information.
|
||||||
* \remarks The returned object container object is persistent. However, the contained
|
* \remarks The returned object container object is persistent. However, the contained
|
||||||
* info objects are invalidated when the newConfig() signal is emitted.
|
* info objects are invalidated when the newConfig() signal is emitted.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -77,7 +77,7 @@ void TrayIcon::handleActivated(QSystemTrayIcon::ActivationReason reason)
|
||||||
|
|
||||||
void TrayIcon::handleMessageClicked()
|
void TrayIcon::handleMessageClicked()
|
||||||
{
|
{
|
||||||
m_trayMenu.widget()->connection().notificationsRead();
|
m_trayMenu.widget()->connection().considerAllNotificationsRead();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrayIcon::showInternalError(const QString &errorMsg)
|
void TrayIcon::showInternalError(const QString &errorMsg)
|
||||||
|
|
|
@ -238,7 +238,7 @@ void TrayWidget::showNotifications()
|
||||||
}
|
}
|
||||||
m_notifications.clear();
|
m_notifications.clear();
|
||||||
showDialog(dlg);
|
showDialog(dlg);
|
||||||
m_connection.notificationsRead();
|
m_connection.considerAllNotificationsRead();
|
||||||
m_ui->notificationsPushButton->setHidden(true);
|
m_ui->notificationsPushButton->setHidden(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue