Skip to content

Commit

Permalink
fix: Fixed the initial menu issue
Browse files Browse the repository at this point in the history
  • Loading branch information
pengfeixx committed Dec 17, 2024
1 parent f175728 commit b795860
Show file tree
Hide file tree
Showing 36 changed files with 2,399 additions and 2,404 deletions.
1 change: 1 addition & 0 deletions src/deepin-voice-note.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,6 @@
<file>dsg/icons/save_note.dci</file>
<file>dsg/icons/search_no_results.dci</file>
<file>gui/dialog/ViewPictureDialog.qml</file>
<file>gui/mainwindow/TitleBarMenu.qml</file>
</qresource>
</RCC>
18 changes: 17 additions & 1 deletion src/gui/mainwindow/InitialInterface.qml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import QtQuick 2.15
import QtQuick.Layouts
import org.deepin.dtk 1.0
import VNote 1.0

Item {
id: rootWindow

property bool isLoad: true

signal createFolder
signal titleOpenSetting

function loadFinished(hasFile) {
isLoad = false;
Expand All @@ -26,6 +28,20 @@ Item {
Layout.fillWidth: true
anchors.top: rootWindow.top
height: 40

menu: TitleBarMenu {
onOpenPrivacy: {
VNoteMainManager.showPrivacy();
}
onOpenSetting: {
rootWindow.titleOpenSetting();
}
}
}

Rectangle {
anchors.fill: rootWindow
color: DTK.themeType === ApplicationHelper.LightType ? "#FFFFFF" : "#101010"
}

ColumnLayout {
Expand All @@ -43,7 +59,7 @@ Item {
width: 168
}

Text {
Label {
id: description

Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
Expand Down
18 changes: 18 additions & 0 deletions src/gui/mainwindow/MainWindow.qml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ ApplicationWindow {

}

Loader {
id: settingDlgLoader

}

Connections {
function handleFinishedFolderLoad(foldersData) {
for (var i = 0; i < foldersData.length; i++) {
Expand Down Expand Up @@ -643,6 +648,12 @@ ApplicationWindow {
onMoveNote: {
itemListView.onMoveNote();
}
onOpenSetting: {
if (settingDlgLoader.status === Loader.Null)
settingDlgLoader.setSource("../dialog/SettingDialog.qml");
if (settingDlgLoader.status === Loader.Ready)
settingDlgLoader.item.show();
}
onSaveAudio: {
itemListView.onSaveAudio();
}
Expand All @@ -667,6 +678,13 @@ ApplicationWindow {

Layout.fillHeight: true
Layout.fillWidth: true

onTitleOpenSetting: {
if (settingDlgLoader.status === Loader.Null)
settingDlgLoader.setSource("../dialog/SettingDialog.qml");
if (settingDlgLoader.status === Loader.Ready)
settingDlgLoader.item.show();
}
}
}

Expand Down
69 changes: 69 additions & 0 deletions src/gui/mainwindow/TitleBarMenu.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import QtQuick
import org.deepin.dtk 1.0
import VNote 1.0

Menu {
signal openPrivacy
signal openSetting

width: 200
x: 0
y: 0

MenuItem {
id: settingsControl

text: qsTr("Settings")

onTriggered: {
openSetting();
// if (settingDlgLoader.status === Loader.Null)
// settingDlgLoader.setSource("../dialog/SettingDialog.qml");
// if (settingDlgLoader.status === Loader.Ready)
// settingDlgLoader.item.show();
}
}

MenuItem {
id: privacyBtn

text: qsTr("Privacy Policy")

onTriggered: {
openPrivacy();
}
}

MenuSeparator {
}

ThemeMenu {
width: 200
}

MenuSeparator {
}

HelpAction {
}

AboutAction {
aboutDialog: AboutDialog {
companyLogo: "deepin-voice-note"
description: qsTr("Voice Notes is a lightweight memo tool to make text notes and voice recordings.")
productIcon: "deepin-voice-note"
productName: qsTr("Voice Note")
version: Qt.application.version
websiteLink: DTK.deepinWebsiteLink
websiteName: DTK.deepinWebsiteName

header: DialogTitleBar {
enableInWindowBlendBlur: false
}
}
}

QuitAction {
onTriggered: VNoteMainManager.forceExit()
}
}
8 changes: 5 additions & 3 deletions src/gui/mainwindow/WebEngineView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Item {

signal deleteNote
signal moveNote
signal openSetting
signal saveAudio
signal saveNote

Expand Down Expand Up @@ -79,6 +80,10 @@ Item {

Layout.fillWidth: true
imageBtnEnable: webVisible

onTitleOpenSetting: {
rootItem.openSetting();
}
}

Rectangle {
Expand Down Expand Up @@ -373,9 +378,6 @@ Item {
selectImgLoader.item.open();
}
}
onOpenPrivacy: {
VNoteMainManager.showPrivacy();
}
onStartRecording: {
VoiceRecoderHandler.startRecoder();
}
Expand Down
69 changes: 9 additions & 60 deletions src/gui/mainwindow/WindowTitleBar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@ import QtQuick
import QtQuick.Window
import QtQuick.Layouts
import org.deepin.dtk 1.0
import VNote 1.0

TitleBar {
id: titleBar

property bool imageBtnEnable: true
property bool isRecording: false
property bool recorderBtnEnable: true
property bool recordingHover: false
property bool isRecording: false

signal createNote
signal insertImage
signal openPrivacy
signal startRecording
signal titleOpenSetting

enableInWindowBlendBlur: false
height: 40
Expand All @@ -28,67 +29,15 @@ TitleBar {
parent.Layout.leftMargin = 0;
}
}
menu: Menu {
width: 200
x: 0
y: 0

MenuItem {
id: settingsControl

text: qsTr("Settings")

onTriggered: {
if (settingDlgLoader.status === Loader.Null)
settingDlgLoader.setSource("../dialog/SettingDialog.qml");
if (settingDlgLoader.status === Loader.Ready)
settingDlgLoader.item.show();
}
}

MenuItem {
id: privacyBtn

text: qsTr("Privacy Policy")
menu: TitleBarMenu {
id: tMenu

onTriggered: {
openPrivacy();
}
onOpenPrivacy: {
VNoteMainManager.showPrivacy();
}

MenuSeparator {
onOpenSetting: {
titleBar.titleOpenSetting();
}

ThemeMenu {
width: 200
}

MenuSeparator {
}

HelpAction {
}

AboutAction {
aboutDialog: AboutDialog {
companyLogo: "deepin-voice-note"
description: qsTr("Voice Notes is a lightweight memo tool to make text notes and voice recordings.")
productIcon: "deepin-voice-note"
productName: qsTr("Voice Note")
version: Qt.application.version
websiteLink: DTK.deepinWebsiteLink
websiteName: DTK.deepinWebsiteName

header: DialogTitleBar {
enableInWindowBlendBlur: false
}
}
}
}

Loader {
id: settingDlgLoader

}

ToolButton {
Expand Down
Loading

0 comments on commit b795860

Please sign in to comment.