StelMainView.cpp   StelMainView.cpp 
skipping to change at line 429 skipping to change at line 429
if (!format().doubleBuffer()) if (!format().doubleBuffer())
qWarning("Could not get double buffer; results will be suboptimal"); qWarning("Could not get double buffer; results will be suboptimal");
} }
}; };
#endif #endif
StelMainView::StelMainView(QWidget* parent) StelMainView::StelMainView(QWidget* parent)
: QGraphicsView(parent), guiItem(NULL), gui(NULL), : QGraphicsView(parent), guiItem(NULL), gui(NULL),
flagInvertScreenShotColors(false), flagInvertScreenShotColors(false),
flagOverwriteScreenshots(false),
screenShotPrefix("stellarium-"), screenShotPrefix("stellarium-"),
screenShotDir(""), screenShotDir(""),
cursorTimeout(-1.f), flagCursorTimeout(false), minFpsTimer(NULL), maxfps(10000.f) cursorTimeout(-1.f), flagCursorTimeout(false), minFpsTimer(NULL), maxfps(10000.f)
{ {
StelApp::initStatic(); StelApp::initStatic();
// Can't create 2 StelMainView instances // Can't create 2 StelMainView instances
Q_ASSERT(!singleton); Q_ASSERT(!singleton);
singleton = this; singleton = this;
skipping to change at line 1167 skipping to change at line 1168
} }
//! Delete openGL textures (to call before the GLContext disappears) //! Delete openGL textures (to call before the GLContext disappears)
void StelMainView::deinitGL() void StelMainView::deinitGL()
{ {
StelApp::getInstance().deinit(); StelApp::getInstance().deinit();
delete gui; delete gui;
gui = NULL; gui = NULL;
} }
void StelMainView::saveScreenShot(const QString& filePrefix, const QString& saveDir) void StelMainView::saveScreenShot(const QString& filePrefix, const QString& saveDir, const bool overwrite)
{ {
screenShotPrefix = filePrefix; screenShotPrefix = filePrefix;
screenShotDir = saveDir; screenShotDir = saveDir;
flagOverwriteScreenshots=overwrite;
emit(screenshotRequested()); emit(screenshotRequested());
} }
void StelMainView::doScreenshot(void) void StelMainView::doScreenshot(void)
{ {
QFileInfo shotDir; QFileInfo shotDir;
#if STEL_USE_NEW_OPENGL_WIDGETS #if STEL_USE_NEW_OPENGL_WIDGETS
QImage im = glWidget->grabFramebuffer(); QImage im = glWidget->grabFramebuffer();
#else #else
QImage im = glWidget->grabFrameBuffer(); QImage im = glWidget->grabFrameBuffer();
skipping to change at line 1202 skipping to change at line 1204
qWarning() << "ERROR requested screenshot directory is not a directory: " << QDir::toNativeSeparators(shotDir.filePath()); qWarning() << "ERROR requested screenshot directory is not a directory: " << QDir::toNativeSeparators(shotDir.filePath());
return; return;
} }
else if (!shotDir.isWritable()) else if (!shotDir.isWritable())
{ {
qWarning() << "ERROR requested screenshot directory is not w ritable: " << QDir::toNativeSeparators(shotDir.filePath()); qWarning() << "ERROR requested screenshot directory is not w ritable: " << QDir::toNativeSeparators(shotDir.filePath());
return; return;
} }
QFileInfo shotPath; QFileInfo shotPath;
for (int j=0; j<100000; ++j) if (flagOverwriteScreenshots)
{ {
shotPath = QFileInfo(shotDir.filePath() + "/" + screenShotPr shotPath = QFileInfo(shotDir.filePath() + "/" + screenShotPr
efix + QString("%1").arg(j, 3, 10, QLatin1Char('0')) + ".png"); efix + ".png");
if (!shotPath.exists()) }
break; else
{
for (int j=0; j<100000; ++j)
{
shotPath = QFileInfo(shotDir.filePath() + "/" + scre
enShotPrefix + QString("%1").arg(j, 3, 10, QLatin1Char('0')) + ".png");
if (!shotPath.exists())
break;
}
} }
qDebug() << "INFO Saving screenshot in file: " << QDir::toNativeSepa rators(shotPath.filePath()); qDebug() << "INFO Saving screenshot in file: " << QDir::toNativeSepa rators(shotPath.filePath());
if (!im.save(shotPath.filePath())) { if (!im.save(shotPath.filePath())) {
qWarning() << "WARNING failed to write screenshot to: " << Q Dir::toNativeSeparators(shotPath.filePath()); qWarning() << "WARNING failed to write screenshot to: " << Q Dir::toNativeSeparators(shotPath.filePath());
} }
} }
QPoint StelMainView::getMousePos() QPoint StelMainView::getMousePos()
{ {
return glWidget->mapFromGlobal(QCursor::pos()); return glWidget->mapFromGlobal(QCursor::pos());
} }
 End of changes. 6 change blocks. 
7 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/