Skip to content

Commit 30813f9

Browse files
committedJun 2, 2016
Make using specific date/time an option, use current date/time otherwise
1 parent 6293315 commit 30813f9

File tree

2 files changed

+33
-7
lines changed

2 files changed

+33
-7
lines changed
 

‎src/plugins/globe/qgsglobeplugindialog.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ QgsGlobePluginDialog::QgsGlobePluginDialog( QWidget* parent, Qt::WFlags fl )
9090
#endif
9191

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

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

125+
horizontalSliderMinAmbient->setEnabled( checkBoxSkyAutoAmbient->isChecked() );
126+
dateTimeEditSky->setEnabled( checkBoxDateTime->isChecked() );
127+
124128
// Advanced
125129
sliderScrollSensitivity->setValue( settings.value( "/Plugin-Globe/scrollSensitivity", 20 ).toInt() );
126130
checkBoxInvertScroll->setChecked( settings.value( "/Plugin-Globe/invertScrollWheel", 0 ).toInt() );
@@ -224,6 +228,7 @@ void QgsGlobePluginDialog::readProjectSettings()
224228

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

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

461467
QDateTime QgsGlobePluginDialog::getSkyDateTime() const
462468
{
463-
return QDateTime::fromString( QgsProject::instance()->readEntry( "Globe-Plugin", "/skyDateTime", QDateTime::currentDateTime().toString() ) );
469+
bool overrideDateTime = QgsProject::instance()->readBoolEntry( "Globe-Plugin", "/overrideDateTime", false );
470+
if ( overrideDateTime )
471+
{
472+
return QDateTime::fromString( QgsProject::instance()->readEntry( "Globe-Plugin", "/skyDateTime", QDateTime::currentDateTime().toString() ) );
473+
}
474+
else
475+
{
476+
return QDateTime::currentDateTime();
477+
}
464478
}
465479

466480
bool QgsGlobePluginDialog::getSkyAutoAmbience() const

‎src/plugins/globe/qgsglobeplugindialog.ui

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,27 @@
5959
<bool>true</bool>
6060
</property>
6161
<layout class="QFormLayout" name="formLayout_3">
62-
<item row="0" column="0">
63-
<widget class="QLabel" name="labelDateTime">
62+
<item row="1" column="0">
63+
<widget class="QCheckBox" name="checkBoxDateTime">
64+
<property name="sizePolicy">
65+
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
66+
<horstretch>0</horstretch>
67+
<verstretch>0</verstretch>
68+
</sizepolicy>
69+
</property>
6470
<property name="text">
65-
<string>Date / Time (UTC):</string>
71+
<string>Override Date / Time (UTC):</string>
6672
</property>
6773
</widget>
6874
</item>
69-
<item row="0" column="1">
75+
<item row="1" column="1">
7076
<widget class="QDateTimeEdit" name="dateTimeEditSky">
77+
<property name="sizePolicy">
78+
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
79+
<horstretch>0</horstretch>
80+
<verstretch>0</verstretch>
81+
</sizepolicy>
82+
</property>
7183
<property name="displayFormat">
7284
<string>dd.MM.yyyy HH:mm</string>
7385
</property>
@@ -76,14 +88,14 @@
7688
</property>
7789
</widget>
7890
</item>
79-
<item row="2" column="0">
91+
<item row="3" column="0">
8092
<widget class="QCheckBox" name="checkBoxSkyAutoAmbient">
8193
<property name="text">
8294
<string>Ambient lighting</string>
8395
</property>
8496
</widget>
8597
</item>
86-
<item row="2" column="1">
98+
<item row="3" column="1">
8799
<widget class="QSlider" name="horizontalSliderMinAmbient">
88100
<property name="enabled">
89101
<bool>false</bool>

0 commit comments

Comments
 (0)
Please sign in to comment.