summaryrefslogtreecommitdiffhomepage
path: root/opentrack/main-window.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-01-26 02:15:41 +0100
committerStanislaw Halik <sthalik@misaki.pl>2022-01-26 02:15:41 +0100
commitefab199484d2b5f1b333257b052a71eef2f4be8a (patch)
tree6049913395314c2e93cb971cf64afe1278d3bc4b /opentrack/main-window.cpp
parentf5f3bd69fa64834b555ec8e224271756f017527e (diff)
opentrack: merge mk_window{,_common}
Diffstat (limited to 'opentrack/main-window.cpp')
-rw-r--r--opentrack/main-window.cpp17
1 files changed, 6 insertions, 11 deletions
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<typename t, typename F>
-static bool mk_window_common(std::unique_ptr<t>& d, bool show, F&& fun)
+template<typename t, typename... Args>
+static bool mk_window(std::unique_ptr<t>& d, bool show, Args&&... params)
{
bool fresh = false;
if (!d)
- d = fun(), fresh = !!d;
+ {
+ d = std::make_unique<t>(std::forward<Args>(params)...);
+ fresh = !!d;
+ }
if (d)
{
@@ -647,14 +650,6 @@ static bool mk_window_common(std::unique_ptr<t>& d, bool show, F&& fun)
return fresh;
}
-template<typename t, typename... Args>
-static bool mk_window(std::unique_ptr<t>& place, bool show, Args&&... params)
-{
- return mk_window_common(place, show, [&] {
- return std::make_unique<t>(std::forward<Args>(params)...);
- });
-}
-
template<typename Instance, typename Dialog>
static void show_module_settings(std::shared_ptr<Instance> instance,
std::unique_ptr<Dialog>& dialog,