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