Tracker: style fixes to StatusWindow classes

This commit is contained in:
John Scipione
2014-06-20 21:29:40 -04:00
parent ad12c9b56f
commit 754d953d6d
2 changed files with 25 additions and 18 deletions
+19 -11
View File
@@ -58,7 +58,11 @@ All rights reserved.
#include "DeskWindow.h" #include "DeskWindow.h"
const float kDefaultStatusViewHeight = 50; #undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "StatusWindow"
const float kDefaultStatusViewHeight = 50;
const bigtime_t kMaxUpdateInterval = 100000LL; const bigtime_t kMaxUpdateInterval = 100000LL;
const bigtime_t kSpeedReferenceInterval = 2000000LL; const bigtime_t kSpeedReferenceInterval = 2000000LL;
const bigtime_t kShowSpeedInterval = 8000000LL; const bigtime_t kShowSpeedInterval = 8000000LL;
@@ -69,6 +73,7 @@ static bigtime_t sLastEstimatedFinishSpeedToggleTime = -1;
static bool sShowSpeed = true; static bool sShowSpeed = true;
static const time_t kSecondsPerDay = 24 * 60 * 60; static const time_t kSecondsPerDay = 24 * 60 * 60;
class TCustomButton : public BButton { class TCustomButton : public BButton {
public: public:
TCustomButton(BRect frame, uint32 command); TCustomButton(BRect frame, uint32 command);
@@ -90,6 +95,9 @@ BStatusWindow* gStatusWindow = NULL;
} }
// #pragma mark - BStatusMouseFilter
BStatusMouseFilter::BStatusMouseFilter() BStatusMouseFilter::BStatusMouseFilter()
: :
BMessageFilter(B_ANY_DELIVERY, B_ANY_SOURCE, B_MOUSE_DOWN) BMessageFilter(B_ANY_DELIVERY, B_ANY_SOURCE, B_MOUSE_DOWN)
@@ -115,6 +123,9 @@ BStatusMouseFilter::Filter(BMessage* message, BHandler** target)
} }
// #pragma mark - TCustomButton
TCustomButton::TCustomButton(BRect frame, uint32 what) TCustomButton::TCustomButton(BRect frame, uint32 what)
: :
BButton(frame, "", "", new BMessage(what), B_FOLLOW_LEFT | B_FOLLOW_TOP, BButton(frame, "", "", new BMessage(what), B_FOLLOW_LEFT | B_FOLLOW_TOP,
@@ -154,13 +165,14 @@ TCustomButton::Draw(BRect updateRect)
} }
// #pragma mark - // #pragma mark - StatusBackgroundView
class StatusBackgroundView : public BView { class StatusBackgroundView : public BView {
public: public:
StatusBackgroundView(BRect frame) StatusBackgroundView(BRect frame)
: BView(frame, "BackView", B_FOLLOW_ALL, B_WILL_DRAW | B_PULSE_NEEDED) :
BView(frame, "BackView", B_FOLLOW_ALL, B_WILL_DRAW | B_PULSE_NEEDED)
{ {
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
} }
@@ -183,11 +195,7 @@ public:
}; };
// #pragma mark - BStatusWindow // #pragma mark - BStatusWindow
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "StatusWindow"
BStatusWindow::BStatusWindow() BStatusWindow::BStatusWindow()
@@ -611,9 +619,6 @@ BStatusView::InitStatus(int32 totalItems, off_t totalSize,
case kRestoreFromTrashState: case kRestoreFromTrashState:
fStatusBar->Reset(B_TRANSLATE("Restoring: "), buffer.String()); fStatusBar->Reset(B_TRANSLATE("Restoring: "), buffer.String());
break; break;
default:
break;
} }
fStatusBar->SetMaxValue(1); fStatusBar->SetMaxValue(1);
@@ -756,6 +761,7 @@ BStatusView::_FullSpeedString()
buffer.ReplaceFirst("%BytesPerSecond", buffer.ReplaceFirst("%BytesPerSecond",
string_for_size(fBytesPerSecond, sizeBuffer, sizeof(sizeBuffer))); string_for_size(fBytesPerSecond, sizeBuffer, sizeof(sizeBuffer)));
} }
return buffer; return buffer;
} }
@@ -770,6 +776,7 @@ BStatusView::_ShortSpeedString()
buffer.ReplaceFirst("%BytesPerSecond", buffer.ReplaceFirst("%BytesPerSecond",
string_for_size(fBytesPerSecond, sizeBuffer, sizeof(sizeBuffer))); string_for_size(fBytesPerSecond, sizeBuffer, sizeof(sizeBuffer)));
} }
return buffer; return buffer;
} }
@@ -804,6 +811,7 @@ BStatusView::_TimeStatusString(float availableSpace, float* _width)
if (_width != NULL) if (_width != NULL)
*_width = width; *_width = width;
return string; return string;
} }
+6 -7
View File
@@ -31,17 +31,16 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#ifndef STATUS_WINDOW_H #ifndef _STATUS_WINDOW_H
#define STATUS_WINDOW_H #define _STATUS_WINDOW_H
#include <Window.h>
#include <View.h>
#include <Bitmap.h> #include <Bitmap.h>
#include <ObjectList.h>
#include <StatusBar.h> #include <StatusBar.h>
#include <String.h> #include <String.h>
#include <View.h>
#include "ObjectList.h" #include <Window.h>
namespace BPrivate { namespace BPrivate {
@@ -204,4 +203,4 @@ extern BStatusWindow* gStatusWindow;
using namespace BPrivate; using namespace BPrivate;
#endif // STATUS_WINDOW_H #endif // _STATUS_WINDOW_H