setAutoStart and fix borderView

This commit is contained in:
unstop
2016-11-04 19:25:51 +08:00
parent 793007c13d
commit b6126bfdfd
5 changed files with 18 additions and 6 deletions

View File

@@ -232,7 +232,12 @@ static const NSInteger kPreferencesDefaultHeight = 192;
- (void)setLaunchAtLogin:(NSArray *)args
{
BOOL launchAtLogin = args[0];
BOOL launchAtLogin;
if ([args[0] isEqual: @"true"]){
launchAtLogin = true;
}else{
launchAtLogin = false;
}
StartAtLoginController *loginController = [[StartAtLoginController alloc] initWithIdentifier:@"com.hackplan.quark-shell-helper"];
loginController.startAtLogin = launchAtLogin;

View File

@@ -8,7 +8,7 @@
#import "QSHWindowBorderView.h"
static const CGFloat marginTop = -5;
static const CGFloat marginTop = 5;
static const CGFloat roundedRectangleCornerRadius = 5;
static const CGFloat arrowHeight = 10;
static const CGFloat arrowWidth = 20;
@@ -25,14 +25,14 @@ static const CGFloat arrowWidth = 20;
- (NSRect)innerFrame
{
return NSMakeRect(0, marginTop, NSWidth(self.bounds), NSHeight(self.bounds) - arrowHeight);
return NSMakeRect(0, 0, NSWidth(self.bounds), NSHeight(self.bounds) - arrowHeight - marginTop);
}
- (void)drawRect:(NSRect)dirtyRect
{
[super drawRect:dirtyRect];
NSRect roundedRectangleRect = NSMakeRect(0, marginTop, NSWidth(self.bounds), NSHeight(self.bounds) - arrowHeight);
NSRect roundedRectangleRect = NSMakeRect(0, 0, NSWidth(self.bounds), NSHeight(self.bounds) - arrowHeight - marginTop);
NSRect roundedRectangleInnerRect = NSInsetRect(roundedRectangleRect, roundedRectangleCornerRadius, roundedRectangleCornerRadius);
NSBezierPath *roundedRectanglePath = [NSBezierPath bezierPath];
[roundedRectanglePath appendBezierPathWithArcWithCenter:NSMakePoint(NSMinX(roundedRectangleInnerRect), NSMinY(roundedRectangleInnerRect)) radius: roundedRectangleCornerRadius startAngle:180 endAngle:270];

View File

@@ -53,7 +53,7 @@ function setupQuarkWithBridge(bridge) {
window.quark.setLaunchAtLogin = function (shouldLaunchAtLogin) {
shouldLaunchAtLogin = !!shouldLaunchAtLogin
bridge.callHandler('quark', {'method': 'setLaunchAtLogin', 'args': [shouldLaunchAtLogin]})
bridge.callHandler('quark', {'method': 'setLaunchAtLogin', 'args': [shouldLaunchAtLogin.toString()]})
}
window.quark.emit = function (options) {

View File

@@ -95,6 +95,9 @@
<button onclick="showPrompt()">Prompt</button>
<button onclick="quark.quit()">Quit</button>
</p>
<p>
<button onclick="setupPref()">Set Pref</button>
</p>
</div>
<canvas id="icon"></canvas>
<canvas id="highlighted-icon"></canvas>

View File

@@ -150,6 +150,10 @@ function showPrompt() {
quark.notify({title: 'Quark Shell', content: content, popupOnClick: true})
}
function setAutoStart(){
quark.setLaunchAtLogin(true)
}
function setIcon() {
var iconCanvas = document.getElementById('icon')
iconCanvas.width = 40