diff --git a/include/AutomationEditor.h b/include/AutomationEditor.h index d203ac25e..97ea48572 100644 --- a/include/AutomationEditor.h +++ b/include/AutomationEditor.h @@ -45,7 +45,6 @@ class QScrollBar; class ComboBox; class NotePlayHandle; class Timeline; -class ToolButton; @@ -277,19 +276,19 @@ protected slots: void stop(); private: - QAbstractButton * m_drawButton; - QAbstractButton * m_eraseButton; - QAbstractButton * m_selectButton; - QAbstractButton * m_moveButton; + QAction* m_drawAction; + QAction* m_eraseAction; + QAction* m_selectAction; + QAction* m_moveAction; - ToolButton * m_discreteButton; - ToolButton * m_linearButton; - ToolButton * m_cubicHermiteButton; + QAction* m_discreteAction; + QAction* m_linearAction; + QAction* m_cubicHermiteAction; Knob * m_tensionKnob; - ToolButton * m_cutButton; - ToolButton * m_copyButton; - ToolButton * m_pasteButton; + QAction * m_cutAction; + QAction * m_copyAction; + QAction * m_pasteAction; ComboBox * m_zoomingXComboBox; ComboBox * m_zoomingYComboBox; diff --git a/include/BBEditor.h b/include/BBEditor.h index d13d1cc45..3f9122445 100644 --- a/include/BBEditor.h +++ b/include/BBEditor.h @@ -32,7 +32,6 @@ class BBTrackContainer; class ComboBox; -class ToolButton; class BBTrackContainerView; diff --git a/include/PianoRoll.h b/include/PianoRoll.h index 0d87c752a..0adc98e86 100644 --- a/include/PianoRoll.h +++ b/include/PianoRoll.h @@ -49,7 +49,6 @@ class ComboBox; class NotePlayHandle; class Pattern; class Timeline; -class ToolButton; class PianoRoll : public QWidget { @@ -387,14 +386,14 @@ signals: private: PianoRoll* m_editor; - ToolButton * m_drawButton; - ToolButton * m_eraseButton; - ToolButton * m_selectButton; - ToolButton * m_detuneButton; + QAction* m_drawAction; + QAction* m_eraseAction; + QAction* m_selectAction; + QAction* m_detuneAction; - ToolButton * m_cutButton; - ToolButton * m_copyButton; - ToolButton * m_pasteButton; + QAction* m_cutAction; + QAction* m_copyAction; + QAction* m_pasteAction; ComboBox * m_zoomingComboBox; ComboBox * m_quantizeComboBox; diff --git a/include/SongEditor.h b/include/SongEditor.h index 4f523dbb2..44a0c5b2f 100644 --- a/include/SongEditor.h +++ b/include/SongEditor.h @@ -41,7 +41,6 @@ class MeterDialog; class Song; class TextFloat; class Timeline; -class ToolButton; class positionLine : public QWidget { @@ -148,12 +147,12 @@ protected slots: void stop(); private: - ToolButton * m_addBBTrackButton; - ToolButton * m_addSampleTrackButton; - ToolButton * m_addAutomationTrackButton; + QAction* m_addBBTrackAction; + QAction* m_addSampleTrackAction; + QAction* m_addAutomationTrackAction; - ToolButton * m_drawModeButton; - ToolButton * m_editModeButton; + QAction* m_drawModeAction; + QAction* m_selectModeAction; ComboBox * m_zoomingComboBox; }; diff --git a/src/gui/AutomationEditor.cpp b/src/gui/AutomationEditor.cpp index abf0e3225..b1d1d49f9 100644 --- a/src/gui/AutomationEditor.cpp +++ b/src/gui/AutomationEditor.cpp @@ -57,7 +57,6 @@ #include "gui_templates.h" #include "Timeline.h" #include "ToolTip.h" -#include "ToolButton.h" #include "TextFloat.h" #include "ComboBox.h" #include "BBTrackContainer.h" @@ -2041,17 +2040,19 @@ AutomationEditorWindow::AutomationEditorWindow() : "current pattern." ) ); // Edit mode buttons + QActionGroup * tool_action_group = new QActionGroup(this); - m_drawButton = new ToolButton(embed::getIconPixmap( "edit_draw" ), - tr( "Draw mode (Shift+D)" )); - m_drawButton->setCheckable( true ); - m_drawButton->setChecked( true ); - m_drawButton->setShortcut(Qt::SHIFT | Qt::Key_D); + m_drawAction = new QAction(embed::getIconPixmap("edit_draw"), + tr("Draw mode (Shift+D)"), tool_action_group); + m_drawAction->setCheckable(true); + m_drawAction->setShortcut(Qt::SHIFT | Qt::Key_D); - m_eraseButton = new ToolButton( embed::getIconPixmap( "edit_erase" ), - tr( "Erase mode (Shift+E)" )); - m_eraseButton->setCheckable( true ); - m_eraseButton->setShortcut(Qt::SHIFT | Qt::Key_E); + m_eraseAction = new QAction(embed::getIconPixmap("edit_erase"), + tr("Erase mode (Shift+E)"), tool_action_group); + m_eraseAction->setCheckable(true); + m_eraseAction->setShortcut(Qt::SHIFT | Qt::Key_E); + + m_drawAction->setChecked(true); //TODO: m_selectButton and m_moveButton are broken. /*m_selectButton = new ToolButton( embed::getIconPixmap( @@ -2068,32 +2069,30 @@ AutomationEditorWindow::AutomationEditorWindow() : m_moveButton->setCheckable( true );*/ QSignalMapper* signalmapper = new QSignalMapper(this); - signalmapper->setMapping(m_drawButton, AutomationEditor::DRAW); - signalmapper->setMapping(m_eraseButton, AutomationEditor::ERASE); + signalmapper->setMapping(m_drawAction, AutomationEditor::DRAW); + signalmapper->setMapping(m_eraseAction, AutomationEditor::ERASE); // signalmapper->setMapping(m_selectButton, AutomationEditor::SELECT); // signalmapper->setMapping(m_moveButton, AutomationEditor::MOVE); - connect(m_drawButton, SIGNAL(clicked()), signalmapper, SLOT(map())); - connect(m_eraseButton, SIGNAL(clicked()), signalmapper, SLOT(map())); + connect(m_drawAction, SIGNAL(triggered()), signalmapper, SLOT(map())); + connect(m_eraseAction, SIGNAL(triggered()), signalmapper, SLOT(map())); // connect(m_selectButton, SIGNAL(triggered()), signalmapper, SLOT(map())); // connect(m_moveButton, SIGNAL(triggered()), signalmapper, SLOT(map())); connect(signalmapper, SIGNAL(mapped(int)), m_editor, SLOT(setEditMode(int))); - QButtonGroup * tool_button_group = new QButtonGroup(); - tool_button_group->addButton( m_drawButton ); - tool_button_group->addButton( m_eraseButton ); +// tool_action_group->addAction( m_drawButton ); +// tool_action_group->addAction( m_eraseButton ); //tool_button_group->addButton( m_selectButton ); //tool_button_group->addButton( m_moveButton ); - tool_button_group->setExclusive( true ); - m_drawButton->setWhatsThis( + m_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_eraseButton->setWhatsThis( + m_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." ) ); @@ -2112,90 +2111,69 @@ AutomationEditorWindow::AutomationEditorWindow() : // Progression type buttons + QActionGroup* progression_type_group = new QActionGroup(this); - m_discreteButton = new ToolButton( embed::getIconPixmap( - "progression_discrete" ), - tr( "Discrete progression" ), - m_editor, SLOT( setProgressionDiscrete() ), - m_toolBar ); - m_discreteButton->setCheckable( true ); - m_discreteButton->setChecked( true ); + m_discreteAction = new QAction(embed::getIconPixmap("progression_discrete"), + tr("Discrete progression"), progression_type_group); + m_linearAction = new QAction(embed::getIconPixmap("progression_linear"), + tr("Linear progression"), progression_type_group); + m_cubicHermiteAction = new QAction(embed::getIconPixmap("progression_cubic_hermite"), + tr( "Cubic Hermite progression"), progression_type_group); - m_linearButton = new ToolButton( embed::getIconPixmap( - "progression_linear" ), - tr( "Linear progression" ), - m_editor, SLOT( setProgressionLinear() ), - m_toolBar ); - m_linearButton->setCheckable( true ); + m_linearAction->setCheckable( true ); + m_cubicHermiteAction->setCheckable( true ); + m_discreteAction->setCheckable( true ); + m_discreteAction->setChecked( true ); - m_cubicHermiteButton = new ToolButton( embed::getIconPixmap( - "progression_cubic_hermite" ), - tr( "Cubic Hermite progression" ), - m_editor, SLOT( - setProgressionHermite() ), - m_toolBar ); - m_cubicHermiteButton->setCheckable( true ); + connect(m_discreteAction, SIGNAL(triggered()), m_editor, SLOT(setProgressionDiscrete())); + connect(m_linearAction, SIGNAL(triggered()), m_editor, SLOT(setProgressionLinear())); + connect(m_cubicHermiteAction, SIGNAL(triggered()), m_editor, SLOT(setProgressionHermite())); // setup tension-stuff m_tensionKnob = new Knob( knobSmall_17, this, "Tension" ); - tool_button_group = new QButtonGroup( this ); - tool_button_group->addButton( m_discreteButton ); - tool_button_group->addButton( m_linearButton ); - tool_button_group->addButton( m_cubicHermiteButton ); - tool_button_group->setExclusive( true ); - - m_discreteButton->setWhatsThis( + m_discreteAction->setWhatsThis( tr( "Click here to choose discrete progressions for this " "automation pattern. The value of the connected " "object will remain constant between control points " "and be set immediately to the new value when each " "control point is reached." ) ); - m_linearButton->setWhatsThis( + m_linearAction->setWhatsThis( tr( "Click here to choose linear progressions for this " "automation pattern. The value of the connected " "object will change at a steady rate over time " "between control points to reach the correct value at " "each control point without a sudden change." ) ); - m_cubicHermiteButton->setWhatsThis( + m_cubicHermiteAction->setWhatsThis( tr( "Click here to choose cubic hermite progressions for this " "automation pattern. The value of the connected " "object will change in a smooth curve and ease in to " "the peaks and valleys." ) ); - - // Copy paste buttons - m_cutButton = new ToolButton( embed::getIconPixmap( "edit_cut" ), - tr( "Cut selected values (Ctrl+X)" ), - m_editor, SLOT( cutSelectedValues() ), - m_toolBar ); + m_cutAction = new QAction(embed::getIconPixmap("edit_cut"), + tr("Cut selected values (Ctrl+X)"), this); + m_copyAction = new QAction(embed::getIconPixmap("edit_copy"), + tr("Copy selected values (Ctrl+C)"), this); + m_pasteAction = new QAction(embed::getIconPixmap("edit_paste"), + tr("Paste values from clipboard Ctrl+V)"), this); - m_copyButton = new ToolButton( embed::getIconPixmap( "edit_copy" ), - tr( "Copy selected values (Ctrl+C)" ), - m_editor, SLOT( copySelectedValues() ), - m_toolBar ); - - m_pasteButton = new ToolButton( embed::getIconPixmap( "edit_paste" ), - tr( "Paste values from clipboard " - "(Ctrl+V)" ), - m_editor, SLOT( pasteValues() ), - m_toolBar ); - - m_cutButton->setWhatsThis( + m_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_copyButton->setWhatsThis( + m_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_pasteButton->setWhatsThis( + m_pasteAction->setWhatsThis( tr( "Click here and the values from the clipboard will be " "pasted at the first visible measure." ) ); - + 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())); // Zoom controls @@ -2249,21 +2227,21 @@ AutomationEditorWindow::AutomationEditorWindow() : m_toolBar->addSeparator();; - m_toolBar->addWidget( m_drawButton ); - m_toolBar->addWidget( m_eraseButton ); - //m_toolBar->addWidget( m_selectButton ); - //m_toolBar->addWidget( m_moveButton ); + m_toolBar->addAction(m_drawAction); + m_toolBar->addAction(m_eraseAction); + //m_toolBar->addAction(m_selectButton); + //m_toolBar->addAction(m_moveButton); m_toolBar->addSeparator(); - m_toolBar->addWidget( m_discreteButton ); - m_toolBar->addWidget( m_linearButton ); - m_toolBar->addWidget( m_cubicHermiteButton ); + m_toolBar->addAction(m_discreteAction); + m_toolBar->addAction(m_linearAction); + m_toolBar->addAction(m_cubicHermiteAction); m_toolBar->addSeparator(); m_toolBar->addWidget( new QLabel( tr("Tension: "), m_toolBar )); m_toolBar->addWidget( m_tensionKnob ); m_toolBar->addSeparator(); - m_toolBar->addWidget( m_cutButton ); - m_toolBar->addWidget( m_copyButton ); - m_toolBar->addWidget( m_pasteButton ); + m_toolBar->addAction( m_cutAction ); + m_toolBar->addAction( m_copyAction ); + m_toolBar->addAction( m_pasteAction ); m_toolBar->addSeparator(); m_editor->m_timeLine->addToolButtons(m_toolBar); m_toolBar->addSeparator(); @@ -2298,13 +2276,13 @@ void AutomationEditorWindow::setCurrentPattern(AutomationPattern* pattern) switch(m_editor->m_pattern->progressionType()) { case AutomationPattern::DiscreteProgression: - m_discreteButton->setChecked(true); + m_discreteAction->setChecked(true); break; case AutomationPattern::LinearProgression: - m_linearButton->setChecked(true); + m_linearAction->setChecked(true); break; case AutomationPattern::CubicHermiteProgression: - m_cubicHermiteButton->setChecked(true); + m_cubicHermiteAction->setChecked(true); break; } diff --git a/src/gui/BBEditor.cpp b/src/gui/BBEditor.cpp index 03499cb87..64a6d1f7c 100644 --- a/src/gui/BBEditor.cpp +++ b/src/gui/BBEditor.cpp @@ -33,7 +33,6 @@ #include "embed.h" #include "MainWindow.h" #include "Song.h" -#include "ToolButton.h" #include "ConfigManager.h" #include "DataFile.h" #include "StringPairDrag.h" @@ -68,28 +67,6 @@ BBEditor::BBEditor( BBTrackContainer* tc ) : m_playAction->setToolTip(tr( "Play/pause current beat/bassline (Space)" )); m_stopAction->setToolTip(tr( "Stop playback of current beat/bassline (Space)" )); - ToolButton * add_bb_track = new ToolButton( - embed::getIconPixmap( "add_bb_track" ), - tr( "Add beat/bassline" ), - Engine::getSong(), SLOT( addBBTrack() ), - m_toolBar ); - - ToolButton * add_automation_track = new ToolButton( - embed::getIconPixmap( "add_automation" ), - tr( "Add automation-track" ), - m_trackContainerView, SLOT( addAutomationTrack() ), m_toolBar ); - - ToolButton * remove_bar = new ToolButton( - embed::getIconPixmap( "step_btn_remove" ), - tr( "Remove steps" ), - m_trackContainerView, SLOT( removeSteps() ), m_toolBar ); - - ToolButton * add_bar = new ToolButton( - embed::getIconPixmap( "step_btn_add" ), - tr( "Add steps" ), - m_trackContainerView, SLOT( addSteps() ), m_toolBar ); - - m_playAction->setWhatsThis( tr( "Click here to play the current " "beat/bassline. The beat/bassline is automatically " @@ -104,14 +81,21 @@ BBEditor::BBEditor( BBTrackContainer* tc ) : m_toolBar->addSeparator(); m_toolBar->addWidget( m_bbComboBox ); + m_toolBar->addSeparator(); - m_toolBar->addWidget( add_bb_track ); - m_toolBar->addWidget( add_automation_track ); + m_toolBar->addAction(embed::getIconPixmap("add_bb_track"), tr("Add beat/bassline"), + Engine::getSong(), SLOT(addBBTrack())); + m_toolBar->addAction(embed::getIconPixmap("add_automation"), tr("Add automation-track"), + m_trackContainerView, SLOT(addAutomationTrack())); + QWidget* stretch = new QWidget(m_toolBar); stretch->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); m_toolBar->addWidget(stretch); - m_toolBar->addWidget( remove_bar ); - m_toolBar->addWidget( add_bar ); + + m_toolBar->addAction(embed::getIconPixmap("step_btn_remove"), tr("Remove steps"), + m_trackContainerView, SLOT(removeSteps())); + m_toolBar->addAction(embed::getIconPixmap("step_btn_add"), tr("Add steps"), + m_trackContainerView, SLOT(addSteps())); m_toolBar->addSeparator(); connect( &tc->m_bbComboBoxModel, SIGNAL( dataChanged() ), diff --git a/src/gui/PianoRoll.cpp b/src/gui/PianoRoll.cpp index 8c66eb6f8..6cc05f644 100644 --- a/src/gui/PianoRoll.cpp +++ b/src/gui/PianoRoll.cpp @@ -66,7 +66,6 @@ #include "templates.h" #include "TextFloat.h" #include "Timeline.h" -#include "ToolButton.h" #include "TextFloat.h" @@ -4003,94 +4002,82 @@ PianoRollWindow::PianoRollWindow() : tr( "Click here to stop playback of current pattern." ) ); // init edit-buttons at the top - m_drawButton = new ToolButton( embed::getIconPixmap( "edit_draw" ), - tr( "Draw mode (Shift+D)" ), - m_editor, SLOT( drawButtonToggled() ), - m_toolBar ); - m_drawButton->setShortcut(Qt::SHIFT | Qt::Key_D); - m_drawButton->setCheckable( true ); - m_drawButton->setChecked( true ); + QActionGroup* tool_button_group = new QActionGroup(this); + m_drawAction = new QAction(embed::getIconPixmap("edit_draw"), + tr( "Draw mode (Shift+D)" ), tool_button_group); + m_drawAction->setShortcut(Qt::SHIFT | Qt::Key_D); + m_drawAction->setCheckable( true ); + m_drawAction->setChecked( true ); - m_eraseButton = new ToolButton( embed::getIconPixmap( "edit_erase" ), - tr( "Erase mode (Shift+E)" ), - m_editor, SLOT( eraseButtonToggled() ), - m_toolBar ); - m_eraseButton->setShortcut(Qt::SHIFT | Qt::Key_E); - m_eraseButton->setCheckable( true ); + m_eraseAction = new QAction(embed::getIconPixmap("edit_erase"), + tr("Erase mode (Shift+E)"), tool_button_group); + m_eraseAction->setShortcut(Qt::SHIFT | Qt::Key_E); + m_eraseAction->setCheckable( true ); - m_selectButton = new ToolButton( embed::getIconPixmap( - "edit_select" ), - tr( "Select mode (Shift+S)" ), - m_editor, SLOT( selectButtonToggled() ), - m_toolBar ); - m_selectButton->setShortcut(Qt::SHIFT | Qt::Key_S); - m_selectButton->setCheckable( true ); + m_selectAction = new QAction( embed::getIconPixmap("edit_select"), + tr("Select mode (Shift+S)"), tool_button_group); + m_selectAction->setShortcut(Qt::SHIFT | Qt::Key_S); + m_selectAction->setCheckable( true ); - m_detuneButton = new ToolButton( embed::getIconPixmap( "automation"), - tr( "Detune mode (Shift+T)" ), - m_editor, SLOT( detuneButtonToggled() ), - m_toolBar ); - m_detuneButton->setShortcut(Qt::SHIFT | Qt::Key_T); - m_detuneButton->setCheckable( true ); + m_detuneAction = new QAction(embed::getIconPixmap("automation"), + tr("Detune mode (Shift+T)"), tool_button_group); + m_detuneAction->setShortcut(Qt::SHIFT | Qt::Key_T); + m_detuneAction->setCheckable( true ); - QButtonGroup * tool_button_group = new QButtonGroup( this ); - tool_button_group->addButton( m_drawButton ); - tool_button_group->addButton( m_eraseButton ); - tool_button_group->addButton( m_selectButton ); - tool_button_group->addButton( m_detuneButton ); - tool_button_group->setExclusive( true ); - - m_drawButton->setWhatsThis( + m_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_eraseButton->setWhatsThis( + m_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_selectButton->setWhatsThis( + m_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_detuneButton->setWhatsThis( + m_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 " "notes from one to another. You can also press " "'Shift+T' on your keyboard to activate this mode." ) ); - m_cutButton = new ToolButton( embed::getIconPixmap( "edit_cut" ), - tr( "Cut selected notes (Ctrl+X)" ), - m_editor, SLOT( cutSelectedNotes() ), - m_toolBar ); + connect(m_drawAction, SIGNAL(triggered()), m_editor, SLOT(drawButtonToggled())); + connect(m_eraseAction, SIGNAL(triggered()), m_editor, SLOT(eraseButtonToggled())); + connect(m_selectAction, SIGNAL(triggered()), m_editor, SLOT(selectButtonToggled())); + connect(m_detuneAction, SIGNAL(triggered()), m_editor, SLOT(detuneButtonToggled())); - m_copyButton = new ToolButton( embed::getIconPixmap( "edit_copy" ), - tr( "Copy selected notes (Ctrl+C)" ), - m_editor, SLOT( copySelectedNotes() ), - m_toolBar ); + // Copy + paste actions + m_cutAction = new QAction(embed::getIconPixmap("edit_cut"), + tr("Cut selected notes (Ctrl+X)"), this); - m_pasteButton = new ToolButton( embed::getIconPixmap( "edit_paste" ), - tr( "Paste notes from clipboard " - "(Ctrl+V)" ), - m_editor, SLOT( pasteNotes() ), - m_toolBar ); + m_copyAction = new QAction(embed::getIconPixmap("edit_copy"), + tr("Copy selected notes (Ctrl+C)"), this); - m_cutButton->setWhatsThis( + m_pasteAction = new QAction(embed::getIconPixmap("edit_paste"), + tr("Paste notes from clipboard (Ctrl+V)"), this); + + m_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_copyButton->setWhatsThis( + m_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_pasteButton->setWhatsThis( + m_pasteAction->setWhatsThis( tr( "Click here and the notes from the clipboard will be " "pasted at the first visible measure." ) ); + 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())); + QLabel * zoom_lbl = new QLabel( m_toolBar ); zoom_lbl->setPixmap( embed::getIconPixmap( "zoom" ) ); @@ -4134,15 +4121,15 @@ PianoRollWindow::PianoRollWindow() : m_toolBar->addSeparator(); - m_toolBar->addWidget( m_drawButton ); - m_toolBar->addWidget( m_eraseButton ); - m_toolBar->addWidget( m_selectButton ); - m_toolBar->addWidget( m_detuneButton ); + m_toolBar->addAction( m_drawAction ); + m_toolBar->addAction( m_eraseAction ); + m_toolBar->addAction( m_selectAction ); + m_toolBar->addAction( m_detuneAction ); m_toolBar->addSeparator(); - m_toolBar->addWidget( m_cutButton ); - m_toolBar->addWidget( m_copyButton ); - m_toolBar->addWidget( m_pasteButton ); + m_toolBar->addAction( m_cutAction ); + m_toolBar->addAction( m_copyAction ); + m_toolBar->addAction( m_pasteAction ); m_toolBar->addSeparator(); m_editor->m_timeLine->addToolButtons(m_toolBar); diff --git a/src/gui/SongEditor.cpp b/src/gui/SongEditor.cpp index 3b63a4bf0..ebd6842f7 100644 --- a/src/gui/SongEditor.cpp +++ b/src/gui/SongEditor.cpp @@ -46,7 +46,6 @@ #include "MeterDialog.h" #include "TextFloat.h" #include "Timeline.h" -#include "ToolButton.h" #include "ToolTip.h" #include "VisualizationWidget.h" #include "TimeDisplayWidget.h" @@ -619,35 +618,32 @@ SongEditorWindow::SongEditorWindow(Song* song) : } m_stopAction->setToolTip(tr( "Stop song (Space)" )); - m_addBBTrackButton = new ToolButton( - embed::getIconPixmap("add_bb_track"), - tr("Add beat/bassline"), - m_editor->m_song, SLOT(addBBTrack())); + m_addBBTrackAction = new QAction(embed::getIconPixmap("add_bb_track"), + tr("Add beat/bassline"), this); - m_addSampleTrackButton = new ToolButton( - embed::getIconPixmap("add_sample_track" ), - tr( "Add sample-track"), - m_editor->m_song, SLOT(addSampleTrack())); + m_addSampleTrackAction = new QAction(embed::getIconPixmap("add_sample_track"), + tr("Add sample-track"), this); - m_addAutomationTrackButton = new ToolButton( - embed::getIconPixmap("add_automation" ), - tr( "Add automation-track"), - m_editor->m_song, SLOT(addAutomationTrack())); + m_addAutomationTrackAction = new QAction(embed::getIconPixmap("add_automation"), + tr("Add automation-track"), this); - m_drawModeButton = new ToolButton(embed::getIconPixmap("edit_draw"), - tr("Draw mode"), m_editor, SLOT(setEditModeDraw())); - m_drawModeButton->setCheckable(true); - m_drawModeButton->setChecked(true); + connect(m_addBBTrackAction, SIGNAL(triggered()), m_editor->m_song, SLOT(addBBTrack())); + connect(m_addSampleTrackAction, SIGNAL(triggered()), m_editor->m_song, SLOT(addSampleTrack())); + connect(m_addAutomationTrackAction, SIGNAL(triggered()), m_editor->m_song, SLOT(addAutomationTrack())); - m_editModeButton = new ToolButton(embed::getIconPixmap("edit_select"), - tr("Edit mode (select and move)"), - m_editor, SLOT(setEditModeSelect())); - m_editModeButton->setCheckable(true); + QActionGroup* tool_action_group = new QActionGroup(this); + m_drawModeAction = new QAction(embed::getIconPixmap("edit_draw"), + tr("Draw mode"), tool_action_group); + m_drawModeAction->setCheckable(true); + m_drawModeAction->setChecked(true); + + m_selectModeAction = new QAction(embed::getIconPixmap("edit_select"), + tr("Edit mode (select and move)"), tool_action_group); + m_selectModeAction->setCheckable(true); + + connect(m_drawModeAction, SIGNAL(triggered()), m_editor, SLOT(setEditModeDraw())); + connect(m_selectModeAction, SIGNAL(triggered()), m_editor, SLOT(setEditModeSelect())); - QButtonGroup * tool_button_group = new QButtonGroup(this); - tool_button_group->addButton(m_drawModeButton); - tool_button_group->addButton(m_editModeButton); - tool_button_group->setExclusive(true); m_playAction->setWhatsThis( tr("Click here, if you want to play your whole song. " @@ -669,12 +665,12 @@ SongEditorWindow::SongEditorWindow(Song* song) : m_toolBar->addSeparator(); - m_toolBar->addWidget( m_addBBTrackButton ); - m_toolBar->addWidget( m_addSampleTrackButton ); - m_toolBar->addWidget( m_addAutomationTrackButton ); + m_toolBar->addAction( m_addBBTrackAction ); + m_toolBar->addAction( m_addSampleTrackAction ); + m_toolBar->addAction( m_addAutomationTrackAction ); m_toolBar->addSeparator(); - m_toolBar->addWidget( m_drawModeButton ); - m_toolBar->addWidget( m_editModeButton ); + m_toolBar->addAction( m_drawModeAction ); + m_toolBar->addAction( m_selectModeAction ); m_toolBar->addSeparator(); m_editor->m_timeLine->addToolButtons(m_toolBar); m_toolBar->addSeparator();