Skip to content

Commit

Permalink
Merge pull request #80 from dacoaster/issue-77
Browse files Browse the repository at this point in the history
Issue 77
  • Loading branch information
dacoaster authored Sep 1, 2023
2 parents 4c52b7c + 1068602 commit 34e08c2
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 17 deletions.
75 changes: 58 additions & 17 deletions src/components/ControlPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
block
:color="currentTheme.primary"
:style="{ color: currentTheme.white }"
@click="deleteConfirmDialog = true"
@click="handleDeleteConfirmDialog()"
>
<v-icon left>mdi-delete</v-icon> {{ $tc("caption.delete", 1) }}
</v-btn>
Expand Down Expand Up @@ -92,7 +92,7 @@
</template>
<v-card tile>
<v-list dense>
<v-list-item @click="exportItems">
<v-list-item @click="exportItems()">
<v-list-item-icon class="mr-4">
<v-icon>mdi-download</v-icon>
</v-list-item-icon>
Expand Down Expand Up @@ -145,7 +145,7 @@
small
color="default"
v-on="on"
@click="resume"
@click="resume()"
>
<v-icon v-if="$vuetify.theme.dark === false">
mdi-play-circle
Expand All @@ -166,7 +166,7 @@
small
color="default"
v-on="on"
@click="newSessionDialog = true"
@click="handleNewSessionDialog()"
>
<v-icon v-if="$vuetify.theme.dark === false">
mdi-content-save
Expand All @@ -186,7 +186,7 @@
small
color="default"
v-on="on"
@click="resetConfirmDialog = true"
@click="handleResetConfirmDialog()"
>
<v-icon v-if="$vuetify.theme.dark === false">
mdi-close-circle
Expand Down Expand Up @@ -521,7 +521,7 @@
small
color="default"
v-on="on"
@click="minimize"
@click="minimize()"
>
<img
v-if="$vuetify.theme.dark === false"
Expand Down Expand Up @@ -635,44 +635,51 @@
:sources="sources"
:sourceId="sourceId"
:loaded="loaded"

:configItem="config"
@submit-source="startSession"
@submit-source="startSession()"
/>
<NoteDialog
v-model="noteDialog"
ref="noteDialog"
:configItem="config"
:credentialItems="credentials"
@submit-note="addNote"
@submit-note="addNote()"
/>
<SummaryDialog
ref="summaryDialog"
v-model="summaryDialog"
:configItem="config"
:credentialItems="credentials"
:summary="summary"
@submit-summary="addSummary"
@submit-summary="addSummary()"
/>
<DeleteConfirmDialog
v-model="deleteConfirmDialog"
ref="deleteConfirmDialog"
:text="$t('message.confirm_delete')"
:configItem="config"
@confirm="deleteItems"
@confirm="deleteItems()"
@cancel="deleteConfirmDialog = false"
/>
<ResetConfirmDialog
v-model="resetConfirmDialog"
ref="resetConfirmDialog"
:text="$t('message.confirm_reset')"
:configItem="config"
@confirm="resetSession"
@confirm="resetSession()"
@cancel="resetConfirmDialog = false"
/>
<SaveConfirmDialog
v-model="saveConfirmDialog"
ref="saveConfirmDialog"
:text="$t('message.confirm_session_saved')"
:configItem="config"
@confirm="saveConfirmDialog = false"
@confirm="handleSaveConfirmDialog()"
/>
<NewSessionDialog
v-model="newSessionDialog"
ref="newSessionDialog"
:text="$t('message.confirm_save_progress')"
:configItem="config"
@save="saveSession(callback)"
Expand All @@ -682,8 +689,8 @@
v-model="durationConfirmDialog"
:text="$t('message.confirm_proceed_session_time')"
:configItem="config"
@end="end"
@proceed="proceed"
@end="end()"
@proceed="proceed()"
/>
<AudioErrorDialog
v-model="audioErrorDialog"
Expand All @@ -695,7 +702,7 @@
v-model="endSessionDialog"
:configItem="config"
:post-session-data="postSessionData"
@proceed="closeEndSessionDialog"
@proceed="closeEndSessionDialog()"
/>
</div>
</v-container>
Expand Down Expand Up @@ -978,12 +985,14 @@ export default {
// new session
window.ipc.on("NEW_SESSION", () => {
this.callback = () => this.clearSession();
this.newSessionDialog = true;
this.handleNewSessionDialog();
});
// save session
window.ipc.on("SAVE_SESSION", () => {
this.saveSession(() => (this.saveConfirmDialog = true));
this.saveSession(() => {
this.handleSaveConfirmDialog();
});
});
// reset session
Expand Down Expand Up @@ -1100,6 +1109,12 @@ export default {
}
});
},
handleNewSessionDialog() {
this.newSessionDialog = true;
setTimeout(() => {
this.$refs.newSessionDialog.$refs.confirmBtn.$el.focus();
}, 100);
},
startNewSession() {
this.$root.$emit("start-new-session");
if (!this.checkedStatusOfPreSessionTask) {
Expand All @@ -1109,6 +1124,18 @@ export default {
this.$store.commit("setQuickTest", false);
this.showSourcePickerDialog();
},
handleResetConfirmDialog() {
this.resetConfirmDialog = true;
setTimeout(() => {
this.$refs.resetConfirmDialog.$refs.confirmBtn.$el.focus();
}, 100);
},
handleSaveConfirmDialog() {
this.saveConfirmDialog = true;
setTimeout(() => {
this.$refs.saveConfirmDialog.$refs.confirmBtn.$el.focus();
}, 100);
},
fetchSources() {
return new Promise(function (resolver, reject) {
if (!window.ipc) return reject();
Expand Down Expand Up @@ -1148,6 +1175,10 @@ export default {
showNoteDialog() {
if (this.viewMode === "normal") {
this.noteDialog = true;
// settimeout
setTimeout(() => {
this.$refs.noteDialog.$refs.comment.editor.commands.focus();
});
} else {
if (!window.ipc) return;
window.ipc.invoke(IPC_HANDLERS.WINDOW, {
Expand All @@ -1166,6 +1197,12 @@ export default {
hideNoteDialog() {
this.noteDialog = false;
},
handleDeleteConfirmDialog() {
this.deleteConfirmDialog = true;
setTimeout(() => {
this.$refs.deleteConfirmDialog.$refs.confirmBtn.$el.focus();
}, 100);
},
startInterval() {
console.log("start interval");
if (!this.interval) {
Expand Down Expand Up @@ -1296,6 +1333,10 @@ export default {
showSummaryDialog() {
if (this.viewMode === "normal") {
this.summaryDialog = true;
setTimeout(() => {
this.$refs.summaryDialog.$refs.comment.editor.commands.focus();
}, 200);
} else {
if (!window.ipc) return;
window.ipc.invoke(IPC_HANDLERS.WINDOW, {
Expand Down
1 change: 1 addition & 0 deletions src/components/NotesWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,7 @@ export default {
this.emojiMenu[`menu-${item.id}`] = false;
});
this.fetchNotes();
this.$refs.notes.editor.commands.focus();
},
methods: {
async fetchNotes() {
Expand Down
1 change: 1 addition & 0 deletions src/components/TestWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
</div>
<v-text-field
:placeholder="$t('message.enter_brief_charter_name')"
autofocus
outlined
dense
:height="35"
Expand Down
1 change: 1 addition & 0 deletions src/components/dialogs/DeleteConfirmDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<v-card-actions>
<v-btn
small
ref="confirmBtn"
:color="currentTheme.primary"
class="text-capitalize btn"
v-shortkey="confirmHotkey"
Expand Down
1 change: 1 addition & 0 deletions src/components/dialogs/NewSessionDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<v-card-actions>
<v-btn
small
ref="confirmBtn"
:color="currentTheme.primary"
class="text-capitalize btn"
:style="{ color: currentTheme.white }"
Expand Down
1 change: 1 addition & 0 deletions src/components/dialogs/ResetConfirmDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<v-card-actions>
<v-btn
small
ref="confirmBtn"
:color="currentTheme.primary"
class="text-capitalize btn"
v-shortkey="confirmHotkey"
Expand Down
1 change: 1 addition & 0 deletions src/components/dialogs/SaveConfirmDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<v-card-actions>
<v-btn
small
ref="confirmBtn"
color="currentTheme.primary"
class="text-uppercase btn"
v-shortkey="confirmHotkey"
Expand Down
3 changes: 3 additions & 0 deletions src/views/AddEvidence.vue
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,9 @@ export default {
});
});
// Focus on comment
this.$refs.comment.editor.commands.focus();
this.$root.$on("update-session", this.updateSession);
this.$root.$on("update-processing", this.updateProcessing);
this.$root.$on("save-data", this.saveData);
Expand Down

0 comments on commit 34e08c2

Please sign in to comment.