Sayonara Player
ColumnHeader.h
1 /* MyColumnHeader.h */
2 
3 /* Copyright 2011-2017 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 "Helper/Library/Sortorder.h"
31 
32 #include <QAction>
33 
34 class ColumnHeader : public QObject
35 {
36  Q_OBJECT
37 
38 public:
39  enum class SizeType : quint8
40  {
41  Abs=0,
42  Rel,
43  Undefined
44  };
45 
46  enum HeaderType
47  {
48  Sharp,
49  Artist,
50  Album,
51  Title,
52  NumTracks,
53  Duration,
54  DurationShort,
55  Year,
56  Rating,
57  Bitrate,
58  Filesize
59  };
60 
61 
62 private:
63  ColumnHeader(HeaderType type, bool switchable, Library::SortOrder sort_asc, Library::SortOrder sort_desc);
64  virtual ~ColumnHeader();
65 
66 
67 private:
68  QAction* _action=nullptr;
69  bool _switchable;
70 
71  int _preferred_size_abs;
72  double _preferred_size_rel;
73 
74  Library::SortOrder _sort_asc;
75  Library::SortOrder _sort_desc;
76  SizeType _size_type;
77  HeaderType _type;
78 
79 public:
80 
81  ColumnHeader(HeaderType type, bool switchable, Library::SortOrder sort_asc, Library::SortOrder sort_desc, int preferred_size_abs);
82  ColumnHeader(HeaderType type, bool switchable, Library::SortOrder sort_asc, Library::SortOrder sort_desc, double preferred_size_rel, int min_size);
83 
84  int get_preferred_size_abs() const;
85  double get_preferred_size_rel() const;
86 
87  Library::SortOrder get_asc_sortorder() const;
88  Library::SortOrder get_desc_sortorder() const;
89 
90  ColumnHeader::SizeType get_size_type() const;
91 
92  bool is_visible() const;
93  bool is_hidden() const;
94 
95  void retranslate();
96 
97  QAction* get_action();
98  QString get_title() const;
99 };
100 
102  public QList<ColumnHeader*>
103 {
104  public:
105  int get_shown_columns() const;
106  int get_nth_shown_col(int n) const;
107 };
108 
109 #endif /* MYCOLUMNHEADER_H_ */
Definition: ColumnHeader.h:101
Definition: ColumnHeader.h:34
The Album class.
Definition: Album.h:38
The Artist class.
Definition: Artist.h:33
Definition: org_mpris_media_player2_adaptor.h:20