diff --git a/include/ChatPage.h b/include/ChatPage.h index cd516a71..2fa8779e 100644 --- a/include/ChatPage.h +++ b/include/ChatPage.h @@ -149,8 +149,6 @@ private: QWidget *communitiesSideBar_; QVBoxLayout *communitiesSideBarLayout_; QVBoxLayout *sideBarLayout_; - QVBoxLayout *sideBarTopLayout_; - QVBoxLayout *sideBarMainLayout_; QWidget *sideBarTopWidget_; QVBoxLayout *sideBarTopWidgetLayout_; diff --git a/include/TextInputWidget.h b/include/TextInputWidget.h index b89b7753..872773f1 100644 --- a/include/TextInputWidget.h +++ b/include/TextInputWidget.h @@ -83,11 +83,16 @@ class TextInputWidget : public QWidget { Q_OBJECT + Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor) + public: TextInputWidget(QWidget *parent = 0); void stopTyping(); + QColor borderColor() const { return borderColor_; } + void setBorderColor(QColor &color) { borderColor_ = color; } + public slots: void openFileSelection(); void hideUploadSpinner(); @@ -126,4 +131,6 @@ private: FlatButton *sendFileBtn_; FlatButton *sendMessageBtn_; emoji::PickButton *emojiBtn_; + + QColor borderColor_; }; diff --git a/resources/styles/nheko-dark.qss b/resources/styles/nheko-dark.qss index f70fd8e2..441fa0a5 100644 --- a/resources/styles/nheko-dark.qss +++ b/resources/styles/nheko-dark.qss @@ -163,3 +163,7 @@ TopRoomBar { border: none; border-bottom: 1px solid #414A59; } + +TextInputWidget { + qproperty-borderColor: #414A59; +} diff --git a/resources/styles/nheko.qss b/resources/styles/nheko.qss index 7644b8bb..a937b84e 100644 --- a/resources/styles/nheko.qss +++ b/resources/styles/nheko.qss @@ -146,6 +146,10 @@ TextField { qproperty-labelColor: #333; } +TextInputWidget { + qproperty-borderColor: #dcdcdc; +} + ScrollBar { qproperty-handleColor: #ccc; qproperty-backgroundColor: #efefef; diff --git a/resources/styles/system.qss b/resources/styles/system.qss index ab9dcd8e..21f11cc2 100644 --- a/resources/styles/system.qss +++ b/resources/styles/system.qss @@ -128,3 +128,7 @@ TopRoomBar { border: none; border-bottom: 1px solid palette(text); } + +TextInputWidget { + qproperty-borderColor: palette(text); +} diff --git a/src/ChatPage.cc b/src/ChatPage.cc index 158427fd..f2a3e269 100644 --- a/src/ChatPage.cc +++ b/src/ChatPage.cc @@ -84,16 +84,6 @@ ChatPage::ChatPage(QSharedPointer client, sideBarLayout_->setSpacing(0); sideBarLayout_->setMargin(0); - sideBarTopLayout_ = new QVBoxLayout(); - sideBarTopLayout_->setSpacing(0); - sideBarTopLayout_->setMargin(0); - sideBarMainLayout_ = new QVBoxLayout(); - sideBarMainLayout_->setSpacing(0); - sideBarMainLayout_->setMargin(0); - - sideBarLayout_->addLayout(sideBarTopLayout_); - sideBarLayout_->addLayout(sideBarMainLayout_); - sideBarTopWidget_ = new QWidget(sideBar_); sidebarActions_ = new SideBarActions(this); connect( diff --git a/src/TextInputWidget.cc b/src/TextInputWidget.cc index c2931415..3f3d5cd9 100644 --- a/src/TextInputWidget.cc +++ b/src/TextInputWidget.cc @@ -33,6 +33,8 @@ static constexpr size_t INPUT_HISTORY_SIZE = 127; static constexpr int MAX_TEXTINPUT_HEIGHT = 120; +static constexpr int InputHeight = 26; +static constexpr int ButtonHeight = 24; FilteredTextEdit::FilteredTextEdit(QWidget *parent) : QTextEdit{parent} @@ -313,11 +315,11 @@ TextInputWidget::TextInputWidget(QWidget *parent) sendFileBtn_ = new FlatButton(this); sendFileBtn_->setIcon(send_file_icon); - sendFileBtn_->setIconSize(QSize(24, 24)); + sendFileBtn_->setIconSize(QSize(ButtonHeight, ButtonHeight)); spinner_ = new LoadingIndicator(this); - spinner_->setFixedHeight(32); - spinner_->setFixedWidth(32); + spinner_->setFixedHeight(InputHeight); + spinner_->setFixedWidth(InputHeight); spinner_->setObjectName("FileUploadSpinner"); spinner_->hide(); @@ -325,13 +327,13 @@ TextInputWidget::TextInputWidget(QWidget *parent) font.setPixelSize(conf::textInputFontSize); input_ = new FilteredTextEdit(this); - input_->setFixedHeight(32); + input_->setFixedHeight(InputHeight); input_->setFont(font); input_->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); input_->setPlaceholderText(tr("Write a message...")); connect(input_, &FilteredTextEdit::heightChanged, this, [this](int height) { - int textInputHeight = std::min(MAX_TEXTINPUT_HEIGHT, std::max(height, 32)); + int textInputHeight = std::min(MAX_TEXTINPUT_HEIGHT, std::max(height, InputHeight)); int widgetHeight = std::min(MAX_TEXTINPUT_HEIGHT, std::max(height, conf::textInput::height)); @@ -344,14 +346,14 @@ TextInputWidget::TextInputWidget(QWidget *parent) QIcon send_message_icon; send_message_icon.addFile(":/icons/icons/ui/cursor.png"); sendMessageBtn_->setIcon(send_message_icon); - sendMessageBtn_->setIconSize(QSize(24, 24)); + sendMessageBtn_->setIconSize(QSize(ButtonHeight, ButtonHeight)); emojiBtn_ = new emoji::PickButton(this); QIcon emoji_icon; emoji_icon.addFile(":/icons/icons/ui/smile.png"); emojiBtn_->setIcon(emoji_icon); - emojiBtn_->setIconSize(QSize(24, 24)); + emojiBtn_->setIconSize(QSize(ButtonHeight, ButtonHeight)); topLayout_->addWidget(sendFileBtn_); topLayout_->addWidget(input_); @@ -483,5 +485,9 @@ TextInputWidget::paintEvent(QPaintEvent *) QStyleOption opt; opt.init(this); QPainter p(this); + style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); + + p.setPen(QPen(borderColor())); + p.drawLine(QPointF(0, 0), QPointF(width(), 0)); }