[haiku-commits] r43061 - haiku/trunk/src/preferences/time

  • From: pulkomandy@xxxxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 1 Nov 2011 14:35:58 +0100 (CET)

Author: pulkomandy
Date: 2011-11-01 14:35:58 +0100 (Tue, 01 Nov 2011)
New Revision: 43061
Changeset: https://dev.haiku-os.org/changeset/43061

Modified:
   haiku/trunk/src/preferences/time/TimeMessages.h
   haiku/trunk/src/preferences/time/TimeWindow.cpp
   haiku/trunk/src/preferences/time/ZoneView.cpp
   haiku/trunk/src/preferences/time/ZoneView.h
Log:
 * Remove the now unneeded Message-logic for hiding and showing the preview
 * Put the clock mode radio buttons above the preview
Also makes hiding hte preview work again.


Modified: haiku/trunk/src/preferences/time/TimeMessages.h
===================================================================
--- haiku/trunk/src/preferences/time/TimeMessages.h     2011-11-01 12:45:01 UTC 
(rev 43060)
+++ haiku/trunk/src/preferences/time/TimeMessages.h     2011-11-01 13:35:58 UTC 
(rev 43061)
@@ -31,10 +31,6 @@
 // notice for user changes
 const uint32 H_USER_CHANGE = 'obUC';
 
-// notices to hide or show the time zone preview
-const uint32 H_HIDE_PREVIEW = 'hipr';
-const uint32 H_SHOW_PREVIEW = 'shpr';
-
 // local/ gmt radiobuttons
 const uint32 kRTCUpdate = '_rtc';
 

Modified: haiku/trunk/src/preferences/time/TimeWindow.cpp
===================================================================
--- haiku/trunk/src/preferences/time/TimeWindow.cpp     2011-11-01 12:45:01 UTC 
(rev 43060)
+++ haiku/trunk/src/preferences/time/TimeWindow.cpp     2011-11-01 13:35:58 UTC 
(rev 43061)
@@ -89,19 +89,8 @@
                        break;
 
                case kMsgChange:
-               {
                        _SetRevertStatus();
-                       bool useGMTTime = true;
-                       message->FindBool("UseGMT", &useGMTTime);
-                       if (useGMTTime) {
-                               BMessage show(H_SHOW_PREVIEW);
-                               fTimeZoneView->MessageReceived(&show);
-                       } else {
-                               BMessage hide(H_HIDE_PREVIEW);
-                               fTimeZoneView->MessageReceived(&hide);
-                       }
                        break;
-               }
 
                case kMsgClockSettingChanged:
                        break;

Modified: haiku/trunk/src/preferences/time/ZoneView.cpp
===================================================================
--- haiku/trunk/src/preferences/time/ZoneView.cpp       2011-11-01 12:45:01 UTC 
(rev 43060)
+++ haiku/trunk/src/preferences/time/ZoneView.cpp       2011-11-01 13:35:58 UTC 
(rev 43061)
@@ -171,16 +171,6 @@
                        break;
                }
 
-               case H_HIDE_PREVIEW:
-                       fCurrent->Hide();
-                       fPreview->Hide();
-                       break;
-
-               case H_SHOW_PREVIEW:
-                       fCurrent->Show();
-                       fPreview->Show();
-                       break;
-
                case kMsgRevert:
                        _Revert();
                        break;
@@ -281,6 +271,7 @@
                fGmtTime->SetValue(B_CONTROL_ON);
        else
                fLocalTime->SetValue(B_CONTROL_ON);
+       _ShowOrHidePreview();
        fOldUseGmtTime = fUseGmtTime;
 
 
@@ -288,14 +279,14 @@
        BLayoutBuilder::Group<>(this)
                .Add(scrollList)
                .AddGroup(B_VERTICAL, kInset)
-                       .Add(fCurrent)
-                       .Add(fPreview)
-                       .AddGlue()
                        .Add(text)
                        .AddGroup(B_VERTICAL, kInset)
                                .Add(fLocalTime)
                                .Add(fGmtTime)
                        .End()
+                       .AddGlue()
+                       .Add(fCurrent)
+                       .Add(fPreview)
                        .Add(fSetZone)
                .End()
                .SetInsets(kInset, kInset, kInset, kInset);
@@ -499,6 +490,7 @@
                fGmtTime->SetValue(B_CONTROL_ON);
        else
                fLocalTime->SetValue(B_CONTROL_ON);
+       _ShowOrHidePreview();
 
        _UpdateGmtSettings();
        _SetSystemTimeZone();
@@ -641,6 +633,7 @@
 {
        _WriteRTCSettings();
 
+       _ShowOrHidePreview();
        _NotifyClockSettingChanged();
 
        _kern_set_real_time_clock_is_gmt(fUseGmtTime);
@@ -648,10 +641,26 @@
 
 
 void
+TimeZoneView::_ShowOrHidePreview()
+{
+       if (fUseGmtTime) {
+               // Hardware clock uses GMT time, changing timezone will adjust 
the
+               // offset and we need to display a preview
+               fCurrent->Show();
+               fPreview->Show();
+       } else {
+               // Hardware clock uses local time, changing timezone will 
adjust the
+               // clock and there is no offset to manage, thus, no preview.
+               fCurrent->Hide();
+               fPreview->Hide();
+       }
+}
+
+
+void
 TimeZoneView::_NotifyClockSettingChanged()
 {
-       BMessage msg(kMsgChange);
-       msg.AddBool("UseGMT", fUseGmtTime);
+       BMessage msg(kMsgClockSettingChanged);
        Window()->PostMessage(&msg);
 }
 

Modified: haiku/trunk/src/preferences/time/ZoneView.h
===================================================================
--- haiku/trunk/src/preferences/time/ZoneView.h 2011-11-01 12:45:01 UTC (rev 
43060)
+++ haiku/trunk/src/preferences/time/ZoneView.h 2011-11-01 13:35:58 UTC (rev 
43061)
@@ -52,6 +52,7 @@
                        void                            _ReadRTCSettings();
                        void                            _WriteRTCSettings();
                        void                            _UpdateGmtSettings();
+                       void                            _ShowOrHidePreview();
 
                        void                            _InitView();
                        void                            _BuildZoneMenu();


Other related posts: