Use std::string internally instead of wxString.

This commit is contained in:
Joseph Lenox 2018-05-06 19:39:34 -05:00 committed by Joseph Lenox
parent 8ba681538d
commit bbbe7e7560
3 changed files with 8 additions and 8 deletions

View File

@ -119,7 +119,7 @@ void Plater::add() {
const auto& input_files{open_model(this, *(this->settings), wxTheApp->GetTopWindow())}; const auto& input_files{open_model(this, *(this->settings), wxTheApp->GetTopWindow())};
for (const auto& f : input_files) { for (const auto& f : input_files) {
Log::info(LogChannel, (wxString(L"Calling Load File for ") + f).ToStdWstring()); Log::info(LogChannel, (wxString(L"Calling Load File for ") + f).ToStdWstring());
this->load_file(f); this->load_file(f.ToStdString());
} }
// abort if no objects actually added. // abort if no objects actually added.
@ -144,7 +144,7 @@ void Plater::add() {
} }
std::vector<int> Plater::load_file(const wxString& file, const int obj_idx_to_load) { std::vector<int> Plater::load_file(const std::string file, const int obj_idx_to_load) {
auto input_file {wxFileName(file)}; auto input_file {wxFileName(file)};
settings->skein_directory = input_file.GetPath(); settings->skein_directory = input_file.GetPath();
@ -158,7 +158,7 @@ std::vector<int> Plater::load_file(const wxString& file, const int obj_idx_to_lo
progress_dialog->Pulse(); progress_dialog->Pulse();
//TODO: Add a std::wstring so we can handle non-roman characters as file names. //TODO: Add a std::wstring so we can handle non-roman characters as file names.
try { try {
model = Slic3r::Model::read_from_file(file.ToStdString()); model = Slic3r::Model::read_from_file(file);
} catch (std::runtime_error& e) { } catch (std::runtime_error& e) {
show_error(this, e.what()); show_error(this, e.what());
Slic3r::Log::error(LogChannel, LOG_WSTRING(file << " failed to load: " << e.what())); Slic3r::Log::error(LogChannel, LOG_WSTRING(file << " failed to load: " << e.what()));
@ -177,10 +177,10 @@ std::vector<int> Plater::load_file(const wxString& file, const int obj_idx_to_lo
for (auto i = 0U; i < model.objects.size(); i++) { for (auto i = 0U; i < model.objects.size(); i++) {
auto object {model.objects[i]}; auto object {model.objects[i]};
object->input_file = file.ToStdString(); object->input_file = file;
for (auto j = 0U; j < object->volumes.size(); j++) { for (auto j = 0U; j < object->volumes.size(); j++) {
auto volume {object->volumes.at(j)}; auto volume {object->volumes.at(j)};
volume->input_file = file.ToStdString(); volume->input_file = file;
volume->input_file_obj_idx = i; volume->input_file_obj_idx = i;
volume->input_file_vol_idx = j; volume->input_file_vol_idx = j;
} }

View File

@ -61,7 +61,7 @@ private:
Plate2D* canvas2D {}; //< 2D plater canvas Plate2D* canvas2D {}; //< 2D plater canvas
/// Handles the actual load of the file from the dialog handoff. /// Handles the actual load of the file from the dialog handoff.
std::vector<int> load_file(const wxString& file, const int obj_idx_to_load = -1); std::vector<int> load_file(const std::string file, const int obj_idx_to_load = -1);
const std::string LogChannel {"GUI_Plater"}; //< Which log these messages should go to. const std::string LogChannel {"GUI_Plater"}; //< Which log these messages should go to.

View File

@ -12,9 +12,9 @@ namespace Slic3r { namespace GUI {
class PlaterObject { class PlaterObject {
public: public:
wxString name {L""}; std::string name {""};
size_t identifier {0U}; size_t identifier {0U};
wxString input_file {L""}; std::string input_file {""};
int input_file_obj_idx {-1}; int input_file_obj_idx {-1};