void TimeFormatSettingsView::SetDefaults() { TrackerSettings settings; settings.SetTimeFormatSeparator(kSlashSeparator); settings.SetDateOrderFormat(kMDYFormat); settings.SetClockTo24Hr(false); ShowCurrentSettings(); _SendNotices(); }
void TimeFormatSettingsView::Revert() { TrackerSettings settings; settings.SetTimeFormatSeparator(fSeparator); settings.SetDateOrderFormat(fFormat); settings.SetClockTo24Hr(f24HrClock); ShowCurrentSettings(); _SendNotices(); }
void TimeFormatSettingsView::MessageReceived(BMessage *message) { TTracker *tracker = dynamic_cast<TTracker *>(be_app); if (!tracker) return; TrackerSettings settings; switch (message->what) { case kSettingsContentsModified: { int32 separator = 0; BMenuItem *item = fSeparatorMenuField->Menu()->FindMarked(); if (item) { separator = fSeparatorMenuField->Menu()->IndexOf(item); if (separator >= 0) settings.SetTimeFormatSeparator((FormatSeparator)separator); } DateOrder format = fYMDRadioButton->Value() ? kYMDFormat : fDMYRadioButton->Value() ? kDMYFormat : kMDYFormat; settings.SetDateOrderFormat(format); settings.SetClockTo24Hr(f24HrRadioButton->Value() == 1); // Make the notification message and send it to the tracker: BMessage notificationMessage; notificationMessage.AddInt32("TimeFormatSeparator", separator); notificationMessage.AddInt32("DateOrderFormat", format); notificationMessage.AddBool("24HrClock", f24HrRadioButton->Value() == 1); tracker->SendNotices(kDateFormatChanged, ¬ificationMessage); _UpdateExamples(); Window()->PostMessage(kSettingsContentsModified); break; } default: _inherited::MessageReceived(message); } }