Cleanup, no functional change

* coding style adjustements
* fixed all warnings

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37792 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Oliver Tappe
2010-07-28 16:26:53 +00:00
parent 1c6a53c07c
commit 6d6408d6bc
24 changed files with 386 additions and 353 deletions
+8 -6
View File
@@ -1,13 +1,13 @@
/*
* Copyright 2004-2007, Haiku, Inc. All Rights Reserved.
* Copyright 2004-2010, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Mike Berg <[email protected]>
* Julun <[email protected]>
*/
#ifndef ANALOG_CLOCK_H
#define ANALOG_CLOCK_H
#ifndef _ANALOG_CLOCK_H
#define _ANALOG_CLOCK_H
#include <View.h>
@@ -27,11 +27,13 @@ class TAnalogClock : public BView {
virtual void MessageReceived(BMessage* message);
virtual void MouseDown(BPoint point);
virtual void MouseUp(BPoint point);
virtual void MouseMoved(BPoint point, uint32 transit, const BMessage *message);
virtual void MouseMoved(BPoint point, uint32 transit,
const BMessage* message);
void SetTime(int32 hour, int32 minute, int32 second);
bool IsChangingTime() { return fTimeChangeIsOngoing; }
bool IsChangingTime()
{ return fTimeChangeIsOngoing; }
void ChangeTimeFinished();
private:
void _InitView(BRect frame);
@@ -45,5 +47,5 @@ class TAnalogClock : public BView {
bool fTimeChangeIsOngoing;
};
#endif // ANALOG_CLOCK_H
#endif // _ANALOG_CLOCK_H
+4 -4
View File
@@ -1,13 +1,13 @@
/*
* Copyright 2004-2007, Haiku, Inc. All Rights Reserved.
* Copyright 2004-2010, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Mike Berg <[email protected]>
* Julun <[email protected]>
*/
#ifndef TIMEBASE_H
#define TIMEBASE_H
#ifndef _BASE_VIEW_H
#define _BASE_VIEW_H
#include <Message.h>
@@ -31,5 +31,5 @@ class TTimeBaseView: public BView {
BMessage fMessage;
};
#endif // TIMEBASE_H
#endif // _BASE_VIEW_H
+5 -4
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2004-2007, Haiku, Inc. All Rights Reserved.
* Copyright 2004-2010, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
@@ -8,8 +8,8 @@
* Julun <[email protected]>
*
*/
#ifndef ANALOG_CLOCK_H
#define ANALOG_CLOCK_H
#ifndef _BITMAPS_H
#define _BITMAPS_H
#include <Bitmap.h>
@@ -45,5 +45,6 @@ const unsigned char kDownArrowBits [] = {
0xff,0xff,0xff,0xff,0xff,0x13,0xff,0xff,0xff,0xff,0xff,0xff,0x18,0x3f,0xff,0xff
};
#endif // ANALOG_CLOCK_H
#endif // _BITMAPS_H
+4 -4
View File
@@ -110,7 +110,7 @@ TTimeEdit::DrawSection(uint32 index, bool hasFocus)
country->FormatTime(&text, fieldPositions, fieldCount, time, true);
// TODO : this should be cached somehow to not redo it for each field
if (index * 2 + 1 > fieldCount) {
if (index * 2 + 1 > (uint32)fieldCount) {
free(fieldPositions);
return;
}
@@ -154,7 +154,7 @@ TTimeEdit::DrawSeparator(uint32 index)
country->FormatTime(&text, fieldPositions, fieldCount, time, true);
// TODO : this should be cached somehow to not redo it for each field
if (index * 2 + 2 > fieldCount) {
if (index * 2 + 2 > (uint32)fieldCount) {
free(fieldPositions);
return;
}
@@ -547,7 +547,7 @@ TDateEdit::DrawSection(uint32 index, bool hasFocus)
false);
// TODO : this should be cached somehow to not redo it for each field
if (index * 2 + 1 > fieldCount) {
if (index * 2 + 1 > (uint32)fieldCount) {
free(fieldPositions);
return;
}
@@ -594,7 +594,7 @@ TDateEdit::DrawSeparator(uint32 index)
false);
// TODO : this should be cached somehow to not redo it for each field
if (index * 2 + 2 > fieldCount) {
if (index * 2 + 2 > (uint32)fieldCount) {
free(fieldPositions);
return;
}
+5 -4
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2004-2007, Haiku, Inc. All Rights Reserved.
* Copyright 2004-2010, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
@@ -8,8 +8,8 @@
* Julun <[email protected]>
*
*/
#ifndef DATETIME_H
#define DATETIME_H
#ifndef _DATE_TIME_EDIT_H
#define _DATE_TIME_EDIT_H
#include "SectionEdit.h"
@@ -23,6 +23,7 @@ class TTimeEdit : public TSectionEdit {
TTimeEdit(BRect frame, const char* name,
uint32 sections);
virtual ~TTimeEdit();
virtual void KeyDown(const char* bytes, int32 numBytes);
virtual void InitView();
@@ -85,5 +86,5 @@ class TDateEdit : public TSectionEdit {
int32 fLastKeyDownInt;
};
#endif // DATETIME_H
#endif // _DATE_TIME_EDIT_H
+4 -4
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2004-2007, Haiku, Inc. All Rights Reserved.
* Copyright 2004-2010, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
@@ -8,8 +8,8 @@
* Julun <[email protected]>
* Philippe Saint-Pierre <[email protected]>
*/
#ifndef DATE_TIME_VIEW_H
#define DATE_TIME_VIEW_H
#ifndef _DATE_TIME_VIEW_H
#define _DATE_TIME_VIEW_H
#include <View.h>
@@ -64,5 +64,5 @@ class DateTimeView : public BView {
bigtime_t fSystemTimeAtStart;
};
#endif // DATE_TIME_VIEW_H
#endif // _DATE_TIME_VIEW_H
+29
View File
@@ -18,6 +18,35 @@
#include "TimeMessages.h"
TSection::TSection(BRect frame)
:
fFrame(frame)
{
}
BRect
TSection::Bounds() const
{
BRect frame(fFrame);
return frame.OffsetByCopy(B_ORIGIN);
}
void
TSection::SetFrame(BRect frame)
{
fFrame = frame;
}
BRect
TSection::Frame() const
{
return fFrame;
}
const uint32 kArrowAreaWidth = 16;
+8 -17
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2004-2007, Haiku, Inc. All Rights Reserved.
* Copyright 2004-2010, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
@@ -7,8 +7,8 @@
* Julun <[email protected]>
*
*/
#ifndef SECTIONEDIT_H
#define SECTIONEDIT_H
#ifndef _SECTION_EDIT_H
#define _SECTION_EDIT_H
#include <Control.h>
@@ -20,20 +20,11 @@ class BList;
class TSection {
public:
TSection(BRect frame)
: fFrame(frame) {}
TSection(BRect frame);
BRect Bounds() const
{
BRect frame(fFrame);
return frame.OffsetByCopy(B_ORIGIN);
}
void SetFrame(BRect frame)
{ fFrame = frame; }
BRect Frame() const
{ return fFrame; }
BRect Bounds() const;
void SetFrame(BRect frame);
BRect Frame() const;
private:
BRect fFrame;
@@ -89,5 +80,5 @@ class TSectionEdit: public BControl {
bool fShowFocus;
};
#endif
#endif // _SECTION_EDIT_H
+7 -6
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2004-2007, Haiku, Inc. All Rights Reserved.
* Copyright 2004-2010, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
@@ -8,8 +8,8 @@
* Julun <[email protected]>
*
*/
#ifndef TTZDISPLAY_H
#define TTZDISPLAY_H
#ifndef _TZ_DISPLAY_H
#define _TZ_DISPLAY_H
#include <View.h>
@@ -18,7 +18,8 @@
class TTZDisplay : public BView {
public:
TTZDisplay(BRect frame, const char *name, const char *label);
TTZDisplay(BRect frame, const char* name,
const char* label);
virtual ~TTZDisplay();
virtual void AttachedToWindow();
@@ -38,8 +39,8 @@ class TTZDisplay : public BView {
BString fLabel;
BString fText;
BString fTime;
};
#endif // TTZDISPLAY_H
#endif // _TZ_DISPLAY_H
+5 -4
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007, Haiku. All rights reserved.
* Copyright 2002-2010, Haiku. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
@@ -7,8 +7,8 @@
* Mike Berg <[email protected]>
* Julun <[email protected]>
*/
#ifndef TIME_H
#define TIME_H
#ifndef _TIME_H
#define _TIME_H
#include <Application.h>
@@ -29,5 +29,6 @@ class TimeApplication : public BApplication {
TTimeWindow* fWindow;
};
#endif // TIME_H
#endif // _TIME_H
+1 -1
View File
@@ -15,7 +15,7 @@ resource app_version {
internal = 0,
short_info = "Time",
long_info = "Time ©2002-2009 Haiku"
long_info = "Time ©2002-2010 Haiku"
};
resource vector_icon {
+6 -5
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007, Haiku. All rights reserved.
* Copyright 2002-2010, Haiku. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
@@ -8,14 +8,14 @@
* Julun <[email protected]>
* Philippe Saint-Pierre <[email protected]>
*/
#ifndef TIME_MESSAGES_H
#define TIME_MESSAGES_H
#ifndef _TIME_MESSAGES_H
#define _TIME_MESSAGES_H
//Timezone messages
const uint32 H_CITY_CHANGED = 'h_CC';
const uint32 H_CITY_SET = 'h_CS';
//SetButton
const uint32 H_SET_TIME_ZONE = 'hSTZ';
@@ -46,5 +46,6 @@ const uint32 kMsgRevert = 'rvrt';
// change time finished
const uint32 kChangeTimeFinished = 'tcfi';
#endif //TIME_MESSAGES_H
#endif // _TIME_MESSAGES_H
+5 -4
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007, Haiku. All rights reserved.
* Copyright 2002-2010, Haiku. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
@@ -7,8 +7,8 @@
* Mike Berg <[email protected]>
* Julun <[email protected]>
*/
#ifndef TIME_SETTINGS_H
#define TIME_SETTINGS_H
#ifndef _TIME_SETTINGS_H
#define _TIME_SETTINGS_H
#include <Point.h>
@@ -27,5 +27,6 @@ class TimeSettings {
BString fSettingsFile;
};
#endif // TIME_SETTINGS_H
#endif // _TIME_SETTINGS_H
+5 -4
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2004-2007, Haiku, Inc. All Rights Reserved.
* Copyright 2004-2010, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
@@ -7,8 +7,8 @@
* Julun <[email protected]>
*
*/
#ifndef TIME_WINDOW_H
#define TIME_WINDOW_H
#ifndef _TIME_WINDOW_H
#define _TIME_WINDOW_H
#include <Window.h>
@@ -42,5 +42,6 @@ class TTimeWindow : public BWindow {
BButton* fRevertButton;
};
#endif // TIME_WINDOW_H
#endif // _TIME_WINDOW_H
+8 -6
View File
@@ -6,8 +6,8 @@
* Adrien Destugues <[email protected]>
*/
#ifndef __TIMEZONELISTITEM_H__
#define __TIMEZONELISTITEM_H__
#ifndef _TIME_ZONE_LIST_ITEM_H
#define _TIME_ZONE_LIST_ITEM_H
#include <StringItem.h>
@@ -20,11 +20,12 @@ class BTimeZone;
class TimeZoneListItem : public BStringItem {
public:
TimeZoneListItem(const char* text, BCountry* country,
BTimeZone* timeZone);
TimeZoneListItem(const char* text,
BCountry* country, BTimeZone* timeZone);
~TimeZoneListItem();
void DrawItem(BView* owner, BRect frame, bool complete = false);
void DrawItem(BView* owner, BRect frame,
bool complete = false);
void Code(char* buffer);
private:
@@ -32,4 +33,5 @@ class TimeZoneListItem : public BStringItem {
BTimeZone* fTimeZone;
};
#endif
#endif // _TIME_ZONE_LIST_ITEM_H
+23 -21
View File
@@ -49,7 +49,7 @@ TimeZoneView::TimeZoneView(BRect frame)
fCurrentZone = NULL;
fOldZone = NULL;
// TODO : get default timezone from locale kit
InitView();
_InitView();
}
@@ -74,8 +74,8 @@ TimeZoneView::_Revert()
fCityList->ScrollToSelection();
fCurrent->SetText(((TimeZoneListItem*)fCityList->ItemAt(czone))->Text());
SetPreview();
SetTimeZone();
_SetPreview();
_SetTimeZone();
}
@@ -126,7 +126,7 @@ TimeZoneView::MessageReceived(BMessage *message)
message->FindInt32(B_OBSERVE_WHAT_CHANGE, &change);
switch(change) {
case H_TM_CHANGED:
UpdateDateTime(message);
_UpdateDateTime(message);
break;
default:
@@ -138,7 +138,7 @@ TimeZoneView::MessageReceived(BMessage *message)
case H_SET_TIME_ZONE:
{
SetTimeZone();
_SetTimeZone();
((TTimeWindow*)Window())->SetRevertStatus();
break;
}
@@ -148,7 +148,7 @@ TimeZoneView::MessageReceived(BMessage *message)
break;
case H_CITY_CHANGED:
SetPreview();
_SetPreview();
break;
default:
@@ -159,7 +159,7 @@ TimeZoneView::MessageReceived(BMessage *message)
void
TimeZoneView::UpdateDateTime(BMessage *message)
TimeZoneView::_UpdateDateTime(BMessage* message)
{
int32 hour;
int32 minute;
@@ -174,14 +174,14 @@ TimeZoneView::UpdateDateTime(BMessage *message)
// do calc to get other zone time
if (fCityList->CurrentSelection() > -1)
SetPreview();
_SetPreview();
}
}
}
void
TimeZoneView::InitView()
TimeZoneView::_InitView()
{
// left side
BRect frameLeft(Bounds());
@@ -194,7 +194,7 @@ TimeZoneView::InitView()
fCityList->SetSelectionMessage(new BMessage(H_CITY_CHANGED));
fCityList->SetInvocationMessage(new BMessage(H_SET_TIME_ZONE));
BuildRegionMenu();
_BuildRegionMenu();
BScrollView* scrollList = new BScrollView("scrollList", fCityList,
B_FOLLOW_ALL, 0, false, true);
@@ -229,7 +229,7 @@ TimeZoneView::InitView()
void
TimeZoneView::BuildRegionMenu()
TimeZoneView::_BuildRegionMenu()
{
// Get a list of countries
// For each country, get all the timezones and AddItemUnder them
@@ -266,7 +266,9 @@ TimeZoneView::BuildRegionMenu()
fCityList->AddItem(countryItem);
BTimeZone* timeZone;
for (int j = 0; timeZone = (BTimeZone*)tzList.ItemAt(j); j++) {
for (int j = 0;
(timeZone = (BTimeZone*)tzList.ItemAt(j)) != NULL;
j++) {
BString readableName;
timeZone->GetName(readableName);
BStringItem* tzItem = new TimeZoneListItem(readableName,
@@ -283,7 +285,7 @@ TimeZoneView::BuildRegionMenu()
void
TimeZoneView::SetPreview()
TimeZoneView::_SetPreview()
{
int32 selection = fCityList->CurrentSelection();
if (selection >= 0) {
@@ -293,7 +295,7 @@ TimeZoneView::SetPreview()
// set timezone to selection
char buffer[50];
item->Code(buffer);
SetTimeZone(buffer);
_SetTimeZone(buffer);
// calc preview time
time_t current = time(NULL);
@@ -305,7 +307,7 @@ TimeZoneView::SetPreview()
fPreview->SetTime(localTime.tm_hour, localTime.tm_min);
fCurrentZone->Code(buffer);
SetTimeZone(buffer);
_SetTimeZone(buffer);
fSetZone->SetEnabled((strcmp(fCurrent->Text(), item->Text()) != 0));
}
@@ -313,11 +315,11 @@ TimeZoneView::SetPreview()
void
TimeZoneView::SetCurrent(const char *text)
TimeZoneView::_SetCurrent(const char* text)
{
char buffer[50];
fCurrentZone->Code(buffer);
SetTimeZone(buffer);
_SetTimeZone(buffer);
time_t current = time(NULL);
struct tm localTime;
@@ -329,7 +331,7 @@ TimeZoneView::SetCurrent(const char *text)
void
TimeZoneView::SetTimeZone()
TimeZoneView::_SetTimeZone()
{
/* set time based on supplied timezone. How to do this?
1) replace symlink "timezone" in B_USER_SETTINGS_DIR with a link to the
@@ -347,7 +349,7 @@ TimeZoneView::SetTimeZone()
((TimeZoneListItem*)fCityList->ItemAt(selection))->Code(timeZoneCode);
// update environment
SetTimeZone(timeZoneCode);
_SetTimeZone(timeZoneCode);
// update display
time_t current = time(NULL);
@@ -365,12 +367,12 @@ TimeZoneView::SetTimeZone()
fHour = localTime.tm_hour;
fMinute = localTime.tm_min;
fCurrentZone = (TimeZoneListItem*)(fCityList->ItemAt(selection));
SetCurrent(((TimeZoneListItem *)fCityList->ItemAt(selection))->Text());
_SetCurrent(((TimeZoneListItem*)fCityList->ItemAt(selection))->Text());
}
void
TimeZoneView::SetTimeZone(const char *zone)
TimeZoneView::_SetTimeZone(const char* zone)
{
putenv(BString("TZ=").Append(zone).String());
tzset();
+9 -9
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2004-2009, Haiku, Inc. All Rights Reserved.
* Copyright 2004-2010, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
@@ -32,13 +32,13 @@ class TimeZoneView : public BView {
bool CheckCanRevert();
private:
void UpdateDateTime(BMessage *message);
void SetTimeZone();
void SetTimeZone(const char *zone);
void SetPreview();
void SetCurrent(const char *text);
void InitView();
void BuildRegionMenu();
void _UpdateDateTime(BMessage* message);
void _SetTimeZone();
void _SetTimeZone(const char* zone);
void _SetPreview();
void _SetCurrent(const char* text);
void _InitView();
void _BuildRegionMenu();
void _Revert();
private:
@@ -54,5 +54,5 @@ class TimeZoneView : public BView {
bool fInitialized;
};
#endif //Zone_View_H
#endif // ZONE_VIEW_H