Commit d13f94c0 authored by Pierre Kraemer's avatar Pierre Kraemer

SCHNApps : toggle automatic snapshots using the 'S' key

parent 7c660fcf
......@@ -160,6 +160,8 @@ protected:
Utils::Texture<2, Geom::Vec3uc>* m_textureWallpaper;
Utils::ShaderWallPaper* m_shaderWallpaper;
bool b_saveSnapshots;
};
} // namespace SCHNApps
......
......@@ -41,10 +41,15 @@ View::View(const QString& name, SCHNApps* s, QGLFormat& format) :
m_dialogCameras(NULL),
m_frameDrawer(NULL),
m_textureWallpaper(NULL),
m_shaderWallpaper(NULL)
m_shaderWallpaper(NULL),
b_saveSnapshots(false)
{
++viewCount;
setSnapshotFormat("JPEG");
setSnapshotFileName(m_name);
setSnapshotQuality(95);
m_currentCamera = m_schnapps->addCamera();
m_currentCamera->linkView(this);
......@@ -104,6 +109,10 @@ View::View(const QString& name, SCHNApps* s, QGLFormat& format, const QGLWidget
{
++viewCount;
setSnapshotFormat("JPEG");
setSnapshotFileName(m_name);
setSnapshotQuality(95);
m_currentCamera = m_schnapps->addCamera();
m_currentCamera->linkView(this);
......@@ -545,9 +554,20 @@ void View::drawFrame()
void View::keyPressEvent(QKeyEvent* event)
{
if (event->key() == Qt::Key_S)
{
b_saveSnapshots = !b_saveSnapshots;
if (b_saveSnapshots)
connect(this, SIGNAL(drawFinished(bool)), this, SLOT(saveSnapshot(bool)));
else
disconnect(this, SIGNAL(drawFinished(bool)), this, SLOT(saveSnapshot(bool)));
}
else
{
foreach(PluginInteraction* plugin, l_plugins)
plugin->keyPress(this, event);
QGLViewer::keyPressEvent(event);
}
}
void View::keyReleaseEvent(QKeyEvent *event)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment