Skip to content

Commit

Permalink
fix: fix qml res path on start.
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinlq committed Jan 3, 2024
1 parent b08a363 commit 9d22b5e
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 13 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ From this project, you can learn the following knowledge points:
-…

![login](images/login1.png)
![login](images/login2.png)
![chat](images/chat1.png)
![chat](images/chat2.png)
![favorit](images/favorit1.png)
![setting](images/setting1.png)
Expand Down
2 changes: 0 additions & 2 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@
- ……

![login](images/login1.png)
![login](images/login2.png)
![chat](images/chat1.png)
![chat](images/chat2.png)
![favorit](images/favorit1.png)
![setting](images/setting1.png)
Expand Down
2 changes: 1 addition & 1 deletion src/KQML/Config/Theme/ThemeBase.qml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
this is base theme style
*/
import QtQuick 2.15
import "./themeElement"
import "./../../Config/Theme/ThemeElement"

QtObject {

Expand Down
3 changes: 2 additions & 1 deletion src/KQML/Login/LoginIngPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import QtQuick 2.11
import QtQuick.Layouts 1.13
import "./../Component"
import "./../Config"

BasePage {

Expand All @@ -31,7 +32,7 @@ BasePage {
id: _titleLabel
width: 79
height: 79
source: "Config/Theme/logo.jpg"
source: KGlHelp.useAvatar
anchors {
top: parent.top
topMargin: 52
Expand Down
2 changes: 1 addition & 1 deletion src/KQML/Login/LoginWindow.qml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ KWindow
KGlHelp.loginUserName = "wxid_1024"
KGlHelp.loginNickName = "kevinlq"
KGlHelp.userCachePath = SettingsHelper.userCachePath()
KGlHelp.useAvatar = "Config/Theme/images/contact/" + KGlHelp.loginUserName + ".png"
KGlHelp.useAvatar = "/Config/Theme/images/contact/" + KGlHelp.loginUserName + ".png"

KGlHelp.debugUserInfo()
}
Expand Down
2 changes: 1 addition & 1 deletion src/KQML/Login/ScanQRCodePage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ BasePage {
width: 180
height: 180
anchors.centerIn: parent
source: "Config/Theme/qrcode.jpg"
source: "/Config/Theme/qrcode.jpg"
}
}
KTextButton {
Expand Down
10 changes: 6 additions & 4 deletions src/KWeChatClient/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ if(WIN32)
set(WIN32_RESOURCES ${CMAKE_CURRENT_SOURCE_DIR}/kchatIcon.rc)
endif()

add_executable(${TARGET_NAME}
add_executable(${TARGET_NAME} WIN32
${CLIENT_SOURCES}
${CLIENT_HEADERS}
${INTERFACE_SOURCES}
Expand All @@ -46,9 +46,11 @@ add_executable(${TARGET_NAME}
${WIN32_RESOURCES}
)

target_sources(${TARGET_NAME} PRIVATE
${PROJECT_SOURCE_DIR}/src/KChatApp.qrc
)
# target_sources(${TARGET_NAME} PRIVATE
# ${PROJECT_SOURCE_DIR}/src/KChatApp.qrc
# )
add_custom_target(KAppRes
SOURCES ${PROJECT_SOURCE_DIR}/src/KChatApp.qrc)

target_include_directories(${TARGET_NAME} PUBLIC
${PROJECT_SOURCE_DIR}/src
Expand Down
10 changes: 9 additions & 1 deletion src/KWeChatClient/Client/KStartManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,20 @@ int KStartManager::start(int &argc, char *argv[])
QString qmlRes = "qrc:/KQML/App.qml";
QString resPrefix = ":/KQML";
//! TODO local debug use
if(true)
if(false)
{
qmlRes = QString("file:///%1/src/KQML/App.qml").arg(IDE_SOURCE_PATH);
QFileInfo fInfo(QUrl(qmlRes).toLocalFile());
resPrefix = fInfo.absolutePath() + "/";
}
else {
QString strFullResPath = QCoreApplication::applicationDirPath() + "/config/KSkinRes.rcc";
if (!QResource::registerResource(strFullResPath))
{
LOG_ERROR() << "QResource registerResource qml failed! " << strFullResPath;
return 1;
}
}
settingHelp->setResPrefix(resPrefix);

const QUrl url(qmlRes);
Expand Down

0 comments on commit 9d22b5e

Please sign in to comment.