diff --git a/res.qrc b/res.qrc index bac33714b..934829e45 100644 --- a/res.qrc +++ b/res.qrc @@ -51,18 +51,15 @@ ui/chatArea/scrollBarDownArrow.svg ui/chatArea/scrollBarLeftArrow.svg ui/chatArea/scrollBarRightArrow.svg - ui/chatForm/buttons.css ui/chatForm/callButton.svg ui/chatForm/micButton.svg ui/chatForm/videoButton.svg ui/chatForm/volButton.svg - ui/chatForm/emoteButton.svg ui/chatForm/fileButton.svg ui/chatForm/screenshotButton.svg ui/chatForm/sendButton.svg - ui/emoticonWidget/dot_page.svg ui/emoticonWidget/dot_page_current.svg ui/emoticonWidget/dot_page_hover.svg @@ -98,5 +95,6 @@ img/caps_lock.svg ui/contentDialog/contentDialog.css ui/tooliconsZone/tooliconsZone.css + ui/chatForm/searchButton.svg diff --git a/src/widget/chatformheader.cpp b/src/widget/chatformheader.cpp index 3c55a4658..09c3b1644 100644 --- a/src/widget/chatformheader.cpp +++ b/src/widget/chatformheader.cpp @@ -76,6 +76,12 @@ const QString MIC_TOOL_TIP[] = { ChatFormHeader::tr("Mute microphone"), }; +const QString SEARCH_TOOL_TIP[] = { + ChatFormHeader::tr("Search in text"), + ChatFormHeader::tr("Unmute search"), + ChatFormHeader::tr("Mute search"), +}; + template QPushButton* createButton(const QString& name, T* self, Fun onClickSlot) { @@ -111,6 +117,7 @@ ChatFormHeader::ChatFormHeader(QWidget* parent) , videoState{CallButtonState::Disabled} , volState{ToolButtonState::Disabled} , micState{ToolButtonState::Disabled} + , searchState{ToolButtonState::Off} { QHBoxLayout* headLayout = new QHBoxLayout(); avatar = new MaskablePixmapWidget(this, AVATAR_SIZE, ":/img/avatar_mask.svg"); @@ -132,6 +139,7 @@ ChatFormHeader::ChatFormHeader(QWidget* parent) volButton = createButton("volButton", this, &ChatFormHeader::volMuteToggle); callButton = createButton("callButton", this, &ChatFormHeader::callTriggered); videoButton = createButton("videoButton", this, &ChatFormHeader::videoCallTriggered); + searchButton = createButton("searchButton", this, &ChatFormHeader::searchTriggered); QVBoxLayout* micButtonsLayout = new QVBoxLayout(); micButtonsLayout->setSpacing(MIC_BUTTONS_LAYOUT_SPACING); @@ -139,9 +147,10 @@ ChatFormHeader::ChatFormHeader(QWidget* parent) micButtonsLayout->addWidget(volButton, Qt::AlignTop | Qt::AlignRight); QGridLayout* buttonsLayout = new QGridLayout(); - buttonsLayout->addLayout(micButtonsLayout, 0, 0, 2, 1, Qt::AlignTop | Qt::AlignRight); - buttonsLayout->addWidget(callButton, 0, 1, 2, 1, Qt::AlignTop); - buttonsLayout->addWidget(videoButton, 0, 2, 2, 1, Qt::AlignTop); + buttonsLayout->addWidget(searchButton, 0, 0, 2, 1, Qt::AlignTop); + buttonsLayout->addLayout(micButtonsLayout, 0, 1, 2, 1, Qt::AlignTop | Qt::AlignRight); + buttonsLayout->addWidget(callButton, 0, 2, 2, 1, Qt::AlignTop); + buttonsLayout->addWidget(videoButton, 0, 3, 2, 1, Qt::AlignTop); buttonsLayout->setVerticalSpacing(0); buttonsLayout->setHorizontalSpacing(BUTTONS_LAYOUT_HOR_SPACING); @@ -171,6 +180,7 @@ void ChatFormHeader::setMode(ChatFormHeader::Mode mode) videoButton->hide(); volButton->hide(); micButton->hide(); + searchButton->hide(); } } @@ -180,6 +190,7 @@ void ChatFormHeader::retranslateUi() setStateToolTip(videoButton, videoState, VIDEO_TOOL_TIP); setStateToolTip(micButton, micState, MIC_TOOL_TIP); setStateToolTip(volButton, volState, VOL_TOOL_TIP); + setStateToolTip(searchButton, searchState, SEARCH_TOOL_TIP); } void ChatFormHeader::updateButtonsView() @@ -188,6 +199,7 @@ void ChatFormHeader::updateButtonsView() setStateName(videoButton, videoState); setStateName(micButton, micState); setStateName(volButton, volState); + setStateName(searchButton, searchState); retranslateUi(); Style::repolish(this); } diff --git a/src/widget/chatformheader.h b/src/widget/chatformheader.h index d744cf0d2..0ab7f9200 100644 --- a/src/widget/chatformheader.h +++ b/src/widget/chatformheader.h @@ -81,6 +81,7 @@ signals: void videoCallTriggered(); void micMuteToggle(); void volMuteToggle(); + void searchTriggered(); void nameChanged(const QString& name); @@ -102,11 +103,13 @@ private: QPushButton* videoButton; QPushButton* volButton; QPushButton* micButton; + QPushButton* searchButton; CallButtonState callState; CallButtonState videoState; ToolButtonState volState; ToolButtonState micState; + ToolButtonState searchState; std::unique_ptr callConfirm; }; diff --git a/src/widget/form/chatform.cpp b/src/widget/form/chatform.cpp index 1b54fed94..4b23d4748 100644 --- a/src/widget/form/chatform.cpp +++ b/src/widget/form/chatform.cpp @@ -177,6 +177,7 @@ ChatForm::ChatForm(Friend* chatFriend, History* history) connect(headWidget, &ChatFormHeader::videoCallTriggered, this, &ChatForm::onVideoCallTriggered); connect(headWidget, &ChatFormHeader::micMuteToggle, this, &ChatForm::onMicMuteToggle); connect(headWidget, &ChatFormHeader::volMuteToggle, this, &ChatForm::onVolMuteToggle); + connect(headWidget, &ChatFormHeader::searchTriggered, this, &ChatForm::onSearchTrigered); connect(msgEdit, &ChatTextEdit::enterPressed, this, &ChatForm::onSendTriggered); connect(msgEdit, &ChatTextEdit::textChanged, this, &ChatForm::onTextEditChanged); @@ -488,6 +489,11 @@ void ChatForm::onVolMuteToggle() updateMuteVolButton(); } +void ChatForm::onSearchTrigered() +{ + +} + void ChatForm::onFileSendFailed(uint32_t friendId, const QString& fname) { if (friendId != f->getId()) { diff --git a/src/widget/form/chatform.h b/src/widget/form/chatform.h index bb926533d..87912425a 100644 --- a/src/widget/form/chatform.h +++ b/src/widget/form/chatform.h @@ -87,6 +87,7 @@ private slots: void onRejectCallTriggered(); void onMicMuteToggle(); void onVolMuteToggle(); + void onSearchTrigered(); void onFileSendFailed(uint32_t friendId, const QString& fname); void onFriendStatusChanged(quint32 friendId, Status status); diff --git a/ui/chatForm/buttons.css b/ui/chatForm/buttons.css index 12c33a71c..11f19b32c 100644 --- a/ui/chatForm/buttons.css +++ b/ui/chatForm/buttons.css @@ -67,6 +67,14 @@ QAbstractButton#callButton height: 40px; } +QAbstractButton#searchButton +{ + background-image: url(":/ui/chatForm/searchButton.svg"); + border-radius: 5px; + width: 50px; + height: 40px; +} + /* Common */ QAbstractButton diff --git a/ui/chatForm/searchButton.svg b/ui/chatForm/searchButton.svg new file mode 100644 index 000000000..bebf9b02c --- /dev/null +++ b/ui/chatForm/searchButton.svg @@ -0,0 +1,86 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + +