Browse Source

feat: add search in text in group chats

reviewable/pr4955/r3
TriKriSta 8 years ago
parent
commit
7718734c9a
  1. 6
      res.qrc
  2. 7
      src/chatlog/content/text.cpp
  3. 155
      src/widget/form/chatform.cpp
  4. 13
      src/widget/form/chatform.h
  5. 135
      src/widget/form/genericchatform.cpp
  6. 12
      src/widget/form/genericchatform.h
  7. 12
      src/widget/form/groupchatform.cpp
  8. 2
      src/widget/form/groupchatform.h
  9. 38
      src/widget/searchform.cpp
  10. 14
      src/widget/searchform.h

6
res.qrc

@ -53,12 +53,15 @@
<file>ui/chatArea/scrollBarRightArrow.svg</file> <file>ui/chatArea/scrollBarRightArrow.svg</file>
<file>ui/chatForm/buttons.css</file> <file>ui/chatForm/buttons.css</file>
<file>ui/chatForm/callButton.svg</file> <file>ui/chatForm/callButton.svg</file>
<file>ui/chatForm/hideButton.svg</file>
<file>ui/chatForm/micButton.svg</file> <file>ui/chatForm/micButton.svg</file>
<file>ui/chatForm/videoButton.svg</file> <file>ui/chatForm/videoButton.svg</file>
<file>ui/chatForm/volButton.svg</file> <file>ui/chatForm/volButton.svg</file>
<file>ui/chatForm/emoteButton.svg</file> <file>ui/chatForm/emoteButton.svg</file>
<file>ui/chatForm/fileButton.svg</file> <file>ui/chatForm/fileButton.svg</file>
<file>ui/chatForm/screenshotButton.svg</file> <file>ui/chatForm/screenshotButton.svg</file>
<file>ui/chatForm/searchDownButton.svg</file>
<file>ui/chatForm/searchUpButton.svg</file>
<file>ui/chatForm/sendButton.svg</file> <file>ui/chatForm/sendButton.svg</file>
<file>ui/emoticonWidget/dot_page.svg</file> <file>ui/emoticonWidget/dot_page.svg</file>
<file>ui/emoticonWidget/dot_page_current.svg</file> <file>ui/emoticonWidget/dot_page_current.svg</file>
@ -95,8 +98,5 @@
<file>img/caps_lock.svg</file> <file>img/caps_lock.svg</file>
<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/searchDownButton.svg</file>
<file>ui/chatForm/searchUpButton.svg</file>
<file>ui/chatForm/hideButton.svg</file>
</qresource> </qresource>
</RCC> </RCC>

7
src/chatlog/content/text.cpp

@ -62,12 +62,13 @@ void Text::selectText(const QString &txt, const int index)
{ {
regenerate(); regenerate();
if (!doc) if (!doc) {
return; return;
}
QTextCursor cursor = doc->find(txt, index); auto cursor = doc->find(txt, index);
if (cursor != QTextCursor()) { if (!cursor.isNull()) {
cursor.beginEditBlock(); cursor.beginEditBlock();
cursor.setPosition(index); cursor.setPosition(index);
cursor.setPosition(index + txt.size(), QTextCursor::KeepAnchor); cursor.setPosition(index + txt.size(), QTextCursor::KeepAnchor);

155
src/widget/form/chatform.cpp

@ -179,11 +179,6 @@ ChatForm::ChatForm(Friend* chatFriend, History* history)
connect(headWidget, &ChatFormHeader::micMuteToggle, this, &ChatForm::onMicMuteToggle); connect(headWidget, &ChatFormHeader::micMuteToggle, this, &ChatForm::onMicMuteToggle);
connect(headWidget, &ChatFormHeader::volMuteToggle, this, &ChatForm::onVolMuteToggle); connect(headWidget, &ChatFormHeader::volMuteToggle, this, &ChatForm::onVolMuteToggle);
connect(searchForm, &SearchForm::searchInBegin, this, &ChatForm::searchInBegin);
connect(searchForm, &SearchForm::searchUp, this, &ChatForm::onSearchUp);
connect(searchForm, &SearchForm::searchDown, this, &ChatForm::onSearchDown);
connect(searchForm, &SearchForm::visibleChanged, this, &ChatForm::onSearchTrigered);
connect(msgEdit, &ChatTextEdit::enterPressed, this, &ChatForm::onSendTriggered); connect(msgEdit, &ChatTextEdit::enterPressed, this, &ChatForm::onSendTriggered);
connect(msgEdit, &ChatTextEdit::textChanged, this, &ChatForm::onTextEditChanged); connect(msgEdit, &ChatTextEdit::textChanged, this, &ChatForm::onTextEditChanged);
connect(msgEdit, &ChatTextEdit::pasteImage, this, &ChatForm::sendImage); connect(msgEdit, &ChatTextEdit::pasteImage, this, &ChatForm::sendImage);
@ -208,8 +203,6 @@ ChatForm::ChatForm(Friend* chatFriend, History* history)
}); });
connect(headWidget, &ChatFormHeader::callRejected, this, &ChatForm::onRejectCallTriggered); connect(headWidget, &ChatFormHeader::callRejected, this, &ChatForm::onRejectCallTriggered);
connect(chatWidget, &ChatLog::workerTimeoutFinished, this, &ChatForm::onContinueSearch);
updateCallButtons(); updateCallButtons();
if (Nexus::getProfile()->isHistoryEnabled()) { if (Nexus::getProfile()->isHistoryEnabled()) {
loadHistory(QDateTime::currentDateTime().addDays(-7), true); loadHistory(QDateTime::currentDateTime().addDays(-7), true);
@ -496,27 +489,7 @@ void ChatForm::onVolMuteToggle()
updateMuteVolButton(); updateMuteVolButton();
} }
void ChatForm::onSearchTrigered() void ChatForm::onSearchUp(const QString& phrase)
{
if (searchForm->isHidden()) {
searchForm->removeSearchPhrase();
desibleSearchText();
} else {
searchPoint = QPoint(1, -1);
searchAfterLoadHistory = false;
}
}
void ChatForm::searchInBegin(const QString &phrase)
{
desibleSearchText();
searchPoint = QPoint(1, -1);
onSearchUp(phrase);
}
void ChatForm::onSearchUp(const QString &phrase)
{ {
if (phrase.isEmpty()) { if (phrase.isEmpty()) {
desibleSearchText(); desibleSearchText();
@ -531,7 +504,7 @@ void ChatForm::onSearchUp(const QString &phrase)
QString pk = f->getPublicKey().toString(); QString pk = f->getPublicKey().toString();
QDateTime startDate = history->getStartDateChatHistory(pk); QDateTime startDate = history->getStartDateChatHistory(pk);
if (startDate == earliestMessage) { if (!startDate.isValid() || startDate == earliestMessage) {
return; return;
} }
@ -547,109 +520,30 @@ void ChatForm::onSearchUp(const QString &phrase)
return; return;
} }
for (int i = startLine; i >= 0; --i) { bool isSearch = searchInText(phrase, true);
ChatLine::Ptr l = lines[i];
if (l->getColumnCount() >= 2) {
ChatLineContent* content = l->getContent(1);
Text* text = static_cast<Text*>(content);
if (searchPoint.y() == 0) {
text->deselectText();
searchPoint.setY(-1);
} else {
QString txt = content->getText();
if (txt.contains(phrase, Qt::CaseInsensitive)) {
int startIndex = -1;
if (searchPoint.y() > -1) {
startIndex = searchPoint.y() - 1;
}
int index = txt.lastIndexOf(phrase, startIndex, Qt::CaseInsensitive);
if ((index == -1 && searchPoint.y() > -1)) {
text->deselectText();
searchPoint.setY(-1);
} else {
chatWidget->scrollToLine(l);
text->deselectText();
text->selectText(phrase, index);
searchPoint = QPoint(numLines - i, index);
break;
}
}
}
if (i == 0) { if (!isSearch) {
QString pk = f->getPublicKey().toString(); QString pk = f->getPublicKey().toString();
QDateTime startDate = history->getStartDateChatHistory(pk); QDateTime startDate = history->getStartDateChatHistory(pk);
QDateTime newBaseData = earliestMessage.addDays(-1); QDateTime newBaseData = earliestMessage.addDays(-1);
if (startDate > newBaseData) {
newBaseData = startDate;
}
searchPoint.setX(numLines); if (!startDate.isValid()) {
searchAfterLoadHistory = true; return;
loadHistory(newBaseData);
}
} }
}
}
void ChatForm::onSearchDown(const QString &phrase)
{
if (phrase.isEmpty()) {
desibleSearchText();
}
QVector<ChatLine::Ptr> lines = chatWidget->getLines();
if (lines.isEmpty()) {
return;
}
int numLines = lines.size();
int startLine = numLines - searchPoint.x();
for (int i = startLine; i < numLines; ++i) {
ChatLine::Ptr l = lines[i];
if (l->getColumnCount() >= 2) {
ChatLineContent* content = l->getContent(1);
Text* text = static_cast<Text*>(content);
QString txt = content->getText();
if (txt.contains(phrase, Qt::CaseInsensitive)) {
int startIndex = 0;
if (searchPoint.y() > -1) {
startIndex = searchPoint.y() + 1;
}
int index = txt.indexOf(phrase, startIndex, Qt::CaseInsensitive); if (startDate > newBaseData) {
if (index == -1 && searchPoint.y() > -1) { newBaseData = startDate;
text->deselectText();
searchPoint.setY(-1);
} else {
chatWidget->scrollToLine(l);
text->deselectText();
text->selectText(phrase, index);
searchPoint = QPoint(numLines - i, index);
break;
}
}
} }
searchPoint.setX(numLines);
searchAfterLoadHistory = true;
loadHistory(newBaseData);
} }
} }
void ChatForm::onContinueSearch() void ChatForm::onSearchDown(const QString& phrase)
{ {
QString phrase = searchForm->getSearchPhrase(); searchInText(phrase, false);
if (!phrase.isEmpty() && searchAfterLoadHistory) {
searchAfterLoadHistory = false;
onSearchUp(phrase);
}
} }
void ChatForm::onFileSendFailed(uint32_t friendId, const QString& fname) void ChatForm::onFileSendFailed(uint32_t friendId, const QString& fname)
@ -1124,21 +1018,6 @@ void ChatForm::SendMessageStr(QString msg)
} }
} }
void ChatForm::desibleSearchText()
{
if (searchPoint != QPoint(1, -1)) {
QVector<ChatLine::Ptr> lines = chatWidget->getLines();
int numLines = lines.size();
int index = numLines - searchPoint.x();
if (numLines > index) {
ChatLine::Ptr l = lines[index];
ChatLineContent* content = l->getContent(1);
Text* text = static_cast<Text*>(content);
text->deselectText();
}
}
}
void ChatForm::retranslateUi() void ChatForm::retranslateUi()
{ {
loadHistoryAction->setText(tr("Load chat history...")); loadHistoryAction->setText(tr("Load chat history..."));

13
src/widget/form/chatform.h

@ -72,6 +72,10 @@ public slots:
void onAvatarChange(uint32_t friendId, const QPixmap& pic); void onAvatarChange(uint32_t friendId, const QPixmap& pic);
void onAvatarRemoved(uint32_t friendId); void onAvatarRemoved(uint32_t friendId);
protected slots:
void onSearchUp(const QString& phrase) override;
void onSearchDown(const QString& phrase) override;
private slots: private slots:
void clearChatArea(bool notInForm) override final; void clearChatArea(bool notInForm) override final;
void onSendTriggered() override; void onSendTriggered() override;
@ -87,12 +91,7 @@ private slots:
void onRejectCallTriggered(); void onRejectCallTriggered();
void onMicMuteToggle(); void onMicMuteToggle();
void onVolMuteToggle(); void onVolMuteToggle();
void onSearchTrigered();
void searchInBegin(const QString& phrase);
void onSearchUp(const QString& phrase);
void onSearchDown(const QString& phrase);
void onContinueSearch();
void onFileSendFailed(uint32_t friendId, const QString& fname); void onFileSendFailed(uint32_t friendId, const QString& fname);
void onFriendStatusChanged(quint32 friendId, Status status); void onFriendStatusChanged(quint32 friendId, Status status);
void onFriendTypingChanged(quint32 friendId, bool isTyping); void onFriendTypingChanged(quint32 friendId, bool isTyping);
@ -117,8 +116,6 @@ private:
void updateCallButtons(); void updateCallButtons();
void SendMessageStr(QString msg); void SendMessageStr(QString msg);
void desibleSearchText();
protected: protected:
GenericNetCamView* createNetcam() final override; GenericNetCamView* createNetcam() final override;
void insertChatMessage(ChatMessage::Ptr msg) final override; void insertChatMessage(ChatMessage::Ptr msg) final override;
@ -144,8 +141,6 @@ private:
QHash<uint, FileTransferInstance*> ftransWidgets; QHash<uint, FileTransferInstance*> ftransWidgets;
bool isTyping; bool isTyping;
bool lastCallIsVideo; bool lastCallIsVideo;
QPoint searchPoint;
bool searchAfterLoadHistory;
}; };
#endif // CHATFORM_H #endif // CHATFORM_H

135
src/widget/form/genericchatform.cpp

@ -224,6 +224,13 @@ GenericChatForm::GenericChatForm(QWidget* parent)
connect(chatWidget, &ChatLog::customContextMenuRequested, this, connect(chatWidget, &ChatLog::customContextMenuRequested, this,
&GenericChatForm::onChatContextMenuRequested); &GenericChatForm::onChatContextMenuRequested);
connect(searchForm, &SearchForm::searchInBegin, this, &GenericChatForm::searchInBegin);
connect(searchForm, &SearchForm::searchUp, this, &GenericChatForm::onSearchUp);
connect(searchForm, &SearchForm::searchDown, this, &GenericChatForm::onSearchDown);
connect(searchForm, &SearchForm::visibleChanged, this, &GenericChatForm::onSearchTrigered);
connect(chatWidget, &ChatLog::workerTimeoutFinished, this, &GenericChatForm::onContinueSearch);
chatWidget->setStyleSheet(Style::getStylesheet(":/ui/chatArea/chatArea.css")); chatWidget->setStyleSheet(Style::getStylesheet(":/ui/chatArea/chatArea.css"));
headWidget->setStyleSheet(Style::getStylesheet(":/ui/chatArea/chatHead.css")); headWidget->setStyleSheet(Style::getStylesheet(":/ui/chatArea/chatHead.css"));
@ -241,6 +248,7 @@ GenericChatForm::GenericChatForm(QWidget* parent)
GenericChatForm::~GenericChatForm() GenericChatForm::~GenericChatForm()
{ {
Translator::unregister(this); Translator::unregister(this);
delete searchForm;
} }
void GenericChatForm::adjustFileMenuPosition() void GenericChatForm::adjustFileMenuPosition()
@ -531,6 +539,104 @@ void GenericChatForm::addSystemDateMessage()
insertChatMessage(ChatMessage::createChatInfoMessage(dateText, ChatMessage::INFO, QDateTime())); insertChatMessage(ChatMessage::createChatInfoMessage(dateText, ChatMessage::INFO, QDateTime()));
} }
void GenericChatForm::desibleSearchText()
{
if (searchPoint != QPoint(1, -1)) {
QVector<ChatLine::Ptr> lines = chatWidget->getLines();
int numLines = lines.size();
int index = numLines - searchPoint.x();
if (numLines > index) {
ChatLine::Ptr l = lines[index];
ChatLineContent* content = l->getContent(1);
Text* text = static_cast<Text*>(content);
text->deselectText();
}
}
}
bool GenericChatForm::searchInText(const QString& phrase, bool searchUp)
{
bool isSearch = false;
if (phrase.isEmpty()) {
desibleSearchText();
}
QVector<ChatLine::Ptr> lines = chatWidget->getLines();
if (lines.isEmpty()) {
return isSearch;
}
int numLines = lines.size();
int startLine = numLines - searchPoint.x();
if (startLine < 0 || startLine >= numLines) {
return isSearch;
}
for (int i = startLine; searchUp ? i >= 0 : i < numLines; searchUp ? --i : ++i) {
ChatLine::Ptr l = lines[i];
if (l->getColumnCount() < 2) {
continue;
}
ChatLineContent* content = l->getContent(1);
Text* text = static_cast<Text*>(content);
if (searchUp && searchPoint.y() == 0) {
text->deselectText();
searchPoint.setY(-1);
continue;
}
QString txt = content->getText();
if (txt.contains(phrase, Qt::CaseInsensitive)) {
int index = indexForSearchInLine(txt, phrase, searchUp);
if ((index == -1 && searchPoint.y() > -1)) {
text->deselectText();
searchPoint.setY(-1);
} else {
chatWidget->scrollToLine(l);
text->deselectText();
text->selectText(phrase, index);
searchPoint = QPoint(numLines - i, index);
isSearch = true;
break;
}
}
}
return isSearch;
}
int GenericChatForm::indexForSearchInLine(const QString& txt, const QString& phrase, bool searchUp)
{
int index = 0;
if (searchUp) {
int startIndex = -1;
if (searchPoint.y() > -1) {
startIndex = searchPoint.y() - 1;
}
index = txt.lastIndexOf(phrase, startIndex, Qt::CaseInsensitive);
} else {
int startIndex = 0;
if (searchPoint.y() > -1) {
startIndex = searchPoint.y() + 1;
}
index = txt.indexOf(phrase, startIndex, Qt::CaseInsensitive);
}
return index;
}
void GenericChatForm::clearChatArea() void GenericChatForm::clearChatArea()
{ {
clearChatArea(true); clearChatArea(true);
@ -681,6 +787,35 @@ void GenericChatForm::searchFormShow()
} }
} }
void GenericChatForm::onSearchTrigered()
{
if (searchForm->isHidden()) {
searchForm->removeSearchPhrase();
desibleSearchText();
} else {
searchPoint = QPoint(1, -1);
searchAfterLoadHistory = false;
}
}
void GenericChatForm::searchInBegin(const QString& phrase)
{
desibleSearchText();
searchPoint = QPoint(1, -1);
onSearchUp(phrase);
}
void GenericChatForm::onContinueSearch()
{
QString phrase = searchForm->getSearchPhrase();
if (!phrase.isEmpty() && searchAfterLoadHistory) {
searchAfterLoadHistory = false;
onSearchUp(phrase);
}
}
void GenericChatForm::retranslateUi() void GenericChatForm::retranslateUi()
{ {
sendButton->setToolTip(tr("Send message")); sendButton->setToolTip(tr("Send message"));

12
src/widget/form/genericchatform.h

@ -104,6 +104,12 @@ protected slots:
void quoteSelectedText(); void quoteSelectedText();
void copyLink(); void copyLink();
void searchFormShow(); void searchFormShow();
void onSearchTrigered();
void searchInBegin(const QString& phrase);
virtual void onSearchUp(const QString& phrase) = 0;
virtual void onSearchDown(const QString& phrase) = 0;
void onContinueSearch();
private: private:
void retranslateUi(); void retranslateUi();
@ -125,6 +131,9 @@ protected:
virtual bool event(QEvent*) final override; virtual bool event(QEvent*) final override;
virtual void resizeEvent(QResizeEvent* event) final override; virtual void resizeEvent(QResizeEvent* event) final override;
virtual bool eventFilter(QObject* object, QEvent* event) final override; virtual bool eventFilter(QObject* object, QEvent* event) final override;
void desibleSearchText();
bool searchInText(const QString& phrase, bool searchUp);
int indexForSearchInLine(const QString& txt, const QString& phrase, bool searchUp);
protected: protected:
bool audioInputFlag; bool audioInputFlag;
@ -160,6 +169,9 @@ protected:
FlyoutOverlayWidget* fileFlyout; FlyoutOverlayWidget* fileFlyout;
GenericNetCamView* netcam; GenericNetCamView* netcam;
Widget* parent; Widget* parent;
QPoint searchPoint;
bool searchAfterLoadHistory;
}; };
#endif // GENERICCHATFORM_H #endif // GENERICCHATFORM_H

12
src/widget/form/groupchatform.cpp

@ -22,6 +22,8 @@
#include "tabcompleter.h" #include "tabcompleter.h"
#include "src/core/core.h" #include "src/core/core.h"
#include "src/core/coreav.h" #include "src/core/coreav.h"
#include "src/chatlog/chatlog.h"
#include "src/chatlog/content/text.h"
#include "src/model/friend.h" #include "src/model/friend.h"
#include "src/friendlist.h" #include "src/friendlist.h"
#include "src/model/group.h" #include "src/model/group.h"
@ -189,6 +191,16 @@ void GroupChatForm::onTitleChanged(uint32_t groupId, const QString& author, cons
addSystemInfoMessage(message, ChatMessage::INFO, curTime); addSystemInfoMessage(message, ChatMessage::INFO, curTime);
} }
void GroupChatForm::onSearchUp(const QString& phrase)
{
searchInText(phrase, true);
}
void GroupChatForm::onSearchDown(const QString& phrase)
{
searchInText(phrase, false);
}
void GroupChatForm::onScreenshotClicked() void GroupChatForm::onScreenshotClicked()
{ {
// Unsupported // Unsupported

2
src/widget/form/groupchatform.h

@ -49,6 +49,8 @@ private slots:
void onCallClicked(); void onCallClicked();
void onUserListChanged(); void onUserListChanged();
void onTitleChanged(uint32_t groupId, const QString& author, const QString& title); void onTitleChanged(uint32_t groupId, const QString& author, const QString& title);
void onSearchUp(const QString& phrase) override;
void onSearchDown(const QString& phrase) override;
protected: protected:
virtual GenericNetCamView* createNetcam() final override; virtual GenericNetCamView* createNetcam() final override;

38
src/widget/searchform.cpp

@ -23,27 +23,14 @@
#include <QLineEdit> #include <QLineEdit>
#include <QPushButton> #include <QPushButton>
SearchForm::SearchForm(QWidget *parent) : QWidget(parent) SearchForm::SearchForm(QWidget* parent) : QWidget(parent)
{ {
QHBoxLayout *layout = new QHBoxLayout(); QHBoxLayout *layout = new QHBoxLayout();
searchLine = new QLineEdit(); searchLine = new QLineEdit();
upButton = new QPushButton();
upButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); upButton = createButton("searchUpButton", "green");
upButton->setObjectName("searchUpButton"); downButton = createButton("searchDownButton", "green");
upButton->setProperty("state", "green"); hideButton = createButton("hideButton","red");
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")));
hideButton = new QPushButton();
hideButton->setAttribute(Qt::WA_LayoutUsesWidgetRect);
hideButton->setObjectName("hideButton");
hideButton->setProperty("state", "red");
hideButton->setStyleSheet(Style::getStylesheet(QStringLiteral(":/ui/chatForm/buttons.css")));
layout->setMargin(0); layout->setMargin(0);
layout->addWidget(searchLine); layout->addWidget(searchLine);
@ -69,13 +56,24 @@ QString SearchForm::getSearchPhrase() const
return searchPhrase; return searchPhrase;
} }
void SearchForm::showEvent(QShowEvent *event) QPushButton *SearchForm::createButton(const QString& name, const QString& state)
{
QPushButton* btn = new QPushButton();
btn->setAttribute(Qt::WA_LayoutUsesWidgetRect);
btn->setObjectName(name);
btn->setProperty("state", state);
btn->setStyleSheet(Style::getStylesheet(QStringLiteral(":/ui/chatForm/buttons.css")));
return btn;
}
void SearchForm::showEvent(QShowEvent* event)
{ {
QWidget::showEvent(event); QWidget::showEvent(event);
emit visibleChanged(); emit visibleChanged();
} }
void SearchForm::changedSearchPhrase(const QString &text) void SearchForm::changedSearchPhrase(const QString& text)
{ {
searchPhrase = text; searchPhrase = text;
emit searchInBegin(searchPhrase); emit searchInBegin(searchPhrase);

14
src/widget/searchform.h

@ -29,11 +29,13 @@ class SearchForm final : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit SearchForm(QWidget *parent = nullptr); explicit SearchForm(QWidget* parent = nullptr);
void removeSearchPhrase(); void removeSearchPhrase();
QString getSearchPhrase() const; QString getSearchPhrase() const;
private: private:
QPushButton* createButton(const QString& name, const QString& state);
QPushButton* upButton; QPushButton* upButton;
QPushButton* downButton; QPushButton* downButton;
QPushButton* hideButton; QPushButton* hideButton;
@ -42,18 +44,18 @@ private:
QString searchPhrase; QString searchPhrase;
protected: protected:
virtual void showEvent(QShowEvent *event); virtual void showEvent(QShowEvent* event);
private slots: private slots:
void changedSearchPhrase(const QString &text); void changedSearchPhrase(const QString& text);
void clickedUp(); void clickedUp();
void clickedDown(); void clickedDown();
void clickedHide(); void clickedHide();
signals: signals:
void searchInBegin(const QString &); void searchInBegin(const QString& phrase);
void searchUp(const QString &); void searchUp(const QString& phrase);
void searchDown(const QString &); void searchDown(const QString& phrase);
void visibleChanged(); void visibleChanged();
}; };

Loading…
Cancel
Save