Commit 31aed5c4 authored by Marlin Frickenschmidt's avatar Marlin Frickenschmidt
Browse files

Extended the snapshot dialog to allow setting the level of multisampling

Fixed small bug in menu bar (orthogonal/perspective projection option)
Renaming to diversify between examiner and viewer snapshot functions; this is also reflected in the menu

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@9963 383ad7c9-94d9-4d36-a494-682f7c89f535
parent c02efc38
...@@ -336,10 +336,17 @@ void CoreWidget::updatePopupMenuCoordsysNode(QMenu* _menu , const int /*_part*/ ...@@ -336,10 +336,17 @@ void CoreWidget::updatePopupMenuCoordsysNode(QMenu* _menu , const int /*_part*/
//==================================================================================================== //====================================================================================================
QAction* snapshot = _menu->addAction(tr("Snapshot")); QAction* snapshot_examiner = _menu->addAction(tr("Examiner Snapshot"));
snapshot->setToolTip(tr("Make a snapshot")); snapshot_examiner->setToolTip(tr("Take a snapshot of the current examiner"));
snapshot->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"snapshot.png") ); snapshot_examiner->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"snapshot.png") );
connect(snapshot, SIGNAL(triggered()), this, SLOT( slotSnapshot() ) ); connect(snapshot_examiner, SIGNAL(triggered()), this, SLOT( slotExaminerSnapshot() ) );
//====================================================================================================
QAction* snapshot_viewer = _menu->addAction(tr("Viewer Snapshot"));
snapshot_viewer->setToolTip(tr("Take a snapshot of the whole viewer"));
snapshot_viewer->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"snapshot.png") );
connect(snapshot_viewer, SIGNAL(triggered()), this, SLOT( viewerSnapshotDialog() ) );
} }
......
...@@ -693,7 +693,7 @@ public: ...@@ -693,7 +693,7 @@ public:
void slotUpdateViewerDrawMenu(); void slotUpdateViewerDrawMenu();
/// Create a snapshot of the last active examiner /// Create a snapshot of the last active examiner
void slotSnapshot(); void slotExaminerSnapshot();
/// Show / hide wheels /// Show / hide wheels
void slotSwitchWheels(bool _state); void slotSwitchWheels(bool _state);
......
...@@ -249,6 +249,15 @@ void CoreWidget::setupMenuBar() ...@@ -249,6 +249,15 @@ void CoreWidget::setupMenuBar()
connect( orthogonalProjectionAction_,SIGNAL( triggered() ), this, SLOT( slotGlobalOrthographicProjection() ) ); connect( orthogonalProjectionAction_,SIGNAL( triggered() ), this, SLOT( slotGlobalOrthographicProjection() ) );
renderingOptionsMenu->addAction( orthogonalProjectionAction_); renderingOptionsMenu->addAction( orthogonalProjectionAction_);
perspectiveProjectionAction_ = new QAction( tr("Switch Viewers to Perspective Projection"), viewMenu_ );;
perspectiveProjectionAction_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"perspective.png") );
perspectiveProjectionAction_->setCheckable( false );
perspectiveProjectionAction_->setStatusTip( tr("Switch to perspective projection mode."));
perspectiveProjectionAction_->setWhatsThis( tr("Switch projection mode<br><br>"
"Switch to <b>perspective</b> projection mode."));
connect( perspectiveProjectionAction_,SIGNAL( triggered() ), this, SLOT( slotGlobalPerspectiveProjection() ) );
renderingOptionsMenu->addAction( perspectiveProjectionAction_);
// ===================== // =====================
globalAnimationAction_ = renderingOptionsMenu->addAction(tr("Animation")); globalAnimationAction_ = renderingOptionsMenu->addAction(tr("Animation"));
...@@ -347,15 +356,6 @@ void CoreWidget::setupMenuBar() ...@@ -347,15 +356,6 @@ void CoreWidget::setupMenuBar()
connect( appSnapShotAction,SIGNAL( triggered() ), this, SLOT( applicationSnapshotDialog() ) ); connect( appSnapShotAction,SIGNAL( triggered() ), this, SLOT( applicationSnapshotDialog() ) );
viewMenu_->addAction( appSnapShotAction); viewMenu_->addAction( appSnapShotAction);
perspectiveProjectionAction_ = new QAction( tr("Switch Viewers to Perspective Projection"), viewMenu_ );;
perspectiveProjectionAction_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"perspective.png") );
perspectiveProjectionAction_->setCheckable( false );
perspectiveProjectionAction_->setStatusTip( tr("Switch to perspective projection mode."));
perspectiveProjectionAction_->setWhatsThis( tr("Switch projection mode<br><br>"
"Switch to <b>perspective</b> projection mode."));
connect( perspectiveProjectionAction_,SIGNAL( triggered() ), this, SLOT( slotGlobalPerspectiveProjection() ) );
viewMenu_->addAction( perspectiveProjectionAction_);
viewMenu_->addSeparator(); viewMenu_->addSeparator();
QAction* wheelSwitchAction = new QAction( tr("Show / hide wheels"), viewMenu_ ); QAction* wheelSwitchAction = new QAction( tr("Show / hide wheels"), viewMenu_ );
...@@ -606,13 +606,13 @@ void CoreWidget::slotViewMenuAboutToShow() { ...@@ -606,13 +606,13 @@ void CoreWidget::slotViewMenuAboutToShow() {
else else
orthogonalCount++; orthogonalCount++;
} }
if ( perspectiveCount == 4 ) if ( perspectiveCount == PluginFunctions::viewers() )
perspectiveProjectionAction_->setVisible(false); perspectiveProjectionAction_->setVisible(false);
else else
perspectiveProjectionAction_->setVisible(true); perspectiveProjectionAction_->setVisible(true);
if ( orthogonalCount == 4 ) if ( orthogonalCount == PluginFunctions::viewers() )
orthogonalProjectionAction_->setVisible(false); orthogonalProjectionAction_->setVisible(false);
else else
orthogonalProjectionAction_->setVisible(true); orthogonalProjectionAction_->setVisible(true);
......
...@@ -233,7 +233,7 @@ void CoreWidget::slotLocalChangeMipmapping(bool _mipmapping) { ...@@ -233,7 +233,7 @@ void CoreWidget::slotLocalChangeMipmapping(bool _mipmapping) {
} }
/// Take a snapshot of the current Viewer /// Take a snapshot of the current Viewer
void CoreWidget::slotSnapshot() { void CoreWidget::slotExaminerSnapshot() {
QFileInfo fi(PluginFunctions::viewerProperties().snapshotName()); QFileInfo fi(PluginFunctions::viewerProperties().snapshotName());
int counter = PluginFunctions::viewerProperties().snapshotCounter(); int counter = PluginFunctions::viewerProperties().snapshotCounter();
...@@ -419,7 +419,8 @@ void CoreWidget::viewerSnapshotDialog() { ...@@ -419,7 +419,8 @@ void CoreWidget::viewerSnapshotDialog() {
examiner_widgets_[PluginFunctions::activeExaminer()]->snapshot(finalImage, examiner_widgets_[PluginFunctions::activeExaminer()]->snapshot(finalImage,
dialog.snapWidth->value(), dialog.snapHeight->value(), dialog.snapWidth->value(), dialog.snapHeight->value(),
dialog.transparent->isChecked(), dialog.hideCoordsys->isChecked()); dialog.transparent->isChecked(), dialog.hideCoordsys->isChecked(),
dialog.multisampling->isChecked() ? dialog.num_samples->value() : 1);
finalImage.save(newName); finalImage.save(newName);
......
/*===========================================================================*\ /*===========================================================================*\
* * * *
* OpenFlipper * * OpenFlipper *
* Copyright (C) 2001-2010 by Computer Graphics Group, RWTH Aachen * * Copyright (C) 2001-2010 by Computer Graphics Group, RWTH Aachen *
...@@ -2032,7 +2032,7 @@ void glViewer::slotPropertiesUpdated() { ...@@ -2032,7 +2032,7 @@ void glViewer::slotPropertiesUpdated() {
updateGL(); updateGL();
} }
void glViewer::snapshot(QImage& _image, int _width, int _height, bool _alpha, bool _hideCoordsys) { void glViewer::snapshot(QImage& _image, int _width, int _height, bool _alpha, bool _hideCoordsys, int samples) {
int w = 0, h = 0, bak_w = 0, bak_h = 0, left = 0, bottom = 0; int w = 0, h = 0, bak_w = 0, bak_h = 0, left = 0, bottom = 0;
...@@ -2067,7 +2067,7 @@ void glViewer::snapshot(QImage& _image, int _width, int _height, bool _alpha, bo ...@@ -2067,7 +2067,7 @@ void glViewer::snapshot(QImage& _image, int _width, int _height, bool _alpha, bo
format.setAttachment(QGLFramebufferObject::CombinedDepthStencil); format.setAttachment(QGLFramebufferObject::CombinedDepthStencil);
// 16 samples per pixel as we want a nice snapshot. If this is not supported // 16 samples per pixel as we want a nice snapshot. If this is not supported
// it will fall back to the maximal supported number of samples // it will fall back to the maximal supported number of samples
format.setSamples(16); format.setSamples(samples);
QGLFramebufferObject fb( w, h, format); QGLFramebufferObject fb( w, h, format);
if ( fb.isValid() ){ if ( fb.isValid() ){
......
...@@ -768,7 +768,7 @@ private: ...@@ -768,7 +768,7 @@ private:
virtual void snapshot(int _width = 0, int _height = 0, bool _alpha = false); virtual void snapshot(int _width = 0, int _height = 0, bool _alpha = false);
/// Take a snapshot and store it in the given image /// Take a snapshot and store it in the given image
virtual void snapshot(QImage& _image, int _width = 0, int _height = 0, bool _alpha = false, bool _hideCoordsys = false); virtual void snapshot(QImage& _image, int _width = 0, int _height = 0, bool _alpha = false, bool _hideCoordsys = false, int samples = 1);
/** @} */ /** @} */
......
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>272</width> <width>353</width>
<height>308</height> <height>348</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<item> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="text"> <property name="text">
<string>Output filename:</string> <string>Save to: </string>
</property> </property>
</widget> </widget>
</item> </item>
...@@ -47,102 +47,172 @@ ...@@ -47,102 +47,172 @@
<property name="title"> <property name="title">
<string> Resolution </string> <string> Resolution </string>
</property> </property>
<layout class="QFormLayout" name="formLayout"> <layout class="QVBoxLayout" name="verticalLayout_5">
<property name="fieldGrowthPolicy"> <item>
<enum>QFormLayout::ExpandingFieldsGrow</enum> <layout class="QGridLayout" name="gridLayout_3">
</property> <item row="2" column="1">
<item row="2" column="0"> <widget class="QSpinBox" name="snapWidth">
<widget class="QLabel" name="label_3"> <property name="sizePolicy">
<property name="text"> <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<string>Width:</string> <horstretch>0</horstretch>
</property> <verstretch>0</verstretch>
</widget> </sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>8192</number>
</property>
<property name="value">
<number>800</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Height:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Width:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="snapHeight">
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>8192</number>
</property>
<property name="value">
<number>600</number>
</property>
</widget>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="resButton">
<property name="text">
<string>Change Resolution</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QCheckBox" name="keepAspect">
<property name="text">
<string>Keep aspect ratio</string>
</property>
</widget>
</item>
</layout>
</item> </item>
<item row="2" column="1"> </layout>
<widget class="QSpinBox" name="snapWidth"> </widget>
<property name="sizePolicy"> </item>
<sizepolicy hsizetype="Minimum" vsizetype="Fixed"> <item>
<horstretch>0</horstretch> <widget class="QGroupBox" name="groupBox">
<verstretch>0</verstretch> <property name="title">
</sizepolicy> <string>Rendering options</string>
</property> </property>
<property name="minimumSize"> <layout class="QVBoxLayout" name="verticalLayout_6">
<size> <item>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>8192</number>
</property>
<property name="value">
<number>800</number>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Height:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QSpinBox" name="snapHeight">
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>8192</number>
</property>
<property name="value">
<number>600</number>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QPushButton" name="resButton">
<property name="text">
<string>Change Resolution</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QCheckBox" name="keepAspect">
<property name="text">
<string>Keep aspect</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QCheckBox" name="transparent"> <widget class="QCheckBox" name="transparent">
<property name="text"> <property name="text">
<string>Transparent background</string> <string>Transparent background</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="1"> <item>
<widget class="QCheckBox" name="hideCoordsys"> <widget class="QCheckBox" name="hideCoordsys">
<property name="text"> <property name="text">
<string>Hide coordinate system</string> <string>Hide coordinate system</string>
</property> </property>
</widget> </widget>
</item> </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QCheckBox" name="multisampling">
<property name="text">
<string>Multisampling:</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="num_samples">
<property name="minimum">
<number>2</number>
</property>
<property name="maximum">
<number>16</number>
</property>
<property name="value">
<number>16</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>samples</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
...@@ -171,7 +241,7 @@ ...@@ -171,7 +241,7 @@
<item> <item>
<widget class="QPushButton" name="okButton"> <widget class="QPushButton" name="okButton">
<property name="text"> <property name="text">
<string>Ok</string> <string>OK</string>
</property> </property>
</widget> </widget>
</item> </item>
......
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