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, int preferredWidth, bool isStretchable=false);
50  virtual QString hashPrefix() const=0;
51 
52  public:
53  virtual ~ColumnHeader();
54 
55  virtual QString title() const=0;
56 
57  QString hash() const;
58 
59  bool isStretchable() const;
60  bool isSwitchable() const;
61  int defaultSize() const;
62 
63  int preferredSize() const;
64  void setPreferredSize(int size);
65 
66  SortOrder sortorder(Qt::SortOrder sortOrder) const;
67 
68  ColumnIndex::IntegerType columnIndex() const;
69  };
70 
71 
73  {
74  Q_OBJECT
75 
76  public:
77  ColumnHeaderTrack(ColumnIndex::Track columnIndex, bool switchable, SortOrder sortAsc, SortOrder sortDesc, int preferredWidth, bool isStretchable=false);
78  QString title() const override;
79 
80  protected:
81  QString hashPrefix() const override;
82  };
83 
85  {
86  Q_OBJECT
87 
88  public:
89  ColumnHeaderAlbum(ColumnIndex::Album columnIndex, bool switchable, SortOrder sortAsc, SortOrder sortDesc, int preferredWidth, bool isStretchable=false);
90  QString title() const override;
91 
92  protected:
93  QString hashPrefix() const override;
94  };
95 
97  {
98  Q_OBJECT
99 
100  public:
101  ColumnHeaderArtist(ColumnIndex::Artist columnIndex, bool switchable, SortOrder sortAsc, SortOrder sortDesc, 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:73
Library::ColumnHeaderArtist
Definition: ColumnHeader.h:97
Library::ColumnHeaderAlbum
Definition: ColumnHeader.h:85
Library::SortOrder
SortOrder
The SortOrder enum.
Definition: Sortorder.h:32