//moved from KFormDesigner::FormManager void KexiFormManager::createActions(KActionCollection* collection) { d->collection = collection; // KXMLGUIClient* client = (KXMLGUIClient*)d->collection->parentGUIClient(); d->lib->createWidgetActions(d->widgetActionGroup); //! @todo insertWidget() slot? //2.0 d->lib->createWidgetActions(client, d->collection, //2.0 this, SLOT(insertWidget(const QByteArray &))); #ifdef KFD_SIGSLOTS if (d->features & KFormDesigner::Form::EnableConnections) { // nothing } else { d->dragConnectionAction = new KToggleAction( KIcon("signalslot"), i18n("Connect Signals/Slots"), d->collection); d->dragConnectionAction->setObjectName("drag_connection"); // d->widgetActionGroup->addAction(d->dragConnectionAction); connect(d->dragConnectionAction, SIGNAL(triggered()), this, SLOT(startCreatingConnection())); d->dragConnectionAction->setChecked(false); } #endif d->pointerAction = new KToggleAction( KIcon("mouse_pointer"), i18n("Pointer"), d->collection); d->pointerAction->setObjectName("edit_pointer"); d->widgetActionGroup->addAction(d->pointerAction); connect(d->pointerAction, SIGNAL(triggered()), this, SLOT(slotPointerClicked())); d->pointerAction->setChecked(true); d->snapToGridAction = new KToggleAction( i18n("Snap to Grid"), d->collection); d->snapToGridAction->setObjectName("snap_to_grid"); // d->widgetActionGroup->addAction(d->snapToGridAction); // d->snapToGridAction->setChecked(true); #if 0 // 2.0: todo // Create the Style selection action (with a combo box in toolbar and submenu items) KSelectAction *styleAction = new KSelectAction( i18n("Style"), d->collection); styleAction->setObjectName("change_style"); connect(styleAction, SIGNAL(triggered()), this, SLOT(slotStyle())); styleAction->setEditable(false); //js: unused? KGlobalGroup cg = KGlobal::config()->group("General"); QString currentStyle(kapp->style()->objectName().toLower()); const QStringList styles = QStyleFactory::keys(); styleAction->setItems(styles); styleAction->setCurrentItem(0); QStringList::ConstIterator endIt = styles.constEnd(); int idx = 0; for (QStringList::ConstIterator it = styles.constBegin(); it != endIt; ++it, ++idx) { if ((*it).toLower() == currentStyle) { styleAction->setCurrentItem(idx); break; } } styleAction->setToolTip(i18n("Set the current view style.")); styleAction->setMenuAccelsEnabled(true); #endif d->lib->addCustomWidgetActions(d->collection); #ifdef KEXI_DEBUG_GUI KConfigGroup generalGroup(KGlobal::config()->group("General")); if (generalGroup.readEntry("ShowInternalDebugger", false)) { KAction *a = new KAction(KIcon("run-build-file"), i18n("Show Form UI Code"), this); d->collection->addAction("show_form_ui", a); a->setShortcut(Qt::CTRL + Qt::Key_U); connect(a, SIGNAL(triggered()), this, SLOT(showFormUICode())); } #endif //! @todo move elsewhere { // (from obsolete kexiformpartinstui.rc) QStringList formActions; formActions << "edit_pointer" << QString() //sep #ifndef KEXI_NO_AUTOFIELD_WIDGET << ":library_widget_KexiDBAutoField" #endif << ":library_widget_KexiDBLabel" << ":library_widget_KexiDBImageBox" << ":library_widget_KexiDBLineEdit" << ":library_widget_KexiDBTextEdit" << ":library_widget_KPushButton" << ":library_widget_KexiDBComboBox" << ":library_widget_KexiDBCheckBox" #ifndef KEXI_NO_FORM_LAYOUTS << ":library_widget_Spacer" #endif << ":library_widget_Line" << ":library_widget_KexiFrame" << ":library_widget_QGroupBox" << ":library_widget_KFDTabWidget" #ifndef KEXI_NO_FORM_SPRING_ELEMENT << ":library_widget_Spring" #endif << QString() //sep ; KexiMainWindowIface *win = KexiMainWindowIface::global(); foreach( const QString& actionName_, formActions ) { QAction *a; const QString actionName(actionName_.startsWith(':') ? actionName_.mid(1) : actionName_); if (actionName.isEmpty()) { a = new QAction(this); a->setSeparator(true); } else { a = d->widgetActionGroup->action(actionName); } if (actionName_.startsWith(':')) { // icon only KexiSmallToolButton *btn = new KexiSmallToolButton(a, win->toolBar("form")); btn->setToolButtonStyle(Qt::ToolButtonIconOnly); win->appendWidgetToToolbar("form", btn); } else { win->addToolBarAction("form", a); } } QSet<QString> iconOnlyActions; iconOnlyActions << "widget_assign_action" << "show_form_ui"; const QList<QAction*> actions( d->collection->actions() ); foreach( QAction *a, actions ) { if (iconOnlyActions.contains(a->objectName())) { // icon only KexiSmallToolButton *btn = new KexiSmallToolButton(a, win->toolBar("form")); btn->setToolButtonStyle(Qt::ToolButtonIconOnly); win->appendWidgetToToolbar("form", btn); } else { win->addToolBarAction("form", a); } } }
// Setup the GUI void Mainwindow::initGUI() { QAction *action; // Start a new game action = KStandardGameAction::gameNew(this, SLOT(menuNewLSkatGame()), actionCollection()); if (global_demo_mode) action->setEnabled(false); // Clear all time statistics action = KStandardGameAction::clearStatistics(this, SLOT(menuClearStatistics()), actionCollection()); action->setWhatsThis(i18n("Clears the all time statistics which is kept in all sessions.")); if (global_demo_mode) action->setEnabled(false); // End a game action = KStandardGameAction::end(this, SLOT(menuEndGame()), actionCollection()); action->setWhatsThis(i18n("Ends a currently played game. No winner will be declared.")); action->setEnabled(false); // Quit the program action = KStandardGameAction::quit(this, SLOT(close()), actionCollection()); action->setWhatsThis(i18n("Quits the program.")); // Determine start player KSelectAction *startPlayerAct = new KSelectAction(i18n("Starting Player"), this); actionCollection()->addAction(QLatin1String("startplayer"), startPlayerAct); connect(startPlayerAct, SIGNAL(triggered(int)), this, SLOT(menuStartplayer())); startPlayerAct->setToolTip(i18n("Changing starting player...")); startPlayerAct->setWhatsThis(i18n("Chooses which player begins the next game.")); QStringList list; list.clear(); list.append(i18n("Player &1")); list.append(i18n("Player &2")); startPlayerAct->setItems(list); if (global_demo_mode) startPlayerAct->setEnabled(false); // Determine who player player 1 KSelectAction *player1Act = new KSelectAction(i18n("Player &1 Played By"), this); actionCollection()->addAction(QLatin1String("player1"), player1Act); connect(player1Act, SIGNAL(triggered(int)), this, SLOT(menuPlayer1By())); player1Act->setToolTip(i18n("Changing who plays player 1...")); player1Act->setWhatsThis(i18n("Changing who plays player 1.")); list.clear(); list.append(i18n("&Mouse")); list.append(i18n("&Computer")); player1Act->setItems(list); if (global_demo_mode) player1Act->setEnabled(false); // Determine who player player 2 KSelectAction *player2Act = new KSelectAction(i18n("Player &2 Played By"), this); actionCollection()->addAction(QLatin1String("player2"), player2Act); connect(player2Act, SIGNAL(triggered(int)), this, SLOT(menuPlayer2By())); player2Act->setToolTip(i18n("Changing who plays player 2...")); player2Act->setWhatsThis(i18n("Changing who plays player 2.")); player2Act->setItems(list); if (global_demo_mode) player2Act->setEnabled(false); // Add all theme files to the menu QStringList themes(mThemeFiles.keys()); themes.sort(); KSelectAction *themeAct = new KSelectAction(i18n("&Theme"), this); actionCollection()->addAction(QLatin1String("theme"), themeAct); themeAct->setItems(themes); connect(themeAct, SIGNAL(triggered(int)), SLOT(changeTheme(int))); if (global_debug > 0) kDebug() << "Setting current theme item to" << mThemeIndexNo; themeAct->setCurrentItem(mThemeIndexNo); themeAct->setToolTip(i18n("Changing theme...")); themeAct->setWhatsThis(i18n("Changing theme.")); // Choose card deck KAction *action1 = actionCollection()->addAction(QLatin1String("select_carddeck")); action1->setText(i18n("Select &Card Deck...")); action1->setShortcuts(KShortcut(Qt::Key_F10)); connect(action1, SIGNAL(triggered(bool)), this, SLOT(menuCardDeck())); action1->setToolTip(i18n("Configure card decks...")); action1->setWhatsThis(i18n("Choose how the cards should look.")); // Change player names action = actionCollection()->addAction(QLatin1String("change_names")); action->setText(i18n("&Change Player Names...")); connect(action, SIGNAL(triggered(bool)), this, SLOT(menuPlayerNames())); if (global_demo_mode) action->setEnabled(false); }
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); } }
/** * This function will intialize the playlist window. */ void PlaylistWindow::init() { DEBUG_BLOCK //this function is necessary because amaroK::actionCollection() returns our actionCollection //via the App::m_pPlaylistWindow pointer since App::m_pPlaylistWindow is not defined until //the above ctor returns it causes a crash unless we do the initialisation in 2 stages. m_browsers = new BrowserBar( this ); //<Dynamic Mode Status Bar /> DynamicBar *dynamicBar = new DynamicBar( m_browsers->container()); { //<Search LineEdit> KToolBar *bar = new KToolBar( m_browsers->container(), "NotMainToolBar" ); bar->setIconSize( 22, false ); //looks more sensible bar->setFlat( true ); //removes the ugly frame bar->setMovingEnabled( false ); //removes the ugly frame QWidget *button = new KToolBarButton( "locationbar_erase", 1, bar ); QLabel *filter_label = new QLabel( i18n("S&earch:") + " ", bar ); m_lineEdit = new ClickLineEdit( i18n( "Enter search terms here" ), bar ); filter_label->setBuddy( m_lineEdit ); bar->setStretchableWidget( m_lineEdit ); m_lineEdit->setFrame( QFrame::Sunken ); m_lineEdit->installEventFilter( this ); //we intercept keyEvents connect( button, SIGNAL(clicked()), m_lineEdit, SLOT(clear()) ); QToolTip::add( button, i18n( "Clear filter" ) ); QString filtertip = i18n( "Enter space-separated terms to filter the playlist.\n\n" "Advanced, Google-esque syntax is also available;\n" "see the handbook (The Playlist section of chapter 4) for details." ); QToolTip::add( filter_label, filtertip ); QToolTip::add( m_lineEdit, filtertip ); } //</Search LineEdit> QFrame *playlist = new Playlist( m_browsers->container() ); dynamicBar->init(); m_toolbar = new amaroK::ToolBar( m_browsers->container(), "mainToolBar" ); m_toolbar->setShown( AmarokConfig::showToolbar() ); QWidget *statusbar = new amaroK::StatusBar( this ); KAction* repeatAction = amaroK::actionCollection()->action( "repeat" ); connect( repeatAction, SIGNAL( activated( int ) ), playlist, SLOT( slotRepeatTrackToggled( int ) ) ); connect( m_lineEdit, SIGNAL(textChanged( const QString& )), playlist, SLOT(setFilterSlot( const QString& )) ); m_menubar = new KMenuBar( this ); m_menubar->setShown( AmarokConfig::showMenuBar() ); //BEGIN Actions menu KPopupMenu *actionsMenu = new KPopupMenu( m_menubar ); actionCollection()->action("playlist_playmedia")->plug( actionsMenu ); actionCollection()->action("play_audiocd")->plug( actionsMenu ); actionsMenu->insertSeparator(); actionCollection()->action("prev")->plug( actionsMenu ); actionCollection()->action("play_pause")->plug( actionsMenu ); actionCollection()->action("stop")->plug( actionsMenu ); actionCollection()->action("next")->plug( actionsMenu ); actionsMenu->insertSeparator(); actionCollection()->action(KStdAction::name(KStdAction::Quit))->plug( actionsMenu ); connect( actionsMenu, SIGNAL( aboutToShow() ), SLOT( actionsMenuAboutToShow() ) ); //END Actions menu //BEGIN Playlist menu KPopupMenu *playlistMenu = new KPopupMenu( m_menubar ); actionCollection()->action("playlist_add")->plug( playlistMenu ); actionCollection()->action("playlist_save")->plug( playlistMenu ); playlistMenu->insertSeparator(); actionCollection()->action("playlist_undo")->plug( playlistMenu ); actionCollection()->action("playlist_redo")->plug( playlistMenu ); playlistMenu->insertSeparator(); actionCollection()->action("playlist_clear")->plug( playlistMenu ); actionCollection()->action("playlist_shuffle")->plug( playlistMenu ); actionCollection()->action("playlist_show")->plug( playlistMenu ); //this one has no real context with regard to the menu //actionCollection()->action("playlist_copy")->plug( playlistMenu ); playlistMenu->insertSeparator(); actionCollection()->action("queue_selected")->plug( playlistMenu ); actionCollection()->action("playlist_remove_duplicates")->plug( playlistMenu ); actionCollection()->action("playlist_select_all")->plug( playlistMenu ); //END Playlist menu //BEGIN Mode menu KPopupMenu *modeMenu = new KPopupMenu( m_menubar ); actionCollection()->action("repeat")->plug( modeMenu ); KSelectAction *random = static_cast<KSelectAction*>( actionCollection()->action("random_mode") ); random->plug( modeMenu ); random->popupMenu()->insertSeparator(); actionCollection()->action("favor_tracks")->plug( random->popupMenu() ); //END Mode menu //BEGIN Tools menu m_toolsMenu = new KPopupMenu( m_menubar ); m_toolsMenu->insertItem( SmallIconSet( "covermanager" ), i18n("&Cover Manager"), amaroK::Menu::ID_SHOW_COVER_MANAGER ); actionCollection()->action("queue_manager")->plug( m_toolsMenu ); m_toolsMenu->insertItem( SmallIconSet( "visualizations"), i18n("&Visualizations"), amaroK::Menu::ID_SHOW_VIS_SELECTOR ); m_toolsMenu->insertItem( SmallIconSet( "equalizer"), i18n("&Equalizer"), kapp, SLOT( slotConfigEqualizer() ), 0, amaroK::Menu::ID_CONFIGURE_EQUALIZER ); actionCollection()->action("script_manager")->plug( m_toolsMenu ); actionCollection()->action("statistics")->plug( m_toolsMenu ); m_toolsMenu->insertSeparator(); m_toolsMenu->insertItem( SmallIconSet( "wizard"), i18n("&First-Run Wizard"), amaroK::Menu::ID_SHOW_WIZARD ); m_toolsMenu->insertItem( SmallIconSet( amaroK::icon( "rescan" ) ), i18n("&Rescan Collection"), amaroK::Menu::ID_RESCAN_COLLECTION ); #if defined HAVE_XMMS || defined HAVE_LIBVISUAL m_toolsMenu->setItemEnabled( amaroK::Menu::ID_SHOW_VIS_SELECTOR, true ); #else m_toolsMenu->setItemEnabled( amaroK::Menu::ID_SHOW_VIS_SELECTOR, false ); #endif connect( m_toolsMenu, SIGNAL( aboutToShow() ), SLOT( toolsMenuAboutToShow() ) ); connect( m_toolsMenu, SIGNAL( activated(int) ), SLOT( slotMenuActivated(int) ) ); //END Tools menu //BEGIN Settings menu m_settingsMenu = new KPopupMenu( m_menubar ); //TODO use KStdAction or KMainWindow static_cast<KToggleAction *>(actionCollection()->action(KStdAction::name(KStdAction::ShowMenubar)))->setChecked( AmarokConfig::showMenuBar() ); actionCollection()->action(KStdAction::name(KStdAction::ShowMenubar))->plug( m_settingsMenu ); m_settingsMenu->insertItem( AmarokConfig::showToolbar() ? i18n( "Hide Toolbar" ) : i18n("Show Toolbar"), ID_SHOW_TOOLBAR ); m_settingsMenu->insertItem( AmarokConfig::showPlayerWindow() ? i18n("Hide Player &Window") : i18n("Show Player &Window"), ID_SHOW_PLAYERWINDOW ); m_settingsMenu->insertSeparator(); actionCollection()->action("options_configure_globals")->plug( m_settingsMenu ); actionCollection()->action(KStdAction::name(KStdAction::KeyBindings))->plug( m_settingsMenu ); actionCollection()->action(KStdAction::name(KStdAction::ConfigureToolbars))->plug( m_settingsMenu ); actionCollection()->action(KStdAction::name(KStdAction::Preferences))->plug( m_settingsMenu ); connect( m_settingsMenu, SIGNAL( activated(int) ), SLOT( slotMenuActivated(int) ) ); //END Settings menu m_menubar->insertItem( i18n( "&Actions" ), actionsMenu ); m_menubar->insertItem( i18n( "&Playlist" ), playlistMenu ); m_menubar->insertItem( i18n( "&Mode" ), modeMenu ); m_menubar->insertItem( i18n( "&Tools" ), m_toolsMenu ); m_menubar->insertItem( i18n( "&Settings" ), m_settingsMenu ); m_menubar->insertItem( i18n( "&Help" ), amaroK::Menu::helpMenu() ); QBoxLayout *layV = new QVBoxLayout( this ); layV->addWidget( m_menubar ); layV->addWidget( m_browsers, 1 ); layV->addWidget( m_toolbar ); layV->addSpacing( 2 ); layV->addWidget( statusbar ); //The volume slider later becomes our FocusProxy, so all wheelEvents get redirected to it m_toolbar->setFocusPolicy( QWidget::WheelFocus ); m_toolbar->setFlat( true ); m_toolbar->setMovingEnabled( false ); playlist->setMargin( 2 ); playlist->installEventFilter( this ); //we intercept keyEvents //<XMLGUI> { QString xmlFile = amaroK::config()->readEntry( "XMLFile", "amarokui.rc" ); if ( xmlFile == "amarokui_first.rc" ) // this bug can bite you if you are a pre 1.2 user, we // deleted amarokui_first.rc, but we must still support it xmlFile = "amarokui.rc"; setXMLFile( xmlFile ); createGUI(); //NOTE we implement this } //</XMLGUI> //<Browsers> { Debug::Block block( "Creating browsers. Please report long start times!" ); #define addBrowserMacro( Type, name, text, icon ) { \ Debug::Block block( name ); \ m_browsers->addBrowser( new Type( name ), text, icon ); } #define addInstBrowserMacro( Type, name, text, icon ) { \ Debug::Block block( name ); \ m_browsers->addBrowser( Type::instance(), text, icon ); } addBrowserMacro( ContextBrowser, "ContextBrowser", i18n( "Context" ), amaroK::icon( "info" ) ) addBrowserMacro( CollectionBrowser, "CollectionBrowser", i18n( "Collection" ), amaroK::icon( "collection" ) ) addInstBrowserMacro( PlaylistBrowser, "PlaylistBrowser", i18n( "Playlists" ), amaroK::icon( "playlist" ) ) //DEBUG: Comment out the addBrowserMacro line and uncomment the m_browsers line (passing in a vfat device name) to see the "virtual root" functionality addBrowserMacro( FileBrowser, "FileBrowser", i18n( "Files" ), "folder" ) //m_browsers->addBrowser( new FileBrowser( "FileBrowser", DeviceManager::instance()->getDevice( "hda5" ) ), i18n( "Files" ), "folder" ); new MediaBrowser( "MediaBrowser" ); if( MediaBrowser::isAvailable() ) addInstBrowserMacro( MediaBrowser, "MediaBrowser", i18n( "Media Device" ), amaroK::icon( "device" ) ) #undef addBrowserMacro #undef addInstBrowserMacro } //</Browsers> connect( Playlist::instance()->qscrollview(), SIGNAL( dynamicModeChanged( const DynamicMode* ) ), PlaylistBrowser::instance(), SLOT( loadDynamicItems() ) ); qApp->installEventFilter( this ); // keyboards shortcuts for the browsers connect( playlist, SIGNAL( itemCountChanged( int, int, int, int, int, int ) ), statusbar, SLOT( slotItemCountChanged( int, int, int, int, int, int ) ) ); connect( playlist, SIGNAL( queueChanged( const PLItemList &, const PLItemList & ) ), statusbar, SLOT( updateQueueLabel() ) ); connect( playlist, SIGNAL( aboutToClear() ), m_lineEdit, SLOT( clear() ) ); amaroK::MessageQueue::instance()->sendMessages(); }
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); }