Reorder code to match UI
[qBittorrent.git] / src / gui / search / searchwidget.h
blob06544308c0079ae0ea1b5348e3db8b042ac75263
1 /*
2 * Bittorrent Client using Qt and libtorrent.
3 * Copyright (C) 2020, Will Da Silva <will@willdasilva.xyz>
4 * Copyright (C) 2015, 2018 Vladimir Golovnev <glassez@yandex.ru>
5 * Copyright (C) 2006 Christophe Dumez <chris@qbittorrent.org>
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 * In addition, as a special exception, the copyright holders give permission to
22 * link this program with the OpenSSL project's "OpenSSL" library (or with
23 * modified versions of it that use the same license as the "OpenSSL" library),
24 * and distribute the linked executables. You must obey the GNU General Public
25 * License in all respects for all of the code used other than "OpenSSL". If you
26 * modify file(s), you may extend this exception to your version of the file(s),
27 * but you are not obligated to do so. If you do not wish to do so, delete this
28 * exception statement from your version.
31 #pragma once
33 #include <QList>
34 #include <QPointer>
35 #include <QWidget>
37 #include "gui/guiapplicationcomponent.h"
39 class QEvent;
40 class QObject;
41 class QTabWidget;
43 class MainWindow;
44 class SearchJobWidget;
46 namespace Ui
48 class SearchWidget;
51 class SearchWidget : public GUIApplicationComponent<QWidget>
53 Q_OBJECT
54 Q_DISABLE_COPY_MOVE(SearchWidget)
56 public:
57 explicit SearchWidget(IGUIApplication *app, MainWindow *mainWindow);
58 ~SearchWidget() override;
60 void giveFocusToSearchInput();
62 private slots:
63 void on_searchButton_clicked();
64 void on_pluginsButton_clicked();
66 private:
67 bool eventFilter(QObject *object, QEvent *event) override;
68 void tabChanged(int index);
69 void closeTab(int index);
70 void closeAllTabs();
71 void tabStatusChanged(QWidget *tab);
72 void selectMultipleBox(int index);
73 void toggleFocusBetweenLineEdits();
75 void fillCatCombobox();
76 void fillPluginComboBox();
77 void selectActivePage();
78 void searchTextEdited(const QString &);
80 QString selectedCategory() const;
81 QString selectedPlugin() const;
83 Ui::SearchWidget *m_ui = nullptr;
84 QPointer<SearchJobWidget> m_currentSearchTab; // Selected tab
85 QPointer<SearchJobWidget> m_activeSearchTab; // Tab with running search
86 QList<SearchJobWidget *> m_allTabs; // To store all tabs
87 MainWindow *m_mainWindow = nullptr;
88 bool m_isNewQueryString = false;