Sayonara Player
HeaderView.h
1 
2 /* Copyright (C) 2011-2016 Lucio Carreras
3  *
4  * This file is part of sayonara player
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10 
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15 
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 
21 
22 #ifndef HEADERVIEW_H
23 #define HEADERVIEW_H
24 
25 #include <QHeaderView>
26 #include <QWidget>
27 #include <QMenu>
28 #include <QTableView>
29 
30 #include "GUI/Library/Helper/ColumnHeader.h"
31 #include "Helper/Settings/SayonaraClass.h"
32 #include "Components/Library/Sorting.h"
33 
34 
35 class HeaderView :
36  public QHeaderView,
37  protected SayonaraClass
38 {
39 
40  Q_OBJECT
41 
42 signals:
43  void sig_columns_changed(const BoolList& shown_cols);
44 
45 private:
46  QMenu* _context_menu=nullptr;
47  ColumnHeaderList _column_headers;
48 
49 private:
50  void init_header_action(ColumnHeader* header, bool is_shown);
51 
52 private slots:
53  void action_triggered(bool b);
54  void language_changed();
55 
56 public:
57 
58  HeaderView(Qt::Orientation orientation, QWidget* parent=nullptr);
59  QSize sizeHint() const override;
60 
61  void set_column_headers(const ColumnHeaderList& column_headers, const BoolList& shown_columns, SortOrder sorting );
62  void refresh_sizes(QTableView* view);
63  BoolList refresh_active_columns();
64 
65  ColumnHeader* get_column_header(int idx);
66 
67 };
68 
69 
70 
71 #endif // HEADERVIEW_H
The SayonaraClass class provides access to Settings and notifications.
Definition: SayonaraClass.h:31
Definition: ColumnHeader.h:191
Definition: ColumnHeader.h:40
Definition: HeaderView.h:35