-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVnseaApp.h
137 lines (116 loc) · 4 KB
/
VnseaApp.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#if !defined(_VnseaApp_h_)
#define _VnseaApp_h_
#import <CoreFoundation/CoreFoundation.h>
#import <Foundation/Foundation.h>
#import <UIKit/CDStructures.h>
#import <UIKit/UIWindow.h>
#import <UIKit/UIView-Hierarchy.h>
#import <UIKit/UIHardware.h>
#import <UIKit/UIKit.h>
#import <UIKit/UIApplication.h>
#import <UIKit/UIScroller.h>
#import <UIKit/UITransitionView.h>
#import "VNCView.h"
#import "VNCServerInfoView.h"
#import "VNCServerListView.h"
#import "VNCPrefsView.h"
@class Profile;
@class Shimmer;
@class RFBConnection;
//! Path to the file that server settings are stored in.
#define kServersFilePath @"vnsea_servers.plist"
#define kPrefsFilePath @"vnsea_prefs.plist"
//! The top level dictionary key containing the array of server dictionaries in the
//! server settings file.
#define kServerArrayKey @"servers"
#define kPrefsArrayKey @"prefs"
//! URL for a plist that contains information about the latest version
//! of the application, for use by Shimmer.
#define kUpdateURL @"http://www.manyetas.com/creed/iphone/shimmer/vnsea.plist"
//! If a connection attempt takes longer than this amount of time, then
//! an alert is displayed telling the user what is going on.
#define kConnectionAlertTime (0.6f)
//! Amount of time in seconds to let the run loop run while waiting for
//! a connection to be made.
#define kConnectWaitRunLoopTime (0.1f)
//! Status bar animation modes.
enum
{
kUIStatusBarFadeAnimation = 0,
kUIStatusBarBottomToTopAnimation = 1,
kUIStatusBarTopToBottomAnimation = 2
};
/*!
* @brief Main application class for the VNC viewer program.
*
* This class manages the high level interaction with the user. It
* switches between the server list, server editor, and connection views
* as necessary. It also handles reading and writing the saved list
* of servers to and from media.
*/
@interface VnseaApp : UIApplication
{
//! @name Views
//@{
UIWindow * _window;
UIView * _mainView;
UITransitionView * _transView;
VNCView * _vncView;
VNCServerListView * _serversView;
VNCServerInfoView * _serverEditorView;
VNCPrefsView *_prefsView;
//@}
Profile * _defaultProfile; //!< Our single profile object, reused for every connection.
int _editingIndex, _serverConnectingIndex; //!< Index of the server currently being edited.
RFBConnection * _connection; //!< The active connection object.
NSConditionLock * _connectLock; //!< Lock used for thread synchronisation during connect.
BOOL _didOpenConnection; //!< YES if the connection was opened successfully.
NSString * _connectError; //!< Error message from attempting to open a connection.
BOOL _closingConnection; //!< True if the connection is intentionally being closed.
UIAlertSheet * _connectAlert; //!< Sheet saying we're connecting to a server.
int _lastAlertButtonIndexClicked;
NSTimer *_statusDoubleTapTimer;
NSString *_autoConnectHost;
}
-(void)autoConnect:(NSTimer *)timer;
-(id)_initWithArgc:(int)cArgs argv:(const char **)argv;
//! @name Server list I/O
//@{
- (NSArray *)loadServers;
- (void)saveServers:(NSArray *)theServers;
//@}
//! @name Preferences
//@{
- (void)finishedEditingPreferences;
- (void)displayPrefs;
//@}
//! @brief Called when the first frame from RFB protocol arrives.
- (void)gotFirstFullScreenTransitionNow;
- (void)_endedEditing;
- (BOOL)_shouldEndEditing;
//! @name List and editor delegate messages
//@{
- (int)findServerIndex:(NSString *)serverName;
- (void)serverSelected:(int)serverIndex;
- (void)editServer:(int)serverIndex;
- (void)addNewServer;
- (void)finishedEditingServer:(NSDictionary *)serverInfo;
- (void)serverValidationFailed:(NSString *)pnsBodyText;
- (void)deleteServer;
//@}
//! @brief Creates a dictionary populated with default server values.
- (NSDictionary *)defaultServerInfo;
//! @name Shimmer auto-update support
//@{
- (void)checkForUpdate:(id)unused;
//@}
//! @brief Show the about alert.
- (void)displayAbout;
//! @name Connection methods
//@{
- (void)waitForConnection:(RFBConnection *)connection;
- (void)connectToServer:(RFBConnection *)connection;
- (void)closeConnection;
//@}
@end
#endif // _VnseaApp_h_