Sayonara Player
Loading...
Searching...
No Matches
CoverView.h
1/* CoverView.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 COVERVIEW_H
22#define COVERVIEW_H
23
24#include "Gui/Library/ItemView.h"
25#include "Gui/Library/Header/ActionPair.h"
26#include "Utils/Library/Sortorder.h"
27
28class LocalLibrary;
29class QAction;
30
31namespace Library
32{
33 class MergeData;
34 class ActionPair;
35
40 class CoverView :
41 public ItemView
42 {
43 Q_OBJECT
44 PIMPL(CoverView)
45
46 public:
47 explicit CoverView(QWidget* parent = nullptr);
48 ~CoverView() override;
49
50 void init(LocalLibrary* library);
51 AbstractLibrary* library() const override;
52
53 // QAbstractItemView
54 QStyleOptionViewItem viewOptions() const override;
55
56 //SayonaraSelectionView
57 int mapModelIndexToIndex(const QModelIndex& idx) const override;
58 ModelIndexRange mapIndexToModelIndexes(int idx) const override;
59 SelectionViewInterface::SelectionType selectionType() const override;
60
61 int zoom() const;
62 void changeZoom(int zoom = -1);
63 void changeSortorder(SortOrder so);
64
65 static QList<ActionPair> sortingActions();
66 static QList<int> zoomFactors();
67
68 public slots:
69 void reload();
70 void clearCache();
71
72 protected:
73 void fill() override;
74 void initContextMenu() override;
75
76 void languageChanged() override;
77
78 // ItemView
79 bool isMergeable() const override;
80 MD::Interpretation metadataInterpretation() const override;
81
82 int sizeHintForColumn(int) const override;
83
84 void wheelEvent(QWheelEvent* e) override;
85 void resizeEvent(QResizeEvent* e) override;
86 void hideEvent(QHideEvent* e) override;
87
88 private:
89 void resizeSections();
90
91 // Library::ItemView
92 void playClicked() override;
93 void playNewTabClicked() override;
94 void playNextClicked() override;
95 void appendClicked() override;
96 void selectedItemsChanged(const IndexSet& indexes) override;
97 void refreshClicked() override;
98 void runMergeOperation(const Library::MergeData& mergedata) override;
99 };
100}
101
102#endif // COVERVIEW_H
Definition AbstractLibrary.h:41
The CoverView class.
Definition CoverView.h:42
bool isMergeable() const override
indicates if multiple ids can be merged into one. For example if the same artist is written in three ...
The main task of the ItemView is to display a context menu for various selections....
Definition ItemView.h:57
Definition MergeData.h:33
Definition LocalLibrary.h:38
Definition EngineUtils.h:33
A set structure. Inherited from std::set with some useful methods. For integer and String this set is...
Definition Set.h:37
Definition typedefs.h:33