void NPlayer::createActions() { m_showHideAction = new NAction(QIcon::fromTheme("preferences-system-windows", QIcon(":/trolltech/styles/commonstyle/images/dockdock-16.png")), tr("Show / Hide"), this); m_showHideAction->setObjectName("ShowHideAction"); m_showHideAction->setStatusTip(tr("Toggle window visibility")); m_showHideAction->setCustomizable(true); m_playAction = new NAction(QIcon::fromTheme("media-playback-start", style()->standardIcon(QStyle::SP_MediaPlay)), tr("Play / Pause"), this); m_playAction->setObjectName("PlayAction"); m_playAction->setStatusTip(tr("Toggle playback")); m_playAction->setCustomizable(true); m_stopAction = new NAction(QIcon::fromTheme("media-playback-stop", style()->standardIcon(QStyle::SP_MediaStop)), tr("Stop"), this); m_stopAction->setObjectName("StopAction"); m_stopAction->setStatusTip(tr("Stop playback")); m_stopAction->setCustomizable(true); m_prevAction = new NAction(QIcon::fromTheme("media-playback-backward", style()->standardIcon(QStyle::SP_MediaSkipBackward)), tr("Previous"), this); m_prevAction->setObjectName("PrevAction"); m_prevAction->setStatusTip(tr("Play previous track in playlist")); m_prevAction->setCustomizable(true); m_nextAction = new NAction(QIcon::fromTheme("media-playback-forward", style()->standardIcon(QStyle::SP_MediaSkipForward)), tr("Next"), this); m_nextAction->setObjectName("NextAction"); m_nextAction->setStatusTip(tr("Play next track in playlist")); m_nextAction->setCustomizable(true); m_preferencesAction = new NAction(QIcon::fromTheme("preferences-desktop", style()->standardIcon(QStyle::SP_MessageBoxInformation)), tr("Preferences..."), this); m_preferencesAction->setShortcut(QKeySequence("Ctrl+P")); m_exitAction = new NAction(QIcon::fromTheme("exit", style()->standardIcon(QStyle::SP_DialogCloseButton)), tr("Exit"), this); m_exitAction->setShortcut(QKeySequence("Ctrl+Q")); m_addFilesAction = new NAction(style()->standardIcon(QStyle::SP_DialogOpenButton), tr("Add Files..."), this); m_addFilesAction->setShortcut(QKeySequence("Ctrl+O")); m_addDirAction = new NAction(style()->standardIcon(QStyle::SP_FileDialogNewFolder), tr("Add Directory..."), this); m_addDirAction->setShortcut(QKeySequence("Ctrl+Shift+O")); m_savePlaylistAction = new NAction(style()->standardIcon(QStyle::SP_DialogSaveButton), tr("Save Playlist..."), this); m_savePlaylistAction->setShortcut(QKeySequence("Ctrl+S")); m_showCoverAction = new NAction(tr("Show Cover Art"), this); m_showCoverAction->setCheckable(true); m_showCoverAction->setObjectName("ShowCoverAction"); m_aboutAction = new NAction(QIcon::fromTheme("help-about", style()->standardIcon(QStyle::SP_MessageBoxQuestion)), tr("About"), this); m_playingOnTopAction = new NAction(tr("On Top During Playback"), this); m_playingOnTopAction->setCheckable(true); m_playingOnTopAction->setObjectName("PlayingOnTopAction"); m_alwaysOnTopAction = new NAction(tr("Always On Top"), this); m_alwaysOnTopAction->setCheckable(true); m_alwaysOnTopAction->setObjectName("AlwaysOnTopAction"); m_fullScreenAction = new NAction(tr("Fullscreen Mode"), this); m_fullScreenAction->setStatusTip(tr("Hide all controll except waveform")); m_fullScreenAction->setObjectName("FullScreenAction"); m_fullScreenAction->setCustomizable(true); // playlist actions >> m_shufflePlaylistAction = new NAction(tr("Shuffle"), this); m_shufflePlaylistAction->setCheckable(true); m_shufflePlaylistAction->setObjectName("ShufflePlaylistAction"); m_shufflePlaylistAction->setStatusTip(tr("Toggle playlist shuffle")); m_shufflePlaylistAction->setCustomizable(true); m_repeatPlaylistAction = new NAction(tr("Repeat"), this); m_repeatPlaylistAction->setCheckable(true); m_repeatPlaylistAction->setObjectName("RepeatPlaylistAction"); m_repeatPlaylistAction->setStatusTip(tr("Toggle current item repeat")); m_repeatPlaylistAction->setCustomizable(true); m_loopPlaylistAction = new NAction(tr("Loop playlist"), this); m_loopPlaylistAction->setCheckable(true); m_loopPlaylistAction->setObjectName("LoopPlaylistAction"); m_nextFileEnableAction = new NAction(tr("Load next file in directory when finished"), this); m_nextFileEnableAction->setCheckable(true); m_nextFileEnableAction->setObjectName("NextFileEnableAction"); m_nextFileByNameAscdAction = new NAction(QString::fromUtf8(" ├ %1 ↓").arg(tr("By Name")), this); m_nextFileByNameAscdAction->setCheckable(true); m_nextFileByNameAscdAction->setObjectName("NextFileByNameAscdAction"); m_nextFileByNameDescAction = new NAction(QString::fromUtf8(" ├ %1 ↑").arg(tr("By Name")), this); m_nextFileByNameDescAction->setCheckable(true); m_nextFileByNameDescAction->setObjectName("NextFileByNameDescAction"); m_nextFileByDateAscd = new NAction(QString::fromUtf8(" ├ %1 ↓").arg(tr("By Date")), this); m_nextFileByDateAscd->setCheckable(true); m_nextFileByDateAscd->setObjectName("NextFileByDateAscd"); m_nextFileByDateDesc = new NAction(QString::fromUtf8(" └ %1 ↑").arg(tr("By Date")), this); m_nextFileByDateDesc->setCheckable(true); m_nextFileByDateDesc->setObjectName("NextFileByDateDesc"); QActionGroup *group = new QActionGroup(this); m_nextFileByNameAscdAction->setActionGroup(group); m_nextFileByNameDescAction->setActionGroup(group); m_nextFileByDateAscd->setActionGroup(group); m_nextFileByDateDesc->setActionGroup(group); // << playlist actions // jump actions >> for (int i = 1; i <= 3; ++i) { QString num = QString::number(i); NAction *jumpFwAction = new NAction(QString(tr("Jump Forward #%1")).arg(num), this); jumpFwAction->setObjectName(QString("Jump%1ForwardAction").arg(num)); jumpFwAction->setStatusTip(QString(tr("Make a jump forward #%1")).arg(num)); jumpFwAction->setCustomizable(true); NAction *jumpBwAction = new NAction(QString(tr("Jump Backwards #%1")).arg(num), this); jumpBwAction->setObjectName(QString("Jump%1BackwardsAction").arg(num)); jumpBwAction->setStatusTip(QString(tr("Make a jump backwards #%1")).arg(num)); jumpBwAction->setCustomizable(true); } // << jump actions // keyboard shortcuts m_settings->initShortcuts(this); m_settings->loadShortcuts(); foreach (NAction *action, findChildren<NAction *>()) { if (!action->shortcuts().isEmpty()) m_mainWindow->addAction(action); } createContextMenu(); createGlobalMenu(); createTrayIcon(); }