diff --git a/include/lmms_basics.h b/include/lmms_basics.h index 637867b4d34..cca04e97d8f 100644 --- a/include/lmms_basics.h +++ b/include/lmms_basics.h @@ -141,5 +141,11 @@ typedef sample_t sampleFrameA[DEFAULT_CHANNELS] __attribute__((__aligned__(ALIGN #define STRINGIFY(s) STR(s) #define STR(PN) #PN +// Abstract away GUI CTRL key (linux/windows) vs ⌘ (apple) +#ifdef LMMS_BUILD_APPLE +# define UI_CTRL_KEY "⌘" +#else +# define UI_CTRL_KEY "Ctrl" +#endif #endif diff --git a/src/core/AutomationPattern.cpp b/src/core/AutomationPattern.cpp index 9345ad56638..ab74c6eabe6 100644 --- a/src/core/AutomationPattern.cpp +++ b/src/core/AutomationPattern.cpp @@ -619,12 +619,7 @@ const QString AutomationPattern::name() const { return m_objects.first()->fullDisplayName(); } - return tr( "Drag a control while pressing <%1>" ).arg( - #ifdef LMMS_BUILD_APPLE - "⌘"); - #else - "Ctrl"); - #endif + return tr( "Drag a control while pressing <%1>" ).arg(UI_CTRL_KEY); } diff --git a/src/core/Track.cpp b/src/core/Track.cpp index e115292490c..2a59334aaed 100644 --- a/src/core/Track.cpp +++ b/src/core/Track.cpp @@ -791,12 +791,7 @@ void TrackContentObjectView::mousePressEvent( QMouseEvent * me ) QString hint = m_action == Move || m_action == MoveSelection ? tr( "Press <%1> and drag to make a copy." ) : tr( "Press <%1> for free resizing." ); - m_hint = TextFloat::displayMessage( tr( "Hint" ), hint.arg( - #ifdef LMMS_BUILD_APPLE - "⌘"), - #else - "Ctrl"), - #endif + m_hint = TextFloat::displayMessage( tr( "Hint" ), hint.arg(UI_CTRL_KEY), embed::getIconPixmap( "hint" ), 0 ); } } @@ -1093,12 +1088,7 @@ void TrackContentObjectView::contextMenuEvent( QContextMenuEvent * cme ) tr( "Paste" ), m_tco, SLOT( paste() ) ); contextMenu.addSeparator(); contextMenu.addAction( embed::getIconPixmap( "muted" ), - tr( "Mute/unmute (<%1> + middle click)" ).arg( - #ifdef LMMS_BUILD_APPLE - "⌘"), - #else - "Ctrl"), - #endif + tr( "Mute/unmute (<%1> + middle click)" ).arg(UI_CTRL_KEY), m_tco, SLOT( toggleMute() ) ); constructContextMenu( &contextMenu ); @@ -1734,12 +1724,7 @@ TrackOperationsWidget::TrackOperationsWidget( TrackView * parent ) : m_trackView( parent ) /*!< The parent track view */ { ToolTip::add( this, tr( "Press <%1> while clicking on move-grip " - "to begin a new drag'n'drop action." ).arg( - #ifdef LMMS_BUILD_APPLE - "⌘") ); - #else - "Ctrl") ); - #endif + "to begin a new drag'n'drop action." ).arg(UI_CTRL_KEY) ); QMenu * toMenu = new QMenu( this ); toMenu->setFont( pointSize<9>( toMenu->font() ) ); diff --git a/src/gui/TimeLineWidget.cpp b/src/gui/TimeLineWidget.cpp index ccf32add12a..5c91cfcf8e1 100644 --- a/src/gui/TimeLineWidget.cpp +++ b/src/gui/TimeLineWidget.cpp @@ -337,24 +337,14 @@ void TimeLineWidget::mousePressEvent( QMouseEvent* event ) { delete m_hint; m_hint = TextFloat::displayMessage( tr( "Hint" ), - tr( "Press <%1> to disable magnetic loop points." ).arg( - #ifdef LMMS_BUILD_APPLE - "⌘"), - #else - "Ctrl"), - #endif + tr( "Press <%1> to disable magnetic loop points." ).arg(UI_CTRL_KEY), embed::getIconPixmap( "hint" ), 0 ); } else if( m_action == MoveLoopEnd ) { delete m_hint; m_hint = TextFloat::displayMessage( tr( "Hint" ), - tr( "Hold to move the begin loop point; Press <%1> to disable magnetic loop points." ).arg( - #ifdef LMMS_BUILD_APPLE - "⌘"), - #else - "Ctrl"), - #endif + tr( "Hold to move the begin loop point; Press <%1> to disable magnetic loop points." ).arg(UI_CTRL_KEY), embed::getIconPixmap( "hint" ), 0 ); } diff --git a/src/gui/editors/AutomationEditor.cpp b/src/gui/editors/AutomationEditor.cpp index 890bb234696..e00c107d1dc 100644 --- a/src/gui/editors/AutomationEditor.cpp +++ b/src/gui/editors/AutomationEditor.cpp @@ -2294,26 +2294,11 @@ AutomationEditorWindow::AutomationEditorWindow() : /*DropToolBar *copyPasteActionsToolBar = addDropToolBarToTop(tr("Copy paste actions"));*/ QAction* cutAction = new QAction(embed::getIconPixmap("edit_cut"), - tr("Cut selected values (%1+X)").arg( - #ifdef LMMS_BUILD_APPLE - "⌘"), this); - #else - "Ctrl"), this); - #endif + tr("Cut selected values (%1+X)").arg(UI_CTRL_KEY), this); QAction* copyAction = new QAction(embed::getIconPixmap("edit_copy"), - tr("Copy selected values (%1+C)").arg( - #ifdef LMMS_BUILD_APPLE - "⌘"), this); - #else - "Ctrl"), this); - #endif + tr("Copy selected values (%1+C)").arg(UI_CTRL_KEY), this); QAction* pasteAction = new QAction(embed::getIconPixmap("edit_paste"), - tr("Paste values from clipboard (%1+V)").arg( - #ifdef LMMS_BUILD_APPLE - "⌘"), this); - #else - "Ctrl"), this); - #endif + tr("Paste values from clipboard (%1+V)").arg(UI_CTRL_KEY), this); cutAction->setShortcut(Qt::CTRL | Qt::Key_X); copyAction->setShortcut(Qt::CTRL | Qt::Key_C); diff --git a/src/gui/editors/PianoRoll.cpp b/src/gui/editors/PianoRoll.cpp index 1060574c9a6..1ec23724c8d 100644 --- a/src/gui/editors/PianoRoll.cpp +++ b/src/gui/editors/PianoRoll.cpp @@ -4090,28 +4090,13 @@ PianoRollWindow::PianoRollWindow() : DropToolBar *copyPasteActionsToolBar = addDropToolBarToTop( tr( "Copy paste controls" ) ); QAction* cutAction = new QAction(embed::getIconPixmap( "edit_cut" ), - tr( "Cut (%1+X)" ).arg( - #ifdef LMMS_BUILD_APPLE - "⌘" ), this ); - #else - "Ctrl" ), this ); - #endif + tr( "Cut (%1+X)" ).arg(UI_CTRL_KEY), this ); QAction* copyAction = new QAction(embed::getIconPixmap( "edit_copy" ), - tr( "Copy (%1+C)" ).arg( - #ifdef LMMS_BUILD_APPLE - "⌘"), this); - #else - "Ctrl" ), this ); - #endif + tr( "Copy (%1+C)" ).arg(UI_CTRL_KEY), this ); QAction* pasteAction = new QAction(embed::getIconPixmap( "edit_paste" ), - tr( "Paste (%1+V)" ).arg( - #ifdef LMMS_BUILD_APPLE - "⌘" ), this ); - #else - "Ctrl" ), this ); - #endif + tr( "Paste (%1+V)" ).arg(UI_CTRL_KEY), this ); cutAction->setShortcut( Qt::CTRL | Qt::Key_X ); copyAction->setShortcut( Qt::CTRL | Qt::Key_C ); diff --git a/src/gui/widgets/ProjectNotes.cpp b/src/gui/widgets/ProjectNotes.cpp index d8d6636c490..7fc35b446a6 100644 --- a/src/gui/widgets/ProjectNotes.cpp +++ b/src/gui/widgets/ProjectNotes.cpp @@ -115,56 +115,31 @@ void ProjectNotes::setupActions() a = new QAction( embed::getIconPixmap( "edit_undo" ), tr( "&Undo" ), this ); - a->setShortcut( tr( "%1+Z" ).arg( - #ifdef LMMS_BUILD_APPLE - "⌘") ); - #else - "Ctrl") ); - #endif + a->setShortcut( tr( "%1+Z" ).arg(UI_CTRL_KEY) ); connect( a, SIGNAL( triggered() ), m_edit, SLOT( undo() ) ); tb->addAction( a ); a = new QAction( embed::getIconPixmap( "edit_redo" ), tr( "&Redo" ), this ); - a->setShortcut( tr( "%1+Y" ).arg( - #ifdef LMMS_BUILD_APPLE - "⌘") ); - #else - "Ctrl") ); - #endif + a->setShortcut( tr( "%1+Y" ).arg(UI_CTRL_KEY) ); connect( a, SIGNAL( triggered() ), m_edit, SLOT( redo() ) ); tb->addAction( a ); a = new QAction( embed::getIconPixmap( "edit_copy" ), tr( "&Copy" ), this ); - a->setShortcut( tr( "%1+C" ).arg( - #ifdef LMMS_BUILD_APPLE - "⌘") ); - #else - "Ctrl") ); - #endif + a->setShortcut( tr( "%1+C" ).arg(UI_CTRL_KEY) ); connect( a, SIGNAL( triggered() ), m_edit, SLOT( copy() ) ); tb->addAction( a ); a = new QAction( embed::getIconPixmap( "edit_cut" ), tr( "Cu&t" ), this ); - a->setShortcut( tr( "%1+X" ).arg( - #ifdef LMMS_BUILD_APPLE - "⌘") ); - #else - "Ctrl") ); - #endif + a->setShortcut( tr( "%1+X" ).arg(UI_CTRL_KEY) ); connect( a, SIGNAL( triggered() ), m_edit, SLOT( cut() ) ); tb->addAction( a ); a = new QAction( embed::getIconPixmap( "edit_paste" ), tr( "&Paste" ), this ); - a->setShortcut( tr( "%1+V" ).arg( - #ifdef LMMS_BUILD_APPLE - "⌘") ); - #else - "Ctrl") ); - #endif + a->setShortcut( tr( "%1+V" ).arg(UI_CTRL_KEY) ); connect( a, SIGNAL( triggered() ), m_edit, SLOT( paste() ) ); tb->addAction( a ); @@ -194,24 +169,14 @@ void ProjectNotes::setupActions() m_actionTextBold = new QAction( embed::getIconPixmap( "text_bold" ), tr( "&Bold" ), this ); - m_actionTextBold->setShortcut( tr( "%1+B" ).arg( - #ifdef LMMS_BUILD_APPLE - "⌘") ); - #else - "Ctrl") ); - #endif + m_actionTextBold->setShortcut( tr( "%1+B" ).arg(UI_CTRL_KEY) ); m_actionTextBold->setCheckable( true ); connect( m_actionTextBold, SIGNAL( triggered() ), this, SLOT( textBold() ) ); m_actionTextItalic = new QAction( embed::getIconPixmap( "text_italic" ), tr( "&Italic" ), this ); - m_actionTextItalic->setShortcut( tr( "%1+I" ).arg( - #ifdef LMMS_BUILD_APPLE - "⌘") ); - #else - "Ctrl") ); - #endif + m_actionTextItalic->setShortcut( tr( "%1+I" ).arg(UI_CTRL_KEY) ); m_actionTextItalic->setCheckable( true ); connect( m_actionTextItalic, SIGNAL( triggered() ), this, SLOT( textItalic() ) ); @@ -219,12 +184,7 @@ void ProjectNotes::setupActions() m_actionTextUnderline = new QAction( embed::getIconPixmap( "text_under" ), tr( "&Underline" ), this ); - m_actionTextUnderline->setShortcut( tr( "%1+U" ).arg( - #ifdef LMMS_BUILD_APPLE - "⌘") ); - #else - "Ctrl") ); - #endif + m_actionTextUnderline->setShortcut( tr( "%1+U" ).arg(UI_CTRL_KEY) ); m_actionTextUnderline->setCheckable( true ); connect( m_actionTextUnderline, SIGNAL( triggered() ), this, SLOT( textUnderline() ) ); @@ -236,12 +196,7 @@ void ProjectNotes::setupActions() m_actionAlignLeft = new QAction( embed::getIconPixmap( "text_left" ), tr( "&Left" ), m_edit ); - m_actionAlignLeft->setShortcut( tr( "%1+L" ).arg( - #ifdef LMMS_BUILD_APPLE - "⌘") ); - #else - "Ctrl") ); - #endif + m_actionAlignLeft->setShortcut( tr( "%1+L" ).arg(UI_CTRL_KEY) ); m_actionAlignLeft->setCheckable( true ); grp->addAction( m_actionAlignLeft ); @@ -249,36 +204,21 @@ void ProjectNotes::setupActions() "text_center" ), tr( "C&enter" ), m_edit ); m_actionAlignCenter->setShortcutContext( Qt::WidgetShortcut ); - m_actionAlignCenter->setShortcut( tr( "%1+E" ).arg( - #ifdef LMMS_BUILD_APPLE - "⌘") ); - #else - "Ctrl") ); - #endif + m_actionAlignCenter->setShortcut( tr( "%1+E" ).arg(UI_CTRL_KEY) ); m_actionAlignCenter->setCheckable( true ); grp->addAction( m_actionAlignCenter ); m_actionAlignRight = new QAction( embed::getIconPixmap( "text_right" ), tr( "&Right" ), m_edit ); m_actionAlignRight->setShortcutContext( Qt::WidgetShortcut ); - m_actionAlignRight->setShortcut( tr( "%1+R" ).arg( - #ifdef LMMS_BUILD_APPLE - "⌘") ); - #else - "Ctrl") ); - #endif + m_actionAlignRight->setShortcut( tr( "%1+R" ).arg(UI_CTRL_KEY) ); m_actionAlignRight->setCheckable( true ); grp->addAction( m_actionAlignRight ); m_actionAlignJustify = new QAction( embed::getIconPixmap( "text_block" ), tr( "&Justify" ), m_edit ); - m_actionAlignJustify->setShortcut( tr( "%1+J" ).arg( - #ifdef LMMS_BUILD_APPLE - "⌘") ); - #else - "Ctrl") ); - #endif + m_actionAlignJustify->setShortcut( tr( "%1+J" ).arg(UI_CTRL_KEY) ); m_actionAlignJustify->setCheckable( true ); grp->addAction( m_actionAlignJustify ); diff --git a/src/tracks/SampleTrack.cpp b/src/tracks/SampleTrack.cpp index 3315ccb55c4..bd70a3a084c 100644 --- a/src/tracks/SampleTrack.cpp +++ b/src/tracks/SampleTrack.cpp @@ -338,12 +338,7 @@ void SampleTCOView::contextMenuEvent( QContextMenuEvent * _cme ) tr( "Paste" ), m_tco, SLOT( paste() ) ); contextMenu.addSeparator(); contextMenu.addAction( embed::getIconPixmap( "muted" ), - tr( "Mute/unmute (<%1> + middle click)" ).arg( - #ifdef LMMS_BUILD_APPLE - "⌘"), - #else - "Ctrl"), - #endif + tr( "Mute/unmute (<%1> + middle click)" ).arg(UI_CTRL_KEY), m_tco, SLOT( toggleMute() ) ); /*contextMenu.addAction( embed::getIconPixmap( "record" ), tr( "Set/clear record" ),