[olympic] Cleanup

This commit is contained in:
Gary Talent 2023-12-16 03:05:57 -06:00
parent 56f59b29fe
commit 00c2a39dba
3 changed files with 10 additions and 11 deletions

View File

@ -171,8 +171,7 @@ constexpr AssetRef<T>::AssetRef(AssetRef const&h) noexcept: m_ctr(h.m_ctr) {
}
template<typename T>
constexpr AssetRef<T>::AssetRef(AssetRef &&h) noexcept {
m_ctr = h.m_ctr;
constexpr AssetRef<T>::AssetRef(AssetRef &&h) noexcept: m_ctr(h.m_ctr) {
if (m_ctr) {
m_ctr->updated.connect(this, &AssetRef::emitUpdated);
}

View File

@ -41,9 +41,9 @@ oxModelEnd()
StudioUI::StudioUI(turbine::Context &ctx, ox::StringView projectDataDir) noexcept:
m_ctx(ctx),
m_projectDataDir(projectDataDir),
m_projectExplorer(ox::make_unique<ProjectExplorer>(m_ctx)),
m_projectExplorer(m_ctx),
m_aboutPopup(m_ctx) {
m_projectExplorer->fileChosen.connect(this, &StudioUI::openFile);
m_projectExplorer.fileChosen.connect(this, &StudioUI::openFile);
ImGui::GetIO().IniFilename = nullptr;
loadModules();
// open project and files
@ -148,7 +148,7 @@ void StudioUI::draw() noexcept {
ImGui::Begin("MainWindow##Studio", nullptr, windowFlags);
{
if (m_showProjectExplorer) {
m_projectExplorer->draw(m_ctx);
m_projectExplorer.draw(m_ctx);
ImGui::SameLine();
}
drawTabBar();
@ -285,7 +285,7 @@ void StudioUI::loadModule(studio::Module const*mod) noexcept {
}
void StudioUI::loadModules() noexcept {
for (auto &mod : modules) {
for (auto const mod : modules) {
loadModule(mod);
}
}
@ -324,15 +324,15 @@ ox::Error StudioUI::openProject(ox::CRStringView path) noexcept {
m_project = ox::make_unique<studio::Project>(keelCtx(m_ctx), ox::String(path), m_projectDataDir);
auto sctx = applicationData<studio::StudioContext>(m_ctx);
sctx->project = m_project.get();
m_project->fileAdded.connect(m_projectExplorer.get(), &ProjectExplorer::refreshProjectTreeModel);
m_project->fileDeleted.connect(m_projectExplorer.get(), &ProjectExplorer::refreshProjectTreeModel);
m_project->fileAdded.connect(&m_projectExplorer, &ProjectExplorer::refreshProjectTreeModel);
m_project->fileDeleted.connect(&m_projectExplorer, &ProjectExplorer::refreshProjectTreeModel);
m_openFiles.clear();
m_editors.clear();
studio::editConfig<StudioConfig>(keelCtx(m_ctx), [&](StudioConfig *config) {
config->projectPath = ox::String(path);
config->openFiles.clear();
});
return m_projectExplorer->refreshProjectTreeModel();
return m_projectExplorer.refreshProjectTreeModel();
}
ox::Error StudioUI::openFile(ox::CRStringView path) noexcept {

View File

@ -30,7 +30,7 @@ class StudioUI: public ox::SignalHandler {
ox::Vector<ox::UPtr<studio::BaseEditor>> m_editors;
ox::Vector<ox::UPtr<studio::Widget>> m_widgets;
ox::HashMap<ox::String, studio::EditorMaker::Func> m_editorMakers;
ox::UPtr<ProjectExplorer> m_projectExplorer;
ProjectExplorer m_projectExplorer;
ox::Vector<ox::String> m_openFiles;
studio::BaseEditor *m_activeEditorOnLastDraw = nullptr;
studio::BaseEditor *m_activeEditor = nullptr;
@ -67,7 +67,7 @@ class StudioUI: public ox::SignalHandler {
void loadEditorMaker(studio::EditorMaker const&editorMaker) noexcept;
void loadModule(const studio::Module *mod) noexcept;
void loadModule(studio::Module const*mod) noexcept;
void loadModules() noexcept;