Editors: Some cleanups

This commit is contained in:
Lukas W
2014-12-11 11:24:26 +01:00
parent 9b6612c396
commit 02869b13dd
6 changed files with 105 additions and 124 deletions

View File

@@ -276,19 +276,11 @@ protected slots:
void stop();
private:
QAction* m_drawAction;
QAction* m_eraseAction;
QAction* m_selectAction;
QAction* m_moveAction;
QAction* m_discreteAction;
QAction* m_linearAction;
QAction* m_cubicHermiteAction;
Knob * m_tensionKnob;
QAction * m_cutAction;
QAction * m_copyAction;
QAction * m_pasteAction;
Knob * m_tensionKnob;
ComboBox * m_zoomingXComboBox;
ComboBox * m_zoomingYComboBox;

View File

@@ -384,15 +384,6 @@ signals:
private:
PianoRoll* m_editor;
QAction* m_drawAction;
QAction* m_eraseAction;
QAction* m_selectAction;
QAction* m_detuneAction;
QAction* m_cutAction;
QAction* m_copyAction;
QAction* m_pasteAction;
ComboBox * m_zoomingComboBox;
ComboBox * m_quantizeComboBox;
ComboBox * m_noteLenComboBox;

View File

@@ -2005,25 +2005,25 @@ AutomationEditorWindow::AutomationEditorWindow() :
"current pattern." ) );
// Edit mode buttons
m_drawAction = addEditMode(embed::getIconPixmap("edit_draw"), tr("Draw mode (Shift+D)"));
m_drawAction->setShortcut(Qt::SHIFT | Qt::Key_D);
QAction* drawAction = addEditMode(embed::getIconPixmap("edit_draw"), tr("Draw mode (Shift+D)"));
drawAction->setShortcut(Qt::SHIFT | Qt::Key_D);
m_eraseAction = addEditMode(embed::getIconPixmap("edit_erase"), tr("Erase mode (Shift+E)"));
m_eraseAction->setShortcut(Qt::SHIFT | Qt::Key_E);
QAction* eraseAction = addEditMode(embed::getIconPixmap("edit_erase"), tr("Erase mode (Shift+E)"));
eraseAction->setShortcut(Qt::SHIFT | Qt::Key_E);
m_drawAction->setChecked(true);
drawAction->setChecked(true);
// TODO: m_selectButton and m_moveButton are broken.
// m_selectButton = addEditMode(embed::getIconPixmap("edit_select"), tr("Select mode (Shift+S)"));
// m_moveButton = addEditMode(embed::getIconPixmap("edit_move"), tr("Move selection mode (Shift+M)"));
m_drawAction->setWhatsThis(
drawAction->setWhatsThis(
tr( "Click here and draw-mode will be activated. In this "
"mode you can add and move single values. This "
"is the default mode which is used most of the time. "
"You can also press 'Shift+D' on your keyboard to "
"activate this mode." ) );
m_eraseAction->setWhatsThis(
eraseAction->setWhatsThis(
tr( "Click here and erase-mode will be activated. In this "
"mode you can erase single values. You can also press "
"'Shift+E' on your keyboard to activate this mode." ) );
@@ -2083,32 +2083,32 @@ AutomationEditorWindow::AutomationEditorWindow() :
// Copy paste buttons
m_cutAction = new QAction(embed::getIconPixmap("edit_cut"),
QAction* cutAction = new QAction(embed::getIconPixmap("edit_cut"),
tr("Cut selected values (Ctrl+X)"), this);
m_copyAction = new QAction(embed::getIconPixmap("edit_copy"),
QAction* copyAction = new QAction(embed::getIconPixmap("edit_copy"),
tr("Copy selected values (Ctrl+C)"), this);
m_pasteAction = new QAction(embed::getIconPixmap("edit_paste"),
QAction* pasteAction = new QAction(embed::getIconPixmap("edit_paste"),
tr("Paste values from clipboard Ctrl+V)"), this);
m_cutAction->setWhatsThis(
cutAction->setWhatsThis(
tr( "Click here and selected values will be cut into the "
"clipboard. You can paste them anywhere in any pattern "
"by clicking on the paste button." ) );
m_copyAction->setWhatsThis(
copyAction->setWhatsThis(
tr( "Click here and selected values will be copied into "
"the clipboard. You can paste them anywhere in any "
"pattern by clicking on the paste button." ) );
m_pasteAction->setWhatsThis(
pasteAction->setWhatsThis(
tr( "Click here and the values from the clipboard will be "
"pasted at the first visible measure." ) );
m_cutAction->setShortcut(Qt::CTRL | Qt::Key_X);
m_copyAction->setShortcut(Qt::CTRL | Qt::Key_C);
m_pasteAction->setShortcut(Qt::CTRL | Qt::Key_V);
cutAction->setShortcut(Qt::CTRL | Qt::Key_X);
copyAction->setShortcut(Qt::CTRL | Qt::Key_C);
pasteAction->setShortcut(Qt::CTRL | Qt::Key_V);
connect(m_cutAction, SIGNAL(triggered()), m_editor, SLOT(cutSelectedValues()));
connect(m_copyAction, SIGNAL(triggered()), m_editor, SLOT(copySelectedValues()));
connect(m_pasteAction, SIGNAL(triggered()), m_editor, SLOT(pasteValues()));
connect(cutAction, SIGNAL(triggered()), m_editor, SLOT(cutSelectedValues()));
connect(copyAction, SIGNAL(triggered()), m_editor, SLOT(copySelectedValues()));
connect(pasteAction, SIGNAL(triggered()), m_editor, SLOT(pasteValues()));
// Zoom controls
@@ -2162,8 +2162,8 @@ AutomationEditorWindow::AutomationEditorWindow() :
m_toolBar->addSeparator();;
m_toolBar->addAction(m_drawAction);
m_toolBar->addAction(m_eraseAction);
m_toolBar->addAction(drawAction);
m_toolBar->addAction(eraseAction);
// m_toolBar->addAction(m_selectButton);
// m_toolBar->addAction(m_moveButton);
m_toolBar->addSeparator();
@@ -2175,9 +2175,9 @@ AutomationEditorWindow::AutomationEditorWindow() :
m_toolBar->addWidget( m_tensionKnob );
m_toolBar->addSeparator();
// Select is broken
// m_toolBar->addAction( m_cutAction );
// m_toolBar->addAction( m_copyAction );
// m_toolBar->addAction( m_pasteAction );
// m_toolBar->addAction( cutAction );
// m_toolBar->addAction( copyAction );
// m_toolBar->addAction( pasteAction );
m_toolBar->addSeparator();
m_editor->m_timeLine->addToolButtons(m_toolBar);
m_toolBar->addSeparator();

View File

@@ -98,40 +98,40 @@ Editor::Editor(bool record) :
m_toolBar->setContextMenuPolicy(Qt::PreventContextMenu);
m_toolBar->setMovable(false);
auto addButton = [this](const char* pixmap_name, QString text, QString objectName) {
QAction* action = m_toolBar->addAction(embed::getIconPixmap(pixmap_name), text);
auto addButton = [this](QAction* action, QString objectName) {
m_toolBar->addAction(action);
m_toolBar->widgetForAction(action)->setObjectName(objectName);
return action;
};
// Set up play button
m_playAction = addButton("play", tr("Play (Space)"), "playButton");
// Set up play and record actions
m_playAction = new QAction(embed::getIconPixmap("play"), tr("Play (Space)"), this);
m_stopAction = new QAction(embed::getIconPixmap("stop"), tr("Stop (Space)"), this);
m_recordAction = new QAction(embed::getIconPixmap("record"), tr("Record"), this);
m_recordAccompanyAction = new QAction(embed::getIconPixmap("record_accompany"), tr("Record while playing"), this);
m_playAction->setShortcut(Qt::Key_Space);
// Set up record buttons if wanted
if (record)
{
m_recordAction = addButton("record", tr("Record"), "recordButton");
m_recordAccompanyAction = addButton("record_accompany", tr("Record while playing"), "recordAccompanyButton");
}
// Set up stop button
m_stopAction = addButton("stop", tr("Stop (Space)"), "stopButton");
// Add toolbar to window
addToolBar(Qt::TopToolBarArea, m_toolBar);
// Set up connections
connect(m_playAction, SIGNAL(triggered()), this, SLOT(play()));
if (record)
{
connect(m_recordAction, SIGNAL(triggered()), this, SLOT(record()));
connect(m_recordAccompanyAction, SIGNAL(triggered()), this, SLOT(recordAccompany()));
}
connect(m_recordAction, SIGNAL(triggered()), this, SLOT(record()));
connect(m_recordAccompanyAction, SIGNAL(triggered()), this, SLOT(recordAccompany()));
connect(m_stopAction, SIGNAL(triggered()), this, SLOT(stop()));
// Connect edit mode
connect(m_editModeGroup, SIGNAL(triggered(QAction*)), this, SLOT(setEditModeByAction(QAction*)));
// Add toolbar to window
addToolBar(Qt::TopToolBarArea, m_toolBar);
// Add actions to toolbar
addButton(m_playAction, "playButton");
if (record)
{
addButton(m_recordAction, "recordButton");
addButton(m_recordAccompanyAction, "recordAccompanyButton");
}
addButton(m_stopAction, "stopButton");
}
Editor::~Editor()

View File

@@ -197,32 +197,33 @@ PianoRoll::PianoRoll() :
signalMapper = new QSignalMapper( this );
m_semiToneMarkerMenu = new QMenu( this );
QAction * act = new QAction( tr("Mark/unmark current semitone"), this );
connect( act, SIGNAL(triggered()), signalMapper, SLOT(map()) );
signalMapper->setMapping( act, static_cast<int>( stmaMarkCurrentSemiTone ) );
m_semiToneMarkerMenu->addAction( act );
QAction * markSemitoneAction = new QAction( tr("Mark/unmark current semitone"), this );
QAction* markScaleAction = new QAction( tr("Mark current scale"), this );
QAction* markChordAction = new QAction( tr("Mark current chord"), this );
QAction* unmarkAllAction = new QAction( tr("Unmark all"), this );
act = new QAction( tr("Mark current scale"), this );
act->setEnabled( false );
connect( act, SIGNAL(triggered()), signalMapper, SLOT(map()) );
connect( this, SIGNAL(semiToneMarkerMenuScaleSetEnabled(bool)), act, SLOT(setEnabled(bool)) );
signalMapper->setMapping( act, static_cast<int>( stmaMarkCurrentScale ) );
m_semiToneMarkerMenu->addAction( act );
connect( markSemitoneAction, SIGNAL(triggered()), signalMapper, SLOT(map()) );
connect( markScaleAction, SIGNAL(triggered()), signalMapper, SLOT(map()) );
connect( markChordAction, SIGNAL(triggered()), signalMapper, SLOT(map()) );
connect( unmarkAllAction, SIGNAL(triggered()), signalMapper, SLOT(map()) );
act = new QAction( tr("Mark current chord"), this );
act->setEnabled( false );
connect( act, SIGNAL(triggered()), signalMapper, SLOT(map()) );
connect( this, SIGNAL(semiToneMarkerMenuChordSetEnabled(bool)), act, SLOT(setEnabled(bool)) );
signalMapper->setMapping( act, static_cast<int>( stmaMarkCurrentChord ) );
m_semiToneMarkerMenu->addAction( act );
signalMapper->setMapping( markSemitoneAction, static_cast<int>( stmaMarkCurrentSemiTone ) );
signalMapper->setMapping( markScaleAction, static_cast<int>( stmaMarkCurrentScale ) );
signalMapper->setMapping( markChordAction, static_cast<int>( stmaMarkCurrentChord ) );
signalMapper->setMapping( unmarkAllAction, static_cast<int>( stmaUnmarkAll ) );
act = new QAction( tr("Unmark all"), this );
connect( act, SIGNAL(triggered()), signalMapper, SLOT(map()) );
signalMapper->setMapping( act, static_cast<int>( stmaUnmarkAll ) );
m_semiToneMarkerMenu->addAction( act );
markScaleAction->setEnabled( false );
markChordAction->setEnabled( false );
connect( signalMapper, SIGNAL(mapped(int)),
this, SLOT(markSemiTone(int)) );
connect( this, SIGNAL(semiToneMarkerMenuScaleSetEnabled(bool)), markScaleAction, SLOT(setEnabled(bool)) );
connect( this, SIGNAL(semiToneMarkerMenuChordSetEnabled(bool)), markChordAction, SLOT(setEnabled(bool)) );
connect( signalMapper, SIGNAL(mapped(int)), this, SLOT(markSemiTone(int)) );
m_semiToneMarkerMenu->addAction( markSemitoneAction );
m_semiToneMarkerMenu->addAction( markScaleAction );
m_semiToneMarkerMenu->addAction( markChordAction );
m_semiToneMarkerMenu->addAction( unmarkAllAction );
// init pixmaps
if( s_whiteKeySmallPm == NULL )
@@ -3938,36 +3939,36 @@ PianoRollWindow::PianoRollWindow() :
tr( "Click here to stop playback of current pattern." ) );
// init edit-buttons at the top
m_drawAction = addEditMode(embed::getIconPixmap("edit_draw"), tr("Draw mode (Shift+D)"));
m_drawAction->setShortcut(Qt::SHIFT | Qt::Key_D);
m_drawAction->setChecked( true );
QAction* drawAction = addEditMode(embed::getIconPixmap("edit_draw"), tr("Draw mode (Shift+D)"));
drawAction->setShortcut(Qt::SHIFT | Qt::Key_D);
drawAction->setChecked( true );
m_eraseAction = addEditMode(embed::getIconPixmap("edit_erase"), tr("Erase mode (Shift+E)"));
m_eraseAction->setShortcut(Qt::SHIFT | Qt::Key_E);
QAction* eraseAction = addEditMode(embed::getIconPixmap("edit_erase"), tr("Erase mode (Shift+E)"));
eraseAction->setShortcut(Qt::SHIFT | Qt::Key_E);
m_selectAction = addEditMode(embed::getIconPixmap("edit_select"), tr("Select mode (Shift+S)"));
m_selectAction->setShortcut(Qt::SHIFT | Qt::Key_S);
QAction* selectAction = addEditMode(embed::getIconPixmap("edit_select"), tr("Select mode (Shift+S)"));
selectAction->setShortcut(Qt::SHIFT | Qt::Key_S);
m_detuneAction = addEditMode(embed::getIconPixmap("automation"), tr("Detune mode (Shift+T)"));
m_detuneAction->setShortcut(Qt::SHIFT | Qt::Key_T);
QAction* detuneAction = addEditMode(embed::getIconPixmap("automation"), tr("Detune mode (Shift+T)"));
detuneAction->setShortcut(Qt::SHIFT | Qt::Key_T);
m_drawAction->setWhatsThis(
drawAction->setWhatsThis(
tr( "Click here and draw mode will be activated. In this "
"mode you can add, resize and move notes. This "
"is the default mode which is used most of the time. "
"You can also press 'Shift+D' on your keyboard to "
"activate this mode. In this mode, hold Ctrl to "
"temporarily go into select mode." ) );
m_eraseAction->setWhatsThis(
eraseAction->setWhatsThis(
tr( "Click here and erase mode will be activated. In this "
"mode you can erase notes. You can also press "
"'Shift+E' on your keyboard to activate this mode." ) );
m_selectAction->setWhatsThis(
selectAction->setWhatsThis(
tr( "Click here and select mode will be activated. "
"In this mode you can select notes. Alternatively, "
"you can hold Ctrl in draw mode to temporarily use "
"select mode." ) );
m_detuneAction->setWhatsThis(
detuneAction->setWhatsThis(
tr( "Click here and detune mode will be activated. "
"In this mode you can click a note to open its "
"automation detuning. You can utilize this to slide "
@@ -3977,34 +3978,34 @@ PianoRollWindow::PianoRollWindow() :
connect(this, SIGNAL(editModeChanged(int)), m_editor, SLOT(setEditMode(int)));
// Copy + paste actions
m_cutAction = new QAction(embed::getIconPixmap("edit_cut"),
QAction* cutAction = new QAction(embed::getIconPixmap("edit_cut"),
tr("Cut selected notes (Ctrl+X)"), this);
m_copyAction = new QAction(embed::getIconPixmap("edit_copy"),
QAction* copyAction = new QAction(embed::getIconPixmap("edit_copy"),
tr("Copy selected notes (Ctrl+C)"), this);
m_pasteAction = new QAction(embed::getIconPixmap("edit_paste"),
QAction* pasteAction = new QAction(embed::getIconPixmap("edit_paste"),
tr("Paste notes from clipboard (Ctrl+V)"), this);
m_cutAction->setWhatsThis(
cutAction->setWhatsThis(
tr( "Click here and the selected notes will be cut into the "
"clipboard. You can paste them anywhere in any pattern "
"by clicking on the paste button." ) );
m_copyAction->setWhatsThis(
copyAction->setWhatsThis(
tr( "Click here and the selected notes will be copied into the "
"clipboard. You can paste them anywhere in any pattern "
"by clicking on the paste button." ) );
m_pasteAction->setWhatsThis(
pasteAction->setWhatsThis(
tr( "Click here and the notes from the clipboard will be "
"pasted at the first visible measure." ) );
m_cutAction->setShortcut(Qt::CTRL | Qt::Key_X);
m_copyAction->setShortcut(Qt::CTRL | Qt::Key_C);
m_pasteAction->setShortcut(Qt::CTRL | Qt::Key_V);
cutAction->setShortcut(Qt::CTRL | Qt::Key_X);
copyAction->setShortcut(Qt::CTRL | Qt::Key_C);
pasteAction->setShortcut(Qt::CTRL | Qt::Key_V);
connect(m_cutAction, SIGNAL(triggered()), m_editor, SLOT(cutSelectedNotes()));
connect(m_copyAction, SIGNAL(triggered()), m_editor, SLOT(copySelectedNotes()));
connect(m_pasteAction, SIGNAL(triggered()), m_editor, SLOT(pasteNotes()));
connect(cutAction, SIGNAL(triggered()), m_editor, SLOT(cutSelectedNotes()));
connect(copyAction, SIGNAL(triggered()), m_editor, SLOT(copySelectedNotes()));
connect(pasteAction, SIGNAL(triggered()), m_editor, SLOT(pasteNotes()));
QLabel * zoom_lbl = new QLabel( m_toolBar );
zoom_lbl->setPixmap( embed::getIconPixmap( "zoom" ) );
@@ -4049,15 +4050,15 @@ PianoRollWindow::PianoRollWindow() :
m_toolBar->addSeparator();
m_toolBar->addAction( m_drawAction );
m_toolBar->addAction( m_eraseAction );
m_toolBar->addAction( m_selectAction );
m_toolBar->addAction( m_detuneAction );
m_toolBar->addAction( drawAction );
m_toolBar->addAction( eraseAction );
m_toolBar->addAction( selectAction );
m_toolBar->addAction( detuneAction );
m_toolBar->addSeparator();
m_toolBar->addAction( m_cutAction );
m_toolBar->addAction( m_copyAction );
m_toolBar->addAction( m_pasteAction );
m_toolBar->addAction( cutAction );
m_toolBar->addAction( copyAction );
m_toolBar->addAction( pasteAction );
m_toolBar->addSeparator();
m_editor->m_timeLine->addToolButtons(m_toolBar);

View File

@@ -611,11 +611,8 @@ SongEditorWindow::SongEditorWindow(Song* song) :
// Set up buttons
m_playAction->setToolTip(tr("Play song (Space)"));
if (m_recordAction && m_recordAccompanyAction)
{
m_recordAction->setToolTip(tr("Record samples from Audio-device"));
m_recordAccompanyAction->setToolTip(tr( "Record samples from Audio-device while playing song or BB track"));
}
m_recordAction->setToolTip(tr("Record samples from Audio-device"));
m_recordAccompanyAction->setToolTip(tr( "Record samples from Audio-device while playing song or BB track"));
m_stopAction->setToolTip(tr( "Stop song (Space)" ));
m_addBBTrackAction = new QAction(embed::getIconPixmap("add_bb_track"),