LMMS
Loading...
Searching...
No Matches
Editor.h
Go to the documentation of this file.
1/*
2 * Editor.h - declaration of Editor class
3 *
4 * Copyright (c) 2014 Lukas W <lukaswhl/at/gmail.com>
5 *
6 * This file is part of LMMS - https://lmms.io
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public
19 * License along with this program (see COPYING); if not, write to the
20 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301 USA.
22 *
23 */
24
25#ifndef LMMS_GUI_EDITOR_H
26#define LMMS_GUI_EDITOR_H
27
28#include <QMainWindow>
29#include <QToolBar>
30
31class QAction;
32
33namespace lmms::gui
34{
35
36static const int Quantizations[] = {
37 1, 2, 4, 8, 16, 32, 64,
38 3, 6, 12, 24, 48, 96, 192
39};
40
41
42class DropToolBar;
43
48class Editor : public QMainWindow
49{
50 Q_OBJECT
51public:
52 void setPauseIcon(bool displayPauseIcon=true);
53 QAction *playAction() const;
55protected:
56 DropToolBar * addDropToolBarToTop(QString const & windowTitle);
57 DropToolBar * addDropToolBar(Qt::ToolBarArea whereToAdd, QString const & windowTitle);
58 DropToolBar * addDropToolBar(QWidget * parent, Qt::ToolBarArea whereToAdd, QString const & windowTitle);
59
60 void keyPressEvent(QKeyEvent* ke) override;
61
62public slots:
64 void togglePlayStop();
66 void togglePause();
67
68protected slots:
69 virtual void play() {}
70 virtual void record() {}
71 virtual void recordAccompany() {}
72 virtual void toggleStepRecording() {}
73 virtual void stop() {}
74
75private slots:
76 void toggleMaximize();
77private:
78 inline static Editor* s_lastPlayedEditor = nullptr;
79
80signals:
81
82protected:
87 Editor(bool record = false, bool record_step = false);
88 ~Editor() override = default;
89
90
92
93 QAction* m_playAction;
97 QAction* m_stopAction;
98};
99
100
102class DropToolBar : public QToolBar
103{
104 Q_OBJECT
105public:
106 DropToolBar(QWidget* parent=0);
107
108signals:
109 void dragEntered(QDragEnterEvent* event);
110 void dropped(QDropEvent* event);
111
112protected:
113 void dragEnterEvent(QDragEnterEvent* event) override;
114 void dropEvent(QDropEvent* event) override;
115};
116
117
118} // namespace lmms::gui
119
120#endif // LMMS_GUI_EDITOR_H
Small helper class: A QToolBar that accepts and exposes drop events as signals.
Definition Editor.h:103
void dropped(QDropEvent *event)
void dropEvent(QDropEvent *event) override
Definition Editor.cpp:169
void dragEnterEvent(QDragEnterEvent *event) override
Definition Editor.cpp:164
DropToolBar(QWidget *parent=0)
Definition Editor.cpp:159
void dragEntered(QDragEnterEvent *event)
static Editor * s_lastPlayedEditor
Definition Editor.h:78
virtual void recordAccompany()
Definition Editor.h:71
QAction * m_stopAction
Definition Editor.h:97
static Editor * lastPlayedEditor()
Definition Editor.h:54
DropToolBar * addDropToolBarToTop(QString const &windowTitle)
Definition Editor.cpp:49
QAction * m_toggleStepRecordingAction
Definition Editor.h:96
void setPauseIcon(bool displayPauseIcon=true)
Definition Editor.cpp:40
void toggleMaximize()
Definition Editor.cpp:86
QAction * playAction() const
Definition Editor.cpp:137
~Editor() override=default
DropToolBar * addDropToolBar(Qt::ToolBarArea whereToAdd, QString const &windowTitle)
Definition Editor.cpp:54
QAction * m_recordAction
Definition Editor.h:94
QAction * m_recordAccompanyAction
Definition Editor.h:95
DropToolBar * m_toolBar
Definition Editor.h:91
void togglePlayStop()
Called by pressing the space key. Plays or stops.
Definition Editor.cpp:71
virtual void record()
Definition Editor.h:70
Editor(bool record=false, bool record_step=false)
Constructor.
Definition Editor.cpp:91
virtual void play()
Definition Editor.h:69
void keyPressEvent(QKeyEvent *ke) override
Definition Editor.cpp:142
QAction * m_playAction
Definition Editor.h:93
virtual void stop()
Definition Editor.h:73
void togglePause()
Called by pressing shift+space. Toggles pause state.
Definition Editor.cpp:80
virtual void toggleStepRecording()
Definition Editor.h:72
static uintptr_t parent
Definition pugl.h:1644
Definition AudioPortAudio.cpp:223
static const int Quantizations[]
Definition Editor.h:36