Sayonara Player
HeaderView.h
1 
2 /* Copyright (C) 2011-2019 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 "Gui/Library/Header/ColumnHeader.h"
24 #include "Gui/Utils/Widgets/WidgetTemplate.h"
25 #include "Utils/Library/Sortorder.h"
26 #include "Utils/Pimpl.h"
27 
28 #include <QTableView>
29 #include <QHeaderView>
30 #include <QMenu>
31 
32 namespace Library
33 {
38  class HeaderView :
39  public Gui::WidgetTemplate<QHeaderView>
40  {
41  Q_OBJECT
42  PIMPL(HeaderView)
43 
44  signals:
45  void sig_columns_changed();
46 
47  private:
48  void init_header_action(ColumnHeaderPtr header, bool is_shown);
49  QString resize_text() const;
50 
51  int calc_header_width() const;
52 
53  private slots:
54  void action_triggered(bool b);
55  void action_resize_triggered();
56 
57  protected:
58  BoolList refresh_active_columns();
59  void language_changed() override;
60  void resizeEvent(QResizeEvent* e) override;
61 
62  public:
63  HeaderView(Qt::Orientation orientation, QWidget* parent=nullptr);
64  virtual ~HeaderView() override;
65 
66  QSize sizeHint() const override;
67 
68  void set_columns(const ColumnHeaderList& column_headers, const BoolList& shown_columns, Library::SortOrder sorting );
69 
70  BoolList shown_columns() const;
71  ColumnHeaderPtr column(int idx);
72  };
73 }
74 
75 #endif // HEADERVIEW_H
SortOrder
The SortOrder enum.
Definition: Sortorder.h:31
The HeaderView class.
Definition: HeaderView.h:38
Template for Sayonara Widgets. This template is responsible for holding a reference to the settings.
Definition: WidgetTemplate.h:84
An interface class needed when implementing a library plugin.
Definition: LocalLibraryWatcher.h:32
Definition: EngineUtils.h:33