[nostalgia,studio] Make module handling consistent
This commit is contained in:
@@ -6,12 +6,16 @@
|
||||
|
||||
#include <ox/std/string.hpp>
|
||||
|
||||
#include <studio/module.hpp>
|
||||
|
||||
namespace studio {
|
||||
|
||||
void registerModule(const studio::Module*) noexcept;
|
||||
|
||||
int main(
|
||||
const char *appName,
|
||||
ox::String projectDataDir,
|
||||
[[maybe_unused]] int argc,
|
||||
[[maybe_unused]] const char **argv);
|
||||
int argc,
|
||||
const char **argv);
|
||||
|
||||
}
|
||||
|
@@ -1,5 +1,3 @@
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
add_library(
|
||||
StudioAppLib
|
||||
aboutpopup.cpp
|
||||
|
@@ -10,8 +10,6 @@
|
||||
#include <keel/media.hpp>
|
||||
#include <turbine/turbine.hpp>
|
||||
|
||||
#include <nostalgia/appmodules/appmodules.hpp>
|
||||
|
||||
#include <studio/context.hpp>
|
||||
#include "studioapp.hpp"
|
||||
|
||||
@@ -65,8 +63,8 @@ namespace studio {
|
||||
int main(
|
||||
const char *appName,
|
||||
ox::String projectDataDir,
|
||||
[[maybe_unused]] int argc,
|
||||
[[maybe_unused]] const char **argv) {
|
||||
int,
|
||||
const char **) {
|
||||
#ifdef DEBUG
|
||||
ox::LoggerConn loggerConn;
|
||||
const auto loggerErr = loggerConn.initConn(appName);
|
||||
@@ -88,4 +86,4 @@ int main(
|
||||
return static_cast<int>(err);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -13,6 +13,8 @@
|
||||
#include "filedialogmanager.hpp"
|
||||
#include "studioapp.hpp"
|
||||
|
||||
ox::Vector<const studio::Module*> modules;
|
||||
|
||||
struct StudioConfig {
|
||||
static constexpr auto TypeName = "net.drinkingtea.studio.StudioConfig";
|
||||
static constexpr auto TypeVersion = 1;
|
||||
@@ -246,7 +248,7 @@ void StudioUI::loadEditorMaker(const studio::EditorMaker &editorMaker) noexcept
|
||||
}
|
||||
}
|
||||
|
||||
void StudioUI::loadModule(studio::Module *mod) noexcept {
|
||||
void StudioUI::loadModule(const studio::Module *mod) noexcept {
|
||||
for (const auto &editorMaker : mod->editors(m_ctx)) {
|
||||
loadEditorMaker(editorMaker);
|
||||
}
|
||||
@@ -256,9 +258,8 @@ void StudioUI::loadModule(studio::Module *mod) noexcept {
|
||||
}
|
||||
|
||||
void StudioUI::loadModules() noexcept {
|
||||
for (auto &moduleMaker : BuiltinModules) {
|
||||
const auto mod = moduleMaker();
|
||||
loadModule(mod.get());
|
||||
for (auto &mod : modules) {
|
||||
loadModule(mod);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -369,3 +370,11 @@ ox::Error StudioUI::closeFile(const ox::String &path) noexcept {
|
||||
});
|
||||
return OxError(0);
|
||||
}
|
||||
|
||||
namespace studio {
|
||||
|
||||
void registerModule(const studio::Module *mod) noexcept {
|
||||
modules.emplace_back(mod);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -65,7 +65,7 @@ class StudioUI: public ox::SignalHandler {
|
||||
|
||||
void loadEditorMaker(const studio::EditorMaker &editorMaker) noexcept;
|
||||
|
||||
void loadModule(studio::Module *mod) noexcept;
|
||||
void loadModule(const studio::Module *mod) noexcept;
|
||||
|
||||
void loadModules() noexcept;
|
||||
|
||||
|
Reference in New Issue
Block a user