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 "CoverViewSortorderInfo.h"
25#include "Gui/Library/ItemView.h"
26#include "Gui/Utils/SearchableWidget/SelectionView.h"
27#include "Utils/Library/Sortorder.h"
28
29class LocalLibrary;
30class QAction;
31
32namespace Library
33{
34 class MergeData;
35
36 class CoverView :
37 public ItemView
38 {
39 Q_OBJECT
40 Q_PROPERTY(QColor overlayForeground READ overlayForeground WRITE setOverlayForeground DESIGNABLE true)
41 Q_PROPERTY(QColor overlayBackground READ overlayBackground WRITE setOverlayBackground DESIGNABLE true)
42 Q_PROPERTY(int overlayAlpha READ overlayAlpha WRITE setOverlayAlpha DESIGNABLE true)
43
44 PIMPL(CoverView)
45
46 public:
47 explicit CoverView(QWidget* parent = nullptr);
48 ~CoverView() override;
49
50 void init(LocalLibrary* library);
51 [[nodiscard]] AbstractLibrary* library() const override;
52
53 // QAbstractItemView
54 [[nodiscard]] QStyleOptionViewItem viewOptions() const override;
55
56 //SayonaraSelectionView
57 [[nodiscard]] int mapModelIndexToIndex(const QModelIndex& idx) const override;
58 [[nodiscard]] ModelIndexRange mapIndexToModelIndexes(int idx) const override;
59 [[nodiscard]] SelectionViewInterface::SelectionType selectionType() const override;
60
61 [[nodiscard]] int zoom() const;
62 void changeZoom(int zoom = -1);
63 void changeSortorder(AlbumSortorder so);
64
65 [[nodiscard]] QColor overlayForeground() const;
66 void setOverlayForeground(const QColor& color);
67
68 [[nodiscard]] QColor overlayBackground() const;
69 void setOverlayBackground(const QColor& color);
70
71 [[nodiscard]] int overlayAlpha() const;
72 void setOverlayAlpha(int alpha);
73
74 [[nodiscard]] static QList<CoverViewSortorderInfo> sortingActions();
75 [[nodiscard]] static QList<int> zoomFactors();
76
77 public slots:
78 void reload();
79 void clearCache();
80
81 protected:
82 void fill() override;
83 void initContextMenu() override;
84
85 // ItemView
86 [[nodiscard]] bool isMergeable() const override;
87 [[nodiscard]] MD::Interpretation metadataInterpretation() const override;
88 [[nodiscard]] ItemModel* itemModel() const override;
89 [[nodiscard]] int sizeHintForColumn(int size) const override;
90
91 void triggerSelectionChange(const IndexSet& indexes) override;
92
93 [[nodiscard]] PlayActionEventHandler::TrackSet trackSet() const override;
94
95 void skinChanged() override;
96
97 void wheelEvent(QWheelEvent* e) override;
98 void resizeEvent(QResizeEvent* e) override;
99 void hideEvent(QHideEvent* e) override;
100
101 private:
102 void resizeSections();
103 void refreshView() override;
104 void runMergeOperation(const Library::MergeData& mergedata) override;
105 void scrollspeedChanged();
106 };
107}
108
109#endif // COVERVIEW_H
Definition AbstractLibrary.h:41
Definition ItemModel.h:40
Definition MergeData.h:33
Definition LocalLibrary.h:38
Definition EngineUtils.h:33