38 SimPT_Shell::Ws::WorkspaceFactory::g_project_index_file>;
46 Project::Project(
const string& path,
47 const string& prefs_file,
48 const shared_ptr<SimShell::Ws::IWorkspace>& w)
49 : SimPTProjectBase(path, prefs_file, w)
51 auto prefs_path = path +
'/' + prefs_file;
53 if (!QFile::exists(QString::fromStdString(prefs_path))) {
54 ptree default_preferences;
55 ptree new_preferences;
58 const string default_prefs_file = f.GetWorkspaceTemplatePath() +
'/' + prefs_file;
59 read_xml(default_prefs_file, default_preferences, trim_whitespace);
60 default_preferences = default_preferences.get_child(
"preferences");
63 PTreeUtils::CopyStructure(default_preferences, new_preferences,
"$WORKSPACE$", {
"<xmlcomment>"});
65 SetPreferences(new_preferences);
74 [](
const string& type,
const string& path,
const string& prefs_file,
const shared_ptr<SimShell::Ws::IWorkspace>& w)
75 -> shared_ptr<SimShell::Ws::IProject>
77 if (type ==
"project") {
78 return make_shared<Project>(path, prefs_file, w);
92 auto create_window = [
this](vector<IConverterFormat*> formats,
const string& title,
93 shared_ptr<SimShell::Ws::MergedPreferences> p,
QWidget* parent) {
94 auto conv_window = make_shared<ConverterWindow>(
this, formats, p, title, parent);
96 m_converter_window = conv_window;
99 return {{
"Convert...", bind(create_window, FileConverterFormats::GetConverterFormats(),
100 "Convert Project", placeholders::_1, placeholders::_2)},
101 {
"Postprocess...", bind(create_window, FileConverterFormats::GetExportFormats(),
102 "Postprocess Project", placeholders::_1, placeholders::_2)}};
108 if (
auto c = m_converter_window.lock()) {
virtual std::vector< QAction * > GetContextMenuActions() const
Namespace for miscellaneous utilities.
Interface for SimPT projects.
Namespace for SimPT shell package.
virtual std::vector< WidgetCallback > GetWidgets()
Interface for ConverterWindow.
virtual ~Project()
Virtual destructor.
virtual void Refresh()
Overrides SimShell::Ws::Project::Refresh.
Interface of file converter formats.
Implementation for Project.
Base class representing the file types used to initiate a session.
see the online Qt documentation
std::function< std::shared_ptr< IProject >(const std::string &, const std::string &, const std::string &, const std::shared_ptr< IWorkspace > &)> ConstructorType
First argument : type of project to create.
Namespace for generic graphical shell for simulators.