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/Utils/ColumnHeader.h"
29 #include "GUI/Utils/Widgets/WidgetTemplate.h"
30 #include "Utils/Library/Sortorder.h"
31 #include "Utils/Pimpl.h"
32 
33 namespace Library
34 {
35  class HeaderView :
36  public Gui::WidgetTemplate<QHeaderView>
37  {
38  Q_OBJECT
39  PIMPL(HeaderView)
40 
41  signals:
42  void sig_columns_changed();
43 
44  private:
45  void init_header_action(ColumnHeaderPtr header, bool is_shown);
46 
47  private slots:
48  void action_triggered(bool b);
49 
50  protected:
51  BoolList refresh_active_columns();
52  void language_changed() override;
53 
54  public:
55  HeaderView(Qt::Orientation orientation, QWidget* parent=nullptr);
56  virtual ~HeaderView();
57 
58  QSize sizeHint() const override;
59 
60  void set_column_headers(const ColumnHeaderList& column_headers, const BoolList& shown_columns, Library::SortOrder sorting );
61  void refresh_sizes(QTableView* view);
62 
63  BoolList shown_columns() const;
64  ColumnHeaderPtr column_header(int idx);
65  };
66 }
67 
68 #endif // HEADERVIEW_H
Definition: HeaderView.h:35
Template for Sayonara Widgets. This template is responsible for holding a reference to the settings.
Definition: WidgetTemplate.h:47
Definition: ColumnHeader.h:95
An interface class needed when implementing a library plugin.
Definition: CachingThread.h:31