mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
feat: add a button to search
This commit is contained in:
parent
0d2926e196
commit
47d9da98cf
4
res.qrc
4
res.qrc
|
@ -51,18 +51,15 @@
|
|||
<file>ui/chatArea/scrollBarDownArrow.svg</file>
|
||||
<file>ui/chatArea/scrollBarLeftArrow.svg</file>
|
||||
<file>ui/chatArea/scrollBarRightArrow.svg</file>
|
||||
|
||||
<file>ui/chatForm/buttons.css</file>
|
||||
<file>ui/chatForm/callButton.svg</file>
|
||||
<file>ui/chatForm/micButton.svg</file>
|
||||
<file>ui/chatForm/videoButton.svg</file>
|
||||
<file>ui/chatForm/volButton.svg</file>
|
||||
|
||||
<file>ui/chatForm/emoteButton.svg</file>
|
||||
<file>ui/chatForm/fileButton.svg</file>
|
||||
<file>ui/chatForm/screenshotButton.svg</file>
|
||||
<file>ui/chatForm/sendButton.svg</file>
|
||||
|
||||
<file>ui/emoticonWidget/dot_page.svg</file>
|
||||
<file>ui/emoticonWidget/dot_page_current.svg</file>
|
||||
<file>ui/emoticonWidget/dot_page_hover.svg</file>
|
||||
|
@ -98,5 +95,6 @@
|
|||
<file>img/caps_lock.svg</file>
|
||||
<file>ui/contentDialog/contentDialog.css</file>
|
||||
<file>ui/tooliconsZone/tooliconsZone.css</file>
|
||||
<file>ui/chatForm/searchButton.svg</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
@ -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 <class T, class Fun>
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -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<CallConfirmWidget> callConfirm;
|
||||
};
|
||||
|
|
|
@ -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()) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
86
ui/chatForm/searchButton.svg
Normal file
86
ui/chatForm/searchButton.svg
Normal file
|
@ -0,0 +1,86 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="8.5557709mm"
|
||||
height="5.0002112mm"
|
||||
viewBox="0 0 8.555771 5.0002106"
|
||||
version="1.1"
|
||||
id="svg8"
|
||||
inkscape:version="0.92.2 5c3e80d, 2017-08-06"
|
||||
sodipodi:docname="searchButton.svg">
|
||||
<defs
|
||||
id="defs2" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="22.4"
|
||||
inkscape:cx="21.984681"
|
||||
inkscape:cy="2.8941014"
|
||||
inkscape:document-units="mm"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
fit-margin-top="0"
|
||||
fit-margin-left="0"
|
||||
fit-margin-right="0"
|
||||
fit-margin-bottom="0"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1015"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="876"
|
||||
inkscape:window-maximized="1"
|
||||
showguides="false">
|
||||
<inkscape:grid
|
||||
type="xygrid"
|
||||
id="grid40" />
|
||||
</sodipodi:namedview>
|
||||
<metadata
|
||||
id="metadata5">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(340.51327,202.78083)">
|
||||
<g
|
||||
id="g38"
|
||||
transform="translate(-6.0476191,-0.34254092)"
|
||||
style="fill:#ffffff">
|
||||
<path
|
||||
id="path12"
|
||||
transform="matrix(0.26458333,0,0,0.26458333,-340.91,-203.00001)"
|
||||
d="m 47.244141,2.1230469 a 9.4488189,9.4488189 0 0 0 -9.449219,9.4492191 9.4488189,9.4488189 0 0 0 9.449219,9.449218 9.4488189,9.4488189 0 0 0 9.449218,-9.449218 9.4488189,9.4488189 0 0 0 -9.449218,-9.4492191 z m 0,3.4023437 a 6.0472442,6.0472442 0 0 1 6.046875,6.0468754 6.0472442,6.0472442 0 0 1 -6.046875,6.046875 6.0472442,6.0472442 0 0 1 -6.046875,-6.046875 6.0472442,6.0472442 0 0 1 6.046875,-6.0468754 z"
|
||||
style="fill:#ffffff;stroke-width:1.0102793"
|
||||
inkscape:connector-curvature="0" />
|
||||
<rect
|
||||
ry="0.64999998"
|
||||
transform="rotate(-15)"
|
||||
y="-278.625"
|
||||
x="-271.75787"
|
||||
height="1.3"
|
||||
width="4.5002789"
|
||||
id="rect32"
|
||||
style="fill:#ffffff;stroke-width:0.26111853" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.8 KiB |
Loading…
Reference in New Issue
Block a user