void MainWindow::createLayerToolbar() { qDebug("MainWindow createLayerToolbar()"); toolbarLayer->setObjectName("toolbarLayer"); toolbarLayer->addAction(actionHash.value(ACTION_makelayercurrent)); toolbarLayer->addAction(actionHash.value(ACTION_layers)); QString icontheme = getSettingsGeneralIconTheme(); layerSelector->setFocusProxy(prompt); //NOTE: Qt4.7 wont load icons without an extension... //TODO: Create layer pixmaps by concatenating several icons layerSelector->addItem(QIcon("icons/" + icontheme + "/" + "linetypebylayer" + ".png"), "0"); layerSelector->addItem(QIcon("icons/" + icontheme + "/" + "linetypebylayer" + ".png"), "1"); layerSelector->addItem(QIcon("icons/" + icontheme + "/" + "linetypebylayer" + ".png"), "2"); layerSelector->addItem(QIcon("icons/" + icontheme + "/" + "linetypebylayer" + ".png"), "3"); layerSelector->addItem(QIcon("icons/" + icontheme + "/" + "linetypebylayer" + ".png"), "4"); layerSelector->addItem(QIcon("icons/" + icontheme + "/" + "linetypebylayer" + ".png"), "5"); layerSelector->addItem(QIcon("icons/" + icontheme + "/" + "linetypebylayer" + ".png"), "6"); layerSelector->addItem(QIcon("icons/" + icontheme + "/" + "linetypebylayer" + ".png"), "7"); layerSelector->addItem(QIcon("icons/" + icontheme + "/" + "linetypebylayer" + ".png"), "8"); layerSelector->addItem(QIcon("icons/" + icontheme + "/" + "linetypebylayer" + ".png"), "9"); toolbarLayer->addWidget(layerSelector); connect(layerSelector, SIGNAL(currentIndexChanged(int)), this, SLOT(layerSelectorIndexChanged(int))); toolbarLayer->addAction(actionHash.value(ACTION_layerprevious)); connect(toolbarLayer, SIGNAL(topLevelChanged(bool)), this, SLOT(floatingChangedToolBar(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: 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))); }
void MainWindow::createViewMenu() { qDebug("MainWindow createViewMenu()"); QString icontheme = getSettingsGeneralIconTheme(); menuBar()->addMenu(viewMenu); viewMenu->addSeparator(); viewMenu->addMenu(zoomMenu); zoomMenu->setIcon(QIcon("icons/" + icontheme + "/zoom" + ".png")); zoomMenu->addAction(actionDict.value(ACTION_zoomrealtime)); zoomMenu->addAction(actionDict.value(ACTION_zoomprevious)); zoomMenu->addSeparator(); zoomMenu->addAction(actionDict.value(ACTION_zoomwindow)); zoomMenu->addAction(actionDict.value(ACTION_zoomdynamic)); zoomMenu->addAction(actionDict.value(ACTION_zoomscale)); zoomMenu->addAction(actionDict.value(ACTION_zoomcenter)); zoomMenu->addSeparator(); zoomMenu->addAction(actionDict.value(ACTION_zoomin)); zoomMenu->addAction(actionDict.value(ACTION_zoomout)); zoomMenu->addSeparator(); zoomMenu->addAction(actionDict.value(ACTION_zoomselected)); zoomMenu->addAction(actionDict.value(ACTION_zoomall)); zoomMenu->addAction(actionDict.value(ACTION_zoomextents)); viewMenu->addMenu(panMenu); panMenu->setIcon(QIcon("icons/" + icontheme + "/pan" + ".png")); panMenu->addAction(actionDict.value(ACTION_panrealtime)); panMenu->addAction(actionDict.value(ACTION_panpoint)); panMenu->addSeparator(); panMenu->addAction(actionDict.value(ACTION_panleft)); panMenu->addAction(actionDict.value(ACTION_panright)); panMenu->addAction(actionDict.value(ACTION_panup)); panMenu->addAction(actionDict.value(ACTION_pandown)); viewMenu->addSeparator(); viewMenu->addAction(actionDict.value(ACTION_day)); viewMenu->addAction(actionDict.value(ACTION_night)); viewMenu->addSeparator(); viewMenu->setTearOffEnabled(true); zoomMenu->setTearOffEnabled(true); panMenu->setTearOffEnabled(true); }
void MainWindow::createPropertiesToolbar() { qDebug("MainWindow createPropertiesToolbar()"); toolbarProperties->setObjectName("toolbarProperties"); QString icontheme = getSettingsGeneralIconTheme(); colorSelector->setFocusProxy(prompt); //NOTE: Qt4.7 wont load icons without an extension... colorSelector->addItem(QIcon("icons/" + icontheme + "/" + "colorbylayer" + ".png"), "ByLayer"); colorSelector->addItem(QIcon("icons/" + icontheme + "/" + "colorbyblock" + ".png"), "ByBlock"); colorSelector->addItem(QIcon("icons/" + icontheme + "/" + "colorred" + ".png"), tr("Red"), qRgb(255, 0, 0)); colorSelector->addItem(QIcon("icons/" + icontheme + "/" + "coloryellow" + ".png"), tr("Yellow"), qRgb(255,255, 0)); colorSelector->addItem(QIcon("icons/" + icontheme + "/" + "colorgreen" + ".png"), tr("Green"), qRgb( 0,255, 0)); colorSelector->addItem(QIcon("icons/" + icontheme + "/" + "colorcyan" + ".png"), tr("Cyan"), qRgb( 0,255,255)); colorSelector->addItem(QIcon("icons/" + icontheme + "/" + "colorblue" + ".png"), tr("Blue"), qRgb( 0, 0,255)); colorSelector->addItem(QIcon("icons/" + icontheme + "/" + "colormagenta" + ".png"), tr("Magenta"), qRgb(255, 0,255)); colorSelector->addItem(QIcon("icons/" + icontheme + "/" + "colorwhite" + ".png"), tr("White"), qRgb(255,255,255)); colorSelector->addItem(QIcon("icons/" + icontheme + "/" + "colorother" + ".png"), tr("Other...")); toolbarProperties->addWidget(colorSelector); connect(colorSelector, SIGNAL(currentIndexChanged(int)), this, SLOT(colorSelectorIndexChanged(int))); toolbarProperties->addSeparator(); linetypeSelector->setFocusProxy(prompt); //NOTE: Qt4.7 wont load icons without an extension... linetypeSelector->addItem(QIcon("icons/" + icontheme + "/" + "linetypebylayer" + ".png"), "ByLayer"); linetypeSelector->addItem(QIcon("icons/" + icontheme + "/" + "linetypebyblock" + ".png"), "ByBlock"); linetypeSelector->addItem(QIcon("icons/" + icontheme + "/" + "linetypecontinuous" + ".png"), "Continuous"); linetypeSelector->addItem(QIcon("icons/" + icontheme + "/" + "linetypehidden" + ".png"), "Hidden"); linetypeSelector->addItem(QIcon("icons/" + icontheme + "/" + "linetypecenter" + ".png"), "Center"); linetypeSelector->addItem(QIcon("icons/" + icontheme + "/" + "linetypeother" + ".png"), "Other..."); toolbarProperties->addWidget(linetypeSelector); connect(linetypeSelector, SIGNAL(currentIndexChanged(int)), this, SLOT(linetypeSelectorIndexChanged(int))); toolbarProperties->addSeparator(); lineweightSelector->setFocusProxy(prompt); //NOTE: Qt4.7 wont load icons without an extension... lineweightSelector->addItem(QIcon("icons/" + icontheme + "/" + "lineweightbylayer" + ".png"), "ByLayer", -2.00); lineweightSelector->addItem(QIcon("icons/" + icontheme + "/" + "lineweightbyblock" + ".png"), "ByBlock", -1.00); lineweightSelector->addItem(QIcon("icons/" + icontheme + "/" + "lineweightdefault" + ".png"), "Default", 0.00); //TODO: Thread weight is weird. See http://en.wikipedia.org/wiki/Thread_(yarn)#Weight lineweightSelector->addItem(QIcon("icons/" + icontheme + "/" + "lineweight01" + ".png"), "0.00 mm", 0.00); lineweightSelector->addItem(QIcon("icons/" + icontheme + "/" + "lineweight02" + ".png"), "0.05 mm", 0.05); lineweightSelector->addItem(QIcon("icons/" + icontheme + "/" + "lineweight03" + ".png"), "0.15 mm", 0.15); lineweightSelector->addItem(QIcon("icons/" + icontheme + "/" + "lineweight04" + ".png"), "0.20 mm", 0.20); lineweightSelector->addItem(QIcon("icons/" + icontheme + "/" + "lineweight05" + ".png"), "0.25 mm", 0.25); lineweightSelector->addItem(QIcon("icons/" + icontheme + "/" + "lineweight06" + ".png"), "0.30 mm", 0.30); lineweightSelector->addItem(QIcon("icons/" + icontheme + "/" + "lineweight07" + ".png"), "0.35 mm", 0.35); lineweightSelector->addItem(QIcon("icons/" + icontheme + "/" + "lineweight08" + ".png"), "0.40 mm", 0.40); lineweightSelector->addItem(QIcon("icons/" + icontheme + "/" + "lineweight09" + ".png"), "0.45 mm", 0.45); lineweightSelector->addItem(QIcon("icons/" + icontheme + "/" + "lineweight10" + ".png"), "0.50 mm", 0.50); lineweightSelector->addItem(QIcon("icons/" + icontheme + "/" + "lineweight11" + ".png"), "0.55 mm", 0.55); lineweightSelector->addItem(QIcon("icons/" + icontheme + "/" + "lineweight12" + ".png"), "0.60 mm", 0.60); lineweightSelector->addItem(QIcon("icons/" + icontheme + "/" + "lineweight13" + ".png"), "0.65 mm", 0.65); lineweightSelector->addItem(QIcon("icons/" + icontheme + "/" + "lineweight14" + ".png"), "0.70 mm", 0.70); lineweightSelector->addItem(QIcon("icons/" + icontheme + "/" + "lineweight15" + ".png"), "0.75 mm", 0.75); lineweightSelector->addItem(QIcon("icons/" + icontheme + "/" + "lineweight16" + ".png"), "0.80 mm", 0.80); lineweightSelector->addItem(QIcon("icons/" + icontheme + "/" + "lineweight17" + ".png"), "0.85 mm", 0.85); lineweightSelector->addItem(QIcon("icons/" + icontheme + "/" + "lineweight18" + ".png"), "0.90 mm", 0.90); lineweightSelector->addItem(QIcon("icons/" + icontheme + "/" + "lineweight19" + ".png"), "0.95 mm", 0.95); lineweightSelector->addItem(QIcon("icons/" + icontheme + "/" + "lineweight20" + ".png"), "1.00 mm", 1.00); lineweightSelector->addItem(QIcon("icons/" + icontheme + "/" + "lineweight21" + ".png"), "1.05 mm", 1.05); lineweightSelector->addItem(QIcon("icons/" + icontheme + "/" + "lineweight22" + ".png"), "1.10 mm", 1.10); lineweightSelector->addItem(QIcon("icons/" + icontheme + "/" + "lineweight23" + ".png"), "1.15 mm", 1.15); lineweightSelector->addItem(QIcon("icons/" + icontheme + "/" + "lineweight24" + ".png"), "1.20 mm", 1.20); lineweightSelector->setMinimumContentsLength(8); // Prevent dropdown text readability being squish...d. toolbarProperties->addWidget(lineweightSelector); connect(lineweightSelector, SIGNAL(currentIndexChanged(int)), this, SLOT(lineweightSelectorIndexChanged(int))); connect(toolbarProperties, SIGNAL(topLevelChanged(bool)), this, SLOT(floatingChangedToolBar(bool))); }
MainWindow::MainWindow() : QMainWindow(0) { readSettings(); QString lang = getSettingsGeneralLanguage(); qDebug("language: %s", qPrintable(lang)); if(lang == "system") lang = QLocale::system().languageToString(QLocale::system().language()).toLower(); //Load translations for the Embroidermodder 2 GUI QTranslator translatorEmb; translatorEmb.load("translations/" + lang + "/embroidermodder2_" + lang); qApp->installTranslator(&translatorEmb); //Load translations for the commands QTranslator translatorCmd; translatorCmd.load("translations/" + lang + "/commands_" + lang); qApp->installTranslator(&translatorCmd); //Load translations provided by Qt - this covers dialog buttons and other common things. QTranslator translatorQt; translatorQt.load("qt_" + QLocale::system().name(), QLibraryInfo::location(QLibraryInfo::TranslationsPath)); qApp->installTranslator(&translatorQt); //Init mainWin = this; //Menus fileMenu = new QMenu(tr("&File"), this); editMenu = new QMenu(tr("&Edit"), this); viewMenu = new QMenu(tr("&View"), this); settingsMenu = new QMenu(tr("&Settings"), this); windowMenu = new QMenu(tr("&Window"), this); helpMenu = new QMenu(tr("&Help"), this); //SubMenus recentMenu = new QMenu(tr("Open &Recent"), this); zoomMenu = new QMenu(tr("&Zoom"), this); panMenu = new QMenu(tr("&Pan"), this); //Toolbars toolbarFile = addToolBar(tr("File")); toolbarEdit = addToolBar(tr("Edit")); toolbarView = addToolBar(tr("View")); toolbarZoom = addToolBar(tr("Zoom")); toolbarPan = addToolBar(tr("Pan")); toolbarIcon = addToolBar(tr("Icon")); toolbarHelp = addToolBar(tr("Help")); toolbarLayer = addToolBar(tr("Layer")); toolbarProperties = addToolBar(tr("Properties")); toolbarText = addToolBar(tr("Text")); toolbarPrompt = addToolBar(tr("Command Prompt")); //Selectors layerSelector = new QComboBox(this); colorSelector = new QComboBox(this); linetypeSelector = new QComboBox(this); lineweightSelector = new QComboBox(this); textFontSelector = new QFontComboBox(this); textSizeSelector = new QComboBox(this); numOfDocs = 0; docIndex = 0; shiftKeyPressedState = false; setWindowIcon(QIcon("icons/" + getSettingsGeneralIconTheme() + "/" + "app" + ".png")); //create the mdiArea QFrame* vbox = new QFrame(this); QVBoxLayout* layout = new QVBoxLayout(vbox); layout->setMargin(0); vbox->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); mdiArea = new MdiArea(this, vbox); mdiArea->useBackgroundLogo(getSettingsGeneralMdiBGUseLogo()); mdiArea->useBackgroundTexture(getSettingsGeneralMdiBGUseTexture()); mdiArea->useBackgroundColor(getSettingsGeneralMdiBGUseColor()); mdiArea->setBackgroundLogo(getSettingsGeneralMdiBGLogo()); mdiArea->setBackgroundTexture(getSettingsGeneralMdiBGTexture()); mdiArea->setBackgroundColor(QColor(getSettingsGeneralMdiBGColor())); mdiArea->setViewMode(QMdiArea::TabbedView); mdiArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); mdiArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); mdiArea->setActivationOrder(QMdiArea::ActivationHistoryOrder); layout->addWidget(mdiArea); setCentralWidget(vbox); //create the Command Prompt prompt = new CmdPrompt(this); prompt->setFocus(Qt::OtherFocusReason); this->setFocusProxy(prompt); mdiArea->setFocusProxy(prompt); prompt->setPromptTextColor(QColor(getSettingsPromptTextColor())); prompt->setPromptBackgroundColor(QColor(getSettingsPromptBGColor())); connect(prompt, SIGNAL(startCommand(const QString&)), this, SLOT(runCommandMain(const QString&))); connect(prompt, SIGNAL(runCommand(const QString&, const QString&)), this, SLOT(runCommandPrompt(const QString&, const QString&))); connect(prompt, SIGNAL(deletePressed()), this, SLOT(deletePressed())); //TODO: connect(prompt, SIGNAL(tabPressed()), this, SLOT(someUnknownSlot())); connect(prompt, SIGNAL(escapePressed()), this, SLOT(escapePressed())); connect(prompt, SIGNAL(F1Pressed()), this, SLOT(help())); //TODO: connect(prompt, SIGNAL(F2Pressed()), this, SLOT(floatHistory())); //TODO: connect(prompt, SIGNAL(F3Pressed()), this, SLOT(toggleQSNAP())); connect(prompt, SIGNAL(F4Pressed()), this, SLOT(toggleLwt())); //TODO: typically this is toggleTablet(), make F-Keys customizable thru settings //TODO: connect(prompt, SIGNAL(F5Pressed()), this, SLOT(toggleISO())); //TODO: connect(prompt, SIGNAL(F6Pressed()), this, SLOT(toggleCoords())); connect(prompt, SIGNAL(F7Pressed()), this, SLOT(toggleGrid())); //TODO: connect(prompt, SIGNAL(F8Pressed()), this, SLOT(toggleORTHO())); //TODO: connect(prompt, SIGNAL(F9Pressed()), this, SLOT(toggleSNAP())); //TODO: connect(prompt, SIGNAL(F10Pressed()), this, SLOT(togglePOLAR())); //TODO: connect(prompt, SIGNAL(F11Pressed()), this, SLOT(toggleQTRACK())); connect(prompt, SIGNAL(F12Pressed()), this, SLOT(toggleRuler())); connect(prompt, SIGNAL(cutPressed()), this, SLOT(cut())); connect(prompt, SIGNAL(copyPressed()), this, SLOT(copy())); connect(prompt, SIGNAL(pastePressed()), this, SLOT(paste())); connect(prompt, SIGNAL(selectAllPressed()), this, SLOT(selectAll())); connect(prompt, SIGNAL(undoPressed()), this, SLOT(undo())); connect(prompt, SIGNAL(redoPressed()), this, SLOT(redo())); connect(prompt, SIGNAL(shiftPressed()), this, SLOT(setShiftPressed())); connect(prompt, SIGNAL(shiftReleased()), this, SLOT(setShiftReleased())); //create the Object Property Editor dockPropEdit = new PropertyEditor("icons/" + getSettingsGeneralIconTheme(), getSettingsSelectionModePickAdd(), prompt, this); addDockWidget(Qt::LeftDockWidgetArea, dockPropEdit); connect(dockPropEdit, SIGNAL(pickAddModeToggled()), this, SLOT(pickAddModeToggled())); //create the Command History Undo Editor dockUndoEdit = new UndoEditor("icons/" + getSettingsGeneralIconTheme(), prompt, this); addDockWidget(Qt::LeftDockWidgetArea, dockUndoEdit); //setDockOptions(QMainWindow::AnimatedDocks | QMainWindow::AllowTabbedDocks | QMainWindow::VerticalTabs); //TODO: Load these from settings //tabifyDockWidget(dockPropEdit, dockUndoEdit); //TODO: load this from settings //Javascript initMainWinPointer(this); engine = new QScriptEngine(this); engine->installTranslatorFunctions(); debugger = new QScriptEngineDebugger(this); debugger->attachTo(engine); javaInitNatives(engine); //Load all commands in a loop QDir commandDir("commands"); QStringList cmdList = commandDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot); foreach(QString cmdName, cmdList) { javaLoadCommand(cmdName); }