void CBuilder::run() { valid = false; absoluteMainSources= cprojectObject->absoluteMainSources(); developMode = cprojectObject->developMode(); if (developMode == "UserDefined") { makefile = cprojectObject->makefile(); QFileInfo fileInfo(makefile); if (!fileInfo.exists() && !fileInfo.isFile()) { emit buildError("Makefile not exists \"" + fileInfo.absoluteFilePath() + "\"."); valid = true; return; } workingDir = fileInfo.path(); makefile = fileInfo.fileName(); valid = true; return; } FileTools fileTools; if (!fileTools.mkdir(rootPath + "/" + developMode)) { emit buildError(fileTools.errorString()); return; } subdirs.clear(); buildErrorStr.clear(); if (scan) { scanSources(rootPath); // 扫描源文件 if (!buildErrorStr.isEmpty()) { emit buildError(buildErrorStr); buildErrorStr.clear(); } buildErrorStr.clear(); if (!buildMakefile()) { emit buildError(buildErrorStr); buildErrorStr.clear(); return; } } valid = true; } // run
/// \brief Report an Error to a client. /// /// The error reported generates an error operation. /// This is used instead of error() when an event occurs which is of no /// interest to the server admin, or world builder, and should only be /// be reported to the client. It stops the logs from getting filled /// with reports of authentication failures, and other similar occurences. /// @param op The operation that caused the error. /// @param errstring A message describing the error. /// @param res The resulting error operation is returned here. /// @param to The error operation should be directed to this ID. void Router::clientError(const Operation & op, const std::string & errstring, OpVector & res, const std::string & to) const { Atlas::Objects::Operation::Error e; buildError(op, errstring, e, to); res.push_back(e); }
/// \brief Report an Error. /// /// The error reported is noted in the log, and an error operation is /// genereated. /// @param op The operation that caused the error. /// @param errstring A message describing the error. /// @param res The resulting error operation is returned here. /// @param to The error operation should be directed to this ID. void Router::error(const Operation & op, const std::string & errstring, OpVector & res, const std::string & to) const { Atlas::Objects::Operation::Error e; log(NOTICE, String::compose("ERROR generated by %1 with message [%2]", getId(), errstring)); buildError(op, errstring, e, to); res.push_back(e); }
bool Builder::setParam( const std::string & param_name, ParamInfo< double >, const std::string &, const std::string & name, int lineno ) { buildError( m_module_name, param_name, "'" + m_module_name + "' has no string parameter called '" + param_name + "'", name, lineno ); return false; }
bool Builder::doBuildParam( const std::string & param_name, const std::string & value, const std::string & name, int lineno ) { IntMap::iterator int_iter = m_ints.find( param_name ); if ( int_iter != m_ints.end() ) { return setParam( param_name, int_iter->second, value, name, lineno ); } BoolMap::iterator bool_iter = m_bools.find( param_name ); if ( bool_iter != m_bools.end() ) { return setParam( param_name, bool_iter->second, value, name, lineno ); } DoubMap::iterator doub_iter = m_doubs.find( param_name ); if ( doub_iter != m_doubs.end() ) { return setParam( param_name, doub_iter->second, value, name, lineno ); } StrMap::iterator str_iter = m_strs.find( param_name ); if ( str_iter != m_strs.end() ) { return setParam( param_name, str_iter->second, value, name, lineno ); } if ( param_name == "version" ) { m_parsed_version = value; return ( m_version == value ); } buildError( m_module_name, param_name, "'" + m_module_name + "' has no parameter called '" + param_name + "'", name, lineno ); return false; }
void CBuilder::make() { if (!valid) { return; } makeProcess = new QProcess; if (!makeProcess) { emit buildError("create build process failed."); return; } connect(makeProcess, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(makeFinished(int, QProcess::ExitStatus))); connect(makeProcess, SIGNAL(error(QProcess::ProcessError)), this, SLOT(makeError(QProcess::ProcessError))); makeProcess->setProcessChannelMode(QProcess::MergedChannels); QStringList args; if (developMode == "UserDefined") { // 如果是用户自定义模式 makeProcess->setWorkingDirectory(workingDir); args << "-f" << makefile; } else { makeProcess->setWorkingDirectory(rootPath + "/" + developMode); } if (targetList.isEmpty()) args << "all"; else args << targetList; QString makeTool = cprojectObject->make(); if (makeTool.isEmpty()) makeTool = "make"; makeProcess->start(makeTool, args); } // runMakeProcess
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { setWindowTitle(QCoreApplication::applicationName()); ui.setupUi(this); // setup preferences dialog connect(&preferences, SIGNAL(accepted()), this, SLOT(getApplicationSettings())); connect(&builder, SIGNAL(highlightLine(const QString &, int, int, const QString &)), this, SLOT(highlightFileLine(const QString &, int, int))); connect(&builder, SIGNAL(finished()), this, SLOT(setBuildAvailable())); connect(&builder, SIGNAL(buildError()), &preferences, SLOT(showPreferences())); parser = language.parser(); connect(&preferences, SIGNAL(updateColors()), this, SLOT(recolorProjectView())); connect(&preferences, SIGNAL(updateFonts(const QFont &)), this, SLOT(recolorProjectView())); connect(&preferences, SIGNAL(updateFonts(const QFont &)), this, SLOT(recolorBuildManager())); connect(&preferences, SIGNAL(accepted()), ui.editorTabs, SIGNAL(accepted())); connect(&preferences, SIGNAL(updateColors()), ui.editorTabs, SIGNAL(updateColors())); connect(&preferences, SIGNAL(updateFonts(const QFont &)), ui.editorTabs, SIGNAL(updateFonts(const QFont &))); recolorProjectView(); recolorBuildManager(); // project editor tabs ui.finder->connectFileManager(ui.editorTabs); QSplitterHandle *hndl = ui.splitter->handle(1); hndl->setEnabled(false); connect(ui.editorTabs, SIGNAL(fileUpdated(int)), this, SLOT(setProject())); // File Menu connect(ui.action_New, SIGNAL(triggered()), ui.editorTabs, SLOT(newFile())); connect(ui.actionNew_From_File, SIGNAL(triggered()), ui.editorTabs, SLOT(newFromFile())); connect(ui.actionNew_From_Template, SIGNAL(triggered()), this, SLOT(newFromTemplate())); connect(ui.action_Open, SIGNAL(triggered()), ui.editorTabs, SLOT(open())); connect(ui.action_Save,SIGNAL(triggered()),ui.editorTabs,SLOT(save())); connect(ui.actionSave_As,SIGNAL(triggered()),ui.editorTabs,SLOT(saveAs())); connect(ui.actionSave_All,SIGNAL(triggered()),ui.editorTabs,SLOT(saveAll())); ui.actionPrint->setEnabled(true); connect(ui.actionPrint,SIGNAL(triggered()),this,SLOT(printFile())); ui.action_Zip->setEnabled(true); connect(ui.action_Zip,SIGNAL(triggered()),this,SLOT(zipFiles())); recentFiles = findChildren<QAction *>(QRegExp("action_[0-9]+_File")); for (int i = 0; i < recentFiles.size(); i++) connect(recentFiles.at(i), SIGNAL(triggered()),this, SLOT(openRecentFile())); connect(ui.action_Close, SIGNAL(triggered()), ui.editorTabs, SLOT(closeFile())); connect(ui.actionClose_All, SIGNAL(triggered()), ui.editorTabs, SLOT(closeAll())); connect(ui.action_Quit, SIGNAL(triggered()), this, SLOT(quitProgram())); connect(ui.editorTabs, SIGNAL(saveAvailable(bool)), this, SLOT(setSaveAvailable(bool))); connect(ui.editorTabs, SIGNAL(saveAvailable(bool)), this, SLOT(setSaveAvailable(bool))); connect(ui.editorTabs, SIGNAL(closeAvailable(bool)), this, SLOT(setCloseAvailable(bool))); connect(ui.editorTabs, SIGNAL(closeAvailable(bool)), this, SLOT(setCloseAvailable(bool))); connect(ui.editorTabs, SIGNAL(closeAvailable(bool)), this, SLOT(setBuildAvailable(bool))); // Edit Menu connect(ui.action_Undo, SIGNAL(triggered()), ui.editorTabs, SLOT(undo())); connect(ui.action_Redo, SIGNAL(triggered()), ui.editorTabs, SLOT(redo())); connect(ui.action_Cut, SIGNAL(triggered()), ui.editorTabs, SLOT(cut())); connect(ui.action_Copy, SIGNAL(triggered()), ui.editorTabs, SLOT(copy())); connect(ui.action_Paste, SIGNAL(triggered()), ui.editorTabs, SLOT(paste())); connect(ui.actionSelect_All, SIGNAL(triggered()), ui.editorTabs, SLOT(selectAll())); connect(ui.action_Find, SIGNAL(triggered()), ui.finder, SLOT(showFinder())); connect(ui.actionFind_Next, SIGNAL(triggered()), ui.finder, SLOT(findNext())); connect(ui.actionFind_Previous,SIGNAL(triggered()), ui.finder, SLOT(findPrevious())); connect(ui.actionPreferences, SIGNAL(triggered()), &preferences, SLOT(showPreferences())); connect(ui.editorTabs, SIGNAL(undoAvailable(bool)), ui.action_Undo,SLOT(setEnabled(bool))); connect(ui.editorTabs, SIGNAL(redoAvailable(bool)), ui.action_Redo,SLOT(setEnabled(bool))); connect(ui.editorTabs, SIGNAL(copyAvailable(bool)), ui.action_Cut,SLOT(setEnabled(bool))); connect(ui.editorTabs, SIGNAL(copyAvailable(bool)), ui.action_Copy,SLOT(setEnabled(bool))); // View Menu connect(ui.actionShow_Browser, SIGNAL(triggered()), this, SLOT(showBrowser())); connect(ui.actionBigger_Font, SIGNAL(triggered()), this, SLOT(fontBigger())); connect(ui.actionSmaller_Font, SIGNAL(triggered()), this, SLOT(fontSmaller())); ui.actionBigger_Font->setShortcuts(QList<QKeySequence>() << QKeySequence::ZoomIn << Qt::CTRL+Qt::Key_Equal); // Project Menu connect(ui.actionMemory_Map,SIGNAL(triggered()), this, SLOT(spawnMemoryMap())); connect(ui.actionBuild, SIGNAL(triggered()), this, SLOT(programBuild())); connect(ui.actionRun, SIGNAL(triggered()), this, SLOT(programRun())); connect(ui.actionWrite, SIGNAL(triggered()), this, SLOT(programWrite())); connect(ui.actionTerminal, SIGNAL(triggered()), this, SLOT(spawnTerminal())); // Help Menu connect(ui.actionPropeller_Quick_Reference, SIGNAL(triggered()), this, SLOT(propellerQuickReference())); connect(ui.actionPropeller_Datasheet, SIGNAL(triggered()), this, SLOT(propellerDatasheet())); connect(ui.actionPropeller_Manual, SIGNAL(triggered()), this, SLOT(propellerManual())); connect(ui.actionPropBASIC_Manual, SIGNAL(triggered()), this, SLOT(propBasicManual())); connect(ui.action_About, SIGNAL(triggered()), this, SLOT(about())); // Toolbar Extras cbPort = new QComboBox(this); cbPort->setLayoutDirection(Qt::LeftToRight); cbPort->setToolTip(tr("Select Serial Port")); cbPort->setSizeAdjustPolicy(QComboBox::AdjustToContents); ui.toolBar->addWidget(cbPort); connect(ui.projectview, SIGNAL(showFileLine(QString, int)), this, SLOT(highlightFileLine(QString, int))); updateRecentFileActions(); connect(ui.editorTabs, SIGNAL(sendMessage(const QString &)), this,SLOT(showMessage(const QString &))); connect(ui.finder, SIGNAL(sendMessage(const QString &)), this,SLOT(showMessage(const QString &))); restoreGeometry(QSettings().value("windowSize").toByteArray()); getApplicationSettings(); connect(&manager, SIGNAL(portListChanged()), this, SLOT(updatePorts())); manager.enablePortMonitor(true); updatePorts(); QSettings settings; QString lastport = settings.value("lastPort", QString()).toString(); if (!lastport.isEmpty()) { int index = cbPort->findText(lastport); if (index != -1) cbPort->setCurrentIndex(index); } ui.editorTabs->newFile(); loadSession(); installEventFilter(this); statusBar(); }
void CBuilder::makeError(QProcess::ProcessError error) { if (error == QProcess::FailedToStart) { emit buildError("make process failed start."); } } // processError