From 1d4966d5fd916f21bdbbad8080eec69bb2c817d6 Mon Sep 17 00:00:00 2001 From: redsky17 Date: Tue, 11 Jun 2019 23:36:46 -0400 Subject: [PATCH] Add style for reply popup. Fix ALL of the linting issues --- resources/styles/nheko-dark.qss | 4 ++++ resources/styles/nheko.qss | 4 ++++ src/ChatPage.h | 4 +++- src/TextInputWidget.cpp | 6 ++---- src/TextInputWidget.h | 4 ++-- src/popups/PopupItem.cpp | 2 +- src/popups/ReplyPopup.cpp | 4 ++-- src/popups/ReplyPopup.h | 1 - src/popups/SuggestionsPopup.cpp | 2 +- src/popups/SuggestionsPopup.h | 1 - src/timeline/TimelineView.h | 4 +++- src/timeline/TimelineViewManager.cpp | 3 +-- 12 files changed, 23 insertions(+), 16 deletions(-) diff --git a/resources/styles/nheko-dark.qss b/resources/styles/nheko-dark.qss index 5567f32c..c55960f9 100644 --- a/resources/styles/nheko-dark.qss +++ b/resources/styles/nheko-dark.qss @@ -41,6 +41,10 @@ SuggestionsPopup { background-color: #202228; } +ReplyPopup { + background-color: #202228; +} + PopupItem { background-color: #202228; qproperty-hoverColor: rgba(45, 49, 57, 120); diff --git a/resources/styles/nheko.qss b/resources/styles/nheko.qss index 58e83c22..c352956a 100644 --- a/resources/styles/nheko.qss +++ b/resources/styles/nheko.qss @@ -46,6 +46,10 @@ SuggestionsPopup { background-color: white; } +ReplyPopup { + background-color: white; +} + PopupItem { background-color: white; qproperty-hoverColor: rgba(192, 193, 195, 120); diff --git a/src/ChatPage.h b/src/ChatPage.h index 09e7a2c6..f70f5bdd 100644 --- a/src/ChatPage.h +++ b/src/ChatPage.h @@ -83,7 +83,9 @@ signals: void connectionLost(); void connectionRestored(); - void messageReply(const QString &username, const QString &msg, const QString &related_event); + void messageReply(const QString &username, + const QString &msg, + const QString &related_event); void notificationsRetrieved(const mtx::responses::Notifications &); diff --git a/src/TextInputWidget.cpp b/src/TextInputWidget.cpp index 7971ab43..dc41b4d3 100644 --- a/src/TextInputWidget.cpp +++ b/src/TextInputWidget.cpp @@ -176,18 +176,16 @@ FilteredTextEdit::keyPressEvent(QKeyEvent *event) } if (replyPopup_.isVisible()) { - switch (event->key()) - { + switch (event->key()) { case Qt::Key_Escape: closeReply(); return; - + default: break; } } - switch (event->key()) { case Qt::Key_At: atTriggerPosition_ = textCursor().position(); diff --git a/src/TextInputWidget.h b/src/TextInputWidget.h index 2936340b..c462de05 100644 --- a/src/TextInputWidget.h +++ b/src/TextInputWidget.h @@ -28,10 +28,10 @@ #include #include -#include "popups/SuggestionsPopup.h" -#include "popups/ReplyPopup.h" #include "dialogs/PreviewUploadOverlay.h" #include "emoji/PickButton.h" +#include "popups/ReplyPopup.h" +#include "popups/SuggestionsPopup.h" namespace dialogs { class PreviewUploadOverlay; diff --git a/src/popups/PopupItem.cpp b/src/popups/PopupItem.cpp index b10cd32e..94de3a92 100644 --- a/src/popups/PopupItem.cpp +++ b/src/popups/PopupItem.cpp @@ -2,9 +2,9 @@ #include #include -#include "PopupItem.h" #include "../Utils.h" #include "../ui/Avatar.h" +#include "PopupItem.h" constexpr int PopupHMargin = 4; constexpr int PopupItemMargin = 3; diff --git a/src/popups/ReplyPopup.cpp b/src/popups/ReplyPopup.cpp index a883739f..04c3cea5 100644 --- a/src/popups/ReplyPopup.cpp +++ b/src/popups/ReplyPopup.cpp @@ -1,5 +1,5 @@ -#include #include +#include #include #include @@ -32,7 +32,7 @@ ReplyPopup::setReplyContent(const QString &user, const QString &msg, const QStri // layout position. // if (!item) { auto userItem = new UserItem(this, user); - auto *text = new QLabel(this); + auto *text = new QLabel(this); text->setText(msg); auto *event = new QLabel(this); event->setText(srcEvent); diff --git a/src/popups/ReplyPopup.h b/src/popups/ReplyPopup.h index d8355e53..57c2bc8a 100644 --- a/src/popups/ReplyPopup.h +++ b/src/popups/ReplyPopup.h @@ -28,5 +28,4 @@ signals: private: QVBoxLayout *layout_; - }; diff --git a/src/popups/SuggestionsPopup.cpp b/src/popups/SuggestionsPopup.cpp index 6861a76a..ba1f77b9 100644 --- a/src/popups/SuggestionsPopup.cpp +++ b/src/popups/SuggestionsPopup.cpp @@ -3,10 +3,10 @@ #include #include "../Config.h" -#include "SuggestionsPopup.h" #include "../Utils.h" #include "../ui/Avatar.h" #include "../ui/DropShadow.h" +#include "SuggestionsPopup.h" SuggestionsPopup::SuggestionsPopup(QWidget *parent) : QWidget(parent) diff --git a/src/popups/SuggestionsPopup.h b/src/popups/SuggestionsPopup.h index 4fbb97b3..1ef720b2 100644 --- a/src/popups/SuggestionsPopup.h +++ b/src/popups/SuggestionsPopup.h @@ -10,7 +10,6 @@ #include "../ChatPage.h" #include "PopupItem.h" - class SuggestionsPopup : public QWidget { Q_OBJECT diff --git a/src/timeline/TimelineView.h b/src/timeline/TimelineView.h index 450b5dfa..db6087eb 100644 --- a/src/timeline/TimelineView.h +++ b/src/timeline/TimelineView.h @@ -121,7 +121,9 @@ public: // Add new events at the end of the timeline. void addEvents(const mtx::responses::Timeline &timeline); - void addUserMessage(mtx::events::MessageType ty, const QString &body, const QString &related_event); + void addUserMessage(mtx::events::MessageType ty, + const QString &body, + const QString &related_event); void addUserMessage(mtx::events::MessageType ty, const QString &msg); template diff --git a/src/timeline/TimelineViewManager.cpp b/src/timeline/TimelineViewManager.cpp index 10c2d747..1ce3794f 100644 --- a/src/timeline/TimelineViewManager.cpp +++ b/src/timeline/TimelineViewManager.cpp @@ -79,8 +79,7 @@ TimelineViewManager::queueEmoteMessage(const QString &msg) } void -TimelineViewManager::queueReplyMessage(const QString &reply, - const QString &related_event) +TimelineViewManager::queueReplyMessage(const QString &reply, const QString &related_event) { if (active_room_.isEmpty()) return;