Skip to content

Commit 5975847

Browse files
author
shengcui
committed
增加Mac Demo
1 parent 4109f03 commit 5975847

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+4467
-0
lines changed

Mac/.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
.DS_Store
2+
build/
3+
DerivedData/
4+
*.pbxuser
5+
!default.pbxuser
6+
*.mode1v3
7+
!default.mode1v3
8+
*.mode2v3
9+
!default.mode2v3
10+
*.perspectivev3
11+
!default.perspectivev3
12+
xcuserdata/
13+
.moved-aside
14+
*.xccheckout
15+
*.xcscmblueprint
16+
*.xcodeproj/*
17+
!*.xcodeproj/project.pbxproj
18+
!*.xcodeproj/xcshareddata/
19+
!*.xcworkspace/contents.xcworkspacedata
20+
/*.gcno
21+
SDK/*

Mac/TRTCDemo.xcodeproj/project.pbxproj

Lines changed: 434 additions & 0 deletions
Large diffs are not rendered by default.

Mac/TRTCDemo/AppDelegate.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//
2+
// AppDelegate.h
3+
// TRTCDemo
4+
//
5+
// Created by rushanting on 2018/12/21.
6+
// Copyright © 2018 rushanting. All rights reserved.
7+
//
8+
9+
#import <Cocoa/Cocoa.h>
10+
#import "TRTCSettingWindowController.h"
11+
#import "TRTCCloud.h"
12+
13+
@interface AppDelegate : NSObject <NSApplicationDelegate>
14+
- (void)showPreferenceWithTabIndex:(TXAVSettingTabIndex)index;
15+
- (TRTCCloud*)getTRTCEngine;
16+
- (void)closePreference;
17+
18+
@end
19+

Mac/TRTCDemo/AppDelegate.m

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
//
2+
// AppDelegate.m
3+
// TRTCDemo
4+
//
5+
// Created by rushanting on 2018/12/21.
6+
// Copyright © 2018 rushanting. All rights reserved.
7+
//
8+
9+
#import "AppDelegate.h"
10+
#import "TRTCNewViewController.h"
11+
#import "TRTCSettingWindowController.h"
12+
13+
@interface AppDelegate ()
14+
{
15+
TRTCSettingWindowController *_settingWindowController;
16+
TRTCCloud* _trtcEngine;
17+
18+
}
19+
@end
20+
21+
@implementation AppDelegate
22+
23+
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
24+
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onWindowClose:) name:NSWindowWillCloseNotification object:nil];
25+
// [self onShowCameraWindow:nil];
26+
}
27+
28+
29+
- (void)applicationWillTerminate:(NSNotification *)aNotification {
30+
// Insert code here to tear down your application
31+
}
32+
33+
- (BOOL)applicationShouldHandleReopen:(NSApplication *)sender hasVisibleWindows:(BOOL)flag {
34+
if (!flag) {
35+
[self showLoginWindow];
36+
}
37+
return YES;
38+
}
39+
40+
- (IBAction)onPreference:(id)sender {
41+
[self showPreferenceWithTabIndex:TXAVSettingTabIndexVideo];
42+
}
43+
44+
- (void)showPreferenceWithTabIndex:(TXAVSettingTabIndex)index
45+
{
46+
if (nil ==_settingWindowController) {
47+
_settingWindowController = [[TRTCSettingWindowController alloc] initWithWindowNibName:@"TRTCSettingWindowController" engine:[self getTRTCEngine]];
48+
}
49+
_settingWindowController.tabIndex = index;
50+
[_settingWindowController showWindow:self];
51+
}
52+
53+
- (void)closePreference{
54+
[_settingWindowController close];
55+
_settingWindowController = nil;
56+
}
57+
58+
- (void)onWindowClose:(NSNotification *)notification {
59+
if ([[notification.object nextResponder] isKindOfClass:[TRTCMainWindowController class]]) {
60+
_trtcEngine = nil;
61+
[self showLoginWindow];
62+
}
63+
}
64+
65+
- (void)showLoginWindow {
66+
NSStoryboard *board = [NSStoryboard storyboardWithName:@"Main" bundle:nil];
67+
NSWindowController *wc = [board instantiateInitialController];
68+
[wc showWindow:nil];
69+
}
70+
71+
// Menu Actions
72+
//- (IBAction)onShowCameraWindow:(id)sender {
73+
// if (_cameraPreviewController == nil) {
74+
// _cameraPreviewController = [[TXCameraPreviewWindowController alloc] initWithWindowNibName:@"TXCameraPreviewWindowController"];
75+
// }
76+
// [_cameraPreviewController showWindow:nil];
77+
//}
78+
79+
- (TRTCCloud*)getTRTCEngine
80+
{
81+
if (!_trtcEngine) {
82+
_trtcEngine = [TRTCCloud new];
83+
}
84+
85+
return _trtcEngine;
86+
}
87+
88+
89+
@end
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "mac",
5+
"size" : "16x16",
6+
"scale" : "1x"
7+
},
8+
{
9+
"idiom" : "mac",
10+
"size" : "16x16",
11+
"scale" : "2x"
12+
},
13+
{
14+
"idiom" : "mac",
15+
"size" : "32x32",
16+
"scale" : "1x"
17+
},
18+
{
19+
"idiom" : "mac",
20+
"size" : "32x32",
21+
"scale" : "2x"
22+
},
23+
{
24+
"idiom" : "mac",
25+
"size" : "128x128",
26+
"scale" : "1x"
27+
},
28+
{
29+
"idiom" : "mac",
30+
"size" : "128x128",
31+
"scale" : "2x"
32+
},
33+
{
34+
"idiom" : "mac",
35+
"size" : "256x256",
36+
"scale" : "1x"
37+
},
38+
{
39+
"size" : "256x256",
40+
"idiom" : "mac",
41+
"filename" : "AppIcon512.png",
42+
"scale" : "2x"
43+
},
44+
{
45+
"idiom" : "mac",
46+
"size" : "512x512",
47+
"scale" : "1x"
48+
},
49+
{
50+
"size" : "512x512",
51+
"idiom" : "mac",
52+
"filename" : "AppIcon1024x1024.png",
53+
"scale" : "2x"
54+
}
55+
],
56+
"info" : {
57+
"version" : 1,
58+
"author" : "xcode"
59+
}
60+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"info" : {
3+
"version" : 1,
4+
"author" : "xcode"
5+
}
6+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "universal",
5+
"filename" : "audio.png",
6+
"scale" : "1x"
7+
},
8+
{
9+
"idiom" : "universal",
10+
"scale" : "2x"
11+
},
12+
{
13+
"idiom" : "universal",
14+
"scale" : "3x"
15+
}
16+
],
17+
"info" : {
18+
"version" : 1,
19+
"author" : "xcode"
20+
}
21+
}
Loading

0 commit comments

Comments
 (0)