Remove the "Full Date" setting and associated madness with respect to
the deskbar's current orientation. Instead, we now always show the full date, but as a tooltip rather than switching the timeview's display based on a mouse click. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39019 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
6f43fabafb
commit
9e9c8091e7
@ -60,9 +60,6 @@ PreferencesWindow::PreferencesWindow(BRect frame)
|
||||
|
||||
fClockSeconds = new BCheckBox(B_TRANSLATE("Show seconds"),
|
||||
new BMessage(kShowSeconds));
|
||||
fClockFullDate = new BCheckBox(B_TRANSLATE("Full date"),
|
||||
new BMessage(kFullDate));
|
||||
|
||||
fWindowAlwaysOnTop = new BCheckBox(B_TRANSLATE("Always on top"),
|
||||
new BMessage(kAlwaysTop));
|
||||
fWindowAutoRaise = new BCheckBox(B_TRANSLATE("Auto-raise"),
|
||||
@ -121,11 +118,9 @@ PreferencesWindow::PreferencesWindow(BRect frame)
|
||||
TReplicantTray* replicantTray = barApp->BarView()->fReplicantTray;
|
||||
|
||||
fClockSeconds->SetValue(replicantTray->ShowingSeconds());
|
||||
fClockFullDate->SetValue(replicantTray->ShowingFullDate());
|
||||
|
||||
bool showingClock = barApp->BarView()->ShowingClock();
|
||||
fClockSeconds->SetEnabled(showingClock);
|
||||
fClockFullDate->SetEnabled(replicantTray->CanShowFullDate());
|
||||
|
||||
fWindowAlwaysOnTop->SetValue(appSettings->alwaysOnTop);
|
||||
fWindowAutoRaise->SetValue(appSettings->autoRaise);
|
||||
@ -138,7 +133,6 @@ PreferencesWindow::PreferencesWindow(BRect frame)
|
||||
fAppsExpandNew->SetTarget(be_app);
|
||||
|
||||
fClockSeconds->SetTarget(replicantTray);
|
||||
fClockFullDate->SetTarget(replicantTray);
|
||||
|
||||
fWindowAlwaysOnTop->SetTarget(be_app);
|
||||
fWindowAutoRaise->SetTarget(be_app);
|
||||
@ -194,7 +188,6 @@ PreferencesWindow::PreferencesWindow(BRect frame)
|
||||
view = BLayoutBuilder::Group<>()
|
||||
.AddGroup(B_VERTICAL, 1)
|
||||
.Add(fClockSeconds)
|
||||
.Add(fClockFullDate)
|
||||
.AddGlue()
|
||||
.SetInsets(10, 10, 10, 10)
|
||||
.End()
|
||||
|
@ -53,7 +53,6 @@ private:
|
||||
BCheckBox* fAppsExpandNew;
|
||||
|
||||
BCheckBox* fClockSeconds;
|
||||
BCheckBox* fClockFullDate;
|
||||
|
||||
BCheckBox* fWindowAlwaysOnTop;
|
||||
BCheckBox* fWindowAutoRaise;
|
||||
|
@ -199,7 +199,6 @@ TReplicantTray::RememberClockSettings()
|
||||
desk_settings* settings = ((TBarApp*)be_app)->Settings();
|
||||
|
||||
settings->timeShowSeconds = fClock->ShowingSeconds();
|
||||
settings->timeFullDate = fClock->ShowingFullDate();
|
||||
}
|
||||
}
|
||||
|
||||
@ -213,24 +212,6 @@ TReplicantTray::ShowingSeconds()
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
TReplicantTray::ShowingFullDate()
|
||||
{
|
||||
if (fClock && CanShowFullDate())
|
||||
return fClock->ShowingFullDate();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
TReplicantTray::CanShowFullDate()
|
||||
{
|
||||
if (fClock)
|
||||
return fClock->CanShowFullDate();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TReplicantTray::DealWithClock(bool showClock)
|
||||
{
|
||||
@ -241,12 +222,11 @@ TReplicantTray::DealWithClock(bool showClock)
|
||||
desk_settings* settings = ((TBarApp*)be_app)->Settings();
|
||||
|
||||
fClock = new TTimeView(fMinimumTrayWidth, kMaxReplicantHeight - 1.0,
|
||||
settings->timeShowSeconds, settings->timeFullDate,
|
||||
settings->timeShowSeconds,
|
||||
false);
|
||||
AddChild(fClock);
|
||||
|
||||
fClock->MoveTo(Bounds().right - fClock->Bounds().Width() - 1, 2);
|
||||
fClock->AllowFullDate(!IsMultiRow());
|
||||
}
|
||||
} else {
|
||||
if (fClock) {
|
||||
@ -1387,11 +1367,6 @@ void
|
||||
TReplicantTray::SetMultiRow(bool state)
|
||||
{
|
||||
fMultiRowMode = state;
|
||||
|
||||
// in multi-row state, we only want the short date
|
||||
|
||||
if (fClock != NULL)
|
||||
fClock->AllowFullDate(!state);
|
||||
}
|
||||
|
||||
|
||||
|
@ -113,8 +113,6 @@ public:
|
||||
|
||||
bool ShowingSeconds(void);
|
||||
bool ShowingMiltime(void);
|
||||
bool ShowingFullDate(void);
|
||||
bool CanShowFullDate(void);
|
||||
|
||||
void RememberClockSettings();
|
||||
void DealWithClock(bool);
|
||||
|
@ -68,7 +68,7 @@ enum {
|
||||
#define B_TRANSLATE_CONTEXT "TimeView"
|
||||
|
||||
TTimeView::TTimeView(float maxWidth, float height, bool showSeconds,
|
||||
bool fullDate, bool)
|
||||
bool)
|
||||
:
|
||||
BView(BRect(-100, -100, -90, -90), "_deskbar_tv_",
|
||||
B_FOLLOW_RIGHT | B_FOLLOW_TOP,
|
||||
@ -76,14 +76,11 @@ TTimeView::TTimeView(float maxWidth, float height, bool showSeconds,
|
||||
fParent(NULL),
|
||||
fShowInterval(true), // ToDo: defaulting this to true until UI is in place
|
||||
fShowSeconds(showSeconds),
|
||||
fFullDate(fullDate),
|
||||
fCanShowFullDate(false),
|
||||
fMaxWidth(maxWidth),
|
||||
fHeight(height),
|
||||
fOrientation(true),
|
||||
fLongClickMessageRunner(NULL)
|
||||
{
|
||||
fShowingDate = false;
|
||||
fTime = fLastTime = time(NULL);
|
||||
fSeconds = fMinute = fHour = 0;
|
||||
fLastTimeStr[0] = 0;
|
||||
@ -100,9 +97,7 @@ TTimeView::TTimeView(BMessage* data)
|
||||
{
|
||||
fTime = fLastTime = time(NULL);
|
||||
data->FindBool("seconds", &fShowSeconds);
|
||||
data->FindBool("fulldate", &fFullDate);
|
||||
data->FindBool("interval", &fInterval);
|
||||
fShowingDate = false;
|
||||
|
||||
fLocale = *be_locale;
|
||||
}
|
||||
@ -131,7 +126,6 @@ TTimeView::Archive(BMessage* data, bool deep) const
|
||||
{
|
||||
BView::Archive(data, deep);
|
||||
data->AddBool("seconds", fShowSeconds);
|
||||
data->AddBool("fulldate", fFullDate);
|
||||
data->AddBool("interval", fInterval);
|
||||
data->AddInt32("deskbar:private_align", B_ALIGN_RIGHT);
|
||||
|
||||
@ -163,21 +157,14 @@ TTimeView::GetPreferredSize(float* width, float* height)
|
||||
*height = fHeight;
|
||||
|
||||
GetCurrentTime();
|
||||
GetCurrentDate();
|
||||
|
||||
// TODO: SetOrientation never gets called, fix that
|
||||
// When in vertical mode, we want to limit the width so that it can't
|
||||
// overlap the bevels in the parent view.
|
||||
if (ShowingDate())
|
||||
*width = fOrientation ?
|
||||
min_c(fMaxWidth - kHMargin, kHMargin + StringWidth(fDateStr))
|
||||
: kHMargin + StringWidth(fDateStr);
|
||||
else {
|
||||
*width = fOrientation ?
|
||||
min_c(fMaxWidth - kHMargin, kHMargin + StringWidth(fTimeStr))
|
||||
: kHMargin + StringWidth(fTimeStr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
@ -206,10 +193,6 @@ void
|
||||
TTimeView::MessageReceived(BMessage* message)
|
||||
{
|
||||
switch (message->what) {
|
||||
case kFullDate:
|
||||
ShowFullDate(!ShowingFullDate());
|
||||
break;
|
||||
|
||||
case kShowSeconds:
|
||||
ShowSeconds(!ShowingSeconds());
|
||||
break;
|
||||
@ -314,7 +297,7 @@ TTimeView::GetCurrentDate()
|
||||
{
|
||||
char tmp[64];
|
||||
|
||||
fLocale.FormatDate(tmp, 64, fTime, fFullDate && CanShowFullDate());
|
||||
fLocale.FormatDate(tmp, 64, fTime, true);
|
||||
|
||||
// remove leading 0 from date when month is less than 10 (MM/DD/YY)
|
||||
// or remove leading 0 from date when day is less than 10 (DD/MM/YY)
|
||||
@ -336,9 +319,6 @@ TTimeView::Draw(BRect /*updateRect*/)
|
||||
FillRect(Bounds());
|
||||
SetHighColor(0, 0, 0, 255);
|
||||
|
||||
if (fShowingDate)
|
||||
DrawString(fDateStr, fDateLocation);
|
||||
else
|
||||
DrawString(fTimeStr, fTimeLocation);
|
||||
|
||||
PopState();
|
||||
@ -358,11 +338,6 @@ TTimeView::MouseDown(BPoint point)
|
||||
StartLongClickNotifier(point);
|
||||
}
|
||||
|
||||
// flip to/from showing date or time
|
||||
fShowingDate = !fShowingDate;
|
||||
if (fShowingDate)
|
||||
fLastTime = time(NULL);
|
||||
|
||||
// invalidate last time/date strings and call the pulse
|
||||
// method directly to change the display instantly
|
||||
fLastDateStr[0] = '\0';
|
||||
@ -390,14 +365,12 @@ TTimeView::Pulse()
|
||||
|
||||
GetCurrentTime();
|
||||
GetCurrentDate();
|
||||
if ((!fShowingDate && strcmp(fTimeStr, fLastTimeStr) != 0)
|
||||
|| (fShowingDate && strcmp(fDateStr, fLastDateStr) != 0)) {
|
||||
if (strcmp(fTimeStr, fLastTimeStr) != 0) {
|
||||
// Update bounds when the size of the strings has changed
|
||||
// For dates, Update() could be called two times in a row,
|
||||
// but that should only happen very rarely
|
||||
if ((!fShowingDate && fLastTimeStr[1] != fTimeStr[1]
|
||||
if ((fLastTimeStr[1] != fTimeStr[1]
|
||||
&& (fLastTimeStr[1] == ':' || fTimeStr[1] == ':'))
|
||||
|| (fShowingDate && strlen(fDateStr) != strlen(fLastDateStr))
|
||||
|| !fLastTimeStr[0])
|
||||
Update();
|
||||
|
||||
@ -406,11 +379,6 @@ TTimeView::Pulse()
|
||||
fNeedToUpdate = true;
|
||||
}
|
||||
|
||||
if (fShowingDate && (fLastTime + 5 <= time(NULL))) {
|
||||
fShowingDate = false;
|
||||
Update(); // Needs to happen since size can change here
|
||||
}
|
||||
|
||||
if (fNeedToUpdate) {
|
||||
fSeconds = ct->tm_sec;
|
||||
fMinute = ct->tm_min;
|
||||
@ -431,32 +399,6 @@ TTimeView::ShowSeconds(bool on)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TTimeView::ShowDate(bool on)
|
||||
{
|
||||
fShowingDate = on;
|
||||
Update();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TTimeView::ShowFullDate(bool on)
|
||||
{
|
||||
fFullDate = on;
|
||||
Update();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TTimeView::AllowFullDate(bool allow)
|
||||
{
|
||||
fCanShowFullDate = allow;
|
||||
|
||||
if (allow != ShowingFullDate())
|
||||
Update();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TTimeView::Update()
|
||||
{
|
||||
@ -464,6 +406,8 @@ TTimeView::Update()
|
||||
GetCurrentTime();
|
||||
GetCurrentDate();
|
||||
|
||||
SetToolTip(fDateStr);
|
||||
|
||||
ResizeToPreferred();
|
||||
CalculateTextPlacement();
|
||||
|
||||
|
@ -55,7 +55,7 @@ class _EXPORT TTimeView;
|
||||
class TTimeView : public BView {
|
||||
public:
|
||||
TTimeView(float maxWidth, float height, bool showSeconds = false,
|
||||
bool fullDate = false, bool showInterval = false);
|
||||
bool showInterval = false);
|
||||
TTimeView(BMessage* data);
|
||||
~TTimeView();
|
||||
|
||||
@ -76,12 +76,6 @@ class TTimeView : public BView {
|
||||
|
||||
bool ShowingSeconds() { return fShowSeconds; }
|
||||
void ShowSeconds(bool);
|
||||
bool ShowingDate() { return fShowingDate; }
|
||||
void ShowDate(bool);
|
||||
bool ShowingFullDate() { return fFullDate; }
|
||||
void ShowFullDate(bool);
|
||||
bool CanShowFullDate() const { return fCanShowFullDate; }
|
||||
void AllowFullDate(bool);
|
||||
void ShowCalendar(BPoint where);
|
||||
void StartLongClickNotifier(BPoint where);
|
||||
void StopLongClickNotifier();
|
||||
@ -116,9 +110,6 @@ class TTimeView : public BView {
|
||||
|
||||
bool fShowInterval;
|
||||
bool fShowSeconds;
|
||||
bool fShowingDate;
|
||||
bool fFullDate;
|
||||
bool fCanShowFullDate;
|
||||
|
||||
float fMaxWidth;
|
||||
float fHeight;
|
||||
|
Loading…
Reference in New Issue
Block a user