Sayonara Player
Loading...
Searching...
No Matches
TableView.h
1/* TableView.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 LIBRARYTABLEVIEW_H
22#define LIBRARYTABLEVIEW_H
23
24#include "Gui/Library/ItemView.h"
25#include "Gui/Library/Header/ColumnHeader.h"
26#include "Gui/Utils/SearchableWidget/SelectionView.h"
27
28#include "Utils/Pimpl.h"
29#include "Utils/Library/Sortorder.h"
30
32namespace Library
33{
34 class TableView :
35 public ItemView
36 {
37 Q_OBJECT
38 PIMPL(TableView)
39
40 private:
41
42 public:
43 explicit TableView(QWidget* parent = nullptr);
44 ~TableView() override;
45 TableView(const TableView& other) = delete;
46 TableView& operator=(const TableView& other) = delete;
47
48 void init(const std::shared_ptr<PlayActionEventHandler>& playActionEventHandler, AbstractLibrary* library);
49
50 protected:
51 void setupColumnNames();
52 virtual void initView(AbstractLibrary* library) = 0;
53
54 [[nodiscard]] virtual ColumnHeaderList columnHeaders() const = 0;
55 [[nodiscard]] virtual QByteArray columnHeaderState() const = 0;
56 virtual void saveColumnHeaderState(const QByteArray& state) = 0;
57
58 [[nodiscard]] virtual VariableSortorder sortorder() const = 0;
59 virtual void applySortorder(VariableSortorder s) = 0;
60
61 [[nodiscard]] virtual bool autoResizeState() const = 0;
62 virtual void saveAutoResizeState(bool b) = 0;
63
64 void languageChanged() override;
65
66 [[nodiscard]] int mapModelIndexToIndex(const QModelIndex& idx) const override;
67 [[nodiscard]] ModelIndexRange mapIndexToModelIndexes(int idx) const override;
68
69 protected slots:
70 void headerColumnsChanged(int oldCount, int newCount);
71 void sortorderChanged(int index, Qt::SortOrder sortorder);
72 void sectionResized(int logicalIndex, int oldSize, int newSize);
73 void sectionMoved(int logicalIndex, int oldVisualIndex, int newVisualIndex);
74 void autoResizeTriggered(bool b);
75 };
76}
77
78#endif // LIBRARYTABLEVIEW_H
Definition: AbstractLibrary.h:41
Definition: LibraryPlaylistInteractor.h:34
Definition: ItemView.h:55
Definition: TableView.h:36
Definition: EngineUtils.h:33
Definition: typedefs.h:33