mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2026-04-19 06:50:16 +00:00
Dark Mode & Stream Overlay [macOS] (#315)
* dark mode & stream overlay * removed all redundant imports * update for the new xcode version with fixes for the new 'implicitly retains self warning' * reworked the overlay view * cleaning up unused variables * small corrections
This commit is contained in:
committed by
Cameron Gutman
parent
74283a6763
commit
f759f719e6
@@ -21,6 +21,5 @@
|
||||
@property (nonatomic) StreamConfiguration* streamConfig;
|
||||
@property (strong) IBOutlet StreamView *streamView;
|
||||
@property (weak) IBOutlet NSProgressIndicator *progressIndicator;
|
||||
@property (weak) IBOutlet NSTextField *stageLabel;
|
||||
|
||||
@end
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#import "Gamepad.h"
|
||||
#import "keepAlive.h"
|
||||
#import "ControllerSupport.h"
|
||||
#import "StreamView.h"
|
||||
|
||||
@interface StreamFrameViewController ()
|
||||
@end
|
||||
@@ -48,11 +49,11 @@
|
||||
// Can someone test this?
|
||||
_controllerSupport = [[ControllerSupport alloc] init];
|
||||
|
||||
// The gamepad currently gets polled at 60Hz, this could very well be set as 1/Framerate in the future.
|
||||
_eventTimer = [NSTimer scheduledTimerWithTimeInterval:1.0/60.0 target:self selector:@selector(eventTimerTick) userInfo:nil repeats:true];
|
||||
// The gamepad currently gets polled at 1/Framerate.
|
||||
_eventTimer = [NSTimer scheduledTimerWithTimeInterval:1.0/_streamConfig.frameRate target:self selector:@selector(eventTimerTick) userInfo:nil repeats:true];
|
||||
|
||||
// We search for new devices every second.
|
||||
_searchTimer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(searchTimerTick) userInfo:nil repeats:true];
|
||||
// We search for new devices every 2 seconds.
|
||||
_searchTimer = [NSTimer scheduledTimerWithTimeInterval:2 target:self selector:@selector(searchTimerTick) userInfo:nil repeats:true];
|
||||
}
|
||||
|
||||
- (void)eventTimerTick {
|
||||
@@ -94,36 +95,38 @@
|
||||
|
||||
- (void)connectionStarted {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[_progressIndicator stopAnimation:nil];
|
||||
_progressIndicator.hidden = true;
|
||||
_stageLabel.stringValue = @"Waiting for the first frame";
|
||||
[self->_progressIndicator stopAnimation:nil];
|
||||
self->_progressIndicator.hidden = true;
|
||||
});
|
||||
}
|
||||
|
||||
- (void)connectionTerminated:(long)errorCode {
|
||||
[_streamMan stopStream];
|
||||
[self transitionToSetupView:1];
|
||||
}
|
||||
|
||||
- (void)transitionToSetupView:(long)errorCode {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
NSLog(@"error has occured: %ld", errorCode);
|
||||
NSStoryboard *storyBoard = [NSStoryboard storyboardWithName:@"Mac" bundle:nil];
|
||||
ViewController* view = (ViewController*)[storyBoard instantiateControllerWithIdentifier :@"setupFrameVC"];
|
||||
[view setError:1];
|
||||
[view setError:errorCode];
|
||||
self.view.window.contentViewController = view;
|
||||
});
|
||||
}
|
||||
|
||||
- (void)setOrigin: (ViewController*) viewController
|
||||
{
|
||||
- (void)setOrigin: (ViewController*) viewController {
|
||||
_origin = viewController;
|
||||
}
|
||||
|
||||
- (void)displayMessage:(const char *)message {
|
||||
|
||||
//[_streamView drawMessage:[NSString stringWithFormat:@"%s", message]];
|
||||
}
|
||||
|
||||
- (void)displayTransientMessage:(const char *)message {
|
||||
}
|
||||
|
||||
- (void)launchFailed:(NSString *)message {
|
||||
|
||||
|
||||
}
|
||||
|
||||
- (void)stageComplete:(const char *)stageName {
|
||||
@@ -131,10 +134,11 @@
|
||||
}
|
||||
|
||||
- (void)stageFailed:(const char *)stageName withError:(long)errorCode {
|
||||
|
||||
//[_streamView drawMessage:[NSString stringWithFormat:@"Stage: %s failed with code: %li", stageName, errorCode]];
|
||||
}
|
||||
|
||||
- (void)stageStarting:(const char *)stageName {
|
||||
//[_streamView drawMessage:[NSString stringWithFormat:@"%s", stageName]];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import <AppKit/AppKit.h>
|
||||
#import "PairManager.h"
|
||||
#import "StreamConfiguration.h"
|
||||
|
||||
|
||||
@@ -58,6 +58,14 @@
|
||||
|
||||
// Do any additional setup after loading the view.
|
||||
}
|
||||
|
||||
- (void)viewWillAppear {
|
||||
[super viewWillAppear];
|
||||
if ([[[NSUserDefaults standardUserDefaults] stringForKey:@"AppleInterfaceStyle"] isEqual: @"Dark"]) {
|
||||
[self.view.window setAppearance:[NSAppearance appearanceNamed:NSAppearanceNameVibrantDark]];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)viewDidAppear {
|
||||
[super viewDidAppear];
|
||||
|
||||
@@ -84,9 +92,9 @@
|
||||
|
||||
-(void) showAlert:(NSString*) message {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
_alert = [NSAlert new];
|
||||
_alert.messageText = message;
|
||||
[_alert beginSheetModalForWindow:[self.view window] completionHandler:^(NSInteger result) {
|
||||
self->_alert = [NSAlert new];
|
||||
self->_alert.messageText = message;
|
||||
[self->_alert beginSheetModalForWindow:[self.view window] completionHandler:^(NSInteger result) {
|
||||
NSLog(@"Success");
|
||||
}];
|
||||
});
|
||||
@@ -138,7 +146,7 @@
|
||||
_host = _textFieldHost.stringValue;
|
||||
HttpManager* hMan = [[HttpManager alloc] initWithHost:_textFieldHost.stringValue
|
||||
uniqueId:_uniqueId
|
||||
deviceName:@"roth"
|
||||
deviceName:deviceName
|
||||
cert:_cert];
|
||||
|
||||
ServerInfoResponse* serverInfoResp = [[ServerInfoResponse alloc] init];
|
||||
@@ -152,9 +160,9 @@
|
||||
// Polling the server while pairing causes the server to screw up
|
||||
NSLog(@"Pairing");
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
HttpManager* hMan = [[HttpManager alloc] initWithHost:_host uniqueId:_uniqueId deviceName:deviceName cert:_cert];
|
||||
PairManager* pMan = [[PairManager alloc] initWithManager:hMan andCert:_cert callback:self];
|
||||
[_opQueue addOperation:pMan];
|
||||
HttpManager* hMan = [[HttpManager alloc] initWithHost:self->_host uniqueId:self->_uniqueId deviceName:deviceName cert:self->_cert];
|
||||
PairManager* pMan = [[PairManager alloc] initWithManager:hMan andCert:self->_cert callback:self];
|
||||
[self->_opQueue addOperation:pMan];
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -174,12 +182,12 @@
|
||||
|
||||
- (void)alreadyPaired {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[_popupButtonSelection setEnabled:true];
|
||||
[_popupButtonSelection setHidden:false];
|
||||
[_buttonConnect setEnabled:false];
|
||||
[_buttonConnect setHidden:true];
|
||||
[_buttonLaunch setEnabled:true];
|
||||
[_textFieldHost setEnabled:false];
|
||||
[self->_popupButtonSelection setEnabled:true];
|
||||
[self->_popupButtonSelection setHidden:false];
|
||||
[self->_buttonConnect setEnabled:false];
|
||||
[self->_buttonConnect setHidden:true];
|
||||
[self->_buttonLaunch setEnabled:true];
|
||||
[self->_textFieldHost setEnabled:false];
|
||||
});
|
||||
[self searchForHost:_host];
|
||||
[self updateAppsForHost];
|
||||
@@ -202,8 +210,8 @@
|
||||
|
||||
- (void)pairSuccessful {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self.view.window endSheet:_alert.window];
|
||||
_alert = nil;
|
||||
[self.view.window endSheet:self->_alert.window];
|
||||
self->_alert = nil;
|
||||
[self alreadyPaired];
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user