QAction *MainWindow::createAction(const QString icon, const QString toolTip, const QString statusTip, bool scripted) { QAction *ACTION = new QAction(QIcon("icons/" + getSettingsGeneralIconTheme() + "/" + icon + ".png"), toolTip, this); //TODO: Qt4.7 wont load icons without an extension... ACTION->setStatusTip(statusTip); ACTION->setObjectName(icon); // TODO: Set What's This Context Help to statusTip for now so there is some infos there. // Make custom whats this context help popup with more descriptive help than just // the status bar/tip one liner(short but not real long) with a hyperlink in the custom popup // at the bottom to open full help file description. Ex: like wxPython AGW's SuperToolTip. ACTION->setWhatsThis(statusTip); // TODO: Finish All Commands ... <.< if (icon == "donothing") connect(ACTION, SIGNAL(triggered()), this, SLOT(doNothing())); else if(icon == "new") { ACTION->setShortcut(QKeySequence::New); connect(ACTION, SIGNAL(triggered()), this, SLOT(newFile())); } else if(icon == "open") { ACTION->setShortcut(QKeySequence::Open); connect(ACTION, SIGNAL(triggered()), this, SLOT(openFile())); } else if(icon == "save") { ACTION->setShortcut(QKeySequence::Save); connect(ACTION, SIGNAL(triggered()), this, SLOT(savefile())); } else if(icon == "saveas") { ACTION->setShortcut(QKeySequence::SaveAs); connect(ACTION, SIGNAL(triggered()), this, SLOT(saveasfile())); } else if(icon == "print") { ACTION->setShortcut(QKeySequence::Print); connect(ACTION, SIGNAL(triggered()), this, SLOT(print())); } else if(icon == "designdetails") { ACTION->setShortcut(QKeySequence("Ctrl+D")); connect(ACTION, SIGNAL(triggered()), this, SLOT(designDetails())); } else if(icon == "exit") { ACTION->setShortcut(QKeySequence("Ctrl+Q")); connect(ACTION, SIGNAL(triggered()), this, SLOT(exit())); } else if(icon == "cut") { ACTION->setShortcut(QKeySequence::Cut); connect(ACTION, SIGNAL(triggered()), this, SLOT(cut())); } else if(icon == "copy") { ACTION->setShortcut(QKeySequence::Copy); connect(ACTION, SIGNAL(triggered()), this, SLOT(copy())); } else if(icon == "paste") { ACTION->setShortcut(QKeySequence::Paste); connect(ACTION, SIGNAL(triggered()), this, SLOT(paste())); } else if(icon == "windowcascade") connect(ACTION, SIGNAL(triggered()), mdiArea, SLOT(cascade())); else if(icon == "windowtile") connect(ACTION, SIGNAL(triggered()), mdiArea, SLOT(tile())); else if(icon == "windowclose") { ACTION->setShortcut(QKeySequence::Close); connect(ACTION, SIGNAL(triggered()), this, SLOT(onCloseWindow())); } else if(icon == "windowcloseall") connect(ACTION, SIGNAL(triggered()), mdiArea, SLOT(closeAllSubWindows())); else if(icon == "windownext") { ACTION->setShortcut(QKeySequence::NextChild); connect(ACTION, SIGNAL(triggered()), mdiArea, SLOT(activateNextSubWindow())); } else if(icon == "windowprevious") { ACTION->setShortcut(QKeySequence::PreviousChild); connect(ACTION, SIGNAL(triggered()), mdiArea, SLOT(activatePreviousSubWindow())); } else if(icon == "help") connect(ACTION, SIGNAL(triggered()), this, SLOT(help())); else if(icon == "changelog") connect(ACTION, SIGNAL(triggered()), this, SLOT(changelog())); else if(icon == "tipoftheday") connect(ACTION, SIGNAL(triggered()), this, SLOT(tipOfTheDay())); else if(icon == "about") connect(ACTION, SIGNAL(triggered()), this, SLOT(about())); else if(icon == "whatsthis") connect(ACTION, SIGNAL(triggered()), this, SLOT(whatsThisContextHelp())); else if(icon == "icon16") connect(ACTION, SIGNAL(triggered()), this, SLOT(icon16())); else if(icon == "icon24") connect(ACTION, SIGNAL(triggered()), this, SLOT(icon24())); else if(icon == "icon32") connect(ACTION, SIGNAL(triggered()), this, SLOT(icon32())); else if(icon == "icon48") connect(ACTION, SIGNAL(triggered()), this, SLOT(icon48())); else if(icon == "icon64") connect(ACTION, SIGNAL(triggered()), this, SLOT(icon64())); else if(icon == "icon128") connect(ACTION, SIGNAL(triggered()), this, SLOT(icon128())); else if(icon == "settingsdialog") connect(ACTION, SIGNAL(triggered()), this, SLOT(settingsDialog())); else if(icon == "undo") connect(ACTION, SIGNAL(triggered()), this, SLOT(undo())); else if(icon == "redo") connect(ACTION, SIGNAL(triggered()), this, SLOT(redo())); else if(icon == "makelayercurrent") connect(ACTION, SIGNAL(triggered()), this, SLOT(makeLayerActive())); else if(icon == "layers") connect(ACTION, SIGNAL(triggered()), this, SLOT(layerManager())); else if(icon == "layerprevious") connect(ACTION, SIGNAL(triggered()), this, SLOT(layerPrevious())); else if(icon == "textbold") { ACTION->setCheckable(true); connect(ACTION, SIGNAL(toggled(bool)), this, SLOT(setTextBold(bool))); }
QAction *MainWindow::createAction(const QString icon, const QString toolTip, const QString statusTip, bool scripted) { QAction *ACTION = new QAction(QIcon("icons/" + getSettingsGeneralIconTheme() + "/" + icon + ".png"), toolTip, this); //TODO: Qt4.7 wont load icons without an extension... ACTION->setStatusTip(statusTip); ACTION->setObjectName(icon); // TODO: Finish All Commands ... <.< if (icon == "donothing") connect(ACTION, SIGNAL(triggered()), this, SLOT(doNothing())); else if(icon == "new") { ACTION->setShortcut(QKeySequence::New); connect(ACTION, SIGNAL(triggered()), this, SLOT(newfile())); } else if(icon == "open") { ACTION->setShortcut(QKeySequence::Open); connect(ACTION, SIGNAL(triggered()), this, SLOT(openfile())); } else if(icon == "save") { ACTION->setShortcut(QKeySequence::Save); connect(ACTION, SIGNAL(triggered()), this, SLOT(savefile())); } else if(icon == "saveas") { ACTION->setShortcut(QKeySequence::SaveAs); connect(ACTION, SIGNAL(triggered()), this, SLOT(saveasfile())); } else if(icon == "print") { ACTION->setShortcut(QKeySequence::Print); connect(ACTION, SIGNAL(triggered()), this, SLOT(print())); } else if(icon == "close") { ACTION->setShortcut(QKeySequence::Close); connect(ACTION, SIGNAL(triggered()), this, SLOT(onCloseWindow())); } else if(icon == "designdetails") { ACTION->setShortcut(QKeySequence("Ctrl+D")); connect(ACTION, SIGNAL(triggered()), this, SLOT(designDetails())); } else if(icon == "exit") { ACTION->setShortcut(QKeySequence("Ctrl+Q")); connect(ACTION, SIGNAL(triggered()), this, SLOT(exit())); } else if(icon == "cut") { ACTION->setShortcut(QKeySequence::Cut); connect(ACTION, SIGNAL(triggered()), this, SLOT(cut())); } else if(icon == "copy") { ACTION->setShortcut(QKeySequence::Copy); connect(ACTION, SIGNAL(triggered()), this, SLOT(copy())); } else if(icon == "paste") { ACTION->setShortcut(QKeySequence::Paste); connect(ACTION, SIGNAL(triggered()), this, SLOT(paste())); } else if(icon == "windowcascade") connect(ACTION, SIGNAL(triggered()), mdiArea, SLOT(cascade())); else if(icon == "windowtile") connect(ACTION, SIGNAL(triggered()), mdiArea, SLOT(tile())); else if(icon == "windowcloseall") connect(ACTION, SIGNAL(triggered()), mdiArea, SLOT(closeAllSubWindows())); else if(icon == "windownext") { ACTION->setShortcut(QKeySequence::NextChild); connect(ACTION, SIGNAL(triggered()), mdiArea, SLOT(activateNextSubWindow())); } else if(icon == "windowprevious") { ACTION->setShortcut(QKeySequence::PreviousChild); connect(ACTION, SIGNAL(triggered()), mdiArea, SLOT(activatePreviousSubWindow())); } else if(icon == "help") connect(ACTION, SIGNAL(triggered()), this, SLOT(help())); else if(icon == "changelog") connect(ACTION, SIGNAL(triggered()), this, SLOT(changelog())); else if(icon == "tipoftheday") connect(ACTION, SIGNAL(triggered()), this, SLOT(tipOfTheDay())); else if(icon == "about") connect(ACTION, SIGNAL(triggered()), this, SLOT(about())); else if(icon == "aboutQt") connect(ACTION, SIGNAL(triggered()), qApp, SLOT(aboutQt())); else if(icon == "icon16") connect(ACTION, SIGNAL(triggered()), this, SLOT(icon16())); else if(icon == "icon24") connect(ACTION, SIGNAL(triggered()), this, SLOT(icon24())); else if(icon == "icon32") connect(ACTION, SIGNAL(triggered()), this, SLOT(icon32())); else if(icon == "icon48") connect(ACTION, SIGNAL(triggered()), this, SLOT(icon48())); else if(icon == "icon64") connect(ACTION, SIGNAL(triggered()), this, SLOT(icon64())); else if(icon == "icon128") connect(ACTION, SIGNAL(triggered()), this, SLOT(icon128())); else if(icon == "settingsdialog") connect(ACTION, SIGNAL(triggered()), this, SLOT(settingsDialog())); else if(icon == "undo") connect(ACTION, SIGNAL(triggered()), this, SLOT(undo())); else if(icon == "redo") connect(ACTION, SIGNAL(triggered()), this, SLOT(redo())); else if(icon == "makelayercurrent") connect(ACTION, SIGNAL(triggered()), this, SLOT(makeLayerActive())); else if(icon == "layers") connect(ACTION, SIGNAL(triggered()), this, SLOT(layerManager())); else if(icon == "layerprevious") connect(ACTION, SIGNAL(triggered()), this, SLOT(layerPrevious())); else if(icon == "textbold") { ACTION->setCheckable(true); connect(ACTION, SIGNAL(toggled(bool)), this, SLOT(setTextBold(bool))); }