diff options
Diffstat (limited to 'variant/default')
-rw-r--r-- | variant/default/main-window.cpp | 62 |
1 files changed, 31 insertions, 31 deletions
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<typename t, typename... Args> -bool mk_window(std::unique_ptr<t>& place, Args&&... params) -{ - return mk_window_common(place, [&] { - return std::make_unique<t>(params...); - }); -} - -template<typename t> -bool mk_dialog(std::unique_ptr<t>& place, const std::shared_ptr<dylib>& lib) +void show_window(QWidget& d, bool fresh) { - using u = std::unique_ptr<t>; + 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<typename t, typename F> @@ -672,22 +669,25 @@ bool mk_window_common(std::unique_ptr<t>& d, F&& fun) return fresh; } -void show_window(QWidget& d, bool fresh) +template<typename t, typename... Args> +bool mk_window(std::unique_ptr<t>& 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<t>(params...); + }); +} - d.show(); - d.adjustSize(); - d.raise(); - } - else - { - d.show(); - d.raise(); - } +template<typename t> +bool mk_dialog(std::unique_ptr<t>& place, const std::shared_ptr<dylib>& lib) +{ + using u = std::unique_ptr<t>; + + return mk_window_common(place, [&] { + if (lib && lib->Dialog) + return u{ (t*)lib->Dialog() }; + else + return u{}; + }); } void main_window::show_tracker_settings() |