ScripterCore::ScripterCore(QWidget* parent) { menuMgr = NULL; pcon = new PythonConsole(parent); scrScripterActions.clear(); scrRecentScriptActions.clear(); returnString = "init"; scrScripterActions.insert("scripterExecuteScript", new ScrAction(QObject::tr("&Execute Script..."), QKeySequence(), this)); scrScripterActions.insert("scripterShowConsole", new ScrAction(QObject::tr("Show &Console"), QKeySequence(), this)); scrScripterActions.insert("scripterAboutScript", new ScrAction(QObject::tr("&About Script..."), QKeySequence(), this)); scrScripterActions["scripterExecuteScript"]->setMenuRole(QAction::NoRole); scrScripterActions["scripterShowConsole"]->setMenuRole(QAction::NoRole); scrScripterActions["scripterAboutScript"]->setMenuRole(QAction::NoRole); scrScripterActions["scripterShowConsole"]->setToggleAction(true); scrScripterActions["scripterShowConsole"]->setChecked(false); QObject::connect( scrScripterActions["scripterExecuteScript"], SIGNAL(triggered()) , this, SLOT(runScriptDialog()) ); QObject::connect( scrScripterActions["scripterShowConsole"], SIGNAL(toggled(bool)) , this, SLOT(slotInteractiveScript(bool)) ); QObject::connect( scrScripterActions["scripterAboutScript"], SIGNAL(triggered()) , this, SLOT(aboutScript()) ); SavedRecentScripts.clear(); ReadPlugPrefs(); QObject::connect(pcon, SIGNAL(runCommand()), this, SLOT(slotExecute())); QObject::connect(pcon, SIGNAL(paletteShown(bool)), this, SLOT(slotInteractiveScript(bool))); QObject::connect(ScQApp, SIGNAL(appStarted()) , this, SLOT(runStartupScript()) ); QObject::connect(ScQApp, SIGNAL(appStarted()) , this, SLOT(slotRunPythonScript()) ); }
int ScribusQApp::init() { m_ScCore=new ScribusCore(); Q_CHECK_PTR(m_ScCore); if (!m_ScCore) return EXIT_FAILURE; ScCore=m_ScCore; processEvents(); ScCore->init(useGUI, m_filesToLoad); int retVal=EXIT_SUCCESS; /* TODO: * When Scribus is truly able to run without GUI * we should uncomment if (useGUI) * and delete if (true) */ // if (useGUI) if (true) retVal=ScCore->startGUI(m_showSplash, m_showFontInfo, m_showProfileInfo, m_lang, m_prefsUserFile); // A hook for plugins and scripts to trigger on. Some plugins and scripts // require the app to be fully set up (in particular, the main window to be // built and shown) before running their setup. emit appStarted(); return retVal; }
int ScribusCore::startGUI(bool showSplash, bool showFontInfo, bool showProfileInfo, const QString newGuiLanguage, const QString prefsUserFile) { // m_PaletteParent=new QWidget(0); // Q_CHECK_PTR(m_PaletteParent); ScribusMainWindow* scribus = new ScribusMainWindow(); Q_CHECK_PTR(scribus); if (!scribus) return(EXIT_FAILURE); ScMWList.append(scribus); m_currScMW=0; // ScMW=scribus; int retVal=initScribusCore(showSplash, showFontInfo, showProfileInfo,newGuiLanguage, prefsUserFile); if (retVal == 1) return(EXIT_FAILURE); retVal = scribus->initScMW(true); if (retVal == 1) return(EXIT_FAILURE); closeSplash(); m_ScribusInitialized=true; // ScQApp->setMainWidget(scribus); connect(ScQApp, SIGNAL(lastWindowClosed()), ScQApp, SLOT(quit())); scribus->show(); int subsRet=scribus->ShowSubs(); if (subsRet==0) { if (!m_Files.isEmpty()) { for (int i = 0; i < m_Files.size(); ++i) scribus->loadDoc(m_Files.at(i)); } else { if (PrefsManager::instance()->appPrefs.uiPrefs.showStartupDialog) scribus->startUpDialog(); else scribus->setFocus(); } } else if (subsRet==QMessageBox::Help) { scribus->slotRaiseOnlineHelp(); } qApp->setOverrideCursor(QCursor(Qt::ArrowCursor)); // A hook for plugins and scripts to trigger on. Some plugins and scripts // require the app to be fully set up (in particular, the main window to be // built and shown) before running their setup. emit appStarted(); return EXIT_SUCCESS; }