Sayonara Player
GUI_DirectoryWidget.h
1 /* GUI_DirectoryWidget.h */
2 
3 /* Copyright (C) 2011-2016 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 
22 
23 #ifndef GUI_DIRECTORYWIDGET_H
24 #define GUI_DIRECTORYWIDGET_H
25 
26 #include "GUI/DirectoryWidget/ui_GUI_DirectoryWidget.h"
27 #include "GUI/Helper/SayonaraWidget/SayonaraWidget.h"
28 #include "Interfaces/LibraryInterface/LibraryContainer/LibraryContainer.h"
29 #include "GUI/InfoDialog/InfoDialogContainer.h"
30 
31 #include <QWidget>
32 #include <QFileSystemModel>
33 #include <QShowEvent>
34 #include <QMouseEvent>
35 
36 class LocalLibrary;
37 class IconProvider;
38 class LocalLibrary;
40 class LibraryContextMenu;
41 
43  public SayonaraWidget,
44  public InfoDialogContainer,
46 {
47  Q_OBJECT
48 
49 public:
50  explicit GUI_DirectoryWidget(QWidget *parent = 0);
52 
53  QComboBox* get_libchooser();
54 
55 
56 private:
57 
58  enum SelectedWidget
59  {
60  None=0,
61  Dirs,
62  Files
63  } _selected_widget;
64 
65  IconProvider* _icon_provider=nullptr;
66  QFileSystemModel* _file_model=nullptr;
67  LocalLibrary* _local_library=nullptr;
68  AbstractSearchFileTreeModel* _dir_model=nullptr;
69 
70  QModelIndex _found_idx;
71  QString _search_term;
72  QStringList _found_strings;
73 
74 
75 private:
76  void showEvent(QShowEvent* e) override;
77  void init_shortcuts();
78 
79 private slots:
80  void search_button_clicked();
81  void search_term_changed(const QString& term);
82  void directory_loaded(const QString& path);
83  void files_loaded(const QString& path);
84  void init_dir_view();
85  void dir_clicked(QModelIndex idx);
86  void dir_pressed(QModelIndex idx);
87  void file_dbl_clicked(QModelIndex idx);
88  void file_pressed(QModelIndex idx);
89 
90  void dir_append_clicked();
91  void dir_play_next_clicked();
92  void dir_delete_clicked();
93 
94  void file_append_clicked();
95  void file_play_next_clicked();
96  void file_delete_clicked();
97 
98  // InfoDialogContainer interface
99 protected:
100  MetaDataList::Interpretation get_metadata_interpretation() const;
102 };
103 
104 
105 
106 // for showing up in library tree
109 {
110 
111  Q_OBJECT
112 
113 private:
114  GUI_DirectoryWidget* ui=nullptr;
115 
116 public:
117 
118  DirectoryLibraryContainer(QObject* parent=nullptr);
119 
120  QIcon get_icon() const override;
121  QString get_display_name() const override;
122  QString get_name() const override;
123  QWidget* get_ui() const override;
124  QComboBox* get_libchooser() override;
125  void init_ui() override;
126 
127 };
128 
129 
130 
131 #endif // GUI_DIRECTORYWIDGET_H
Definition: GUI_DirectoryWidget.h:107
Definition: DirectoryIconProvider.h:29
An interface used to abstract the usage of the info dialog. An implementing class has to return the i...
Definition: InfoDialogContainer.h:38
Definition: GUI_DirectoryWidget.h:42
MetaDataList get_data_for_info_dialog() const
get the metadata that should be used for the info dialog So for lists, the selected tracks are used h...
Definition: LocalLibrary.h:34
Definition: MetaDataList.h:44
MetaDataList::Interpretation get_metadata_interpretation() const
get the interpretation for the metadata. Maybe a list of metadata should be intrepeted as albums whil...
Widget with Settings connection. Also contains triggers for language_changed() and skin_changed() wi...
Definition: SayonaraWidget.h:41
Definition: ui_GUI_DirectoryWidget.h:146
An interface class needed when implementing a library plugin.
Definition: LibraryContainer.h:42
Context menu used for Library and playlist windows.
Definition: LibraryContextMenu.h:37
Definition: SearchableFileTreeView.h:32