From eb04e50ac133361d1225820d21c0ea0d72240cc8 Mon Sep 17 00:00:00 2001 From: xiepengfei Date: Thu, 17 Oct 2024 15:01:09 +0800 Subject: [PATCH] fix: Modify the interface style Modify the interface style Bug: https://pms.uniontech.com/bug-view-277187.html Log: Modify the interface style --- src/common/VNoteMainManager.cpp | 1 + src/common/VNoteMainManager.h | 1 + src/common/jscontent.cpp | 5 +++++ src/common/jscontent.h | 3 +++ src/common/webrichetextmanager.cpp | 4 ++++ src/common/webrichetextmanager.h | 1 + src/gui/mainwindow/FolderListView.qml | 5 ++++- src/gui/mainwindow/ItemListView.qml | 6 +++--- src/gui/mainwindow/MainWindow.qml | 4 ++-- src/gui/mainwindow/RecordingView.qml | 6 +++--- src/gui/mainwindow/WebEngineView.qml | 13 +++++++++++++ src/gui/mainwindow/WindowTitleBar.qml | 4 ++++ src/web/css/dark.css | 16 ++++++++++++++-- src/web/css/voiceplayback.css | 12 ------------ src/web/index.css | 4 ++-- src/web/index.js | 5 ++++- 16 files changed, 64 insertions(+), 26 deletions(-) diff --git a/src/common/VNoteMainManager.cpp b/src/common/VNoteMainManager.cpp index 7c077bc8..a5456611 100644 --- a/src/common/VNoteMainManager.cpp +++ b/src/common/VNoteMainManager.cpp @@ -64,6 +64,7 @@ void VNoteMainManager::initConnections() connect(m_richTextManager, &WebRichTextManager::needUpdateNote, this, &VNoteMainManager::needUpdateNote); connect(m_richTextManager, &WebRichTextManager::noteTextChanged, this, &VNoteMainManager::onNoteChanged, Qt::QueuedConnection); connect(m_richTextManager, &WebRichTextManager::updateSearch, this, &VNoteMainManager::updateSearch); + connect(m_richTextManager, &WebRichTextManager::scrollChange, this, &VNoteMainManager::scrollChange); connect(VoiceRecoderHandler::instance(), &VoiceRecoderHandler::finishedRecod, this, &VNoteMainManager::insertVoice); } diff --git a/src/common/VNoteMainManager.h b/src/common/VNoteMainManager.h index 198aaddd..ee7bce78 100644 --- a/src/common/VNoteMainManager.h +++ b/src/common/VNoteMainManager.h @@ -62,6 +62,7 @@ class VNoteMainManager : public QObject void moveFinished(const QVariantList &index, const int &srcFolderIndex, const int &dstFolderIndex); void needUpdateNote(); void updateRichTextSearch(const QString &key); + void scrollChange(const bool &isTop); private slots: void onVNoteFoldersLoaded(); diff --git a/src/common/jscontent.cpp b/src/common/jscontent.cpp index 3c9767a5..bd1e3892 100644 --- a/src/common/jscontent.cpp +++ b/src/common/jscontent.cpp @@ -160,6 +160,11 @@ QString JsContent::jsCallDivTextTranslation() return doc.toJson(QJsonDocument::Compact); } +void JsContent::jsCallScrollChange(int scrollTop) +{ + emit scrollTopChange(scrollTop == 0); +} + /** @brief Js前端调用停止播放 */ diff --git a/src/common/jscontent.h b/src/common/jscontent.h index 018e3b44..d9fad331 100644 --- a/src/common/jscontent.h +++ b/src/common/jscontent.h @@ -94,6 +94,8 @@ class JsContent : public QObject void callJsSetFontList(const QStringList &list, const QString &font); void getfontinfo(); //获取字体列表信息信号 + void scrollTopChange(const bool &isTop); + protected: JsContent(); @@ -113,6 +115,7 @@ public slots: void jsCallSetClipData(const QString &text, const QString &html); //web前端调用后端,设置剪切板内容 QString jsCallGetTranslation(); //web前端调用后端,获取翻译 QString jsCallDivTextTranslation(); // web前端调用后端,获取动态组件翻译 + void jsCallScrollChange(int scrollTop); void jsCallPlayVoiceStop(); // web前端调用后端,停止播放 void jsCallVoiceProgressChange(qint64 progressMs); // web前端调用后端,变更播放进度 void onClipChange(QClipboard::Mode mode); diff --git a/src/common/webrichetextmanager.cpp b/src/common/webrichetextmanager.cpp index d0e9a144..44822cb2 100644 --- a/src/common/webrichetextmanager.cpp +++ b/src/common/webrichetextmanager.cpp @@ -30,6 +30,10 @@ void WebRichTextManager::initConnect() m_textChange = true; emit noteTextChanged(); }); + + connect(JsContent::instance(), &JsContent::scrollTopChange, this, [=](bool isTop){ + emit scrollChange(isTop); + }); } void WebRichTextManager::setData(VNoteItem *data, const QString reg) diff --git a/src/common/webrichetextmanager.h b/src/common/webrichetextmanager.h index 0ca4562d..ce92d80c 100644 --- a/src/common/webrichetextmanager.h +++ b/src/common/webrichetextmanager.h @@ -34,6 +34,7 @@ public slots: void needUpdateNote(); void noteTextChanged(); void updateSearch(); + void scrollChange(const bool &isTop); private: void setData(VNoteItem *data, const QString reg); diff --git a/src/gui/mainwindow/FolderListView.qml b/src/gui/mainwindow/FolderListView.qml index faa236de..6ed3cfa3 100644 --- a/src/gui/mainwindow/FolderListView.qml +++ b/src/gui/mainwindow/FolderListView.qml @@ -210,7 +210,7 @@ Item { property bool isRename: false property var startMove: [-1, -1] - color: index === folderListView.currentIndex ? "#33000000" : (isHovered ? "#1A000000" : "transparent") + color: index === folderListView.currentIndex ? (root.activeFocus ? "#1F6DE4" : DTK.themeType === ApplicationHelper.LightType ? "#33000000" : "#33FFFFFF") : (isHovered ? (DTK.themeType === ApplicationHelper.LightType ? "#1A000000" : "#1AFFFFFF") : "transparent") enabled: folderListView.enabled height: itemHeight radius: 6 @@ -231,6 +231,7 @@ Item { break; case Qt.Key_Escape: isRename = false; + root.forceActiveFocus(); break; default: break; @@ -330,6 +331,7 @@ Item { id: folderNameLabel Layout.fillWidth: true + color: index === folderListView.currentIndex ? (root.activeFocus ? "white" : (DTK.themeType === ApplicationHelper.LightType ? "black" : "#B2FFFFFF")) : (DTK.themeType === ApplicationHelper.LightType ? "black" : "#B2FFFFFF") elide: Text.ElideRight font.pixelSize: 14 horizontalAlignment: Text.AlignLeft @@ -342,6 +344,7 @@ Item { id: folderCountLabel Layout.rightMargin: 10 + color: folderNameLabel.color font.pixelSize: 14 horizontalAlignment: Text.AlignRight text: model.count diff --git a/src/gui/mainwindow/ItemListView.qml b/src/gui/mainwindow/ItemListView.qml index 64f13b09..5168bade 100644 --- a/src/gui/mainwindow/ItemListView.qml +++ b/src/gui/mainwindow/ItemListView.qml @@ -344,7 +344,7 @@ Item { property bool isSelected: false property var startMove: [-1, -1] - color: isSelected ? "#FF1F6EE7" : (DTK.themeType === ApplicationHelper.LightType ? "white" : "#212944") + color: isSelected ? (rootItem.activeFocus ? "#FF1F6EE7" : (DTK.themeType === ApplicationHelper.LightType ? "#33000000" : "#33FFFFFF")) : (DTK.themeType === ApplicationHelper.LightType ? "white" : "#202944") height: isSearch ? 67 : 50 radius: 6 width: itemListView.width @@ -385,7 +385,7 @@ Item { Label { id: noteNameLabel - color: isSelected ? "white" : (DTK.themeType === ApplicationHelper.LightType ? "black" : "white") + color: DTK.themeType === ApplicationHelper.LightType ? (isSelected ? (rootItem.activeFocus ? "white" : "black") : "black") : "white" font.pixelSize: 14 height: 18 horizontalAlignment: Text.AlignHLeft @@ -397,7 +397,7 @@ Item { Label { id: timeLabel - color: isSelected ? "#7FFFFFFF" : (DTK.themeType === ApplicationHelper.LightType ? "#7F000000" : "#7FFFFFFF") + color: isSelected ? (rootItem.activeFocus ? "#7FFFFFFF" : DTK.themeType === ApplicationHelper.LightType ? "#7F000000" : "#7FFFFFFF") : (DTK.themeType === ApplicationHelper.LightType ? "#7F000000" : "#7FFFFFFF") font.pixelSize: 10 height: 15 horizontalAlignment: Text.AlignHLeft diff --git a/src/gui/mainwindow/MainWindow.qml b/src/gui/mainwindow/MainWindow.qml index 89364064..dabce7b3 100644 --- a/src/gui/mainwindow/MainWindow.qml +++ b/src/gui/mainwindow/MainWindow.qml @@ -244,7 +244,7 @@ ApplicationWindow { Layout.fillHeight: true//#F2F6F8 Layout.preferredWidth: leftViewWidth - color: DTK.themeType === ApplicationHelper.LightType ? "#EBF6FF" : "#101010" + color: DTK.themeType === ApplicationHelper.LightType ? "#EBF6FF" : "#2E1F60" ColumnLayout { anchors.bottomMargin: 10 @@ -360,7 +360,7 @@ ApplicationWindow { Layout.fillHeight: true Layout.preferredWidth: leftViewWidth - color: DTK.themeType === ApplicationHelper.LightType ? "#F1F5F8" : "#D9000000" + color: DTK.themeType === ApplicationHelper.LightType ? "#F1F5F8" : "#14183A" onWidthChanged: { if (!leftBgArea.visible) { diff --git a/src/gui/mainwindow/RecordingView.qml b/src/gui/mainwindow/RecordingView.qml index 3011cd8e..81770c18 100644 --- a/src/gui/mainwindow/RecordingView.qml +++ b/src/gui/mainwindow/RecordingView.qml @@ -24,9 +24,9 @@ Item { Rectangle { anchors.fill: parent - border.color: "#0A000000" + border.color: DTK.themeType === ApplicationHelper.LightType ? "#0A000000" : "#19FFFFFF" border.width: 1 - color: "#7FF4F4F4" + color: DTK.themeType === ApplicationHelper.LightType ? "#7FF4F4F4" : "#0A0A10" radius: 12 } @@ -57,7 +57,7 @@ Item { width: 180 } - Text { + Label { id: duation text: time diff --git a/src/gui/mainwindow/WebEngineView.qml b/src/gui/mainwindow/WebEngineView.qml index f702a2df..0f598365 100644 --- a/src/gui/mainwindow/WebEngineView.qml +++ b/src/gui/mainwindow/WebEngineView.qml @@ -16,6 +16,7 @@ import "../dialog" Item { id: rootItem + property bool hasScroll: false property bool noSearchResult: false property bool webVisible: true @@ -62,6 +63,7 @@ Item { id: columnLayout anchors.fill: parent + spacing: 0 WindowTitleBar { id: title @@ -150,6 +152,14 @@ Item { } } + + Rectangle { + anchors.top: webRect.top + border.width: 0 + color: hasScroll ? (DTK.themeType === ApplicationHelper.LightType ? "#0C000000" : "#0CFFFFFF") : "transparent" + height: 1 + width: parent.width + } } Loader { @@ -329,6 +339,9 @@ Item { VNoteMainManager.updateNoteWithResult(result); }); } + onScrollChange: isTop => { + hasScroll = !isTop; + } onUpdateRichTextSearch: key => { webView.findText(key); } diff --git a/src/gui/mainwindow/WindowTitleBar.qml b/src/gui/mainwindow/WindowTitleBar.qml index 826093c8..c0cb15aa 100644 --- a/src/gui/mainwindow/WindowTitleBar.qml +++ b/src/gui/mainwindow/WindowTitleBar.qml @@ -14,9 +14,13 @@ TitleBar { signal insertImage signal startRecording + enableInWindowBlendBlur: false height: 40 width: 0 + background: Rectangle { + color: DTK.themeType === ApplicationHelper.LightType ? "white" : "black" + } menu: Menu { width: 200 x: 0 diff --git a/src/web/css/dark.css b/src/web/css/dark.css index 76307294..f7896679 100644 --- a/src/web/css/dark.css +++ b/src/web/css/dark.css @@ -72,7 +72,7 @@ strike[style="text-decoration-line: underline;"] { color: rgba(192, 198, 212, 1); } -.icon-backcolor .path5 { +.icon-backcolor .path2 { color: rgb(255, 255, 255, .2); } @@ -123,8 +123,20 @@ body::-webkit-scrollbar-thumb:active, /********** 悬浮语言播放控件 **********/ .airVoicePlaybackContainer .voicePlayback { - background: #09090F !important; + background: #171623 !important; border: 1px solid rgb(255, 255, 255, 0.05); outline: 1px solid rgb(0, 0, 0, 0.6); box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1); } + +.voicePlayback .voiceBtn { + background-image: url('../img/audio_file_play/Normal/Dark.svg'); +} + +.voicePlayback .voiceBtn:hover { + background-image: url('../img/audio_file_play/Hover/Dark.svg'); +} + +.voicePlayback .voiceBtn:active { + background-image: url('../img/audio_file_play/Pressed/Dark.svg'); +} \ No newline at end of file diff --git a/src/web/css/voiceplayback.css b/src/web/css/voiceplayback.css index 07724d3e..d1abd323 100644 --- a/src/web/css/voiceplayback.css +++ b/src/web/css/voiceplayback.css @@ -322,26 +322,14 @@ background-image: url('../img/audio_file_play/Normal/Light.svg'); } -.body.dark .voicePlayback .voiceBtn { - background-image: url('../img/audio_file_play/Normal/Dark.svg'); -} - .voicePlayback .voiceBtn:hover { background-image: url('../img/audio_file_play/Hover/Light.svg'); } -.body.dark .voicePlayback .voiceBtn:hover { - background-image: url('../img/audio_file_play/Hover/Dark.svg'); -} - .voicePlayback .voiceBtn:active { background-image: url('../img/audio_file_play/Pressed/Light.svg'); } -.body.dark .voicePlayback .voiceBtn:active { - background-image: url('../img/audio_file_play/Pressed/Dark.svg'); -} - /* 播放状态的播放暂停按钮 */ .voicePlayback.play .voiceBtn { background-image: none; diff --git a/src/web/index.css b/src/web/index.css index ecfe78e9..c1aa1c66 100644 --- a/src/web/index.css +++ b/src/web/index.css @@ -9,7 +9,7 @@ body { line-height: 1.72; font-family: 'Helvetica'; background-color: var(--backgroundColor); - color: rgba(65, 77, 104, 1); + color: rgba(0, 0, 0, 1); word-wrap: break-word; } @@ -189,4 +189,4 @@ strike { strike[style="text-decoration-line: underline;"] { text-decoration-color: transparent !important; border-bottom: 1px solid rgba(65, 77, 104, 1); -} \ No newline at end of file +} diff --git a/src/web/index.js b/src/web/index.js index ab0f4904..1859844d 100644 --- a/src/web/index.js +++ b/src/web/index.js @@ -1305,6 +1305,9 @@ function resetScroll() { // 监听滚动事件 $(document).scroll(function () { + var scrollTopDistance = $(document).scrollTop(); + webobj.jsCallScrollChange(scrollTopDistance); + if (scrollHide) { clearTimeout(scrollHide) $('#scrollStyle').html(` @@ -1568,4 +1571,4 @@ function toggleVoiceToTextState(translateHeader) { } } -/***** 语音转文本相关函数 end *****/ \ No newline at end of file +/***** 语音转文本相关函数 end *****/