From 50a78e613567c44c415c2ebc294089ff1e60493f Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 10 Oct 2017 09:22:20 +0200 Subject: compat/util: remove macro and typedefs --- compat/util.hpp | 8 -------- gui/main-window.cpp | 8 ++++---- gui/main-window.hpp | 18 +++++++++--------- 3 files changed, 13 insertions(+), 21 deletions(-) diff --git a/compat/util.hpp b/compat/util.hpp index cd0dbdef..c0d3e3fd 100644 --- a/compat/util.hpp +++ b/compat/util.hpp @@ -20,14 +20,6 @@ #define prog1(x, ...) (([&]() { auto _ret1324 = (x); do { __VA_ARGS__; } while (0); return _ret1324; })()) #define once_only(...) do { static bool once = false; if (!once) { once = true; __VA_ARGS__; } } while(false) -#define load_time_value(x) \ - progn( \ - static const auto _value132((x)); \ - return static_cast(value132); \ - ) - -template using mem = std::shared_ptr; -template using ptr = std::unique_ptr; template inline int iround(const t& val) diff --git a/gui/main-window.cpp b/gui/main-window.cpp index 010fd1d0..51e22861 100644 --- a/gui/main-window.cpp +++ b/gui/main-window.cpp @@ -574,7 +574,7 @@ void MainWindow::show_pose() } template -bool MainWindow::mk_window_common(ptr& d, F&& ctor) +bool MainWindow::mk_window_common(std::unique_ptr& d, F&& ctor) { if (d) { @@ -583,7 +583,7 @@ bool MainWindow::mk_window_common(ptr& d, F&& ctor) return false; } - else if ((d = ptr(ctor()))) + else if ((d = std::unique_ptr(ctor()))) { QWidget& w = *d; @@ -602,13 +602,13 @@ bool MainWindow::mk_window_common(ptr& d, F&& ctor) } template -inline bool MainWindow::mk_window(ptr& place, Args&&... params) +inline bool MainWindow::mk_window(std::unique_ptr& place, Args&&... params) { return mk_window_common(place, [&]() { return new t(std::forward(params)...); }); } template -bool MainWindow::mk_dialog(std::shared_ptr lib, ptr& d) +bool MainWindow::mk_dialog(std::shared_ptr lib, std::unique_ptr& 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 75f58db1..3fde4301 100644 --- a/gui/main-window.hpp +++ b/gui/main-window.hpp @@ -49,17 +49,17 @@ class MainWindow : public QMainWindow, private State Shortcuts global_shortcuts; module_settings m; - ptr tray; + std::unique_ptr tray; QMenu tray_menu; QTimer pose_update_timer; QTimer det_timer; QTimer config_list_timer; - ptr options_widget; - ptr mapping_widget; + std::unique_ptr options_widget; + std::unique_ptr mapping_widget; QShortcut kbd_quit; - ptr pFilterDialog; - ptr pProtocolDialog; - ptr pTrackerDialog; + std::unique_ptr pFilterDialog; + std::unique_ptr pProtocolDialog; + std::unique_ptr pTrackerDialog; process_detector_worker det; QMenu profile_menu; @@ -100,15 +100,15 @@ class MainWindow : public QMainWindow, private State // only use in impl file since no definition in header! template - bool mk_dialog(std::shared_ptr lib, ptr& d); + bool mk_dialog(std::shared_ptr lib, std::unique_ptr& d); // idem template - inline bool mk_window(ptr& place, Args&&... params); + inline bool mk_window(std::unique_ptr& place, Args&&... params); // idem template - bool mk_window_common(ptr& d, F&& ctor); + bool mk_window_common(std::unique_ptr& d, F&& ctor); private slots: void save_modules(); -- cgit v1.2.3