2 * Copyright 2011-2014 Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
6 * Axel Dörfler, axeld@pinc-software.de
7 * Hamish Morrison, hamish@lavabit.com
8 * John Scipione, jscipione@gmail.com
10 #ifndef NETWORK_TIME_VIEW_H
11 #define NETWORK_TIME_VIEW_H
14 #include <LayoutBuilder.h>
26 static const uint32 kMsgNetworkTimeSettings
= 'ntst';
27 static const uint32 kMsgSetDefaultServer
= 'setd';
28 static const uint32 kMsgServerEdited
= 'sved';
29 static const uint32 kMsgAddServer
= 'asrv';
30 static const uint32 kMsgRemoveServer
= 'rsrv';
31 static const uint32 kMsgResetServerList
= 'rstl';
32 static const uint32 kMsgTryAllServers
= 'tras';
33 static const uint32 kMsgSynchronizeAtBoot
= 'synb';
34 static const uint32 kMsgSynchronize
= 'sync';
35 static const uint32 kMsgStopSynchronization
= 'stps';
36 static const uint32 kMsgSynchronizationResult
= 'syrs';
37 static const uint32 kMsgNetworkTimeChange
= 'ntch';
45 void AddServer(const char* server
);
46 const char* GetServer(int32 index
) const;
47 void RemoveServer(const char* server
);
48 void SetDefaultServer(int32 index
);
49 int32
GetDefaultServer() const;
50 void SetTryAllServers(bool boolean
);
51 bool GetTryAllServers() const;
52 void SetSynchronizeAtBoot(bool boolean
);
53 bool GetSynchronizeAtBoot() const;
55 void ResetServersToDefaults();
56 void ResetToDefaults();
58 bool SettingsChanged();
64 int32
_GetStringByValue(const char* name
,
66 status_t
_GetPath(BPath
& path
);
74 class NetworkTimeView
: public BGroupView
{
76 NetworkTimeView(const char* name
);
77 virtual ~NetworkTimeView();
79 virtual void MessageReceived(BMessage
* message
);
80 virtual void AttachedToWindow();
82 bool CheckCanRevert();
85 void _UpdateServerList();
86 void _DoneSynchronizing();
87 bool _IsValidServerName(const char* serverName
);
91 BTextControl
* fServerTextControl
;
93 BButton
* fRemoveButton
;
94 BButton
* fResetButton
;
96 BListView
* fServerListView
;
97 BCheckBox
* fTryAllServersCheckBox
;
98 BCheckBox
* fSynchronizeAtBootCheckBox
;
99 BButton
* fSynchronizeButton
;
101 rgb_color fTextColor
;
102 rgb_color fInvalidColor
;
104 thread_id fUpdateThread
;
109 update_thread(void* params
);
112 update_time(const Settings
& settings
, BMessenger
* messenger
,
116 update_time(const Settings
& settings
, const char** errorString
,
120 #endif // NETWORK_TIME_VIEW_H