Compare commits

...

2 Commits

Author SHA1 Message Date
wuyize 9ced807900 Merge remote-tracking branch 'origin/main' into main
# Conflicts:
#	AicsKnowledgeBase/qml/page/ContentPage.qml
2023-07-02 16:00:00 +08:00
wuyize bdfa98fed2 添加文件传输状态弹窗 2023-07-02 15:58:02 +08:00
18 changed files with 354 additions and 57 deletions

View File

@ -86,6 +86,8 @@ AppFluWindow {
} }
} }
FluFilledButton { FluFilledButton {
id: btn_login
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
//normalColor: FluColors.Green.normal //normalColor: FluColors.Green.normal
//normalColor: "#ffffff" //normalColor: "#ffffff"
@ -95,7 +97,8 @@ AppFluWindow {
"username": account.text, "username": account.text,
"password": password.text "password": password.text
} }
btn_login.disabled = true
btn_login.text = "登录中"
Request.post("login", Request.post("login",
JSON.stringify(param), JSON.stringify(param),
function (result, data) { function (result, data) {
@ -108,6 +111,8 @@ AppFluWindow {
console.log(p2) console.log(p2)
//FluApp.navigate("/"); //FluApp.navigate("/");
//window.close(); //window.close();
btn_login.disabled = false
btn_login.text = "登录"
}) })
//HttpClient.doGetRequest( //HttpClient.doGetRequest(

View File

@ -7,13 +7,14 @@ import FluentUI
import org.wangwenx190.FramelessHelper import org.wangwenx190.FramelessHelper
import "qrc:///AicsKnowledgeBase/qml/global" import "qrc:///AicsKnowledgeBase/qml/global"
import "qrc:///AicsKnowledgeBase/qml/page" import "qrc:///AicsKnowledgeBase/qml/page"
import "qrc:///AicsKnowledgeBase/qml/component"
FluWindow { FluWindow {
id: window id: window
width: 1000 width: 1000
height: 640 height: 640
FluAppBar { CustomAppBar {
id: title_bar id: title_bar
title: window.title title: window.title
@ -26,6 +27,7 @@ FluWindow {
} }
RowLayout { RowLayout {
id: tool_bar
anchors.top: parent.top anchors.top: parent.top
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: 140 anchors.rightMargin: 140
@ -38,24 +40,6 @@ FluWindow {
// anchors.fill: parent // anchors.fill: parent
// color: "red" // color: "red"
// } // }
Rectangle {
color: FluColors.White
radius: 50
width: 32
height: 32
}
Text {
Layout.margins: {
right: 10
}
text: "用户名"
}
Image {
height: 30
source: "qrc:/AicsKnowledgeBase/res/transfer.svg"
}
} }
RowLayout { RowLayout {
@ -120,6 +104,7 @@ FluWindow {
setHitTestVisible(title_bar.minimizeButton()) setHitTestVisible(title_bar.minimizeButton())
setHitTestVisible(title_bar.maximizeButton()) setHitTestVisible(title_bar.maximizeButton())
setHitTestVisible(title_bar.closeButton()) setHitTestVisible(title_bar.closeButton())
setHitTestVisible(title_bar.transferButton())
title_bar.maximizeButton.visible = true title_bar.maximizeButton.visible = true
// window.backgroundVisible = false // window.backgroundVisible = false
window.show() window.show()

View File

@ -0,0 +1,200 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Window
import QtQuick.Layouts
import FluentUI
Rectangle {
property string title: ""
property string darkText: "夜间模式"
property string minimizeText: "最小化"
property string restoreText: "向下还原"
property string maximizeText: "最大化"
property string closeText: "关闭"
property color textColor: FluTheme.dark ? "#FFFFFF" : "#000000"
property color minimizeNormalColor: Qt.rgba(0, 0, 0, 0)
property color minimizeHoverColor: FluTheme.dark ? Qt.rgba(1, 1, 1,
0.1) : Qt.rgba(
0, 0, 0, 0.06)
property color maximizeNormalColor: Qt.rgba(0, 0, 0, 0)
property color maximizeHoverColor: FluTheme.dark ? Qt.rgba(1, 1, 1,
0.1) : Qt.rgba(
0, 0, 0, 0.06)
property color closeNormalColor: Qt.rgba(0, 0, 0, 0)
property color closeHoverColor: Qt.rgba(251 / 255, 115 / 255, 115 / 255, 1)
property bool showDark: false
property bool titleVisible: true
property bool isMac: FluTools.isMacos()
property color borerlessColor: FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
property var maxClickListener: function () {
if (d.win.visibility === Window.Maximized)
d.win.visibility = Window.Windowed
else
d.win.visibility = Window.Maximized
}
property var minClickListener: function () {
d.win.visibility = Window.Minimized
}
property var closeClickListener: function () {
d.win.close()
}
property var darkClickListener: function () {
if (FluTheme.dark) {
FluTheme.darkMode = FluDarkMode.Light
} else {
FluTheme.darkMode = FluDarkMode.Dark
}
}
id: root
color: Qt.rgba(0, 0, 0, 0)
height: visible ? 44 : 0
opacity: visible
z: 65535
Item {
id: d
property var win: Window.window
property bool isRestore: win && Window.Maximized === win.visibility
property bool resizable: win
&& !(win.minimumHeight === win.maximumHeight
&& win.maximumWidth === win.minimumWidth)
}
TapHandler {
onTapped: if (tapCount === 2)
btn_maximize.clicked()
gesturePolicy: TapHandler.DragThreshold
}
DragHandler {
target: null
grabPermissions: TapHandler.CanTakeOverFromAnything
onActiveChanged: if (active) {
d.win.startSystemMove()
}
}
FluText {
text: title
anchors {
verticalCenter: parent.verticalCenter
left: isMac ? undefined : parent.left
leftMargin: isMac ? undefined : 10
horizontalCenter: isMac ? parent.horizontalCenter : undefined
}
visible: root.titleVisible
color: root.textColor
}
RowLayout {
anchors.right: parent.right
height: root.height
spacing: 0
Item {
height: 32
width: 32
Layout.rightMargin: 10
FluIconButton {
id: btn_transfer
anchors.fill: parent
onClicked: {
transferList_popup.open()
}
}
Image {
height: 18
width: 18
anchors.centerIn: parent
source: "qrc:/AicsKnowledgeBase/res/transfer.svg"
}
TransferListPopup {
id: transferList_popup
}
}
Text {
Layout.margins: {
right: 10
}
text: "用户名"
}
Rectangle {
Layout.rightMargin: 10
color: FluColors.White
radius: 50
width: 32
height: 32
}
RowLayout {
Layout.alignment: Qt.AlignVCenter
Layout.rightMargin: 5
visible: showDark
spacing: 5
FluText {
text: darkText
color: root.textColor
}
FluToggleSwitch {
id: btn_dark
checked: FluTheme.dark
clickListener: () => darkClickListener(btn_dark)
}
}
FluIconButton {
id: btn_minimize
width: 40
height: 30
iconSource: FluentIcons.ChromeMinimize
Layout.alignment: Qt.AlignTop
iconSize: 11
text: minimizeText
radius: 0
visible: !isMac
iconColor: root.textColor
color: hovered ? minimizeHoverColor : minimizeNormalColor
onClicked: minClickListener()
}
FluIconButton {
id: btn_maximize
width: 40
height: 30
iconSource: d.isRestore ? FluentIcons.ChromeRestore : FluentIcons.ChromeMaximize
color: hovered ? maximizeHoverColor : maximizeNormalColor
Layout.alignment: Qt.AlignTop
visible: d.resizable && !isMac
radius: 0
iconColor: root.textColor
text: d.isRestore ? restoreText : maximizeText
iconSize: 11
onClicked: maxClickListener()
}
FluIconButton {
id: btn_close
iconSource: FluentIcons.ChromeClose
Layout.alignment: Qt.AlignTop
text: closeText
width: 40
height: 30
visible: !isMac
radius: 0
iconSize: 10
iconColor: hovered ? Qt.rgba(1, 1, 1, 1) : root.textColor
color: hovered ? closeHoverColor : closeNormalColor
onClicked: closeClickListener()
}
}
function minimizeButton() {
return btn_minimize
}
function maximizeButton() {
return btn_maximize
}
function closeButton() {
return btn_close
}
function transferButton() {
return btn_transfer
}
}

View File

@ -0,0 +1,66 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Window
import QtQuick.Layouts
import FluentUI
Popup {
id: transfer_popup
x: parent ? (parent.width - implicitWidth) / 2 : 0
y: parent ? parent.height : 0
background: FluArea {
implicitWidth: 300
implicitHeight: 200
color: "#f8f8f8"
radius: 5
FluShadow {}
}
contentItem: Item {
anchors.top: parent.top
ListModel //-
{
id: itemModel
ListElement {
name: "Apple"
progressValue: 0.1
}
ListElement {
name: "Orange"
progressValue: 1
}
ListElement {
name: "Banana"
progressValue: 0.6
}
}
Component //-
{
id: itemDelegate
ColumnLayout {
spacing: 10
width: parent.width
Text {
Layout.topMargin: 10
text: name
}
FluProgressBar {
Layout.fillWidth: true
progress: progressValue
indeterminate: false
}
}
}
ListView //-
{
anchors.fill: parent
model: itemModel
delegate: itemDelegate
}
}
}

View File

@ -7,7 +7,7 @@ import FluentUI
FluArea { FluArea {
property string url: '' property string url: ''
color: "#f9f9f9" backgroundColor: "#f9f9f9"
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true

View File

@ -9,7 +9,7 @@ import FluentUI
FluArea { FluArea {
id: content_area id: content_area
paddings: 0 paddings: 0
color: "#f9f9f9" backgroundColor: "#f9f9f9"
property string type: null property string type: null
property int knowledgeFileId property int knowledgeFileId
signal download(string knowledgeFileId) signal download(string knowledgeFileId)

View File

@ -7,7 +7,7 @@ import FluentUI
FluArea { FluArea {
property string url: '' property string url: ''
color: "#f9f9f9" backgroundColor: "#f9f9f9"
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
paddings: 10 paddings: 10

View File

@ -7,7 +7,7 @@ import FluentUI
FluArea { FluArea {
property string url: '' property string url: ''
color: "#f9f9f9" backgroundColor: "#f9f9f9"
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
paddings: 10 paddings: 10

View File

@ -8,7 +8,7 @@ import "qrc:///AicsKnowledgeBase/qml/component"
FluArea { FluArea {
property string url: '' property string url: ''
color: "#f9f9f9" backgroundColor: "#f9f9f9"
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
@ -20,5 +20,9 @@ FluArea {
text: "" text: ""
} }
FluButton {
text: "上传"
}
FileList {} FileList {}
} }

View File

@ -7,7 +7,7 @@ import FluentUI
FluArea { FluArea {
property string url: '' property string url: ''
color: "#f9f9f9" backgroundColor: "#f9f9f9"
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
paddings: 10 paddings: 10

View File

@ -7,7 +7,7 @@ import FluentUI
FluArea { FluArea {
property string url: '' property string url: ''
color: "#f9f9f9" backgroundColor: "#f9f9f9"
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
paddings: 10 paddings: 10

View File

@ -7,7 +7,7 @@ import FluentUI
FluArea { FluArea {
property string url: '' property string url: ''
color: "#f9f9f9" backgroundColor: "#f9f9f9"
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
paddings: 10 paddings: 10

View File

@ -7,7 +7,7 @@ import FluentUI
FluArea { FluArea {
property string url: '' property string url: ''
color: "#f9f9f9" backgroundColor: "#f9f9f9"
Layout.fillHeight: true Layout.fillHeight: true
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 20 Layout.topMargin: 20

View File

@ -7,7 +7,7 @@ import FluentUI
FluArea { FluArea {
property string url: '' property string url: ''
color: "#f9f9f9" backgroundColor: "#f9f9f9"
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
paddings: 10 paddings: 10

View File

@ -0,0 +1,10 @@
//
// Created by wuyiz on 2023/7/1.
//
#include "FileTransferManager.h"
FileTransferManager::FileTransferManager(QObject *parent) : QObject(parent)
{
}

View File

@ -0,0 +1,20 @@
//
// Created by wuyiz on 2023/7/1.
//
#ifndef AICSKNOWLEDGEBASE_FILETRANSFERMANAGER_H
#define AICSKNOWLEDGEBASE_FILETRANSFERMANAGER_H
#include <QObject>
class FileTransferManager: public QObject
{
Q_OBJECT
public:
explicit FileTransferManager(QObject *parent = nullptr);
};
#endif //AICSKNOWLEDGEBASE_FILETRANSFERMANAGER_H

View File

@ -8,47 +8,54 @@
#include <FramelessHelper/Quick/framelessquickmodule.h> #include <FramelessHelper/Quick/framelessquickmodule.h>
#include <FramelessHelper/Core/private/framelessconfig_p.h> #include <FramelessHelper/Core/private/framelessconfig_p.h>
#include "HttpClient.h" #include "HttpClient.h"
#include "FileTransferManager.h"
FRAMELESSHELPER_USE_NAMESPACE FRAMELESSHELPER_USE_NAMESPACE
int main(int argc, char* argv[]) int main(int argc, char *argv[])
{ {
//将样式设置为Basic不然会导致组件显示异常 //将样式设置为Basic不然会导致组件显示异常
qputenv("QT_QUICK_CONTROLS_STYLE", "Basic"); qputenv("QT_QUICK_CONTROLS_STYLE", "Basic");
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts); QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
QtWebEngineQuick::initialize(); QtWebEngineQuick::initialize();
FramelessHelper::Quick::initialize(); FramelessHelper::Quick::initialize();
QGuiApplication app(argc, argv); QGuiApplication app(argc, argv);
app.setOrganizationName("HFUT Software"); QGuiApplication::setOrganizationName("HFUT Software");
app.setApplicationName("Aics Knowledge"); QGuiApplication::setApplicationName("Aics Knowledge");
#ifdef Q_OS_WIN // 此设置仅在Windows下生效 #ifdef Q_OS_WIN // 此设置仅在Windows下生效
FramelessConfig::instance()->set(Global::Option::ForceHideWindowFrameBorder); FramelessConfig::instance()->set(Global::Option::ForceHideWindowFrameBorder);
#endif #endif
FramelessConfig::instance()->set(Global::Option::DisableLazyInitializationForMicaMaterial); FramelessConfig::instance()->set(Global::Option::DisableLazyInitializationForMicaMaterial);
FramelessConfig::instance()->set(Global::Option::CenterWindowBeforeShow); FramelessConfig::instance()->set(Global::Option::CenterWindowBeforeShow);
FramelessConfig::instance()->set(Global::Option::ForceNonNativeBackgroundBlur); FramelessConfig::instance()->set(Global::Option::ForceNonNativeBackgroundBlur);
FramelessConfig::instance()->set(Global::Option::EnableBlurBehindWindow); FramelessConfig::instance()->set(Global::Option::EnableBlurBehindWindow);
#ifdef Q_OS_MACOS #ifdef Q_OS_MACOS
FramelessConfig::instance()->set(Global::Option::ForceNonNativeBackgroundBlur, false); FramelessConfig::instance()->set(Global::Option::ForceNonNativeBackgroundBlur, false);
#endif #endif
QQmlApplicationEngine engine; QQmlApplicationEngine engine;
FramelessHelper::Quick::registerTypes(&engine); FramelessHelper::Quick::registerTypes(&engine);
HttpClient* httpClient = new HttpClient(engine); auto httpClient = new HttpClient(engine);
auto fileTransferManager = new FileTransferManager();
qmlRegisterSingletonInstance<HttpClient>("AicsKB.HttpClient", 1, 0, "HttpClient", httpClient); qmlRegisterSingletonInstance<HttpClient>("AicsKB.HttpClient", 1, 0, "HttpClient", httpClient);
qmlRegisterSingletonInstance<FileTransferManager>("AicsKB.FileTransferManager", 1, 0, "FileTransferManager",
fileTransferManager);
const QUrl url(u"qrc:/AicsKnowledgeBase/qml/App.qml"_qs); const QUrl url(u"qrc:/AicsKnowledgeBase/qml/App.qml"_qs);
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
&app, [url](QObject* obj, const QUrl& objUrl) { &app, [url](QObject *obj, const QUrl &objUrl) {
if (!obj && url == objUrl) if (!obj && url == objUrl)
QCoreApplication::exit(-1); QCoreApplication::exit(-1);
}, Qt::QueuedConnection); }, Qt::QueuedConnection);
engine.load(url); engine.load(url);
auto result = app.exec(); auto result = QGuiApplication::exec();
httpClient->deleteLater(); httpClient->deleteLater();
fileTransferManager->deleteLater();
return result; return result;
} }

@ -1 +1 @@
Subproject commit 7b30ccfd22823c51f5ed8e3ff649737c76ae0ce6 Subproject commit 04dc772cb4f99415687d5a4292917837c39d9874