Sayonara Player
PlaylistTabBar.h
1 /* PlaylistTabBar.h */
2 
3 /* Copyright (C) 2011-2020 Michael Lugmair (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 "PlaylistMenuEntry.h"
25 #include "Utils/Pimpl.h"
26 
27 #include <QTabBar>
28 
29 namespace Playlist
30 {
35  class TabBar :
36  public QTabBar
37  {
38  Q_OBJECT
39  PIMPL(TabBar)
40 
41  signals:
42  void sigOpenFile(int tab_idx);
43  void sigOpenDir(int tab_idx);
44 
45  void sigTabReset(int tab_idx);
46  void sigTabSave(int tab_idx);
47  void sigTabSaveAs(int tab_idx, const QString& name);
48  void sigTabSaveToFile(int tab_idx, const QString& filename);
49  void sigTabRename(int tab_idx, const QString& name);
50  void sigTabClear(int tab_idx);
51 
52  void sigTabDelete(int tab_idx);
53  void sigCurrentIndexChanged(int tab_idx);
54  void sigAddTabClicked();
55  void sigMetadataDropped(int tab_idx, const MetaDataList& v_md);
56  void sigFilesDropped(int tab_idx, const QStringList& files);
57 
58 
59  public:
60  explicit TabBar(QWidget* parent=nullptr);
61  ~TabBar() override;
62 
63  void showMenuItems(MenuEntries entries);
64  void setTabsClosable(bool b);
65 
66  bool wasDragFromPlaylist() const;
67  int getDragOriginTab() const;
68 
69  private:
70  void initShortcuts();
71 
72  private slots:
73  void openFilePressed();
74  void openDirPressed();
75  void resetPressed();
76  void savePressed();
77  void saveAsPressed();
78  void saveToFilePressed();
79  void clearPressed();
80  void deletePressed();
81  void closePressed();
82  void closeOthersPressed();
83  void renamePressed();
84 
85  protected:
86  void mousePressEvent(QMouseEvent* e) override;
87  void wheelEvent(QWheelEvent* e) override;
88  void dragEnterEvent(QDragEnterEvent* e) override;
89  void dragMoveEvent(QDragMoveEvent* e) override;
90  void dragLeaveEvent(QDragLeaveEvent* e) override;
91  void dropEvent(QDropEvent* e) override;
92  };
93 }
94 
95 #endif // PLAYLISTTABBAR_H
MetaDataList
The MetaDataList class.
Definition: MetaDataList.h:37
Playlist::TabBar
The PlaylistTabBar class.
Definition: PlaylistTabBar.h:37