* Deskbar now uses localized time from locale kit. Thus the "24 hour

clock" setting is not needed anymore.
 * The locale kit now provide a less complete 'full' time format : hour 
minutes seconds, I don't think anyone cares much about the "UTC + 1" or 
other similar stuff.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37243 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adrien Destugues
2010-06-24 13:32:59 +00:00
parent fd9fa13896
commit 3fc995d101
9 changed files with 16 additions and 65 deletions
-3
View File
@@ -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,
+1 -2
View File
@@ -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;
-1
View File
@@ -371,7 +371,6 @@ TBeMenu::ResetTargets()
case kConfigShow:
case kAlwaysTop:
case kShowSeconds:
case kMilTime:
case kEuroDate:
case kRebootSystem:
case kSuspendSystem:
-6
View File
@@ -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)
-1
View File
@@ -52,7 +52,6 @@ private:
BCheckBox* fAppsShowExpanders;
BCheckBox* fAppsExpandNew;
BCheckBox* fClock24Hours;
BCheckBox* fClockSeconds;
BCheckBox* fClockEuropeanDate;
BCheckBox* fClockFullDate;
+2 -13
View File
@@ -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)
+11 -34
View File
@@ -38,8 +38,10 @@ All rights reserved.
#include <string.h>
#include <Catalog.h>
#include <Country.h>
#include <Debug.h>
#include <Locale.h>
#include <LocaleRoster.h>
#include <MenuItem.h>
#include <MessageRunner.h>
#include <PopUpMenu.h>
@@ -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)
{
+1 -4
View File
@@ -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;
+1 -1
View File
@@ -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);