From 0c0ac68bc2e23fe1590614bb961a21a4bb09d0dc Mon Sep 17 00:00:00 2001 From: Konstantinos Sideris Date: Sun, 1 Oct 2017 12:11:33 +0300 Subject: [PATCH] Remove extra clang-format options --- .clang-format | 10 ---------- include/Deserializable.h | 20 +++++--------------- include/RoomState.h | 7 ++++--- include/TimelineView.h | 3 ++- include/events/CreateEventContent.h | 3 ++- include/events/TopicEventContent.h | 3 ++- include/ui/Menu.h | 6 +++--- src/Cache.cc | 3 ++- src/EmojiCategory.cc | 4 +--- src/EmojiPanel.cc | 6 +++--- src/Login.cc | 4 +--- src/LoginPage.cc | 8 +++----- src/MainWindow.cc | 6 ++---- src/MatrixClient.cc | 12 ++++++------ src/RegisterPage.cc | 4 +--- src/RoomInfoListItem.cc | 8 +++----- src/RoomList.cc | 4 +--- src/TextInputWidget.cc | 4 +--- src/TimelineItem.cc | 4 +--- src/TimelineViewManager.cc | 4 +--- src/TopRoomBar.cc | 4 +--- src/UserInfoWidget.cc | 4 +--- src/ui/Avatar.cc | 4 +--- src/ui/Badge.cc | 4 +--- src/ui/FlatButton.cc | 11 ++++------- src/ui/RaisedButton.cc | 4 +--- src/ui/Ripple.cc | 4 +--- src/ui/RippleOverlay.cc | 4 +--- src/ui/TextField.cc | 15 +++++---------- src/ui/Theme.cc | 4 +--- 30 files changed, 61 insertions(+), 120 deletions(-) diff --git a/.clang-format b/.clang-format index 1f74e78..d5606cd 100644 --- a/.clang-format +++ b/.clang-format @@ -3,21 +3,11 @@ Language: Cpp AccessModifierOffset: -8 AlignAfterOpenBracket: Align AlignConsecutiveAssignments: true -AlignEscapedNewlinesLeft: false -AlignTrailingComments: false -AllowAllParametersOfDeclarationOnNextLine: true AllowShortFunctionsOnASingleLine: Empty -AllowShortFunctionsOnASingleLine: None -AllowShortIfStatementsOnASingleLine: false BasedOnStyle: Mozilla -BinPackArguments: false -BinPackParameters: false BreakBeforeBraces: Linux -BreakConstructorInitializersBeforeComma: true ColumnLimit: 100 -CompactNamespaces: false IndentCaseLabels: false IndentWidth: 8 KeepEmptyLinesAtTheStartOfBlocks: false -MaxEmptyLinesToKeep: 1 PointerAlignment: Right diff --git a/include/Deserializable.h b/include/Deserializable.h index 938238b..0d0b288 100644 --- a/include/Deserializable.h +++ b/include/Deserializable.h @@ -37,25 +37,15 @@ private: class Deserializable { public: - virtual void deserialize(const QJsonValue &) - { - } - virtual void deserialize(const QJsonObject &) - { - } - virtual void deserialize(const QJsonDocument &) - { - } - virtual ~Deserializable() - { - } + virtual void deserialize(const QJsonValue &) {} + virtual void deserialize(const QJsonObject &) {} + virtual void deserialize(const QJsonDocument &) {} + virtual ~Deserializable() {} }; class Serializable { public: virtual QJsonObject serialize() const = 0; - virtual ~Serializable() - { - } + virtual ~Serializable() {} }; diff --git a/include/RoomState.h b/include/RoomState.h index 11d298d..a07fcbe 100644 --- a/include/RoomState.h +++ b/include/RoomState.h @@ -41,7 +41,8 @@ namespace events = matrix::events; class RoomState { public: - // Calculate room data that are not immediatly accessible. Like room name and avatar. + // Calculate room data that are not immediatly accessible. Like room name and + // avatar. // // e.g If the room is 1-on-1 name and avatar should be extracted from a user. void resolveName(); @@ -76,8 +77,8 @@ private: QUrl avatar_; QString name_; - // It defines the user whose avatar is used for the room. If the room has an avatar - // event this should be empty. + // It defines the user whose avatar is used for the room. If the room has an + // avatar event this should be empty. QString userAvatar_; }; diff --git a/include/TimelineView.h b/include/TimelineView.h index c5c84bd..4b5a2f7 100644 --- a/include/TimelineView.h +++ b/include/TimelineView.h @@ -106,7 +106,8 @@ private: void updateLastSender(const QString &user_id, TimelineDirection direction); void notifyForLastEvent(); - // Used to determine whether or not we should prefix a message with the sender's name. + // Used to determine whether or not we should prefix a message with the + // sender's name. bool isSenderRendered(const QString &user_id, TimelineDirection direction); bool isPendingMessage(const QString &eventid, diff --git a/include/events/CreateEventContent.h b/include/events/CreateEventContent.h index dcea5fd..7db2d36 100644 --- a/include/events/CreateEventContent.h +++ b/include/events/CreateEventContent.h @@ -26,7 +26,8 @@ namespace matrix namespace events { /* - * This is the first event in a room and cannot be changed. It acts as the root of all other events. + * This is the first event in a room and cannot be changed. It acts as the root + * of all other events. */ class CreateEventContent diff --git a/include/events/TopicEventContent.h b/include/events/TopicEventContent.h index c393b3e..b6c376e 100644 --- a/include/events/TopicEventContent.h +++ b/include/events/TopicEventContent.h @@ -26,7 +26,8 @@ namespace matrix namespace events { /* - * A topic is a short message detailing what is currently being discussed in the room. + * A topic is a short message detailing what is currently being discussed in the + * room. */ class TopicEventContent diff --git a/include/ui/Menu.h b/include/ui/Menu.h index 2029b1f..4c2a3c6 100644 --- a/include/ui/Menu.h +++ b/include/ui/Menu.h @@ -16,9 +16,9 @@ public: setFont(font); setStyleSheet( "QMenu { color: black; background-color: white; margin: 0px;}" - "QMenu::item { color: black; padding: 7px 20px; border: 1px solid transparent; " - "margin: " - "2px 0px; }" + "QMenu::item {" + "color: black; padding: 7px 20px; border: 1px solid transparent;" + "margin: 2px 0px; }" "QMenu::item:selected { color: black; background: rgba(180, 180, 180, 100); }"); }; diff --git a/src/Cache.cc b/src/Cache.cc index 6733428..bda8131 100644 --- a/src/Cache.cc +++ b/src/Cache.cc @@ -126,7 +126,8 @@ Cache::insertRoomState(lmdb::txn &txn, const QString &roomid, const RoomState &s auto memberEvent = QJsonDocument(membership.serialize()).toBinaryData(); switch (membership.content().membershipState()) { - // We add or update (e.g invite -> join) a new user to the membership list. + // We add or update (e.g invite -> join) a new user to the membership + // list. case events::Membership::Invite: case events::Membership::Join: { lmdb::dbi_put(txn, diff --git a/src/EmojiCategory.cc b/src/EmojiCategory.cc index 9de86d6..ea32ea9 100644 --- a/src/EmojiCategory.cc +++ b/src/EmojiCategory.cc @@ -80,6 +80,4 @@ EmojiCategory::EmojiCategory(QString category, QList emoji, QWidget *pare connect(emojiListView_, &QListView::clicked, this, &EmojiCategory::clickIndex); } -EmojiCategory::~EmojiCategory() -{ -} +EmojiCategory::~EmojiCategory() {} diff --git a/src/EmojiPanel.cc b/src/EmojiPanel.cc index f7736fb..c272a47 100644 --- a/src/EmojiPanel.cc +++ b/src/EmojiPanel.cc @@ -220,9 +220,9 @@ EmojiPanel::showEmojiCategory(const EmojiCategory *category) // HACK // If we want to go to a previous category and position the label at the top - // the 6*50 offset won't work because not all the categories have the same height. - // To ensure the category is at the top, we move to the top - // and go as normal to the next category. + // the 6*50 offset won't work because not all the categories have the same + // height. To ensure the category is at the top, we move to the top and go as + // normal to the next category. if (current > posToGo) this->scrollArea_->ensureVisible(0, 0, 0, 0); diff --git a/src/Login.cc b/src/Login.cc index 7010e35..d0dd1ea 100644 --- a/src/Login.cc +++ b/src/Login.cc @@ -22,9 +22,7 @@ #include "Deserializable.h" #include "Login.h" -LoginRequest::LoginRequest() -{ -} +LoginRequest::LoginRequest() {} LoginRequest::LoginRequest(QString username, QString password) : user_(username) diff --git a/src/LoginPage.cc b/src/LoginPage.cc index 2f4178d..fd7fede 100644 --- a/src/LoginPage.cc +++ b/src/LoginPage.cc @@ -223,8 +223,8 @@ void LoginPage::versionError(QString error) { // Matrix homeservers are often kept on a subdomain called 'matrix' - // so let's try that next, unless the address was set explicitly or the domain part of the - // username already points to this subdomain + // so let's try that next, unless the address was set explicitly or the domain + // part of the username already points to this subdomain QUrl currentServer = client_->getHomeServer(); QString mxidAddress = matrixid_input_->text().split(":").at(1); if (currentServer.host() == inferredServerAddress_ && @@ -297,6 +297,4 @@ LoginPage::onBackButtonClicked() emit backButtonClicked(); } -LoginPage::~LoginPage() -{ -} +LoginPage::~LoginPage() {} diff --git a/src/MainWindow.cc b/src/MainWindow.cc index 39fb1d2..43f4a94 100644 --- a/src/MainWindow.cc +++ b/src/MainWindow.cc @@ -15,8 +15,8 @@ * along with this program. If not, see . */ -#include "Config.h" #include "MainWindow.h" +#include "Config.h" #include #include @@ -244,6 +244,4 @@ MainWindow::instance() return instance_; } -MainWindow::~MainWindow() -{ -} +MainWindow::~MainWindow() {} diff --git a/src/MatrixClient.cc b/src/MatrixClient.cc index 2e4f7c4..981a30c 100644 --- a/src/MatrixClient.cc +++ b/src/MatrixClient.cc @@ -64,8 +64,8 @@ MatrixClient::onVersionsResponse(QNetworkReply *reply) int status_code = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); if (status_code == 404) { - emit versionError( - "Versions endpoint was not found on the server. Possibly not a Matrix server"); + emit versionError("Versions endpoint was not found on the server. Possibly " + "not a Matrix server"); return; } @@ -581,8 +581,8 @@ MatrixClient::sync() noexcept query.addQueryItem("access_token", token_); if (next_batch_.isEmpty()) { - qDebug() - << "Sync requires a valid next_batch token. Initial sync should be performed."; + qDebug() << "Sync requires a valid next_batch token. Initial sync should " + "be performed."; return; } @@ -684,8 +684,8 @@ MatrixClient::versions() noexcept void MatrixClient::getOwnProfile() noexcept { - // FIXME: Remove settings from the matrix client. The class should store the user's matrix - // ID. + // FIXME: Remove settings from the matrix client. The class should store the + // user's matrix ID. QSettings settings; auto userid = settings.value("auth/user_id", "").toString(); diff --git a/src/RegisterPage.cc b/src/RegisterPage.cc index ce9f43a..e485de7 100644 --- a/src/RegisterPage.cc +++ b/src/RegisterPage.cc @@ -181,6 +181,4 @@ RegisterPage::onRegisterButtonClicked() } } -RegisterPage::~RegisterPage() -{ -} +RegisterPage::~RegisterPage() {} diff --git a/src/RoomInfoListItem.cc b/src/RoomInfoListItem.cc index d19a350..533fc26 100644 --- a/src/RoomInfoListItem.cc +++ b/src/RoomInfoListItem.cc @@ -152,8 +152,8 @@ RoomInfoListItem::paintEvent(QPaintEvent *event) font.setBold(false); p.setFont(font); - // The limit is the space between the end of the username and the start of the - // timestamp. + // The limit is the space between the end of the username and the start of + // the timestamp. int descriptionLimit = std::max(0, width() - 3 * Padding - msgStampWidth - IconSize - nameWidth - 5); auto description = @@ -310,6 +310,4 @@ RoomInfoListItem::mousePressEvent(QMouseEvent *event) ripple_overlay_->addRipple(ripple); } -RoomInfoListItem::~RoomInfoListItem() -{ -} +RoomInfoListItem::~RoomInfoListItem() {} diff --git a/src/RoomList.cc b/src/RoomList.cc index 9ef3646..5c67d98 100644 --- a/src/RoomList.cc +++ b/src/RoomList.cc @@ -61,9 +61,7 @@ RoomList::RoomList(QSharedPointer client, QWidget *parent) SLOT(updateRoomAvatar(const QString &, const QPixmap &))); } -RoomList::~RoomList() -{ -} +RoomList::~RoomList() {} void RoomList::clear() diff --git a/src/TextInputWidget.cc b/src/TextInputWidget.cc index 62b2542..5f06d99 100644 --- a/src/TextInputWidget.cc +++ b/src/TextInputWidget.cc @@ -213,6 +213,4 @@ TextInputWidget::hideUploadSpinner() spinner_->stop(); } -TextInputWidget::~TextInputWidget() -{ -} +TextInputWidget::~TextInputWidget() {} diff --git a/src/TimelineItem.cc b/src/TimelineItem.cc index a6eb2be..9726958 100644 --- a/src/TimelineItem.cc +++ b/src/TimelineItem.cc @@ -461,6 +461,4 @@ TimelineItem::descriptiveTime(const QDateTime &then) return then.toString("dd/MM/yy"); } -TimelineItem::~TimelineItem() -{ -} +TimelineItem::~TimelineItem() {} diff --git a/src/TimelineViewManager.cc b/src/TimelineViewManager.cc index afc8881..a4d616c 100644 --- a/src/TimelineViewManager.cc +++ b/src/TimelineViewManager.cc @@ -37,9 +37,7 @@ TimelineViewManager::TimelineViewManager(QSharedPointer client, QW client_.data(), &MatrixClient::messageSent, this, &TimelineViewManager::messageSent); } -TimelineViewManager::~TimelineViewManager() -{ -} +TimelineViewManager::~TimelineViewManager() {} void TimelineViewManager::messageSent(const QString &event_id, const QString &roomid, int txn_id) diff --git a/src/TopRoomBar.cc b/src/TopRoomBar.cc index 130e18f..1805f06 100644 --- a/src/TopRoomBar.cc +++ b/src/TopRoomBar.cc @@ -137,6 +137,4 @@ TopRoomBar::setRoomSettings(QSharedPointer settings) roomSettings_ = settings; } -TopRoomBar::~TopRoomBar() -{ -} +TopRoomBar::~TopRoomBar() {} diff --git a/src/UserInfoWidget.cc b/src/UserInfoWidget.cc index a14836a..b65329d 100644 --- a/src/UserInfoWidget.cc +++ b/src/UserInfoWidget.cc @@ -120,9 +120,7 @@ UserInfoWidget::closeLogoutDialog(bool isLoggingOut) emit logout(); } -UserInfoWidget::~UserInfoWidget() -{ -} +UserInfoWidget::~UserInfoWidget() {} void UserInfoWidget::resizeEvent(QResizeEvent *event) diff --git a/src/ui/Avatar.cc b/src/ui/Avatar.cc index c806836..c2ee629 100644 --- a/src/ui/Avatar.cc +++ b/src/ui/Avatar.cc @@ -19,9 +19,7 @@ Avatar::Avatar(QWidget *parent) setSizePolicy(policy); } -Avatar::~Avatar() -{ -} +Avatar::~Avatar() {} QColor Avatar::textColor() const diff --git a/src/ui/Badge.cc b/src/ui/Badge.cc index ab34be0..6e73eca 100644 --- a/src/ui/Badge.cc +++ b/src/ui/Badge.cc @@ -22,9 +22,7 @@ Badge::Badge(const QString &text, QWidget *parent) setText(text); } -Badge::~Badge() -{ -} +Badge::~Badge() {} void Badge::init() diff --git a/src/ui/FlatButton.cc b/src/ui/FlatButton.cc index f231407..45a7683 100644 --- a/src/ui/FlatButton.cc +++ b/src/ui/FlatButton.cc @@ -12,7 +12,8 @@ #include "ThemeManager.h" // The ampersand is automatically set in QPushButton or QCheckbx -// by KDEPlatformTheme plugin in Qt5. [https://bugs.kde.org/show_bug.cgi?id=337491] +// by KDEPlatformTheme plugin in Qt5. +// [https://bugs.kde.org/show_bug.cgi?id=337491] // // A workaroud is to add // @@ -79,9 +80,7 @@ FlatButton::FlatButton(const QString &text, ui::Role role, QWidget *parent, ui:: setRole(role); } -FlatButton::~FlatButton() -{ -} +FlatButton::~FlatButton() {} void FlatButton::applyPreset(ui::ButtonPreset preset) @@ -611,9 +610,7 @@ FlatButtonStateMachine::FlatButtonStateMachine(FlatButton *parent) addTransition(button_, QEvent::FocusOut, pressed_state_, hovered_state_); } -FlatButtonStateMachine::~FlatButtonStateMachine() -{ -} +FlatButtonStateMachine::~FlatButtonStateMachine() {} void FlatButtonStateMachine::setOverlayOpacity(qreal opacity) diff --git a/src/ui/RaisedButton.cc b/src/ui/RaisedButton.cc index c30f253..c519f84 100644 --- a/src/ui/RaisedButton.cc +++ b/src/ui/RaisedButton.cc @@ -70,9 +70,7 @@ RaisedButton::RaisedButton(const QString &text, QWidget *parent) setText(text); } -RaisedButton::~RaisedButton() -{ -} +RaisedButton::~RaisedButton() {} bool RaisedButton::event(QEvent *event) diff --git a/src/ui/Ripple.cc b/src/ui/Ripple.cc index 2869bf7..008d7a6 100644 --- a/src/ui/Ripple.cc +++ b/src/ui/Ripple.cc @@ -25,9 +25,7 @@ Ripple::Ripple(const QPoint ¢er, RippleOverlay *overlay, QObject *parent) init(); } -Ripple::~Ripple() -{ -} +Ripple::~Ripple() {} void Ripple::setRadius(qreal radius) diff --git a/src/ui/RippleOverlay.cc b/src/ui/RippleOverlay.cc index cf26436..26d432f 100644 --- a/src/ui/RippleOverlay.cc +++ b/src/ui/RippleOverlay.cc @@ -11,9 +11,7 @@ RippleOverlay::RippleOverlay(QWidget *parent) setAttribute(Qt::WA_NoSystemBackground); } -RippleOverlay::~RippleOverlay() -{ -} +RippleOverlay::~RippleOverlay() {} void RippleOverlay::addRipple(Ripple *ripple) diff --git a/src/ui/TextField.cc b/src/ui/TextField.cc index efa77c3..e038f2d 100644 --- a/src/ui/TextField.cc +++ b/src/ui/TextField.cc @@ -32,9 +32,7 @@ TextField::TextField(QWidget *parent) QCoreApplication::processEvents(); } -TextField::~TextField() -{ -} +TextField::~TextField() {} void TextField::setBackgroundColor(const QColor &color) @@ -199,7 +197,8 @@ TextField::paintEvent(QPaintEvent *event) if (text().isEmpty()) { painter.setOpacity(1 - state_machine_->progress()); - // painter.fillRect(rect(), parentWidget()->palette().color(backgroundRole())); + // painter.fillRect(rect(), + // parentWidget()->palette().color(backgroundRole())); painter.fillRect(rect(), backgroundColor()); } @@ -273,9 +272,7 @@ TextFieldStateMachine::TextFieldStateMachine(TextField *parent) connect(text_field_, SIGNAL(textChanged(QString)), this, SLOT(setupProperties())); } -TextFieldStateMachine::~TextFieldStateMachine() -{ -} +TextFieldStateMachine::~TextFieldStateMachine() {} void TextFieldStateMachine::setLabel(TextFieldLabel *label) @@ -352,9 +349,7 @@ TextFieldLabel::TextFieldLabel(TextField *parent) setFont(font); } -TextFieldLabel::~TextFieldLabel() -{ -} +TextFieldLabel::~TextFieldLabel() {} void TextFieldLabel::paintEvent(QPaintEvent *) diff --git a/src/ui/Theme.cc b/src/ui/Theme.cc index 1560cf1..52d4b88 100644 --- a/src/ui/Theme.cc +++ b/src/ui/Theme.cc @@ -22,9 +22,7 @@ Theme::Theme(QObject *parent) setColor("Transparent", ui::Color::Transparent); } -Theme::~Theme() -{ -} +Theme::~Theme() {} QColor Theme::rgba(int r, int g, int b, qreal a) const