diff options
| author | Stanislaw Halik <sthalik@misaki.pl> | 2017-05-06 13:23:44 +0200 | 
|---|---|---|
| committer | Stanislaw Halik <sthalik@misaki.pl> | 2017-05-10 11:19:22 +0200 | 
| commit | 03c5a15199b34b564314ac222d51ab687fc97a93 (patch) | |
| tree | c130aa8785dc273090dbe0f3fa04e5055d851483 | |
| parent | 632cd5bf7778cb9062633f8d27ecd6aadcaa5d28 (diff) | |
get rid of the silly mem -> shared_ptr alias
| -rw-r--r-- | gui/main-window.cpp | 8 | ||||
| -rw-r--r-- | gui/main-window.hpp | 8 | ||||
| -rw-r--r-- | gui/main.cpp | 4 | ||||
| -rw-r--r-- | logic/selected-libraries.hpp | 11 | ||||
| -rw-r--r-- | logic/state.hpp | 2 | ||||
| -rw-r--r-- | logic/work.cpp | 2 | ||||
| -rw-r--r-- | logic/work.hpp | 2 | ||||
| -rw-r--r-- | spline/spline-widget.cpp | 2 | ||||
| -rw-r--r-- | spline/spline.cpp | 4 | ||||
| -rw-r--r-- | spline/spline.hpp | 6 | 
10 files changed, 26 insertions, 23 deletions
| diff --git a/gui/main-window.cpp b/gui/main-window.cpp index 96be298e..aa8e16f3 100644 --- a/gui/main-window.cpp +++ b/gui/main-window.cpp @@ -74,13 +74,13 @@ MainWindow::MainWindow() :      {          modules.filters().push_front(std::make_shared<dylib>("", dylib::Filter)); -        for (mem<dylib>& x : modules.trackers()) +        for (std::shared_ptr<dylib>& x : modules.trackers())              ui.iconcomboTrackerSource->addItem(x->icon, x->name); -        for (mem<dylib>& x : modules.protocols()) +        for (std::shared_ptr<dylib>& x : modules.protocols())              ui.iconcomboProtocol->addItem(x->icon, x->name); -        for (mem<dylib>& x : modules.filters()) +        for (std::shared_ptr<dylib>& x : modules.filters())              ui.iconcomboFilter->addItem(x->icon, x->name);      } @@ -601,7 +601,7 @@ inline bool MainWindow::mk_window(ptr<t>& place, Args&&... params)  }  template<typename t> -bool MainWindow::mk_dialog(mem<dylib> lib, ptr<t>& d) +bool MainWindow::mk_dialog(std::shared_ptr<dylib> lib, ptr<t>& d)  {      const bool just_created = mk_window_common(d, [&]() -> t* {          if (lib && lib->Dialog) diff --git a/gui/main-window.hpp b/gui/main-window.hpp index 71e372f0..ef6143e7 100644 --- a/gui/main-window.hpp +++ b/gui/main-window.hpp @@ -68,15 +68,15 @@ class MainWindow : public QMainWindow, private State              menu_action_tracker, menu_action_filter, menu_action_proto,              menu_action_options, menu_action_mappings; -    mem<dylib> current_tracker() +    std::shared_ptr<dylib> current_tracker()      {          return modules.trackers().value(ui.iconcomboTrackerSource->currentIndex(), nullptr);      } -    mem<dylib> current_protocol() +    std::shared_ptr<dylib> current_protocol()      {          return modules.protocols().value(ui.iconcomboProtocol->currentIndex(), nullptr);      } -    mem<dylib> current_filter() +    std::shared_ptr<dylib> current_filter()      {          return modules.filters().value(ui.iconcomboFilter->currentIndex(), nullptr);      } @@ -99,7 +99,7 @@ class MainWindow : public QMainWindow, private State      // only use in impl file since no definition in header!      template<typename t> -    bool mk_dialog(mem<dylib> lib, ptr<t>& d); +    bool mk_dialog(std::shared_ptr<dylib> lib, ptr<t>& d);      // idem      template<typename t, typename... Args> diff --git a/gui/main.cpp b/gui/main.cpp index 80040732..16e08b6e 100644 --- a/gui/main.cpp +++ b/gui/main.cpp @@ -129,13 +129,13 @@ main(int argc, char** argv)      if (!QSettings(OPENTRACK_ORG).value("disable-translation", false).toBool())      { -        (void) t.load(QLocale(), "", "", QCoreApplication::applicationDirPath() + "/" + OPENTRACK_I18N_PATH, ".qm"); +        (void) t.load(QLocale(), "", "", QCoreApplication::applicationDirPath() + "/" OPENTRACK_I18N_PATH, ".qm");          (void) QCoreApplication::installTranslator(&t);      }      do      { -       mem<MainWindow> w = std::make_shared<MainWindow>(); +       std::shared_ptr<MainWindow> w = std::make_shared<MainWindow>();         if (!w->isEnabled())             break; diff --git a/logic/selected-libraries.hpp b/logic/selected-libraries.hpp index 689cbec3..65e9733e 100644 --- a/logic/selected-libraries.hpp +++ b/logic/selected-libraries.hpp @@ -15,11 +15,14 @@  struct OTR_LOGIC_EXPORT SelectedLibraries  { -    using dylibptr = mem<dylib>; -    mem<ITracker> pTracker; -    mem<IFilter> pFilter; -    mem<IProtocol> pProtocol; +    using dylibptr = std::shared_ptr<dylib>; + +    std::shared_ptr<ITracker> pTracker; +    std::shared_ptr<IFilter> pFilter; +    std::shared_ptr<IProtocol> pProtocol; +      SelectedLibraries(QFrame* frame, dylibptr t, dylibptr p, dylibptr f);      SelectedLibraries() : pTracker(nullptr), pFilter(nullptr), pProtocol(nullptr), correct(false) {} +      bool correct;  }; diff --git a/logic/state.hpp b/logic/state.hpp index f5892557..8bef71ad 100644 --- a/logic/state.hpp +++ b/logic/state.hpp @@ -26,5 +26,5 @@ struct State      Modules modules;      main_settings s;      Mappings pose; -    mem<Work> work; +    std::shared_ptr<Work> work;  }; diff --git a/logic/work.cpp b/logic/work.cpp index 7b9e550e..6829e62b 100644 --- a/logic/work.cpp +++ b/logic/work.cpp @@ -60,7 +60,7 @@ std::shared_ptr<TrackLogger> Work::make_logger(main_settings &s)  } -Work::Work(Mappings& m, QFrame* frame, mem<dylib> tracker_, mem<dylib> filter_, mem<dylib> proto_) : +Work::Work(Mappings& m, QFrame* frame, std::shared_ptr<dylib> tracker_, std::shared_ptr<dylib> filter_, std::shared_ptr<dylib> proto_) :      libs(frame, tracker_, filter_, proto_),      logger(make_logger(s)),      tracker(std::make_shared<Tracker>(m, libs, *logger)), diff --git a/logic/work.hpp b/logic/work.hpp index f1d5e401..dc32536c 100644 --- a/logic/work.hpp +++ b/logic/work.hpp @@ -35,7 +35,7 @@ struct OTR_LOGIC_EXPORT Work      std::shared_ptr<Shortcuts> sc;      std::vector<key_tuple> keys; -    Work(Mappings& m, QFrame* frame, mem<dylib> tracker, mem<dylib> filter, mem<dylib> proto); +    Work(Mappings& m, QFrame* frame, std::shared_ptr<dylib> tracker, std::shared_ptr<dylib> filter, std::shared_ptr<dylib> proto);      ~Work();      void reload_shortcuts();      bool is_ok() const; diff --git a/spline/spline-widget.cpp b/spline/spline-widget.cpp index fef03e82..c71626f0 100644 --- a/spline/spline-widget.cpp +++ b/spline/spline-widget.cpp @@ -59,7 +59,7 @@ void spline_widget::setConfig(spline* spl)          if (spl)          { -            mem<spline::settings> s = spl->get_settings(); +            std::shared_ptr<spline::settings> s = spl->get_settings();              connection = connect(s.get(), &spline::settings::recomputed,                                   this, [this]() { reload_spline(); },                                   Qt::QueuedConnection); diff --git a/spline/spline.cpp b/spline/spline.cpp index 58703e02..c1f09db8 100644 --- a/spline/spline.cpp +++ b/spline/spline.cpp @@ -428,13 +428,13 @@ void spline::recompute()  }  // the return value is only safe to use with no spline::set_bundle calls -mem<spline::settings> spline::get_settings() +std::shared_ptr<spline::settings> spline::get_settings()  {      QMutexLocker foo(&_mutex);      return s;  } -mem<const spline::settings> spline::get_settings() const +std::shared_ptr<const spline::settings> spline::get_settings() const  {      QMutexLocker foo(&_mutex);      return s; diff --git a/spline/spline.hpp b/spline/spline.hpp index 146837c8..acb1861a 100644 --- a/spline/spline.hpp +++ b/spline/spline.hpp @@ -52,7 +52,7 @@ class OTR_SPLINE_EXPORT spline final      static QPointF ensure_in_bounds(const QList<QPointF>& points, double max_x, int i);      static int element_count(const QList<QPointF>& points, double max_x); -    mem<spline_detail::settings> s; +    std::shared_ptr<spline_detail::settings> s;      QMetaObject::Connection connection;      std::vector<float> data; @@ -99,8 +99,8 @@ public:      bundle get_bundle();      void recompute(); -    mem<settings> get_settings(); -    mem<const settings> get_settings() const; +    std::shared_ptr<settings> get_settings(); +    std::shared_ptr<const settings> get_settings() const;      using points_t = decltype(s->points());      int get_point_count() const; | 
