diff options
| -rw-r--r-- | gui/process_detector.cpp | 2 | ||||
| -rw-r--r-- | gui/process_detector.h | 2 | ||||
| -rw-r--r-- | migration/migration.cpp | 8 | ||||
| -rw-r--r-- | migration/migration.hpp | 4 | ||||
| -rw-r--r-- | options/defs.hpp | 9 | ||||
| -rw-r--r-- | options/globals.cpp | 4 | ||||
| -rw-r--r-- | variant/default/main-window.cpp | 40 | ||||
| -rw-r--r-- | variant/default/main-window.hpp | 12 | 
8 files changed, 38 insertions, 43 deletions
diff --git a/gui/process_detector.cpp b/gui/process_detector.cpp index 67b05c7c..b17d5dd0 100644 --- a/gui/process_detector.cpp +++ b/gui/process_detector.cpp @@ -195,7 +195,7 @@ bool process_detector_worker::should_stop()      return true;  } -bool process_detector_worker::config_to_start(QString& str) +bool process_detector_worker::profile_to_start(QString& str)  {      proc_detector_settings s;      if (!s.is_enabled()) diff --git a/gui/process_detector.h b/gui/process_detector.h index 7439b19b..4e8842c6 100644 --- a/gui/process_detector.h +++ b/gui/process_detector.h @@ -63,7 +63,7 @@ class OTR_GUI_EXPORT process_detector_worker : QObject      proc_detector_settings s;      QString last_exe_name;  public: -    bool config_to_start(QString& s); +    bool profile_to_start(QString& str);      bool should_stop();  }; diff --git a/migration/migration.cpp b/migration/migration.cpp index 59ceee1a..d4ec6493 100644 --- a/migration/migration.cpp +++ b/migration/migration.cpp @@ -172,7 +172,7 @@ std::vector<QString> migrator::run()                  done.push_back(m->name());              }          } -        mark_config_as_not_needing_migration(); +        mark_profile_as_not_needing_migration();      });      return done; @@ -192,14 +192,14 @@ std::vector<QString> run_migrations()      return migrations::detail::migrator::run();  } -void mark_config_as_not_needing_migration() +void mark_profile_as_not_needing_migration()  {      using m = migrations::detail::migrator; -    m::mark_config_as_not_needing_migration(); +    m::mark_profile_as_not_needing_migration();  } -void migrations::detail::migrator::mark_config_as_not_needing_migration() +void migrations::detail::migrator::mark_profile_as_not_needing_migration()  {      set_last_migration_time(time_after_migrations());  } diff --git a/migration/migration.hpp b/migration/migration.hpp index 4eaa959f..2c1fee5b 100644 --- a/migration/migration.hpp +++ b/migration/migration.hpp @@ -28,7 +28,7 @@ namespace detail {      {          static std::vector<QString> run();          static void add_migration_thunk(std::function<mptr()>& thunk); -        static void mark_config_as_not_needing_migration(); +        static void mark_profile_as_not_needing_migration();      private:          static void sort_migrations(); @@ -87,4 +87,4 @@ struct migration  } // ns migrations  OTR_MIGRATION_EXPORT std::vector<QString> run_migrations(); -OTR_MIGRATION_EXPORT void mark_config_as_not_needing_migration(); +OTR_MIGRATION_EXPORT void mark_profile_as_not_needing_migration(); diff --git a/options/defs.hpp b/options/defs.hpp index a71a56e2..9ea4f3b3 100644 --- a/options/defs.hpp +++ b/options/defs.hpp @@ -1,11 +1,6 @@  #pragma once -#include "compat/macros.hpp" - -#include <QString> -#include <QMetaType> - -#define OPENTRACK_CONFIG_FILENAME_KEY "settings-filename" -#define OPENTRACK_DEFAULT_CONFIG "default.ini" +#define OPENTRACK_PROFILE_FILENAME_KEY "settings-filename" +#define OPENTRACK_DEFAULT_PROFILE "default.ini" diff --git a/options/globals.cpp b/options/globals.cpp index dbc6df90..5f1bda67 100644 --- a/options/globals.cpp +++ b/options/globals.cpp @@ -105,9 +105,9 @@ bool is_ini_modified()  QString ini_filename()  {      return with_global_settings_object([&](QSettings& settings) { -        const QString ret = settings.value(OPENTRACK_CONFIG_FILENAME_KEY, OPENTRACK_DEFAULT_CONFIG).toString(); +        const QString ret = settings.value(OPENTRACK_PROFILE_FILENAME_KEY, OPENTRACK_DEFAULT_PROFILE).toString();          if (ret.size() == 0) -            return QStringLiteral(OPENTRACK_DEFAULT_CONFIG); +            return QStringLiteral(OPENTRACK_DEFAULT_PROFILE);          return ret;      });  } diff --git a/variant/default/main-window.cpp b/variant/default/main-window.cpp index bf272429..2e9461ed 100644 --- a/variant/default/main-window.cpp +++ b/variant/default/main-window.cpp @@ -146,18 +146,18 @@ void main_window::init_profiles()      refresh_profile_list();      // implicitly created by `ini_directory()'      if (ini_directory().isEmpty() || !QDir(ini_directory()).isReadable()) -        die_on_config_not_writable(); +        die_on_profile_not_writable();      set_profile(ini_filename());      // profile menu -    profile_menu.addAction(tr("Create new empty config"), this, &main_window::make_empty_config); -    profile_menu.addAction(tr("Create new copied config"), this, &main_window::make_copied_config); -    profile_menu.addAction(tr("Open configuration directory"), this, &main_window::open_config_directory); +    profile_menu.addAction(tr("Create new empty config"), this, &main_window::create_empty_profile); +    profile_menu.addAction(tr("Create new copied config"), this, &main_window::create_copied_profile); +    profile_menu.addAction(tr("Open configuration directory"), this, &main_window::open_profile_directory);      ui.profile_button->setMenu(&profile_menu); -    connect(&config_list_timer, &QTimer::timeout, this, &main_window::refresh_profile_list); -    config_list_timer.start(1000 * 5); +    connect(&profile_list_timer, &QTimer::timeout, this, &main_window::refresh_profile_list); +    profile_list_timer.start(1000 * 5);      connect(ui.iconcomboProfile, &QComboBox::currentTextChanged,              this, [this](const QString& x) { main_window::set_profile(x); }); @@ -257,7 +257,7 @@ void main_window::register_shortcuts()          work->reload_shortcuts();  } -void main_window::die_on_config_not_writable() +void main_window::die_on_profile_not_writable()  {      stop_tracker_(); @@ -271,7 +271,7 @@ void main_window::die_on_config_not_writable()      exit(EX_OSFILE);  } -bool main_window::get_new_config_name_from_dialog(QString& ret) +bool main_window::profile_name_from_dialog(QString& ret)  {      new_file_dialog dlg;      dlg.exec(); @@ -305,10 +305,10 @@ void main_window::save_modules()      m.b->save();  } -void main_window::make_empty_config() +void main_window::create_empty_profile()  {      QString name; -    if (get_new_config_name_from_dialog(name)) +    if (profile_name_from_dialog(name))      {          QFile(ini_combine(name)).open(QFile::ReadWrite);          refresh_profile_list(); @@ -318,16 +318,16 @@ void main_window::make_empty_config()              QSignalBlocker q(ui.iconcomboProfile);              set_profile(name, false); -            mark_config_as_not_needing_migration(); +            mark_profile_as_not_needing_migration();          }      }  } -void main_window::make_copied_config() +void main_window::create_copied_profile()  {      const QString cur = ini_pathname();      QString name; -    if (!cur.isEmpty() && get_new_config_name_from_dialog(name)) +    if (!cur.isEmpty() && profile_name_from_dialog(name))      {          const QString new_name = ini_combine(name);          (void) QFile::remove(new_name); @@ -340,13 +340,13 @@ void main_window::make_copied_config()              QSignalBlocker q(ui.iconcomboProfile);              set_profile(name, false); -            mark_config_as_not_needing_migration(); +            mark_profile_as_not_needing_migration();          }      }  } -void main_window::open_config_directory() +void main_window::open_profile_directory()  {      QDesktopServices::openUrl("file:///" + QDir::toNativeSeparators(ini_directory()));  } @@ -363,7 +363,7 @@ void main_window::refresh_profile_list()          return;      if (!list.contains(current)) -        current = OPENTRACK_DEFAULT_CONFIG; +        current = OPENTRACK_DEFAULT_PROFILE;      profile_list = list; @@ -656,7 +656,7 @@ void main_window::set_profile(const QString& new_name_, bool migrate)      if (!profile_list.contains(new_name))      { -        new_name = OPENTRACK_DEFAULT_CONFIG; +        new_name = OPENTRACK_DEFAULT_PROFILE;          refresh_profile_list();          if (!profile_list.contains(new_name))              migrate = false; @@ -683,7 +683,7 @@ void main_window::set_profile(const QString& new_name_, bool migrate)          run_migrations();      }      else -        mark_config_as_not_needing_migration(); +        mark_profile_as_not_needing_migration();      set_title();  } @@ -794,7 +794,7 @@ void main_window::maybe_start_profile_from_executable()      if (!work)      {          QString profile; -        if (det.config_to_start(profile) && profile_list.contains(profile)) +        if (det.profile_to_start(profile) && profile_list.contains(profile))          {              set_profile(profile);              start_tracker_(); @@ -860,7 +860,7 @@ bool main_window::start_in_tray()  void main_window::set_profile_in_registry(const QString &profile)  {      with_global_settings_object([&](QSettings& s) { -        s.setValue(OPENTRACK_CONFIG_FILENAME_KEY, profile); +        s.setValue(OPENTRACK_PROFILE_FILENAME_KEY, profile);      });  } diff --git a/variant/default/main-window.hpp b/variant/default/main-window.hpp index 49dda590..9ffb7019 100644 --- a/variant/default/main-window.hpp +++ b/variant/default/main-window.hpp @@ -50,7 +50,7 @@ class main_window final : public QMainWindow, private State      QTimer pose_update_timer { this };      QTimer det_timer; -    QTimer config_list_timer; +    QTimer profile_list_timer;      Shortcuts global_shortcuts;      QShortcut kbd_quit { QKeySequence("Ctrl+Q"), this }; @@ -122,13 +122,13 @@ class main_window final : public QMainWindow, private State      void set_profile(const QString& new_name, bool migrate = true);      void set_profile_in_registry(const QString& profile);      void refresh_profile_list(); -    void die_on_config_not_writable(); +    void die_on_profile_not_writable();      void maybe_start_profile_from_executable(); -    [[nodiscard]] static bool get_new_config_name_from_dialog(QString &ret); +    [[nodiscard]] static bool profile_name_from_dialog(QString& ret); -    void make_empty_config(); -    void make_copied_config(); -    void open_config_directory(); +    void create_empty_profile(); +    void create_copied_profile(); +    void open_profile_directory();      void ensure_tray();      void toggle_restore_from_tray(QSystemTrayIcon::ActivationReason e);  | 
