Sayonara Player
TabBar.h
1 /* PlaylistTabBar.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 PLAYLISTTABBAR_H
22 #define PLAYLISTTABBAR_H
23 
24 #include "MenuEntry.h"
25 #include "GUI/Utils/Shortcuts/ShortcutWidget.h"
26 #include "Utils/Pimpl.h"
27 
28 #include <QTabBar>
29 
30 class MetaDataList;
31 
33  public QTabBar,
34  public ShortcutWidget
35 {
36  Q_OBJECT
37  PIMPL(PlaylistTabBar)
38 
39 signals:
40 
41  void sig_open_file(int tab_idx);
42  void sig_open_dir(int tab_idx);
43 
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_clear(int tab_idx);
50 
51  void sig_tab_delete(int tab_idx);
52  void sig_cur_idx_changed(int tab_idx);
53  void sig_add_tab_clicked();
54  void sig_metadata_dropped(int tab_idx, const MetaDataList& v_md);
55 
56 
57 public:
58  explicit PlaylistTabBar(QWidget *parent=nullptr);
59  virtual ~PlaylistTabBar();
60 
61  void show_menu_items(PlaylistMenuEntries entries);
62  void setTabsClosable(bool b);
63 
64  bool was_drag_from_playlist() const;
65  int get_drag_origin_tab() const;
66 
67  QString get_shortcut_text(const QString &shortcut_identifier) const override;
68 
69 
70 private:
71  void mousePressEvent(QMouseEvent* e) override;
72  void wheelEvent(QWheelEvent* e) override;
73  void dragEnterEvent(QDragEnterEvent* e) override;
74  void dragMoveEvent(QDragMoveEvent* e) override;
75  void dragLeaveEvent(QDragLeaveEvent* e) override;
76  void dropEvent(QDropEvent* e) override;
77 
78  void init_shortcuts();
79 
80 private slots:
81  void open_file_pressed();
82  void open_dir_pressed();
83  void reset_pressed();
84  void save_pressed();
85  void save_as_pressed();
86  void save_to_file_pressed();
87  void clear_pressed();
88  void delete_pressed();
89  void close_pressed();
90  void close_others_pressed();
91  void rename_pressed();
92 };
93 
94 #endif // PLAYLISTTABBAR_H
Definition: TabBar.h:32
The MetaDataList class.
Definition: MetaDataList.h:38
Interface that should be implemented when using configurable shortcuts.
Definition: ShortcutWidget.h:30