Commit e05a3f7b authored by Marlin Frickenschmidt's avatar Marlin Frickenschmidt
Browse files

Fixed minor bugs in snapshot dialog and added better display for light sources (on or off).

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@10255 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 6134ecd6
......@@ -60,8 +60,9 @@
//-----------------------------------------------------------------------------
void Core::startVideoCapture(QString _baseName, int _fps, bool _captureViewers) {
connect( &videoTimer_ , SIGNAL(timeout()), this, SLOT( viewUpdated() ) ,Qt::DirectConnection );
// set track auf true;
connect( &videoTimer_ , SIGNAL(timeout()), this, SLOT( viewUpdated() ) ,Qt::DirectConnection );
// set track to true;
videoTimer_.setSingleShot(false);
// 25 fps
......@@ -85,7 +86,7 @@ void Core::startVideoCapture(QString _baseName, int _fps, bool _captureViewers)
void Core::captureVideo() {
int elapsed = lastVideoTime_.elapsed();
if ( elapsed < 40 ) {
if ( elapsed < videoTimer_.interval() ) {
// std::cerr << "Too early to capture" << std::endl;
return;
}
......
......@@ -64,6 +64,7 @@ SnapshotDialog::SnapshotDialog(QString _suggest, bool _captureViewers, int _w, i
resButton->setDisabled(captureViewers_);
keepAspect->setDisabled(!captureViewers_);
transparent->setDisabled(!captureViewers_);
hideCoordsys->setDisabled(!captureViewers_);
multisampling->setDisabled(!captureViewers_);
num_samples->setDisabled(!captureViewers_);
......@@ -75,6 +76,8 @@ SnapshotDialog::SnapshotDialog(QString _suggest, bool _captureViewers, int _w, i
connect(snapWidth, SIGNAL(valueChanged(int)), this, SLOT(snapWidthChanged(int)) );
connect(snapHeight, SIGNAL(valueChanged(int)), this, SLOT(snapHeightChanged(int)) );
connect(keepAspect, SIGNAL(stateChanged(int)), this, SLOT(keepAspectChanged()) );
connect(multisampling, SIGNAL(stateChanged(int)), this, SLOT(multisampleChanged()) );
connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()) );
connect(findButton, SIGNAL(clicked()), this, SLOT(findFile()) );
......@@ -126,6 +129,18 @@ void SnapshotDialog::snapHeightChanged(int _h) {
}
}
void SnapshotDialog::keepAspectChanged() {
if(keepAspect->isChecked()) {
blockSpinBox_ = true;
snapHeight->setValue((int)((double)snapWidth->value() / aspect_));
blockSpinBox_ = false;
}
}
void SnapshotDialog::multisampleChanged() {
num_samples->setDisabled (!multisampling->isChecked());
}
void SnapshotDialog::slotChangeResolution()
{
if ( !captureViewers_ )
......
......@@ -63,6 +63,8 @@ class SnapshotDialog : public QDialog, public Ui::SnapshotDialog
void snapWidthChanged(int _w);
void snapHeightChanged(int _h);
void keepAspectChanged();
void multisampleChanged();
void saveStates();
void loadStates();
......
......@@ -129,6 +129,17 @@
</item>
<item row="3" column="2">
<widget class="QPushButton" name="resButton">
<property name="toolTip">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Changes the resolution of the application window and thus of the snapshot taken. It will be reset to its original value when this dialog is closed.&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;This will not work when the application is maximized or fullscreen.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Only available when taking application snapshots.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Change Resolution</string>
</property>
......@@ -170,6 +181,10 @@
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QCheckBox" name="multisampling">
<property name="toolTip">
<string>Activating this option will render the image with the given number of samples.
Deactivating this option will use only one sample.</string>
</property>
<property name="text">
<string>Multisampling:</string>
</property>
......@@ -180,6 +195,10 @@
</item>
<item>
<widget class="QSpinBox" name="num_samples">
<property name="toolTip">
<string>Number of samples for multisampling.
Allowed values: any number between 2 and 16.</string>
</property>
<property name="minimum">
<number>2</number>
</property>
......
......@@ -308,9 +308,22 @@ void DataControlPlugin::slotCustomContextMenuRequested ( const QPoint & _pos ) {
icon.addFile(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"datacontrol-delete-item.png");
action->setIcon(icon);
menu.addSeparator();
action = menu.addAction(tr("Switch On/Off"),this,SLOT ( slotSwitchLight() ));
icon = typeIcon(DATA_LIGHT);
LightObject* light = 0;
if ( item->id() != -1 && PluginFunctions::getObject( item->id(), light ) ) {
if (light != 0 && !light->lightSource()->enabled()) {
action = menu.addAction(tr("Switch On"),this,SLOT ( slotSwitchLight() ));
icon = typeIcon(DATA_LIGHT);
}
}
if (light == 0 || light->lightSource()->enabled())
{
action = menu.addAction(tr("Switch Off"),this,SLOT ( slotSwitchLight() ));
icon = QIcon (OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"LightOff.png");
}
action->setIcon(icon);
action = menu.addAction(tr("Edit Light"),this,SLOT ( slotEditLight() ));
icon = typeIcon(DATA_LIGHT);
action->setIcon(icon);
......@@ -574,7 +587,7 @@ void DataControlPlugin::slotSwitchLight() {
//******************************************************************************
/**
* \brief Switch light source on or off
* \brief Edit the light source's parameters
*/
void DataControlPlugin::slotEditLight() {
......
......@@ -50,6 +50,9 @@
#include <OpenFlipper/common/Types.hh>
#include <OpenFlipper/BasePlugin/PluginFunctions.hh>
#include <OpenFlipper/common/GlobalOptions.hh>
#include <ObjectTypes/Light/LightWidget.hh>
//******************************************************************************
......@@ -126,7 +129,16 @@ QVariant TreeModel::data(const QModelIndex &index, int role) const
// If we are setting the name, also add the icon
if ( role == Qt::DecorationRole ) {
return QVariant( typeIcon(item->dataType()) );
if (item->dataType() == DATA_LIGHT)
{
LightObject* light = 0;
if (item->id() != -1 && PluginFunctions::getObject( item->id(), light ) ) {
if (light != 0 && !light->lightSource()->enabled())
return QVariant (QIcon (OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"LightOff.png"));
}
}
return QVariant( typeIcon(item->dataType()) );
}
if (role != Qt::DisplayRole && role != Qt::EditRole )
......
Supports Markdown
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