From efab199484d2b5f1b333257b052a71eef2f4be8a Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 26 Jan 2022 02:15:41 +0100 Subject: opentrack: merge mk_window{,_common} --- opentrack/main-window.cpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'opentrack') diff --git a/opentrack/main-window.cpp b/opentrack/main-window.cpp index 42dfacc4..26da2f67 100644 --- a/opentrack/main-window.cpp +++ b/opentrack/main-window.cpp @@ -630,13 +630,16 @@ static void show_window(QWidget& d, bool fresh) } } -template -static bool mk_window_common(std::unique_ptr& d, bool show, F&& fun) +template +static bool mk_window(std::unique_ptr& d, bool show, Args&&... params) { bool fresh = false; if (!d) - d = fun(), fresh = !!d; + { + d = std::make_unique(std::forward(params)...); + fresh = !!d; + } if (d) { @@ -647,14 +650,6 @@ static bool mk_window_common(std::unique_ptr& d, bool show, F&& fun) return fresh; } -template -static bool mk_window(std::unique_ptr& place, bool show, Args&&... params) -{ - return mk_window_common(place, show, [&] { - return std::make_unique(std::forward(params)...); - }); -} - template static void show_module_settings(std::shared_ptr instance, std::unique_ptr& dialog, -- cgit v1.2.3