Apply tidy after updating to clang-format 5.0.0

The behavior of clang-format slightly changed in Clang 5.0.0:
http://releases.llvm.org/5.0.0/tools/clang/docs/ReleaseNotes.html#clang-format
This commit is contained in:
Martchus 2017-09-17 21:48:15 +02:00
parent 18ed981d29
commit 69ffaeb1f3
54 changed files with 84 additions and 79 deletions

View File

@ -1503,10 +1503,12 @@ void SyncthingConnection::readDownloadProgressEvent(DateTime eventTime, const QJ
= QStringLiteral("%1 / %2 - %3 %")
.arg(QString::fromLatin1(dataSizeToString(dirInfo.blocksAlreadyDownloaded > 0
? static_cast<uint64>(dirInfo.blocksAlreadyDownloaded) * SyncthingItemDownloadProgress::syncthingBlockSize
: 0).data()),
: 0)
.data()),
QString::fromLatin1(dataSizeToString(dirInfo.blocksToBeDownloaded > 0
? static_cast<uint64>(dirInfo.blocksToBeDownloaded) * SyncthingItemDownloadProgress::syncthingBlockSize
: 0).data()),
: 0)
.data()),
QString::number(dirInfo.downloadPercentage));
}
emit downloadProgressChanged();
@ -2091,4 +2093,4 @@ void SyncthingConnection::recalculateStatus()
* \fn SyncthingConnection::restartTriggered()
* \brief Indicates a restart has been successfully triggered via restart().
*/
}
} // namespace Data

View File

@ -18,4 +18,4 @@ bool SyncthingConnectionSettings::loadHttpsCert()
}
return true;
}
}
} // namespace Data

View File

@ -24,6 +24,6 @@ struct LIB_SYNCTHING_CONNECTOR_EXPORT SyncthingConnectionSettings {
QList<QSslError> expectedSslErrors;
bool loadHttpsCert();
};
}
} // namespace Data
#endif // SYNCTHINGCONNECTIONSETTINGS_H

View File

@ -127,4 +127,4 @@ bool setDevicesPaused(QJsonObject &syncthingConfig, const QStringList &devIds, b
}
return altered;
}
}
} // namespace Data

View File

@ -45,6 +45,6 @@ template <class Objects> QStringList LIB_SYNCTHING_CONNECTOR_EXPORT ids(const Ob
}
return ids;
}
}
} // namespace Data
#endif // DATA_UTILS_H

View File

@ -34,7 +34,7 @@ inline QColor orange(bool bright)
{
return bright ? QColor(0xFFC500) : QColor(0xA85900);
}
}
} // namespace Colors
} // namespace Data

View File

@ -89,11 +89,11 @@ QtGui::SettingsDialog *setupSettingsDialog(SyncthingApplet &applet)
#ifdef LIB_SYNCTHING_CONNECTOR_SUPPORT_SYSTEMD
<< systemdPage
#endif
);
);
category->setIcon(
QIcon::fromTheme(QStringLiteral("preferences-other"), QIcon(QStringLiteral(":/icons/hicolor/scalable/apps/preferences-other.svg"))));
categories << category;
return new ::QtGui::SettingsDialog(categories);
}
}
} // namespace Plasmoid

View File

@ -23,6 +23,6 @@ QKeySequenceEdit *m_globalShortcutEdit;
END_DECLARE_OPTION_PAGE
QtGui::SettingsDialog *setupSettingsDialog(Plasmoid::SyncthingApplet &applet);
}
} // namespace Plasmoid
#endif // SETTINGSDIALOG_H

View File

@ -297,7 +297,7 @@ void SyncthingApplet::handleConnectionStatusChanged(SyncthingStatus status)
#ifdef LIB_SYNCTHING_CONNECTOR_SUPPORT_SYSTEMD
&& !syncthingService().isManuallyStopped()
#endif
) {
) {
m_dbusNotifier.showDisconnect();
}
break;
@ -371,7 +371,7 @@ void SyncthingApplet::handleSystemdServiceError(const QString &context, const QS
handleInternalError(tr("D-Bus error - unable to ") % context % QChar('\n') % name % QChar(':') % message, SyncthingErrorCategory::SpecificRequest,
QNetworkReply::NoError, QNetworkRequest(), QByteArray());
}
}
} // namespace Plasmoid
K_EXPORT_PLASMA_APPLET_WITH_JSON(syncthing, Plasmoid::SyncthingApplet, "metadata.json")

View File

@ -27,7 +27,7 @@ class SyncthingDeviceModel;
class SyncthingDownloadModel;
class SyncthingService;
enum class SyncthingErrorCategory;
}
} // namespace Data
namespace QtGui {
class WebViewDialog;
@ -191,6 +191,6 @@ inline Data::SyncthingConnectionSettings *SyncthingApplet::currentConnectionConf
{
return connectionConfig(m_currentConnectionConfig);
}
}
} // namespace Plasmoid
#endif // SYNCTHINGAPPLET_H

View File

@ -8,4 +8,4 @@ namespace TestUtilities {
* The default factor is 1.0.
*/
double timeoutFactor = 1.0;
}
} // namespace TestUtilities

View File

@ -299,6 +299,6 @@ template <typename Action, typename... SignalInfos> void waitForSignals(Action a
" ms.", timeoutFactor != 1.0 ? argsToString(" (original timeout: ", timeout, " ms)") : std::string()));
}
}
}
} // namespace TestUtilities
#endif // SYNCTHINGTESTHELPER_H

View File

@ -97,4 +97,4 @@ void SyncthingTestInstance::stop()
cerr << "\n - Syncthing stderr during the testrun:\n" << m_syncthingProcess.readAllStandardError().data();
}
}
}
} // namespace TestUtilities

View File

@ -59,6 +59,6 @@ inline QProcess &SyncthingTestInstance::syncthingProcess()
{
return m_syncthingProcess;
}
}
} // namespace TestUtilities
#endif // SYNCTHINGTESTHELPER_SYNCTHINGTESTINSTANCE_H

View File

@ -84,8 +84,9 @@ int initSyncthingTray(bool windowed, bool waitForTray, const char *connectionCon
}
#else
QMessageBox::critical(nullptr, QApplication::applicationName(),
QApplication::translate("main", "The Qt libraries have not been built with tray icon support. You could open the tray menu as a regular "
"window using the -w flag, though."));
QApplication::translate("main",
"The Qt libraries have not been built with tray icon support. You could open the tray menu as a regular "
"window using the -w flag, though."));
return -2;
#endif
}

View File

@ -93,4 +93,4 @@ void SingleInstance::readArgs()
emit newInstance(static_cast<int>(args.size() - 1), args.data());
}
}
} // namespace QtGui

View File

@ -26,6 +26,6 @@ private Q_SLOTS:
private:
QLocalServer *m_server;
};
}
} // namespace QtGui
#endif // SINGLEINSTANCE_H

View File

@ -60,4 +60,4 @@ void DevButtonsItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem
option.rect.right() - 16, buttonY, 16, 16, index.data(SyncthingDeviceModel::DevicePaused).toBool() ? m_resumeIcon : m_pauseIcon);
}
}
}
} // namespace QtGui

View File

@ -17,6 +17,6 @@ private:
const QPixmap m_pauseIcon;
const QPixmap m_resumeIcon;
};
}
} // namespace QtGui
#endif // DEVBUTTONSITEMDELEGATE_H

View File

@ -98,4 +98,4 @@ void DevView::copySelectedItemId()
}
}
}
}
} // namespace QtGui

View File

@ -25,6 +25,6 @@ private Q_SLOTS:
void copySelectedItem();
void copySelectedItemId();
};
}
} // namespace QtGui
#endif // DEVVIEW_H

View File

@ -67,4 +67,4 @@ void DirButtonsItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem
painter->drawPixmap(option.rect.right() - 16, buttonY, 16, 16, m_folderIcon);
}
}
}
} // namespace QtGui

View File

@ -19,6 +19,6 @@ private:
const QPixmap m_pauseIcon;
const QPixmap m_resumeIcon;
};
}
} // namespace QtGui
#endif // DIRBUTTONSITEMDELEGATE_H

View File

@ -115,4 +115,4 @@ void DirView::copySelectedItemPath()
}
}
}
}
} // namespace QtGui

View File

@ -27,6 +27,6 @@ private Q_SLOTS:
void copySelectedItem();
void copySelectedItemPath();
};
}
} // namespace QtGui
#endif // DIRVIEW_H

View File

@ -95,4 +95,4 @@ QSize DownloadItemDelegate::sizeHint(const QStyleOptionViewItem &option, const Q
}
return defaultSize;
}
}
} // namespace QtGui

View File

@ -17,6 +17,6 @@ public:
private:
const QPixmap m_folderIcon;
};
}
} // namespace QtGui
#endif // DOWNLOADITEMDELEGATE_H

View File

@ -83,4 +83,4 @@ void DownloadView::copySelectedItem()
}
}
}
}
} // namespace QtGui

View File

@ -6,7 +6,7 @@
namespace Data {
struct SyncthingItemDownloadProgress;
struct SyncthingDir;
}
} // namespace Data
namespace QtGui {
@ -26,6 +26,6 @@ private Q_SLOTS:
void showContextMenu();
void copySelectedItem();
};
}
} // namespace QtGui
#endif // DOWNLOADVIEW_H

View File

@ -219,7 +219,7 @@ void TrayIcon::showStatusNotification(SyncthingStatus status)
#ifdef LIB_SYNCTHING_CONNECTOR_SUPPORT_SYSTEMD
&& !syncthingService().isManuallyStopped()
#endif
) {
) {
#ifdef QT_UTILITIES_SUPPORT_DBUS_NOTIFICATIONS
if (settings.dbusNotifications) {
m_dbusNotifier.showDisconnect();
@ -277,4 +277,4 @@ void TrayIcon::showInternalErrorsDialog()
centerWidget(errorViewDlg);
errorViewDlg->show();
}
}
} // namespace QtGui

View File

@ -16,7 +16,7 @@ QT_FORWARD_DECLARE_CLASS(QNetworkRequest)
namespace Data {
enum class SyncthingStatus;
enum class SyncthingErrorCategory;
}
} // namespace Data
namespace QtGui {
@ -59,6 +59,6 @@ inline TrayMenu &TrayIcon::trayMenu()
{
return m_trayMenu;
}
}
} // namespace QtGui
#endif // TRAY_ICON_H

View File

@ -58,4 +58,4 @@ void TrayMenu::showAtCursor()
moveInside(pos, size(), QApplication::desktop()->availableGeometry(pos));
popup(pos);
}
}
} // namespace QtGui

View File

@ -36,6 +36,6 @@ inline TrayIcon *TrayMenu::icon()
{
return m_trayIcon;
}
}
} // namespace QtGui
#endif // TRAY_MENU_H

View File

@ -591,4 +591,4 @@ void TrayWidget::showDialog(QWidget *dlg)
dlg->show();
dlg->activateWindow();
}
}
} // namespace QtGui

View File

@ -116,6 +116,6 @@ inline const std::vector<TrayWidget *> &TrayWidget::instances()
{
return m_instances;
}
}
} // namespace QtGui
#endif // TRAY_WIDGET_H

View File

@ -35,6 +35,6 @@ void DBusStatusNotifier::handleSyncthingNotificationAction(const QString &action
emit showNotificationsRequested();
}
}
}
} // namespace QtGui
#endif

View File

@ -69,6 +69,6 @@ inline void DBusStatusNotifier::showSyncComplete(const QString &message)
{
m_syncCompleteNotification.update(message);
}
}
} // namespace QtGui
#endif // !defined(SYNCTHINGWIDGETS_DBUSSTATUSNOTIFIER_H) && defined(QT_UTILITIES_SUPPORT_DBUS_NOTIFICATIONS)

View File

@ -110,4 +110,4 @@ void ErrorViewDialog::clearErrors()
s_instance->browser()->clear();
}
}
}
} // namespace QtGui

View File

@ -47,6 +47,6 @@ inline void ErrorViewDialog::showInstance()
{
instance()->show();
}
}
} // namespace QtGui
#endif // SYNCTHINGWIDGETS_ERRORVIEWDIALOG_H

View File

@ -29,4 +29,4 @@ bool InternalError::isRelevant(const SyncthingConnection &connection, SyncthingE
#endif
;
}
}
} // namespace QtGui

View File

@ -12,7 +12,7 @@
namespace Data {
class SyncthingConnection;
enum class SyncthingErrorCategory;
}
} // namespace Data
namespace QtGui {
@ -34,6 +34,6 @@ inline InternalError::InternalError(const QString &message, const QUrl &url, con
, when(ChronoUtilities::DateTime::now())
{
}
}
} // namespace QtGui
#endif // SYNCTHINGWIDGETS_INTERNALERROR_H

View File

@ -46,13 +46,14 @@ QDialog *ownDeviceIdDialog(Data::SyncthingConnection &connection)
QObject::connect(
copyPushButton, &QPushButton::clicked, bind(&QClipboard::setText, QGuiApplication::clipboard(), connection.myId(), QClipboard::Clipboard));
layout->addWidget(copyPushButton);
QObject::connect(dlg, &QWidget::destroyed, bind(static_cast<bool (*)(const QMetaObject::Connection &)>(&QObject::disconnect),
connection.requestQrCode(connection.myId(), [pixmapLabel](const QByteArray &data) {
QPixmap pixmap;
pixmap.loadFromData(data);
pixmapLabel->setPixmap(pixmap);
})));
QObject::connect(dlg, &QWidget::destroyed,
bind(static_cast<bool (*)(const QMetaObject::Connection &)>(&QObject::disconnect),
connection.requestQrCode(connection.myId(), [pixmapLabel](const QByteArray &data) {
QPixmap pixmap;
pixmap.loadFromData(data);
pixmapLabel->setPixmap(pixmap);
})));
dlg->setLayout(layout);
return dlg;
}
}
} // namespace QtGui

View File

@ -94,4 +94,4 @@ void StatusInfo::update(const SyncthingConnection &connection)
m_additionalStatusText.clear();
}
}
}
} // namespace QtGui

View File

@ -48,6 +48,6 @@ inline const QIcon &StatusInfo::statusIcon() const
{
return *m_statusIcon;
}
}
} // namespace QtGui
#endif // SYNCTHINGWIDGETS_STATUSINFO_H

View File

@ -132,8 +132,9 @@ TextViewDialog *TextViewDialog::forLogEntries(SyncthingConnection &connection)
{
auto *const dlg = new TextViewDialog(tr("Log"));
const auto loadLog = [dlg, &connection] {
connect(dlg, &QWidget::destroyed, bind(static_cast<bool (*)(const QMetaObject::Connection &)>(&QObject::disconnect),
connection.requestLog(bind(&TextViewDialog::showLogEntries, dlg, _1))));
connect(dlg, &QWidget::destroyed,
bind(static_cast<bool (*)(const QMetaObject::Connection &)>(&QObject::disconnect),
connection.requestLog(bind(&TextViewDialog::showLogEntries, dlg, _1))));
};
connect(dlg, &TextViewDialog::reload, loadLog);
loadLog();
@ -167,4 +168,4 @@ void TextViewDialog::showLogEntries(const std::vector<SyncthingLogEntry> &logEnt
browser()->append(entry.when % QChar(':') % QChar(' ') % QChar('\n') % entry.message % QChar('\n'));
}
}
}
} // namespace QtGui

View File

@ -12,7 +12,7 @@ namespace Data {
class SyncthingConnection;
struct SyncthingDir;
struct SyncthingLogEntry;
}
} // namespace Data
namespace QtGui {
@ -43,6 +43,6 @@ inline QTextBrowser *TextViewDialog::browser()
{
return m_browser;
}
}
} // namespace QtGui
#endif // SYNCTHINGWIDGETS_TEXTVIEWDIALOG_H

View File

@ -33,7 +33,7 @@ template <> struct hash<QString> {
return qHash(str);
}
};
}
} // namespace std
namespace Settings {
@ -288,4 +288,4 @@ void save()
v.qt.save(settings);
}
}
} // namespace Settings

View File

@ -109,6 +109,6 @@ struct SYNCTHINGWIDGETS_EXPORT Settings {
Settings SYNCTHINGWIDGETS_EXPORT &values();
void SYNCTHINGWIDGETS_EXPORT restore();
void SYNCTHINGWIDGETS_EXPORT save();
}
} // namespace Settings
#endif // SETTINGS_H

View File

@ -897,9 +897,9 @@ QWidget *WebViewOptionPage::setupWidget()
auto *label = new QLabel;
label->setWindowTitle(QCoreApplication::translate("QtGui::WebViewOptionPage", "General"));
label->setAlignment(Qt::AlignCenter);
label->setText(
QCoreApplication::translate("QtGui::WebViewOptionPage", "Syncthing Tray has not been built with vieb view support utilizing either Qt WebKit "
"or Qt WebEngine.\nThe Web UI will be opened in the default web browser instead."));
label->setText(QCoreApplication::translate("QtGui::WebViewOptionPage",
"Syncthing Tray has not been built with vieb view support utilizing either Qt WebKit "
"or Qt WebEngine.\nThe Web UI will be opened in the default web browser instead."));
return label;
}
#endif
@ -964,7 +964,7 @@ SettingsDialog::SettingsDialog(Data::SyncthingConnection *connection, QWidget *p
#ifdef LIB_SYNCTHING_CONNECTOR_SUPPORT_SYSTEMD
<< new SystemdOptionPage
#endif
);
);
category->setIcon(QIcon::fromTheme(QStringLiteral("system-run"), QIcon(QStringLiteral(":/icons/hicolor/scalable/apps/system-run.svg"))));
categories << category;
@ -987,7 +987,7 @@ void SettingsDialog::init()
// some settings could be applied without restarting the application, good idea?
//connect(this, &Dialogs::SettingsDialog::applied, bind(&Dialogs::QtSettings::apply, &Settings::qtSettings()));
}
}
} // namespace QtGui
INSTANTIATE_UI_FILE_BASED_OPTION_PAGE_NS(QtGui, ConnectionOptionPage)
INSTANTIATE_UI_FILE_BASED_OPTION_PAGE_NS(QtGui, NotificationsOptionPage)

View File

@ -18,7 +18,7 @@ namespace Data {
class SyncthingConnection;
class SyncthingService;
class SyncthingProcess;
}
} // namespace Data
namespace QtGui {
@ -120,7 +120,7 @@ public:
private:
void init();
};
}
} // namespace QtGui
DECLARE_EXTERN_UI_FILE_BASED_OPTION_PAGE_NS(QtGui, ConnectionOptionPage)
DECLARE_EXTERN_UI_FILE_BASED_OPTION_PAGE_NS(QtGui, NotificationsOptionPage)

View File

@ -166,6 +166,6 @@ void WebPage::handleSslErrors(QNetworkReply *reply, const QList<QSslError> &erro
}
}
#endif
}
} // namespace QtGui
#endif // SYNCTHINGWIDGETS_NO_WEBVIEW

View File

@ -47,7 +47,7 @@ private:
WebViewDialog *m_dlg;
SYNCTHINGWIDGETS_WEB_VIEW *m_view;
};
}
} // namespace QtGui
#endif // SYNCTHINGWIDGETS_NO_WEBVIEW
#endif // WEBPAGE_H

View File

@ -122,6 +122,6 @@ bool WebViewDialog::eventFilter(QObject *watched, QEvent *event)
return QMainWindow::eventFilter(watched, event);
}
#endif
}
} // namespace QtGui
#endif // SYNCTHINGWIDGETS_NO_WEBVIEW

View File

@ -46,7 +46,7 @@ inline const Data::SyncthingConnectionSettings &WebViewDialog::settings() const
{
return m_settings;
}
}
} // namespace QtGui
#endif // SYNCTHINGWIDGETS_NO_WEBVIEW
#endif // WEBVIEW_DIALOG_H