You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
133 lines
3.2 KiB
133 lines
3.2 KiB
//
|
|
// DDWRT_MonitorAppDelegate.h
|
|
// DDWRT-Monitor
|
|
//
|
|
// Created by Matthieu Lalonde & Spike Grobstein on 11-05-27.
|
|
// Copyleft 2011 Spurf CC BY-SH-NC. Some rights reserved.
|
|
//
|
|
|
|
#import <Cocoa/Cocoa.h>
|
|
#import<WebKit/WebKit.h>
|
|
#import "WRTStatusClient.h"
|
|
|
|
@interface DDWRT_MonitorAppDelegate : NSObject <NSApplicationDelegate> {
|
|
IBOutlet NSMenu *AppMenu;
|
|
|
|
IBOutlet NSPanel *ConfigPanel;
|
|
IBOutlet NSPanel *BandwidthViewer;
|
|
|
|
IBOutlet WebView* BandwidthViewerWebView;
|
|
|
|
IBOutlet id configFieldHostname;
|
|
IBOutlet NSMatrix *configFieldProtocol;
|
|
IBOutlet NSButtonCell *configFieldProtocolHTTP;
|
|
IBOutlet NSButtonCell *configFieldProtocolHTTPS;
|
|
IBOutlet id configFieldPort;
|
|
IBOutlet id configFieldRefresh;
|
|
IBOutlet id configLabelRefresh;
|
|
IBOutlet id configFieldUseBytes;
|
|
IBOutlet id configFieldShowIcon;
|
|
IBOutlet id configLabelStatus;
|
|
IBOutlet NSProgressIndicator *configStateStatus;
|
|
IBOutlet id configButtonSave;
|
|
|
|
IBOutlet id menuUptime;
|
|
IBOutlet id menuLoad;
|
|
IBOutlet id menuWanIP;
|
|
|
|
IBOutlet id menuWanStatus;
|
|
IBOutlet id menuWanUptime;
|
|
|
|
IBOutlet id menuWanTrafficIn;
|
|
IBOutlet id menuWanTrafficOut;
|
|
|
|
IBOutlet id menuWanSeparator;
|
|
|
|
IBOutlet id menuWanDNS;
|
|
IBOutlet id menuWanDNSItem0;
|
|
IBOutlet id menuWanDNSItem1;
|
|
IBOutlet id menuWanDNSItem2;
|
|
IBOutlet id menuWanBandwidthGraph;
|
|
|
|
|
|
IBOutlet id menuClients;
|
|
IBOutlet id menuClientsCount;
|
|
IBOutlet id menuClientsConnections;
|
|
IBOutlet id menuClientsSeparator;
|
|
|
|
NSUserDefaults *defaults;
|
|
|
|
// application prefs:
|
|
|
|
NSString *hostname;
|
|
NSString *protocol;
|
|
int port;
|
|
NSString *username;
|
|
NSString *password;
|
|
|
|
int refreshTime;
|
|
bool useBytes;
|
|
bool showMenuIcon;
|
|
|
|
// end app prefs
|
|
|
|
NSStatusItem *_appMenu;
|
|
NSAlert *modalWindow;
|
|
|
|
NSTimer *_readTimer;
|
|
NSTimeInterval _lastSpeedRead;
|
|
|
|
WRTStatusClient *wrt_client;
|
|
|
|
NSDate *_lastDateThroughput;
|
|
unsigned long long _lastInThroughput;
|
|
unsigned long long _lastOutThroughput;
|
|
|
|
BOOL _wrtReachable;
|
|
}
|
|
|
|
- (void) initialize;
|
|
- (void) deinitialize;
|
|
|
|
- (void) initDefaults;
|
|
- (void) readDefaults;
|
|
- (void) writeDefaults;
|
|
|
|
- (void) terminate:(id)sender;
|
|
- (void) showConfigPanel:(id)sender;
|
|
- (void) hideConfigPanel:(id)sender;
|
|
- (void) showBandwidthViewer:(id)sender;
|
|
- (void) hideBandwidthViewer:(id)sender;
|
|
- (void) showMenubar;
|
|
- (void) hideMenubar;
|
|
- (void) showMenubarIcon:(BOOL)enabled;
|
|
- (void) hideMenubarIcon;
|
|
- (void) setMenubarText:(NSString *)menubarText;
|
|
|
|
- (void) setConfigHostname:(id)sender;
|
|
- (void) setConfigProtocol:(id)sender;
|
|
- (void) setConfigPort:(id)sender;
|
|
- (void) setConfigRefresh:(id)sender;
|
|
- (void) setConfigWan:(id)sender;
|
|
- (void) setConfigBytes:(id)sender;
|
|
- (void) setConfigIcon:(id)sender;
|
|
|
|
- (IBAction) refreshMenu:(id)sender;
|
|
- (IBAction) refreshSystemMenu:(id)sender;
|
|
- (IBAction) refreshWanMenu:(id)sender;
|
|
- (void) wanRequestCallback:(NSData *)data;
|
|
- (IBAction) refreshClientsMenu:(id)sender;
|
|
- (void) cbClientsRequest:(NSData *)data;
|
|
|
|
- (void) saveConfig:(id)sender;
|
|
- (void) updateThroughput:(NSTimer *)timer;
|
|
- (void) throughputCallback:(NSData *)data;
|
|
- (void) doUpdateStatus:(NSData *)data;
|
|
|
|
- (NSMenu *) createCopyMenuItem;
|
|
- (IBAction) copyParentMenuTitle:(id)sender;
|
|
- (NSString *) stringFromSize:(uint64_t)theBytes;
|
|
- (NSString *) stringFromSpeed:(uint64_t)theBytes;
|
|
|
|
@end
|