diff --git a/src/apps/deskbar/BarApp.cpp b/src/apps/deskbar/BarApp.cpp index d1e1a2e7ab..257a126f3b 100644 --- a/src/apps/deskbar/BarApp.cpp +++ b/src/apps/deskbar/BarApp.cpp @@ -192,7 +192,6 @@ TBarApp::SaveSettings() fSettingsFile->Write(&fSettings.recentAppsCount, sizeof(int32)); fSettingsFile->Write(&fSettings.recentDocsCount, sizeof(int32)); fSettingsFile->Write(&fSettings.timeShowSeconds, sizeof(bool)); - fSettingsFile->Write(&fSettings.timeShowMil, sizeof(bool)); fSettingsFile->Write(&fSettings.recentFoldersCount, sizeof(int32)); fSettingsFile->Write(&fSettings.timeShowEuro, sizeof(bool)); fSettingsFile->Write(&fSettings.alwaysOnTop, sizeof(bool)); @@ -224,7 +223,6 @@ TBarApp::InitSettings() settings.recentAppsCount = 10; settings.recentDocsCount = 10; settings.timeShowSeconds = false; - settings.timeShowMil = false; settings.recentFoldersCount = 10; settings.timeShowEuro = false; settings.alwaysOnTop = false; @@ -276,7 +274,6 @@ TBarApp::InitSettings() } if (size >= kValidSettingsSize4) { fSettingsFile->Read(&settings.timeShowSeconds, sizeof(bool)); - fSettingsFile->Read(&settings.timeShowMil, sizeof(bool)); } if (size >= kValidSettingsSize5) fSettingsFile->Read(&settings.recentFoldersCount, diff --git a/src/apps/deskbar/BarApp.h b/src/apps/deskbar/BarApp.h index 3041b7a8f1..7968f0bd87 100644 --- a/src/apps/deskbar/BarApp.h +++ b/src/apps/deskbar/BarApp.h @@ -104,7 +104,6 @@ struct desk_settings { int32 recentAppsCount; // version 3 int32 recentDocsCount; bool timeShowSeconds; // version 4 - bool timeShowMil; int32 recentFoldersCount; // version 5 bool timeShowEuro; // version 6 bool alwaysOnTop; @@ -126,7 +125,7 @@ const uint32 kValidSettingsSize1 = 5 * sizeof(bool) + sizeof(uint32) + sizeof(float); const uint32 kValidSettingsSize2 = sizeof(BPoint) + kValidSettingsSize1; const uint32 kValidSettingsSize3 = 2 * sizeof(int32) + kValidSettingsSize2; -const uint32 kValidSettingsSize4 = 2 * sizeof(bool) + kValidSettingsSize3; +const uint32 kValidSettingsSize4 = sizeof(bool) + kValidSettingsSize3; const uint32 kValidSettingsSize5 = sizeof(int32) + kValidSettingsSize4; const uint32 kValidSettingsSize6 = 2 * sizeof(bool) + kValidSettingsSize5; const uint32 kValidSettingsSize7 = sizeof(bool) + kValidSettingsSize6; diff --git a/src/apps/deskbar/BeMenu.cpp b/src/apps/deskbar/BeMenu.cpp index 5532e1f314..fe4e81db41 100644 --- a/src/apps/deskbar/BeMenu.cpp +++ b/src/apps/deskbar/BeMenu.cpp @@ -371,7 +371,6 @@ TBeMenu::ResetTargets() case kConfigShow: case kAlwaysTop: case kShowSeconds: - case kMilTime: case kEuroDate: case kRebootSystem: case kSuspendSystem: diff --git a/src/apps/deskbar/PreferencesWindow.cpp b/src/apps/deskbar/PreferencesWindow.cpp index c515308056..af0167ec29 100644 --- a/src/apps/deskbar/PreferencesWindow.cpp +++ b/src/apps/deskbar/PreferencesWindow.cpp @@ -58,8 +58,6 @@ PreferencesWindow::PreferencesWindow(BRect frame) fAppsExpandNew = new BCheckBox(B_TRANSLATE("Expand new applications"), new BMessage(kExpandNewTeams)); - fClock24Hours = new BCheckBox(B_TRANSLATE("24 hour clock"), - new BMessage(kMilTime)); fClockSeconds = new BCheckBox(B_TRANSLATE("Show seconds"), new BMessage(kShowSeconds)); fClockEuropeanDate = new BCheckBox(B_TRANSLATE("European date"), @@ -124,13 +122,11 @@ PreferencesWindow::PreferencesWindow(BRect frame) TReplicantTray* replicantTray = barApp->BarView()->fReplicantTray; - fClock24Hours->SetValue(replicantTray->ShowingMiltime()); fClockSeconds->SetValue(replicantTray->ShowingSeconds()); fClockEuropeanDate->SetValue(replicantTray->ShowingEuroDate()); fClockFullDate->SetValue(replicantTray->ShowingFullDate()); bool showingClock = barApp->BarView()->ShowingClock(); - fClock24Hours->SetEnabled(showingClock); fClockSeconds->SetEnabled(showingClock); fClockEuropeanDate->SetEnabled(showingClock); fClockFullDate->SetEnabled(replicantTray->CanShowFullDate()); @@ -145,7 +141,6 @@ PreferencesWindow::PreferencesWindow(BRect frame) fAppsSortTrackerFirst->SetTarget(be_app); fAppsExpandNew->SetTarget(be_app); - fClock24Hours->SetTarget(replicantTray); fClockSeconds->SetTarget(replicantTray); fClockEuropeanDate->SetTarget(replicantTray); fClockFullDate->SetTarget(replicantTray); @@ -203,7 +198,6 @@ PreferencesWindow::PreferencesWindow(BRect frame) view = BLayoutBuilder::Group<>() .AddGroup(B_VERTICAL, 1) - .Add(fClock24Hours) .Add(fClockSeconds) .Add(fClockEuropeanDate) .Add(fClockFullDate) diff --git a/src/apps/deskbar/PreferencesWindow.h b/src/apps/deskbar/PreferencesWindow.h index 0d3928c7fe..aee5775b89 100644 --- a/src/apps/deskbar/PreferencesWindow.h +++ b/src/apps/deskbar/PreferencesWindow.h @@ -52,7 +52,6 @@ private: BCheckBox* fAppsShowExpanders; BCheckBox* fAppsExpandNew; - BCheckBox* fClock24Hours; BCheckBox* fClockSeconds; BCheckBox* fClockEuropeanDate; BCheckBox* fClockFullDate; diff --git a/src/apps/deskbar/StatusView.cpp b/src/apps/deskbar/StatusView.cpp index d97cd7d384..bedf826512 100644 --- a/src/apps/deskbar/StatusView.cpp +++ b/src/apps/deskbar/StatusView.cpp @@ -199,7 +199,6 @@ TReplicantTray::RememberClockSettings() desk_settings* settings = ((TBarApp*)be_app)->Settings(); settings->timeShowSeconds = fClock->ShowingSeconds(); - settings->timeShowMil = fClock->ShowingMilTime(); settings->timeShowEuro = fClock->ShowingEuroDate(); settings->timeFullDate = fClock->ShowingFullDate(); } @@ -215,15 +214,6 @@ TReplicantTray::ShowingSeconds() } -bool -TReplicantTray::ShowingMiltime() -{ - if (fClock) - return fClock->ShowingMilTime(); - return false; -} - - bool TReplicantTray::ShowingEuroDate() { @@ -261,8 +251,8 @@ TReplicantTray::DealWithClock(bool showClock) desk_settings* settings = ((TBarApp*)be_app)->Settings(); fClock = new TTimeView(fMinimumTrayWidth, kMaxReplicantHeight - 1.0, - settings->timeShowSeconds, settings->timeShowMil, - settings->timeFullDate, settings->timeShowEuro, false); + settings->timeShowSeconds, settings->timeFullDate, + settings->timeShowEuro, false); AddChild(fClock); fClock->MoveTo(Bounds().right - fClock->Bounds().Width() - 1, 2); @@ -385,7 +375,6 @@ TReplicantTray::MessageReceived(BMessage* message) break; case kShowSeconds: - case kMilTime: case kEuroDate: case kFullDate: if (fClock != NULL) diff --git a/src/apps/deskbar/TimeView.cpp b/src/apps/deskbar/TimeView.cpp index 042dad3328..92a170dcfc 100644 --- a/src/apps/deskbar/TimeView.cpp +++ b/src/apps/deskbar/TimeView.cpp @@ -38,8 +38,10 @@ All rights reserved. #include #include +#include #include #include +#include #include #include #include @@ -72,7 +74,7 @@ enum { #define B_TRANSLATE_CONTEXT "TimeView" TTimeView::TTimeView(float maxWidth, float height, bool showSeconds, - bool milTime, bool fullDate, bool euroDate, bool) + bool fullDate, bool euroDate, bool) : BView(BRect(-100,-100,-90,-90), "_deskbar_tv_", B_FOLLOW_RIGHT | B_FOLLOW_TOP, @@ -80,7 +82,6 @@ TTimeView::TTimeView(float maxWidth, float height, bool showSeconds, fParent(NULL), fShowInterval(true), // ToDo: defaulting this to true until UI is in place fShowSeconds(showSeconds), - fMilTime(milTime), fFullDate(fullDate), fCanShowFullDate(false), fEuroDate(euroDate), @@ -104,7 +105,6 @@ TTimeView::TTimeView(BMessage* data) { fTime = fLastTime = time(NULL); data->FindBool("seconds", &fShowSeconds); - data->FindBool("miltime", &fMilTime); data->FindBool("fulldate", &fFullDate); data->FindBool("eurodate", &fEuroDate); data->FindBool("interval", &fInterval); @@ -135,7 +135,6 @@ TTimeView::Archive(BMessage* data, bool deep) const { BView::Archive(data, deep); data->AddBool("seconds", fShowSeconds); - data->AddBool("miltime", fMilTime); data->AddBool("fulldate", fFullDate); data->AddBool("eurodate", fEuroDate); data->AddBool("interval", fInterval); @@ -220,10 +219,6 @@ TTimeView::MessageReceived(BMessage* message) ShowSeconds(!ShowingSeconds()); break; - case kMilTime: - ShowMilTime(!ShowingMilTime()); - break; - case kEuroDate: ShowEuroDate(!ShowingEuroDate()); break; @@ -315,28 +310,18 @@ TTimeView::StopLongClickNotifier() void TTimeView::GetCurrentTime() { - char tmp[64]; + // TODO : should this be another function ? tm time = *localtime(&fTime); - - if (fMilTime) { - strftime(tmp, 64, fShowSeconds ? "%H:%M:%S" : "%H:%M", &time); - } else { - if (fShowInterval) - strftime(tmp, 64, fShowSeconds ? "%I:%M:%S %p" : "%I:%M %p", &time); - else - strftime(tmp, 64, fShowSeconds ? "%I:%M:%S" : "%I:%M", &time); - } - - // remove leading 0 from time when hour is less than 10 - const char* str = tmp; - if (str[0] == '0') - str++; - - strcpy(fTimeStr, str); - + fSeconds = time.tm_sec; fMinute = time.tm_min; fHour = time.tm_hour; + + + BCountry* here; + be_locale_roster->GetDefaultCountry(&here); + + here->FormatTime(fTimeStr, 64, fTime, fShowSeconds); } @@ -465,14 +450,6 @@ TTimeView::ShowSeconds(bool on) } -void -TTimeView::ShowMilTime(bool on) -{ - fMilTime = on; - Update(); -} - - void TTimeView::ShowDate(bool on) { diff --git a/src/apps/deskbar/TimeView.h b/src/apps/deskbar/TimeView.h index 802276c1df..42e0bf6d82 100644 --- a/src/apps/deskbar/TimeView.h +++ b/src/apps/deskbar/TimeView.h @@ -54,7 +54,7 @@ class _EXPORT TTimeView; class TTimeView : public BView { public: TTimeView(float maxWidth, float height, bool showSeconds = false, - bool milTime = false, bool fullDate = false, bool euroDate = false, + bool fullDate = false, bool euroDate = false, bool showInterval = false); TTimeView(BMessage* data); ~TTimeView(); @@ -76,8 +76,6 @@ class TTimeView : public BView { bool ShowingSeconds() { return fShowSeconds; } void ShowSeconds(bool); - bool ShowingMilTime() { return fMilTime; } - void ShowMilTime(bool); bool ShowingDate() { return fShowingDate; } void ShowDate(bool); bool ShowingFullDate() { return fFullDate; } @@ -120,7 +118,6 @@ class TTimeView : public BView { bool fShowInterval; bool fShowSeconds; - bool fMilTime; bool fShowingDate; bool fFullDate; bool fCanShowFullDate; diff --git a/src/kits/locale/Country.cpp b/src/kits/locale/Country.cpp index 7892d6fc85..00819a78bc 100644 --- a/src/kits/locale/Country.cpp +++ b/src/kits/locale/Country.cpp @@ -164,7 +164,7 @@ BCountry::FormatTime(BString* string, time_t time, bool longFormat) // short, medium, long, and full. Our bool parameter is not enough... icu_4_2::DateFormat* timeFormatter; timeFormatter = DateFormat::createTimeInstance( - longFormat ? DateFormat::FULL : DateFormat::SHORT, + longFormat ? DateFormat::MEDIUM : DateFormat::SHORT, *fICULocale); UnicodeString ICUString; ICUString = timeFormatter->format((UDate)time * 1000, ICUString);