重组qml文件,使用qmldir文件实现模块化
This commit is contained in:
notify 2023-05-19 10:08:36 +08:00 committed by GitHub
parent 0d709d6a73
commit 2acec5f20a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
85 changed files with 166 additions and 356 deletions

View File

@ -65,7 +65,7 @@ jobs:
run: |
mkdir FreeKill-release
cp build/FreeKill.exe FreeKill-release
cp -r qml FreeKill-release
cp -r qml Fk FreeKill-release
cd FreeKill-release
windeployqt FreeKill.exe
cp -r ../.git .

View File

@ -3,7 +3,7 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import ".."
import Fk.RoomElement
Item {
id: root

View File

@ -3,7 +3,7 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import ".."
import Fk.RoomElement
Item {
id: root

6
Fk/Cheat/qmldir Normal file
View File

@ -0,0 +1,6 @@
module Fk.Cheat
CardDetail 1.0 CardDetail.qml
FreeAssign 1.0 FreeAssign.qml
GeneralDetail 1.0 GeneralDetail.qml
PlayerDetail 1.0 PlayerDetail.qml
SameConvert 1.0 SameConvert.qml

3
Fk/Common/qmldir Normal file
View File

@ -0,0 +1,3 @@
module Fk.Common
ChatBox 1.0 ChatBox.qml
LogEdit 1.0 LogEdit.qml

View File

@ -2,7 +2,7 @@
import QtQuick
import QtQuick.Layouts
import "../skin-bank.js" as SkinBank
import Fk
Item {
id: root
@ -49,7 +49,7 @@ Item {
TapHandler {
onTapped: {
lobby_dialog.source = "LobbyElement/EditProfile.qml";
lobby_dialog.sourceComponent = Qt.createComponent("Fk.LobbyElement", "EditProfile");
lobby_drawer.open();
}
}

9
Fk/LobbyElement/qmldir Normal file
View File

@ -0,0 +1,9 @@
module Fk.LobbyElement
AudioSetting 1.0 AudioSetting.qml
BGSetting 1.0 BGSetting.qml
CreateRoom 1.0 CreateRoom.qml
EditProfile 1.0 EditProfile.qml
PersonalSettings 1.0 PersonalSettings.qml
RoomGeneralSettings 1.0 RoomGeneralSettings.qml
RoomPackageSettings 1.0 RoomPackageSettings.qml
UserInfo 1.0 UserInfo.qml

View File

@ -3,7 +3,7 @@
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import "RoomElement"
import Fk.RoomElement
Item {
id: root

View File

@ -3,7 +3,7 @@
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import "RoomElement"
import Fk.RoomElement
Item {
id: root

View File

@ -4,8 +4,8 @@ import QtQuick
import QtQuick.Controls
import QtQuick.Window
import QtQuick.Layouts
import "LobbyElement"
import "Common"
import Fk.LobbyElement
import Fk.Common
import "Logic.js" as Logic
Item {
@ -154,7 +154,7 @@ Item {
icon.name: "media-playback-start"
text: Backend.translate("Create Room")
onClicked: {
lobby_dialog.source = "LobbyElement/CreateRoom.qml";
lobby_dialog.sourceComponent = Qt.createComponent("Fk.LobbyElement", "CreateRoom");
lobby_drawer.open();
config.observing = false;
}
@ -225,10 +225,11 @@ Item {
if (item === null)
return;
item.finished.connect(() => {
source = "";
sourceComponent = undefined;
lobby_drawer.close();
});
}
onSourceComponentChanged: sourceChanged();
}
}
@ -289,4 +290,3 @@ Item {
toast.show(Backend.translate("$WelcomeToLobby"));
}
}

View File

@ -71,4 +71,3 @@ Item {
}
}
}

View File

@ -4,10 +4,10 @@ import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import QtMultimedia
import "Common"
import "RoomElement"
import Fk
import Fk.Common
import Fk.RoomElement
import "RoomLogic.js" as Logic
import "skin-bank.js" as SkinBank
Item {
@ -100,7 +100,7 @@ Item {
from: "*"; to: "notactive"
ScriptAction {
script: {
skillInteraction.source = "";
skillInteraction.sourceComponent = undefined;
promptText = "";
progress.visible = false;
okCancel.visible = false;
@ -128,7 +128,7 @@ Item {
from: "*"; to: "playing"
ScriptAction {
script: {
skillInteraction.source = "";
skillInteraction.sourceComponent = undefined;
dashboard.enableCards();
dashboard.enableSkills();
progress.visible = true;
@ -143,7 +143,7 @@ Item {
from: "*"; to: "responding"
ScriptAction {
script: {
skillInteraction.source = "";
skillInteraction.sourceComponent = undefined;
dashboard.enableCards(responding_card);
dashboard.enableSkills(responding_card, respond_play);
autoPending = false;
@ -157,7 +157,7 @@ Item {
from: "*"; to: "replying"
ScriptAction {
script: {
skillInteraction.source = "";
skillInteraction.sourceComponent = undefined;
dashboard.disableAllCards();
dashboard.disableSkills();
progress.visible = true;
@ -435,7 +435,7 @@ Item {
if (item === null)
return;
item.finished.connect(function(){
source = "";
sourceComponent = undefined;
});
item.widthChanged.connect(function(){
popupBox.moveToCenter();
@ -445,6 +445,7 @@ Item {
});
moveToCenter();
}
onSourceComponentChanged: sourceChanged();
function moveToCenter()
{
@ -460,11 +461,12 @@ Item {
onSourceChanged: {
if (item === null)
return;
item.finished.connect(() => source = "");
item.finished.connect(() => sourceComponent = undefined);
item.widthChanged.connect(() => manualBox.moveToCenter());
item.heightChanged.connect(() => manualBox.moveToCenter());
moveToCenter();
}
onSourceComponentChanged: sourceChanged();
function moveToCenter()
{
@ -486,30 +488,30 @@ Item {
Backend.callLuaFunction("SetInteractionDataOfSkill", [skill_name, "null"]);
switch (data.type) {
case "combo":
skillInteraction.source = "RoomElement/SkillInteraction/SkillCombo.qml";
skillInteraction.sourceComponent = Qt.createComponent("Fk.SkillInteraction", "SkillCombo");
skillInteraction.item.skill = skill_name;
skillInteraction.item.default_choice = data["default"];
skillInteraction.item.choices = data.choices;
skillInteraction.item.clicked();
// skillInteraction.item.clicked();
break;
case "spin":
skillInteraction.source = "RoomElement/SkillInteraction/SkillSpin.qml";
skillInteraction.sourceComponent = Qt.createComponent("Fk.SkillInteraction", "SkillSpin");
skillInteraction.item.skill = skill_name;
skillInteraction.item.from = data.from;
skillInteraction.item.to = data.to;
break;
default:
skillInteraction.source = "";
skillInteraction.sourceComponent = undefined;
break;
}
} else {
skillInteraction.source = "";
skillInteraction.sourceComponent = undefined;
}
dashboard.startPending(skill_name);
cancelButton.enabled = true;
} else {
skillInteraction.source = "";
skillInteraction.sourceComponent = undefined;
Logic.doCancelButton();
}
}
@ -582,6 +584,7 @@ Item {
cheatDrawer.close();
});
}
onSourceComponentChanged: sourceChanged();
}
}
@ -798,8 +801,8 @@ Item {
}
}
function startCheat(source, data) {
cheatLoader.source = source;
function startCheat(type, data) {
cheatLoader.sourceComponent = Qt.createComponent("Fk.Cheat", type);
cheatLoader.item.extra_data = data;
cheatDrawer.open();
}
@ -834,4 +837,3 @@ Item {
Logic.arrangePhotos();
}
}

View File

@ -227,7 +227,7 @@ function setEmotion(id, emotion, isCardId) {
// TODO: set picture emotion
return;
}
let component = Qt.createComponent("RoomElement/PixmapAnimation.qml");
let component = Qt.createComponent("Fk.RoomElement", "PixmapAnimation");
if (component.status !== Component.Ready)
return;
@ -276,7 +276,7 @@ function changeHp(id, delta, losthp) {
}
function doIndicate(from, tos) {
let component = Qt.createComponent("RoomElement/IndicatorLine.qml");
let component = Qt.createComponent("Fk.RoomElement", "IndicatorLine");
if (component.status !== Component.Ready)
return;
@ -593,7 +593,7 @@ callbacks["AskForGeneral"] = function(jsonData) {
let heg = data[2];
roomScene.promptText = Backend.translate("#AskForGeneral");
roomScene.state = "replying";
roomScene.popupBox.source = "RoomElement/ChooseGeneralBox.qml";
roomScene.popupBox.sourceComponent = Qt.createComponent("Fk.RoomElement", "ChooseGeneralBox");
let box = roomScene.popupBox.item;
box.accepted.connect(() => {
replyToServer(JSON.stringify(box.choices));
@ -626,7 +626,7 @@ callbacks["AskForGuanxing"] = function(jsonData) {
let min_bottom_cards = data.min_bottom_cards;
let max_bottom_cards = data.max_bottom_cards;
roomScene.state = "replying";
roomScene.popupBox.source = "RoomElement/GuanxingBox.qml";
roomScene.popupBox.sourceComponent = Qt.createComponent("Fk.RoomElement", "GuanxingBox");
data.cards.forEach(id => {
let d = Backend.callLuaFunction("GetCardData", [id]);
cards.push(JSON.parse(d));
@ -662,7 +662,7 @@ callbacks["AskForChoice"] = function(jsonData) {
roomScene.promptText = processPrompt(prompt);
}
roomScene.state = "replying";
roomScene.popupBox.source = "RoomElement/ChoiceBox.qml";
roomScene.popupBox.sourceComponent = Qt.createComponent("Fk.RoomElement", "ChoiceBox");
let box = roomScene.popupBox.item;
box.options = choices;
box.skill_name = skill_name;
@ -701,7 +701,7 @@ callbacks["AskForCardChosen"] = function(jsonData) {
roomScene.promptText = Backend.translate("#AskForChooseCard")
.arg(Backend.translate(reason));
roomScene.state = "replying";
roomScene.popupBox.source = "RoomElement/PlayerCardBox.qml";
roomScene.popupBox.sourceComponent = Qt.createComponent("Fk.RoomElement", "PlayerCardBox");
let box = roomScene.popupBox.item;
box.addHandcards(handcards);
box.addEquips(equips);
@ -744,7 +744,7 @@ callbacks["AskForCardsChosen"] = function(jsonData) {
roomScene.promptText = Backend.translate("#AskForChooseCard")
.arg(Backend.translate(reason));
roomScene.state = "replying";
roomScene.popupBox.source = "RoomElement/PlayerCardBox.qml";
roomScene.popupBox.sourceComponent = Qt.createComponent("Fk.RoomElement", "PlayerCardBox");
let box = roomScene.popupBox.item;
box.multiChoose = true;
box.min = min;
@ -933,7 +933,7 @@ callbacks["Animate"] = function(jsonData) {
}
case "InvokeSkill": {
let id = data.player;
let component = Qt.createComponent("RoomElement/SkillInvokeAnimation.qml");
let component = Qt.createComponent("Fk.RoomElement", "SkillInvokeAnimation");
if (component.status !== Component.Ready)
return;
@ -997,7 +997,7 @@ callbacks["LogEvent"] = function(jsonData) {
callbacks["GameOver"] = function(jsonData) {
roomScene.state = "notactive";
roomScene.popupBox.source = "RoomElement/GameOverBox.qml";
roomScene.popupBox.sourceComponent = Qt.createComponent("Fk.RoomElement", "GameOverBox");
let box = roomScene.popupBox.item;
box.winner = jsonData;
roomScene.isStarted = false;
@ -1006,7 +1006,7 @@ callbacks["GameOver"] = function(jsonData) {
callbacks["FillAG"] = (j) => {
let data = JSON.parse(j);
let ids = data[0];
roomScene.manualBox.source = "RoomElement/AG.qml";
roomScene.manualBox.sourceComponent = Qt.createComponent("Fk.RoomElement", "AG");
roomScene.manualBox.item.addIds(ids);
}

View File

@ -2,7 +2,7 @@
import QtQuick
import Qt5Compat.GraphicalEffects
import "skin-bank.js" as SkinBank
import Fk
Item {
property alias text: labelText.text

12
Fk/Pages/qmldir Normal file
View File

@ -0,0 +1,12 @@
module Fk.Pages
About 1.0 About.qml
CardsOverview 1.0 CardsOverview.qml
Danmaku 1.0 Danmaku.qml
GeneralsOverview 1.0 GeneralsOverview.qml
Init 1.0 Init.qml
Lobby 1.0 Lobby.qml
MetroButton 1.0 MetroButton.qml
ModesOverview 1.0 ModesOverview.qml
PackageManage 1.0 PackageManage.qml
Room 1.0 Room.qml
TileButton 1.0 TileButton.qml

View File

@ -1,8 +1,8 @@
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick
import ".."
import "../../skin-bank.js" as SkinBank
import Fk
import Fk.RoomElement
Item {
InvisibleCardArea {

View File

@ -1,8 +1,8 @@
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick
import ".."
import "../../skin-bank.js" as SkinBank
import Fk
import Fk.RoomElement
/* Layout of EquipArea:
* | Treasure |
@ -124,4 +124,3 @@ Column {
return area.cards;
}
}

View File

@ -1,9 +1,8 @@
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick
import ".."
import "../../../util.js" as Utility
import "../../skin-bank.js" as SkinBank
import Fk
import Fk.RoomElement
Item {
property int cid: 0

View File

@ -1,8 +1,8 @@
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick
import ".."
import "../../skin-bank.js" as SkinBank
import Fk
import Fk.RoomElement
Column {
id: root
@ -83,4 +83,3 @@ Column {
}
}
}

View File

@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick
import "../../skin-bank.js" as SkinBank
import Fk
Item {
id: root

View File

@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick
import "../../skin-bank.js" as SkinBank
import Fk
Image {
source: SkinBank.MAGATAMA_DIR + "0"
@ -57,4 +57,3 @@ Image {
anchors.centerIn: parent
}
}

View File

@ -59,7 +59,7 @@ Item {
return;
// Just for using room's right drawer
roomScene.startCheat("RoomElement/ViewPile.qml", {
roomScene.startCheat("ViewPile", {
name: mark_name,
ids: data
});

View File

@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick
import "../../skin-bank.js" as SkinBank
import Fk
Image {
property string value: "unknown"

View File

@ -1,5 +1,5 @@
import QtQuick
import "../../skin-bank.js" as SkinBank
import Fk
Image {
id: root

12
Fk/PhotoElement/qmldir Normal file
View File

@ -0,0 +1,12 @@
module Fk.PhotoElement
DelayedTrickArea 1.0 DelayedTrickArea.qml
EquipArea 1.0 EquipArea.qml
EquipItem 1.0 EquipItem.qml
HpBar 1.0 HpBar.qml
LimitSkillArea 1.0 LimitSkillArea.qml
LimitSkillItem 1.0 LimitSkillItem.qml
Magatama 1.0 Magatama.qml
MarkArea 1.0 MarkArea.qml
RoleComboBox 1.0 RoleComboBox.qml
Shield 1.0 Shield.qml
SpecialMarkArea 1.0 SpecialMarkArea.qml

View File

@ -78,4 +78,3 @@ Item {
}
}
}

View File

@ -2,7 +2,7 @@
import QtQuick
import Qt5Compat.GraphicalEffects
import "../skin-bank.js" as SkinBank
import Fk
/* Layout of card:
* +--------+
@ -70,7 +70,7 @@ Item {
onRightClicked: {
if (!showDetail) return;
roomScene.startCheat("RoomElement/Cheat/CardDetail.qml", { card: this });
roomScene.startCheat("CardDetail", { card: this });
}
RectangularGlow {

View File

@ -2,7 +2,7 @@
import QtQuick
import QtQuick.Layouts
import ".."
import Fk.Pages
GraphicsBox {
property var options: []

View File

@ -1,8 +1,8 @@
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick
import ".."
import "../skin-bank.js" as SkinBank
import Fk
import Fk.Pages
GraphicsBox {
property alias generalList: generalList
@ -91,10 +91,7 @@ GraphicsBox {
MetroButton {
id: convertBtn
text: Backend.translate("Same General Convert")
onClicked: roomScene.startCheat(
"RoomElement/Cheat/SameConvert.qml",
{ cards: generalList }
);
onClicked: roomScene.startCheat("SameConvert", { cards: generalList });
}
MetroButton {
@ -112,7 +109,7 @@ GraphicsBox {
enabled: choices.length > 0
text: Backend.translate("Show General Detail")
onClicked: roomScene.startCheat(
"RoomElement/Cheat/GeneralDetail.qml",
"GeneralDetail",
{ generals: choices }
);
}
@ -146,7 +143,7 @@ GraphicsBox {
onRightClicked: {
if (selectedItem.indexOf(this) === -1 && config.enableFreeAssign)
roomScene.startCheat("RoomElement/Cheat/FreeAssign.qml", { card: this });
roomScene.startCheat("FreeAssign", { card: this });
}
onReleased: {

View File

@ -73,7 +73,7 @@ RowLayout {
if (expanded_pile_names.indexOf(pile) !== -1)
return;
let component = Qt.createComponent("CardItem.qml");
let component = Qt.createComponent("Fk.RoomElement", "CardItem");
let parentPos = roomScene.mapFromItem(self, 0, 0);
expanded_piles[pile] = [];

View File

@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick
import ".."
import Fk.Pages
GraphicsBox {
property string winner: ""

View File

@ -2,8 +2,8 @@
import QtQuick
import Qt5Compat.GraphicalEffects
import "PhotoElement"
import "../skin-bank.js" as SkinBank
import Fk
import Fk.PhotoElement
/* Layout of general card:
* +--------+

View File

@ -2,7 +2,7 @@
import QtQuick
import QtQuick.Layouts
import ".."
import Fk.Pages
GraphicsBox {
id: root

View File

@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick
import "../../util.js" as Utility
import Fk
Item {
property alias cards: cardArea.cards

View File

@ -50,7 +50,7 @@ Item {
function remove(outputs)
{
let component = Qt.createComponent("CardItem.qml");
let component = Qt.createComponent("Fk.RoomElement", "CardItem");
if (component.status !== Component.Ready)
return [];

View File

@ -1,5 +1,5 @@
import QtQuick
import "../skin-bank.js" as SkinBank
import Fk
Item {
id: root

View File

@ -3,8 +3,8 @@
import QtQuick
import Qt5Compat.GraphicalEffects
import QtQuick.Controls
import "PhotoElement"
import "../skin-bank.js" as SkinBank
import Fk
import Fk.PhotoElement
Item {
id: root
@ -595,6 +595,6 @@ Item {
}
function showDetail() {
roomScene.startCheat("RoomElement/Cheat/PlayerDetail.qml", { photo: this });
roomScene.startCheat("PlayerDetail", { photo: this });
}
}

View File

@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick
import "../skin-bank.js" as SkinBank
import Fk
Item {
property string source: ""

View File

@ -2,7 +2,7 @@
import QtQuick
import QtQuick.Layouts
import ".."
import Fk.Pages
GraphicsBox {
id: root

View File

@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick
import "../skin-bank.js" as SkinBank
import Fk
Item {
id: root

24
Fk/RoomElement/qmldir Normal file
View File

@ -0,0 +1,24 @@
module Fk.RoomElement
AG 1.0 AG.qml
CardArea 1.0 CardArea.qml
CardItem 1.0 CardItem.qml
ChoiceBox 1.0 ChoiceBox.qml
ChooseGeneralBox 1.0 ChooseGeneralBox.qml
Dashboard 1.0 Dashboard.qml
GameOverBox 1.0 GameOverBox.qml
GeneralCardItem 1.0 GeneralCardItem.qml
GlowText 1.0 GlowText.qml
GraphicsBox 1.0 GraphicsBox.qml
GuanxingBox 1.0 GuanxingBox.qml
HandcardArea 1.0 HandcardArea.qml
IndicatorLine 1.0 IndicatorLine.qml
InvisibleCardArea 1.0 InvisibleCardArea.qml
MiscStatus 1.0 MiscStatus.qml
Photo 1.0 Photo.qml
PixmapAnimation 1.0 PixmapAnimation.qml
PlayerCardBox 1.0 PlayerCardBox.qml
SkillArea 1.0 SkillArea.qml
SkillButton 1.0 SkillButton.qml
SkillInvokeAnimation 1.0 SkillInvokeAnimation.qml
TablePile 1.0 TablePile.qml
ViewPile 1.0 ViewPile.qml

View File

@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick
import "../.."
import Fk.Pages
MetroButton {
id: root
@ -21,7 +21,7 @@ MetroButton {
}
onClicked: {
roomScene.popupBox.source = "RoomElement/ChoiceBox.qml";
roomScene.popupBox.sourceComponent = Qt.createComponent("Fk.RoomElement", "ChoiceBox");
let box = roomScene.popupBox.item;
box.options = choices;
box.accepted.connect(() => {

View File

@ -0,0 +1,3 @@
module Fk.SkillInteraction
SkillCombo 1.0 SkillCombo.qml
SkillSpin 1.0 SkillSpin.qml

View File

@ -4,7 +4,7 @@ import QtQuick
import QtQuick.Controls
import QtQuick.Window
import "Logic.js" as Logic
import "Pages"
import Fk.Pages
Window {
id: realMainWin
@ -45,12 +45,11 @@ Item {
id: mainStack
visible: !mainWindow.busy
// If error occurs during loading initialItem, the program will fall into "polish()" loop
// initialItem: OS !== "Web" ? init : webinit
// initialItem: init
anchors.fill: parent
}
Component { id: init; Init {} }
Component { id: webinit; WebInit {} }
Component { id: packageManage; PackageManage {} }
Component { id: lobby; Lobby {} }
Component { id: generalsOverview; GeneralsOverview {} }
@ -123,73 +122,6 @@ Item {
}
}
// global popup. it is modal and just lower than toast
Rectangle {
id: globalPopupDim
anchors.fill: parent
color: "black"
opacity: 0
visible: !mainWindow.busy
property bool stateVisible: false
states: [
State {
when: globalPopupDim.stateVisible
PropertyChanges { target: globalPopupDim; opacity: 0.5 }
},
State {
when: !globalPopupDim.stateVisible
PropertyChanges { target: globalPopupDim; opacity: 0.0 }
}
]
transitions: Transition {
NumberAnimation { properties: "opacity"; easing.type: Easing.InOutQuad }
}
}
Popup {
id: globalPopup
property string source: ""
modal: true
dim: false // cannot animate the dim
focus: true
opacity: mainWindow.busy ? 0 : 1
closePolicy: Popup.CloseOnEscape
anchors.centerIn: parent
onAboutToShow: {
globalPopupDim.stateVisible = true
}
enter: Transition {
NumberAnimation { properties: "opacity"; from: 0; to: 1 }
NumberAnimation { properties: "scale"; from: 0.4; to: 1 }
}
onAboutToHide: {
globalPopupDim.stateVisible = false
}
exit: Transition {
NumberAnimation { properties: "opacity"; from: 1; to: 0 }
NumberAnimation { properties: "scale"; from: 1; to: 0.4 }
}
Loader {
visible: !mainWindow.busy
source: globalPopup.source === "" ? "" : "GlobalPopups/" + globalPopup.source
onSourceChanged: {
if (item === null)
return;
item.finished.connect(() => {
globalPopup.close();
globalPopup.source = "";
});
}
}
}
Popup {
id: errDialog
property string txt: ""
@ -266,7 +198,6 @@ Item {
}
Component.onCompleted: {
if (OS !== "Web") {
mainStack.push(init);
if (!Debugging) {
splashLoader.source = "Splash.qml";
@ -274,9 +205,6 @@ Item {
splashLoader.source = "";
});
}
} else {
mainStack.push(webinit);
}
if (OS !== "Android" && OS !== "Web") {
x = config.winX;
y = config.winY;

3
Fk/qmldir Normal file
View File

@ -0,0 +1,3 @@
module Fk
SkinBank 1.0 skin-bank.js
Utility 1.0 util.js

View File

@ -27,6 +27,7 @@ cp -r ../packages/test assets/res/packages
rm assets/res/packages/test/test.lua
cp ../packages/init.sql assets/res/packages
cp -r ../qml assets/res
cp -r ../Fk assets/res
mkdir assets/res/server
cp ../server/init.sql assets/res/server
cp ../LICENSE assets/res

View File

@ -1,187 +0,0 @@
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
Item {
id: root
Item {
width: 960 * 0.8
height: 540 * 0.8
anchors.centerIn: parent
Item {
id: left
width: 300
height: parent.height
Image {
id: lady
width: parent.width + 20
height: parent.height
fillMode: Image.PreserveAspectFit
}
Image {
anchors.bottom: parent.bottom
anchors.bottomMargin: 12
width: parent.width
source: AppPath + "/image/widelogo"
}
}
Rectangle {
id: right
anchors.left: left.right
width: parent.width - left.width
height: parent.height
color: "#88EEEEEE"
radius: 16
ColumnLayout {
width: parent.width * 0.8
height: parent.height * 0.8
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
anchors.topMargin: 40
//spacing
Text {
text: qsTr("Welcome back!")
font.pixelSize: 28
Layout.alignment: Qt.AlignHCenter
}
GridLayout {
columns: 2
rowSpacing: 20
Text {
text: qsTr("Server Addr")
}
ComboBox {
id: server_addr
Layout.fillWidth: true
model: []
editable: true
onEditTextChanged: {
if (model.indexOf(editText) === -1) {
passwordEdit.text = "";
} else {
let data = config.savedPassword[editText];
screenNameEdit.text = data.username;
passwordEdit.text = data.shorten_password;
}
}
}
Text {
text: qsTr("Username")
}
TextField {
id: screenNameEdit
Layout.fillWidth: true
placeholderText: qsTr("Username")
text: ""
onTextChanged: {
passwordEdit.text = "";
let data = config.savedPassword[server_addr.editText];
if (data) {
if (text === data.username) {
passwordEdit.text = data.shorten_password;
}
}
}
}
CheckBox {
id: showPasswordCheck
text: qsTr("Show Password")
}
TextField {
id: passwordEdit
Layout.fillWidth: true
placeholderText: qsTr("Password")
text: ""
echoMode: showPasswordCheck.checked ? TextInput.Normal : TextInput.Password
passwordCharacter: "*"
}
}
Button {
text: qsTr("Join Server")
Layout.fillWidth: true
display: AbstractButton.TextBesideIcon
icon.name: "go-next"
enabled: passwordEdit.text !== ""
onClicked: {
config.serverAddr = server_addr.editText;
config.screenName = screenNameEdit.text;
config.password = passwordEdit.text;
mainWindow.busy = true;
Backend.joinServer(server_addr.editText);
}
}
Button {
Layout.fillWidth: true
text: qsTr("PackageManage")
onClicked: {
mainStack.push(packageManage);
}
}
}
Text {
anchors.left: parent.left
anchors.bottom: parent.bottom
anchors.leftMargin: 12
anchors.bottomMargin: 12
text: "FreeKill " + FkVersion
font.pixelSize: 16
font.bold: true
}
Text {
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.rightMargin: 8
anchors.bottomMargin: 8
text: qsTr("FAQ")
color: "blue"
font.pixelSize: 24
font.underline: true
TapHandler {
onTapped: {
errDialog.txt = qsTr("$LoginFAQ");
errDialog.open();
}
}
}
}
}
function downloadComplete() {
toast.show(qsTr("updated packages for md5"));
}
Component.onCompleted: {
config.loadConf();
lady.source = config.ladyImg;
server_addr.model = Object.keys(config.savedPassword);
server_addr.onModelChanged();
server_addr.currentIndex = server_addr.model.indexOf(config.lastLoginServer);
let data = config.savedPassword[config.lastLoginServer];
if (data) {
screenNameEdit.text = data.username;
passwordEdit.text = data.shorten_password;
}
}
}

View File

@ -217,6 +217,8 @@ QString calcFileMD5() {
writeDirMD5(flist, "lua", "*.lua");
writeDirMD5(flist, "qml", "*.qml");
writeDirMD5(flist, "qml", "*.js");
writeDirMD5(flist, "Fk", "*.qml");
writeDirMD5(flist, "Fk", "*.js");
// then, return flist.txt's md5
flist.close();

View File

@ -288,8 +288,10 @@ int main(int argc, char *argv[]) {
engine->rootContext()->setContextProperty(
"AppPath", QUrl::fromLocalFile(QDir::currentPath()));
engine->addImportPath(QDir::currentPath());
// 加载完全局变量后,就再去加载 main.qml此时UI界面正式显示
engine->load("qml/main.qml");
engine->load("Fk/main.qml");
// qml 报错了就直接退出吧
if (engine->rootObjects().isEmpty())