Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Master cleanup #4431

Merged
merged 2 commits into from Jun 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions include/lmms_basics.h
Expand Up @@ -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
7 changes: 1 addition & 6 deletions src/core/AutomationPattern.cpp
Expand Up @@ -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);
}


Expand Down
21 changes: 3 additions & 18 deletions src/core/Track.cpp
Expand Up @@ -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 );
}
}
Expand Down Expand Up @@ -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 );

Expand Down Expand Up @@ -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() ) );
Expand Down
14 changes: 2 additions & 12 deletions src/gui/TimeLineWidget.cpp
Expand Up @@ -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 );
}

Expand Down
21 changes: 3 additions & 18 deletions src/gui/editors/AutomationEditor.cpp
Expand Up @@ -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);
Expand Down
21 changes: 3 additions & 18 deletions src/gui/editors/PianoRoll.cpp
Expand Up @@ -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 );
Expand Down
84 changes: 12 additions & 72 deletions src/gui/widgets/ProjectNotes.cpp
Expand Up @@ -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 );

Expand Down Expand Up @@ -194,37 +169,22 @@ 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() ) );

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() ) );
Expand All @@ -236,49 +196,29 @@ 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 );

m_actionAlignCenter = new QAction( embed::getIconPixmap(
"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 );

Expand Down
7 changes: 1 addition & 6 deletions src/tracks/SampleTrack.cpp
Expand Up @@ -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" ),
Expand Down