Sayonara Player
PlaylistTabWidget.h
1 /* PlaylistTabWidget.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 PLAYLISTTABWIDGET_H
22 #define PLAYLISTTABWIDGET_H
23 
24 #include "PlaylistMenuEntry.h"
25 #include "Utils/Pimpl.h"
26 
27 #include <QTabWidget>
28 
29 namespace Playlist
30 {
35  class TabWidget :
36  public QTabWidget
37  {
38  Q_OBJECT
39  PIMPL(TabWidget)
40 
41  signals:
42  void sig_open_file(int tab_idx);
43  void sig_open_dir(int tab_idx);
44  void sig_tab_reset(int tab_idx);
45  void sig_tab_save(int tab_idx);
46  void sig_tab_save_as(int tab_idx, const QString& name);
47  void sig_tab_save_to_file(int tab_idx, const QString& filename);
48  void sig_tab_rename(int tab_idx, const QString& name);
49  void sig_tab_delete(int tab_idx);
50  void sig_tab_clear(int tab_idx);
51  void sig_add_tab_clicked();
52  void sig_metadata_dropped(int tab_idx, const MetaDataList& v_md);
53  void sig_files_dropped(int tab_idx, const QStringList& files);
54 
55  public:
56  explicit TabWidget(QWidget* parent=nullptr);
57  ~TabWidget() override;
58 
59  void show_menu_items(MenuEntries actions);
60 
61  void removeTab(int index);
62  void addTab(QWidget* widget, const QIcon& icon, const QString& label);
63  void addTab(QWidget* widget, const QString& label);
64  void insertTab(int index, QWidget* widget, const QString& label);
65  void insertTab(int index, QWidget* widget, const QIcon& icon, const QString& label);
66 
67  bool was_drag_from_playlist() const;
68  int get_drag_origin_tab() const;
69 
70  private:
71  void check_last_tab();
72  };
73 }
74 
75 #endif // PLAYLISTTABWIDGET_H
Playlist::TabWidget
The PlaylistTabWidget class.
Definition: PlaylistTabWidget.h:35
MetaDataList
The MetaDataList class.
Definition: MetaDataList.h:37
Gui::Util::icon
QIcon icon(const QString &icon_name, IconTheme theme_name)
fetch a icon from resources