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