Skip to content
Permalink
Browse files

Make using specific date/time an option, use current date/time otherwise

  • Loading branch information
manisandro committed Jun 2, 2016
1 parent 6293315 commit 30813f91709a99361db03d79443ea5105d93c820
Showing with 33 additions and 7 deletions.
  1. +15 −1 src/plugins/globe/qgsglobeplugindialog.cpp
  2. +18 −6 src/plugins/globe/qgsglobeplugindialog.ui
@@ -90,6 +90,7 @@ QgsGlobePluginDialog::QgsGlobePluginDialog( QWidget* parent, Qt::WFlags fl )
#endif

connect( checkBoxSkyAutoAmbient, SIGNAL( toggled( bool ) ), horizontalSliderMinAmbient, SLOT( setEnabled( bool ) ) );
connect( checkBoxDateTime, SIGNAL( toggled( bool ) ), dateTimeEditSky, SLOT( setEnabled( bool ) ) );
connect( buttonBox->button( QDialogButtonBox::Apply ), SIGNAL( clicked( bool ) ), this, SLOT( apply() ) );

restoreSavedSettings();
@@ -121,6 +122,9 @@ void QgsGlobePluginDialog::restoreSavedSettings()
groupBoxAntiAliasing->setChecked( settings.value( "/Plugin-Globe/anti-aliasing", false ).toBool() );
lineEditAASamples->setText( settings.value( "/Plugin-Globe/anti-aliasing-level", "" ).toString() );

horizontalSliderMinAmbient->setEnabled( checkBoxSkyAutoAmbient->isChecked() );
dateTimeEditSky->setEnabled( checkBoxDateTime->isChecked() );

// Advanced
sliderScrollSensitivity->setValue( settings.value( "/Plugin-Globe/scrollSensitivity", 20 ).toInt() );
checkBoxInvertScroll->setChecked( settings.value( "/Plugin-Globe/invertScrollWheel", 0 ).toInt() );
@@ -224,6 +228,7 @@ void QgsGlobePluginDialog::readProjectSettings()

// Map settings
groupBoxSky->setChecked( QgsProject::instance()->readBoolEntry( "Globe-Plugin", "/skyEnabled", true ) );
checkBoxDateTime->setChecked( QgsProject::instance()->readBoolEntry( "Globe-Plugin", "/overrideDateTime", false ) );
dateTimeEditSky->setDateTime( QDateTime::fromString( QgsProject::instance()->readEntry( "Globe-Plugin", "/skyDateTime", QDateTime::currentDateTime().toString() ) ) );
checkBoxSkyAutoAmbient->setChecked( QgsProject::instance()->readBoolEntry( "Globe-Plugin", "/skyAutoAmbient", true ) );
horizontalSliderMinAmbient->setValue( QgsProject::instance()->readDoubleEntry( "Globe-Plugin", "/skyMinAmbient", 30. ) );
@@ -257,6 +262,7 @@ void QgsGlobePluginDialog::writeProjectSettings()

// Map settings
QgsProject::instance()->writeEntry( "Globe-Plugin", "/skyEnabled/", groupBoxSky->isChecked() );
QgsProject::instance()->writeEntry( "Globe-Plugin", "/overrideDateTime/", checkBoxDateTime->isChecked() );
QgsProject::instance()->writeEntry( "Globe-Plugin", "/skyDateTime/", dateTimeEditSky->dateTime().toString() );
QgsProject::instance()->writeEntry( "Globe-Plugin", "/skyAutoAmbient/", checkBoxSkyAutoAmbient->isChecked() );
QgsProject::instance()->writeEntry( "Globe-Plugin", "/skyMinAmbient/", horizontalSliderMinAmbient->value() );
@@ -460,7 +466,15 @@ bool QgsGlobePluginDialog::getSkyEnabled() const

QDateTime QgsGlobePluginDialog::getSkyDateTime() const
{
return QDateTime::fromString( QgsProject::instance()->readEntry( "Globe-Plugin", "/skyDateTime", QDateTime::currentDateTime().toString() ) );
bool overrideDateTime = QgsProject::instance()->readBoolEntry( "Globe-Plugin", "/overrideDateTime", false );
if ( overrideDateTime )
{
return QDateTime::fromString( QgsProject::instance()->readEntry( "Globe-Plugin", "/skyDateTime", QDateTime::currentDateTime().toString() ) );
}
else
{
return QDateTime::currentDateTime();
}
}

bool QgsGlobePluginDialog::getSkyAutoAmbience() const
@@ -59,15 +59,27 @@
<bool>true</bool>
</property>
<layout class="QFormLayout" name="formLayout_3">
<item row="0" column="0">
<widget class="QLabel" name="labelDateTime">
<item row="1" column="0">
<widget class="QCheckBox" name="checkBoxDateTime">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Date / Time (UTC):</string>
<string>Override Date / Time (UTC):</string>
</property>
</widget>
</item>
<item row="0" column="1">
<item row="1" column="1">
<widget class="QDateTimeEdit" name="dateTimeEditSky">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="displayFormat">
<string>dd.MM.yyyy HH:mm</string>
</property>
@@ -76,14 +88,14 @@
</property>
</widget>
</item>
<item row="2" column="0">
<item row="3" column="0">
<widget class="QCheckBox" name="checkBoxSkyAutoAmbient">
<property name="text">
<string>Ambient lighting</string>
</property>
</widget>
</item>
<item row="2" column="1">
<item row="3" column="1">
<widget class="QSlider" name="horizontalSliderMinAmbient">
<property name="enabled">
<bool>false</bool>

0 comments on commit 30813f9

Please sign in to comment.
You can’t perform that action at this time.