Style fixes
authorSoeren Apel <soeren@apelpie.net>
Mon, 22 Apr 2019 13:39:13 +0000 (15:39 +0200)
committerSoeren Apel <soeren@apelpie.net>
Mon, 22 Apr 2019 13:39:13 +0000 (15:39 +0200)
main.cpp
pv/mainwindow.cpp
pv/mainwindow.hpp
pv/session.cpp
pv/session.hpp
pv/toolbars/mainbar.cpp

index 1e4fe57..4bbddcc 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -340,8 +340,7 @@ int main(int argc, char *argv[])
                                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()) {
index 638d75b..fb749f5 100644 (file)
@@ -399,13 +399,10 @@ void MainWindow::remove_session(shared_ptr<Session> session)
 }
 
 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()
index bf8be0a..92fba45 100644 (file)
@@ -92,8 +92,7 @@ public:
 
        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();
index e412f50..c2fd214 100644 (file)
@@ -526,8 +526,7 @@ Session::input_format_options(vector<string> user_spec,
 }
 
 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;
@@ -551,15 +550,12 @@ void Session::load_init_file(const string &file_name,
                        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));
@@ -587,13 +583,13 @@ void Session::load_file(QString 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);
index 7d9375a..211fe1b 100644 (file)
@@ -172,12 +172,10 @@ public:
 
        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>());
index 0266102..666c28d 100644 (file)
@@ -705,7 +705,7 @@ void MainBar::import_file(shared_ptr<InputFormat> format)
                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);