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