Remove Time Interval radio buttons from Deskbar Prefs.
* 12/24 hour clock is set from the Locale prefs only. * Redirect B_LOCALE_CHANGED message to the replicant tray instead of the time view and tell the replicant tray to update the time instead of updating the time view directly. This is because there was a bug where if the AM/PM marker grew the time view over the replicant tray icons when switching from 24 hour to 12 hour clock it wouldn't reflow the replicant tray icons like it should. * Rename the replicant tray view from "Status" to "_replicant_tray_" because BarApp uses FindView() to get the view by name and I'm assuming that this method can have conflicts. Following the example of the "_deskbar_tv_" naming convention.
This commit is contained in:
parent
889692191d
commit
30a5580244
@ -640,10 +640,11 @@ TBarApp::MessageReceived(BMessage* message)
|
||||
if (message->FindBool("filesys", &localize) == B_OK)
|
||||
gLocalizedNamePreferred = localize;
|
||||
|
||||
BMessenger(fBarWindow->FindView("_deskbar_tv_")).SendMessage(
|
||||
BMessenger(fBarWindow->FindView("_replicant_tray_")).SendMessage(
|
||||
message);
|
||||
// Notify the TimeView that the format has changed and it should
|
||||
// recompute its size
|
||||
// Notify the replicant tray that the time interval has
|
||||
// changed and it should update the time view and reflow
|
||||
// the tray icons.
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -399,7 +399,6 @@ TDeskbarMenu::ResetTargets()
|
||||
break;
|
||||
|
||||
case kShowHideTime:
|
||||
case kTimeIntervalChanged:
|
||||
case kShowSeconds:
|
||||
case kShowDayOfWeek:
|
||||
case kShowTimeZone:
|
||||
|
@ -86,16 +86,6 @@ PreferencesWindow::PreferencesWindow(BRect frame)
|
||||
new BMessage(kAutoHide));
|
||||
|
||||
// Clock controls
|
||||
BMessage* timeInterval12HoursMessage = new BMessage(kTimeIntervalChanged);
|
||||
timeInterval12HoursMessage->AddBool("use24HourClock", false);
|
||||
fTimeInterval12HourRadioButton = new BRadioButton("time inteval",
|
||||
B_TRANSLATE("12 hour"), timeInterval12HoursMessage);
|
||||
|
||||
BMessage* timeInterval24HoursMessage = new BMessage(kTimeIntervalChanged);
|
||||
timeInterval24HoursMessage->AddBool("use24HourClock", true);
|
||||
fTimeInterval24HourRadioButton = new BRadioButton("time inteval",
|
||||
B_TRANSLATE("24 hour"), timeInterval24HoursMessage);
|
||||
|
||||
fShowSeconds = new BCheckBox(B_TRANSLATE("Show seconds"),
|
||||
new BMessage(kShowSeconds));
|
||||
fShowDayOfWeek = new BCheckBox(B_TRANSLATE("Show day of week"),
|
||||
@ -163,13 +153,6 @@ PreferencesWindow::PreferencesWindow(BRect frame)
|
||||
fWindowAutoHide->SetValue(settings->autoHide);
|
||||
|
||||
// Clock settings
|
||||
BFormattingConventions conventions;
|
||||
BLocale::Default()->GetFormattingConventions(&conventions);
|
||||
if (conventions.Use24HourClock())
|
||||
fTimeInterval24HourRadioButton->SetValue(B_CONTROL_ON);
|
||||
else
|
||||
fTimeInterval12HourRadioButton->SetValue(B_CONTROL_ON);
|
||||
|
||||
TReplicantTray* replicantTray = barApp->BarView()->ReplicantTray();
|
||||
if (replicantTray->Time() != NULL) {
|
||||
fShowSeconds->SetValue(replicantTray->Time()->ShowSeconds());
|
||||
@ -194,9 +177,6 @@ PreferencesWindow::PreferencesWindow(BRect frame)
|
||||
fWindowAutoRaise->SetTarget(be_app);
|
||||
fWindowAutoHide->SetTarget(be_app);
|
||||
|
||||
fTimeInterval12HourRadioButton->SetTarget(replicantTray);
|
||||
fTimeInterval24HourRadioButton->SetTarget(replicantTray);
|
||||
|
||||
fShowSeconds->SetTarget(replicantTray);
|
||||
fShowDayOfWeek->SetTarget(replicantTray);
|
||||
fShowTimeZone->SetTarget(replicantTray);
|
||||
@ -271,21 +251,8 @@ PreferencesWindow::PreferencesWindow(BRect frame)
|
||||
.View();
|
||||
fWindowBox->AddChild(view);
|
||||
|
||||
BGroupLayout* timeIntervalLayout = new BGroupLayout(B_VERTICAL, 0);
|
||||
timeIntervalLayout->SetInsets(B_USE_DEFAULT_SPACING, 0, 0, 0);
|
||||
BView* timeIntervalView = new BView("interval", 0, timeIntervalLayout);
|
||||
timeIntervalView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
timeIntervalView->SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
timeIntervalView->AddChild(fTimeInterval12HourRadioButton);
|
||||
timeIntervalView->AddChild(fTimeInterval24HourRadioButton);
|
||||
|
||||
view = BLayoutBuilder::Group<>()
|
||||
.AddGroup(B_VERTICAL, 0)
|
||||
.AddGroup(B_VERTICAL, 0)
|
||||
.SetInsets(0, 0, 0, B_USE_DEFAULT_SPACING)
|
||||
.Add(new BStringView("interval", B_TRANSLATE("Interval")))
|
||||
.Add(timeIntervalView)
|
||||
.End()
|
||||
.AddGroup(B_VERTICAL, 0)
|
||||
.SetInsets(0, 0, 0, B_USE_DEFAULT_SPACING)
|
||||
.Add(fShowSeconds)
|
||||
|
@ -24,7 +24,6 @@ const uint32 kAutoRaise = 'AtRs';
|
||||
const uint32 kAutoHide = 'AtHd';
|
||||
|
||||
const uint32 kShowHideTime = 'ShTm';
|
||||
const uint32 kTimeIntervalChanged = 'TiCh';
|
||||
const uint32 kShowSeconds = 'SwSc';
|
||||
const uint32 kShowDayOfWeek = 'SwDw';
|
||||
const uint32 kShowTimeZone = 'SwTz';
|
||||
@ -75,9 +74,6 @@ private:
|
||||
BCheckBox* fWindowAutoRaise;
|
||||
BCheckBox* fWindowAutoHide;
|
||||
|
||||
BRadioButton* fTimeInterval24HourRadioButton;
|
||||
BRadioButton* fTimeInterval12HourRadioButton;
|
||||
|
||||
BCheckBox* fShowSeconds;
|
||||
BCheckBox* fShowDayOfWeek;
|
||||
BCheckBox* fShowTimeZone;
|
||||
|
@ -54,7 +54,6 @@ All rights reserved.
|
||||
#include <FindDirectory.h>
|
||||
#include <Locale.h>
|
||||
#include <MenuItem.h>
|
||||
#include <MutableLocaleRoster.h>
|
||||
#include <NodeInfo.h>
|
||||
#include <NodeMonitor.h>
|
||||
#include <Path.h>
|
||||
@ -125,8 +124,8 @@ DumpList(BList* itemlist)
|
||||
// don't change the name of this view to anything other than "Status"!
|
||||
|
||||
TReplicantTray::TReplicantTray(TBarView* parent, bool vertical)
|
||||
: BView(BRect(0, 0, 1, 1), "Status", B_FOLLOW_LEFT | B_FOLLOW_TOP,
|
||||
B_WILL_DRAW | B_FRAME_EVENTS),
|
||||
: BView(BRect(0, 0, 1, 1), "_replicant_tray_",
|
||||
B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_FRAME_EVENTS),
|
||||
fTime(NULL),
|
||||
fBarView(parent),
|
||||
fShelf(new TReplicantShelf(this)),
|
||||
@ -276,33 +275,27 @@ void
|
||||
TReplicantTray::MessageReceived(BMessage* message)
|
||||
{
|
||||
switch (message->what) {
|
||||
case kShowHideTime:
|
||||
// from context menu in clock and in this view
|
||||
ShowHideTime();
|
||||
break;
|
||||
|
||||
case kTimeIntervalChanged:
|
||||
case B_LOCALE_CHANGED:
|
||||
{
|
||||
if (fTime == NULL)
|
||||
return;
|
||||
|
||||
bool use24HourClock;
|
||||
if (message->FindBool("use24HourClock", &use24HourClock)
|
||||
== B_OK) {
|
||||
BFormattingConventions conventions;
|
||||
BLocale::Default()->GetFormattingConventions(&conventions);
|
||||
conventions.SetExplicitUse24HourClock(use24HourClock);
|
||||
BPrivate::MutableLocaleRoster::Default()->
|
||||
SetDefaultFormattingConventions(conventions);
|
||||
fTime->SetUse24HourClock(use24HourClock);
|
||||
// time string reformat -> realign
|
||||
RealignReplicants();
|
||||
AdjustPlacement();
|
||||
}
|
||||
// Locale may have updated 12/24 hour clock
|
||||
BFormattingConventions conventions;
|
||||
BLocale::Default()->GetFormattingConventions(&conventions);
|
||||
fTime->SetUse24HourClock(conventions.Use24HourClock());
|
||||
|
||||
// time string reformat -> realign
|
||||
RealignReplicants();
|
||||
AdjustPlacement();
|
||||
break;
|
||||
}
|
||||
|
||||
case kShowHideTime:
|
||||
// from context menu in clock and in this view
|
||||
ShowHideTime();
|
||||
break;
|
||||
|
||||
case kShowSeconds:
|
||||
if (fTime == NULL)
|
||||
return;
|
||||
|
@ -66,6 +66,7 @@ enum {
|
||||
#undef B_TRANSLATION_CONTEXT
|
||||
#define B_TRANSLATION_CONTEXT "TimeView"
|
||||
|
||||
|
||||
TTimeView::TTimeView(float maxWidth, float height, bool use24HourClock,
|
||||
bool showSeconds, bool showDayOfWeek, bool showTimeZone)
|
||||
:
|
||||
@ -194,10 +195,6 @@ void
|
||||
TTimeView::MessageReceived(BMessage* message)
|
||||
{
|
||||
switch (message->what) {
|
||||
case B_LOCALE_CHANGED:
|
||||
Update();
|
||||
break;
|
||||
|
||||
case kChangeTime:
|
||||
// launch the time prefs app
|
||||
be_roster->Launch("application/x-vnd.Haiku-Time");
|
||||
@ -487,16 +484,16 @@ void
|
||||
TTimeView::Update()
|
||||
{
|
||||
fLocale = *BLocale::Default();
|
||||
UpdateTimeFormat();
|
||||
|
||||
GetCurrentTime();
|
||||
GetCurrentDate();
|
||||
SetToolTip(fCurrentDateStr);
|
||||
|
||||
UpdateTimeFormat();
|
||||
|
||||
CalculateTextPlacement();
|
||||
ResizeToPreferred();
|
||||
|
||||
if (fParent)
|
||||
if (fParent != NULL)
|
||||
fParent->Invalidate();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user