Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

增加两个按钮【如图】 #60

Merged
merged 2 commits into from
Dec 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/renderer/components/LocaleChangerSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@
v-model="editedItem.exec"
:label="$t('executionType')"
:rules="[noLineBreakRule]"
append-icon="mdi-dots-horizontal"
@click:append="requestPath('*.exe')"
></v-textarea>
</v-col>
</v-row>
Expand Down Expand Up @@ -126,6 +128,9 @@ import {
import {
ipcRenderer
} from 'electron'
import {
join
} from 'path'
import IpcTypes from '../../common/IpcTypes'

type TempLocaleChangerItem = yuki.Config.LocaleChangerItem & {
Expand Down Expand Up @@ -185,6 +190,17 @@ export default class LocaleChangerSettings extends Vue {
}
}

public requestPath (filename: string) {
ipcRenderer.once(
IpcTypes.HAS_PATH_WITH_FILE,
(event: Electron.Event, path: string) => {
this.editedItem.exec = join(
'"'+path+'"' + ' %GAME_PATH%'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

path加双引号避免程序文件夹带有空格而无法执行

)
}
)
ipcRenderer.send(IpcTypes.REQUEST_PATH_WITH_FILE, filename)
}
public closeDialog () {
this.showDialog = false
}
Expand Down
53 changes: 42 additions & 11 deletions src/translator/components/TranslatePage.vue
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
<template>
<div class="three-columns">
<v-btn
text
icon
large
dark
v-if="isPreviousTextValid"
@click="goToPreviousText"
class="navigation-button"
>
<v-icon dark>mdi-chevron-left</v-icon>
</v-btn>
<div v-if="isPreviousTextValid" class="navigation-button">
<v-btn text icon large dark @click="goToPreviousText">
<v-icon dark>mdi-chevron-left</v-icon>
</v-btn>

<v-btn text icon large dark @click="incTextSize">
<v-icon dark>mdi-format-font-size-increase</v-icon>
</v-btn>
<v-btn text icon large dark @click="decTextSize">
<v-icon dark>mdi-format-font-size-decrease</v-icon>
</v-btn>
</div>
<div class="navigation-button" v-else></div>

<v-container style="flex: 1;">
Expand Down Expand Up @@ -89,6 +90,9 @@ export default class TranslatePage extends Vue {
@namespace('Config').Getter('getOriginalText')
public getOriginalText!: () => yuki.FontStyle

@(namespace("Config").Getter("getTranslationText"))
public getTranslationText!: () => yuki.TranslationTextStyle

@namespace('Hooks').State('isMecabEnable')
public isMecabEnable!: boolean

Expand All @@ -100,6 +104,21 @@ export default class TranslatePage extends Vue {
get originalTextSize () {
return this.getOriginalText().fontSize
}
set originalTextSize(size: number) {
this.$store.commit("Config/SET_ORIGINAL_TEXT_SIZE", {
size
})
this.$store.commit('Config/SAVE_GUI_CONFIG')
}
get translationTextSize() {
return this.getTranslationText().fontSize;
}
set translationTextSize(size: number) {
this.$store.commit("Config/SET_TRANSLATION_TEXT_SIZE", {
size
})
this.$store.commit('Config/SAVE_GUI_CONFIG')
}

get currentOriginText () {
return this.getTextByHandleAndId(
Expand Down Expand Up @@ -154,6 +173,18 @@ export default class TranslatePage extends Vue {
this.idOffset++
}
}
public incTextSize() {
if (this.originalTextSize < 36)
this.originalTextSize = this.originalTextSize + 1
if (this.translationTextSize < 36)
this.translationTextSize = this.translationTextSize + 1
}
public decTextSize() {
if (this.originalTextSize > 1)
this.originalTextSize = this.originalTextSize - 1
if (this.translationTextSize > 1)
this.translationTextSize = this.translationTextSize - 1
}

public beforeRouteEnter (to: Route, from: Route, next: () => void) {
const newHeight = document.body.offsetHeight + 24
Expand Down