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; }
ArchiverWindow::ArchiverWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::ArchiverWindow) , m_busy(false) { ui->setupUi(this); // Set the archive model m_model = new ArchiveModel(this); ui->treeView->setModel(m_model); connect(ui->actionFileNew, SIGNAL(triggered()), this, SLOT(slotFileNew())); connect(ui->actionFileOpen, SIGNAL(triggered()), this, SLOT(slotFileOpen())); connect(ui->actionFileSaveAs, SIGNAL(triggered()), this, SLOT(slotFileSaveAs())); connect(ui->actionFileQuit, SIGNAL(triggered()), this, SLOT(close())); connect(ui->actionActionAddFile, SIGNAL(triggered()), this, SLOT(slotActionAddFile())); connect(ui->actionActionAddFolder, SIGNAL(triggered()), this, SLOT(slotActionAddFolder())); connect(ui->actionActionDelete, SIGNAL(triggered()), this, SLOT(slotActionDelete())); connect(ui->actionActionExtract, SIGNAL(triggered()), this, SLOT(slotActionExtract())); connect(ui->actionHelpAbout, SIGNAL(triggered()), this, SLOT(slotHelpAbout())); }
void KgpgApp::initActions() { KStdAction::openNew(TQT_TQOBJECT(this), TQT_SLOT(slotFileNew()), actionCollection()); KStdAction::open(TQT_TQOBJECT(this), TQT_SLOT(slotFileOpen()), actionCollection()); KStdAction::saveAs(TQT_TQOBJECT(this), TQT_SLOT(slotFileSaveAs()), actionCollection()); KStdAction::quit(TQT_TQOBJECT(this), TQT_SLOT(slotFileQuit()), actionCollection()); KStdAction::cut(TQT_TQOBJECT(this), TQT_SLOT(slotEditCut()), actionCollection()); KStdAction::copy(TQT_TQOBJECT(this), TQT_SLOT(slotEditCopy()), actionCollection()); KStdAction::paste(TQT_TQOBJECT(this), TQT_SLOT(slotEditPaste()), actionCollection()); KStdAction::selectAll(TQT_TQOBJECT(this), TQT_SLOT(slotSelectAll()), actionCollection()); KStdAction::preferences(TQT_TQOBJECT(this), TQT_SLOT(slotOptions()), actionCollection(),"kgpg_config"); //KStdAction::keyBindings(guiFactory(), TQT_SLOT(configureShortcuts()), actionCollection()); //KStdAction::configureToolbars(TQT_TQOBJECT(this), TQT_SLOT(slotConfigureToolbars()), actionCollection()); fileSave = KStdAction::save(TQT_TQOBJECT(this), TQT_SLOT(slotFileSave()), actionCollection()); (void) new TDEAction(i18n("&Encrypt File..."), "encrypted", 0,TQT_TQOBJECT(this), TQT_SLOT(slotFilePreEnc()), actionCollection(),"file_encrypt"); (void) new TDEAction(i18n("&Decrypt File..."), "decrypted", 0,TQT_TQOBJECT(this), TQT_SLOT(slotFilePreDec()), actionCollection(),"file_decrypt"); (void) new TDEAction(i18n("&Open Key Manager"), "kgpg", 0,TQT_TQOBJECT(this), TQT_SLOT(slotKeyManager()), actionCollection(),"key_manage"); editUndo = KStdAction::undo(TQT_TQOBJECT(this), TQT_SLOT(slotundo()), actionCollection()); editRedo = KStdAction::redo(TQT_TQOBJECT(this), TQT_SLOT(slotredo()), actionCollection()); //(void) new TDEAction(i18n("&Manage Keys"), "kgpg_manage", CTRL+Key_K,TQT_TQOBJECT(this), TQT_SLOT(slotManageKey()), actionCollection(),"keys_manage"); (void) new TDEAction(i18n("&Generate Signature..."),0, TQT_TQOBJECT(this), TQT_SLOT(slotPreSignFile()), actionCollection(), "sign_generate"); (void) new TDEAction(i18n("&Verify Signature..."),0, TQT_TQOBJECT(this), TQT_SLOT(slotPreVerifyFile()), actionCollection(), "sign_verify"); (void) new TDEAction(i18n("&Check MD5 Sum..."), 0,TQT_TQOBJECT(this), TQT_SLOT(slotCheckMd5()), actionCollection(), "sign_check"); KStdAction::print(TQT_TQOBJECT(this), TQT_SLOT(slotFilePrint()), actionCollection()); // comment out for now, only confusing //encodingAction=new TDEToggleAction(i18n("&Unicode (utf-8) Encoding"), 0, 0,this, TQT_SLOT(slotSetCharset()),actionCollection(),"charsets"); }
KPlatoWork_MainWindow::KPlatoWork_MainWindow() : KParts::MainWindow() { debugPlanWork<<this; m_part = new KPlatoWork::Part( this, this ); KStandardAction::quit(qApp, SLOT(quit()), actionCollection()); KStandardAction::open(this, SLOT(slotFileOpen()), actionCollection()); // KStandardAction::save(this, SLOT(slotFileSave()), actionCollection()); QAction *a = KStandardAction::undo(m_part->undoStack(), SLOT(undo()), actionCollection()); a->setEnabled( false ); connect( m_part->undoStack(), SIGNAL(canUndoChanged(bool)), a, SLOT(setEnabled(bool)) ); a = KStandardAction::redo(m_part->undoStack(), SLOT(redo()), actionCollection()); a->setEnabled( false ); connect( m_part->undoStack(), SIGNAL(canRedoChanged(bool)), a, SLOT(setEnabled(bool)) ); setCentralWidget( m_part->widget() ); setupGUI( KXmlGuiWindow::ToolBar | KXmlGuiWindow::Keys | KXmlGuiWindow::StatusBar | KXmlGuiWindow::Save); createGUI( m_part ); connect( m_part, SIGNAL(captionChanged(QString,bool)), SLOT(setCaption(QString,bool)) ); }
KPlatoWork_MainWindow::KPlatoWork_MainWindow() : KParts::MainWindow() { kDebug(planworkDbg())<<this; m_part = new KPlatoWork::Part( this, this ); KStandardAction::quit(kapp, SLOT(quit()), actionCollection()); KStandardAction::open(this, SLOT(slotFileOpen()), actionCollection()); // KStandardAction::save(this, SLOT(slotFileSave()), actionCollection()); QAction *a = KStandardAction::undo(m_part->undoStack(), SLOT(undo()), actionCollection()); a->setEnabled( false ); connect( m_part->undoStack(), SIGNAL(canUndoChanged(bool)), a, SLOT(setEnabled(bool)) ); a = KStandardAction::redo(m_part->undoStack(), SLOT(redo()), actionCollection()); a->setEnabled( false ); connect( m_part->undoStack(), SIGNAL(canRedoChanged(bool)), a, SLOT(setEnabled(bool)) ); setupGUI( KXmlGuiWindow::Default, "planwork_mainwindow.rc" ); setCentralWidget( m_part->widget() ); createGUI( m_part ); connect( m_part, SIGNAL(captionChanged(QString,bool)), SLOT(setCaption(QString,bool)) ); }
void KSlovar::registerButtons() { m_newDictionary = new KAction(i18n("&New dictionary"), "filenew", KShortcut(KKey("CTRL+n")), this, SLOT(slotNewDictionary()), actionCollection(), "newDictionary"); m_openDictionary = KStdAction::open(this, SLOT(slotFileOpen()), actionCollection()); m_quit = KStdAction::quit(kapp, SLOT(quit()), actionCollection()); m_back=KStdAction::back(this, SLOT(slotPrevPhrase()), actionCollection()); m_forward=KStdAction::forward(this, SLOT(slotNextPhrase()), actionCollection()); m_home=KStdAction::home(this, SLOT(slotHome()), actionCollection()); m_editDictionary = new KAction(i18n("&Edit dictionary"), "edit", KShortcut(KKey("CTRL+e")), this, SLOT(slotEditDictionary()), actionCollection(), "editDictionary"); m_close=KStdAction::close(this, SLOT(slotClose()), actionCollection()); m_find = KStdAction::find(this, SLOT(slotFind()), actionCollection()); m_findNext = KStdAction::findNext(this, SLOT(slotFindNext()), actionCollection()); m_literalSearch = new KToggleAction(i18n("&Literal search"), "filter", KShortcut(KKey("CTRL+l")), this, SLOT(slotToggleLiteral()), actionCollection(), "literalSearch"); m_backSearch = new KToggleAction(i18n("Ba&ck search"), "previous", KShortcut(KKey("CTRL+b")), this, SLOT(slotToggleBack()), actionCollection(), "backSearch"); m_print=KStdAction::print(this, SLOT(slotPrint()), actionCollection()); m_selectAll=KStdAction::selectAll(this, SLOT(slotSelectAll()), actionCollection()); m_addPhrase=new KAction(i18n("&Add phrase"), "filenew", KShortcut(KKey("CTRL+a")), this, SLOT(slotAddPhrase()), actionCollection(), "addPhrase"); m_editPhrase=new KAction(i18n("Edi&t phrase"), "edit", KShortcut(KKey("CTRL+t")), this, SLOT(slotEditPhrase()), actionCollection(), "editPhrase"); m_removePhrase=new KAction(i18n("&Remove phrase"), "editdelete", KShortcut(KKey("Delete")), this, SLOT(slotRemovePhrase()), actionCollection(), "removePhrase"); m_listPopup=new QPopupMenu; m_addPhrase->plug(m_listPopup); m_editPhrase->plug(m_listPopup); m_removePhrase->plug(m_listPopup); m_config = KStdAction::preferences(this, SLOT(slotConfigure()), actionCollection()); m_conversion = new KAction(i18n("Edit &conversion table"), "conversion", this, SLOT(slotConversionTable()), actionCollection(), "editConversion"); m_update = new KAction(i18n("Update &languages"), "ktalkd", KShortcut(KKey("")), this, SLOT(slotDownloadLanguage()), actionCollection(), "updateLanguages"); m_wizard = new KAction(i18n("Run &First-time wizard"), "wizard", KShortcut(KKey("")), this, SLOT(slotFirstRunWizard()), actionCollection(), "firstRunWizard"); }
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()); }
void App::initMenuBar() { /////////////////////////////////////////////////////////////////// // File Menu m_fileMenu = new QPopupMenu(); m_fileMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/filenew.png")), "&New", this, SLOT(slotFileNew()), CTRL+Key_N, ID_FILE_NEW); m_fileMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/fileopen.png")), "&Open...", this, SLOT(slotFileOpen()), CTRL+Key_O, ID_FILE_OPEN); m_fileMenu->insertSeparator(); m_fileMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/filesave.png")), "&Save", this, SLOT(slotFileSave()), CTRL+Key_S, ID_FILE_SAVE); m_fileMenu->insertItem("Save As...", this, SLOT(slotFileSaveAs()), 0, ID_FILE_SAVE_AS); m_fileMenu->insertSeparator(); m_fileMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/exit.png")), "E&xit", this, SLOT(slotFileQuit()), CTRL+Key_Q, ID_FILE_QUIT); /////////////////////////////////////////////////////////////////// // Window Menu m_windowMenu = new QPopupMenu(); connect(m_windowMenu, SIGNAL(aboutToShow()), this, SLOT(slotRefreshWindowMenu())); /////////////////////////////////////////////////////////////////// // Help menu m_helpMenu = new QPopupMenu(); m_helpMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/help.png")), "Index...", this, SLOT(slotHelpIndex()), SHIFT + Key_F1, ID_HELP_INDEX); m_helpMenu->insertSeparator(); m_helpMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/Q.png")), "About...", this, SLOT(slotHelpAbout()), 0, ID_HELP_ABOUT); m_helpMenu->insertItem("About Qt...", this, SLOT(slotHelpAboutQt()), 0, ID_HELP_ABOUT_QT); /////////////////////////////////////////////////////////////////// // Menubar configuration menuBar()->insertItem("File", m_fileMenu); menuBar()->insertItem("Window", m_windowMenu); menuBar()->insertSeparator(); menuBar()->insertItem("Help", m_helpMenu); menuBar()->setSeparator(QMenuBar::InWindowsStyle); }
int BrowserMainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QMainWindow::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: loadPage((*reinterpret_cast< const QString(*)>(_a[1]))); break; case 1: slotHome(); break; case 2: save(); break; case 3: slotLoadProgress((*reinterpret_cast< int(*)>(_a[1]))); break; case 4: slotUpdateStatusbar((*reinterpret_cast< const QString(*)>(_a[1]))); break; case 5: slotUpdateWindowTitle((*reinterpret_cast< const QString(*)>(_a[1]))); break; case 6: slotUpdateWindowTitle(); break; case 7: loadUrl((*reinterpret_cast< const QUrl(*)>(_a[1]))); break; case 8: slotPreferences(); break; case 9: slotFileNew(); break; case 10: slotFileOpen(); break; case 11: slotFilePrintPreview(); break; case 12: slotFilePrint(); break; case 13: slotPrivateBrowsing(); break; case 14: slotFileSaveAs(); break; case 15: slotEditFind(); break; case 16: slotEditFindNext(); break; case 17: slotEditFindPrevious(); break; case 18: slotShowBookmarksDialog(); break; case 19: slotAddBookmark(); break; case 20: slotViewZoomIn(); break; case 21: slotViewZoomOut(); break; case 22: slotViewResetZoom(); break; case 23: slotViewZoomTextOnly((*reinterpret_cast< bool(*)>(_a[1]))); break; case 24: slotViewToolbar(); break; case 25: slotViewBookmarksBar(); break; case 26: slotViewStatusbar(); break; case 27: slotViewPageSource(); break; case 28: slotViewFullScreen((*reinterpret_cast< bool(*)>(_a[1]))); break; case 29: slotWebSearch(); break; case 30: slotToggleInspector((*reinterpret_cast< bool(*)>(_a[1]))); break; case 31: slotAboutApplication(); break; case 32: slotDownloadManager(); break; case 33: slotSelectLineEdit(); break; case 34: slotAboutToShowBackMenu(); break; case 35: slotAboutToShowForwardMenu(); break; case 36: slotAboutToShowWindowMenu(); break; case 37: slotOpenActionUrl((*reinterpret_cast< QAction*(*)>(_a[1]))); break; case 38: slotShowWindow(); break; case 39: slotSwapFocus(); break; case 40: printRequested((*reinterpret_cast< QWebFrame*(*)>(_a[1]))); break; case 41: geometryChangeRequested((*reinterpret_cast< const QRect(*)>(_a[1]))); break; case 42: updateToolbarActionText((*reinterpret_cast< bool(*)>(_a[1]))); break; case 43: updateBookmarksToolbarActionText((*reinterpret_cast< bool(*)>(_a[1]))); break; default: ; } _id -= 44; } return _id; }
/** * Testing function. */ void LC_SimpleTests::slotTestUnicode() { RS_DEBUG->print("%s\n: begin\n", __func__); auto appWin= QC_ApplicationWindow::getAppWindow(); appWin->slotFileOpen("./fonts/unicode.cxf", RS2::FormatCXF); RS_Document* d =appWin->getDocument(); if (d) { RS_Graphic* graphic = (RS_Graphic*)d; if (graphic==NULL) { return; } RS_Insert* ins; int col; int row; QChar uCode; // e.g. 65 (or 'A') QString strCode; // unicde as string e.g. '[0041] A' graphic->setAutoUpdateBorders(false); for (col=0x0000; col<=0xFFF0; col+=0x10) { printf("col: %X\n", col); for (row=0x0; row<=0xF; row++) { //printf(" row: %X\n", row); uCode = QChar(col+row); //printf(" code: %X\n", uCode.unicode()); strCode.setNum(uCode.unicode(), 16); while (strCode.length()<4) { strCode="0"+strCode; } strCode = "[" + strCode + "] " + uCode; if (graphic->findBlock(strCode)) { RS_InsertData d(strCode, RS_Vector(col/0x10*20.0,row*20.0), RS_Vector(1.0,1.0), 0.0, 1, 1, RS_Vector(0.0, 0.0), NULL, RS2::NoUpdate); ins = new RS_Insert(graphic, d); ins->setLayerToActive(); ins->setPen(RS_Pen(RS_Color(255, 255, 255), RS2::Width01, RS2::SolidLine)); ins->update(); graphic->addEntity(ins); } } } graphic->setAutoUpdateBorders(true); graphic->calculateBorders(); } RS_DEBUG->print("%s\n: end\n", __func__); }
void App::initToolBar() { m_toolbar = new QToolBar(this, "Workspace"); new QToolButton(QPixmap(QString(PIXMAPS) + QString("/filenew.xpm")), "New...", 0, this, SLOT(slotFileNew()), m_toolbar); new QToolButton(QPixmap(QString(PIXMAPS) + QString("/fileopen.xpm")), "Load...", 0, this, SLOT(slotFileOpen()), m_toolbar); new QToolButton(QPixmap(QString(PIXMAPS) + QString("/filesave.xpm")), "Save", 0, this, SLOT(slotFileSave()), m_toolbar); }
PartViewer::PartViewer() { // KXMLGUIClient looks in the "data" resource for the .rc files // This line is for test programs only! KGlobal::dirs()->addResourceDir( "data", KDESRCDIR ); setXMLFile( "partviewer_shell.rc" ); KAction * paOpen = new KAction( KIcon("document-open"), "&Open file", this ); actionCollection()->addAction( "file_open", paOpen ); connect( paOpen, SIGNAL(triggered()), this, SLOT(slotFileOpen()) ); KAction * paQuit = new KAction( KIcon("application-exit"), "&Quit", this ); actionCollection()->addAction( "file_quit", paQuit ); connect(paQuit, SIGNAL(triggered()), this, SLOT(close())); m_part = 0; // Set a reasonable size resize( 600, 350 ); slotFileOpen(); }
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(); }
void editor::initActions() { fileNew = new QAction(QIcon(":/icons/filenew.png"),tr("&New"),this); fileNew->setShortcut(tr("Ctrl+N")); fileNew->setStatusTip(tr("Create a new image")); connect(fileNew, SIGNAL(triggered()), this, SLOT(slotFileNew())); fileOpen = new QAction(QIcon(":/icons/fileopen.png"),tr("&Open"),this); fileOpen->setShortcut(tr("Ctrl+O")); fileOpen->setStatusTip(tr("Open an image file")); connect(fileOpen, SIGNAL(triggered()), this, SLOT(slotFileOpen())); fileSave = new QAction(QIcon(":/icons/filesave.png"),tr("&Save file .."),this); fileSave->setStatusTip(tr("Save the file under the same name and format")); connect(fileSave, SIGNAL(triggered()), this, SLOT(slotFileSave())); fileSaveImage = new QAction(tr("Save &Image file .."),this); fileSaveImage->setStatusTip(tr("Save the file in PNG format")); connect(fileSaveImage, SIGNAL(triggered()), this, SLOT(slotFileSaveImage())); fileSaveTemplate = new QAction(("Save &Template .."),this); fileSaveTemplate->setStatusTip(tr("Save template file ")); connect(fileSaveTemplate, SIGNAL(triggered()), this, SLOT(slotFileSaveTemplate())); fileQuit = new QAction(tr("Quit"),this); fileQuit->setShortcut(tr("Ctrl+Q")); fileQuit->setStatusTip(tr("Quits the editor")); connect(fileQuit, SIGNAL(triggered()), this, SLOT(slotFileQuit())); clearAll= new QAction(QIcon(":/icons/eraser.png"),tr("Clear &All"),this); clearAll->setShortcut(tr("Ctrl+A")); clearAll->setStatusTip(tr("Delete all objects and fill the background with the background color")); connect(clearAll, SIGNAL(triggered()), ev, SLOT(slotClearAll())); copy= new QAction(tr("Copy"),this); copy->setShortcut(tr("Ctrl+C")); connect(copy, SIGNAL(triggered()), ev->getScene(), SLOT(slotCopy())); paste= new QAction(tr("Paste"),this); paste->setShortcut(tr("Ctrl+V")); connect(paste, SIGNAL(triggered()), ev->getScene(), SLOT(slotPaste())); deleteAction=new QAction(tr("&Delete"),this); deleteAction->setShortcut(tr("Del")); connect(deleteAction, SIGNAL(triggered()), ev->getScene(), SLOT(slotDeleteItem())); dump= new QAction(tr("dump"),this); connect(dump, SIGNAL(triggered()), ev, SLOT(slotDump())); }
// // Create & fill toolbar // void App::initToolBar() { m_toolbar = new QToolBar(this, "Workspace"); QString dir; settings()->get(KEY_SYSTEM_DIR, dir); dir += QString("/") + PIXMAPPATH; m_newTB = new QToolButton(QPixmap(dir + QString("/filenew.xpm")), "New workspace", 0, this, SLOT(slotFileNew()), m_toolbar); m_openTB = new QToolButton(QPixmap(dir + QString("/fileopen.xpm")), "Open existing workspace", 0, this, SLOT(slotFileOpen()), m_toolbar); m_saveTB = new QToolButton(QPixmap(dir + QString("/filesave.xpm")), "Save current workspace", 0, this, SLOT(slotFileSave()), m_toolbar); m_toolbar->addSeparator(); m_dmTB = new QToolButton(QPixmap(dir + QString("/device.xpm")), "Device manager", 0, this, SLOT(slotViewDeviceManager()), m_toolbar); m_vcTB = new QToolButton(QPixmap(dir + QString("/virtualconsole.xpm")), "Virtual console", 0, this, SLOT(slotViewVirtualConsole()), m_toolbar); m_ftTB = new QToolButton(QPixmap(dir + QString("/chaser.png")), "Function manager", 0, this, SLOT(slotViewFunctionTree()), m_toolbar); m_toolbar->addSeparator(); m_panicTB = new QToolButton(QPixmap(dir + QString("/panic.xpm")), "Panic!", 0, this, SLOT(slotPanic()), m_toolbar); m_blackOutTB = new QToolButton(QPixmap(dir + QString("/blackout.xpm")), "Blackout", 0, this, SLOT(slotToggleBlackOut()), m_toolbar); m_modeTB = new QToolButton(QPixmap(dir + QString("/unlocked.xpm")), "Design Mode; All editing features enabled", 0, this, SLOT(slotSetMode()), m_toolbar); }
bool mainWidget::qt_invoke( int _id, QUObject* _o ) { switch ( _id - staticMetaObject()->slotOffset() ) { case 0: slotLoadMainConfig((const QString&)static_QUType_QString.get(_o+1)); break; case 1: slotFileOpen(); break; case 2: chooseOpenFile(); break; case 3: slotClickedListViewItem((QListViewItem*)static_QUType_ptr.get(_o+1)); break; case 4: slotFileSave(); break; case 5: aboutSlot(); break; case 6: slotReloadMainConfig(); break; case 7: slotAskForSave(); break; case 8: commentLine(); break; case 9: closeClicked(); break; case 10: languageChange(); break; default: return QMainWindow::qt_invoke( _id, _o ); } return TRUE; }
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())); }
int App::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QMainWindow::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: clipboardChanged(); break; case 1: slotFileNew(); break; case 2: slotFileOpen(); break; case 3: slotFileSave(); break; case 4: slotFileSaveAs(); break; case 5: slotFileQuit(); break; case 6: slotHelpIndex(); break; case 7: slotHelpAbout(); break; case 8: slotHelpAboutQt(); break; default: ; } _id -= 9; } return _id; }
MainWindow::MainWindow() { currentFrameIndex = 0; resize(500, 500); fileCutter = NULL; glWidget = new GLWidget(this); setCentralWidget(glWidget); glWidget->show(); //------------------------------------- mainToolbar = new QToolBar("main toolbar", this); mainToolbar->setIconSize(QSize(22, 22)); actionFileOpen = new QAction(QIcon(":/images/document-open.png"), "open", this); mainToolbar->addAction(actionFileOpen); connect(actionFileOpen, SIGNAL(triggered()), this, SLOT(slotFileOpen())); actionVisibleBrokenEdges = new QAction(QIcon(":/images/insert-link.png"), "show broken edges", this); actionVisibleBrokenEdges->setCheckable(true); mainToolbar->addAction(actionVisibleBrokenEdges); connect(actionVisibleBrokenEdges, SIGNAL(toggled(bool)), glWidget, SLOT(setVisibleBrokenEdges(bool))); addToolBar(Qt::TopToolBarArea, mainToolbar); //------------------------------------- playbackToolbar = new QToolBar("playback toolbar", this); actionPlaybackStart = new QAction(QIcon(":/images/media-playback-start.png"), "Play", this); playbackToolbar->addAction(actionPlaybackStart); connect(actionPlaybackStart, SIGNAL(triggered()), this, SLOT(slotPlaybackStart())); actionPlaybackPause = new QAction(QIcon(":/images/media-playback-pause.png"), "Pause", this); playbackToolbar->addAction(actionPlaybackPause); connect(actionPlaybackPause, SIGNAL(triggered()), this, SLOT(slotPlaybackPause())); playbackSlider = new PlaybackSlider(playbackToolbar); playbackSliderAction = playbackToolbar->addWidget(playbackSlider); addToolBar(Qt::BottomToolBarArea, playbackToolbar); timePlot = new TimePlot(); addDockWidget(Qt::BottomDockWidgetArea, timePlot); timePlot->setFeatures(0); connect(playbackSlider, SIGNAL(valueChanged(int)), this, SLOT(slotGotoFrame(int))); connect(playbackSlider, SIGNAL(valueChanged(int)), timePlot, SLOT(moveCurrentMark(int))); actionPlaybackStart->setVisible(false); actionPlaybackPause->setVisible(false); //------------------------------- connect(&playbackTimer, SIGNAL(timeout()), this, SLOT(slotPlaybackNextFrame())); //------------------------------- setStatusBar(new QStatusBar()); //------------------------------- commentDock = new CommentDock; addDockWidget(Qt::RightDockWidgetArea, commentDock); }
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(); }
void App::initToolBar() { m_toolbar = new QToolBar(this, "Workspace"); QString dir; settings()->get(KEY_SYSTEM_DIR, dir); dir += QString("/") + PIXMAPPATH; new QToolButton(QPixmap(dir + QString("/filenew.xpm")), "New workspace; clear everything", 0, this, SLOT(slotFileNew()), m_toolbar); new QToolButton(QPixmap(dir + QString("/fileopen.xpm")), "Open existing workspace", 0, this, SLOT(slotFileOpen()), m_toolbar); new QToolButton(QPixmap(dir + QString("/filesave.xpm")), "Save current workspace", 0, this, SLOT(slotFileSave()), m_toolbar); m_toolbar->addSeparator(); new QToolButton(QPixmap(dir + QString("/device.xpm")), "View device manager", 0, this, SLOT(slotViewDeviceManager()), m_toolbar); new QToolButton(QPixmap(dir + QString("/virtualconsole.xpm")), "View virtual console", 0, this, SLOT(slotViewVirtualConsole()), m_toolbar); QToolBar* vc = new QToolBar(this, "Virtual Console toolbar"); new QToolButton(QPixmap(dir + QString("/panic.xpm")), "Panic; Shut down all running functions", 0, this, SLOT(slotPanic()), vc); m_modeButton = new QToolButton(QPixmap(dir + QString("/unlocked.xpm")), "Design Mode; All editing features enabled", 0, this, SLOT(slotModeButtonClicked()), vc); }
void App::initMenuBar() { QString dir; settings()->get(KEY_SYSTEM_DIR, dir); dir += QString("/") + PIXMAPPATH; /////////////////////////////////////////////////////////////////// // File Menu m_fileMenu = new QPopupMenu(); m_fileMenu->insertItem(QPixmap(dir + QString("/filenew.xpm")), "&New", this, SLOT(slotFileNew()), CTRL+Key_N, ID_FILE_NEW); m_fileMenu->insertItem(QPixmap(dir + QString("/fileopen.xpm")), "&Open...", this, SLOT(slotFileOpen()), CTRL+Key_O, ID_FILE_OPEN); m_fileMenu->insertSeparator(); m_fileMenu->insertItem(QPixmap(dir + QString("/filesave.xpm")), "&Save", this, SLOT(slotFileSave()), CTRL+Key_S, ID_FILE_SAVE); m_fileMenu->insertItem("Save &As...", this, SLOT(slotFileSaveAs()), 0, ID_FILE_SAVE_AS); m_fileMenu->insertSeparator(); m_fileMenu->insertItem(QPixmap(dir + QString("/info.xpm")), "Se&ttings...", this, SLOT(slotFileSettings()), 0, ID_FILE_SETTINGS); m_fileMenu->insertSeparator(); m_fileMenu->insertItem(QPixmap(dir + QString("/exit.xpm")), "E&xit", this, SLOT(slotFileQuit()), CTRL+Key_Q, ID_FILE_QUIT); /////////////////////////////////////////////////////////////////// // View Menu m_toolsMenu = new QPopupMenu(); m_toolsMenu->setCheckable(true); m_toolsMenu->insertItem(QPixmap(dir + QString("/device.xpm")), "Device Manager", this, SLOT(slotViewDeviceManager()), CTRL + Key_D, ID_VIEW_DEVICE_MANAGER); m_toolsMenu->insertItem(QPixmap(dir + QString("/virtualconsole.xpm")), "Virtual Console", this, SLOT(slotViewVirtualConsole()), CTRL + Key_G, ID_VIEW_VIRTUAL_CONSOLE); m_toolsMenu->insertSeparator(); m_toolsMenu->insertItem(QPixmap(dir + QString("/deviceclasseditor.xpm")), "Device Class Editor", this, SLOT(slotViewDeviceClassEditor()), CTRL + Key_E, ID_VIEW_DEVICE_CLASS_EDITOR); m_toolsMenu->insertItem(QPixmap(dir + QString("/function.xpm")), "Function Tree", this, SLOT(slotViewFunctionTree()), CTRL + Key_F, ID_VIEW_FUNCTION_TREE); m_toolsMenu->insertSeparator(); m_toolsMenu->insertItem(QPixmap(dir + QString("/panic.xpm")), "Panic!", this, SLOT(slotPanic()), CTRL + Key_C, ID_FUNCTIONS_PANIC); connect(m_toolsMenu, SIGNAL(aboutToShow()), this, SLOT(slotRefreshToolsMenu())); /////////////////////////////////////////////////////////////////// // Window Menu m_windowMenu = new QPopupMenu(); connect(m_windowMenu, SIGNAL(aboutToShow()), this, SLOT(slotRefreshWindowMenu())); /////////////////////////////////////////////////////////////////// // Help menu m_helpMenu = new QPopupMenu(); m_helpMenu->insertItem(QPixmap(dir + QString("/help.xpm")), "About...", this, SLOT(slotHelpAbout()), 0, ID_HELP_ABOUT); m_helpMenu->insertItem(QPixmap(dir + QString("/qt.xpm")), "About Qt...", this, SLOT(slotHelpAboutQt()), 0, ID_HELP_ABOUT_QT); /////////////////////////////////////////////////////////////////// // Menubar configuration menuBar()->insertItem("&File", m_fileMenu); menuBar()->insertItem("&Tools", m_toolsMenu); menuBar()->insertItem("&Window", m_windowMenu); menuBar()->insertSeparator(); menuBar()->insertItem("&Help", m_helpMenu); menuBar()->setSeparator(QMenuBar::InWindowsStyle); }
KAMenu::KAMenu( QWidget *parent, const char *name ) : KMenuBar( parent, name ), host_id(0), nice_id(0), searchmode_id(0) { config = kapp->getConfig(); file = new QPopupMenu(); CHECK_PTR( file ); file->insertItem( i18n("O&pen in editor"), this, SLOT(slotFileOpen()), CTRL+Key_O ); file->insertItem( i18n("&Open Dir"), this, SLOT(slotFileOpenDir()), CTRL+Key_D ); file->insertItem( i18n("&Download..."), this, SLOT(slotFileGet()), CTRL+Key_G ); file->insertSeparator(); file->insertItem( i18n("&Load List..."), this, SLOT(slotFileLoad()), CTRL+Key_L ); file->insertItem( i18n("&Save List..."), this, SLOT(slotFileSave()), CTRL+Key_S ); file->insertItem( i18n("Expor&t List..."), this, SLOT(slotFileWrite()), CTRL+Key_R ); file->insertSeparator(); file->insertItem( i18n("&Exit"), qApp, SLOT(quit()), CTRL+Key_Q ); /* empty for now * will be filled on request with actual * Config settings */ host = new QPopupMenu(); CHECK_PTR( host ); host->setCheckable( TRUE ); connect ( host, SIGNAL(activated(int)), this, SLOT(slotSettingsHostname(int)) ); searchmode = new QPopupMenu(); CHECK_PTR( searchmode ); searchmode->setCheckable( TRUE ); searchmode->insertItem( i18n("&Exact"), SEARCH_EXACT, SEARCH_EXACT); searchmode->insertItem( i18n("&Substring"), SEARCH_SUBSTR, SEARCH_SUBSTR); searchmode->insertItem( i18n("Substring &case insensitive"), SEARCH_SUBCASE, SEARCH_SUBCASE); searchmode->insertItem( i18n("&Regular expression"), SEARCH_REGEXP, SEARCH_REGEXP); searchmode->insertItem( i18n("Exact, then substring"), SEARCH_EXACT_SUBSTR, SEARCH_EXACT_SUBSTR); searchmode->insertItem( i18n("Exact, then substring case ins."), SEARCH_EXACT_SUBCASE, SEARCH_EXACT_SUBCASE); searchmode->insertItem( i18n("Exact, then regular expression"), SEARCH_EXACT_REGEXP, SEARCH_EXACT_REGEXP); connect ( searchmode, SIGNAL(activated(int)), this, SLOT(slotSettingsSearchmode(int)) ); nicelevel = new QPopupMenu(); CHECK_PTR( nicelevel ); nicelevel->setCheckable( TRUE ); nicelevel->insertItem( i18n("n&ormal"), NICE_NORMAL, NICE_NORMAL); nicelevel->insertItem( i18n("&nice"), NICE_NICE, NICE_NICE); nicelevel->insertItem( i18n("&very nice"), NICE_VERY, NICE_VERY); nicelevel->insertItem( i18n("&even more nice"), NICE_MORE, NICE_MORE); nicelevel->insertItem( i18n("n&icest"), NICE_NICEST, NICE_NICEST); connect ( nicelevel, SIGNAL(activated(int)), this, SLOT(slotSettingsNicelevel(int)) ); settings = new QPopupMenu(); CHECK_PTR( settings ); settings->setCheckable( TRUE ); settings->insertItem( i18n("Show &File discription"), this, SLOT( slotSettingsShowFile() )); settings->setId( 0, 0 ); settings->setItemChecked( 0 , TRUE); settings->insertItem( i18n("Archie&server"), host ); settings->insertItem( i18n("Search&mode"), searchmode ); settings->insertItem( i18n("&Nicelevel"), nicelevel ); settings->insertSeparator(); settings->insertItem( i18n("&All..."), this, SLOT( slotSettingsAll() )); // settings->insertSeparator(); // settings->insertItem( i18n("&Save"), this, SLOT( slotSettingsSave() )); query = new QPopupMenu(); CHECK_PTR( query ); query->insertItem( i18n("for &Filename"), QUERY_FILE, QUERY_FILE); query->insertItem( i18n("for &Path/Location"), QUERY_PATH, QUERY_PATH); query->insertItem( i18n("for &Hostname"), QUERY_HOST, QUERY_HOST); query->insertSeparator(); query->insertItem( i18n("&STOP"), QUERY_STOP, QUERY_STOP); slotQueryRunning(FALSE); // no query on initialisation connect ( query, SIGNAL(activated(int)), this, SLOT(slotQuery(int)) ); // host search and path search doesn't work proper query->setItemEnabled(QUERY_PATH, FALSE); query->setItemEnabled(QUERY_HOST, FALSE); /* query->insertItem( i18n("for &Filename"), this, SLOT( slotQueryFile() )); query->insertItem( i18n("for &Path/Location"), this, SLOT( slotQueryPath() )); query->insertItem( i18n("for &Hostname"), this, SLOT( slotQueryHost() )); */ sort = new QPopupMenu(); CHECK_PTR( sort ); sort->insertItem( i18n("by &Hostname"), SORT_HOST, SORT_HOST); sort->insertItem( i18n("by &Domain"), SORT_DOMAIN, SORT_DOMAIN); sort->insertItem( i18n("by D&ate"), SORT_DATE, SORT_DATE); sort->insertItem( i18n("by &Filesize"), SORT_SIZE, SORT_SIZE); connect ( sort, SIGNAL(activated(int)), this, SLOT(slotSort(int)) ); QString aboutText; aboutText += i18n("KArchie ver. "); aboutText += KARCHIE_VERSION; aboutText += i18n("\n\n" "by Jörg Habenicht <*****@*****.**>\n\n" "based on the work of:\n" " - archie prospero client by\n" " Clifford Neuman and\n" " Brendan Kehoe ([email protected])\n" " - and xarchie by\n" " George Ferguson ([email protected])\n" "(See README files and copyright.h).\n" "My own code is based on the GPL"); help = kapp->getHelpMenu( TRUE, aboutText ); insertItem( i18n("&File"), file); insertItem( i18n("&Settings"), settings); insertItem( i18n("&Query"), query); insertItem( i18n("S&ort"), sort); insertSeparator(); insertItem( i18n("&Help"),help); slotHostlistChanged(); }
void DebuggerMainWnd::initKAction() { // file menu KAction* open = KStandardAction::open(this, SLOT(slotFileOpen()), actionCollection()); open->setText(i18n("&Open Source...")); m_closeAction = KStandardAction::close(m_filesWindow, SLOT(slotClose()), actionCollection()); m_reloadAction = createAction(i18n("&Reload Source"), "view-refresh", 0, m_filesWindow, SLOT(slotFileReload()), "file_reload"); m_fileExecAction = createAction(i18n("&Executable..."), "document-open-executable", 0, this, SLOT(slotFileExe()), "file_executable"); m_recentExecAction = KStandardAction::openRecent(this, SLOT(slotRecentExec(const KUrl&)), actionCollection()); m_recentExecAction->setObjectName("file_executable_recent"); m_recentExecAction->setText(i18n("Recent E&xecutables")); m_coreDumpAction = createAction(i18n("&Core dump..."), 0, this, SLOT(slotFileCore()), "file_core_dump"); KStandardAction::quit(kapp, SLOT(closeAllWindows()), actionCollection()); // settings menu m_settingsAction = createAction(i18n("This &Program..."), 0, this, SLOT(slotFileProgSettings()), "settings_program"); createAction(i18n("&Global Options..."), 0, this, SLOT(slotFileGlobalSettings()), "settings_global"); KStandardAction::keyBindings(this, SLOT(slotConfigureKeys()), actionCollection()); KStandardAction::showStatusbar(this, SLOT(slotViewStatusbar()), actionCollection()); // view menu m_findAction = KStandardAction::find(m_filesWindow, SLOT(slotViewFind()), actionCollection()); KStandardAction::findNext(m_filesWindow, SLOT(slotFindForward()), actionCollection()); KStandardAction::findPrev(m_filesWindow, SLOT(slotFindBackward()), actionCollection()); i18n("Source &code"); struct { QString text; QWidget* w; QString id; QAction** act; } dw[] = { { i18n("Stac&k"), m_btWindow, "view_stack", &m_btWindowAction }, { i18n("&Locals"), m_localVariables, "view_locals", &m_localVariablesAction }, { i18n("&Watched expressions"), m_watches, "view_watched_expressions", &m_watchesAction }, { i18n("&Registers"), m_registers, "view_registers", &m_registersAction }, { i18n("&Breakpoints"), m_bpTable, "view_breakpoints", &m_bpTableAction }, { i18n("T&hreads"), m_threads, "view_threads", &m_threadsAction }, { i18n("&Output"), m_ttyWindow, "view_output", &m_ttyWindowAction }, { i18n("&Memory"), m_memoryWindow, "view_memory", &m_memoryWindowAction } }; for (unsigned i = 0; i < sizeof(dw)/sizeof(dw[0]); i++) { QDockWidget* d = dockParent(dw[i].w); *dw[i].act = new KToggleAction(dw[i].text, actionCollection()); actionCollection()->addAction(dw[i].id, *dw[i].act); connect(*dw[i].act, SIGNAL(triggered()), d, SLOT(show())); } // execution menu m_runAction = createAction(i18n("&Run"), "debug-run", Qt::Key_F5, m_debugger, SLOT(programRun()), "exec_run"); connect(m_runAction, SIGNAL(activated()), this, SLOT(intoBackground())); m_stepIntoAction = createAction(i18n("Step &into"), "debug-step-into", Qt::Key_F8, m_debugger, SLOT(programStep()), "exec_step_into"); connect(m_stepIntoAction, SIGNAL(activated()), this, SLOT(intoBackground())); m_stepOverAction = createAction(i18n("Step &over"), "debug-step-over", Qt::Key_F10, m_debugger, SLOT(programNext()), "exec_step_over"); connect(m_stepOverAction, SIGNAL(activated()), this, SLOT(intoBackground())); m_stepOutAction = createAction(i18n("Step o&ut"), "debug-step-out", Qt::Key_F6, m_debugger, SLOT(programFinish()), "exec_step_out"); connect(m_stepOutAction, SIGNAL(activated()), this, SLOT(intoBackground())); m_toCursorAction = createAction(i18n("Run to &cursor"), "debug-execute-to-cursor", Qt::Key_F7, this, SLOT(slotExecUntil()), "exec_run_to_cursor"); connect(m_toCursorAction, SIGNAL(activated()), this, SLOT(intoBackground())); m_stepIntoIAction = createAction(i18n("Step i&nto by instruction"), "debug-step-into-instruction", Qt::SHIFT+Qt::Key_F8, m_debugger, SLOT(programStepi()), "exec_step_into_by_insn"); connect(m_stepIntoIAction, SIGNAL(activated()), this, SLOT(intoBackground())); m_stepOverIAction = createAction(i18n("Step o&ver by instruction"), "debug-step-instruction", Qt::SHIFT+Qt::Key_F10, m_debugger, SLOT(programNexti()), "exec_step_over_by_insn"); connect(m_stepOverIAction, SIGNAL(activated()), this, SLOT(intoBackground())); m_execMovePCAction = createAction(i18n("&Program counter to current line"), "debug-run-cursor", 0, m_filesWindow, SLOT(slotMoveProgramCounter()), "exec_movepc"); m_breakAction = createAction(i18n("&Break"), 0, m_debugger, SLOT(programBreak()), "exec_break"); m_killAction = createAction(i18n("&Kill"), 0, m_debugger, SLOT(programKill()), "exec_kill"); m_restartAction = createAction(i18n("Re&start"), 0, m_debugger, SLOT(programRunAgain()), "exec_restart"); m_attachAction = createAction(i18n("A&ttach..."), 0, this, SLOT(slotExecAttach()), "exec_attach"); m_argumentsAction = createAction(i18n("&Arguments..."), 0, this, SLOT(slotExecArgs()), "exec_arguments"); // breakpoint menu m_bpSetAction = createAction(i18n("Set/Clear &breakpoint"), "brkpt", Qt::Key_F9, m_filesWindow, SLOT(slotBrkptSet()), "breakpoint_set"); m_bpSetTempAction = createAction(i18n("Set &temporary breakpoint"), Qt::SHIFT+Qt::Key_F9, m_filesWindow, SLOT(slotBrkptSetTemp()), "breakpoint_set_temporary"); m_bpEnableAction = createAction(i18n("&Enable/Disable breakpoint"), Qt::CTRL+Qt::Key_F9, m_filesWindow, SLOT(slotBrkptEnable()), "breakpoint_enable"); // only in popup menus createAction(i18n("Watch Expression"), 0, this, SLOT(slotLocalsToWatch()), "watch_expression"); m_editValueAction = createAction(i18n("Edit Value"), Qt::Key_F2, this, SLOT(slotEditValue()), "edit_value"); // all actions force an UI update QList<QAction*> actions = actionCollection()->actions(); foreach(QAction* action, actions) { connect(action, SIGNAL(activated()), this, SLOT(updateUI())); }
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" ); }
void App::initMenuBar() { /////////////////////////////////////////////////////////////////// // File Menu m_fileMenu = new QPopupMenu(); m_fileMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/filenew.xpm")), "&New", this, SLOT(slotFileNew()), CTRL+Key_N, ID_FILE_NEW); m_fileMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/fileopen.xpm")), "&Open...", this, SLOT(slotFileOpen()), CTRL+Key_O, ID_FILE_OPEN); m_fileMenu->insertSeparator(); m_fileMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/filesave.xpm")), "&Save", this, SLOT(slotFileSave()), CTRL+Key_S, ID_FILE_SAVE); m_fileMenu->insertItem("Save As...", this, SLOT(slotFileSaveAs()), 0, ID_FILE_SAVE_AS); m_fileMenu->insertSeparator(); m_fileMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/exit.xpm")), "E&xit", this, SLOT(slotFileQuit()), CTRL+Key_Q, ID_FILE_QUIT); /////////////////////////////////////////////////////////////////// // Edit Menu m_editMenu = new QPopupMenu(); m_editMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/add.xpm")), "Add &Channel...", this, SLOT(slotEmpty()), CTRL+Key_C, ID_EDIT_ADD_CHANNEL); m_editMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/remove.xpm")), "&Remove Channel", this, SLOT(slotEmpty()), CTRL+Key_R, ID_EDIT_REMOVE_CHANNEL); m_editMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/edit.xpm")), "Edit C&hannel...", this, SLOT(slotEmpty()), CTRL+Key_H, ID_EDIT_CHANNEL); m_editMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/up.xpm")), "Raise Channel", this, SLOT(slotEmpty()), CTRL+Key_Up, ID_EDIT_RAISE_CHANNEL); m_editMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/down.xpm")), "Lower Channel", this, SLOT(slotEmpty()), CTRL+Key_Down, ID_EDIT_LOWER_CHANNEL); m_editMenu->insertSeparator(); m_editMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/add.xpm")), "&Add Capability...", this, SLOT(slotEmpty()), CTRL+Key_A, ID_EDIT_ADD_CAPABILITY); m_editMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/remove.xpm")), "R&emove Capability", this, SLOT(slotEmpty()), CTRL+Key_E, ID_EDIT_REMOVE_CAPABILITY); m_editMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/edit.xpm")), "Ed&it Capability...", this, SLOT(slotEmpty()), CTRL+Key_I, ID_EDIT_CAPABILITY); connect(m_editMenu, SIGNAL(activated(int)), this, SLOT(slotEditMenuActivated(int))); connect(m_editMenu, SIGNAL(aboutToShow()), this, SLOT(slotRefreshEditMenu())); /////////////////////////////////////////////////////////////////// // Window Menu m_windowMenu = new QPopupMenu(); connect(m_windowMenu, SIGNAL(aboutToShow()), this, SLOT(slotRefreshWindowMenu())); /////////////////////////////////////////////////////////////////// // Help menu m_helpMenu = new QPopupMenu(); m_helpMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/help.xpm")), "About...", this, SLOT(slotHelpAbout()), 0, ID_HELP_ABOUT); m_helpMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/qt.xpm")), "About Qt...", this, SLOT(slotHelpAboutQt()), 0, ID_HELP_ABOUT_QT); /////////////////////////////////////////////////////////////////// // Menubar configuration menuBar()->insertItem("File", m_fileMenu); menuBar()->insertItem("Edit", m_editMenu); menuBar()->insertItem("Window", m_windowMenu); menuBar()->insertSeparator(); menuBar()->insertItem("Help", m_helpMenu); menuBar()->setSeparator(QMenuBar::InWindowsStyle); }
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); }
// // Menu bar // void App::initMenuBar() { QString dir; settings()->get(KEY_SYSTEM_DIR, dir); dir += QString("/") + PIXMAPPATH; /////////////////////////////////////////////////////////////////// // File Menu m_fileMenu = new QPopupMenu(); m_fileMenu->insertItem(QPixmap(dir + QString("/filenew.xpm")), "&New", this, SLOT(slotFileNew()), CTRL+Key_N, ID_FILE_NEW); m_fileMenu->insertItem(QPixmap(dir + QString("/fileopen.xpm")), "&Open...", this, SLOT(slotFileOpen()), CTRL+Key_O, ID_FILE_OPEN); m_fileMenu->insertSeparator(); m_fileMenu->insertItem(QPixmap(dir + QString("/filesave.xpm")), "&Save", this, SLOT(slotFileSave()), CTRL+Key_S, ID_FILE_SAVE); m_fileMenu->insertItem("Save &As...", this, SLOT(slotFileSaveAs()), 0, ID_FILE_SAVE_AS); m_fileMenu->insertSeparator(); m_fileMenu->insertItem(QPixmap(dir + QString("/settings.xpm")), "Se&ttings...", this, SLOT(slotFileSettings()), 0, ID_FILE_SETTINGS); m_fileMenu->insertSeparator(); m_fileMenu->insertItem(QPixmap(dir + QString("/exit.xpm")), "E&xit", this, SLOT(slotFileQuit()), CTRL+Key_Q, ID_FILE_QUIT); connect(m_fileMenu, SIGNAL(aboutToShow()), this, SLOT(slotRefreshMenus())); /////////////////////////////////////////////////////////////////// // Tools Menu m_toolsMenu = new QPopupMenu(); m_toolsMenu->setCheckable(true); m_toolsMenu->insertItem(QPixmap(dir + QString("/device.xpm")), "Device Manager", this, SLOT(slotViewDeviceManager()), CTRL + Key_M, ID_VIEW_DEVICE_MANAGER); m_toolsMenu->insertItem(QPixmap(dir + QString("/virtualconsole.xpm")), "Virtual Console", this, SLOT(slotViewVirtualConsole()), CTRL + Key_V, ID_VIEW_VIRTUAL_CONSOLE); m_toolsMenu->insertSeparator(); m_toolsMenu->insertItem(QPixmap(dir + QString("/chaser.png")), "Function Manager", this, SLOT(slotViewFunctionTree()), CTRL + Key_F, ID_VIEW_FUNCTION_TREE); m_toolsMenu->insertItem(QPixmap(dir + QString("/bus.xpm")), "Bus Properties", this, SLOT(slotViewBusProperties()), CTRL + Key_B, ID_VIEW_BUS_PROPERTIES); m_toolsMenu->insertSeparator(); m_toolsMenu->insertItem(QPixmap(dir + QString("/panic.xpm")), "Panic!", this, SLOT(slotPanic()), CTRL + Key_P, ID_FUNCTIONS_PANIC); connect(m_toolsMenu, SIGNAL(aboutToShow()), this, SLOT(slotRefreshMenus())); //////////////////////////////////////////////////////////////////// // Mode menu m_modeMenu = new QPopupMenu(); m_modeMenu->setCheckable(true); m_modeMenu->insertItem(QPixmap(dir + QString("/unlocked.xpm")), "Design", this, SLOT(slotSetDesignMode()), CTRL + Key_D, ID_FUNCTIONS_MODE_DESIGN); m_modeMenu->insertItem(QPixmap(dir + QString("/locked.xpm")), "Operate", this, SLOT(slotSetOperateMode()), CTRL + Key_R, ID_FUNCTIONS_MODE_OPERATE); connect(m_modeMenu, SIGNAL(aboutToShow()), this, SLOT(slotRefreshMenus())); /////////////////////////////////////////////////////////////////// // Window Menu m_windowMenu = new QPopupMenu(); connect(m_windowMenu, SIGNAL(aboutToShow()), this, SLOT(slotRefreshMenus())); connect(m_windowMenu, SIGNAL(activated(int)), this, SLOT(slotWindowMenuCallback(int))); /////////////////////////////////////////////////////////////////// // Help menu m_helpMenu = new QPopupMenu(); m_helpMenu->setCheckable(true); m_helpMenu->insertItem(QPixmap(dir + QString("/help.xpm")), "Index...", this, SLOT(slotHelpIndex()), SHIFT + Key_F1, ID_HELP_INDEX); m_helpMenu->insertSeparator(); m_helpMenu->insertItem(QPixmap(dir + QString("/Q.xpm")), "About...", this, SLOT(slotHelpAbout()), 0, ID_HELP_ABOUT); m_helpMenu->insertItem(QPixmap(dir + QString("/qt.xpm")), "About Qt...", this, SLOT(slotHelpAboutQt()), 0, ID_HELP_ABOUT_QT); m_helpMenu->insertSeparator(); m_helpMenu->insertItem(QPixmap(dir + QString("")), "Show Tooltips", this, SLOT(slotHelpTooltips()), 0, ID_HELP_TOOLTIPS); /////////////////////////////////////////////////////////////////// // Menubar configuration menuBar()->insertItem("&File", m_fileMenu); menuBar()->insertItem("&Tools", m_toolsMenu); m_toolsMenu->insertItem("&Mode", m_modeMenu); menuBar()->insertItem("&Window", m_windowMenu); menuBar()->insertSeparator(); menuBar()->insertItem("&Help", m_helpMenu); menuBar()->setSeparator(QMenuBar::InWindowsStyle); }