Sayonara Player
ColumnHeader.h
1 /* MyColumnHeader.h */
2 
3 /* Copyright (C) 2011-2020 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 /*
22  *
23  * Created on: 19.12.2012
24  * Author: luke
25  */
26 
27 #ifndef MYCOLUMNHEADER_H_
28 #define MYCOLUMNHEADER_H_
29 
30 #include "ColumnIndex.h"
31 #include "Utils/Library/Sortorder.h"
32 #include "Utils/Pimpl.h"
33 
34 #include <QObject>
35 
36 class QAction;
37 namespace Library
38 {
43  class ColumnHeader : public QObject
44  {
45  Q_OBJECT
46  PIMPL(ColumnHeader)
47 
48  protected:
49  ColumnHeader(ColumnIndex::IntegerType columnIndex, bool switchable, SortOrder sortAsc, SortOrder sortDesc,
50  int preferredWidth, bool isStretchable = false);
51  virtual QString hashPrefix() const = 0;
52 
53  public:
54  virtual ~ColumnHeader() override;
55 
56  virtual QString title() const = 0;
57 
58  QString hash() const;
59 
60  bool isStretchable() const;
61  bool isSwitchable() const;
62  int defaultSize() const;
63 
64  SortOrder sortorder(Qt::SortOrder sortOrder) const;
65 
66  ColumnIndex::IntegerType columnIndex() const;
67  };
68 
70  {
71  Q_OBJECT
72 
73  public:
74  ColumnHeaderTrack(ColumnIndex::Track columnIndex, bool switchable, SortOrder sortAsc, SortOrder sortDesc,
75  int preferredWidth, bool isStretchable = false);
76  QString title() const override;
77 
78  protected:
79  QString hashPrefix() const override;
80  };
81 
83  {
84  Q_OBJECT
85 
86  public:
87  ColumnHeaderAlbum(ColumnIndex::Album columnIndex, bool switchable, SortOrder sortAsc, SortOrder sortDesc,
88  int preferredWidth, bool isStretchable = false);
89  QString title() const override;
90 
91  protected:
92  QString hashPrefix() const override;
93  };
94 
96  {
97  Q_OBJECT
98 
99  public:
100  ColumnHeaderArtist(ColumnIndex::Artist columnIndex, bool switchable, SortOrder sortAsc, SortOrder sortDesc,
101  int preferredWidth, bool isStretchable = false);
102  QString title() const override;
103 
104  protected:
105  QString hashPrefix() const override;
106  };
107 
108  using ColumnHeaderPtr = std::shared_ptr<ColumnHeader>;
110 }
111 
112 #endif /* MYCOLUMNHEADER_H_ */
QList
Definition: EngineUtils.h:33
Library::ColumnHeader
The ColumnHeader class.
Definition: ColumnHeader.h:44
Library
An interface class needed when implementing a library plugin.
Definition: LocalLibraryWatcher.h:31
Library::ColumnHeaderTrack
Definition: ColumnHeader.h:70
Library::ColumnHeaderArtist
Definition: ColumnHeader.h:96
Library::ColumnHeaderAlbum
Definition: ColumnHeader.h:83
Library::SortOrder
SortOrder
The SortOrder enum.
Definition: Sortorder.h:32