Skip to content

Commit

Permalink
feat: project launcher update
Browse files Browse the repository at this point in the history
  • Loading branch information
FlyAndNotDown committed Jan 1, 2025
1 parent 83390c3 commit b6ffd7f
Show file tree
Hide file tree
Showing 23 changed files with 202 additions and 276 deletions.
2 changes: 1 addition & 1 deletion CMake/ThirdParty.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -531,5 +531,5 @@ function(Setup3rdPackage)
HASH ${HASH_VALUE}
)

set(${PARAMS_NAME}_SOURCE_DIR ${SOURCE_DIR})
set(${PARAMS_NAME}_SOURCE_DIR ${SOURCE_DIR} CACHE PATH "" FORCE)
endfunction()
32 changes: 31 additions & 1 deletion Editor/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +1,31 @@
add_subdirectory(Source)
set(CMAKE_PREFIX_PATH ${QT_LIB_PREFIX})
find_package(
Qt6 ${QT_VERSION}
COMPONENTS Core Gui Widgets Quick
REQUIRED
)

qt_standard_project_setup(REQUIRES ${QT_VERSION})

file(GLOB_RECURSE SOURCES Src/*.cpp)
qt_add_executable(Editor ${SOURCES})
target_include_directories(Editor PRIVATE Include)
target_link_libraries(Editor PRIVATE Core RHI Runtime Qt6::Core Qt6::Gui Qt6::Widgets Qt6::Quick)

# TODO config runtime dependencies in Windows

file(GLOB_RECURSE QML_SOURCES QML/*.qml)
file(GLOB_RECURSE RESOURCES Resource/*)

list(APPEND RESOURCES_PENDING_SET_ALIAS ${QML_SOURCES} ${RESOURCES})
foreach (RESOURCE ${RESOURCES_PENDING_SET_ALIAS})
get_filename_component(FILENAME ${RESOURCE} NAME)
set_source_files_properties(${RESOURCE} PROPERTIES QT_RESOURCE_ALIAS ${FILENAME})
endforeach ()

qt_add_qml_module(
Editor
URI editor
QML_FILES ${QML_SOURCES}
RESOURCES ${RESOURCES}
)
File renamed without changes.
File renamed without changes.
File renamed without changes.
28 changes: 28 additions & 0 deletions Editor/Include/Editor/QmlHotReload.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//
// Created by Kindem on 2024/12/31.
//

#pragma once

#include <unordered_set>

#include <QQuickView>

namespace Editor {
class QmlHotReloadEngine {
public:
static QmlHotReloadEngine& Get();

~QmlHotReloadEngine();

void Start();
void Stop();
void Register(QQuickView* inView);
void Unregister(QQuickView* inView);

private:
QmlHotReloadEngine();

std::unordered_set<QQuickView*> liveQuickViews;
};
}
16 changes: 16 additions & 0 deletions Editor/Include/Editor/Widget/Launcher.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// Created by johnk on 2024/6/23.
//

#pragma once

#include <Editor/Widget/QmlWidget.h>

namespace Editor {
class Launcher final : public QmlWidget {
Q_OBJECT

public:
Launcher();
};
}
24 changes: 24 additions & 0 deletions Editor/Include/Editor/Widget/QmlWidget.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// Created by Kindem on 2024/12/31.
//

#pragma once

#include <QQuickView>
#include <QWidget>

namespace Editor {
class QmlWidget : public QWidget {
Q_OBJECT

public:
explicit QmlWidget(const std::string& qmlFileName, QWidget* parent = nullptr);

QQuickView* GetQuickView();
const QUrl& GetQmlUrl() const;

private:
QUrl url;
QQuickView* quickView;
};
}
5 changes: 5 additions & 0 deletions Editor/QML/launcher.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import QtQuick

Rectangle {
color: 'red'
}
30 changes: 0 additions & 30 deletions Editor/Source/CMakeLists.txt

This file was deleted.

30 changes: 0 additions & 30 deletions Editor/Source/Include/Editor/Resource.h

This file was deleted.

37 changes: 0 additions & 37 deletions Editor/Source/Include/Editor/Theme.h

This file was deleted.

23 changes: 0 additions & 23 deletions Editor/Source/Include/Editor/Widget/Launcher.h

This file was deleted.

40 changes: 0 additions & 40 deletions Editor/Source/Src/Resource.cpp

This file was deleted.

61 changes: 0 additions & 61 deletions Editor/Source/Src/Theme.cpp

This file was deleted.

53 changes: 0 additions & 53 deletions Editor/Source/Src/Widget/Launcher.cpp

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit b6ffd7f

Please sign in to comment.