void TravelWorkbench::initActions()
{
   BEGIN;

   CoaAction *action;

   //action = GETACTION (CoaDefaultActions::actionApplicationSettings);
   //QObject::connect (action, SIGNAL(triggered()), this, SLOT(slotFileNewContact()));

   action = GETACTION (CoaDefaultActions::actionFileNew);
   QObject::connect (action, SIGNAL(triggered()), this, SLOT(slotFileNew()));

   action = GETACTION (CoaDefaultActions::actionFileOpen);
   QObject::connect (action, SIGNAL(triggered()), this, SLOT(slotFileOpen()));

   action = GETACTION (CoaDefaultActions::actionFileSave);
   QObject::connect (action, SIGNAL(triggered()), this, SLOT(slotFileSave()));

   action = GETACTION (CoaDefaultActions::actionFileSaveAs);
   QObject::connect (action, SIGNAL(triggered()), this, SLOT(slotFileSaveAs()));

   action = GETACTION (CoaDefaultActions::actionFileSaveAll);
   QObject::connect (action, SIGNAL(triggered()), this, SLOT(slotFileSaveAll()));

   action = GETACTION (CoaDefaultActions::actionFileClose);
   QObject::connect (action, SIGNAL(triggered()), this, SLOT(slotFileClose()));

   action = GETACTION (CoaDefaultActions::actionFileCloseAll);
   QObject::connect (action, SIGNAL(triggered()), this, SLOT(slotFileCloseAll()));

   action = 0;
}
Esempio n. 2
0
void KompareShell::setupActions()
{
	QAction *a;
	a = actionCollection()->addAction(KStandardAction::Open, this, SLOT(slotFileOpen()));
	a->setText( i18n( "&Open Diff..." ) );
	a = actionCollection()->addAction("file_compare_files", this, SLOT(slotFileCompareFiles()));
	a->setIcon(QIcon::fromTheme("document-open"));
	a->setText(i18n("&Compare Files..."));
	actionCollection()->setDefaultShortcut(a, QKeySequence(Qt::CTRL + Qt::Key_C));
	a = actionCollection()->addAction("file_blend_url", this, SLOT(slotFileBlendURLAndDiff()));
	a->setText(i18n("&Blend URL with Diff..."));
	actionCollection()->setDefaultShortcut(a, QKeySequence(Qt::CTRL + Qt::Key_B));
	actionCollection()->addAction(KStandardAction::Quit, this, SLOT( slotFileClose() ));

	createStandardStatusBarAction();
	setStandardToolBarMenuEnabled(true);
	m_showTextView = new KToggleAction(i18n("Show T&ext View"), this);
// needs a KGuiItem, also the doc says explicitly not to do this
//	m_showTextView->setCheckedState(i18n("Hide T&ext View"));
	actionCollection()->addAction("options_show_text_view", m_showTextView);
	connect(m_showTextView, SIGNAL(triggered(bool)), SLOT(slotShowTextView()));

	KStandardAction::keyBindings(this, SLOT(optionsConfigureKeys()), actionCollection());
	KStandardAction::configureToolbars(this, SLOT(optionsConfigureToolbars()), actionCollection());
}
Esempio n. 3
0
void KVerbosApp::initActions()
{
  fileNewWindow = new KAction(i18n("New &Window"), "window_new.png", 0, this, SLOT(slotFileNewWindow()), actionCollection(),"file_new_window");
  fileNew = KStdAction::openNew(this, SLOT(slotFileNew()), actionCollection());
  fileOpen = KStdAction::open(this, SLOT(slotFileOpen()), actionCollection());
  fileOpenRecent = KStdAction::openRecent(this, SLOT(slotFileOpenRecent(const KURL&)), actionCollection());
  fileOpenStandard = new KAction(i18n("Open &Standard Verb File"), "fileopen.png", 0, this, SLOT(slotFileOpenStandard()), actionCollection(),"file_open_standard");
  fileSave = KStdAction::save(this, SLOT(slotFileSave()), actionCollection());
  fileSaveAs = KStdAction::saveAs(this, SLOT(slotFileSaveAs()), actionCollection());
  fileClose = KStdAction::close(this, SLOT(slotFileClose()), actionCollection());
  filePrint = KStdAction::print(this, SLOT(slotFilePrint()), actionCollection());
  fileQuit = KStdAction::quit(this, SLOT(slotFileQuit()), actionCollection());
  editCut = KStdAction::cut(this, SLOT(slotEditCut()), actionCollection());
  editCopy = KStdAction::copy(this, SLOT(slotEditCopy()), actionCollection());
  editPaste = KStdAction::paste(this, SLOT(slotEditPaste()), actionCollection());
  editErfassen = new KAction(i18n("E&nter New Verb..."), 0, 0, this, SLOT(slotEditErfassen()), actionCollection(),"edit_erfassen");
  editBearbeiten = new KAction(i18n("&Edit Verb List..."), 0, 0, this, SLOT(slotEditBearbeiten()), actionCollection(), "edit_bearbeiten");

  settingOptions = new KAction(i18n("&Configure KVerbos..."), 0, 0, this, SLOT(slotSettingsOptions()), actionCollection(), "settings_options");
  userUsername = new KAction(i18n("&Username..."), 0, 0, this, SLOT(slotSettingsUsername()), actionCollection(), "user_username");
  userResults = new KAction(i18n("&Results"), 0, 0, this, SLOT(slotUserResults()), actionCollection(), "user_results");
 
  fileNewWindow->setToolTip(i18n("Opens a new application window"));
  fileOpenStandard->setToolTip(i18n("Opens the standard KVerbos verb file"));
  fileNew->setToolTip(i18n("Creates a new document"));
  fileOpen->setToolTip(i18n("Opens an existing document"));
  fileOpenRecent->setToolTip(i18n("Opens a recently used file"));
  fileSave->setToolTip(i18n("Saves the actual document"));
  fileSaveAs->setToolTip(i18n("Saves the actual document as..."));
  fileClose->setToolTip(i18n("Closes the actual document"));
  filePrint ->setToolTip(i18n("Prints out the actual document"));
  fileQuit->setToolTip(i18n("Quits the application"));
  editCut->setToolTip(i18n("Cuts the selected section and puts it to the clipboard"));
  editCopy->setToolTip(i18n("Copies the selected section to the clipboard"));
  editPaste->setToolTip(i18n("Pastes the clipboard contents to actual position"));
  editErfassen->setToolTip(i18n("Add new verbs."));
  editBearbeiten->setToolTip(i18n("Edit the list of verbs."));
  settingOptions->setToolTip(i18n("Change some options of the program"));
  userUsername->setToolTip(i18n("Enter your name as the username"));
  userResults->setToolTip(i18n("These are your latest results."));

  // icons
  editBearbeiten->setIcon("edit.png");
  editErfassen->setIcon("editclear.png");
  settingOptions->setIcon("configure.png");
  userUsername->setIcon("kverbosuser.png");
  userResults->setIcon("kverbosuser.png");
  
  setupGUI();
}
/**
 * closes this MDI window.
 *
 * @param force Disable cancel button (demo versions)
 * @param ask Ask user before closing.
 */
bool QC_MDIWindow::closeMDI(bool force, bool ask) {
    // should never happen:
    if (document==NULL) {
        return true;
    }

    bool ret = false;

    bool isBlock = (parentWindow!=NULL);

    // This is a block and we don't need to ask the user for closing
    //   since it's still available in the parent drawing after closing.
    if (isBlock) {
        RS_DEBUG->print("  closing block");
        // tell parent window we're not here anymore.
        if (parentWindow!=NULL) {
            RS_DEBUG->print("    notifying parent about closing this window");
            parentWindow->removeChildWindow(this);
        }
        emit(signalClosing());
        ret = true;
    }

    // This is a graphic document. ask user for closing.
    else if (!ask || slotFileClose(force)) {
        RS_DEBUG->print("  closing graphic");
        // close all child windows:
        bool done;
        do {
            done=true;
            if (childWindows.at(0)!=NULL) {
                childWindows.at(0)->close();
                done=false;
            }
        } while (!done);

        emit(signalClosing());

        ret = true;
    }

    // User decided not to close graphic document:
    else {
        ret = false;
    }

    return (ret || force);
}
Esempio n. 5
0
/**
 * closes this MDI window.
 *
 * @param force Disable cancel button (demo versions)
 * @param ask Ask user before closing.
 */
bool QC_MDIWindow::closeMDI(bool force, bool ask)
{
    RS_DEBUG->print("QC_MDIWindow::closeMDI begin");
    // should never happen:
    if (document==NULL) {
        return true;
    }

    bool ret = false;

    // This is a block and we don't need to ask the user for closing
    //   since it's still available in the parent drawing after closing.
    if (parentWindow)
    {
        RS_DEBUG->print("  closing block");
        RS_DEBUG->print("  notifying parent about closing this window");
        parentWindow->removeChildWindow(this);
        emit(signalClosing(this));
        ret = true;
    }

    // This is a graphic document. ask user for closing.
    else if (!ask || slotFileClose(force)) {
        RS_DEBUG->print("  closing graphic");

        emit(signalClosing(this));

        if (childWindows.length() > 0)
        {
            for(auto p: childWindows)
            {
                cadMdiArea->removeSubWindow(p);
                p->close();
            }
		childWindows.clear();
        }

        ret = true;
    }

    // User decided not to close graphic document:
    else {
        ret = false;
    }

    return (ret || force);
}
Esempio n. 6
0
void JuffEd::initActions() {
	CommandStorageInt* st = Juff::Utils::commandStorage();
	
	st->addAction(FILE_NEW,         tr("&New"),     this, SLOT(slotFileNew()));
	st->addAction(FILE_OPEN,        tr("&Open"),    this, SLOT(slotFileOpen()));
	st->addAction(FILE_SAVE,        tr("&Save"),    this, SLOT(slotFileSave()));
	st->addAction(FILE_SAVE_AS,     tr("Save as"), this, SLOT(slotFileSaveAs()));
	st->addAction(FILE_SAVE_ALL,    tr("Save all"), this, SLOT(slotFileSaveAll()));
	st->addAction(FILE_RELOAD,      tr("&Reload"),  this, SLOT(slotFileReload()));
	st->addAction(FILE_RENAME,      tr("Rename"),  this, SLOT(slotFileRename()));
	st->addAction(FILE_CLOSE,       tr("Close"),  this, SLOT(slotFileClose()));
	st->addAction(FILE_CLOSE_ALL,   tr("Close All"),  this, SLOT(slotFileCloseAll()));
	st->addAction(FILE_PRINT,       tr("&Print"),  this, SLOT(slotFilePrint()));
	st->addAction(FILE_EXIT,        tr("Exit"),  this, SLOT(slotFileExit()));
	
	st->addAction(SESSION_NEW,      tr("New session"), this, SLOT(slotSessionNew()));
	st->addAction(SESSION_OPEN,     tr("Open session"), this, SLOT(slotSessionOpen()));
	st->addAction(SESSION_SAVE,     tr("Save session as..."), this, SLOT(slotSessionSaveAs()));
	
	st->addAction(EDIT_UNDO,        tr("Undo"), this, SLOT(slotEditUndo()));
	st->addAction(EDIT_REDO,        tr("Redo"), this, SLOT(slotEditRedo()));
	st->addAction(EDIT_CUT,         tr("Cut"), this, SLOT(slotEditCut()));
	st->addAction(EDIT_COPY,        tr("Copy"), this, SLOT(slotEditCopy()));
	st->addAction(EDIT_PASTE,       tr("Paste"), this, SLOT(slotEditPaste()));
	
	st->addAction(SEARCH_FIND,      tr("Find"), this, SLOT(slotFind()));
	st->addAction(SEARCH_FIND_NEXT, tr("Find next"), this, SLOT(slotFindNext()));
	st->addAction(SEARCH_FIND_PREV, tr("Find previous"), this, SLOT(slotFindPrev()));
	st->addAction(SEARCH_REPLACE,   tr("Replace"), this, SLOT(slotReplace()));
	st->addAction(SEARCH_GOTO_LINE, tr("Go to line"), this, SLOT(slotGotoLine()));
	st->addAction(SEARCH_GOTO_FILE, tr("Go to file"), this, SLOT(slotGotoFile()));
	
	st->addAction(VIEW_ZOOM_IN,      tr("Zoom In"), this, SLOT(slotZoomIn()));
	st->addAction(VIEW_ZOOM_OUT,     tr("Zoom Out"), this, SLOT(slotZoomOut()));
	st->addAction(VIEW_ZOOM_100,     tr("Zoom 100%"), this, SLOT(slotZoom100()));
	st->addAction(VIEW_FULLSCREEN,   tr("Fullscreen"), this, SLOT(slotFullscreen()));
	
	st->addAction(TOOLS_SETTINGS,    tr("Settings"), this, SLOT(slotSettings()));
	st->addAction(HELP_ABOUT,        tr("About"), mw_, SLOT(slotAbout()));
	st->addAction(HELP_ABOUT_QT,     tr("About Qt"), mw_, SLOT(slotAboutQt()));
}
Esempio n. 7
0
bool KateAppCommands::exec(KTextEditor::View *view, const QString &cmd, QString &msg)
{
    QStringList args(cmd.split( QRegExp("\\s+"), QString::SkipEmptyParts)) ;
    QString command( args.takeFirst() );

    KateMainWindow *mainWin = KateApp::self()->activeMainWindow();

    if (re_write.exactMatch(command)) {  //TODO: handle writing to specific file
        if (!re_write.cap(1).isEmpty()) { // [a]ll
            KateDocManager::self()->saveAll();
            msg = i18n("All documents written to disk");
        } else {
            view->document()->documentSave();
            msg = i18n("Document written to disk");
        }
    }
    // Other buffer commands are implemented by the KateFileTree plugin
    else if (re_close.exactMatch(command)) {
        QTimer::singleShot(0, mainWin, SLOT(slotFileClose()));
    }
    else if (re_quit.exactMatch(command)) {
        if (!re_quit.cap(2).isEmpty()) { // a[ll]
            if (!re_quit.cap(1).isEmpty()) { // [w]rite
                KateDocManager::self()->saveAll();
            }
            QTimer::singleShot(0, mainWin, SLOT(slotFileQuit()));
        } else {
            if (!re_quit.cap(1).isEmpty() && view->document()->isModified()) { // [w]rite
                view->document()->documentSave();
            }

            if (mainWin->viewManager()->count() > 1) {
              QTimer::singleShot(0, mainWin->viewManager(), SLOT(slotCloseCurrentViewSpace()));
            } else {
                if (KateDocManager::self()->documents() > 1)
                  QTimer::singleShot(0, mainWin, SLOT(slotFileClose()));
                else
                  QTimer::singleShot(0, mainWin, SLOT(slotFileQuit()));
            }
        }
    } else if (re_exit.exactMatch(command)) {
        if (!re_exit.cap(1).isEmpty()) { // a[ll]
            KateDocManager::self()->saveAll();
            QTimer::singleShot(0, mainWin, SLOT(slotFileQuit()));
        } else {
            if (view->document()->isModified()) {
                view->document()->documentSave();
            }

            if (KateDocManager::self()->documents() > 1)
                QTimer::singleShot(0, mainWin, SLOT(slotFileClose()));
            else
                QTimer::singleShot(0, mainWin, SLOT(slotFileQuit()));
        }
        QTimer::singleShot(0, mainWin, SLOT(slotFileQuit()));
    }
    else if (re_edit.exactMatch(command)) {
        QString argument = args.join(QString(' '));
        if (argument.isEmpty() || argument == "!") {
            view->document()->documentReload();
        } else {
            KUrl base = mainWin->activeDocumentUrl();
            KUrl url;
            KUrl arg2path(argument);
            if (base.isValid()) { // first try to use the same path as the current open document has
              url = KUrl(base.resolved(arg2path));  //resolved handles the case where the args is a relative path, and is the same as using KUrl(args) elsewise
            } else { // else use the cwd
              url = KUrl(KUrl(QDir::currentPath() + "/").resolved(arg2path)); // + "/" is needed because of http://lists.qt.nokia.com/public/qt-interest/2011-May/033913.html
            }
            QFileInfo file( url.toLocalFile() );
            KTextEditor::Document *doc = KateDocManager::self()->findDocument( url );
            if (doc) {
                mainWin->viewManager()->activateView( doc );
            } else if (file.exists()) {
                mainWin->viewManager()->openUrl( url, QString(), true );
            } else {
                mainWin->viewManager()->openUrl( KUrl(), QString(), true )->saveAs ( url );
            }
        }
    }
    else if (re_new.exactMatch(command)) {
        if (re_new.cap(1) == "v") { // vertical split
            mainWin->viewManager()->slotSplitViewSpaceVert();
        } else {                    // horizontal split
            mainWin->viewManager()->slotSplitViewSpaceHoriz();
        }
        mainWin->viewManager()->slotDocumentNew();
    }
    else if (command == "enew") {
        mainWin->viewManager()->slotDocumentNew();
    }
    else if (re_split.exactMatch(command)) {
        mainWin->viewManager()->slotSplitViewSpaceHoriz();
    }
    else if (re_vsplit.exactMatch(command)) {
        mainWin->viewManager()->slotSplitViewSpaceVert();
    } else if (re_only.exactMatch(command)) {
      mainWin->viewManager()->slotCloseOtherViews();
    }

    return true;
}
Esempio n. 8
0
void PMShell::setupActions( )
{
//   m_helpMenu = new KHelpMenu( this, PMFactory::aboutData( ), true,
//                               actionCollection( ) );

   KStdAction::openNew( this, SLOT( slotFileNew( ) ), actionCollection( ) );
   KStdAction::open( this, SLOT( slotFileOpen( ) ), actionCollection( ) );
   m_pRecent = KStdAction::openRecent( this, SLOT( slotOpenRecent( const KURL& ) ),
                                       actionCollection( ) );
   KStdAction::save( this, SLOT( slotFileSave( ) ), actionCollection( ) );
   KStdAction::saveAs( this, SLOT( slotFileSaveAs( ) ), actionCollection( ) );

   KStdAction::revert( this, SLOT( slotFileRevert( ) ), actionCollection( ) );
   KStdAction::print( this, SLOT( slotFilePrint( ) ), actionCollection( ) );

   KStdAction::close( this, SLOT( slotFileClose( ) ), actionCollection( ) );
   KStdAction::quit( this, SLOT( close( ) ), actionCollection( ) );

   m_pPathAction = new KToggleAction( i18n( "Show &Path" ), 0, this,
                               SLOT( slotShowPath( ) ), actionCollection( ),
                               "options_show_path" );
   m_pPathAction->setCheckedState(i18n("Hide &Path"));

   m_pStatusbarAction = KStdAction::showStatusbar( this, SLOT( slotShowStatusbar( ) ),
                                                   actionCollection( ) );

   KStdAction::saveOptions( this, SLOT( saveOptions( ) ), actionCollection( ) );

   KStdAction::keyBindings( this, SLOT( slotConfigureKeys( ) ),
                            actionCollection( ) );
   KStdAction::configureToolbars( this, SLOT( slotConfigureToolbars( ) ),
                                  actionCollection( ) );
   KStdAction::preferences( this, SLOT( slotSettings( ) ), actionCollection( ) );

   m_pNewTopViewAction = new KAction( i18n( "New Top View" ), 0, this,
                                      SLOT( slotNewTopView( ) ),
                                      actionCollection( ), "view_new_topview" );
   m_pNewBottomViewAction = new KAction( i18n( "New Bottom View" ), 0, this,
                                         SLOT( slotNewBottomView( ) ),
                                         actionCollection( ), "view_new_bottomview" );
   m_pNewLeftViewAction = new KAction( i18n( "New Left View" ), 0, this,
                                       SLOT( slotNewLeftView( ) ),
                                       actionCollection( ), "view_new_leftview" );
   m_pNewRightViewAction = new KAction( i18n( "New Right View" ), 0, this,
                                        SLOT( slotNewRightView( ) ),
                                        actionCollection( ), "view_new_rightview" );
   m_pNewFrontViewAction = new KAction( i18n( "New Front View" ), 0, this,
                                        SLOT( slotNewFrontView( ) ),
                                        actionCollection( ), "view_new_frontview" );
   m_pNewBackViewAction = new KAction( i18n( "New Back View" ), 0, this,
                                       SLOT( slotNewBackView( ) ),
                                       actionCollection( ), "view_new_back_view" );
   m_pNewCameraViewAction = new KAction( i18n( "New Camera View" ), 0, this,
                                         SLOT( slotNewCameraView( ) ),
                                         actionCollection( ), "view_new_cameraview" );

   m_pNewTreeViewAction = new KAction( i18n( "New Object Tree" ), 0, this,
                              SLOT( slotNewTreeView( ) ), actionCollection( ),
                              "view_new_treeview" );
   m_pNewDialogViewAction = new KAction( i18n( "New Properties View" ), 0, this,
                             SLOT( slotNewDialogView( ) ), actionCollection( ),
                             "view_new_dialogview" );

#ifdef KPM_WITH_OBJECT_LIBRARY
   m_pNewLibraryBrowserAction = new KAction( i18n( "New Library Browser" ), 0, this,
                                    SLOT( slotNewLibraryBrowserView( ) ), actionCollection( ),
                                    "view_new_librarybrowser" );
#endif

   // Creating the view layouts menu
   m_pViewLayoutsAction = new KActionMenu( i18n( "View Layouts" ),
                                           actionCollection( ), "view_layouts_menu" );
   KPopupMenu* menu = m_pViewLayoutsAction->popupMenu( );
   connect( menu, SIGNAL( aboutToShow( ) ), SLOT( slotViewsMenuAboutToShow( ) ) );
   PMViewLayoutManager::theManager( )->fillPopupMenu( menu );
   connect( menu, SIGNAL( activated( int ) ), SLOT( slotSelectedLayout( int ) ) );

   m_pSaveViewLayoutAction = new KAction( i18n( "Save View Layout..." ), 0, this,
                                          SLOT( slotSaveViewLayout( ) ),
                                          actionCollection( ), "save_view_layout" );
}
Esempio n. 9
0
void KstApp::slotFileQuit() {
  slotFileClose();
}
Esempio n. 10
0
void KstApp::initActions() {

  fileNewWindow = new KAction(i18n("New &Window"), 0, 0,
                              this, SLOT(slotFileNewWindow()),
                              actionCollection(),"file_new_window");

  fileOpenNew = KStdAction::openNew(this, SLOT(slotFileNew()), actionCollection());
  fileOpenNew->setWhatsThis(i18n("Open Kst plot file."));

  fileSave = KStdAction::save(   this, SLOT(slotFileSave()), actionCollection());
  fileSave->setWhatsThis(i18n("Save to current Kst plot file."));

  fileSaveAs = KStdAction::saveAs( this, SLOT(slotFileSaveAs()), actionCollection());
  fileSaveAs->setWhatsThis(i18n("Save to new Kst plot file."));

  fileClose = KStdAction::close(  this, SLOT(slotFileClose()), actionCollection());
  fileClose->setWhatsThis(i18n("Close Kst."));

  fileQuit = KStdAction::quit(   this, SLOT(slotFileClose()), actionCollection());
  fileQuit->setWhatsThis(i18n("Quit Kst."));

  fileKeyBindings = KStdAction::keyBindings(this, SLOT(slotConfigureKeys()), actionCollection());
  fileKeyBindings->setWhatsThis(i18n("Bring up a dialog box\n"
                                     "to configure shortcuts."));

  filePreferences = KStdAction::preferences(this, SLOT(slotPreferences()), actionCollection());
  filePreferences->setWhatsThis(i18n("Bring up a dialog box\n"
                                     "to configure Kst settings."));

  fileCopy = KStdAction::copy(this, SLOT(slotCopy()), actionCollection());
  fileCopy->setWhatsThis(i18n("Copy cursor position to the clipboard."));

  /************/
  filePrint = KStdAction::print(this, SLOT(slotFilePrint()),
                                actionCollection());
  filePrint->setToolTip(i18n("Print"));
  filePrint->setWhatsThis(i18n("Print current display"));

  /************/
  ToolBarAction = KStdAction::showToolbar(this, SLOT(slotViewToolBar()),
                                          actionCollection());
  ToolBarAction->setWhatsThis(i18n("Toggle Toolbar"));
  connect(ToolBarAction, SIGNAL(activated()), this, SLOT(setSettingsDirty()));

  /************/
  StatusBarAction = KStdAction::showStatusbar(this, SLOT(slotViewStatusBar()),
                                              actionCollection());
  StatusBarAction->setWhatsThis(i18n("Toggle Statusbar"));
  connect(StatusBarAction, SIGNAL(activated()), this, SLOT(setSettingsDirty()));

  /************/
  KStdAction::open(this, SLOT(slotFileOpen()), actionCollection());

  /************/
  recent = KStdAction::openRecent(this, SLOT(slotFileOpenRecent(const KURL &)),
                           actionCollection());
  recent->setWhatsThis(i18n("Open a recently used Kst plot."));

  /************/
  PauseAction = new KToggleAction(i18n("P&ause"),"player_pause",0,
                                  actionCollection(), "pause_action");
  PauseAction->setToolTip(i18n("Pause"));
  PauseAction->setWhatsThis(i18n("When paused, new data will not be read."));

  /************/
  TiedZoomAction = new KAction(i18n("&Tied Zoom"),"kst_zoomtie",0,
                               view, SLOT(toggleTiedZoom()),
                               actionCollection(), "zoomtie_action");
  TiedZoomAction->setToolTip(i18n("Toggle tied zoom"));
  TiedZoomAction->setWhatsThis(i18n("Apply zoom actions to all plots\n"
                                     "(not just the active one)."));

  /************/
  XYZoomAction = new KRadioAction(i18n("XY Mouse &Zoom"), "kst_zoomxy",0,
                                  actionCollection(), "zoomxy_action");
  XYZoomAction->setExclusiveGroup("zoom");
  XYZoomAction->setToolTip(i18n("XY mouse zoom"));
  XYZoomAction->setWhatsThis(i18n("XY zoom: mouse zooming effects\n"
                                  "both X and Y axis"));
  XYZoomAction->setChecked(true);

  /************/
  XZoomAction = new KRadioAction(i18n("&X Mouse Zoom"), "kst_zoomx",0,
                                 actionCollection(), "zoomx_action");
  XZoomAction->setExclusiveGroup("zoom");
  XZoomAction->setToolTip(i18n("X mouse zoom"));
  XZoomAction->setWhatsThis(i18n("X zoom: Mouse zooming effects only the\n"
                                 "X axis (CTRL-mouse also does this)"));

  /************/
  YZoomAction = new KRadioAction(i18n("&Y Mouse Zoom"), "kst_zoomy",0,
                                  actionCollection(), "zoomy_action");
  YZoomAction->setExclusiveGroup("zoom");
  YZoomAction->setToolTip(i18n("Y mouse zoom"));
  YZoomAction->setWhatsThis(i18n("Y zoom: Mouse zooming effects only the\n"
                                 "Y axis (SHIFT-mouse also does this)"));

  /************/
  TextAction = new KRadioAction(i18n("&Label Editor"), "text",0,
                                  actionCollection(), "label_action");

  TextAction->setExclusiveGroup("zoom");
  TextAction->setToolTip(i18n("Label Editor"));
  TextAction->setWhatsThis(i18n("Use the mouse to create and edit labels."));

  /************/
  FilterDialogAction = new KAction(i18n("Edit &Filters"), 0, 0,
                                 this, SLOT(showFilterListEditor()),
                                 actionCollection(), "filterdialog_action");
  FilterDialogAction->setWhatsThis(i18n("Bring up a dialog box\n"
                                        "to edit filters."));

  /************/
  PlotDialogAction = new KAction(i18n("Edit &Plots"), "kst_editplots", 0,
                                 this, SLOT(showPlotDialog()),
                                 actionCollection(), "plotdialog_action");
  PlotDialogAction->setWhatsThis(i18n("Bring up a dialog box\n"
                                      "to edit plot settings."));

  /************/
  DataManagerAction = new KAction(i18n("&Data Manager"), "kst_datamanager", 0,
                                  dataManager, SLOT(show_I()),
                                  actionCollection(), "datamanager_action");
  DataManagerAction->setWhatsThis(i18n("Bring up a dialog box\n"
                                       "to manage data."));

  /************/
  VectorDialogAction = new KAction(i18n("Edit &Vectors"), 0, 0,
                                 KstVectorDialogI::globalInstance(),
                                 SLOT(show_I()), actionCollection(),
                                 "vectordialog_action");
  VectorDialogAction->setWhatsThis(i18n("Bring up a dialog box\n"
                                        "to edit or create vectors."));

  /************/
  CurveDialogAction = new KAction(i18n("Edit &Curves"), 0, 0,
                                  KstCurveDialogI::globalInstance(),
                                  SLOT(show_I()), actionCollection(),
                                  "curvedialog_action");
  CurveDialogAction->setWhatsThis(i18n("Bring up a dialog box\n"
                                       "to edit or create curves."));

  /************/
  EqDialogAction = new KAction(i18n("Edit &Equations"), 0, 0,
                               KstEqDialogI::globalInstance(), SLOT(show_I()),
                               actionCollection(), "eqdialog_action");
  EqDialogAction->setWhatsThis(i18n("Bring up a dialog box\n"
                                    "to edit or create equations."));

  /************/
  HsDialogAction = new KAction(i18n("Edit &Histograms"), 0, 0,
                               KstHsDialogI::globalInstance(),
                               SLOT(show_I()), actionCollection(),
                               "hsdialog_action");
  HsDialogAction->setWhatsThis(i18n("Bring up a dialog box\n"
                                    "to edit or create histograms."));

  /************/
  PsdDialogAction = new KAction(i18n("Edit Power &Spectra"), 0, 0,
                                KstPsdDialogI::globalInstance(),
                                SLOT(show_I()), actionCollection(),
                                "psddialog_action");
  PsdDialogAction->setWhatsThis(i18n("Bring up a dialog box\n"
                                     "to edit or create power spectra."));

  /************/
  PluginDialogAction = new KAction(i18n("Edit &Plugins"), 0, 0,
                                   KstPluginDialogI::globalInstance(),
                                   SLOT(show_I()), actionCollection(),
                                   "plugindialog_action");
  PluginDialogAction->setWhatsThis(i18n("Bring up a dialog box\n"
                                        "to use plugins."));

  /************/
  ChangeFileDialogAction = new KAction(i18n("Change Data &File"),
                                       "kst_changefile", 0, this,
                                       SLOT(showChangeFileDialog()),
                                       actionCollection(),
                                       "changefiledialog_action");
  ChangeFileDialogAction->setWhatsThis(i18n("Bring up a dialog box\n"
                                            "to change input files."));

  /************/
  ViewScalarsDialogAction = new KAction(i18n("View &Scalars"),
                                       0, 0, this,
                                       SLOT(showViewScalarsDialog()),
                                       actionCollection(),
                                       "viewscalarsdialog_action");
  ViewScalarsDialogAction->setWhatsThis(i18n("Bring up a dialog box\n"
                                            "to view scalar values."));
  
  /************/
  ViewVectorsDialogAction = new KAction(i18n("View Vec&tors"),
                                       0, 0, this,
                                       SLOT(showViewVectorsDialog()),
                                       actionCollection(),
                                       "viewvectorsdialog_action");
  ViewVectorsDialogAction->setWhatsThis(i18n("Bring up a dialog box\n"
                                            "to view vector values."));
  
  /************/
  ChangeNptsDialogAction = new KAction(i18n("Change Data Sample &Ranges"),
                                       "kst_changenpts", 0, this,
                                       SLOT(showChangeNptsDialog()),
                                       actionCollection(),
                                       "changenptsdialog_action");
  ChangeNptsDialogAction->setWhatsThis(i18n("Bring up a dialog box\n"
                                            "to change data sample ranges."));

  /************/
  QuickCurvesDialogAction = new KAction(i18n("Quickly Create New Curve"),
                                       "kst_quickcurves", 0, this,
                                       SLOT(showQuickCurvesDialog()),
                                       actionCollection(),
                                       "quickcurvesdialog_action");
  QuickCurvesDialogAction->setWhatsThis(i18n("Bring up a dialog box\n"
                                           "to create a data curve\n"
                                           "and put it in a plot."));
  /************/
  QuickPSDDialogAction = new KAction(i18n("Quickly Create New PSD"),
                                     "kst_quickpsd", 0,
                                     this, SLOT(showQuickPSDDialog()),
                                     actionCollection(),
                                     "quickpsddialog_action");
  QuickPSDDialogAction->setWhatsThis(i18n("Bring up a dialog box\n"
                                          "to create a PSD\n"
                                          "and put it in a plot."));

  /************/
  EventMonitorAction = new KAction(i18n("Edit Event &Monitoring"),
                                     0, 0,
                                     KstEventMonitorI::globalInstance(), 
                                     SLOT(show_I()),
                                     actionCollection(),
                                     "eventmonitor_action");
  EventMonitorAction->setWhatsThis(i18n("Bring up a dialog box\n"
                                          "to edit event monitoring."));
  
  /************/
  GraphFileDialogAction = new KAction(i18n("Export to Graphics File..."),
                                  "kst_graphfile", 0,
                                  this, SLOT(showGraphFileDialog()),
                                  actionCollection(),
                                  "graphfiledialog_action");
  GraphFileDialogAction->setWhatsThis(i18n("Bring up a dialog box\n"
                                           "to export the plot as a\n"
                                           "graphics file."));

  /************/
  _vectorSaveAction = new KAction(i18n("Save Vectors to Disk..."),
                                  0, 0,
                                  vectorSaveDialog, SLOT(show()),
                                  actionCollection(),
                                  "vectorsavedialog_action");
  _vectorSaveAction->setWhatsThis(i18n("Bring up a dialog box\n"
                                       "to save vectors to text files."));

  /************/
  SamplesDownAction = new KAction(i18n("&Back 1 Screen"),
                                  "kst_back",
                                  KAccel::stringToKey("Ctrl+Left"),
                                  this, SLOT(samplesDown()),
                                  actionCollection(),
                                  "samplesdown_action");
  //SamplesDownAction->setToolTip(i18n("Back"));
  SamplesDownAction->setWhatsThis(i18n("Reduce the starting frame by\n"
                                       "the current number of frames."));

  /************/
  SamplesUpAction = new KAction(i18n("&Advance 1 Screen"),
                                "kst_advance",
                                KAccel::stringToKey("Ctrl+Right"),
                                this, SLOT(samplesUp()),
                                actionCollection(),
                                "samplesup_action");

  //SamplesUpAction->setToolTip(i18n("Advance"));
  SamplesUpAction->setWhatsThis(i18n("Increase the starting frame by\n"
                                     "the current number of frames."));

  /************/
  SamplesFromEndAction = new KAction(i18n("Read From &End"),
                                     "1rightarrow",
                                     KAccel::stringToKey("Shift+Ctrl+Right"),
                                     this, SLOT(samplesEnd()),
                                     actionCollection(),
                                     "samplesend_action");
  SamplesFromEndAction->setToolTip(i18n("Read from end"));
  SamplesFromEndAction->setWhatsThis(i18n("Read current data from end of file."));

  /************/
  PluginManagerAction = new KAction(i18n("&Plugins..."), 0, 0,
                                 this, SLOT(showPluginManager()),
                                 actionCollection(), "pluginmanager_action");
  PluginManagerAction->setWhatsThis(i18n("Bring up a dialog box\n"
                                           "to manage plugins."));


  /************/
  ExtensionManagerAction = new KAction(i18n("&Extensions..."), 0, 0,
                                 this, SLOT(showExtensionManager()),
                                 actionCollection(), "extensionmanager_action");
  ExtensionManagerAction->setWhatsThis(i18n("Bring up a dialog box\n"
                                           "to manage extensions."));


  /************/
  DataWizardAction = new KAction(i18n("Data &Wizard..."), "kst_datawizard", 0,
                                 this, SLOT(showDataWizard()),
                                 actionCollection(), "datawizard_action");
  DataWizardAction->setWhatsThis(i18n("Bring up a wizard\n"
                                           "to easily load data."));


  /************/
  DebugDialogAction = new KAction(i18n("Debug Kst..."), 0, 0,
                                 this, SLOT(showDebugDialog()),
                                 actionCollection(), "debug_action");
  DebugDialogAction->setWhatsThis(i18n("Bring up a dialog\n"
                                           "to display debugging information."));


  /************/
  DataMode = new KToggleAction(i18n("Data Mode"), "kst_datamode", 0,
                                 this, SLOT(toggleDataMode()),
                                 actionCollection(), "datamode_action");
  DataMode->setWhatsThis(i18n("Toggle between cursor mode and data mode."));

  /************/
  _reloadAction = new KAction(i18n("Reload"), "reload", Key_F5, this, SLOT(reload()),
                              actionCollection(), "reload");
  _reloadAction->setWhatsThis(i18n("Reload the data from file."));

  createGUI();
}
Esempio n. 11
0
void ndManager::setupActions()
{
    //File Menu
    QMenu *fileMenu = menuBar()->addMenu(tr("&File"));

    mNewAction = fileMenu->addAction(tr("&New..."));
    mNewAction->setIcon(QPixmap(":/shared-icons/document-new"));
    mNewAction->setShortcut(QKeySequence::New);
    connect(mNewAction, SIGNAL(triggered()), this, SLOT(slotNewFile()));


    mOpenAction = fileMenu->addAction(tr("&Open..."));
    mOpenAction->setIcon(QPixmap(":/shared-icons/document-open"));
    mOpenAction->setShortcut(QKeySequence::Open);
    connect(mOpenAction, SIGNAL(triggered()), this, SLOT(slotFileOpen()));

    mFileOpenRecent = new QRecentFileAction(this);
    QSettings settings;
    mFileOpenRecent->setRecentFiles(settings.value(QLatin1String("Recent Files"),QStringList()).toStringList());
    fileMenu->addAction(mFileOpenRecent);
    connect(mFileOpenRecent, SIGNAL(recentFileSelected(QString)), this, SLOT(slotFileOpenRecent(QString)));
    connect(mFileOpenRecent, SIGNAL(recentFileListChanged()), this, SLOT(slotSaveRecentFiles()));

    mUseTemplateAction = fileMenu->addAction(tr("Use &Template..."));
    connect(mUseTemplateAction, SIGNAL(triggered()), this, SLOT(slotImport()));

    fileMenu->addSeparator();
    mSaveAction = fileMenu->addAction(tr("Save..."));
    mSaveAction->setIcon(QPixmap(":/shared-icons/document-save"));
    mSaveAction->setShortcut(QKeySequence::Save);
    connect(mSaveAction, SIGNAL(triggered()), this, SLOT(slotSave()));

    mSaveAsAction = fileMenu->addAction(tr("&Save As..."));
    mSaveAsAction->setIcon(QPixmap(":/shared-icons/document-save-as"));
    mSaveAsAction->setShortcut(QKeySequence::SaveAs);
    connect(mSaveAsAction, SIGNAL(triggered()), this, SLOT(slotSaveAs()));


    mSaveAsDefaultAction = fileMenu->addAction(tr("Save as &Default"));
    connect(mSaveAsDefaultAction, SIGNAL(triggered()), this, SLOT(slotSaveDefault()));

    mReloadAction = fileMenu->addAction(tr("&Reload"));
    mReloadAction->setShortcut(Qt::Key_F5);
    connect(mReloadAction, SIGNAL(triggered()), this, SLOT(slotReload()));


    fileMenu->addSeparator();


    mCloseAction = fileMenu->addAction(tr("Close"));
    mCloseAction->setIcon(QPixmap(":/shared-icons/document-close"));
    mCloseAction->setShortcut(QKeySequence::Close);
    connect(mCloseAction, SIGNAL(triggered()), this, SLOT(slotFileClose()));


    fileMenu->addSeparator();

    mQuitAction = fileMenu->addAction(tr("Quit"));
    mQuitAction->setIcon(QPixmap(":/shared-icons/window-close"));
    mQuitAction->setShortcut(QKeySequence::Quit);
    connect(mQuitAction, SIGNAL(triggered()), this, SLOT(close()));


    QMenu *actionMenu = menuBar()->addMenu(tr("&Actions"));
    mQueryAction = actionMenu->addAction(tr("&Query"));
#ifndef Q_OS_UNIX
    mQueryAction->setEnabled(false);
#endif
    connect(mQueryAction, SIGNAL(triggered()), this, SLOT(slotQuery()));

    //mProcessingManager = actionMenu->addAction(tr("Show Processing Manager"));

    QMenu *settingsMenu = menuBar()->addMenu(tr("&Settings"));

    //Settings
    mExpertMode = settingsMenu->addAction(tr("&Expert Mode"));
    mExpertMode->setCheckable(true);
    connect(mExpertMode, SIGNAL(triggered(bool)), this, SLOT(slotExpertMode()));
    settingsMenu->addSeparator();

    settings.beginGroup("General");
    if ( settings.contains("expertMode")) mExpertMode->setChecked(settings.value("expertMode").toBool());
	 else mExpertMode->setChecked(true);
    settings.endGroup();

    viewMainToolBar = settingsMenu->addAction(tr("Show Main Toolbar"));

    viewMainToolBar->setCheckable(true);
    viewMainToolBar->setChecked(true);
    connect(viewMainToolBar,SIGNAL(triggered()), this,SLOT(slotViewMainToolBar()));


    viewStatusBar = settingsMenu->addAction(tr("Show StatusBar"));
    viewStatusBar->setCheckable(true);
    connect(viewStatusBar,SIGNAL(triggered()), this,SLOT(slotViewStatusBar()));
    viewStatusBar->setChecked(true);

    QMenu *helpMenu = menuBar()->addMenu(tr("Help"));
    QAction *handbook = helpMenu->addAction(tr("Handbook"));
    handbook->setShortcut(Qt::Key_F1);
    connect(handbook,SIGNAL(triggered()), this,SLOT(slotHanbook()));

    QAction *about = helpMenu->addAction(tr("About"));
    connect(about,SIGNAL(triggered()), this,SLOT(slotAbout()));

    mMainToolBar->addAction(mNewAction);
    mMainToolBar->addAction(mOpenAction);
    mMainToolBar->addAction(mSaveAction);

    resize(800,600);
}