[olympic,nostalgia] Cleanup with StringParam
All checks were successful
Build / build (push) Successful in 2m33s
All checks were successful
Build / build (push) Successful in 2m33s
This commit is contained in:
@ -13,7 +13,7 @@
|
||||
namespace studio {
|
||||
|
||||
NewMenu::NewMenu() noexcept {
|
||||
setTitle(ox::String("New Item"));
|
||||
setTitle("New Item");
|
||||
setSize({230, 140});
|
||||
}
|
||||
|
||||
|
@ -12,8 +12,8 @@
|
||||
|
||||
namespace studio {
|
||||
|
||||
NewProject::NewProject(ox::String projectDatadir) noexcept: m_projectDataDir(std::move(projectDatadir)) {
|
||||
setTitle(ox::String("New Project"));
|
||||
NewProject::NewProject(ox::StringParam projectDatadir) noexcept: m_projectDataDir(std::move(projectDatadir)) {
|
||||
setTitle("New Project");
|
||||
setSize({230, 140});
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ class NewProject: public studio::Popup {
|
||||
bool m_open = false;
|
||||
|
||||
public:
|
||||
NewProject(ox::String projectDatadir) noexcept;
|
||||
NewProject(ox::StringParam projectDatadir) noexcept;
|
||||
|
||||
void open() noexcept override;
|
||||
|
||||
|
@ -41,12 +41,12 @@ oxModelBegin(StudioConfig)
|
||||
oxModelFieldRename(showProjectExplorer, show_project_explorer)
|
||||
oxModelEnd()
|
||||
|
||||
StudioUI::StudioUI(turbine::Context &ctx, ox::StringView projectDataDir) noexcept:
|
||||
StudioUI::StudioUI(turbine::Context &ctx, ox::StringParam projectDataDir) noexcept:
|
||||
m_sctx(*this, ctx),
|
||||
m_ctx(ctx),
|
||||
m_projectDataDir(projectDataDir),
|
||||
m_projectDataDir(std::move(projectDataDir)),
|
||||
m_projectExplorer(m_ctx),
|
||||
m_newProject(ox::String(projectDataDir)),
|
||||
m_newProject(m_projectDataDir),
|
||||
m_aboutPopup(m_ctx) {
|
||||
turbine::setApplicationData(m_ctx, &m_sctx);
|
||||
m_projectExplorer.fileChosen.connect(this, &StudioUI::openFile);
|
||||
@ -326,11 +326,11 @@ ox::Error StudioUI::createOpenProject(ox::CRStringView path) noexcept {
|
||||
return m_project->writeTypeStore();
|
||||
}
|
||||
|
||||
ox::Error StudioUI::openProjectPath(ox::CRStringView path) noexcept {
|
||||
oxRequireM(fs, keel::loadRomFs(path));
|
||||
ox::Error StudioUI::openProjectPath(ox::StringParam path) noexcept {
|
||||
oxRequireM(fs, keel::loadRomFs(path.view()));
|
||||
oxReturnError(keel::setRomFs(keelCtx(m_ctx), std::move(fs)));
|
||||
oxReturnError(
|
||||
ox::make_unique_catch<studio::Project>(keelCtx(m_ctx), ox::String(path), m_projectDataDir)
|
||||
ox::make_unique_catch<studio::Project>(keelCtx(m_ctx), std::move(path), m_projectDataDir)
|
||||
.moveTo(m_project));
|
||||
auto const sctx = applicationData<studio::StudioContext>(m_ctx);
|
||||
sctx->project = m_project.get();
|
||||
@ -364,7 +364,7 @@ ox::Error StudioUI::openFileActiveTab(ox::CRStringView path, bool makeActiveTab)
|
||||
}
|
||||
return {};
|
||||
}
|
||||
oxRequire(ext, studio::fileExt(path).to<ox::String>([](auto const&v) {return ox::String(v);}));
|
||||
oxRequire(ext, studio::fileExt(path));
|
||||
// create Editor
|
||||
studio::BaseEditor *editor = nullptr;
|
||||
if (!m_editorMakers.contains(ext)) {
|
||||
@ -392,7 +392,7 @@ ox::Error StudioUI::openFileActiveTab(ox::CRStringView path, bool makeActiveTab)
|
||||
m_activeEditorUpdatePending = editor;
|
||||
}
|
||||
// save to config
|
||||
studio::editConfig<StudioConfig>(keelCtx(m_ctx), [&](StudioConfig &config) {
|
||||
studio::editConfig<StudioConfig>(keelCtx(m_ctx), [&path](StudioConfig &config) {
|
||||
if (!config.openFiles.contains(path)) {
|
||||
config.openFiles.emplace_back(path);
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ class StudioUI: public ox::SignalHandler {
|
||||
bool m_showProjectExplorer = true;
|
||||
|
||||
public:
|
||||
explicit StudioUI(turbine::Context &ctx, ox::StringView projectDataDir) noexcept;
|
||||
explicit StudioUI(turbine::Context &ctx, ox::StringParam projectDataDir) noexcept;
|
||||
|
||||
void handleKeyEvent(turbine::Key, bool down) noexcept;
|
||||
|
||||
@ -85,7 +85,7 @@ class StudioUI: public ox::SignalHandler {
|
||||
|
||||
ox::Error createOpenProject(ox::CRStringView path) noexcept;
|
||||
|
||||
ox::Error openProjectPath(ox::CRStringView path) noexcept;
|
||||
ox::Error openProjectPath(ox::StringParam path) noexcept;
|
||||
|
||||
ox::Error openFile(ox::CRStringView path) noexcept;
|
||||
|
||||
|
Reference in New Issue
Block a user