Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
mycard
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xiaoye
mycard
Commits
640276a3
Commit
640276a3
authored
Jun 03, 2024
by
mercury233
Committed by
nanahira
Jun 03, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add importEnabled and closeToTray settings
parent
0849f532
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
79 additions
and
6 deletions
+79
-6
app/app-detail.component.html
app/app-detail.component.html
+1
-1
app/mycard.component.html
app/mycard.component.html
+17
-3
app/mycard.component.ts
app/mycard.component.ts
+20
-2
app/settings.sevices.ts
app/settings.sevices.ts
+41
-0
No files found.
app/app-detail.component.html
View file @
640276a3
...
...
@@ -17,7 +17,7 @@
<!--应用已购买,未安装-->
<div
*ngIf=
"currentApp.isBought() && !currentApp.isInstalled()"
class=
"i-b"
>
<button
i18n
(click)=
"updateInstallOption(currentApp)"
type=
"button"
class=
"btn btn-primary btn-sm"
data-toggle=
"modal"
data-target=
"#install-modal"
>
安装
</button>
<button
i18n
*ngIf=
"currentApp.runnable()"
(click)=
"updateInstallOption(currentApp)"
type=
"button"
class=
"btn btn-secondary btn-sm"
data-toggle=
"modal"
data-target=
"#import-modal"
>
导入
</button>
<button
i18n
*ngIf=
"currentApp.runnable()
&& settingsService.getImportEnabled()
"
(click)=
"updateInstallOption(currentApp)"
type=
"button"
class=
"btn btn-secondary btn-sm"
data-toggle=
"modal"
data-target=
"#import-modal"
>
导入
</button>
</div>
<!--应用变更中-->
...
...
app/mycard.component.html
View file @
640276a3
...
...
@@ -42,7 +42,7 @@
<i
i18n
(click)=
"currentWindow.minimize()"
class=
"fa fa-minus"
i18n-title
title=
"最小化"
></i>
<i
i18n
*ngIf=
"!currentWindow.isMaximized()"
(click)=
"currentWindow.maximize()"
class=
"fa fa-expand"
i18n-title
title=
"最大化"
></i>
<i
i18n
*ngIf=
"currentWindow.isMaximized()"
(click)=
"currentWindow.unmaximize()"
class=
"fa fa-clone"
i18n-title
title=
"还原"
></i>
<i
i18n
(click)=
"c
urrentWindow.hide
()"
class=
"fa fa-times"
i18n-title
title=
"关闭"
></i>
<i
i18n
(click)=
"c
loseWindow
()"
class=
"fa fa-times"
i18n-title
title=
"关闭"
></i>
</div>
</div>
</nav>
...
...
@@ -67,14 +67,28 @@
<div
class=
"modal-body"
>
<div
class=
"container"
>
<div
class=
"form-group row"
>
<label
i18n
for=
"locale"
class=
"col-sm-2 col-form-label"
>
语言
</label>
<div
class=
"col-sm-10"
>
<label
i18n
class=
"col-sm-3 col-form-label"
>
关闭时
</label>
<div
class=
"col-sm-9"
>
<input
type=
"checkbox"
id=
"chkCloseToTray"
[(ngModel)]=
"closeToTray"
name=
"chkCloseToTray"
>
<label
i18n
for=
"chkCloseToTray"
>
点击关闭按钮最小化到系统托盘
</label>
</div>
</div>
<div
class=
"form-group row"
>
<label
i18n
for=
"locale"
class=
"col-sm-3 col-form-label"
>
语言
</label>
<div
class=
"col-sm-9"
>
<select
class=
"form-control"
id=
"locale"
[(ngModel)]=
"locale"
name=
"locale"
>
<option
value=
"en-US"
>
English
</option>
<option
value=
"zh-CN"
>
简体中文
</option>
</select>
</div>
</div>
<div
class=
"form-group row"
>
<label
i18n
class=
"col-sm-3 col-form-label"
>
允许导入
</label>
<div
class=
"col-sm-9"
>
<input
type=
"checkbox"
id=
"chkImportEnabled"
[(ngModel)]=
"importEnabled"
name=
"chkImportEnabled"
>
<label
i18n
for=
"chkImportEnabled"
>
我确认我在开发者指导下使用导入功能
</label>
</div>
</div>
</div>
</div>
<div
class=
"modal-footer"
>
...
...
app/mycard.component.ts
View file @
640276a3
...
...
@@ -37,6 +37,8 @@ export class MyCardComponent implements OnInit {
update_elements
:
Map
<
string
,
ElementRef
>
;
locale
:
string
;
importEnabled
:
boolean
;
closeToTray
:
boolean
;
resizing
:
HTMLElement
|
null
;
...
...
@@ -66,6 +68,8 @@ export class MyCardComponent implements OnInit {
this
.
currentWindow
.
webContents
.
openDevTools
({
mode
:
'
undocked
'
});
}
});
$
(
'
#settings-modal
'
).
on
(
'
show.bs.modal
'
,
()
=>
{
this
.
update_settings
();
});
//$('[data-toggle="tooltip"]').tooltip();
// bootstrap有BUG不能用这玩意
...
...
@@ -103,8 +107,13 @@ export class MyCardComponent implements OnInit {
this
.
set_update_status
(
'
update-downloaded
'
);
});
this
.
locale
=
this
.
settingsService
.
getLocale
();
this
.
update_settings
();
}
update_settings
()
{
this
.
locale
=
this
.
settingsService
.
getLocale
();
this
.
importEnabled
=
this
.
settingsService
.
getImportEnabled
();
this
.
closeToTray
=
this
.
settingsService
.
getCloseToTray
();
}
update_retry
()
{
...
...
@@ -159,14 +168,23 @@ export class MyCardComponent implements OnInit {
}
submit
()
{
this
.
settingsService
.
setImportEnabled
(
this
.
importEnabled
);
this
.
settingsService
.
setCloseToTray
(
this
.
closeToTray
);
if
(
this
.
locale
!==
this
.
settingsService
.
getLocale
())
{
localStorage
.
setItem
(
SettingsService
.
SETTING_LOCALE
,
this
.
locale
);
this
.
settingsService
.
setLocale
(
this
.
locale
);
remote
.
app
.
relaunch
();
remote
.
app
.
quit
();
}
$
(
'
#settings-modal
'
).
modal
(
'
hide
'
);
}
closeWindow
()
{
if
(
this
.
closeToTray
)
this
.
currentWindow
.
hide
();
else
remote
.
app
.
quit
();
}
//
// moesound_loaded() {
// this.moesound.nativeElement.insertCSS(`
...
...
app/settings.sevices.ts
View file @
640276a3
...
...
@@ -21,10 +21,14 @@ export class SettingsService {
},
];
static
SETTING_LOCALE
=
'
locale
'
;
static
IMPORT_ENABLED
=
'
importEnabled
'
;
static
CLOSE_TO_TRAY
=
'
closeToTray
'
;
static
defaultLocale
=
remote
.
app
.
getLocale
();
locale
:
string
;
libraries
:
Library
[];
importEnabled
:
boolean
;
closeToTray
:
boolean
;
getLibraries
()
{
...
...
@@ -92,4 +96,41 @@ export class SettingsService {
this
.
locale
=
locale
;
localStorage
.
setItem
(
SettingsService
.
SETTING_LOCALE
,
locale
);
}
getImportEnabled
():
boolean
{
if
(
this
.
importEnabled
===
undefined
)
{
let
importEnabled
=
localStorage
.
getItem
(
SettingsService
.
IMPORT_ENABLED
);
if
(
!
importEnabled
)
{
this
.
importEnabled
=
false
;
localStorage
.
setItem
(
SettingsService
.
IMPORT_ENABLED
,
'
false
'
);
}
else
{
this
.
importEnabled
=
importEnabled
===
'
true
'
;
}
}
return
this
.
importEnabled
;
}
setImportEnabled
(
enabled
:
boolean
)
{
this
.
importEnabled
=
enabled
;
localStorage
.
setItem
(
SettingsService
.
IMPORT_ENABLED
,
enabled
?
'
true
'
:
'
false
'
);
}
getCloseToTray
():
boolean
{
if
(
this
.
closeToTray
===
undefined
)
{
let
closeToTray
=
localStorage
.
getItem
(
SettingsService
.
CLOSE_TO_TRAY
);
if
(
!
closeToTray
)
{
this
.
closeToTray
=
true
;
localStorage
.
setItem
(
SettingsService
.
CLOSE_TO_TRAY
,
'
true
'
);
}
else
{
this
.
closeToTray
=
closeToTray
===
'
true
'
;
}
}
return
this
.
closeToTray
;
}
setCloseToTray
(
enabled
:
boolean
)
{
this
.
closeToTray
=
enabled
;
localStorage
.
setItem
(
SettingsService
.
CLOSE_TO_TRAY
,
enabled
?
'
true
'
:
'
false
'
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment