Sayonara Player
TableView.h
1 /* TableView.h */
2 
3 /* Copyright (C) 2011-2019 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 "Gui/Library/Header/ColumnHeader.h"
26 
27 #include "Utils/Pimpl.h"
28 #include "Utils/Library/Sortorder.h"
29 
30 namespace Library
31 {
36  class TableView :
37  public ItemView
38  {
39  Q_OBJECT
40  PIMPL(TableView)
41 
42  signals:
43  void sig_sortorder_changed(SortOrder);
44 
45  private:
46  TableView(const TableView& other)=delete;
47  TableView& operator=(const TableView& other)=delete;
48 
49  public:
50  explicit TableView(QWidget* parent=nullptr);
51  virtual ~TableView() override;
52 
53  virtual void init(AbstractLibrary* library);
54 
55  protected:
61  virtual void init_view(AbstractLibrary* library)=0;
62 
69  virtual ColumnHeaderList column_headers() const=0;
70 
77  virtual IntList column_header_sizes() const=0;
78 
84  virtual void save_column_header_sizes(const IntList& sizes)=0;
85 
91  virtual BoolList visible_columns() const=0;
92 
98  virtual void save_visible_columns(const BoolList& columns)=0;
99 
103  virtual SortOrder sortorder() const=0;
104 
108  virtual void save_sortorder(SortOrder s)=0;
109 
110  void language_changed() override;
111 
112  // SayonaraSelectionView.h
113  int index_by_model_index(const QModelIndex& idx) const override;
114  ModelIndexRange model_indexrange_by_index(int idx) const override;
115 
116  protected slots:
117  void header_actions_triggered();
118  void sort_by_column(int column_idx);
119  void sizes_changed();
120  };
121 }
122 
123 #endif // LIBRARYTABLEVIEW_H
SortOrder
The SortOrder enum.
Definition: Sortorder.h:31
virtual ColumnHeaderList column_headers() const =0
returns a list of ColumnHeader objects containing name, sortorder. Everytime when the language is cha...
virtual BoolList visible_columns() const =0
A boolean vector where true indicates a visible column and false indicates an invisible column...
virtual IntList column_header_sizes() const =0
This method returns the SAVED column header sizes as they were remembered since the last time sayonar...
Definition: AbstractLibrary.h:41
virtual void save_sortorder(SortOrder s)=0
saves the current sortorder
Definition: typedefs.h:32
virtual void save_visible_columns(const BoolList &columns)=0
save the current state of visible columns
The TableView class.
Definition: TableView.h:36
virtual SortOrder sortorder() const =0
returns the current sortorder for the table view
virtual void init_view(AbstractLibrary *library)=0
here, the model and delegate should be instantiated as well as connections and setting listeners ...
An interface class needed when implementing a library plugin.
Definition: LocalLibraryWatcher.h:32
The main task of the ItemView is to display a context menu for various selections. It also handles drag and drop events with a cover. It supports merging and imports.
Definition: ItemView.h:54
virtual void save_column_header_sizes(const IntList &sizes)=0
Here, the column headers sizes should be saved somewhere.
Definition: EngineUtils.h:33