Introduce UI_CTRL_KEY and use where appropriate (#4431)
This is an abstraction for the name of the 'Ctrl' (or equivalent) key on linux, windows and apple
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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() ) );
|
||||
|
||||
@@ -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 <Shift> to move the begin loop point; Press <%1> to disable magnetic loop points." ).arg(
|
||||
#ifdef LMMS_BUILD_APPLE
|
||||
"⌘"),
|
||||
#else
|
||||
"Ctrl"),
|
||||
#endif
|
||||
tr( "Hold <Shift> to move the begin loop point; Press <%1> to disable magnetic loop points." ).arg(UI_CTRL_KEY),
|
||||
embed::getIconPixmap( "hint" ), 0 );
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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 );
|
||||
|
||||
|
||||
@@ -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" ),
|
||||
|
||||
Reference in New Issue
Block a user