Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Merge pull request #6480 from spycrab/qt_search
Qt: Implement search
- Loading branch information
Showing
12 changed files
with
133 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -26,6 +26,7 @@ set(SRCS | ||
| MenuBar.cpp | ||
| RenderWidget.cpp | ||
| Resources.cpp | ||
| SearchBar.cpp | ||
| Settings.cpp | ||
| ToolBar.cpp | ||
| Translation.cpp | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| // Copyright 2018 Dolphin Emulator Project | ||
| // Licensed under GPLv2+ | ||
| // Refer to the license.txt file included. | ||
|
|
||
| #include "DolphinQt2/SearchBar.h" | ||
|
|
||
| #include <QCheckBox> | ||
| #include <QHBoxLayout> | ||
| #include <QLineEdit> | ||
| #include <QPushButton> | ||
|
|
||
| SearchBar::SearchBar(QWidget* parent) : QWidget(parent) | ||
| { | ||
| CreateWidgets(); | ||
| ConnectWidgets(); | ||
|
|
||
| setFixedHeight(32); | ||
|
|
||
| setHidden(true); | ||
| } | ||
|
|
||
| void SearchBar::CreateWidgets() | ||
| { | ||
| m_search_edit = new QLineEdit; | ||
| m_close_button = new QPushButton(tr("Close")); | ||
|
|
||
| m_search_edit->setPlaceholderText(tr("Type your search term here")); | ||
|
|
||
| auto* layout = new QHBoxLayout; | ||
|
|
||
| layout->addWidget(m_search_edit); | ||
| layout->addWidget(m_close_button); | ||
| layout->setMargin(0); | ||
|
|
||
| setLayout(layout); | ||
| } | ||
|
|
||
| void SearchBar::Toggle() | ||
| { | ||
| m_search_edit->clear(); | ||
|
|
||
| setHidden(isVisible()); | ||
|
|
||
| if (isVisible()) | ||
| m_search_edit->setFocus(); | ||
| else | ||
| m_search_edit->clearFocus(); | ||
| } | ||
|
|
||
| void SearchBar::ConnectWidgets() | ||
| { | ||
| connect(m_search_edit, &QLineEdit::textChanged, this, &SearchBar::Search); | ||
| connect(m_close_button, &QPushButton::pressed, this, &SearchBar::Toggle); | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| // Copyright 2018 Dolphin Emulator Project | ||
| // Licensed under GPLv2+ | ||
| // Refer to the license.txt file included. | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <QWidget> | ||
|
|
||
| class QCheckBox; | ||
| class QLineEdit; | ||
| class QPushButton; | ||
|
|
||
| class SearchBar : public QWidget | ||
| { | ||
| Q_OBJECT | ||
| public: | ||
| explicit SearchBar(QWidget* parent = nullptr); | ||
|
|
||
| void Toggle(); | ||
| signals: | ||
| void Search(const QString& serach); | ||
|
|
||
| private: | ||
| void CreateWidgets(); | ||
| void ConnectWidgets(); | ||
|
|
||
| QLineEdit* m_search_edit; | ||
| QCheckBox* m_wii_check; | ||
| QCheckBox* m_gc_check; | ||
| QPushButton* m_close_button; | ||
| }; |