Sayonara Player
HeaderView.h
1 
2 /* Copyright (C) 2011-2017 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 #ifndef HEADERVIEW_H
21 #define HEADERVIEW_H
22 
23 #include <QHeaderView>
24 #include <QWidget>
25 #include <QMenu>
26 #include <QTableView>
27 
28 #include "GUI/Library/Helper/ColumnHeader.h"
29 #include "Helper/Settings/SayonaraClass.h"
30 #include "Helper/typedefs.h"
31 #include "Helper/Library/Sortorder.h"
32 
33 class HeaderView :
34  public QHeaderView,
35  protected SayonaraClass
36 {
37  Q_OBJECT
38 
39 signals:
40  void sig_columns_changed(const BoolList& shown_cols);
41 
42 private:
43  QMenu* _context_menu=nullptr;
44  ColumnHeaderList _column_headers;
45 
46 private:
47  void init_header_action(ColumnHeader* header, bool is_shown);
48 
49 private slots:
50  void action_triggered(bool b);
51  void language_changed();
52 
53 public:
54 
55  HeaderView(Qt::Orientation orientation, QWidget* parent=nullptr);
56  QSize sizeHint() const override;
57 
58  void set_column_headers(const ColumnHeaderList& column_headers, const BoolList& shown_columns, Library::SortOrder sorting );
59  void refresh_sizes(QTableView* view);
60  BoolList refresh_active_columns();
61 
62  ColumnHeader* get_column_header(int idx);
63 };
64 
65 #endif // HEADERVIEW_H
The SayonaraClass class provides access to Settings and notifications.
Definition: SayonaraClass.h:29
Definition: ColumnHeader.h:101
Definition: ColumnHeader.h:34
Definition: HeaderView.h:33