menus::delete_world
This commit is contained in:
parent
b2abd57a71
commit
7c16333850
@ -48,6 +48,10 @@ fs::path EnginePaths::getWorldFolder() {
|
|||||||
return worldFolder;
|
return worldFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fs::path EnginePaths::getWorldFolder(const std::string& name) {
|
||||||
|
return getWorldsFolder()/fs::path(name);
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<fs::path> EnginePaths::scanForWorlds() {
|
std::vector<fs::path> EnginePaths::scanForWorlds() {
|
||||||
std::vector<fs::path> folders;
|
std::vector<fs::path> folders;
|
||||||
|
|
||||||
|
|||||||
@ -27,6 +27,7 @@ public:
|
|||||||
fs::path getScreenshotFile(std::string ext);
|
fs::path getScreenshotFile(std::string ext);
|
||||||
fs::path getWorldsFolder();
|
fs::path getWorldsFolder();
|
||||||
fs::path getWorldFolder();
|
fs::path getWorldFolder();
|
||||||
|
fs::path getWorldFolder(const std::string& name);
|
||||||
bool isWorldNameUsed(std::string name);
|
bool isWorldNameUsed(std::string name);
|
||||||
|
|
||||||
void setUserfiles(fs::path folder);
|
void setUserfiles(fs::path folder);
|
||||||
|
|||||||
@ -234,6 +234,16 @@ void menus::open_world(std::string name, Engine* engine, bool confirmConvert) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void menus::delete_world(std::string name, Engine* engine) {
|
||||||
|
fs::path folder = engine->getPaths()->getWorldFolder(name);
|
||||||
|
guiutil::confirm(engine->getGUI(), langs::get(L"delete-confirm", L"world")+
|
||||||
|
L" ("+util::str2wstr_utf8(folder.u8string())+L")", [=]() {
|
||||||
|
std::cout << "deleting " << folder.u8string() << std::endl;
|
||||||
|
fs::remove_all(folder);
|
||||||
|
menus::refresh_menus(engine);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
std::shared_ptr<Panel> create_worlds_panel(Engine* engine) {
|
std::shared_ptr<Panel> create_worlds_panel(Engine* engine) {
|
||||||
auto panel = std::dynamic_pointer_cast<Panel>(guiutil::create(
|
auto panel = std::dynamic_pointer_cast<Panel>(guiutil::create(
|
||||||
"<panel size='370' padding='5' color='#FFFFFF11' max-length='400'>"
|
"<panel size='370' padding='5' color='#FFFFFF11' max-length='400'>"
|
||||||
|
|||||||
@ -42,6 +42,11 @@ namespace menus {
|
|||||||
/// @param confirmConvert automatically confirm convert if requested
|
/// @param confirmConvert automatically confirm convert if requested
|
||||||
void open_world(std::string name, Engine* engine, bool confirmConvert);
|
void open_world(std::string name, Engine* engine, bool confirmConvert);
|
||||||
|
|
||||||
|
/// @brief Show world removal confirmation dialog
|
||||||
|
/// @param name world name
|
||||||
|
/// @param engine engine instance
|
||||||
|
void delete_world(std::string name, Engine* engine);
|
||||||
|
|
||||||
/// @brief Create development version label at the top-right screen corner
|
/// @brief Create development version label at the top-right screen corner
|
||||||
void create_version_label(Engine* engine);
|
void create_version_label(Engine* engine);
|
||||||
void create_menus(Engine* engine);
|
void create_menus(Engine* engine);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user