summaryrefslogtreecommitdiffhomepage
path: root/variant
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2018-12-07 08:43:03 +0100
committerStanislaw Halik <sthalik@misaki.pl>2018-12-08 21:30:48 +0100
commit709fe557a3a5c2dc8675472dac9325f8efdff004 (patch)
treefa257eae76fc50d3cbe7b69b5c423108c170af90 /variant
parent788cfe69a1668dfd7e6bca16907de696e6063fbe (diff)
clean up a bit
Diffstat (limited to 'variant')
-rw-r--r--variant/default/main-window.cpp62
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()