mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
feat: add form for search
This commit is contained in:
parent
47d9da98cf
commit
863c46c73d
|
@ -341,6 +341,8 @@ set(${PROJECT_NAME}_SOURCES
|
||||||
src/widget/emoticonswidget.h
|
src/widget/emoticonswidget.h
|
||||||
src/widget/flowlayout.cpp
|
src/widget/flowlayout.cpp
|
||||||
src/widget/flowlayout.h
|
src/widget/flowlayout.h
|
||||||
|
src/widget/searchform.cpp
|
||||||
|
src/widget/searchform.h
|
||||||
src/widget/form/addfriendform.cpp
|
src/widget/form/addfriendform.cpp
|
||||||
src/widget/form/addfriendform.h
|
src/widget/form/addfriendform.h
|
||||||
src/widget/form/chatform.cpp
|
src/widget/form/chatform.cpp
|
||||||
|
|
2
res.qrc
2
res.qrc
|
@ -96,5 +96,7 @@
|
||||||
<file>ui/contentDialog/contentDialog.css</file>
|
<file>ui/contentDialog/contentDialog.css</file>
|
||||||
<file>ui/tooliconsZone/tooliconsZone.css</file>
|
<file>ui/tooliconsZone/tooliconsZone.css</file>
|
||||||
<file>ui/chatForm/searchButton.svg</file>
|
<file>ui/chatForm/searchButton.svg</file>
|
||||||
|
<file>ui/chatForm/searchDownButton.svg</file>
|
||||||
|
<file>ui/chatForm/searchUpButton.svg</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
|
@ -281,6 +281,17 @@ void ChatFormHeader::updateMuteVolButton(bool active, bool outputMuted)
|
||||||
updateButtonsView();
|
updateButtonsView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ChatFormHeader::updateSearchButton(bool active)
|
||||||
|
{
|
||||||
|
if (active) {
|
||||||
|
searchState = ToolButtonState::On;
|
||||||
|
} else {
|
||||||
|
searchState = ToolButtonState::Off;
|
||||||
|
}
|
||||||
|
|
||||||
|
updateButtonsView();
|
||||||
|
}
|
||||||
|
|
||||||
void ChatFormHeader::setAvatar(const QPixmap &img)
|
void ChatFormHeader::setAvatar(const QPixmap &img)
|
||||||
{
|
{
|
||||||
avatar->setPixmap(img);
|
avatar->setPixmap(img);
|
||||||
|
|
|
@ -67,6 +67,7 @@ public:
|
||||||
void updateCallButtons(bool online, bool audio, bool video = false);
|
void updateCallButtons(bool online, bool audio, bool video = false);
|
||||||
void updateMuteMicButton(bool active, bool inputMuted);
|
void updateMuteMicButton(bool active, bool inputMuted);
|
||||||
void updateMuteVolButton(bool active, bool outputMuted);
|
void updateMuteVolButton(bool active, bool outputMuted);
|
||||||
|
void updateSearchButton(bool active);
|
||||||
|
|
||||||
void setAvatar(const QPixmap& img);
|
void setAvatar(const QPixmap& img);
|
||||||
QSize getAvatarSize() const;
|
QSize getAvatarSize() const;
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
#include "src/widget/tool/screenshotgrabber.h"
|
#include "src/widget/tool/screenshotgrabber.h"
|
||||||
#include "src/widget/translator.h"
|
#include "src/widget/translator.h"
|
||||||
#include "src/widget/widget.h"
|
#include "src/widget/widget.h"
|
||||||
|
#include "src/widget/searchform.h"
|
||||||
|
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
@ -491,7 +492,13 @@ void ChatForm::onVolMuteToggle()
|
||||||
|
|
||||||
void ChatForm::onSearchTrigered()
|
void ChatForm::onSearchTrigered()
|
||||||
{
|
{
|
||||||
|
if (searchForm->maximumHeight() == 0) {
|
||||||
|
searchForm->setMaximumHeight(50);
|
||||||
|
headWidget->updateSearchButton(true);
|
||||||
|
} else {
|
||||||
|
searchForm->setMaximumHeight(0);
|
||||||
|
headWidget->updateSearchButton(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatForm::onFileSendFailed(uint32_t friendId, const QString& fname)
|
void ChatForm::onFileSendFailed(uint32_t friendId, const QString& fname)
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
#include "src/widget/tool/flyoutoverlaywidget.h"
|
#include "src/widget/tool/flyoutoverlaywidget.h"
|
||||||
#include "src/widget/translator.h"
|
#include "src/widget/translator.h"
|
||||||
#include "src/widget/widget.h"
|
#include "src/widget/widget.h"
|
||||||
|
#include "src/widget/searchform.h"
|
||||||
|
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
@ -135,8 +136,10 @@ GenericChatForm::GenericChatForm(QWidget* parent)
|
||||||
{
|
{
|
||||||
curRow = 0;
|
curRow = 0;
|
||||||
headWidget = new ChatFormHeader();
|
headWidget = new ChatFormHeader();
|
||||||
|
searchForm = new SearchForm();
|
||||||
chatWidget = new ChatLog(this);
|
chatWidget = new ChatLog(this);
|
||||||
chatWidget->setBusyNotification(ChatMessage::createBusyNotification());
|
chatWidget->setBusyNotification(ChatMessage::createBusyNotification());
|
||||||
|
searchForm->setMaximumHeight(0);
|
||||||
|
|
||||||
// settings
|
// settings
|
||||||
const Settings& s = Settings::getInstance();
|
const Settings& s = Settings::getInstance();
|
||||||
|
@ -190,6 +193,7 @@ GenericChatForm::GenericChatForm(QWidget* parent)
|
||||||
mainFootLayout->setSpacing(0);
|
mainFootLayout->setSpacing(0);
|
||||||
|
|
||||||
QVBoxLayout* contentLayout = new QVBoxLayout(contentWidget);
|
QVBoxLayout* contentLayout = new QVBoxLayout(contentWidget);
|
||||||
|
contentLayout->addWidget(searchForm);
|
||||||
contentLayout->addWidget(chatWidget);
|
contentLayout->addWidget(chatWidget);
|
||||||
contentLayout->addLayout(mainFootLayout);
|
contentLayout->addLayout(mainFootLayout);
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@ class CroppingLabel;
|
||||||
class FlyoutOverlayWidget;
|
class FlyoutOverlayWidget;
|
||||||
class GenericNetCamView;
|
class GenericNetCamView;
|
||||||
class MaskablePixmapWidget;
|
class MaskablePixmapWidget;
|
||||||
|
class SearchForm;
|
||||||
class Widget;
|
class Widget;
|
||||||
|
|
||||||
class QLabel;
|
class QLabel;
|
||||||
|
@ -151,6 +152,7 @@ protected:
|
||||||
|
|
||||||
ChatFormHeader* headWidget;
|
ChatFormHeader* headWidget;
|
||||||
|
|
||||||
|
SearchForm *searchForm;
|
||||||
ChatLog* chatWidget;
|
ChatLog* chatWidget;
|
||||||
ChatTextEdit* msgEdit;
|
ChatTextEdit* msgEdit;
|
||||||
FlyoutOverlayWidget* fileFlyout;
|
FlyoutOverlayWidget* fileFlyout;
|
||||||
|
|
28
src/widget/searchform.cpp
Normal file
28
src/widget/searchform.cpp
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
#include "searchform.h"
|
||||||
|
#include "src/widget/style.h"
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
#include <QLineEdit>
|
||||||
|
#include <QPushButton>
|
||||||
|
|
||||||
|
SearchForm::SearchForm(QWidget *parent) : QWidget(parent)
|
||||||
|
{
|
||||||
|
QHBoxLayout *layout = new QHBoxLayout();
|
||||||
|
searchLine = new QLineEdit();
|
||||||
|
upButton = new QPushButton();
|
||||||
|
upButton->setAttribute(Qt::WA_LayoutUsesWidgetRect);
|
||||||
|
upButton->setObjectName("searchUpButton");
|
||||||
|
upButton->setProperty("state", "green");
|
||||||
|
upButton->setStyleSheet(Style::getStylesheet(QStringLiteral(":/ui/chatForm/buttons.css")));
|
||||||
|
|
||||||
|
downButton = new QPushButton();
|
||||||
|
downButton->setAttribute(Qt::WA_LayoutUsesWidgetRect);
|
||||||
|
downButton->setObjectName("searchDownButton");
|
||||||
|
downButton->setProperty("state", "green");
|
||||||
|
downButton->setStyleSheet(Style::getStylesheet(QStringLiteral(":/ui/chatForm/buttons.css")));
|
||||||
|
|
||||||
|
layout->addWidget(searchLine);
|
||||||
|
layout->addWidget(upButton);
|
||||||
|
layout->addWidget(downButton);
|
||||||
|
|
||||||
|
setLayout(layout);
|
||||||
|
}
|
21
src/widget/searchform.h
Normal file
21
src/widget/searchform.h
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
#ifndef SEARCHFORM_H
|
||||||
|
#define SEARCHFORM_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
class QPushButton;
|
||||||
|
class QLineEdit;
|
||||||
|
|
||||||
|
class SearchForm final : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit SearchForm(QWidget *parent = nullptr);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QPushButton* upButton;
|
||||||
|
QPushButton* downButton;
|
||||||
|
QLineEdit* searchLine;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // SEARCHFORM_H
|
|
@ -75,6 +75,25 @@ QAbstractButton#searchButton
|
||||||
height: 40px;
|
height: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* SearchLine */
|
||||||
|
|
||||||
|
|
||||||
|
QAbstractButton#searchUpButton
|
||||||
|
{
|
||||||
|
background-image: url(":/ui/chatForm/searchUpButton.svg");
|
||||||
|
border-radius: 5px;
|
||||||
|
width: 35px;
|
||||||
|
height: 35px;
|
||||||
|
}
|
||||||
|
|
||||||
|
QAbstractButton#searchDownButton
|
||||||
|
{
|
||||||
|
background-image: url(":/ui/chatForm/searchDownButton.svg");
|
||||||
|
border-radius: 5px;
|
||||||
|
width: 35px;
|
||||||
|
height: 35px;
|
||||||
|
}
|
||||||
|
|
||||||
/* Common */
|
/* Common */
|
||||||
|
|
||||||
QAbstractButton
|
QAbstractButton
|
||||||
|
|
82
ui/chatForm/searchDownButton.svg
Normal file
82
ui/chatForm/searchDownButton.svg
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
<?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="7.0183306mm"
|
||||||
|
height="4.1245208mm"
|
||||||
|
viewBox="0 0 7.0183304 4.1245209"
|
||||||
|
version="1.1"
|
||||||
|
id="svg8"
|
||||||
|
inkscape:version="0.92.2 5c3e80d, 2017-08-06"
|
||||||
|
sodipodi:docname="searchDownButton.svg">
|
||||||
|
<defs
|
||||||
|
id="defs2" />
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="base"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1.0"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:zoom="2.8"
|
||||||
|
inkscape:cx="185.76311"
|
||||||
|
inkscape:cy="-116.1932"
|
||||||
|
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" />
|
||||||
|
<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 />
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<g
|
||||||
|
inkscape:label="Layer 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1"
|
||||||
|
transform="translate(59.722852,-41.245778)">
|
||||||
|
<g
|
||||||
|
id="g11"
|
||||||
|
style="fill:#ffffff"
|
||||||
|
transform="matrix(0.03267961,0,0,0.03267961,-57.771132,39.897882)">
|
||||||
|
<rect
|
||||||
|
transform="rotate(-44.285246)"
|
||||||
|
style="fill:#ffffff;stroke-width:0.36410955"
|
||||||
|
y="123.15389"
|
||||||
|
x="-82.806313"
|
||||||
|
height="30"
|
||||||
|
width="150"
|
||||||
|
id="rect10" />
|
||||||
|
<rect
|
||||||
|
transform="matrix(-0.71587256,-0.69823097,-0.69823097,0.71587256,0,0)"
|
||||||
|
style="fill:#ffffff;stroke-width:0.36410955"
|
||||||
|
y="56.601276"
|
||||||
|
x="-151.04047"
|
||||||
|
height="30.000002"
|
||||||
|
width="150"
|
||||||
|
id="rect10-7" />
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 2.3 KiB |
82
ui/chatForm/searchUpButton.svg
Normal file
82
ui/chatForm/searchUpButton.svg
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
<?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="7.0183306mm"
|
||||||
|
height="4.1245208mm"
|
||||||
|
viewBox="0 0 7.0183304 4.1245209"
|
||||||
|
version="1.1"
|
||||||
|
id="svg8"
|
||||||
|
inkscape:version="0.92.2 5c3e80d, 2017-08-06"
|
||||||
|
sodipodi:docname="searchUpButton.svg">
|
||||||
|
<defs
|
||||||
|
id="defs2" />
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="base"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1.0"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:zoom="2.8"
|
||||||
|
inkscape:cx="185.76311"
|
||||||
|
inkscape:cy="-116.1932"
|
||||||
|
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" />
|
||||||
|
<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(59.722852,-41.245778)">
|
||||||
|
<g
|
||||||
|
id="g11"
|
||||||
|
style="fill:#ffffff"
|
||||||
|
transform="matrix(0.03267961,0,0,-0.03267961,-57.771132,46.718195)">
|
||||||
|
<rect
|
||||||
|
transform="rotate(-44.285246)"
|
||||||
|
style="fill:#ffffff;stroke-width:0.36410955"
|
||||||
|
y="123.15389"
|
||||||
|
x="-82.806313"
|
||||||
|
height="30"
|
||||||
|
width="150"
|
||||||
|
id="rect10" />
|
||||||
|
<rect
|
||||||
|
transform="matrix(-0.71587256,-0.69823097,-0.69823097,0.71587256,0,0)"
|
||||||
|
style="fill:#ffffff;stroke-width:0.36410955"
|
||||||
|
y="56.601276"
|
||||||
|
x="-151.04047"
|
||||||
|
height="30.000002"
|
||||||
|
width="150"
|
||||||
|
id="rect10-7" />
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 2.3 KiB |
Loading…
Reference in New Issue
Block a user