* 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.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43061 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adrien Destugues 2011-11-01 13:35:58 +00:00
parent 0d3e347507
commit f3b7dcd4d2
4 changed files with 25 additions and 30 deletions

View File

@ -31,10 +31,6 @@ const uint32 H_TM_CHANGED = 'obTC';
// 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';

View File

@ -89,19 +89,8 @@ TTimeWindow::MessageReceived(BMessage* message)
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;

View File

@ -171,16 +171,6 @@ TimeZoneView::MessageReceived(BMessage* message)
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 @@ TimeZoneView::_InitView()
fGmtTime->SetValue(B_CONTROL_ON);
else
fLocalTime->SetValue(B_CONTROL_ON);
_ShowOrHidePreview();
fOldUseGmtTime = fUseGmtTime;
@ -288,14 +279,14 @@ TimeZoneView::_InitView()
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 @@ TimeZoneView::_Revert()
fGmtTime->SetValue(B_CONTROL_ON);
else
fLocalTime->SetValue(B_CONTROL_ON);
_ShowOrHidePreview();
_UpdateGmtSettings();
_SetSystemTimeZone();
@ -641,17 +633,34 @@ TimeZoneView::_UpdateGmtSettings()
{
_WriteRTCSettings();
_ShowOrHidePreview();
_NotifyClockSettingChanged();
_kern_set_real_time_clock_is_gmt(fUseGmtTime);
}
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);
}

View File

@ -52,6 +52,7 @@ private:
void _ReadRTCSettings();
void _WriteRTCSettings();
void _UpdateGmtSettings();
void _ShowOrHidePreview();
void _InitView();
void _BuildZoneMenu();