mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-10-04 04:36:31 +08:00
Starting to make Slic3r::GUI::Preset work.
This commit is contained in:
parent
ba57c5085b
commit
81888af2cd
19
src/GUI/Preset.cpp
Normal file
19
src/GUI/Preset.cpp
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#include "Preset.hpp"
|
||||||
|
#include "Config.hpp"
|
||||||
|
#include <regex>
|
||||||
|
|
||||||
|
using namespace std::literals::string_literals;
|
||||||
|
|
||||||
|
namespace Slic3r { namespace GUI {
|
||||||
|
|
||||||
|
Preset::Preset(std::string load_dir, std::string filename, preset_t p) : dir(load_dir), file(filename), group(p) {
|
||||||
|
// find last .ini at the end of the filename.
|
||||||
|
std::regex ini (".ini[ ]*$");
|
||||||
|
this->name = std::regex_replace(filename, ini, "$1");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Preset::dirty() const {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}} // namespace Slic3r::GUI
|
@ -4,6 +4,12 @@
|
|||||||
#include "PrintConfig.hpp"
|
#include "PrintConfig.hpp"
|
||||||
#include "Config.hpp"
|
#include "Config.hpp"
|
||||||
|
|
||||||
|
#include <wx/wxprec.h>
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include <wx/wx.h>
|
||||||
|
#include <wx/string.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Slic3r { namespace GUI {
|
namespace Slic3r { namespace GUI {
|
||||||
|
|
||||||
/// Preset types list. We assign numbers to permit static_casts and use as preset tab indices.
|
/// Preset types list. We assign numbers to permit static_casts and use as preset tab indices.
|
||||||
@ -54,7 +60,7 @@ public:
|
|||||||
t_config_option_keys dirty_options();
|
t_config_option_keys dirty_options();
|
||||||
|
|
||||||
/// Returns whether or not this config is different from its modified state.
|
/// Returns whether or not this config is different from its modified state.
|
||||||
bool dirty();
|
bool dirty() const;
|
||||||
|
|
||||||
/// Loads the selected config from file and return a shared_ptr to that config
|
/// Loads the selected config from file and return a shared_ptr to that config
|
||||||
config_ptr load_config();
|
config_ptr load_config();
|
||||||
@ -69,6 +75,8 @@ public:
|
|||||||
void apply_dirty(const config_ptr& other) { this->apply_dirty(*other); }
|
void apply_dirty(const config_ptr& other) { this->apply_dirty(*other); }
|
||||||
bool operator==(const wxString& _name) const { return this->operator==(_name.ToStdString()); }
|
bool operator==(const wxString& _name) const { return this->operator==(_name.ToStdString()); }
|
||||||
bool operator==(const std::string& _name) const { return _name.compare(this->name) == 0; }
|
bool operator==(const std::string& _name) const { return _name.compare(this->name) == 0; }
|
||||||
|
|
||||||
|
Preset(std::string load_dir, std::string filename, preset_t p);
|
||||||
private:
|
private:
|
||||||
bool external {false};
|
bool external {false};
|
||||||
|
|
||||||
@ -76,10 +84,14 @@ private:
|
|||||||
Slic3r::Config config { Slic3r::Config() };
|
Slic3r::Config config { Slic3r::Config() };
|
||||||
|
|
||||||
/// Alternative config store for a modified configuration.
|
/// Alternative config store for a modified configuration.
|
||||||
Slic3r::Config dirty_config {Slic3r::Config()};
|
Slic3r::Config dirty_config { Slic3r::Config() };
|
||||||
|
|
||||||
|
/// Underlying filename for this preset config
|
||||||
std::string file {""};
|
std::string file {""};
|
||||||
|
|
||||||
|
/// dirname for the file.
|
||||||
|
std::string dir {""};
|
||||||
|
|
||||||
/// reach through to the appropriate material type
|
/// reach through to the appropriate material type
|
||||||
t_config_option_keys _group_class();
|
t_config_option_keys _group_class();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user