Skip to content

Commit

Permalink
Apply clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
Martchus committed Jan 31, 2025
1 parent 3de675d commit f44b5ce
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
7 changes: 5 additions & 2 deletions syncthingmodel/syncthingfilemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,8 @@ QList<QAction *> SyncthingFileModel::selectionActions()
action->needsConfirmation = false;
m_manuallyEditedIgnorePatterns.clear();
m_manuallyEditedLocalDeletions.reset();
emit actionNeedsConfirmation(action, tr("Do you want to apply the following changes?"), computeIgnorePatternDiff(), m_stagedLocalFileDeletions);
emit actionNeedsConfirmation(
action, tr("Do you want to apply the following changes?"), computeIgnorePatternDiff(), m_stagedLocalFileDeletions);
return;
}
action->needsConfirmation = true;
Expand Down Expand Up @@ -936,7 +937,9 @@ QList<QAction *> SyncthingFileModel::selectionActions()
if (failedDeletions.isEmpty()) {
emit notification(QStringLiteral("info"), tr("Ignore patterns have been changed."));
} else {
emit notification(QStringLiteral("error"), tr("Ignore patterns have been changed but the following local files could not be deleted:\n") + failedDeletions.join(QChar('\n')));
emit notification(QStringLiteral("error"),
tr("Ignore patterns have been changed but the following local files could not be deleted:\n")
+ failedDeletions.join(QChar('\n')));
}
emit hasStagedChangesChanged(hasStagedChanges());
});
Expand Down
5 changes: 3 additions & 2 deletions syncthingmodel/syncthingfilemodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
#include <QPixmap>
#include <QSet>

#include <optional>
#include <map>
#include <memory>
#include <optional>
#include <vector>

class ModelTests;
Expand Down Expand Up @@ -96,7 +96,8 @@ class LIB_SYNCTHING_MODEL_EXPORT SyncthingFileModel : public SyncthingModel {
Q_SIGNALS:
void fetchQueueEmpty();
void notification(const QString &type, const QString &message, const QString &details = QString());
void actionNeedsConfirmation(QAction *action, const QString &message, const QString &diff = QString(), const QSet<QString> &localDeletions = QSet<QString>());
void actionNeedsConfirmation(
QAction *action, const QString &message, const QString &diff = QString(), const QSet<QString> &localDeletions = QSet<QString>());
void selectionModeEnabledChanged(bool selectionModeEnabled);
void selectionActionsChanged();
void hasStagedChangesChanged(bool hasStagedChanged);
Expand Down
18 changes: 10 additions & 8 deletions syncthingwidgets/misc/otherdialogs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
#include <QTextBrowser>
#include <QTextDocument>
#include <QTextEdit>
#include <QTreeView>
#include <QToolBar>
#include <QTreeView>
#include <QVBoxLayout>

#include <utility>
Expand Down Expand Up @@ -133,7 +133,7 @@ QDialog *browseRemoteFilesDialog(Data::SyncthingConnection &connection, const Da
auto toolBar = new QToolBar(dlg);
toolBar->setFloatable(false);
toolBar->setMovable(false);
auto updateToolBarActions = [toolBar, model, actions = QList<QAction *>()] () mutable {
auto updateToolBarActions = [toolBar, model, actions = QList<QAction *>()]() mutable {
toolBar->clear();
qDeleteAll(actions);
actions = model->selectionActions();
Expand Down Expand Up @@ -238,8 +238,8 @@ QDialog *browseRemoteFilesDialog(Data::SyncthingConnection &connection, const Da
messageBox.setDetailedText(details);
messageBox.exec();
});
QObject::connect(
model, &Data::SyncthingFileModel::actionNeedsConfirmation, toolBar, [model, toolBar](QAction *action, const QString &message, const QString &details, const QSet<QString> &localDeletions) {
QObject::connect(model, &Data::SyncthingFileModel::actionNeedsConfirmation, toolBar,
[model, toolBar](QAction *action, const QString &message, const QString &details, const QSet<QString> &localDeletions) {
auto *const rejectableAction = qobject_cast<RejectableAction *>(action);
auto messageBox = TextViewDialog(QStringLiteral("Confirm action - " APP_NAME));
auto deletionList = QString();
Expand All @@ -258,8 +258,8 @@ QDialog *browseRemoteFilesDialog(Data::SyncthingConnection &connection, const Da
auto *const browser = messageBox.browser();
auto *const highlighter = new DiffHighlighter(browser->document());
auto *const buttonLayout = new QHBoxLayout(&messageBox);
auto *const editBtn = new QPushButton(
QIcon::fromTheme(QStringLiteral("document-edit")), QCoreApplication::translate("QtGui::OtherDialogs", "Edit patterns manually"), &messageBox);
auto *const editBtn = new QPushButton(QIcon::fromTheme(QStringLiteral("document-edit")),
QCoreApplication::translate("QtGui::OtherDialogs", "Edit patterns manually"), &messageBox);
auto *const yesBtn = new QPushButton(
QIcon::fromTheme(QStringLiteral("dialog-ok")), QCoreApplication::translate("QtGui::OtherDialogs", "Apply"), &messageBox);
auto *const noBtn = new QPushButton(
Expand Down Expand Up @@ -292,9 +292,11 @@ QDialog *browseRemoteFilesDialog(Data::SyncthingConnection &connection, const Da
}
deletionModel->setItems(deletionItems);
deletionView->setModel(deletionModel);
messageBox.layout()->insertWidget(widgetIndex++, new QLabel(QCoreApplication::translate("QtGui::OtherDialogs", "Deletion of the following local files:"), &messageBox));
messageBox.layout()->insertWidget(widgetIndex++,
new QLabel(QCoreApplication::translate("QtGui::OtherDialogs", "Deletion of the following local files:"), &messageBox));
messageBox.layout()->insertWidget(widgetIndex++, deletionView);
messageBox.layout()->insertWidget(widgetIndex++, new QLabel(QCoreApplication::translate("QtGui::OtherDialogs", "Changes to ignore patterns:"), &messageBox));
messageBox.layout()->insertWidget(
widgetIndex++, new QLabel(QCoreApplication::translate("QtGui::OtherDialogs", "Changes to ignore patterns:"), &messageBox));
}
messageBox.layout()->addLayout(buttonLayout);
messageBox.setAttribute(Qt::WA_DeleteOnClose, false);
Expand Down

0 comments on commit f44b5ce

Please sign in to comment.