Sayonara Player
TableView.h
1 /* TableView.h */
2 
3 /* Copyright (C) 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 #ifndef LIBRARYTABLEVIEW_H
22 #define LIBRARYTABLEVIEW_H
23 
24 #include "ItemView.h"
25 #include "Utils/Library/Sortorder.h"
26 #include "GUI/Library/Utils/ColumnHeader.h"
27 #include "Utils/Pimpl.h"
28 
29 namespace Library
30 {
31  class HeaderView;
32  class TableView :
33  public Library::ItemView
34  {
35  Q_OBJECT
36  PIMPL(TableView)
37 
38  signals:
39  void sig_columns_changed();
40  void sig_sortorder_changed(Library::SortOrder);
41 
42  private:
43  TableView(const TableView& other)=delete;
44  TableView& operator=(const TableView& other)=delete;
45 
46  public:
47  explicit TableView(QWidget* parent=nullptr);
48  ~TableView();
49 
50  virtual void init(AbstractLibrary* library);
51 
52  protected:
53  virtual void init_view(AbstractLibrary* library)=0;
54  virtual ColumnHeaderList column_headers() const=0;
55  virtual BoolList shown_columns() const=0;
56  virtual Library::SortOrder sortorder() const=0;
57 
58  void resizeEvent(QResizeEvent* e) override;
59  void language_changed() override;
60 
61  // SayonaraSelectionView.h
62  int index_by_model_index(const QModelIndex& idx) const override;
63  QModelIndex model_index_by_index(int idx) const override;
64 
65  virtual void columns_changed();
66  virtual void sortorder_changed(SortOrder s);
67 
68 
69  protected slots:
70  void header_actions_triggered();
71  void sort_by_column(int column_idx);
72  };
73 }
74 
75 #endif // LIBRARYTABLEVIEW_H
Definition: AbstractLibrary.h:47
Definition: ColumnHeader.h:90
Definition: TableView.h:32
An interface class needed when implementing a library plugin.
Definition: LibraryManager.h:36
Definition: ItemView.h:51