w.add_default_session();
else
for (string& open_file : open_files)
- w.add_session_with_file(open_file, open_file_format,
- open_setup_file);
+ w.add_session_with_file(open_file, open_file_format, open_setup_file);
#ifdef ENABLE_SIGNALS
if (SignalHandler::prepare_signals()) {
}
void MainWindow::add_session_with_file(string open_file_name,
- string open_file_format,
- string open_setup_file_name)
+ string open_file_format, string open_setup_file_name)
{
shared_ptr<Session> session = add_session();
- session->load_init_file(open_file_name,
- open_file_format,
- open_setup_file_name);
+ session->load_init_file(open_file_name, open_file_format, open_setup_file_name);
}
void MainWindow::add_default_session()
void remove_session(shared_ptr<Session> session);
- void add_session_with_file(string open_file_name,
- string open_file_format,
+ void add_session_with_file(string open_file_name, string open_file_format,
string open_setup_file_name);
void add_default_session();
}
void Session::load_init_file(const string &file_name,
- const string &format,
- const string &setup_file_name)
+ const string &format, const string &setup_file_name)
{
shared_ptr<InputFormat> input_format;
map<string, Glib::VariantBase> input_opts;
input_format->options());
}
- load_file(QString::fromStdString(file_name),
- QString::fromStdString(setup_file_name),
+ load_file(QString::fromStdString(file_name), QString::fromStdString(setup_file_name),
input_format, input_opts);
}
-void Session::load_file(QString file_name,
- QString setup_file_name,
- shared_ptr<sigrok::InputFormat> format,
- const map<string, Glib::VariantBase> &options)
+void Session::load_file(QString file_name, QString setup_file_name,
+ shared_ptr<sigrok::InputFormat> format, const map<string, Glib::VariantBase> &options)
{
const QString errorMessage(
QString("Failed to load file %1").arg(file_name));
return;
}
- // Default the setup filename with a .pvs extension if none is provided
+ // Use the input file with .pvs extension if no setup file was given
if (setup_file_name.isEmpty()) {
setup_file_name = file_name;
setup_file_name.truncate(setup_file_name.lastIndexOf('.'));
setup_file_name.append(".pvs");
}
- // Auto-load the setup if one exists
+
if (QFileInfo::exists(setup_file_name) && QFileInfo(setup_file_name).isReadable()) {
QSettings settings_storage(setup_file_name, QSettings::IniFormat);
restore_setup(settings_storage);
void set_default_device();
- void load_init_file(const string &file_name,
- const string &format,
+ void load_init_file(const string &file_name, const string &format,
const string &setup_file_name);
- void load_file(QString file_name,
- QString setup_file_name = nullptr,
+ void load_file(QString file_name, QString setup_file_name = QString(),
shared_ptr<sigrok::InputFormat> format = nullptr,
const map<string, Glib::VariantBase> &options =
map<string, Glib::VariantBase>());
options = dlg.options();
}
- session_.load_file(file_name, nullptr, format, options);
+ session_.load_file(file_name, "", format, options);
const QString abs_path = QFileInfo(file_name).absolutePath();
settings.setValue(SettingOpenDirectory, abs_path);