void MainWindow::setupActions() { KAction *newDownloadAction = actionCollection()->addAction("new_download"); newDownloadAction->setText(i18n("&New Download...")); newDownloadAction->setIcon(KIcon("document-new")); newDownloadAction->setShortcuts(KShortcut("Ctrl+N")); newDownloadAction->setHelpText(i18n("Opens a dialog to add a transfer to the list")); connect(newDownloadAction, SIGNAL(triggered()), SLOT(slotNewTransfer())); KAction *openAction = actionCollection()->addAction("import_transfers"); openAction->setText(i18n("&Import Transfers...")); openAction->setIcon(KIcon("document-open")); openAction->setShortcuts(KShortcut("Ctrl+I")); openAction->setHelpText(i18n("Imports a list of transfers")); connect(openAction, SIGNAL(triggered()), SLOT(slotImportTransfers())); KAction *exportAction = actionCollection()->addAction("export_transfers"); exportAction->setText(i18n("&Export Transfers List...")); exportAction->setIcon(KIcon("document-export")); exportAction->setShortcuts(KShortcut("Ctrl+E")); exportAction->setHelpText(i18n("Exports the current transfers into a file")); connect(exportAction, SIGNAL(triggered()), SLOT(slotExportTransfers())); KAction *createMetalinkAction = actionCollection()->addAction("create_metalink"); createMetalinkAction->setText(i18n("&Create a Metalink...")); createMetalinkAction->setIcon(KIcon("journal-new")); createMetalinkAction->setHelpText(i18n("Creates or modifies a metalink and saves it on disk")); connect(createMetalinkAction, SIGNAL(triggered()), SLOT(slotCreateMetalink())); KAction *priorityTop = actionCollection()->addAction("priority_top"); priorityTop->setText(i18n("Top Priority")); priorityTop->setIcon(KIcon("arrow-up-double")); priorityTop->setShortcuts(KShortcut("Ctrl+PgUp")); priorityTop->setHelpText(i18n("Download selected transfer first")); connect(priorityTop, SIGNAL(triggered()), this, SLOT(slotPriorityTop())); KAction *priorityBottom = actionCollection()->addAction("priority_bottom"); priorityBottom->setText(i18n("Least Priority")); priorityBottom->setIcon(KIcon("arrow-down-double")); priorityBottom->setShortcuts(KShortcut("Ctrl+PgDown")); priorityBottom->setHelpText(i18n("Download selected transfer last")); connect(priorityBottom, SIGNAL(triggered()), this, SLOT(slotPriorityBottom())); KAction *priorityUp = actionCollection()->addAction("priority_up"); priorityUp->setText(i18n("Increase Priority")); priorityUp->setIcon(KIcon("arrow-up")); priorityUp->setShortcuts(KShortcut("Ctrl+Up")); priorityUp->setHelpText(i18n("Increase priority for selected transfer")); connect(priorityUp, SIGNAL(triggered()), this, SLOT(slotPriorityUp())); KAction *priorityDown = actionCollection()->addAction("priority_down"); priorityDown->setText(i18n("Decrease Priority")); priorityDown->setIcon(KIcon("arrow-down")); priorityDown->setShortcuts(KShortcut("Ctrl+Down")); priorityDown->setHelpText(i18n("Decrease priority for selected transfer")); connect(priorityDown, SIGNAL(triggered()), this, SLOT(slotPriorityDown())); //FIXME: Not needed maybe because the normal delete already deletes groups? KAction *deleteGroupAction = actionCollection()->addAction("delete_groups"); deleteGroupAction->setText(i18n("Delete Group")); deleteGroupAction->setIcon(KIcon("edit-delete")); deleteGroupAction->setHelpText(i18n("Delete selected group")); connect(deleteGroupAction, SIGNAL(triggered()), SLOT(slotDeleteGroup())); KAction *renameGroupAction = actionCollection()->addAction("rename_groups"); renameGroupAction->setText(i18n("Rename Group...")); renameGroupAction->setIcon(KIcon("edit-rename")); connect(renameGroupAction, SIGNAL(triggered()), SLOT(slotRenameGroup())); KAction *setIconGroupAction = actionCollection()->addAction("seticon_groups"); setIconGroupAction->setText(i18n("Set Icon...")); setIconGroupAction->setIcon(KIcon("preferences-desktop-icons")); setIconGroupAction->setHelpText(i18n("Select a custom icon for the selected group")); connect(setIconGroupAction, SIGNAL(triggered()), SLOT(slotSetIconGroup())); m_autoPasteAction = new KToggleAction(KIcon("edit-paste"), i18n("Auto-Paste Mode"), actionCollection()); actionCollection()->addAction("auto_paste", m_autoPasteAction); m_autoPasteAction->setChecked(Settings::autoPaste()); m_autoPasteAction->setWhatsThis(i18n("<b>Auto paste</b> button toggles the auto-paste mode " "on and off.\nWhen set, KGet will periodically scan " "the clipboard for URLs and paste them automatically.")); connect(m_autoPasteAction, SIGNAL(triggered()), SLOT(slotToggleAutoPaste())); m_konquerorIntegration = new KToggleAction(KIcon("konqueror"), i18n("Use KGet as Konqueror Download Manager"), actionCollection()); actionCollection()->addAction("konqueror_integration", m_konquerorIntegration); connect(m_konquerorIntegration, SIGNAL(triggered(bool)), SLOT(slotTrayKonquerorIntegration(bool))); m_konquerorIntegration->setChecked(Settings::konquerorIntegration()); // local - Destroys all sub-windows and exits KStandardAction::quit(this, SLOT(slotQuit()), actionCollection()); // local - Standard configure actions KStandardAction::preferences(this, SLOT(slotPreferences()), actionCollection()); KStandardAction::configureNotifications(this, SLOT(slotConfigureNotifications()), actionCollection()); m_menubarAction = KStandardAction::showMenubar(this, SLOT(slotShowMenubar()), actionCollection()); m_menubarAction->setChecked(!menuBar()->isHidden()); // Transfer related actions actionCollection()->addAction(KStandardAction::SelectAll, "select_all", m_viewsContainer, SLOT(selectAll())); KAction *deleteSelectedAction = actionCollection()->addAction("delete_selected_download"); deleteSelectedAction->setText(i18nc("delete selected transfer item", "Remove Selected")); deleteSelectedAction->setIcon(KIcon("edit-delete")); deleteSelectedAction->setShortcuts(KShortcut("Del")); deleteSelectedAction->setHelpText(i18n("Removes selected transfer and deletes files from disk if it's not finished")); connect(deleteSelectedAction, SIGNAL(triggered()), SLOT(slotDeleteSelected())); KAction *deleteAllFinishedAction = actionCollection()->addAction("delete_all_finished"); deleteAllFinishedAction->setText(i18nc("delete all finished transfers", "Remove All Finished")); deleteAllFinishedAction->setIcon(KIcon("edit-clear-list")); deleteAllFinishedAction->setHelpText(i18n("Removes all finished transfers and leaves all files on disk")); connect(deleteAllFinishedAction, SIGNAL(triggered()), SLOT(slotDeleteFinished())); KAction *deleteSelectedIncludingFilesAction = actionCollection()->addAction("delete_selected_download_including_files"); deleteSelectedIncludingFilesAction->setText(i18nc("delete selected transfer item and files", "Remove Selected and Delete Files")); deleteSelectedIncludingFilesAction->setIcon(KIcon("edit-delete")); deleteSelectedIncludingFilesAction->setHelpText(i18n("Removes selected transfer and deletes files from disk in any case")); connect(deleteSelectedIncludingFilesAction, SIGNAL(triggered()), SLOT(slotDeleteSelectedIncludingFiles())); KAction *redownloadSelectedAction = actionCollection()->addAction("redownload_selected_download"); redownloadSelectedAction->setText(i18nc("redownload selected transfer item", "Redownload Selected")); redownloadSelectedAction->setIcon(KIcon("view-refresh")); connect(redownloadSelectedAction, SIGNAL(triggered()), SLOT(slotRedownloadSelected())); KAction *startAllAction = actionCollection()->addAction("start_all_download"); startAllAction->setText(i18n("Start All")); startAllAction->setIcon(KIcon("media-seek-forward")); startAllAction->setShortcuts(KShortcut("Ctrl+R")); startAllAction->setHelpText(i18n("Starts / resumes all transfers")); connect(startAllAction, SIGNAL(triggered()), SLOT(slotStartAllDownload())); KAction *startSelectedAction = actionCollection()->addAction("start_selected_download"); startSelectedAction->setText(i18n("Start Selected")); startSelectedAction->setIcon(KIcon("media-playback-start")); startSelectedAction->setHelpText(i18n("Starts / resumes selected transfer")); connect(startSelectedAction, SIGNAL(triggered()), SLOT(slotStartSelectedDownload())); KAction *stopAllAction = actionCollection()->addAction("stop_all_download"); stopAllAction->setText(i18n("Pause All")); stopAllAction->setIcon(KIcon("media-playback-pause")); stopAllAction->setShortcuts(KShortcut("Ctrl+P")); stopAllAction->setHelpText(i18n("Pauses all transfers")); connect(stopAllAction, SIGNAL(triggered()), SLOT(slotStopAllDownload())); KAction *stopSelectedAction = actionCollection()->addAction("stop_selected_download"); stopSelectedAction->setText(i18n("Stop Selected")); stopSelectedAction->setIcon(KIcon("media-playback-pause")); stopSelectedAction->setHelpText(i18n("Pauses selected transfer")); connect(stopSelectedAction, SIGNAL(triggered()), SLOT(slotStopSelectedDownload())); KActionMenu *startActionMenu = new KActionMenu(KIcon("media-playback-start"), i18n("Start"), actionCollection()); actionCollection()->addAction("start_menu", startActionMenu); startActionMenu->setDelayed(true); startActionMenu->addAction(startSelectedAction); startActionMenu->addAction(startAllAction); connect(startActionMenu, SIGNAL(triggered()), SLOT(slotStartDownload())); KActionMenu *stopActionMenu = new KActionMenu(KIcon("media-playback-pause"), i18n("Pause"), actionCollection()); actionCollection()->addAction("stop_menu", stopActionMenu); stopActionMenu->setDelayed(true); stopActionMenu->addAction(stopSelectedAction); stopActionMenu->addAction(stopAllAction); connect(stopActionMenu, SIGNAL(triggered()), SLOT(slotStopDownload())); KAction *openDestAction = actionCollection()->addAction("transfer_open_dest"); openDestAction->setText(i18n("Open Destination")); openDestAction->setIcon(KIcon("document-open")); connect(openDestAction, SIGNAL(triggered()), SLOT(slotTransfersOpenDest())); KAction *openFileAction = actionCollection()->addAction("transfer_open_file"); openFileAction->setText(i18n("Open File")); openFileAction->setIcon(KIcon("document-open")); connect(openFileAction, SIGNAL(triggered()), SLOT(slotTransfersOpenFile())); KAction *showDetailsAction = new KToggleAction(KIcon("document-properties"), i18n("Show Details"), actionCollection()); actionCollection()->addAction("transfer_show_details", showDetailsAction); connect(showDetailsAction, SIGNAL(triggered()), SLOT(slotTransfersShowDetails())); KAction *copyUrlAction = actionCollection()->addAction("transfer_copy_source_url"); copyUrlAction->setText(i18n("Copy URL to Clipboard")); copyUrlAction->setIcon(KIcon("edit-copy")); connect(copyUrlAction, SIGNAL(triggered()), SLOT(slotTransfersCopySourceUrl())); KAction *transferHistoryAction = actionCollection()->addAction("transfer_history"); transferHistoryAction->setText(i18n("&Transfer History")); transferHistoryAction->setIcon(KIcon("view-history")); transferHistoryAction->setShortcuts(KShortcut("Ctrl+H")); connect(transferHistoryAction, SIGNAL(triggered()), SLOT(slotTransferHistory())); KAction *transferGroupSettingsAction = actionCollection()->addAction("transfer_group_settings"); transferGroupSettingsAction->setText(i18n("&Group Settings")); transferGroupSettingsAction->setIcon(KIcon("preferences-system")); transferGroupSettingsAction->setShortcuts(KShortcut("Ctrl+G")); connect(transferGroupSettingsAction, SIGNAL(triggered()), SLOT(slotTransferGroupSettings())); KAction *transferSettingsAction = actionCollection()->addAction("transfer_settings"); transferSettingsAction->setText(i18n("&Transfer Settings")); transferSettingsAction->setIcon(KIcon("preferences-system")); transferSettingsAction->setShortcuts(KShortcut("Ctrl+T")); connect(transferSettingsAction, SIGNAL(triggered()), SLOT(slotTransferSettings())); KAction *listLinksAction = actionCollection()->addAction("import_links"); listLinksAction->setText(i18n("Import &Links...")); listLinksAction->setIcon(KIcon("view-list-text")); listLinksAction->setShortcuts(KShortcut("Ctrl+L")); connect(listLinksAction, SIGNAL(triggered()), SLOT(slotShowListLinks())); //create the download finished actions which can be displayed in the toolbar KSelectAction *downloadFinishedActions = new KSelectAction(i18n("After downloads finished action"), this);//TODO maybe with name?? actionCollection()->addAction("download_finished_actions", downloadFinishedActions); downloadFinishedActions->setHelpText(i18n("Choose an action that is executed after all downloads have been finished.")); KAction *noAction = downloadFinishedActions->addAction(i18n("No Action")); connect(noAction, SIGNAL(triggered()), SLOT(slotDownloadFinishedActions())); downloadFinishedActions->addAction(noAction); KAction *quitAction = downloadFinishedActions->addAction(i18n("Quit KGet")); quitAction->setData(KGet::Quit); connect(quitAction, SIGNAL(triggered()), SLOT(slotDownloadFinishedActions())); downloadFinishedActions->addAction(quitAction); #ifdef HAVE_KWORKSPACE KAction *shutdownAction = downloadFinishedActions->addAction(i18n("Turn Off Computer")); shutdownAction->setData(KGet::Shutdown); connect(shutdownAction, SIGNAL(triggered()), SLOT(slotDownloadFinishedActions())); downloadFinishedActions->addAction(shutdownAction); KAction *hibernateAction = downloadFinishedActions->addAction(i18n("Hibernate Computer")); hibernateAction->setData(KGet::Hibernate); connect(hibernateAction, SIGNAL(triggered()), SLOT(slotDownloadFinishedActions())); downloadFinishedActions->addAction(hibernateAction); KAction *suspendAction = downloadFinishedActions->addAction(i18n("Suspend Computer")); suspendAction->setData(KGet::Suspend); connect(suspendAction, SIGNAL(triggered()), SLOT(slotDownloadFinishedActions())); downloadFinishedActions->addAction(suspendAction); #endif if (Settings::afterFinishActionEnabled()) { downloadFinishedActions->setCurrentItem(Settings::afterFinishAction() + 1); } else { downloadFinishedActions->setCurrentItem(0); } }
void MonitorManager::setupActions() { KDualAction *playAction = new KDualAction(i18n("Play"), i18n("Pause"), this); playAction->setInactiveIcon(QIcon::fromTheme("media-playback-start")); playAction->setActiveIcon(QIcon::fromTheme("media-playback-pause")); playAction->setShortcut(Qt::Key_Space); pCore->window()->addAction("monitor_play", playAction); connect(playAction, &QAction::triggered, this, &MonitorManager::slotPlay); QAction * monitorPause = new QAction(QIcon::fromTheme("media-playback-stop"), i18n("Pause"), this); monitorPause->setShortcut(Qt::Key_K); pCore->window()->addAction("monitor_pause", monitorPause); connect(monitorPause, &QAction::triggered, this, &MonitorManager::slotPause); // TODO: port later when we are able to setup the monitor menus from this class // m_playZone = new QAction(QIcon::fromTheme("media-playback-start"), i18n("Play Zone"), this); // m_playZone->setShortcut(Qt::CTRL + Qt::Key_Space); // pCore->window()->addAction("monitor_play_zone", m_playZone); // connect(m_playZone, SIGNAL(triggered(bool)), SLOT(slotPlayZone())); // // m_loopZone = new QAction(QIcon::fromTheme("media-playback-start"), i18n("Loop Zone"), this); // m_loopZone->setShortcut(Qt::ALT + Qt::Key_Space); // pCore->window()->addAction("monitor_loop_zone", m_loopZone); // connect(m_loopZone, SIGNAL(triggered(bool)), SLOT(slotLoopZone())); QAction *fullMonitor = new QAction(i18n("Switch monitor fullscreen"), this); fullMonitor->setIcon(QIcon::fromTheme("view-fullscreen")); pCore->window()->addAction("monitor_fullscreen", fullMonitor); connect(fullMonitor, &QAction::triggered, this, &MonitorManager::slotSwitchFullscreen); QAction * monitorSeekBackward = new QAction(QIcon::fromTheme("media-seek-backward"), i18n("Rewind"), this); monitorSeekBackward->setShortcut(Qt::Key_J); pCore->window()->addAction("monitor_seek_backward", monitorSeekBackward); connect(monitorSeekBackward, SIGNAL(triggered(bool)), SLOT(slotRewind())); QAction * monitorSeekBackwardOneFrame = new QAction(QIcon::fromTheme("media-skip-backward"), i18n("Rewind 1 Frame"), this); monitorSeekBackwardOneFrame->setShortcut(Qt::Key_Left); pCore->window()->addAction("monitor_seek_backward-one-frame", monitorSeekBackwardOneFrame); connect(monitorSeekBackwardOneFrame, &QAction::triggered, this, &MonitorManager::slotRewindOneFrame); QAction * monitorSeekBackwardOneSecond = new QAction(QIcon::fromTheme("media-skip-backward"), i18n("Rewind 1 Second"), this); monitorSeekBackwardOneSecond->setShortcut(Qt::SHIFT + Qt::Key_Left); pCore->window()->addAction("monitor_seek_backward-one-second", monitorSeekBackwardOneSecond); connect(monitorSeekBackwardOneSecond, &QAction::triggered, this, &MonitorManager::slotRewindOneSecond); QAction * monitorSeekForward = new QAction(QIcon::fromTheme("media-seek-forward"), i18n("Forward"), this); monitorSeekForward->setShortcut(Qt::Key_L); pCore->window()->addAction("monitor_seek_forward", monitorSeekForward); connect(monitorSeekForward, SIGNAL(triggered(bool)), SLOT(slotForward())); QAction * projectStart = new QAction(QIcon::fromTheme("go-first"), i18n("Go to Project Start"), this); projectStart->setShortcut(Qt::CTRL + Qt::Key_Home); pCore->window()->addAction("seek_start", projectStart); connect(projectStart, &QAction::triggered, this, &MonitorManager::slotStart); QAction * projectEnd = new QAction(QIcon::fromTheme("go-last"), i18n("Go to Project End"), this); projectEnd->setShortcut(Qt::CTRL + Qt::Key_End); pCore->window()->addAction("seek_end", projectEnd); connect(projectEnd, &QAction::triggered, this, &MonitorManager::slotEnd); QAction * monitorSeekForwardOneFrame = new QAction(QIcon::fromTheme("media-skip-forward"), i18n("Forward 1 Frame"), this); monitorSeekForwardOneFrame->setShortcut(Qt::Key_Right); pCore->window()->addAction("monitor_seek_forward-one-frame", monitorSeekForwardOneFrame); connect(monitorSeekForwardOneFrame, &QAction::triggered, this, &MonitorManager::slotForwardOneFrame); QAction * monitorSeekForwardOneSecond = new QAction(QIcon::fromTheme("media-skip-forward"), i18n("Forward 1 Second"), this); monitorSeekForwardOneSecond->setShortcut(Qt::SHIFT + Qt::Key_Right); pCore->window()->addAction("monitor_seek_forward-one-second", monitorSeekForwardOneSecond); connect(monitorSeekForwardOneSecond, &QAction::triggered, this, &MonitorManager::slotForwardOneSecond); KSelectAction *interlace = new KSelectAction(i18n("Deinterlacer"), this); interlace->addAction(i18n("One Field (fast)")); interlace->addAction(i18n("Linear Blend (fast)")); interlace->addAction(i18n("YADIF - temporal only (good)")); interlace->addAction(i18n("YADIF - temporal + spacial (best)")); if (KdenliveSettings::mltdeinterlacer() == "linearblend") interlace->setCurrentItem(1); else if (KdenliveSettings::mltdeinterlacer() == "yadif-temporal") interlace->setCurrentItem(2); else if (KdenliveSettings::mltdeinterlacer() == "yadif") interlace->setCurrentItem(3); else interlace->setCurrentItem(0); pCore->window()->addAction("mlt_interlace", interlace); connect(interlace, static_cast<void (KSelectAction::*)(int)>(&KSelectAction::triggered), this, &MonitorManager::slotSetDeinterlacer); KSelectAction *interpol = new KSelectAction(i18n("Interpolation"), this); interpol->addAction(i18n("Nearest Neighbor (fast)")); interpol->addAction(i18n("Bilinear (good)")); interpol->addAction(i18n("Bicubic (better)")); interpol->addAction(i18n("Hyper/Lanczos (best)")); if (KdenliveSettings::mltinterpolation() == "bilinear") interpol->setCurrentItem(1); else if (KdenliveSettings::mltinterpolation() == "bicubic") interpol->setCurrentItem(2); else if (KdenliveSettings::mltinterpolation() == "hyper") interpol->setCurrentItem(3); else interpol->setCurrentItem(0); pCore->window()->addAction("mlt_interpolation", interpol); connect(interpol, static_cast<void (KSelectAction::*)(int)>(&KSelectAction::triggered), this, &MonitorManager::slotSetInterpolation); QAction * zoneStart = new QAction(QIcon::fromTheme("media-seek-backward"), i18n("Go to Zone Start"), this); zoneStart->setShortcut(Qt::SHIFT + Qt::Key_I); pCore->window()->addAction("seek_zone_start", zoneStart); connect(zoneStart, &QAction::triggered, this, &MonitorManager::slotZoneStart); m_muteAction = new KDualAction(i18n("Mute monitor"), i18n("Unmute monitor"), this); m_muteAction->setActiveIcon(QIcon::fromTheme("audio-volume-medium")); m_muteAction->setInactiveIcon(QIcon::fromTheme("audio-volume-muted")); pCore->window()->addAction("mlt_mute", m_muteAction); connect(m_muteAction, SIGNAL(activeChanged(bool)), this, SLOT(slotMuteCurrentMonitor(bool))); QAction * zoneEnd = new QAction(QIcon::fromTheme("media-seek-forward"), i18n("Go to Zone End"), this); zoneEnd->setShortcut(Qt::SHIFT + Qt::Key_O); pCore->window()->addAction("seek_zone_end", zoneEnd); connect(zoneEnd, &QAction::triggered, this, &MonitorManager::slotZoneEnd); QAction *markIn = new QAction(QIcon::fromTheme("go-first"), i18n("Set Zone In"), this); markIn->setShortcut(Qt::Key_I); pCore->window()->addAction("mark_in", markIn); connect(markIn, &QAction::triggered, this, &MonitorManager::slotSetInPoint); QAction *markOut = new QAction(QIcon::fromTheme("go-last"), i18n("Set Zone Out"), this); markOut->setShortcut(Qt::Key_O); pCore->window()-> addAction("mark_out", markOut); connect(markOut, &QAction::triggered, this, &MonitorManager::slotSetOutPoint); }