Skip to content

Commit

Permalink
Core : Project template managment
Browse files Browse the repository at this point in the history
  • Loading branch information
diegomrno committed May 7, 2024
1 parent 6a18d19 commit aa40860
Show file tree
Hide file tree
Showing 20 changed files with 59 additions and 41 deletions.
Binary file modified build/bin/vortex
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Sample template for Vortex
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"project": {
"author": "unknow",
"compatibleWith": "unknow",
"description": "unknow",
"include_system_templates": true,
"name": "unknow",
"type": "unknow",
"version": "unknow"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"type": "project",
"group": "Core",
"name": "vortex.templates.builtin.blank",
"proper_name": "Blank",
"author": "Infinite",
"version": "1.0.0",
"contributors": [
],
"deps": [],
"tarball": "./base.tar.gz",
"picture": "./assets/logo.png",
"description": "This is a module that allow the creation, manipulation, development & production of a toolchain"
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"project": {
"author": "unknow",
"compatibleWith": "unknow",
"description": "unknow",
"include_system_templates": true,
"name": "unknow",
"type": "unknow",
"version": "unknow"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
]
}
],
"tarball": "./dist/template.tar.gz",
"tarball": "./base.tar.gz",
"picture": "./assets/logo.png",
"description": "This is a module that allow the creation, manipulation, development & production of a toolchain"
}
7 changes: 6 additions & 1 deletion main/src/templates/install.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,12 @@ VORTEX_API void VortexMaker::InstallTemplate(const std::string &name, const std:

VortexMaker::LogInfo("Core", "Installing the template \"" + name + "\" ...");

std::string cmd = "tar -xvf " + tem->m_path + tem->m_tarball + " " + path;
std::string cmd = "tar -xvf " + tem->m_path + tem->m_tarball + " --strip-components=1 " + " -C " + path;
std::cout << cmd << std::endl;
system(cmd.c_str());

// Puis reprendre le ficheir vortex.condfig et l'overrider

}

}
Expand Down
21 changes: 0 additions & 21 deletions main/src/vortex/environment/environment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,6 @@ VORTEX_API void VortexMaker::InitEnvironment()
std::string path = VortexMaker::getHomeDirectory() + "/.vx/templates/vortex.templates.builtin.__blankproject/";
VortexMaker::createFolderIfNotExists(path);
}
{
std::string path = VortexMaker::getHomeDirectory() + "/.vx/templates/vortex.templates.builtin.__blankproject/";
std::string file = path + "template.json";

nlohmann::json default_data = {
{"type", "project"},
{"group", "Core"},
{"name", "vortex.templates.builtin.blankproject"},
{"proper_name", "Blank project"},
{"author", "Infinite"},
{"version", "--"},
{"compatibleWith", "--"},
{"tarball", "--"},
{"picture", "/icon.png"},
{"description", "This the most minimum sample project for Vortex."},
{"deps", nlohmann::json::array()},
{"contributors", nlohmann::json::array()}
};

VortexMaker::createJsonFileIfNotExists(file, default_data);
}

{
std::string path = VortexMaker::getHomeDirectory() + "/.vx/data/";
Expand Down
7 changes: 5 additions & 2 deletions main/src/vortex/project/create_project.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,21 +98,24 @@ VORTEX_API void VortexMaker::CreateProject(const std::string &name, const std::s
VortexMaker::createFolderIfNotExists(path);
VortexMaker::InstallTemplate(template_name, path);

std::string version = VORTEX_VERSION;

// Creating and populating JSON data for vortex.config
/*
{
nlohmann::json j;
j["project"]["author"] = author;
j["project"]["description"] = description;
j["project"]["name"] = name;
j["project"]["type"] = "???";
j["project"]["version"] = "1.0.0";
j["project"]["compatibleWith"] = VORTEX_VERSION;
j["project"]["compatibleWith"] = version;
j["project"]["include_system_templates"] = true;
// Store JSON into vortex.config file
std::ofstream o(path + "/vortex.config");
o << std::setw(4) << j << std::endl;
o.close();
}
}*/

}
1 change: 0 additions & 1 deletion main/src/vortex/project/init_project.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ VORTEX_API void VortexMaker::InitProject(const nlohmann::json &main_configs)
{
// Get reference to the Vortex context
VxContext &ctx = *CVortexMaker;

// Initialize context properties based on JSON configurations
ctx.author = main_configs["project"]["author"].get<std::string>();
ctx.description = main_configs["project"]["description"].get<std::string>();
Expand Down
6 changes: 4 additions & 2 deletions tools/editor/app/core/ModuleManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ static void logo(const std::string &path, std::string index_group, int total)

int index = getIndex(index_group);

if(index == -1)
return;

if (total > logos.size())
{
void *data = UIKit::Image::Decode(hexData, hexTable.size(), w, h);
Expand Down Expand Up @@ -536,8 +539,7 @@ void ModuleManager::menubar()

{
ImGui::BeginChild("LOGO_", ImVec2(70, 70), true);
logo(ctx->IO.sys_em[i]->m_logo_path, ctx->IO.em[i]->m_group, this->ctx->IO.sys_em.size());

logo(ctx->IO.sys_em[i]->m_logo_path, ctx->IO.sys_em[i]->m_group, this->ctx->IO.sys_em.size());
ImGui::EndChild();
ImGui::SameLine();
}
Expand Down
19 changes: 6 additions & 13 deletions tools/launcher/app/core/ProjectManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,9 @@ static void logo(const std::string &path, int index, int total)
std::shared_ptr<UIKit::Image> _icon = std::make_shared<UIKit::Image>(w, h, UIKit::ImageFormat::RGBA, data);
logos.push_back(_icon);
VX_FREE(data);

if (index <= logos.size())
{
ImTextureID addIcon = logos[index]->GetImGuiTextureID(VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
textures.push_back(addIcon);
}

}

if (index <= textures.size())
Expand Down Expand Up @@ -166,8 +163,6 @@ void ProjectManager::OnImGuiRender()
}

{
if (!this->ctx->IO.sys_projects[row]->name.empty() && !this->ctx->IO.sys_projects[row]->name.empty())
{
ImGuiID _id = ImGui::GetID("TEXT_");
ImGui::BeginChild(_id, ImVec2(0, 100), true);
float oldsize = ImGui::GetFont()->Scale;
Expand All @@ -188,7 +183,7 @@ void ProjectManager::OnImGuiRender()
ImGui::Text(this->ctx->IO.sys_projects[row]->author.c_str());

ImGui::EndChild();
}

}

if (ImGui::Button("Open"))
Expand Down Expand Up @@ -321,15 +316,14 @@ void ProjectManager::OnImGuiRender()
ImGui::SameLine();
ImGui::TextColored(ImVec4(1.0f, 1.0f, 1.0f, 0.5f), selected_template_object->m_proper_name.c_str());
ImGui::Text("Description : ");
ImGui::SameLine();
ImGui::SameLine();
ImGui::TextColored(ImVec4(1.0f, 1.0f, 1.0f, 0.5f), selected_template_object->m_description.c_str());
ImGui::Separator();

ImGui::Checkbox("Open the project after creation", &open);
std::ostringstream oss;
oss << buf << "/" << name;
static std::string path = oss.str();
ImGui::Text("This new project will be install in ");
std::string path = s + name;

ImGui::Text("This new project will be install in "); // Fix path and allow project creation + fix core dumped
ImGui::SameLine();
ImGui::TextColored(ImVec4(1.0f, 1.0f, 1.0f, 0.5f), path.c_str());

Expand All @@ -344,7 +338,6 @@ static std::string path = oss.str();
{
VortexMaker::CreateProject(name, auth, desc, path, selected_template_object->m_name);
}
path.clear();
ImGui::EndChild();
}

Expand Down

0 comments on commit aa40860

Please sign in to comment.