* more work towards working central settings, only Deskbar for the moment
settings are not saved atm... git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22619 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -19,20 +19,25 @@
|
|||||||
|
|
||||||
|
|
||||||
const uint32 kMsgMilTime = 'MilT';
|
const uint32 kMsgMilTime = 'MilT';
|
||||||
const uint32 kMsgEuroDate = 'EDat';
|
|
||||||
const uint32 kMsgShowSeconds = 'ShSc';
|
const uint32 kMsgShowSeconds = 'ShSc';
|
||||||
|
|
||||||
const uint32 kYearMonthDay = '_ymd';
|
|
||||||
const uint32 kDayMonthYear = '_dmy';
|
const uint32 kMsgIsoDate = 'IDat';
|
||||||
|
const uint32 kMsgEuroDate = 'EDat';
|
||||||
const uint32 kMonthDayYear = '_mdy';
|
const uint32 kMonthDayYear = '_mdy';
|
||||||
const uint32 kSeparatorChanged = '_tsc';
|
const uint32 kSeparatorChanged = '_tsc';
|
||||||
const uint32 kTrackerDateFormatChanged = 'TDFC';
|
const uint32 kTrackerDateFormatChanged = 'TDFC';
|
||||||
|
|
||||||
|
|
||||||
|
const char* kDeskbarSignature = "application/x-vnd.Be-TSKB";
|
||||||
|
const char* kTrackerSignature = "application/x-vnd.Be-TRAK";
|
||||||
|
|
||||||
|
|
||||||
SettingsView::SettingsView(BRect frame)
|
SettingsView::SettingsView(BRect frame)
|
||||||
: BView(frame,"Settings", B_FOLLOW_ALL,
|
: BView(frame, "Settings", B_FOLLOW_ALL,
|
||||||
B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP),
|
B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP),
|
||||||
fInitialized(false)
|
fInitialized(false),
|
||||||
|
fRecentDateWhat(kMonthDayYear)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,7 +63,22 @@ SettingsView::AttachedToWindow()
|
|||||||
void
|
void
|
||||||
SettingsView::MessageReceived(BMessage *message)
|
SettingsView::MessageReceived(BMessage *message)
|
||||||
{
|
{
|
||||||
BView::MessageReceived(message);
|
switch (message->what) {
|
||||||
|
case kMsgMilTime:
|
||||||
|
case kMsgIsoDate:
|
||||||
|
_UpdateTimeSettings(message->what);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case kMsgEuroDate:
|
||||||
|
case kMonthDayYear:
|
||||||
|
case kMsgShowSeconds:
|
||||||
|
_UpdateDateSettings(message->what);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
BView::MessageReceived(message);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -80,12 +100,14 @@ SettingsView::_InitView()
|
|||||||
fShow24Hours = new BCheckBox(frameLeft, "show24Hours", "24 Hour Clock"
|
fShow24Hours = new BCheckBox(frameLeft, "show24Hours", "24 Hour Clock"
|
||||||
, new BMessage(kMsgMilTime));
|
, new BMessage(kMsgMilTime));
|
||||||
AddChild(fShow24Hours);
|
AddChild(fShow24Hours);
|
||||||
|
fShow24Hours->SetTarget(this);
|
||||||
fShow24Hours->ResizeToPreferred();
|
fShow24Hours->ResizeToPreferred();
|
||||||
|
|
||||||
frameLeft.OffsetBy(0.0, fShow24Hours->Bounds().Height() + 5.0);
|
frameLeft.OffsetBy(0.0, fShow24Hours->Bounds().Height() + 5.0);
|
||||||
fShowSeconds = new BCheckBox(frameLeft, "showSeconds", "Show Seconds"
|
fShowSeconds = new BCheckBox(frameLeft, "showSeconds", "Show Seconds"
|
||||||
, new BMessage(kMsgShowSeconds));
|
, new BMessage(kMsgShowSeconds));
|
||||||
AddChild(fShowSeconds);
|
AddChild(fShowSeconds);
|
||||||
|
fShowSeconds->SetTarget(this);
|
||||||
fShowSeconds->ResizeToPreferred();
|
fShowSeconds->ResizeToPreferred();
|
||||||
|
|
||||||
frameLeft.OffsetBy(0.0, 2 * fShowSeconds->Bounds().Height() + 5.0);
|
frameLeft.OffsetBy(0.0, 2 * fShowSeconds->Bounds().Height() + 5.0);
|
||||||
@@ -105,33 +127,44 @@ SettingsView::_InitView()
|
|||||||
frameRight.left = frameRight.Width() / 2;
|
frameRight.left = frameRight.Width() / 2;
|
||||||
frameRight.InsetBy(10.0f, 10.0f);
|
frameRight.InsetBy(10.0f, 10.0f);
|
||||||
|
|
||||||
|
BView *dateView = new BView(frameRight, "dateView", B_FOLLOW_ALL,
|
||||||
|
B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP);
|
||||||
|
AddChild(dateView);
|
||||||
|
if (Parent())
|
||||||
|
dateView->SetViewColor(Parent()->ViewColor());
|
||||||
|
|
||||||
|
frameRight.OffsetTo(B_ORIGIN);
|
||||||
BStringView *dateSettings = new BStringView(frameRight, "date", "Date:");
|
BStringView *dateSettings = new BStringView(frameRight, "date", "Date:");
|
||||||
AddChild(dateSettings);
|
dateView->AddChild(dateSettings);
|
||||||
dateSettings->ResizeToPreferred();
|
dateSettings->ResizeToPreferred();
|
||||||
|
|
||||||
frameRight.OffsetBy(10.0, dateSettings->Bounds().Height() + 5.0);
|
frameRight.OffsetBy(10.0, dateSettings->Bounds().Height() + 5.0);
|
||||||
fYearMonthDay = new BCheckBox(frameRight, "yearMonthDay", "Year-Month-Day"
|
fYearMonthDay = new BRadioButton(frameRight, "yearMonthDay", "Year-Month-Day"
|
||||||
, new BMessage(kYearMonthDay));
|
, new BMessage(kMsgIsoDate));
|
||||||
AddChild(fYearMonthDay);
|
dateView->AddChild(fYearMonthDay);
|
||||||
|
fYearMonthDay->SetTarget(this);
|
||||||
fYearMonthDay->ResizeToPreferred();
|
fYearMonthDay->ResizeToPreferred();
|
||||||
|
|
||||||
frameRight.OffsetBy(0.0, fYearMonthDay->Bounds().Height() + 5.0);
|
frameRight.OffsetBy(0.0, fYearMonthDay->Bounds().Height() + 5.0);
|
||||||
fDayMonthYear = new BCheckBox(frameRight, "dayMonthYear", "Day-Month-Year"
|
fDayMonthYear = new BRadioButton(frameRight, "dayMonthYear", "Day-Month-Year"
|
||||||
, new BMessage(kDayMonthYear));
|
, new BMessage(kMsgEuroDate));
|
||||||
AddChild(fDayMonthYear);
|
dateView->AddChild(fDayMonthYear);
|
||||||
|
fDayMonthYear->SetTarget(this);
|
||||||
fDayMonthYear->ResizeToPreferred();
|
fDayMonthYear->ResizeToPreferred();
|
||||||
|
|
||||||
frameRight.OffsetBy(0.0, fDayMonthYear->Bounds().Height() + 5.0);
|
frameRight.OffsetBy(0.0, fDayMonthYear->Bounds().Height() + 5.0);
|
||||||
fMonthDayYear = new BCheckBox(frameRight, "monthDayYear", "Month-Day-Year"
|
fMonthDayYear = new BRadioButton(frameRight, "monthDayYear", "Month-Day-Year"
|
||||||
, new BMessage(kMonthDayYear));
|
, new BMessage(kMonthDayYear));
|
||||||
AddChild(fMonthDayYear);
|
dateView->AddChild(fMonthDayYear);
|
||||||
|
fMonthDayYear->SetTarget(this);
|
||||||
fMonthDayYear->ResizeToPreferred();
|
fMonthDayYear->ResizeToPreferred();
|
||||||
fMonthDayYear->SetValue(B_CONTROL_ON);
|
fMonthDayYear->SetValue(B_CONTROL_ON);
|
||||||
|
|
||||||
frameRight.OffsetBy(0.0, fMonthDayYear->Bounds().Height() + 5.0);
|
frameRight.OffsetBy(0.0, fMonthDayYear->Bounds().Height() + 5.0);
|
||||||
fStartWeekMonday = new BCheckBox(frameRight, "startWeekMonday"
|
fStartWeekMonday = new BCheckBox(frameRight, "startWeekMonday"
|
||||||
, "Start week with Monday", new BMessage(kWeekStart));
|
, "Start week with Monday", new BMessage(kWeekStart));
|
||||||
AddChild(fStartWeekMonday);
|
dateView->AddChild(fStartWeekMonday);
|
||||||
|
fStartWeekMonday->SetTarget(this);
|
||||||
fStartWeekMonday->ResizeToPreferred();
|
fStartWeekMonday->ResizeToPreferred();
|
||||||
|
|
||||||
fDateSeparator = new BPopUpMenu("Separator");
|
fDateSeparator = new BPopUpMenu("Separator");
|
||||||
@@ -147,6 +180,28 @@ SettingsView::_InitView()
|
|||||||
frameRight.OffsetBy(0.0, fStartWeekMonday->Bounds().Height() + 5.0);
|
frameRight.OffsetBy(0.0, fStartWeekMonday->Bounds().Height() + 5.0);
|
||||||
BMenuField *menuField = new BMenuField(frameRight, "regions", "Date separator:"
|
BMenuField *menuField = new BMenuField(frameRight, "regions", "Date separator:"
|
||||||
, fDateSeparator, false);
|
, fDateSeparator, false);
|
||||||
AddChild(menuField);
|
dateView->AddChild(menuField);
|
||||||
menuField->ResizeToPreferred();
|
menuField->ResizeToPreferred();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
SettingsView::_UpdateDateSettings(const uint32 _what)
|
||||||
|
{
|
||||||
|
uint32 what = _what;
|
||||||
|
if (_what == kMonthDayYear)
|
||||||
|
what = fRecentDateWhat;
|
||||||
|
|
||||||
|
fRecentDateWhat = _what;
|
||||||
|
|
||||||
|
BMessenger messenger(kDeskbarSignature);
|
||||||
|
messenger.SendMessage(what);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
SettingsView::_UpdateTimeSettings(const uint32 what) const
|
||||||
|
{
|
||||||
|
BMessenger messenger(kDeskbarSignature);
|
||||||
|
messenger.SendMessage(what);
|
||||||
|
}
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ class SettingsView : public BView {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void _InitView();
|
void _InitView();
|
||||||
|
void _UpdateDateSettings(const uint32 what);
|
||||||
|
void _UpdateTimeSettings(const uint32 what) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BCheckBox *fShow24Hours;
|
BCheckBox *fShow24Hours;
|
||||||
@@ -35,14 +37,15 @@ class SettingsView : public BView {
|
|||||||
BRadioButton *fGmtTime;
|
BRadioButton *fGmtTime;
|
||||||
BRadioButton *fLocalTime;
|
BRadioButton *fLocalTime;
|
||||||
|
|
||||||
BCheckBox *fYearMonthDay;
|
BRadioButton *fYearMonthDay;
|
||||||
BCheckBox *fDayMonthYear;
|
BRadioButton *fDayMonthYear;
|
||||||
BCheckBox *fMonthDayYear;
|
BRadioButton *fMonthDayYear;
|
||||||
BCheckBox *fStartWeekMonday;
|
BCheckBox *fStartWeekMonday;
|
||||||
|
|
||||||
BPopUpMenu *fDateSeparator;
|
BPopUpMenu *fDateSeparator;
|
||||||
|
|
||||||
bool fInitialized;
|
bool fInitialized;
|
||||||
|
uint32 fRecentDateWhat;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SETTINGS_VIEW_H
|
#endif // SETTINGS_VIEW_H
|
||||||
|
|||||||
Reference in New Issue
Block a user