ui: Add Preference screen
- enter/exit animation
- switch between panels (general/audio/video/hooks)
Refs #66840
Change-Id: I10b823c5e13c6667f1303cd51e32531a375828ff
diff --git a/RingWindowController.mm b/RingWindowController.mm
index 54563ea..ea00d3c 100644
--- a/RingWindowController.mm
+++ b/RingWindowController.mm
@@ -20,20 +20,10 @@
@end
@implementation RingWindowController
-@synthesize callUriTextField;
- (void)windowDidLoad {
[super windowDidLoad];
-
- Account* acc = AccountModel::instance()->currentAccount();
-
- NSLog(@"Current account is:%@", acc->alias().toNSString());
-
[self connectSlots];
-
-
- // Implement this method to handle any initialization after your window controller's window has been loaded from its nib file.
-
}
@@ -50,9 +40,87 @@
}
-- (IBAction)placeCall:(NSButton *)sender {
- Call* mainCall_ = CallModel::instance()->dialingCall();
- mainCall_->setDialNumber(QString::fromNSString([self.callUriTextField stringValue]));
- mainCall_->performAction(Call::Action::ACCEPT);
+- (IBAction)openPreferences:(id)sender
+{
+
+ if(self.preferencesViewController != nil)
+ return;
+ NSToolbar* tb = [[NSToolbar alloc] initWithIdentifier: @"PreferencesToolbar"];
+
+
+
+ self.preferencesViewController = [[PreferencesViewController alloc] initWithNibName:@"PreferencesScreen" bundle:nil];
+
+ self.myCurrentViewController = self.preferencesViewController;
+
+ NSLayoutConstraint* test = [NSLayoutConstraint constraintWithItem:self.preferencesViewController.view
+ attribute:NSLayoutAttributeWidth
+ relatedBy:NSLayoutRelationEqual
+ toItem:currentView
+ attribute:NSLayoutAttributeWidth
+ multiplier:1.0f
+ constant:0.0f];
+
+ NSLayoutConstraint* test2 = [NSLayoutConstraint constraintWithItem:self.preferencesViewController.view
+ attribute:NSLayoutAttributeHeight
+ relatedBy:NSLayoutRelationEqual
+ toItem:currentView
+ attribute:NSLayoutAttributeHeight
+ multiplier:1.0f
+ constant:0.0f];
+
+ NSLayoutConstraint* test3 = [NSLayoutConstraint constraintWithItem:self.preferencesViewController.view
+ attribute:NSLayoutAttributeCenterX
+ relatedBy:NSLayoutRelationEqual
+ toItem:currentView
+ attribute:NSLayoutAttributeCenterX
+ multiplier:1.0f
+ constant:0.0f];
+
+
+ [currentView addSubview:[self.preferencesViewController view]];
+
+ [tb setDelegate: self.preferencesViewController];
+ [self.window setToolbar: tb];
+
+ [self.window.toolbar setSelectedItemIdentifier:@"GeneralPrefsIdentifier"];
+
+ [currentView addConstraint:test];
+ [currentView addConstraint:test2];
+ [currentView addConstraint:test3];
+ // make sure we automatically resize the controller's view to the current window size
+ [[self.myCurrentViewController view] setFrame:[currentView bounds]];
+
+ // set the view controller's represented object to the number of subviews in that controller
+ // (our NSTextField's value binding will reflect this value)
+ [self.myCurrentViewController setRepresentedObject:[NSNumber numberWithUnsignedInteger:[[[self.myCurrentViewController view] subviews] count]]];
+
}
+
+- (IBAction) closePreferences:(NSToolbarItem *)sender {
+ if(self.myCurrentViewController != nil)
+ {
+ [self.preferencesViewController close];
+ [self.window setToolbar:nil];
+ self.preferencesViewController = nil;
+ }
+}
+
+// FIXME: This is sick, NSWindowController is catching my selectors
+- (void)displayGeneral:(NSToolbarItem *)sender {
+ [self.preferencesViewController displayGeneral:sender];
+}
+
+- (void)displayAudio:(NSToolbarItem *)sender {
+ [self.preferencesViewController displayAudio:sender];
+}
+
+- (void)displayAncrage:(NSToolbarItem *)sender {
+ [self.preferencesViewController displayAncrage:sender];
+}
+
+- (void)displayVideo:(NSToolbarItem *)sender {
+ [self.preferencesViewController displayVideo:sender];
+}
+
@end