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: ...@@ -160,6 +160,8 @@ protected:
Utils::Texture<2, Geom::Vec3uc>* m_textureWallpaper; Utils::Texture<2, Geom::Vec3uc>* m_textureWallpaper;
Utils::ShaderWallPaper* m_shaderWallpaper; Utils::ShaderWallPaper* m_shaderWallpaper;
bool b_saveSnapshots;
}; };
} // namespace SCHNApps } // namespace SCHNApps
......
...@@ -21,7 +21,7 @@ namespace SCHNApps ...@@ -21,7 +21,7 @@ namespace SCHNApps
{ {
unsigned int View::viewCount = 0; unsigned int View::viewCount = 0;
View::View(const QString& name, SCHNApps* s, QGLFormat& format) : View::View(const QString& name, SCHNApps* s, QGLFormat& format) :
QGLViewer(format, NULL, NULL), QGLViewer(format, NULL, NULL),
b_updatingUI(false), b_updatingUI(false),
m_name(name), m_name(name),
...@@ -41,10 +41,15 @@ View::View(const QString& name, SCHNApps* s, QGLFormat& format) : ...@@ -41,10 +41,15 @@ View::View(const QString& name, SCHNApps* s, QGLFormat& format) :
m_dialogCameras(NULL), m_dialogCameras(NULL),
m_frameDrawer(NULL), m_frameDrawer(NULL),
m_textureWallpaper(NULL), m_textureWallpaper(NULL),
m_shaderWallpaper(NULL) m_shaderWallpaper(NULL),
b_saveSnapshots(false)
{ {
++viewCount; ++viewCount;
setSnapshotFormat("JPEG");
setSnapshotFileName(m_name);
setSnapshotQuality(95);
m_currentCamera = m_schnapps->addCamera(); m_currentCamera = m_schnapps->addCamera();
m_currentCamera->linkView(this); m_currentCamera->linkView(this);
...@@ -80,7 +85,7 @@ View::View(const QString& name, SCHNApps* s, QGLFormat& format) : ...@@ -80,7 +85,7 @@ View::View(const QString& name, SCHNApps* s, QGLFormat& format) :
m_dialogCameras->check(m_currentCamera->getName(),Qt::Checked); m_dialogCameras->check(m_currentCamera->getName(),Qt::Checked);
} }
View::View(const QString& name, SCHNApps* s, QGLFormat& format, const QGLWidget* shareWidget) : View::View(const QString& name, SCHNApps* s, QGLFormat& format, const QGLWidget* shareWidget) :
QGLViewer(format, NULL, shareWidget), QGLViewer(format, NULL, shareWidget),
b_updatingUI(false), b_updatingUI(false),
m_name(name), m_name(name),
...@@ -104,6 +109,10 @@ View::View(const QString& name, SCHNApps* s, QGLFormat& format, const QGLWidget ...@@ -104,6 +109,10 @@ View::View(const QString& name, SCHNApps* s, QGLFormat& format, const QGLWidget
{ {
++viewCount; ++viewCount;
setSnapshotFormat("JPEG");
setSnapshotFileName(m_name);
setSnapshotQuality(95);
m_currentCamera = m_schnapps->addCamera(); m_currentCamera = m_schnapps->addCamera();
m_currentCamera->linkView(this); m_currentCamera->linkView(this);
...@@ -545,9 +554,20 @@ void View::drawFrame() ...@@ -545,9 +554,20 @@ void View::drawFrame()
void View::keyPressEvent(QKeyEvent* event) void View::keyPressEvent(QKeyEvent* event)
{ {
foreach(PluginInteraction* plugin, l_plugins) if (event->key() == Qt::Key_S)
plugin->keyPress(this, event); {
QGLViewer::keyPressEvent(event); 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) 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