From 709fe557a3a5c2dc8675472dac9325f8efdff004 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 7 Dec 2018 08:43:03 +0100 Subject: clean up a bit --- variant/default/main-window.cpp | 62 ++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 31 deletions(-) (limited to 'variant') diff --git a/variant/default/main-window.cpp b/variant/default/main-window.cpp index 0112e2cc..5cb1af42 100644 --- a/variant/default/main-window.cpp +++ b/variant/default/main-window.cpp @@ -637,25 +637,22 @@ void main_window::show_pose() display_pose(mapped, raw); } -template -bool mk_window(std::unique_ptr& place, Args&&... params) -{ - return mk_window_common(place, [&] { - return std::make_unique(params...); - }); -} - -template -bool mk_dialog(std::unique_ptr& place, const std::shared_ptr& lib) +void show_window(QWidget& d, bool fresh) { - using u = std::unique_ptr; + if (fresh) + { + d.setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | d.windowFlags()); + d.setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - return mk_window_common(place, [&] { - if (lib && lib->Dialog) - return u{ (t*)lib->Dialog() }; - else - return u{}; - }); + d.show(); + d.adjustSize(); + d.raise(); + } + else + { + d.show(); + d.raise(); + } } template @@ -672,22 +669,25 @@ bool mk_window_common(std::unique_ptr& d, F&& fun) return fresh; } -void show_window(QWidget& d, bool fresh) +template +bool mk_window(std::unique_ptr& place, Args&&... params) { - if (fresh) - { - d.setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | d.windowFlags()); - d.setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + return mk_window_common(place, [&] { + return std::make_unique(params...); + }); +} - d.show(); - d.adjustSize(); - d.raise(); - } - else - { - d.show(); - d.raise(); - } +template +bool mk_dialog(std::unique_ptr& place, const std::shared_ptr& lib) +{ + using u = std::unique_ptr; + + return mk_window_common(place, [&] { + if (lib && lib->Dialog) + return u{ (t*)lib->Dialog() }; + else + return u{}; + }); } void main_window::show_tracker_settings() -- cgit v1.2.3