StelScriptOutput.cpp   StelScriptOutput.cpp 
skipping to change at line 21 skipping to change at line 21
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#include "StelScriptOutput.hpp" #include "StelScriptOutput.hpp"
#include <QDir>
#include <QDebug> #include <QDebug>
// Init static variables. // Init static variables.
QFile StelScriptOutput::outputFile; QFile StelScriptOutput::outputFile;
QString StelScriptOutput::outputText; QString StelScriptOutput::outputText;
void StelScriptOutput::init(const QString& outputFilePath) void StelScriptOutput::init(const QString& outputFilePath)
{ {
outputFile.setFileName(outputFilePath); outputFile.setFileName(outputFilePath);
if (!outputFile.open(QIODevice::WriteOnly | QIODevice::Truncate | QI ODevice::Text | QIODevice::Unbuffered)) if (!outputFile.open(QIODevice::WriteOnly | QIODevice::Truncate | QI ODevice::Text | QIODevice::Unbuffered))
skipping to change at line 51 skipping to change at line 52
msg += "\n"; msg += "\n";
outputFile.write(qPrintable(msg), msg.size()); outputFile.write(qPrintable(msg), msg.size());
outputText += msg; outputText += msg;
} }
void StelScriptOutput::reset(void) void StelScriptOutput::reset(void)
{ {
outputFile.reset(); outputFile.reset();
outputText.clear(); outputText.clear();
} }
void StelScriptOutput::saveOutputAs(const QString &name)
{
QFile asFile;
QFileInfo outputInfo(outputFile);
QDir dir=outputInfo.dir(); // will hold complete dirname
asFile.setFileName(dir.absolutePath() + "/" + name);
if (!asFile.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODev
ice::Text | QIODevice::Unbuffered))
{
qDebug() << "ERROR: Cannot open file" << dir.absolutePath()
+ "/" + name;
return;
}
qDebug() << "saving copy of output.txt to " << dir.absolutePath() +
"/" + name;
asFile.write(qPrintable(outputText), outputText.size());
asFile.close();
}
 End of changes. 2 change blocks. 
0 lines changed or deleted 1 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/