Skip to content

Commit

Permalink
GUI: Rename config -> project in MainWindow
Browse files Browse the repository at this point in the history
Issue #266
  • Loading branch information
rakhimov committed Jul 23, 2018
1 parent 0eb18db commit 9e78e6d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion gui/main.cpp
Expand Up @@ -218,7 +218,7 @@ int main(int argc, char *argv[])
if (vm.count("input-files"))
inputFiles = vm["input-files"].as<std::vector<std::string>>();
if (vm.count("project")) {
w.setConfig(vm["project"].as<std::string>(), inputFiles);
w.setProjectFile(vm["project"].as<std::string>(), inputFiles);
} else {
w.addInputFiles(inputFiles);
}
Expand Down
22 changes: 11 additions & 11 deletions gui/mainwindow.cpp
Expand Up @@ -281,17 +281,17 @@ void displayError(const scram::Error &err, const QString &title,

} // namespace

bool MainWindow::setConfig(const std::string &configPath,
std::vector<std::string> inputFiles)
bool MainWindow::setProjectFile(const std::string &projectFilePath,
std::vector<std::string> inputFiles)
{
try {
Project config(configPath);
inputFiles.insert(inputFiles.begin(), config.input_files().begin(),
config.input_files().end());
mef::Initializer(inputFiles, config.settings());
Project project(projectFilePath);
inputFiles.insert(inputFiles.begin(), project.input_files().begin(),
project.input_files().end());
mef::Initializer(inputFiles, project.settings());
if (!addInputFiles(inputFiles))
return false;
m_settings = config.settings();
m_settings = project.settings();
} catch (const scram::IOError &err) {
displayError(err, _("Configuration file error"), this);
return false;
Expand All @@ -304,7 +304,7 @@ bool MainWindow::setConfig(const std::string &configPath,
this);
return false;
} catch (const scram::VersionError &err) {
displayError(err, tr("Version Error"), tr("Version incompatibility"),
displayError(err, _("Version Error"), _("Version incompatibility"),
this);
return false;
}
Expand Down Expand Up @@ -357,7 +357,7 @@ bool MainWindow::addInputFiles(const std::vector<std::string> &inputFiles)
return false;
}

emit configChanged();
emit projectChanged();
return true;
}

Expand Down Expand Up @@ -548,7 +548,7 @@ void MainWindow::setupConnections()
});
connect(ui->actionRun, &QAction::triggered, this, &MainWindow::runAnalysis);

connect(this, &MainWindow::configChanged, [this] {
connect(this, &MainWindow::projectChanged, [this] {
m_undoStack->clear();
setWindowTitle(QStringLiteral("%1[*]").arg(getModelNameForTitle()));
ui->actionSaveAs->setEnabled(true);
Expand Down Expand Up @@ -658,7 +658,7 @@ void MainWindow::createNewModel()
m_inputFiles.clear();
m_model = std::make_unique<mef::Model>();

emit configChanged();
emit projectChanged();
}

void MainWindow::openFiles(QString directory)
Expand Down
12 changes: 6 additions & 6 deletions gui/mainwindow.h
Expand Up @@ -61,17 +61,17 @@ class MainWindow : public QMainWindow
explicit MainWindow(QWidget *parent = nullptr);
~MainWindow();

/// Loads a model and analysis configuration from a file.
/// Loads a model and analysis from a project file.
///
/// @param[in] configPath The path to the configuration file.
/// @param[in] projectFilePath The path to the project configuration file.
/// @param[in] inputFiles Additional input files for model initialization.
///
/// @returns true if the initialization is successful.
///
/// @post No side effects are left-over
/// if the initialization is not successful.
bool setConfig(const std::string &configPath,
std::vector<std::string> inputFiles = {});
bool setProjectFile(const std::string &projectFilePath,
std::vector<std::string> inputFiles = {});

/// Adds a new set of model elements from input files.
///
Expand All @@ -85,8 +85,8 @@ class MainWindow : public QMainWindow
bool addInputFiles(const std::vector<std::string> &inputFiles);

signals:
/// Indicates addition of new input or configuration files.
void configChanged();
/// Indicates addition of new input or project files.
void projectChanged();

private slots:
/// Opens a new project configuration.
Expand Down

0 comments on commit 9e78e6d

Please sign in to comment.