ScriptConsole.cpp   ScriptConsole.cpp 
skipping to change at line 92 skipping to change at line 92
connect(ui->loadButton, SIGNAL(clicked()), this, SLOT(loadScript())) ; connect(ui->loadButton, SIGNAL(clicked()), this, SLOT(loadScript())) ;
connect(ui->saveButton, SIGNAL(clicked()), this, SLOT(saveScript())) ; connect(ui->saveButton, SIGNAL(clicked()), this, SLOT(saveScript())) ;
connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clearButtonPr essed())); connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clearButtonPr essed()));
connect(ui->preprocessSSCButton, SIGNAL(clicked()), this, SLOT(prepr ocessScript())); connect(ui->preprocessSSCButton, SIGNAL(clicked()), this, SLOT(prepr ocessScript()));
connect(ui->runButton, SIGNAL(clicked()), this, SLOT(runScript())); connect(ui->runButton, SIGNAL(clicked()), this, SLOT(runScript()));
connect(ui->stopButton, SIGNAL(clicked()), &StelApp::getInstance().g etScriptMgr(), SLOT(stopScript())); connect(ui->stopButton, SIGNAL(clicked()), &StelApp::getInstance().g etScriptMgr(), SLOT(stopScript()));
connect(ui->includeBrowseButton, SIGNAL(clicked()), this, SLOT(inclu deBrowse())); connect(ui->includeBrowseButton, SIGNAL(clicked()), this, SLOT(inclu deBrowse()));
connect(ui->quickrunCombo, SIGNAL(currentIndexChanged(int)), this, S LOT(quickRun(int))); connect(ui->quickrunCombo, SIGNAL(currentIndexChanged(int)), this, S LOT(quickRun(int)));
connect(&StelApp::getInstance().getScriptMgr(), SIGNAL(scriptStopped ()), this, SLOT(scriptEnded())); connect(&StelApp::getInstance().getScriptMgr(), SIGNAL(scriptStopped ()), this, SLOT(scriptEnded()));
connect(&StelApp::getInstance().getScriptMgr(), SIGNAL(scriptDebug(c onst QString&)), this, SLOT(appendLogLine(const QString&))); connect(&StelApp::getInstance().getScriptMgr(), SIGNAL(scriptDebug(c onst QString&)), this, SLOT(appendLogLine(const QString&)));
connect(&StelApp::getInstance().getScriptMgr(), SIGNAL(scriptOutput( const QString&)), this, SLOT(appendOutputLine(const QString&)));
#ifndef ENABLE_STRATOSCRIPT_COMPAT #ifndef ENABLE_STRATOSCRIPT_COMPAT
ui->preprocessSTSButton->setHidden(true); ui->preprocessSTSButton->setHidden(true);
#else #else
connect(ui->preprocessSTSButton, SIGNAL(clicked()), this, SLOT(prepr ocessScript())); connect(ui->preprocessSTSButton, SIGNAL(clicked()), this, SLOT(prepr ocessScript()));
#endif #endif
ui->tabs->setCurrentIndex(0); ui->tabs->setCurrentIndex(0);
ui->scriptEdit->setFocus(); ui->scriptEdit->setFocus();
} }
void ScriptConsole::loadScript() void ScriptConsole::loadScript()
skipping to change at line 143 skipping to change at line 144
} }
else else
qWarning() << "ERROR - cannot write script file"; qWarning() << "ERROR - cannot write script file";
} }
void ScriptConsole::clearButtonPressed() void ScriptConsole::clearButtonPressed()
{ {
if (ui->tabs->currentIndex() == 0) if (ui->tabs->currentIndex() == 0)
ui->scriptEdit->clear(); ui->scriptEdit->clear();
else if (ui->tabs->currentIndex() == 1) else if (ui->tabs->currentIndex() == 1)
ui->logBrowser->clear();
else if (ui->tabs->currentIndex() == 2)
ui->outputBrowser->clear(); ui->outputBrowser->clear();
} }
void ScriptConsole::preprocessScript() void ScriptConsole::preprocessScript()
{ {
qDebug() << "ScriptConsole::preprocessScript"; qDebug() << "ScriptConsole::preprocessScript";
QTemporaryFile src(QDir::tempPath() + "/stelscriptXXXXXX"); QTemporaryFile src(QDir::tempPath() + "/stelscriptXXXXXX");
QString dest; QString dest;
QString srcName; QString srcName;
if (src.open()) if (src.open())
skipping to change at line 182 skipping to change at line 185
ui->scriptEdit->setPlainText(dest); ui->scriptEdit->setPlainText(dest);
src.close(); src.close();
} }
ui->tabs->setCurrentIndex(0); ui->tabs->setCurrentIndex(0);
} }
void ScriptConsole::runScript() void ScriptConsole::runScript()
{ {
ui->tabs->setCurrentIndex(1); ui->tabs->setCurrentIndex(1);
ui->outputBrowser->setHtml(""); ui->logBrowser->setHtml("");
QTemporaryFile file(QDir::tempPath() + "/stelscriptXXXXXX.ssc"); QTemporaryFile file(QDir::tempPath() + "/stelscriptXXXXXX.ssc");
QString fileName; QString fileName;
if (file.open()) { if (file.open()) {
QTextStream out(&file); QTextStream out(&file);
out << ui->scriptEdit->toPlainText() << "\n"; out << ui->scriptEdit->toPlainText() << "\n";
fileName = file.fileName(); fileName = file.fileName();
file.close(); file.close();
} }
else else
{ {
skipping to change at line 224 skipping to change at line 227
} }
file.close(); file.close();
} }
return; return;
} }
} }
void ScriptConsole::scriptEnded() void ScriptConsole::scriptEnded()
{ {
qDebug() << "ScriptConsole::scriptEnded"; qDebug() << "ScriptConsole::scriptEnded";
QString html = ui->outputBrowser->toHtml(); QString html = ui->logBrowser->toHtml();
appendLogLine(QString("Script finished at %1").arg(QDateTime::curren tDateTime().toString())); appendLogLine(QString("Script finished at %1").arg(QDateTime::curren tDateTime().toString()));
ui->runButton->setEnabled(true); ui->runButton->setEnabled(true);
ui->stopButton->setEnabled(false); ui->stopButton->setEnabled(false);
} }
void ScriptConsole::appendLogLine(const QString& s) void ScriptConsole::appendLogLine(const QString& s)
{ {
QString html = ui->logBrowser->toHtml();
html.replace(QRegExp("^\\s+"), "");
// if (html!="")
// html += "<br />";
html += s;
ui->logBrowser->setHtml(html);
}
void ScriptConsole::appendOutputLine(const QString& s)
{
QString html = ui->outputBrowser->toHtml(); QString html = ui->outputBrowser->toHtml();
html.replace(QRegExp("^\\s+"), ""); html.replace(QRegExp("^\\s+"), "");
// if (html!="") // if (html!="")
// html += "<br />"; // html += "<br />";
html += s; html += s;
ui->outputBrowser->setHtml(html); ui->outputBrowser->setHtml(html);
} }
void ScriptConsole::includeBrowse() void ScriptConsole::includeBrowse()
 End of changes. 5 change blocks. 
2 lines changed or deleted 16 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/