Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
44b52eb
Add Editor superclass
lukas-w Dec 7, 2014
c6ee614
Clean up ToolButton class
lukas-w Dec 7, 2014
02006f9
Use Editor superclass in AutomationEditor
lukas-w Dec 7, 2014
3e9cc61
SongEditor: Use Editor superclass
lukas-w Dec 7, 2014
86f2c86
Move play, record and stop signals to superclass
lukas-w Dec 7, 2014
d8db894
Editor: Don't delete on close
lukas-w Dec 8, 2014
ec9158c
PianoRoll: Use Editor superclass
lukas-w Dec 8, 2014
e9d841d
Migrate Timeline::addToolButtons to QToolBar
lukas-w Dec 8, 2014
4b27569
ToolBar css fixes
lukas-w Dec 8, 2014
d029c85
BBEditor: Use Editor superclass
lukas-w Dec 8, 2014
11898a5
Move Timeline.cpp to gui directory
lukas-w Dec 8, 2014
7a21d69
SongEditor: Some renames
lukas-w Dec 8, 2014
f131fbd
Editors: Add to workspace in MainWindow class, not in themselves
lukas-w Dec 8, 2014
32da8cb
Editor: Don't use ToolButton
lukas-w Dec 8, 2014
968e581
Editors: Don't use ToolButton
lukas-w Dec 8, 2014
b661e08
PianoRoll: Slot renames
lukas-w Dec 8, 2014
47cbc9e
AutomationEditor + PianoRoll: Move Copy/Paste shortcuts
lukas-w Dec 8, 2014
409e8f2
AutomationEditor style updates
lukas-w Dec 8, 2014
51f5929
Rename Timeline to TimeLineWidget
lukas-w Dec 8, 2014
b25765d
Move Editors to src/gui/editors subdirectory
lukas-w Dec 8, 2014
7c508f7
Merge master into ed_refac
lukas-w Dec 8, 2014
1d07a91
PianoRoll: Coding style updates
lukas-w Dec 11, 2014
ebbec2f
Editor: Add edit mode support
lukas-w Dec 11, 2014
9b6612c
PianoRoll rename fix
lukas-w Dec 11, 2014
02869b1
Editors: Some cleanups
lukas-w Dec 11, 2014
7877888
Introduce ActionGroup subclass
lukas-w Dec 11, 2014
11cb8b5
Automation Editor tension fix
lukas-w Dec 12, 2014
657fb06
More Automation refactoring
lukas-w Dec 17, 2014
eb79701
Merge branch 'master' into ed_refac
lukas-w Dec 17, 2014
1ee9340
Move Engine' GUI code to new GuiApplication class
lukas-w Dec 17, 2014
0df3998
Move some gui initialization to GuiApplication's constructor
lukas-w Jan 6, 2015
834be94
Merge commit 'f7741f184f83e6b9e2f081d39efffb2c499962f6' into ed_refac
lukas-w Jan 6, 2015
1706279
Merge commit '25ab7260f5cc57075360c976826e13434ade058c' into ed_refac
lukas-w Jan 6, 2015
0680669
Merge commit 'b5538c7da818cbcdde5ff1c885ce4eee5b626f3b' into ed_refac
lukas-w Jan 6, 2015
23e0e0f
Merge branch 'master' into ed_refac
lukas-w Jan 6, 2015
0c4833c
Adjust automation editor flip implementation
lukas-w Jan 6, 2015
748cccd
Merge branch 'gui_application' into ed_refac
lukas-w Jan 6, 2015
e0dbfa6
Remove Engine's has_gui option
lukas-w Jan 6, 2015
7f2f9f2
Merge branch 'master' into ed_refac
lukas-w Jan 8, 2015
23dbe95
Stop on second space key press
lukas-w Jan 11, 2015
56055b3
Merge branch 'master' into ed_refac
lukas-w Jan 11, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Move play, record and stop signals to superclass
  • Loading branch information
lukas-w committed Dec 7, 2014
commit 86f2c866b6749e5e7eb5c9e8ea110e1c624a77aa
6 changes: 6 additions & 0 deletions include/Editor.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ class Editor : public QMainWindow
public:
void setPauseIcon(bool displayPauseIcon=true);

protected slots:
virtual void play();
virtual void record();
virtual void recordAccompany();
virtual void stop();

signals:

protected:
Expand Down
22 changes: 7 additions & 15 deletions include/SongEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,7 @@ class SongEditor : public TrackContainerView
};

SongEditor( Song * _song );
virtual ~SongEditor();

void setPauseIcon( bool pause );

~SongEditor();

public slots:
void scrolled( int _new_pos );
Expand All @@ -81,11 +78,6 @@ public slots:
private slots:
void setHighQuality( bool );

void play();
void record();
void recordAccompany();
void stop();

void masterVolumeChanged( int _new_val );
void masterVolumePressed();
void masterVolumeMoved( int _new_val );
Expand Down Expand Up @@ -114,12 +106,6 @@ private slots:

QScrollBar * m_leftRightScroll;

QWidget * m_toolBar;

ToolButton * m_playButton;
ToolButton * m_recordButton;
ToolButton * m_recordAccompanyButton;
ToolButton * m_stopButton;
LcdSpinBox * m_tempoSpinBox;

Timeline * m_timeLine;
Expand Down Expand Up @@ -152,6 +138,12 @@ class SongEditorWindow : public Editor

SongEditor* m_editor;

protected slots:
void play();
void record();
void recordAccompany();
void stop();

private:
ToolButton * m_addBBTrackButton;
ToolButton * m_addSampleTrackButton;
Expand Down
5 changes: 0 additions & 5 deletions src/gui/AutomationEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2040,11 +2040,6 @@ AutomationEditorWindow::AutomationEditorWindow() :
tr( "Click here if you want to stop playing of the "
"current pattern." ) );

// Set up signals)
connect(m_playButton, SIGNAL(clicked()), this, SLOT(play()));
connect(m_stopButton, SIGNAL(clicked()), this, SLOT(stop()));


// Edit mode buttons

m_drawButton = new ToolButton(embed::getIconPixmap( "edit_draw" ),
Expand Down
30 changes: 29 additions & 1 deletion src/gui/Editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,31 @@ void Editor::setPauseIcon(bool displayPauseIcon)
m_playButton->setIcon(embed::getIconPixmap("play"));
}

void Editor::play()
{
}

void Editor::record()
{
}

void Editor::recordAccompany()
{
}

void Editor::stop()
{
}

Editor::Editor(bool record) :
m_toolBar(new QToolBar(this)),
m_playButton(nullptr),
m_recordButton(nullptr),
m_recordAccompanyButton(nullptr),
m_stopButton(nullptr)
{
m_toolBar->setContextMenuPolicy(Qt::PreventContextMenu);

auto addButton = [this](const char* pixmap_name, QString text, QString objectName) {
ToolButton* button = new ToolButton(embed::getIconPixmap(pixmap_name), text);
button->setObjectName(objectName);
Expand All @@ -55,11 +73,12 @@ Editor::Editor(bool record) :

// Set up play button
m_playButton = addButton("play", tr("Play (Space)"), "playButton");
m_playButton->setShortcut(Qt::Key_Space);

// Set up record buttons if wanted
if (record)
{
m_recordButton= addButton("record", tr("Record"), "recordButton");
m_recordButton = addButton("record", tr("Record"), "recordButton");
m_recordAccompanyButton = addButton("record_accompany", tr("Record while playing"), "recordAccompanyButton");
}

Expand All @@ -68,6 +87,15 @@ Editor::Editor(bool record) :

// Add toolbar to window
addToolBar(Qt::TopToolBarArea, m_toolBar);

// Set up connections
connect(m_playButton, SIGNAL(clicked()), this, SLOT(play()));
if (record)
{
connect(m_recordButton, SIGNAL(clicked()), this, SLOT(record()));
connect(m_recordAccompanyButton, SIGNAL(clicked()), this, SLOT(recordAccompany()));
}
connect(m_stopButton, SIGNAL(clicked()), this, SLOT(stop()));
}

Editor::~Editor()
Expand Down
105 changes: 32 additions & 73 deletions src/gui/SongEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,61 +299,6 @@ void SongEditor::setModeEdit()



void SongEditor::setPauseIcon( bool pause )
{
if( pause == true )
{
m_playButton->setIcon( embed::getIconPixmap( "pause" ) );
}
else
{
m_playButton->setIcon( embed::getIconPixmap( "play" ) );
}
}




void SongEditor::play()
{
if( Engine::getSong()->playMode() != Song::Mode_PlaySong )
{
Engine::getSong()->playSong();
}
else
{
Engine::getSong()->togglePause();
}
}




void SongEditor::record()
{
m_song->record();
}




void SongEditor::recordAccompany()
{
m_song->playAndRecord();
}




void SongEditor::stop()
{
m_song->stop();
Engine::pianoRoll()->stopRecording();
}




void SongEditor::keyPressEvent( QKeyEvent * _ke )
{
if( /*_ke->modifiers() & Qt::ShiftModifier*/
Expand Down Expand Up @@ -384,17 +329,6 @@ void SongEditor::keyPressEvent( QKeyEvent * _ke )
m_song->setPlayPos( t, Song::Mode_PlaySong );
}
}
else if( _ke->key() == Qt::Key_Space )
{
if( m_song->isPlaying() )
{
stop();
}
else
{
play();
}
}
else if( _ke->key() == Qt::Key_Home )
{
m_song->setPlayPos( 0, Song::Mode_PlaySong );
Expand Down Expand Up @@ -679,19 +613,12 @@ SongEditorWindow::SongEditorWindow(Song* song) :

// Set up buttons
m_playButton->setToolTip(tr("Play song (Space)"));
connect(m_playButton, SIGNAL(clicked()), m_editor, SLOT(play()));

if (m_recordButton && m_recordAccompanyButton)
{
m_recordButton->setToolTip(tr("Record samples from Audio-device"));
connect(m_recordButton, SIGNAL(clicked()), m_editor, SLOT(record()));

m_recordAccompanyButton->setToolTip(tr( "Record samples from Audio-device while playing song or BB track"));
connect(m_recordAccompanyButton, SIGNAL(clicked()), m_editor, SLOT(recordAccompany()));
}

m_stopButton->setToolTip(tr( "Stop song (Space)" ));
connect(m_stopButton, SIGNAL(clicked()), m_editor, SLOT(stop()));

m_addBBTrackButton = new ToolButton(
embed::getIconPixmap("add_bb_track"),
Expand Down Expand Up @@ -767,3 +694,35 @@ SongEditorWindow::SongEditorWindow(Song* song) :
parentWidget()->move( 5, 5 );
parentWidget()->show();
}


void SongEditorWindow::play()
{
if( Engine::getSong()->playMode() != Song::Mode_PlaySong )
{
Engine::getSong()->playSong();
}
else
{
Engine::getSong()->togglePause();
}
}


void SongEditorWindow::record()
{
m_editor->m_song->record();
}


void SongEditorWindow::recordAccompany()
{
m_editor->m_song->playAndRecord();
}


void SongEditorWindow::stop()
{
m_editor->m_song->stop();
Engine::pianoRoll()->stopRecording();
}