Merge lp:~daggerstab/stellarium/time-zone-plugin into lp:stellarium

Proposed by Bogdan Marinov
Status: Merged
Merged at revision: 4784
Proposed branch: lp:~daggerstab/stellarium/time-zone-plugin
Merge into: lp:stellarium
Diff against target: 2202 lines (+2107/-0)
14 files modified
CMakeLists.txt (+1/-0)
plugins/CMakeLists.txt (+3/-0)
plugins/TimeZoneConfiguration/CMakeLists.txt (+19/-0)
plugins/TimeZoneConfiguration/src/CMakeLists.txt (+72/-0)
plugins/TimeZoneConfiguration/src/TimeZoneConfiguration.cpp (+128/-0)
plugins/TimeZoneConfiguration/src/TimeZoneConfiguration.hpp (+81/-0)
plugins/TimeZoneConfiguration/src/gui/DefineTimeZoneWindow.cpp (+304/-0)
plugins/TimeZoneConfiguration/src/gui/DefineTimeZoneWindow.hpp (+62/-0)
plugins/TimeZoneConfiguration/src/gui/TimeZoneConfigurationWindow.cpp (+231/-0)
plugins/TimeZoneConfiguration/src/gui/TimeZoneConfigurationWindow.hpp (+67/-0)
plugins/TimeZoneConfiguration/src/gui/defineTimeZone.ui (+627/-0)
plugins/TimeZoneConfiguration/src/gui/timeZoneConfigurationWindow.ui (+503/-0)
src/CMakeLists.txt (+5/-0)
src/StelMainGraphicsView.cpp (+4/-0)
To merge this branch: bzr merge lp:~daggerstab/stellarium/time-zone-plugin
Reviewer Review Type Date Requested Status
Fabien Chéreau Approve
Review via email: mp+40543@code.launchpad.net

This proposal supersedes a proposal from 2010-11-08.

Description of the change

Time Zone plug-in:
- allows setting the time zone, providing a GUI for the TZ setting in the configuration file (which in turn uses the format of the POSIX TZ environmental variable);
- allows changing the format used to display the time and the date in the bottom bar (during runtime).

I am not sure how grammatically correct is some of the text in the GUI, so it would be nice if a native speaker proofreads it. :)

To post a comment you must log in.
Revision history for this message
treaves (treaves) wrote : Posted in a previous version of this proposal

What functionality does this provide that isn't there simply by changing locations?

Revision history for this message
Bogdan Marinov (daggerstab) wrote : Posted in a previous version of this proposal

To quote from the text in the main window of the plug-in:

"By default, the time displayed in Stellarium is interpreted as the local time in the system's time zone, not in the displayed location's time zone. This behavior can be changed by changing Stellarium's global time zone settings."

See also bug #510480:
https://bugs.launchpad.net/stellarium/+bug/510480

Stellarium's handling of time and time zones is one of the things that often leaves users confused, though the concept is not hard once you get it.

Revision history for this message
treaves (treaves) wrote : Posted in a previous version of this proposal

Please forgive me if I'm asking the obvious (I'm at work, and looking at code is more difficult than e-mail), but, given the defect you mentioned, wouldn't a better solution be to have Stellarium use the TZ from the location?

It really makes no sense to be able to set a timezone of EST for India, for example, just as it makes no sense to set India as the location, and have Stellarium use EST if that is what the OS is set to.

It strikes me as something that needs to be changed in the core app, not with a plugin.

Revision history for this message
Bogdan Marinov (daggerstab) wrote : Posted in a previous version of this proposal

Who says that the plug-in will be forever? It's just a GUI for an existing "feature" - the time zone setting in the configuration file. It's a stopgap measure.

Revision history for this message
Fabien Chéreau (xalioth) wrote : Posted in a previous version of this proposal

Hi Bogdan,
just tried the plugin and it seems to works fine, at least on linux. Well done!
On the GUI, do you really need to display the current time zone setting on the top? I think the config file string is quite cryptic, so the radio button brings the same information in a more user friendly way. Also it looks like it can be edited but can't (the feature is already at the bottom). So I would just suppress it.
Otherwise I like it :)
Fabien

review: Approve
Revision history for this message
Bogdan Marinov (daggerstab) wrote : Posted in a previous version of this proposal

> On the GUI, do you really need to display the current time zone setting on the
> top? I think the config file string is quite cryptic, so the radio button
> brings the same information in a more user friendly way. Also it looks like it
> can be edited but can't (the feature is already at the bottom). So I would
> just suppress it.

I don't remember what exactly I had in mind when I added that field. Perhaps I've been subconsciously influenced by the Comets and Asteroids plug-in - it has a similar read-only QLineEdit.

Anyway, I've removed the box and I'll commit the changes now.

Revision history for this message
Matthew Gates (matthew-porpoisehead) wrote : Posted in a previous version of this proposal

I am wondering how it is your plug-in doesn't suffer from the same
focus problem as the Satellites plugin... Curious!

On 10 November 2010 15:41, Bogdan Marinov <email address hidden> wrote:
>> On the GUI, do you really need to display the current time zone setting on the
>> top? I think the config file string is quite cryptic, so the radio button
>> brings the same information in a more user friendly way. Also it looks like it
>> can be edited but can't (the feature is already at the bottom). So I would
>> just suppress it.
>
> I don't remember what exactly I had in mind when I added that field. Perhaps I've been subconsciously influenced by the Comets and Asteroids plug-in - it has a similar read-only QLineEdit.
>
> Anyway, I've removed the box and I'll commit the changes now.
> --
> https://code.launchpad.net/~daggerstab/stellarium/time-zone-plugin/+merge/40338
> You are subscribed to branch lp:stellarium.
>

Revision history for this message
Fabien Chéreau (xalioth) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2010-10-29 14:54:12 +0000
3+++ CMakeLists.txt 2010-11-10 15:42:47 +0000
4@@ -134,6 +134,7 @@
5 SET(USE_PLUGIN_OCULARS 1 CACHE BOOL "Define whether the Oculars plugin should be created.")
6 SET(USE_PLUGIN_SVMT 0 CACHE BOOL "Define whether the SVMT plugin should be created.")
7 SET(USE_PLUGIN_TEXTUSERINTERFACE 1 CACHE BOOL "Define whether the TextUserInterface plugin should be created.")
8+SET(USE_PLUGIN_TIMEZONECONFIGURATION 1 CACHE BOOL "Define whether the TimeZoneConfiguration plugin should be created.")
9 SET(USE_PLUGIN_VIRGO 0 CACHE BOOL "Define whether the VirGO plugin should be created.")
10
11 ########## Static plugins need to define includes and libraries
12
13=== modified file 'plugins/CMakeLists.txt'
14--- plugins/CMakeLists.txt 2010-01-22 18:41:50 +0000
15+++ plugins/CMakeLists.txt 2010-11-10 15:42:47 +0000
16@@ -30,6 +30,9 @@
17 IF (USE_PLUGIN_TEXTUSERINTERFACE)
18 ADD_SUBDIRECTORY( TextUserInterface )
19 ENDIF()
20+IF (USE_PLUGIN_TIMEZONECONFIGURATION)
21+ ADD_SUBDIRECTORY( TimeZoneConfiguration )
22+ENDIF()
23 IF (USE_PLUGIN_SVMT)
24 SET(SOURCE_SVMT_PATH "../../svmt/" CACHE PATH "The location of the SVMT plugin main directory i.e. the one containing the top level CMakeLists.txt")
25 ADD_SUBDIRECTORY( ${SOURCE_SVMT_PATH} svmt )
26
27=== added directory 'plugins/TimeZoneConfiguration'
28=== added file 'plugins/TimeZoneConfiguration/CMakeLists.txt'
29--- plugins/TimeZoneConfiguration/CMakeLists.txt 1970-01-01 00:00:00 +0000
30+++ plugins/TimeZoneConfiguration/CMakeLists.txt 2010-11-10 15:42:47 +0000
31@@ -0,0 +1,19 @@
32+
33+SET(TIMEZONECONFIGURATION_MAJOR "0")
34+SET(TIMEZONECONFIGURATION_MINOR "0")
35+SET(TIMEZONECONFIGURATION_PATCH "1")
36+SET(TIMEZONECONFIGURATION_VERSION "${TIMEZONECONFIGURATION_MAJOR}.${TIMEZONECONFIGURATION_MINOR}.${TIMEZONECONFIGURATION_PATCH}")
37+
38+IF(APPLE)
39+ SET(CMAKE_INSTALL_PREFIX $ENV{HOME}/Library/Application\ Support/Stellarium)
40+ElSE(APPLE)
41+ SET(CMAKE_INSTALL_PREFIX $ENV{HOME}/.stellarium)
42+ENDIF(APPLE)
43+
44+ADD_DEFINITIONS(-DPLUGIN_VERSION="${TIMEZONECONFIGURATION_VERSION}")
45+
46+ADD_SUBDIRECTORY( src )
47+
48+INSTALL(FILES DESTINATION "modules/TimeZoneConfiguration")
49+
50+
51
52=== added directory 'plugins/TimeZoneConfiguration/src'
53=== added file 'plugins/TimeZoneConfiguration/src/CMakeLists.txt'
54--- plugins/TimeZoneConfiguration/src/CMakeLists.txt 1970-01-01 00:00:00 +0000
55+++ plugins/TimeZoneConfiguration/src/CMakeLists.txt 2010-11-10 15:42:47 +0000
56@@ -0,0 +1,72 @@
57+
58+INCLUDE_DIRECTORIES(
59+ ${CMAKE_BINARY_DIR}
60+ ${CMAKE_BINARY_DIR}/plugins/TimeZoneConfiguration/src
61+ ${CMAKE_BINARY_DIR}/plugins/TimeZoneConfiguration/src/gui
62+ . gui)
63+
64+LINK_DIRECTORIES(/src)
65+
66+SET(TimeZoneConfiguration_SRCS
67+ TimeZoneConfiguration.hpp
68+ TimeZoneConfiguration.cpp
69+ gui/TimeZoneConfigurationWindow.hpp
70+ gui/TimeZoneConfigurationWindow.cpp
71+ gui/DefineTimeZoneWindow.hpp
72+ gui/DefineTimeZoneWindow.cpp
73+ )
74+
75+SET(TimeZoneConfiguration_UIS
76+ gui/timeZoneConfigurationWindow.ui
77+ gui/defineTimeZone.ui
78+)
79+
80+QT4_WRAP_UI(TimeZoneConfiguration_UIS_H ${TimeZoneConfiguration_UIS})
81+
82+#SET(TimeZoneConfiguration_RES ../resources/resources.qrc)
83+#QT4_ADD_RESOURCES(TimeZoneConfiguration_RES_CXX ${TimeZoneConfiguration_RES})
84+
85+SET(TimeZoneConfiguration_MOC_HDRS
86+ gui/TimeZoneConfigurationWindow.hpp
87+ gui/DefineTimeZoneWindow.hpp
88+ TimeZoneConfiguration.hpp
89+ )
90+
91+QT4_WRAP_CPP(TimeZoneConfiguration_MOC_SRCS ${TimeZoneConfiguration_MOC_HDRS})
92+
93+SET(extLinkerOption ${QT_LIBRARIES} ${OPENGL_LIBRARIES} ${ICONV_LIBRARIES} ${INTL_LIBRARIES})
94+
95+#Dynamic library
96+IF(BUILD_DYNAMIC_PLUGINS)
97+ ADD_LIBRARY(TimeZoneConfiguration MODULE ${TimeZoneConfiguration_SRCS} ${TimeZoneConfiguration_MOC_SRCS} ${TimeZoneConfiguration_RES_CXX} ${TimeZoneConfiguration_UIS_H})
98+
99+ IF(APPLE)
100+ FIND_LIBRARY(OPENGL_LIBRARY OpenGL)
101+ MARK_AS_ADVANCED(OPENGL_LIBRARY)
102+ SET_TARGET_PROPERTIES(TimeZoneConfiguration PROPERTIES LINK_FLAGS "-undefined dynamic_lookup" SUFFIX ".dylib")
103+ ENDIF(APPLE)
104+
105+ IF(WIN32)
106+ SET_TARGET_PROPERTIES(TimeZoneConfiguration PROPERTIES LINK_FLAGS "-enable-runtime-pseudo-reloc -Wl,--allow-multiple-definition" )
107+ SET(StelMain stelMain)
108+ ELSE(WIN32)
109+ SET(StelMain )
110+ ENDIF(WIN32)
111+
112+ TARGET_LINK_LIBRARIES(TimeZoneConfiguration ${StelMain} ${extLinkerOption})
113+
114+ INSTALL(TARGETS TimeZoneConfiguration DESTINATION "modules/TimeZoneConfiguration")
115+ENDIF()
116+
117+#Static library
118+IF(BUILD_STATIC_PLUGINS)
119+ ADD_LIBRARY(TimeZoneConfiguration-static STATIC ${TimeZoneConfiguration_SRCS} ${TimeZoneConfiguration_MOC_SRCS} ${TimeZoneConfiguration_RES_CXX} ${TimeZoneConfiguration_UIS_H})
120+ SET_TARGET_PROPERTIES(TimeZoneConfiguration-static PROPERTIES OUTPUT_NAME "TimeZoneConfiguration")
121+ TARGET_LINK_LIBRARIES(TimeZoneConfiguration-static ${extLinkerOption})
122+ IF(WIN32)
123+ SET_TARGET_PROPERTIES(TimeZoneConfiguration-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")
124+ ELSE()
125+ SET_TARGET_PROPERTIES(TimeZoneConfiguration-static PROPERTIES COMPILE_FLAGS "-fPIC -DQT_STATICPLUGIN")
126+ ENDIF()
127+ ADD_DEPENDENCIES(AllStaticPlugins TimeZoneConfiguration-static)
128+ENDIF()
129
130=== added file 'plugins/TimeZoneConfiguration/src/TimeZoneConfiguration.cpp'
131--- plugins/TimeZoneConfiguration/src/TimeZoneConfiguration.cpp 1970-01-01 00:00:00 +0000
132+++ plugins/TimeZoneConfiguration/src/TimeZoneConfiguration.cpp 2010-11-10 15:42:47 +0000
133@@ -0,0 +1,128 @@
134+/*
135+ * Time zone configuration plug-in for Stellarium
136+ *
137+ * Copyright (C) 2010 Bogdan Marinov
138+ *
139+ * This program is free software; you can redistribute it and/or
140+ * modify it under the terms of the GNU General Public License
141+ * as published by the Free Software Foundation; either version 2
142+ * of the License, or (at your option) any later version.
143+ *
144+ * This program is distributed in the hope that it will be useful,
145+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
146+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
147+ * GNU General Public License for more details.
148+ *
149+ * You should have received a copy of the GNU General Public License
150+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
151+ */
152+
153+#include "TimeZoneConfiguration.hpp"
154+#include "TimeZoneConfigurationWindow.hpp"
155+
156+#include "StelApp.hpp"
157+#include "StelLocaleMgr.hpp"
158+#include "StelModule.hpp"
159+
160+#include <QSettings>
161+
162+StelModule* TimeZoneConfigurationStelPluginInterface::getStelModule() const
163+{
164+ return new TimeZoneConfiguration();
165+}
166+
167+StelPluginInfo TimeZoneConfigurationStelPluginInterface::getPluginInfo() const
168+{
169+ // Allow to load the resources when used as a static plugin
170+ //Q_INIT_RESOURCE(TimeZoneConfiguration);
171+
172+ StelPluginInfo info;
173+ info.id = "TimeZoneConfiguration";
174+ info.displayedName = "Time Zone";
175+ info.authors = "Bogdan Marinov";
176+ info.contact = "http://stellarium.org";
177+ info.description = "A convenient interface for some of the more obscure options in Stellarium's configuration file. Allows setting the time zone and changing the way the time and the date are displayed in the bottom bar.";
178+ return info;
179+}
180+
181+Q_EXPORT_PLUGIN2(TimeZoneConfiguration, TimeZoneConfigurationStelPluginInterface);
182+
183+TimeZoneConfiguration::TimeZoneConfiguration()
184+{
185+ setObjectName("TimeZoneConfiguration");
186+
187+ //
188+}
189+
190+TimeZoneConfiguration::~TimeZoneConfiguration()
191+{
192+ //
193+}
194+
195+void TimeZoneConfiguration::init()
196+{
197+ mainWindow = new TimeZoneConfigurationWindow();
198+}
199+
200+void TimeZoneConfiguration::deinit()
201+{
202+ delete mainWindow;
203+}
204+
205+double TimeZoneConfiguration::getCallOrder(StelModuleActionName) const
206+{
207+ return 0.;
208+}
209+
210+void TimeZoneConfiguration::update(double)
211+{
212+ //
213+}
214+
215+bool TimeZoneConfiguration::configureGui(bool show)
216+{
217+ if (show)
218+ mainWindow->setVisible(true);
219+
220+ return true;
221+}
222+
223+void TimeZoneConfiguration::setTimeZone(QString timeZoneString)
224+{
225+ if (timeZoneString.isEmpty())
226+ {
227+ return;
228+ }
229+ //TODO: Validation?
230+ qDebug() << "Setting \"localization/time_zone\" to" << timeZoneString;
231+
232+ QSettings * settings = StelApp::getInstance().getSettings();
233+ Q_ASSERT(settings);
234+
235+ settings->setValue("localization/time_zone", timeZoneString);
236+ settings->sync();
237+}
238+
239+QString TimeZoneConfiguration::readTimeZone()
240+{
241+ QSettings * settings = StelApp::getInstance().getSettings();
242+ Q_ASSERT(settings);
243+
244+ return settings->value("localization/time_zone").toString();
245+}
246+
247+void TimeZoneConfiguration::saveDisplayFormats()
248+{
249+ QSettings * settings = StelApp::getInstance().getSettings();
250+ Q_ASSERT(settings);
251+
252+ StelLocaleMgr & localeManager = StelApp::getInstance().getLocaleMgr();
253+
254+ QString timeDisplayFormat = localeManager.getTimeFormatStr();
255+ settings->setValue("localization/time_display_format", timeDisplayFormat);
256+
257+ QString dateDisplayFormat = localeManager.getDateFormatStr();
258+ settings->setValue("localization/date_display_format", dateDisplayFormat);
259+
260+ settings->sync();
261+}
262
263=== added file 'plugins/TimeZoneConfiguration/src/TimeZoneConfiguration.hpp'
264--- plugins/TimeZoneConfiguration/src/TimeZoneConfiguration.hpp 1970-01-01 00:00:00 +0000
265+++ plugins/TimeZoneConfiguration/src/TimeZoneConfiguration.hpp 2010-11-10 15:42:47 +0000
266@@ -0,0 +1,81 @@
267+/*
268+ * Time zone configuration plug-in for Stellarium
269+ *
270+ * Copyright (C) 2010 Bogdan Marinov
271+ *
272+ * This program is free software; you can redistribute it and/or
273+ * modify it under the terms of the GNU General Public License
274+ * as published by the Free Software Foundation; either version 2
275+ * of the License, or (at your option) any later version.
276+ *
277+ * This program is distributed in the hope that it will be useful,
278+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
279+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
280+ * GNU General Public License for more details.
281+ *
282+ * You should have received a copy of the GNU General Public License
283+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
284+ */
285+
286+ #ifndef _TIME_ZONE_CONFIGURATION_HPP_
287+ #define _TIME_ZONE_CONFIGURATION_HPP_
288+
289+#include "StelGui.hpp"
290+#include "StelModule.hpp"
291+
292+#include <QString>
293+
294+class TimeZoneConfigurationWindow;
295+
296+class TimeZoneConfiguration : public StelModule
297+{
298+ Q_OBJECT
299+
300+public:
301+ TimeZoneConfiguration();
302+ ~TimeZoneConfiguration();
303+
304+ virtual void init();
305+ virtual void deinit();
306+ virtual void update(double deltaTime);
307+ //virtual void draw(StelCore *core);
308+ virtual double getCallOrder(StelModuleActionName actionName) const;
309+ virtual bool configureGui(bool show);
310+
311+ //! Sets the time zone field in Stellarium's configuration file.
312+ //! To work, timeZoneString should be a valid value of the TZ environmental
313+ //! variable according to the POSIX format.
314+ //! (See http://www.gnu.org/s/libc/manual/html_node/TZ-Variable.html)
315+ //! Note that Microsoft Windows may use a truncated version of the TZ
316+ //! format.
317+ //! For now, Stellarium needs to be restarted for the new settings to take
318+ //! effect.
319+ void setTimeZone(QString timeZoneString);
320+
321+ //! Reads the time zone field in Stellarium's configuration file.
322+ //! \returns the contents of the "localization/time_zone" field in
323+ //! Stellarium's configuration file.
324+ QString readTimeZone();
325+
326+ //! Saves the formats used to display date and time in the bottom bar.
327+ void saveDisplayFormats();
328+
329+private:
330+ TimeZoneConfigurationWindow * mainWindow;
331+};
332+
333+#include "fixx11h.h"
334+#include <QObject>
335+#include "StelPluginInterface.hpp"
336+
337+//! This class is used by Qt to manage a plug-in interface
338+class TimeZoneConfigurationStelPluginInterface : public QObject, public StelPluginInterface
339+{
340+ Q_OBJECT
341+ Q_INTERFACES(StelPluginInterface)
342+public:
343+ virtual StelModule* getStelModule() const;
344+ virtual StelPluginInfo getPluginInfo() const;
345+};
346+
347+ #endif //_TIME_ZONE_CONFIGURATION_HPP_
348
349=== added directory 'plugins/TimeZoneConfiguration/src/gui'
350=== added file 'plugins/TimeZoneConfiguration/src/gui/DefineTimeZoneWindow.cpp'
351--- plugins/TimeZoneConfiguration/src/gui/DefineTimeZoneWindow.cpp 1970-01-01 00:00:00 +0000
352+++ plugins/TimeZoneConfiguration/src/gui/DefineTimeZoneWindow.cpp 2010-11-10 15:42:47 +0000
353@@ -0,0 +1,304 @@
354+/*
355+ * Time zone configuration plug-in for Stellarium
356+ *
357+ * Copyright (C) 2010 Bogdan Marinov
358+ *
359+ * This program is free software; you can redistribute it and/or
360+ * modify it under the terms of the GNU General Public License
361+ * as published by the Free Software Foundation; either version 2
362+ * of the License, or (at your option) any later version.
363+ *
364+ * This program is distributed in the hope that it will be useful,
365+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
366+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
367+ * GNU General Public License for more details.
368+ *
369+ * You should have received a copy of the GNU General Public License
370+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
371+ */
372+
373+#include "TimeZoneConfigurationWindow.hpp"
374+#include "DefineTimeZoneWindow.hpp"
375+#include "ui_defineTimeZone.h"
376+
377+#include <QRegExpValidator>
378+
379+DefineTimeZoneWindow::DefineTimeZoneWindow()
380+{
381+ ui = new Ui_defineTimeZoneForm();
382+ timeZoneNameValidator = new QRegExpValidator(QRegExp("[^:\\d,+-/]{3,}"), this);
383+}
384+
385+DefineTimeZoneWindow::~DefineTimeZoneWindow()
386+{
387+ delete ui;
388+ delete timeZoneNameValidator;
389+}
390+
391+void DefineTimeZoneWindow::languageChanged()
392+{
393+ if (dialog)
394+ ui->retranslateUi(dialog);
395+}
396+
397+void DefineTimeZoneWindow::createDialogContent()
398+{
399+ ui->setupUi(dialog);
400+
401+ connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close()));
402+ connect(ui->pushButtonUseDefinition, SIGNAL(clicked()), this, SLOT(useDefinition()));
403+
404+ connect(ui->doubleSpinBoxOffset, SIGNAL(valueChanged(double)), this, SLOT(updateDstOffset(double)));
405+
406+ connect(ui->comboBoxDstStartDateMonth, SIGNAL(currentIndexChanged(int)), this, SLOT(updateDayNumberMaximumDstStart(int)));
407+ connect(ui->comboBoxDstEndDateMonth, SIGNAL(currentIndexChanged(int)), this, SLOT(updateDayNumberMaximumDstEnd(int)));
408+
409+ ui->lineEditName->setValidator(timeZoneNameValidator);
410+ ui->lineEditNameDst->setValidator(timeZoneNameValidator);
411+
412+ resetWindowState();
413+}
414+
415+void DefineTimeZoneWindow::useDefinition()
416+{
417+ QString definition;
418+ QString timeZoneName = ui->lineEditName->text();
419+ if (timeZoneName.length() < 3)
420+ {
421+ return;
422+ }
423+ definition.append(timeZoneName);
424+ definition.append(TimeZoneConfigurationWindow::getTzOffsetStringFrom(ui->doubleSpinBoxOffset));
425+
426+ //Daylight saving time
427+ if (ui->checkBoxDst->isChecked())
428+ {
429+ QString dstTimeZoneName = ui->lineEditNameDst->text();
430+ if (dstTimeZoneName.length() < 3 || dstTimeZoneName == timeZoneName)
431+ {
432+ return;
433+ }
434+ //The name is the minimum required for DST
435+ definition.append(dstTimeZoneName);
436+
437+ //The offset is not necessary
438+ if (ui->checkBoxOffsetDst)
439+ {
440+ definition.append(TimeZoneConfigurationWindow::getTzOffsetStringFrom(ui->doubleSpinBoxOffsetDst));
441+ }
442+
443+ if (ui->groupBoxDstStart->isChecked() && ui->groupBoxDstEnd->isChecked())
444+ {
445+ if (ui->radioButtonDstStartDate->isChecked())
446+ {
447+ const int month = ui->comboBoxDstStartDateMonth->currentIndex() + 1;
448+ const int day = ui->spinBoxDstStartDateDay->value();
449+ QDate startDate;
450+ if (month == 2 && day == 29)
451+ {
452+ //Leap year: day is indexed between 0 and 365
453+ startDate.setDate(2000, month, day);
454+ definition.append(QString(",%1").arg(startDate.dayOfYear() - 1));
455+ }
456+ else
457+ {
458+ startDate.setDate(2010, month, day);
459+ definition.append(QString(",J%1").arg(startDate.dayOfYear()));
460+ }
461+ }
462+ else //Day of week
463+ {
464+ //Day of the week: 0-6, 0 is Sunday
465+ int day = ui->comboBoxDstStartDay->currentIndex();
466+ //Week ordinal number: 1-5, 5 is "last"
467+ int week = ui->comboBoxDstStartWeek->currentIndex() + 1;
468+ //Month: 1-12
469+ int month = ui->comboBoxDstStartMonth->currentIndex() + 1;
470+
471+ definition.append(QString(",M%1.%2.%3").arg(month).arg(week).arg(day));
472+ }
473+
474+ if (ui->checkBoxDstStartTime->isChecked())
475+ {
476+ definition.append(ui->timeEditDstStart->time().toString("'/'hh:mm:ss"));
477+ }
478+
479+ if (ui->radioButtonDstEndDate->isChecked())
480+ {
481+ const int month = ui->comboBoxDstEndDateMonth->currentIndex() + 1;
482+ const int day = ui->spinBoxDstEndDateDay->value();
483+ QDate endDate;
484+ if (month == 2 && day == 29)
485+ {
486+ //Leap year: day is indexed between 0 and 365
487+ endDate.setDate(2000, month, day);
488+ definition.append(QString(",%1").arg(endDate.dayOfYear() - 1));
489+ }
490+ else
491+ {
492+ endDate.setDate(2010, month, day);
493+ definition.append(QString(",J%1").arg(endDate.dayOfYear()));
494+ }
495+ }
496+ else //Day of week
497+ {
498+ //Day of the week: 0-6, 0 is Sunday
499+ int day = ui->comboBoxDstEndDay->currentIndex();
500+ //Week ordinal number: 1-5, 5 is "last"
501+ int week = ui->comboBoxDstEndWeek->currentIndex() + 1;
502+ //Month: 1-12
503+ int month = ui->comboBoxDstEndMonth->currentIndex() + 1;
504+
505+ definition.append(QString(",M%1.%2.%3").arg(month).arg(week).arg(day));
506+ }
507+
508+ if (ui->checkBoxDstEndTime->isChecked())
509+ {
510+ definition.append(ui->timeEditDstEnd->time().toString("'/'hh:mm:ss"));
511+ }
512+ }
513+ }
514+
515+ emit timeZoneDefined(definition);
516+ close();
517+}
518+
519+void DefineTimeZoneWindow::updateDstOffset(double normalOffset)
520+{
521+ if (ui->checkBoxOffsetDst->isChecked())
522+ return;
523+
524+ //By default, the DST offset is +1 hour the normal offset
525+ ui->doubleSpinBoxOffsetDst->setValue(normalOffset + 1.0);
526+}
527+
528+void DefineTimeZoneWindow::resetWindowState()
529+{
530+ populateDateLists();
531+
532+ //Default section
533+ ui->lineEditName->clear();
534+ ui->lineEditNameDst->clear();
535+
536+ ui->doubleSpinBoxOffset->setValue(0.0);
537+ //(indirectly sets doubleSpinBoxOffsetDst)
538+
539+ ui->checkBoxDst->setChecked(false);
540+ ui->frameDst->setVisible(false);
541+
542+ ui->checkBoxOffsetDst->setChecked(false);
543+ ui->doubleSpinBoxOffsetDst->setEnabled(false);
544+
545+ ui->groupBoxDstStart->setChecked(false);
546+ //(indirectly sets the other one)
547+
548+ ui->radioButtonDstStartDay->setChecked(true);
549+ ui->radioButtonDstEndDay->setChecked(true);
550+
551+ ui->spinBoxDstStartDateDay->setValue(1);
552+ ui->spinBoxDstEndDateDay->setValue(1);
553+ ui->comboBoxDstStartDateMonth->setCurrentIndex(0);
554+ ui->comboBoxDstEndDateMonth->setCurrentIndex(0);
555+
556+ ui->checkBoxDstStartTime->setChecked(false);
557+ ui->timeEditDstStart->setEnabled(false);
558+ ui->timeEditDstStart->setTime(QTime(2, 0, 0, 0));
559+ ui->checkBoxDstEndTime->setChecked(false);
560+ ui->timeEditDstEnd->setEnabled(false);
561+ ui->timeEditDstEnd->setTime(QTime(2, 0, 0, 0));
562+}
563+
564+void DefineTimeZoneWindow::populateDateLists()
565+{
566+ QStringList monthList;
567+ monthList.append("January");
568+ monthList.append("February");
569+ monthList.append("March");
570+ monthList.append("April");
571+ monthList.append("May");
572+ monthList.append("June");
573+ monthList.append("July");
574+ monthList.append("August");
575+ monthList.append("September");
576+ monthList.append("October");
577+ monthList.append("November");
578+ monthList.append("December");
579+
580+ ui->comboBoxDstStartMonth->clear();
581+ ui->comboBoxDstStartMonth->addItems(monthList);
582+ ui->comboBoxDstEndMonth->clear();
583+ ui->comboBoxDstEndMonth->addItems(monthList);
584+ ui->comboBoxDstStartDateMonth->clear();
585+ ui->comboBoxDstStartDateMonth->addItems(monthList);
586+ ui->comboBoxDstEndDateMonth->clear();
587+ ui->comboBoxDstEndDateMonth->addItems(monthList);
588+
589+ //TODO: For the translators: refers to any day of the week, if not possible, translate as "First week"
590+ QStringList weekList;
591+ weekList.append("First");
592+ weekList.append("Second");
593+ weekList.append("Third");
594+ weekList.append("Fourth");
595+ weekList.append("Last");
596+
597+ ui->comboBoxDstStartWeek->clear();
598+ ui->comboBoxDstStartWeek->addItems(weekList);
599+ ui->comboBoxDstEndWeek->clear();
600+ ui->comboBoxDstEndWeek->addItems(weekList);
601+
602+ //Starts from Sunday deliberately
603+ QStringList dayList;
604+ dayList.append("Sunday");
605+ dayList.append("Monday");
606+ dayList.append("Tuesday");
607+ dayList.append("Wednesday");
608+ dayList.append("Thursday");
609+ dayList.append("Friday");
610+ dayList.append("Saturday");
611+
612+ ui->comboBoxDstStartDay->clear();
613+ ui->comboBoxDstStartDay->addItems(dayList);
614+ ui->comboBoxDstEndDay->clear();
615+ ui->comboBoxDstEndDay->addItems(dayList);
616+}
617+void DefineTimeZoneWindow::updateDayNumberMaximum(int monthIndex, QSpinBox *spinBoxDay)
618+{
619+ int maximum = 31;
620+ switch (monthIndex)
621+ {
622+ case 0: //January
623+ case 2: //March
624+ case 4: //May
625+ case 6: //July
626+ case 7: //August
627+ case 9: //October
628+ case 11: //December
629+ maximum = 31;
630+ break;
631+ case 3: //April
632+ case 5: //June
633+ case 8: //September
634+ case 10: //November
635+ maximum = 30;
636+ break;
637+ case 1: //February
638+ maximum = 29;
639+ break;
640+ default:
641+ ;//
642+ }
643+
644+ if (spinBoxDay->value() > maximum)
645+ spinBoxDay->setValue(maximum);
646+ spinBoxDay->setRange(1, maximum);
647+}
648+
649+void DefineTimeZoneWindow::updateDayNumberMaximumDstStart(int monthIndex)
650+{
651+ updateDayNumberMaximum(monthIndex, ui->spinBoxDstStartDateDay);
652+}
653+
654+void DefineTimeZoneWindow::updateDayNumberMaximumDstEnd(int monthIndex)
655+{
656+ updateDayNumberMaximum(monthIndex, ui->spinBoxDstEndDateDay);
657+}
658
659=== added file 'plugins/TimeZoneConfiguration/src/gui/DefineTimeZoneWindow.hpp'
660--- plugins/TimeZoneConfiguration/src/gui/DefineTimeZoneWindow.hpp 1970-01-01 00:00:00 +0000
661+++ plugins/TimeZoneConfiguration/src/gui/DefineTimeZoneWindow.hpp 2010-11-10 15:42:47 +0000
662@@ -0,0 +1,62 @@
663+/*
664+ * Time zone configuration plug-in for Stellarium
665+ *
666+ * Copyright (C) 2010 Bogdan Marinov
667+ *
668+ * This program is free software; you can redistribute it and/or
669+ * modify it under the terms of the GNU General Public License
670+ * as published by the Free Software Foundation; either version 2
671+ * of the License, or (at your option) any later version.
672+ *
673+ * This program is distributed in the hope that it will be useful,
674+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
675+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
676+ * GNU General Public License for more details.
677+ *
678+ * You should have received a copy of the GNU General Public License
679+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
680+ */
681+
682+#ifndef _DEFINE_TIME_ZONE_HPP_
683+#define _DEFINE_TIME_ZONE_HPP_
684+
685+#include "StelDialog.hpp"
686+
687+class Ui_defineTimeZoneForm;
688+class QRegExpValidator;
689+class QSpinBox;
690+
691+class DefineTimeZoneWindow : public StelDialog
692+{
693+ Q_OBJECT
694+
695+public:
696+ DefineTimeZoneWindow();
697+ ~DefineTimeZoneWindow();
698+ void languageChanged();
699+
700+signals:
701+ void timeZoneDefined(QString timeZoneString);
702+
703+protected:
704+ void createDialogContent();
705+
706+private:
707+ Ui_defineTimeZoneForm * ui;
708+
709+ QRegExpValidator * timeZoneNameValidator;
710+
711+ void resetWindowState();
712+ void populateDateLists();
713+
714+ void updateDayNumberMaximum(int monthIndex, QSpinBox * spinBoxDay);
715+
716+private slots:
717+ void useDefinition();
718+ void updateDstOffset(double normalOffset);
719+ void updateDayNumberMaximumDstStart(int monthIndex);
720+ void updateDayNumberMaximumDstEnd(int monthIndex);
721+};
722+
723+
724+#endif //_DEFINE_TIME_ZONE_HPP_
725
726=== added file 'plugins/TimeZoneConfiguration/src/gui/TimeZoneConfigurationWindow.cpp'
727--- plugins/TimeZoneConfiguration/src/gui/TimeZoneConfigurationWindow.cpp 1970-01-01 00:00:00 +0000
728+++ plugins/TimeZoneConfiguration/src/gui/TimeZoneConfigurationWindow.cpp 2010-11-10 15:42:47 +0000
729@@ -0,0 +1,231 @@
730+/*
731+ * Time zone configuration plug-in for Stellarium
732+ *
733+ * Copyright (C) 2010 Bogdan Marinov
734+ *
735+ * This program is free software; you can redistribute it and/or
736+ * modify it under the terms of the GNU General Public License
737+ * as published by the Free Software Foundation; either version 2
738+ * of the License, or (at your option) any later version.
739+ *
740+ * This program is distributed in the hope that it will be useful,
741+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
742+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
743+ * GNU General Public License for more details.
744+ *
745+ * You should have received a copy of the GNU General Public License
746+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
747+ */
748+
749+#include "TimeZoneConfiguration.hpp"
750+#include "TimeZoneConfigurationWindow.hpp"
751+#include "DefineTimeZoneWindow.hpp"
752+#include "ui_timeZoneConfigurationWindow.h"
753+
754+#include "StelApp.hpp"
755+#include "StelLocaleMgr.hpp"
756+#include "StelModuleMgr.hpp"
757+
758+TimeZoneConfigurationWindow::TimeZoneConfigurationWindow()
759+{
760+ ui = new Ui_timeZoneConfigurationWindowForm();
761+ timeZoneConfiguration = GETSTELMODULE(TimeZoneConfiguration);
762+ defineTimeZoneWindow = NULL;
763+}
764+
765+TimeZoneConfigurationWindow::~TimeZoneConfigurationWindow()
766+{
767+ delete ui;
768+ if (defineTimeZoneWindow)
769+ delete defineTimeZoneWindow;
770+}
771+
772+void TimeZoneConfigurationWindow::languageChanged()
773+{
774+ if (dialog)
775+ ui->retranslateUi(dialog);
776+}
777+
778+void TimeZoneConfigurationWindow::createDialogContent()
779+{
780+ ui->setupUi(dialog);
781+
782+ connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close()));
783+ connect(ui->pushButtonSave, SIGNAL(clicked()), this, SLOT(saveTimeZoneSettings()));
784+ connect(ui->pushButtonEditTimeZone, SIGNAL(clicked()), this, SLOT(openDefineTimeZoneWindow()));
785+
786+ connect(ui->radioButtonTimeDefault, SIGNAL(toggled(bool)), this, SLOT(setTimeFormat(bool)));
787+ connect(ui->radioButtonTime12Hour, SIGNAL(toggled(bool)), this, SLOT(setTimeFormat(bool)));
788+ connect(ui->radioButtonTime24Hour, SIGNAL(toggled(bool)), this, SLOT(setTimeFormat(bool)));
789+
790+ connect(ui->radioButtonDateDefault, SIGNAL(toggled(bool)), this, SLOT(setDateFormat(bool)));
791+ connect(ui->radioButtonDateDMY, SIGNAL(toggled(bool)), this, SLOT(setDateFormat(bool)));
792+ connect(ui->radioButtonDateMDY, SIGNAL(toggled(bool)), this, SLOT(setDateFormat(bool)));
793+ connect(ui->radioButtonDateYMD, SIGNAL(toggled(bool)), this, SLOT(setDateFormat(bool)));
794+
795+ updateDisplayFormatSwitches();
796+
797+ QString currentTimeZoneString = timeZoneConfiguration->readTimeZone();
798+ //ui->lineEditCurrent->setText(currentTimeZoneString);
799+ ui->lineEditUserDefined->setText(currentTimeZoneString);
800+ ui->frameUserDefined->setEnabled(false);
801+
802+ QRegExp tzTimeZoneDescription("^SCT([+-])(\\d\\d):(\\d\\d):(\\d\\d)$");
803+ if (tzTimeZoneDescription.indexIn(currentTimeZoneString) == 0)
804+ {
805+ ui->radioButtonOffset->setChecked(true);
806+
807+ //Offset is POSIX style: UTF - local time = offset,
808+ //so invert the sign:
809+ const int sign = (tzTimeZoneDescription.cap(1).at(0).toAscii() == '-') ? 1 : -1;
810+ const int hours = tzTimeZoneDescription.cap(2).toInt();
811+ const int minutes = tzTimeZoneDescription.cap(3).toInt();
812+ const int seconds = tzTimeZoneDescription.cap(4).toInt();
813+ const double offset = sign * (hours + floor(((minutes * 60 + seconds)/3600.0) * 100) / 100.0);//Round to the second digit
814+ ui->doubleSpinBoxOffset->setValue(offset);
815+ }
816+ else if (currentTimeZoneString == "SCT+0")
817+ {
818+ ui->radioButtonUtc->setChecked(true);
819+ }
820+ else if (currentTimeZoneString == "system_default")
821+ {
822+ ui->radioButtonLocalSettings->setChecked(true);
823+ }
824+ else
825+ {
826+ ui->radioButtonUserDefined->setChecked(true);
827+ }
828+
829+ ui->labelTitle->setText(QString("Time Zone plug-in (version %1)").arg(PLUGIN_VERSION));
830+}
831+
832+void TimeZoneConfigurationWindow::saveTimeZoneSettings()
833+{
834+ QString timeZoneString;
835+ if (ui->radioButtonUtc->isChecked())
836+ {
837+ timeZoneString = "SCT+0";//"Stellarium Custom Time" :)
838+ }
839+ else if (ui->radioButtonOffset->isChecked())
840+ {
841+ timeZoneString = QString("SCT").append(getTzOffsetStringFrom(ui->doubleSpinBoxOffset));
842+ }
843+ else
844+ {
845+ timeZoneString = "system_default";
846+ }
847+
848+ timeZoneConfiguration->setTimeZone(timeZoneString);
849+}
850+
851+void TimeZoneConfigurationWindow::openDefineTimeZoneWindow()
852+{
853+ dialog->setEnabled(false);
854+
855+ if (defineTimeZoneWindow == NULL)
856+ {
857+ defineTimeZoneWindow = new DefineTimeZoneWindow();
858+ connect(defineTimeZoneWindow, SIGNAL(timeZoneDefined(QString)), this, SLOT(timeZoneDefined(QString)));
859+ connect(defineTimeZoneWindow, SIGNAL(visibleChanged(bool)), this, SLOT(closeDefineTimeZoneWindow(bool)));
860+ }
861+
862+ defineTimeZoneWindow->setVisible(true);
863+}
864+
865+void TimeZoneConfigurationWindow::closeDefineTimeZoneWindow(bool show)
866+{
867+ if (show)
868+ return;
869+
870+ disconnect(defineTimeZoneWindow, SIGNAL(timeZoneDefined(QString)), this, SLOT(timeZoneDefined(QString)));
871+ disconnect(defineTimeZoneWindow, SIGNAL(visibleChanged(bool)), this, SLOT(closeDefineTimeZoneWindow(bool)));
872+ delete defineTimeZoneWindow;
873+ defineTimeZoneWindow = NULL;
874+
875+ dialog->setEnabled(true);
876+}
877+
878+void TimeZoneConfigurationWindow::timeZoneDefined(QString timeZoneDefinition)
879+{
880+ ui->lineEditUserDefined->setText(timeZoneDefinition);
881+}
882+
883+QString TimeZoneConfigurationWindow::getTzOffsetStringFrom(QDoubleSpinBox * spinBox)
884+{
885+ Q_ASSERT(spinBox);
886+
887+ int offset = spinBox->value() * 3600;
888+ //Offset is POSIX style: UTC - local time = offset,
889+ //so invert the sign:
890+ QChar offsetSign = (offset > 0) ? '-' : '+';
891+ offset = abs(offset);
892+ int offsetSeconds = offset % 60; offset /= 60.;
893+ int offsetMinutes = offset % 60; offset /= 60.;
894+ int offsetHours = offset;
895+
896+ return QString("%1%2:%3:%4").arg(offsetSign).arg(offsetHours, 2, 10, QChar('0')).arg(offsetMinutes, 2, 10, QChar('0')).arg(offsetSeconds, 2, 10, QChar('0'));
897+}
898+
899+void TimeZoneConfigurationWindow::updateDisplayFormatSwitches()
900+{
901+ StelLocaleMgr & localeManager = StelApp::getInstance().getLocaleMgr();
902+
903+ QString timeFormat = localeManager.getTimeFormatStr();
904+ if (timeFormat == "12h")
905+ ui->radioButtonTime12Hour->setChecked(true);
906+ else if (timeFormat == "24h")
907+ ui->radioButtonTime24Hour->setChecked(true);
908+ else
909+ ui->radioButtonTimeDefault->setChecked(true);
910+
911+ QString dateFormat = localeManager.getDateFormatStr();
912+ if (dateFormat == "yyyymmdd")
913+ ui->radioButtonDateYMD->setChecked(true);
914+ else if (dateFormat == "ddmmyyyy")
915+ ui->radioButtonDateDMY->setChecked(true);
916+ else if (dateFormat == "mmddyyyy")
917+ ui->radioButtonDateMDY->setChecked(true);
918+ else
919+ ui->radioButtonDateDefault->setChecked(true);
920+}
921+
922+void TimeZoneConfigurationWindow::setTimeFormat(bool)
923+{
924+ //TODO: This will break if the settings' format is changed.
925+ //It's a pity StelLocaleMgr::sTimeFormatToString() is private...
926+ QString selectedFormat;
927+ if (ui->radioButtonTime12Hour->isChecked())
928+ selectedFormat = "12h";
929+ else if (ui->radioButtonTime24Hour->isChecked())
930+ selectedFormat = "24h";
931+ else
932+ selectedFormat = "system_default";
933+
934+ StelLocaleMgr & localeManager = StelApp::getInstance().getLocaleMgr();
935+ if (selectedFormat == localeManager.getTimeFormatStr())
936+ return;
937+ localeManager.setTimeFormatStr(selectedFormat);
938+ timeZoneConfiguration->saveDisplayFormats();
939+}
940+
941+void TimeZoneConfigurationWindow::setDateFormat(bool)
942+{
943+ //TODO: This will break if the settings' format is changed.
944+ //It's a pity StelLocaleMgr::sDateFormatToString() is private...
945+ QString selectedFormat;
946+ if (ui->radioButtonDateYMD->isChecked())
947+ selectedFormat = "yyyymmdd";
948+ else if (ui->radioButtonDateDMY->isChecked())
949+ selectedFormat = "ddmmyyyy";
950+ else if (ui->radioButtonDateMDY->isChecked())
951+ selectedFormat = "mmddyyyy";
952+ else
953+ selectedFormat = "system_default";
954+
955+ StelLocaleMgr & localeManager = StelApp::getInstance().getLocaleMgr();
956+ if (selectedFormat == localeManager.getDateFormatStr())
957+ return;
958+ localeManager.setDateFormatStr(selectedFormat);
959+ timeZoneConfiguration->saveDisplayFormats();
960+}
961
962=== added file 'plugins/TimeZoneConfiguration/src/gui/TimeZoneConfigurationWindow.hpp'
963--- plugins/TimeZoneConfiguration/src/gui/TimeZoneConfigurationWindow.hpp 1970-01-01 00:00:00 +0000
964+++ plugins/TimeZoneConfiguration/src/gui/TimeZoneConfigurationWindow.hpp 2010-11-10 15:42:47 +0000
965@@ -0,0 +1,67 @@
966+/*
967+ * Time zone configuration plug-in for Stellarium
968+ *
969+ * Copyright (C) 2010 Bogdan Marinov
970+ *
971+ * This program is free software; you can redistribute it and/or
972+ * modify it under the terms of the GNU General Public License
973+ * as published by the Free Software Foundation; either version 2
974+ * of the License, or (at your option) any later version.
975+ *
976+ * This program is distributed in the hope that it will be useful,
977+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
978+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
979+ * GNU General Public License for more details.
980+ *
981+ * You should have received a copy of the GNU General Public License
982+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
983+ */
984+
985+#ifndef _TIME_ZONE_CONFIGURATION_WINDOW_HPP_
986+#define _TIME_ZONE_CONFIGURATION_WINDOW_HPP_
987+
988+#include "StelDialog.hpp"
989+
990+#include <QString>
991+#include <QDoubleSpinBox>
992+
993+class Ui_timeZoneConfigurationWindowForm;
994+class TimeZoneConfiguration;
995+class DefineTimeZoneWindow;
996+
997+class TimeZoneConfigurationWindow : public StelDialog
998+{
999+ Q_OBJECT
1000+
1001+public:
1002+ TimeZoneConfigurationWindow();
1003+ ~TimeZoneConfigurationWindow();
1004+ void languageChanged();
1005+
1006+ //! Converts a decimal fraction of hours to a string containing a signed
1007+ //! offset in the format used in the TZ variable.
1008+ //! The sign is inverted, as in the TZ format offset = (UTC - local time),
1009+ //! not the traditional offset = (local time - UTC).
1010+ static QString getTzOffsetStringFrom(QDoubleSpinBox * spinBox);
1011+
1012+protected:
1013+ void createDialogContent();
1014+
1015+private:
1016+ Ui_timeZoneConfigurationWindowForm * ui;
1017+ DefineTimeZoneWindow * defineTimeZoneWindow;
1018+ TimeZoneConfiguration * timeZoneConfiguration;
1019+
1020+private slots:
1021+ void saveTimeZoneSettings();
1022+ void openDefineTimeZoneWindow();
1023+ void closeDefineTimeZoneWindow(bool);
1024+ void timeZoneDefined(QString timeZoneDefinition);
1025+
1026+ void setTimeFormat(bool);
1027+ void setDateFormat(bool);
1028+ void updateDisplayFormatSwitches();
1029+};
1030+
1031+
1032+#endif //_TIME_ZONE_CONFIGURATION_WINDOW_HPP_
1033
1034=== added file 'plugins/TimeZoneConfiguration/src/gui/defineTimeZone.ui'
1035--- plugins/TimeZoneConfiguration/src/gui/defineTimeZone.ui 1970-01-01 00:00:00 +0000
1036+++ plugins/TimeZoneConfiguration/src/gui/defineTimeZone.ui 2010-11-10 15:42:47 +0000
1037@@ -0,0 +1,627 @@
1038+<?xml version="1.0" encoding="UTF-8"?>
1039+<ui version="4.0">
1040+ <class>defineTimeZoneForm</class>
1041+ <widget class="QWidget" name="defineTimeZoneForm">
1042+ <property name="geometry">
1043+ <rect>
1044+ <x>0</x>
1045+ <y>0</y>
1046+ <width>450</width>
1047+ <height>474</height>
1048+ </rect>
1049+ </property>
1050+ <layout class="QVBoxLayout" name="verticalLayout">
1051+ <property name="spacing">
1052+ <number>0</number>
1053+ </property>
1054+ <property name="margin">
1055+ <number>0</number>
1056+ </property>
1057+ <item>
1058+ <widget class="BarFrame" name="TitleBar">
1059+ <property name="sizePolicy">
1060+ <sizepolicy hsizetype="Expanding" vsizetype="Minimum">
1061+ <horstretch>0</horstretch>
1062+ <verstretch>0</verstretch>
1063+ </sizepolicy>
1064+ </property>
1065+ <property name="minimumSize">
1066+ <size>
1067+ <width>0</width>
1068+ <height>25</height>
1069+ </size>
1070+ </property>
1071+ <property name="maximumSize">
1072+ <size>
1073+ <width>16777215</width>
1074+ <height>30</height>
1075+ </size>
1076+ </property>
1077+ <property name="focusPolicy">
1078+ <enum>Qt::NoFocus</enum>
1079+ </property>
1080+ <property name="autoFillBackground">
1081+ <bool>false</bool>
1082+ </property>
1083+ <property name="frameShape">
1084+ <enum>QFrame::StyledPanel</enum>
1085+ </property>
1086+ <layout class="QHBoxLayout">
1087+ <property name="spacing">
1088+ <number>6</number>
1089+ </property>
1090+ <property name="leftMargin">
1091+ <number>0</number>
1092+ </property>
1093+ <property name="topMargin">
1094+ <number>0</number>
1095+ </property>
1096+ <property name="rightMargin">
1097+ <number>4</number>
1098+ </property>
1099+ <property name="bottomMargin">
1100+ <number>0</number>
1101+ </property>
1102+ <item>
1103+ <spacer name="leftSpacer">
1104+ <property name="orientation">
1105+ <enum>Qt::Horizontal</enum>
1106+ </property>
1107+ <property name="sizeHint" stdset="0">
1108+ <size>
1109+ <width>40</width>
1110+ <height>20</height>
1111+ </size>
1112+ </property>
1113+ </spacer>
1114+ </item>
1115+ <item>
1116+ <widget class="QLabel" name="stelWindowTitle">
1117+ <property name="text">
1118+ <string>Define a time zone</string>
1119+ </property>
1120+ </widget>
1121+ </item>
1122+ <item>
1123+ <spacer name="rightSpacer">
1124+ <property name="orientation">
1125+ <enum>Qt::Horizontal</enum>
1126+ </property>
1127+ <property name="sizeHint" stdset="0">
1128+ <size>
1129+ <width>40</width>
1130+ <height>20</height>
1131+ </size>
1132+ </property>
1133+ </spacer>
1134+ </item>
1135+ <item>
1136+ <widget class="QPushButton" name="closeStelWindow">
1137+ <property name="minimumSize">
1138+ <size>
1139+ <width>16</width>
1140+ <height>16</height>
1141+ </size>
1142+ </property>
1143+ <property name="maximumSize">
1144+ <size>
1145+ <width>16</width>
1146+ <height>16</height>
1147+ </size>
1148+ </property>
1149+ <property name="focusPolicy">
1150+ <enum>Qt::NoFocus</enum>
1151+ </property>
1152+ <property name="text">
1153+ <string/>
1154+ </property>
1155+ </widget>
1156+ </item>
1157+ </layout>
1158+ </widget>
1159+ </item>
1160+ <item>
1161+ <widget class="QGroupBox" name="groupBoxTimeZone">
1162+ <property name="title">
1163+ <string>Time zone</string>
1164+ </property>
1165+ <layout class="QVBoxLayout" name="verticalLayoutTimeZone">
1166+ <property name="margin">
1167+ <number>0</number>
1168+ </property>
1169+ <item>
1170+ <layout class="QHBoxLayout" name="horizontalLayoutName">
1171+ <item>
1172+ <widget class="QLabel" name="labelName">
1173+ <property name="text">
1174+ <string>Timezone name:</string>
1175+ </property>
1176+ </widget>
1177+ </item>
1178+ <item>
1179+ <spacer name="horizontalSpacerName">
1180+ <property name="orientation">
1181+ <enum>Qt::Horizontal</enum>
1182+ </property>
1183+ <property name="sizeHint" stdset="0">
1184+ <size>
1185+ <width>40</width>
1186+ <height>20</height>
1187+ </size>
1188+ </property>
1189+ </spacer>
1190+ </item>
1191+ <item>
1192+ <widget class="QLineEdit" name="lineEditName"/>
1193+ </item>
1194+ </layout>
1195+ </item>
1196+ <item>
1197+ <layout class="QHBoxLayout" name="horizontalLayoutOffset">
1198+ <item>
1199+ <widget class="QLabel" name="labelOffset">
1200+ <property name="text">
1201+ <string>Offset from UTC:</string>
1202+ </property>
1203+ </widget>
1204+ </item>
1205+ <item>
1206+ <spacer name="horizontalSpacer">
1207+ <property name="orientation">
1208+ <enum>Qt::Horizontal</enum>
1209+ </property>
1210+ <property name="sizeHint" stdset="0">
1211+ <size>
1212+ <width>40</width>
1213+ <height>20</height>
1214+ </size>
1215+ </property>
1216+ </spacer>
1217+ </item>
1218+ <item>
1219+ <widget class="QDoubleSpinBox" name="doubleSpinBoxOffset">
1220+ <property name="wrapping">
1221+ <bool>true</bool>
1222+ </property>
1223+ <property name="suffix">
1224+ <string> hours</string>
1225+ </property>
1226+ <property name="minimum">
1227+ <double>-24.000000000000000</double>
1228+ </property>
1229+ <property name="maximum">
1230+ <double>24.000000000000000</double>
1231+ </property>
1232+ <property name="singleStep">
1233+ <double>0.250000000000000</double>
1234+ </property>
1235+ </widget>
1236+ </item>
1237+ </layout>
1238+ </item>
1239+ <item>
1240+ <widget class="QCheckBox" name="checkBoxDst">
1241+ <property name="text">
1242+ <string>Daylight saving time (summer time)</string>
1243+ </property>
1244+ </widget>
1245+ </item>
1246+ <item>
1247+ <widget class="QFrame" name="frameDst">
1248+ <layout class="QVBoxLayout" name="verticalLayoutDst">
1249+ <property name="spacing">
1250+ <number>0</number>
1251+ </property>
1252+ <property name="margin">
1253+ <number>0</number>
1254+ </property>
1255+ <item>
1256+ <widget class="QFrame" name="frame">
1257+ <layout class="QVBoxLayout" name="verticalLayoutDstMain">
1258+ <property name="margin">
1259+ <number>0</number>
1260+ </property>
1261+ <item>
1262+ <layout class="QHBoxLayout" name="horizontalLayoutNameDst">
1263+ <item>
1264+ <widget class="QLabel" name="labelNameDst">
1265+ <property name="sizePolicy">
1266+ <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
1267+ <horstretch>0</horstretch>
1268+ <verstretch>0</verstretch>
1269+ </sizepolicy>
1270+ </property>
1271+ <property name="text">
1272+ <string>DST timezone name:</string>
1273+ </property>
1274+ </widget>
1275+ </item>
1276+ <item>
1277+ <spacer name="horizontalSpacerNameDst">
1278+ <property name="orientation">
1279+ <enum>Qt::Horizontal</enum>
1280+ </property>
1281+ <property name="sizeHint" stdset="0">
1282+ <size>
1283+ <width>40</width>
1284+ <height>20</height>
1285+ </size>
1286+ </property>
1287+ </spacer>
1288+ </item>
1289+ <item>
1290+ <widget class="QLineEdit" name="lineEditNameDst"/>
1291+ </item>
1292+ </layout>
1293+ </item>
1294+ <item>
1295+ <layout class="QHBoxLayout" name="horizontalLayoutOffsetDst">
1296+ <item>
1297+ <widget class="QCheckBox" name="checkBoxOffsetDst">
1298+ <property name="text">
1299+ <string>DST offset from UTC:</string>
1300+ </property>
1301+ </widget>
1302+ </item>
1303+ <item>
1304+ <spacer name="horizontalSpacerOffsetDst">
1305+ <property name="orientation">
1306+ <enum>Qt::Horizontal</enum>
1307+ </property>
1308+ <property name="sizeHint" stdset="0">
1309+ <size>
1310+ <width>0</width>
1311+ <height>0</height>
1312+ </size>
1313+ </property>
1314+ </spacer>
1315+ </item>
1316+ <item>
1317+ <widget class="QDoubleSpinBox" name="doubleSpinBoxOffsetDst">
1318+ <property name="wrapping">
1319+ <bool>true</bool>
1320+ </property>
1321+ <property name="suffix">
1322+ <string> hours</string>
1323+ </property>
1324+ <property name="minimum">
1325+ <double>-24.000000000000000</double>
1326+ </property>
1327+ <property name="maximum">
1328+ <double>24.000000000000000</double>
1329+ </property>
1330+ <property name="singleStep">
1331+ <double>0.250000000000000</double>
1332+ </property>
1333+ </widget>
1334+ </item>
1335+ </layout>
1336+ </item>
1337+ </layout>
1338+ </widget>
1339+ </item>
1340+ <item>
1341+ <widget class="QGroupBox" name="groupBoxDstStart">
1342+ <property name="title">
1343+ <string>Daylight saving time start</string>
1344+ </property>
1345+ <property name="checkable">
1346+ <bool>true</bool>
1347+ </property>
1348+ <property name="checked">
1349+ <bool>false</bool>
1350+ </property>
1351+ <layout class="QGridLayout" name="gridLayoutDstStart">
1352+ <property name="margin">
1353+ <number>0</number>
1354+ </property>
1355+ <item row="1" column="0" colspan="2">
1356+ <widget class="QRadioButton" name="radioButtonDstStartDay">
1357+ <property name="text">
1358+ <string>Day:</string>
1359+ </property>
1360+ </widget>
1361+ </item>
1362+ <item row="1" column="2">
1363+ <widget class="QComboBox" name="comboBoxDstStartWeek"/>
1364+ </item>
1365+ <item row="1" column="3">
1366+ <widget class="QComboBox" name="comboBoxDstStartDay"/>
1367+ </item>
1368+ <item row="1" column="4">
1369+ <widget class="QComboBox" name="comboBoxDstStartMonth"/>
1370+ </item>
1371+ <item row="4" column="0" colspan="2">
1372+ <widget class="QCheckBox" name="checkBoxDstStartTime">
1373+ <property name="text">
1374+ <string>Time of change:</string>
1375+ </property>
1376+ </widget>
1377+ </item>
1378+ <item row="4" column="2" colspan="3">
1379+ <widget class="QTimeEdit" name="timeEditDstStart">
1380+ <property name="wrapping">
1381+ <bool>true</bool>
1382+ </property>
1383+ <property name="displayFormat">
1384+ <string notr="true">HH:mm:ss</string>
1385+ </property>
1386+ <property name="time">
1387+ <time>
1388+ <hour>2</hour>
1389+ <minute>0</minute>
1390+ <second>0</second>
1391+ </time>
1392+ </property>
1393+ </widget>
1394+ </item>
1395+ <item row="2" column="0" colspan="2">
1396+ <widget class="QRadioButton" name="radioButtonDstStartDate">
1397+ <property name="text">
1398+ <string>Date:</string>
1399+ </property>
1400+ </widget>
1401+ </item>
1402+ <item row="2" column="2" colspan="3">
1403+ <widget class="QFrame" name="frameDstStartDate">
1404+ <layout class="QHBoxLayout" name="horizontalLayout">
1405+ <property name="margin">
1406+ <number>0</number>
1407+ </property>
1408+ <item>
1409+ <widget class="QSpinBox" name="spinBoxDstStartDateDay"/>
1410+ </item>
1411+ <item>
1412+ <widget class="QComboBox" name="comboBoxDstStartDateMonth"/>
1413+ </item>
1414+ </layout>
1415+ </widget>
1416+ </item>
1417+ </layout>
1418+ </widget>
1419+ </item>
1420+ <item>
1421+ <widget class="QGroupBox" name="groupBoxDstEnd">
1422+ <property name="title">
1423+ <string>Daylight saving time end</string>
1424+ </property>
1425+ <property name="checkable">
1426+ <bool>true</bool>
1427+ </property>
1428+ <property name="checked">
1429+ <bool>false</bool>
1430+ </property>
1431+ <layout class="QGridLayout" name="gridLayout_4">
1432+ <property name="margin">
1433+ <number>0</number>
1434+ </property>
1435+ <item row="1" column="0" colspan="2">
1436+ <widget class="QRadioButton" name="radioButtonDstEndDay">
1437+ <property name="text">
1438+ <string>Day:</string>
1439+ </property>
1440+ </widget>
1441+ </item>
1442+ <item row="1" column="2">
1443+ <widget class="QComboBox" name="comboBoxDstEndWeek"/>
1444+ </item>
1445+ <item row="1" column="3">
1446+ <widget class="QComboBox" name="comboBoxDstEndDay"/>
1447+ </item>
1448+ <item row="1" column="4">
1449+ <widget class="QComboBox" name="comboBoxDstEndMonth"/>
1450+ </item>
1451+ <item row="4" column="0" colspan="2">
1452+ <widget class="QCheckBox" name="checkBoxDstEndTime">
1453+ <property name="text">
1454+ <string>Time of change:</string>
1455+ </property>
1456+ </widget>
1457+ </item>
1458+ <item row="4" column="2" colspan="3">
1459+ <widget class="QTimeEdit" name="timeEditDstEnd">
1460+ <property name="wrapping">
1461+ <bool>true</bool>
1462+ </property>
1463+ <property name="displayFormat">
1464+ <string notr="true">HH:mm:ss</string>
1465+ </property>
1466+ <property name="time">
1467+ <time>
1468+ <hour>2</hour>
1469+ <minute>0</minute>
1470+ <second>0</second>
1471+ </time>
1472+ </property>
1473+ </widget>
1474+ </item>
1475+ <item row="3" column="0" colspan="2">
1476+ <widget class="QRadioButton" name="radioButtonDstEndDate">
1477+ <property name="text">
1478+ <string>Date:</string>
1479+ </property>
1480+ </widget>
1481+ </item>
1482+ <item row="3" column="2" colspan="3">
1483+ <widget class="QFrame" name="frameDstEndDate">
1484+ <layout class="QHBoxLayout" name="horizontalLayoutDstEndDate">
1485+ <property name="margin">
1486+ <number>0</number>
1487+ </property>
1488+ <item>
1489+ <widget class="QSpinBox" name="spinBoxDstEndDateDay"/>
1490+ </item>
1491+ <item>
1492+ <widget class="QComboBox" name="comboBoxDstEndDateMonth"/>
1493+ </item>
1494+ </layout>
1495+ </widget>
1496+ </item>
1497+ </layout>
1498+ </widget>
1499+ </item>
1500+ </layout>
1501+ </widget>
1502+ </item>
1503+ <item>
1504+ <spacer name="verticalSpacer">
1505+ <property name="orientation">
1506+ <enum>Qt::Vertical</enum>
1507+ </property>
1508+ <property name="sizeHint" stdset="0">
1509+ <size>
1510+ <width>20</width>
1511+ <height>40</height>
1512+ </size>
1513+ </property>
1514+ </spacer>
1515+ </item>
1516+ <item>
1517+ <widget class="QPushButton" name="pushButtonUseDefinition">
1518+ <property name="text">
1519+ <string>Use this definition</string>
1520+ </property>
1521+ </widget>
1522+ </item>
1523+ </layout>
1524+ </widget>
1525+ </item>
1526+ </layout>
1527+ </widget>
1528+ <customwidgets>
1529+ <customwidget>
1530+ <class>BarFrame</class>
1531+ <extends>QFrame</extends>
1532+ <header>Dialog.hpp</header>
1533+ <container>1</container>
1534+ </customwidget>
1535+ </customwidgets>
1536+ <tabstops>
1537+ <tabstop>lineEditName</tabstop>
1538+ <tabstop>doubleSpinBoxOffset</tabstop>
1539+ <tabstop>checkBoxDst</tabstop>
1540+ <tabstop>lineEditNameDst</tabstop>
1541+ <tabstop>checkBoxOffsetDst</tabstop>
1542+ <tabstop>doubleSpinBoxOffsetDst</tabstop>
1543+ <tabstop>groupBoxDstStart</tabstop>
1544+ <tabstop>radioButtonDstStartDay</tabstop>
1545+ <tabstop>comboBoxDstStartWeek</tabstop>
1546+ <tabstop>comboBoxDstStartDay</tabstop>
1547+ <tabstop>comboBoxDstStartMonth</tabstop>
1548+ <tabstop>radioButtonDstStartDate</tabstop>
1549+ <tabstop>spinBoxDstStartDateDay</tabstop>
1550+ <tabstop>comboBoxDstStartDateMonth</tabstop>
1551+ <tabstop>checkBoxDstStartTime</tabstop>
1552+ <tabstop>timeEditDstStart</tabstop>
1553+ <tabstop>groupBoxDstEnd</tabstop>
1554+ <tabstop>radioButtonDstEndDay</tabstop>
1555+ <tabstop>comboBoxDstEndWeek</tabstop>
1556+ <tabstop>comboBoxDstEndDay</tabstop>
1557+ <tabstop>comboBoxDstEndMonth</tabstop>
1558+ <tabstop>radioButtonDstEndDate</tabstop>
1559+ <tabstop>spinBoxDstEndDateDay</tabstop>
1560+ <tabstop>comboBoxDstEndDateMonth</tabstop>
1561+ <tabstop>checkBoxDstEndTime</tabstop>
1562+ <tabstop>timeEditDstEnd</tabstop>
1563+ <tabstop>pushButtonUseDefinition</tabstop>
1564+ </tabstops>
1565+ <resources/>
1566+ <connections>
1567+ <connection>
1568+ <sender>checkBoxDst</sender>
1569+ <signal>toggled(bool)</signal>
1570+ <receiver>frameDst</receiver>
1571+ <slot>setVisible(bool)</slot>
1572+ <hints>
1573+ <hint type="sourcelabel">
1574+ <x>230</x>
1575+ <y>125</y>
1576+ </hint>
1577+ <hint type="destinationlabel">
1578+ <x>228</x>
1579+ <y>316</y>
1580+ </hint>
1581+ </hints>
1582+ </connection>
1583+ <connection>
1584+ <sender>checkBoxOffsetDst</sender>
1585+ <signal>toggled(bool)</signal>
1586+ <receiver>doubleSpinBoxOffsetDst</receiver>
1587+ <slot>setEnabled(bool)</slot>
1588+ <hints>
1589+ <hint type="sourcelabel">
1590+ <x>172</x>
1591+ <y>186</y>
1592+ </hint>
1593+ <hint type="destinationlabel">
1594+ <x>348</x>
1595+ <y>188</y>
1596+ </hint>
1597+ </hints>
1598+ </connection>
1599+ <connection>
1600+ <sender>checkBoxDstEndTime</sender>
1601+ <signal>toggled(bool)</signal>
1602+ <receiver>timeEditDstEnd</receiver>
1603+ <slot>setEnabled(bool)</slot>
1604+ <hints>
1605+ <hint type="sourcelabel">
1606+ <x>95</x>
1607+ <y>427</y>
1608+ </hint>
1609+ <hint type="destinationlabel">
1610+ <x>362</x>
1611+ <y>430</y>
1612+ </hint>
1613+ </hints>
1614+ </connection>
1615+ <connection>
1616+ <sender>checkBoxDstStartTime</sender>
1617+ <signal>toggled(bool)</signal>
1618+ <receiver>timeEditDstStart</receiver>
1619+ <slot>setEnabled(bool)</slot>
1620+ <hints>
1621+ <hint type="sourcelabel">
1622+ <x>115</x>
1623+ <y>298</y>
1624+ </hint>
1625+ <hint type="destinationlabel">
1626+ <x>187</x>
1627+ <y>294</y>
1628+ </hint>
1629+ </hints>
1630+ </connection>
1631+ <connection>
1632+ <sender>groupBoxDstStart</sender>
1633+ <signal>toggled(bool)</signal>
1634+ <receiver>groupBoxDstEnd</receiver>
1635+ <slot>setChecked(bool)</slot>
1636+ <hints>
1637+ <hint type="sourcelabel">
1638+ <x>117</x>
1639+ <y>243</y>
1640+ </hint>
1641+ <hint type="destinationlabel">
1642+ <x>123</x>
1643+ <y>362</y>
1644+ </hint>
1645+ </hints>
1646+ </connection>
1647+ <connection>
1648+ <sender>groupBoxDstEnd</sender>
1649+ <signal>toggled(bool)</signal>
1650+ <receiver>groupBoxDstStart</receiver>
1651+ <slot>setChecked(bool)</slot>
1652+ <hints>
1653+ <hint type="sourcelabel">
1654+ <x>301</x>
1655+ <y>354</y>
1656+ </hint>
1657+ <hint type="destinationlabel">
1658+ <x>295</x>
1659+ <y>286</y>
1660+ </hint>
1661+ </hints>
1662+ </connection>
1663+ </connections>
1664+</ui>
1665
1666=== added file 'plugins/TimeZoneConfiguration/src/gui/timeZoneConfigurationWindow.ui'
1667--- plugins/TimeZoneConfiguration/src/gui/timeZoneConfigurationWindow.ui 1970-01-01 00:00:00 +0000
1668+++ plugins/TimeZoneConfiguration/src/gui/timeZoneConfigurationWindow.ui 2010-11-10 15:42:47 +0000
1669@@ -0,0 +1,503 @@
1670+<?xml version="1.0" encoding="UTF-8"?>
1671+<ui version="4.0">
1672+ <class>timeZoneConfigurationWindowForm</class>
1673+ <widget class="QWidget" name="timeZoneConfigurationWindowForm">
1674+ <property name="geometry">
1675+ <rect>
1676+ <x>0</x>
1677+ <y>0</y>
1678+ <width>450</width>
1679+ <height>400</height>
1680+ </rect>
1681+ </property>
1682+ <layout class="QVBoxLayout" name="verticalLayout">
1683+ <property name="spacing">
1684+ <number>0</number>
1685+ </property>
1686+ <property name="margin">
1687+ <number>0</number>
1688+ </property>
1689+ <item>
1690+ <widget class="BarFrame" name="TitleBar">
1691+ <property name="sizePolicy">
1692+ <sizepolicy hsizetype="Expanding" vsizetype="Minimum">
1693+ <horstretch>0</horstretch>
1694+ <verstretch>0</verstretch>
1695+ </sizepolicy>
1696+ </property>
1697+ <property name="minimumSize">
1698+ <size>
1699+ <width>0</width>
1700+ <height>25</height>
1701+ </size>
1702+ </property>
1703+ <property name="maximumSize">
1704+ <size>
1705+ <width>16777215</width>
1706+ <height>30</height>
1707+ </size>
1708+ </property>
1709+ <property name="focusPolicy">
1710+ <enum>Qt::NoFocus</enum>
1711+ </property>
1712+ <property name="autoFillBackground">
1713+ <bool>false</bool>
1714+ </property>
1715+ <property name="frameShape">
1716+ <enum>QFrame::StyledPanel</enum>
1717+ </property>
1718+ <layout class="QHBoxLayout">
1719+ <property name="spacing">
1720+ <number>6</number>
1721+ </property>
1722+ <property name="leftMargin">
1723+ <number>0</number>
1724+ </property>
1725+ <property name="topMargin">
1726+ <number>0</number>
1727+ </property>
1728+ <property name="rightMargin">
1729+ <number>4</number>
1730+ </property>
1731+ <property name="bottomMargin">
1732+ <number>0</number>
1733+ </property>
1734+ <item>
1735+ <spacer name="leftSpacer">
1736+ <property name="orientation">
1737+ <enum>Qt::Horizontal</enum>
1738+ </property>
1739+ <property name="sizeHint" stdset="0">
1740+ <size>
1741+ <width>40</width>
1742+ <height>20</height>
1743+ </size>
1744+ </property>
1745+ </spacer>
1746+ </item>
1747+ <item>
1748+ <widget class="QLabel" name="stelWindowTitle">
1749+ <property name="text">
1750+ <string>Time zone</string>
1751+ </property>
1752+ </widget>
1753+ </item>
1754+ <item>
1755+ <spacer name="rightSpacer">
1756+ <property name="orientation">
1757+ <enum>Qt::Horizontal</enum>
1758+ </property>
1759+ <property name="sizeHint" stdset="0">
1760+ <size>
1761+ <width>40</width>
1762+ <height>20</height>
1763+ </size>
1764+ </property>
1765+ </spacer>
1766+ </item>
1767+ <item>
1768+ <widget class="QPushButton" name="closeStelWindow">
1769+ <property name="minimumSize">
1770+ <size>
1771+ <width>16</width>
1772+ <height>16</height>
1773+ </size>
1774+ </property>
1775+ <property name="maximumSize">
1776+ <size>
1777+ <width>16</width>
1778+ <height>16</height>
1779+ </size>
1780+ </property>
1781+ <property name="focusPolicy">
1782+ <enum>Qt::NoFocus</enum>
1783+ </property>
1784+ <property name="text">
1785+ <string/>
1786+ </property>
1787+ </widget>
1788+ </item>
1789+ </layout>
1790+ </widget>
1791+ </item>
1792+ <item>
1793+ <widget class="QTabWidget" name="tabWidget">
1794+ <widget class="QWidget" name="tabTimeZone">
1795+ <attribute name="title">
1796+ <string>Time zone</string>
1797+ </attribute>
1798+ <layout class="QVBoxLayout" name="verticalLayoutTimeZone">
1799+ <property name="spacing">
1800+ <number>0</number>
1801+ </property>
1802+ <property name="margin">
1803+ <number>0</number>
1804+ </property>
1805+ <item>
1806+ <widget class="QGroupBox" name="groupBoxTimeZone">
1807+ <property name="title">
1808+ <string>Time zone</string>
1809+ </property>
1810+ <layout class="QGridLayout" name="gridLayoutCurrent">
1811+ <property name="verticalSpacing">
1812+ <number>8</number>
1813+ </property>
1814+ <property name="margin">
1815+ <number>0</number>
1816+ </property>
1817+ <item row="0" column="0" colspan="2">
1818+ <widget class="QLabel" name="labelTimeZoneInfo">
1819+ <property name="text">
1820+ <string>By default, the time displayed in Stellarium is interpreted as the local time in the system's time zone, not in the displayed location's time zone. This behaviour can be changed by changing Stellarium's global time zone settings.</string>
1821+ </property>
1822+ <property name="wordWrap">
1823+ <bool>true</bool>
1824+ </property>
1825+ </widget>
1826+ </item>
1827+ <item row="1" column="0" colspan="2">
1828+ <widget class="QRadioButton" name="radioButtonLocalSettings">
1829+ <property name="text">
1830+ <string>Use system settings (default)</string>
1831+ </property>
1832+ </widget>
1833+ </item>
1834+ <item row="2" column="0" colspan="2">
1835+ <widget class="QRadioButton" name="radioButtonUtc">
1836+ <property name="text">
1837+ <string>Universal Coordinated Time (UTC)</string>
1838+ </property>
1839+ </widget>
1840+ </item>
1841+ <item row="3" column="0">
1842+ <widget class="QRadioButton" name="radioButtonOffset">
1843+ <property name="text">
1844+ <string>Offset from UTC:</string>
1845+ </property>
1846+ </widget>
1847+ </item>
1848+ <item row="3" column="1">
1849+ <widget class="QDoubleSpinBox" name="doubleSpinBoxOffset">
1850+ <property name="wrapping">
1851+ <bool>true</bool>
1852+ </property>
1853+ <property name="suffix">
1854+ <string> hours</string>
1855+ </property>
1856+ <property name="decimals">
1857+ <number>2</number>
1858+ </property>
1859+ <property name="minimum">
1860+ <double>-24.000000000000000</double>
1861+ </property>
1862+ <property name="maximum">
1863+ <double>24.000000000000000</double>
1864+ </property>
1865+ <property name="singleStep">
1866+ <double>0.250000000000000</double>
1867+ </property>
1868+ </widget>
1869+ </item>
1870+ <item row="4" column="0" colspan="2">
1871+ <widget class="QLabel" name="labelOffset">
1872+ <property name="text">
1873+ <string>(offset = local time - UTC time)</string>
1874+ </property>
1875+ <property name="alignment">
1876+ <set>Qt::AlignCenter</set>
1877+ </property>
1878+ </widget>
1879+ </item>
1880+ <item row="5" column="0">
1881+ <widget class="QRadioButton" name="radioButtonUserDefined">
1882+ <property name="text">
1883+ <string>User-defined:</string>
1884+ </property>
1885+ </widget>
1886+ </item>
1887+ <item row="5" column="1">
1888+ <widget class="QFrame" name="frameUserDefined">
1889+ <layout class="QHBoxLayout" name="horizontalLayout">
1890+ <property name="margin">
1891+ <number>0</number>
1892+ </property>
1893+ <item>
1894+ <widget class="QLineEdit" name="lineEditUserDefined"/>
1895+ </item>
1896+ <item>
1897+ <widget class="QPushButton" name="pushButtonEditTimeZone">
1898+ <property name="text">
1899+ <string>...</string>
1900+ </property>
1901+ </widget>
1902+ </item>
1903+ </layout>
1904+ </widget>
1905+ </item>
1906+ <item row="7" column="0" colspan="2">
1907+ <widget class="QPushButton" name="pushButtonSave">
1908+ <property name="text">
1909+ <string>Save settings</string>
1910+ </property>
1911+ </widget>
1912+ </item>
1913+ <item row="8" column="0" colspan="2">
1914+ <widget class="QLabel" name="labelRestart">
1915+ <property name="text">
1916+ <string>Any changes will take effect the next time Stellarium is started.</string>
1917+ </property>
1918+ <property name="alignment">
1919+ <set>Qt::AlignCenter</set>
1920+ </property>
1921+ <property name="wordWrap">
1922+ <bool>true</bool>
1923+ </property>
1924+ </widget>
1925+ </item>
1926+ <item row="9" column="0" colspan="2">
1927+ <spacer name="verticalSpacerTimeZone">
1928+ <property name="orientation">
1929+ <enum>Qt::Vertical</enum>
1930+ </property>
1931+ <property name="sizeHint" stdset="0">
1932+ <size>
1933+ <width>0</width>
1934+ <height>0</height>
1935+ </size>
1936+ </property>
1937+ </spacer>
1938+ </item>
1939+ </layout>
1940+ </widget>
1941+ </item>
1942+ </layout>
1943+ </widget>
1944+ <widget class="QWidget" name="tabDisplayFormats">
1945+ <attribute name="title">
1946+ <string>Display formats</string>
1947+ </attribute>
1948+ <layout class="QVBoxLayout" name="verticalLayoutTabTimeFormat">
1949+ <property name="spacing">
1950+ <number>0</number>
1951+ </property>
1952+ <property name="margin">
1953+ <number>0</number>
1954+ </property>
1955+ <item>
1956+ <widget class="QGroupBox" name="groupBoxDisplayFormats">
1957+ <property name="title">
1958+ <string>Display formats</string>
1959+ </property>
1960+ <property name="alignment">
1961+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
1962+ </property>
1963+ <layout class="QVBoxLayout" name="verticalLayout_4">
1964+ <property name="margin">
1965+ <number>0</number>
1966+ </property>
1967+ <item>
1968+ <widget class="QLabel" name="labelDisplayFormats">
1969+ <property name="text">
1970+ <string>These settings control the way time and date are displayed in the bottom bar.</string>
1971+ </property>
1972+ <property name="wordWrap">
1973+ <bool>true</bool>
1974+ </property>
1975+ </widget>
1976+ </item>
1977+ <item>
1978+ <widget class="QGroupBox" name="groupBoxTimeFormat">
1979+ <property name="title">
1980+ <string>Time display format</string>
1981+ </property>
1982+ <layout class="QVBoxLayout" name="verticalLayoutTimeFormat">
1983+ <property name="margin">
1984+ <number>0</number>
1985+ </property>
1986+ <item>
1987+ <widget class="QRadioButton" name="radioButtonTimeDefault">
1988+ <property name="text">
1989+ <string>System default</string>
1990+ </property>
1991+ </widget>
1992+ </item>
1993+ <item>
1994+ <widget class="QRadioButton" name="radioButtonTime12Hour">
1995+ <property name="text">
1996+ <string>12-hour format</string>
1997+ </property>
1998+ </widget>
1999+ </item>
2000+ <item>
2001+ <widget class="QRadioButton" name="radioButtonTime24Hour">
2002+ <property name="text">
2003+ <string>24-hour format</string>
2004+ </property>
2005+ </widget>
2006+ </item>
2007+ </layout>
2008+ </widget>
2009+ </item>
2010+ <item>
2011+ <widget class="QGroupBox" name="groupBoxDateFormat">
2012+ <property name="title">
2013+ <string>Date display format</string>
2014+ </property>
2015+ <layout class="QVBoxLayout" name="verticalLayoutDateFormat">
2016+ <property name="margin">
2017+ <number>0</number>
2018+ </property>
2019+ <item>
2020+ <widget class="QRadioButton" name="radioButtonDateDefault">
2021+ <property name="text">
2022+ <string>System default</string>
2023+ </property>
2024+ </widget>
2025+ </item>
2026+ <item>
2027+ <widget class="QRadioButton" name="radioButtonDateYMD">
2028+ <property name="text">
2029+ <string>yyyy-mm-dd (ISO 8601)</string>
2030+ </property>
2031+ </widget>
2032+ </item>
2033+ <item>
2034+ <widget class="QRadioButton" name="radioButtonDateDMY">
2035+ <property name="text">
2036+ <string>dd-mm-yyyy</string>
2037+ </property>
2038+ </widget>
2039+ </item>
2040+ <item>
2041+ <widget class="QRadioButton" name="radioButtonDateMDY">
2042+ <property name="text">
2043+ <string>mm-dd-yyyy</string>
2044+ </property>
2045+ </widget>
2046+ </item>
2047+ </layout>
2048+ </widget>
2049+ </item>
2050+ </layout>
2051+ </widget>
2052+ </item>
2053+ <item>
2054+ <spacer name="verticalSpacerDisplayFormats">
2055+ <property name="orientation">
2056+ <enum>Qt::Vertical</enum>
2057+ </property>
2058+ <property name="sizeHint" stdset="0">
2059+ <size>
2060+ <width>0</width>
2061+ <height>0</height>
2062+ </size>
2063+ </property>
2064+ </spacer>
2065+ </item>
2066+ </layout>
2067+ </widget>
2068+ <widget class="QWidget" name="tabAbout">
2069+ <attribute name="title">
2070+ <string>About</string>
2071+ </attribute>
2072+ <layout class="QVBoxLayout" name="verticalLayout_3">
2073+ <item>
2074+ <widget class="QLabel" name="labelTitle">
2075+ <property name="styleSheet">
2076+ <string notr="true">QLabel {
2077+ font: bold 18pt ;
2078+}</string>
2079+ </property>
2080+ <property name="text">
2081+ <string>Time Zone plug-in (version %1)</string>
2082+ </property>
2083+ </widget>
2084+ </item>
2085+ <item>
2086+ <widget class="QLabel" name="labelCopyright">
2087+ <property name="text">
2088+ <string notr="true">Copyright &amp;copy; 2010 Bogdan Marinov</string>
2089+ </property>
2090+ <property name="textFormat">
2091+ <enum>Qt::RichText</enum>
2092+ </property>
2093+ </widget>
2094+ </item>
2095+ <item>
2096+ <widget class="QLabel" name="labelLicense">
2097+ <property name="sizePolicy">
2098+ <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
2099+ <horstretch>0</horstretch>
2100+ <verstretch>0</verstretch>
2101+ </sizepolicy>
2102+ </property>
2103+ <property name="text">
2104+ <string notr="true">This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
2105+
2106+This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
2107+
2108+You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.</string>
2109+ </property>
2110+ <property name="alignment">
2111+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
2112+ </property>
2113+ <property name="wordWrap">
2114+ <bool>true</bool>
2115+ </property>
2116+ <property name="textInteractionFlags">
2117+ <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
2118+ </property>
2119+ </widget>
2120+ </item>
2121+ </layout>
2122+ </widget>
2123+ </widget>
2124+ </item>
2125+ </layout>
2126+ </widget>
2127+ <customwidgets>
2128+ <customwidget>
2129+ <class>BarFrame</class>
2130+ <extends>QFrame</extends>
2131+ <header>Dialog.hpp</header>
2132+ <container>1</container>
2133+ </customwidget>
2134+ </customwidgets>
2135+ <tabstops>
2136+ <tabstop>tabWidget</tabstop>
2137+ <tabstop>radioButtonLocalSettings</tabstop>
2138+ <tabstop>radioButtonUtc</tabstop>
2139+ <tabstop>radioButtonOffset</tabstop>
2140+ <tabstop>doubleSpinBoxOffset</tabstop>
2141+ <tabstop>radioButtonUserDefined</tabstop>
2142+ <tabstop>lineEditUserDefined</tabstop>
2143+ <tabstop>pushButtonEditTimeZone</tabstop>
2144+ <tabstop>pushButtonSave</tabstop>
2145+ <tabstop>radioButtonTimeDefault</tabstop>
2146+ <tabstop>radioButtonTime12Hour</tabstop>
2147+ <tabstop>radioButtonTime24Hour</tabstop>
2148+ <tabstop>radioButtonDateDefault</tabstop>
2149+ <tabstop>radioButtonDateYMD</tabstop>
2150+ <tabstop>radioButtonDateDMY</tabstop>
2151+ <tabstop>radioButtonDateMDY</tabstop>
2152+ </tabstops>
2153+ <resources/>
2154+ <connections>
2155+ <connection>
2156+ <sender>radioButtonUserDefined</sender>
2157+ <signal>toggled(bool)</signal>
2158+ <receiver>frameUserDefined</receiver>
2159+ <slot>setEnabled(bool)</slot>
2160+ <hints>
2161+ <hint type="sourcelabel">
2162+ <x>79</x>
2163+ <y>404</y>
2164+ </hint>
2165+ <hint type="destinationlabel">
2166+ <x>296</x>
2167+ <y>404</y>
2168+ </hint>
2169+ </hints>
2170+ </connection>
2171+ </connections>
2172+</ui>
2173
2174=== modified file 'src/CMakeLists.txt'
2175--- src/CMakeLists.txt 2010-10-17 16:39:43 +0000
2176+++ src/CMakeLists.txt 2010-11-10 15:42:47 +0000
2177@@ -559,6 +559,11 @@
2178 ADD_DEFINITIONS(-DUSE_STATIC_PLUGIN_TEXTUSERINTERFACE)
2179 ENDIF()
2180
2181+ IF (USE_PLUGIN_TIMEZONECONFIGURATION)
2182+ SET(STELLARIUM_STATIC_PLUGINS_LIBRARIES ${STELLARIUM_STATIC_PLUGINS_LIBRARIES} "${CMAKE_BINARY_DIR}/plugins/TimeZoneConfiguration/src/${CMAKE_CFG_INTDIR}/libTimeZoneConfiguration.a")
2183+ ADD_DEFINITIONS(-DUSE_STATIC_PLUGIN_TIMEZONECONFIGURATION)
2184+ ENDIF()
2185+
2186 IF (USE_PLUGIN_SVMT)
2187 SET(STELLARIUM_STATIC_PLUGINS_LIBRARIES ${STELLARIUM_STATIC_PLUGINS_LIBRARIES} ${CMAKE_BINARY_DIR}/plugins/svmt/src/${CMAKE_CFG_INTDIR}/libSVMT.a)
2188 IF(APPLE)
2189
2190=== modified file 'src/StelMainGraphicsView.cpp'
2191--- src/StelMainGraphicsView.cpp 2010-09-12 13:54:39 +0000
2192+++ src/StelMainGraphicsView.cpp 2010-11-10 15:42:47 +0000
2193@@ -93,6 +93,10 @@
2194 Q_IMPORT_PLUGIN(TelescopeControl)
2195 #endif
2196
2197+#ifdef USE_STATIC_PLUGIN_TIMEZONECONFIGURATION
2198+Q_IMPORT_PLUGIN(TimeZoneConfiguration)
2199+#endif
2200+
2201 // Initialize static variables
2202 StelMainGraphicsView* StelMainGraphicsView::singleton = NULL;
2203