Sayonara Player
Toggle main menu visibility
Loading...
Searching...
No Matches
src
Gui
Utils
SearchableWidget
SearchableView.h
1
/* SearchableView.h */
2
3
/* Copyright (C) 2011-2024 Michael Lugmair (Lucio Carreras)
4
*
5
* This file is part of sayonara player
6
*
7
* This program is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
10
* (at your option) any later version.
11
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.
16
17
* You should have received a copy of the GNU General Public License
18
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19
*/
20
21
#ifndef SEARCHABLEVIEW_H
22
#define SEARCHABLEVIEW_H
23
24
#include "Gui/Utils/Widgets/WidgetTemplate.h"
25
#include "Gui/Utils/SearchableWidget/SelectionView.h"
26
#include "Utils/Pimpl.h"
27
28
#include <QKeyEvent>
29
#include <QMap>
30
#include <QTableView>
31
32
class
SearchModel
;
33
34
class
SearchView
35
{
36
PIMPL(SearchView)
37
38
public
:
39
SearchView();
40
virtual
~SearchView()
noexcept
;
41
42
SearchView(
const
SearchView& other) =
delete
;
43
SearchView(SearchView&& other) =
delete
;
44
SearchView& operator=(
const
SearchView& other) =
delete
;
45
SearchView& operator=(SearchView&& other) =
delete
;
46
47
[[nodiscard]]
virtual
QRect viewportGeometry()
const
= 0;
48
int
search(
const
QString& searchstring);
49
void
searchNext();
50
void
searchPrevious();
51
52
[[nodiscard]]
virtual
QWidget* widget() = 0;
53
[[nodiscard]]
virtual
QMap<QString, QString>
searchOptions()
const
;
54
[[nodiscard]]
virtual
QMap<QString, QString>
commands()
const
;
55
56
virtual
void
triggerResult();
57
virtual
void
runCommand(
const
QString& command);
58
59
protected
:
60
[[nodiscard]]
virtual
SearchModel
* searchModel()
const
= 0;
61
virtual
void
selectSearchResult(
int
index) = 0;
62
[[nodiscard]]
virtual
int
currentSelectedItem()
const
= 0;
63
bool
handleKeyPress(QKeyEvent* event);
64
};
65
66
class
SearchableTableView :
67
public
Gui::WidgetTemplate
<QTableView>,
68
public
SearchView,
69
public
SelectionViewInterface
70
{
71
Q_OBJECT
72
73
public
:
74
explicit
SearchableTableView(QWidget* parent =
nullptr
);
75
~SearchableTableView()
override
;
76
77
SearchableTableView(
const
SearchableTableView& other) =
delete
;
78
SearchableTableView(SearchableTableView&& other) =
delete
;
79
SearchableTableView& operator=(
const
SearchableTableView& other) =
delete
;
80
SearchableTableView& operator=(SearchableTableView&& other) =
delete
;
81
82
protected
:
83
[[nodiscard]] QRect viewportGeometry()
const override
;
84
[[nodiscard]] QWidget* widget()
override
;
85
[[nodiscard]]
int
currentSelectedItem()
const override
;
86
void
selectSearchResult(
int
index)
override
;
87
88
void
keyPressEvent(QKeyEvent* event)
override
;
89
};
90
91
#endif
// SEARCHABLEVIEW_H
Gui::WidgetTemplate
Template for Sayonara Widgets. This template is responsible for holding a reference to the settings.
Definition
WidgetTemplate.h:86
QMap
Definition
org_mpris_media_player2_adaptor.h:21
SearchModel
Definition
SearchableModel.h:32
Generated on
for Sayonara Player by
1.17.0