summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2018-07-09 05:33:58 +0200
committerStanislaw Halik <sthalik@misaki.pl>2018-07-09 05:35:08 +0200
commit793cea587159a0ba01fec6af28e899697ef4da79 (patch)
treeb4ec4477862ed74dc2c180d2b002915f8df040e8
parent841e163ae4b86317cca29748cf0f2730418e4fa5 (diff)
cleanup only
-rw-r--r--api/plugin-support.hpp2
-rw-r--r--cmake/msvc.cmake4
-rw-r--r--cmake/opentrack-boilerplate.cmake2
-rw-r--r--compat/macros.hpp18
-rw-r--r--tracker-pt/CMakeLists.txt5
-rw-r--r--tracker-pt/module/CMakeLists.txt4
-rw-r--r--tracker-pt/point_tracker.h4
-rw-r--r--tracker-pt/pt-api.cpp41
-rw-r--r--tracker-pt/pt-settings.cpp8
-rw-r--r--tracker-pt/pt-settings.hpp12
-rw-r--r--variant/default/main-window.cpp26
11 files changed, 61 insertions, 65 deletions
diff --git a/api/plugin-support.hpp b/api/plugin-support.hpp
index 5e93e119..5062a688 100644
--- a/api/plugin-support.hpp
+++ b/api/plugin-support.hpp
@@ -29,7 +29,7 @@
# define OPENTRACK_SOLIB_EXT "so"
#endif
-#define OPENTRACK_SOLIB_PREFIX "lib"
+#define OPENTRACK_SOLIB_PREFIX ""
extern "C" typedef void* (*OPENTRACK_CTOR_FUNPTR)(void);
extern "C" typedef Metadata_* (*OPENTRACK_METADATA_FUNPTR)(void);
diff --git a/cmake/msvc.cmake b/cmake/msvc.cmake
index 4c629861..def8b7dc 100644
--- a/cmake/msvc.cmake
+++ b/cmake/msvc.cmake
@@ -42,8 +42,8 @@ if(CMAKE_PROJECT_NAME STREQUAL "opentrack")
#C4266 - no override available for virtual member function from base type, function is hidden
#C4928 - illegal copy-initialization, more than one user-defined conversion has been implicitly applied
- set(warns 4263 4264 4266 4928)
- set(warns-noerr 4265)
+ set(warns 4265)
+ set(warns-noerr)
foreach(i ${warns})
set(warns_ "${warns_} -w1${i} -we${i}")
diff --git a/cmake/opentrack-boilerplate.cmake b/cmake/opentrack-boilerplate.cmake
index 694c644d..78d0e1dd 100644
--- a/cmake/opentrack-boilerplate.cmake
+++ b/cmake/opentrack-boilerplate.cmake
@@ -158,7 +158,7 @@ function(otr_module n_)
set(link-mode STATIC)
endif()
add_library(${n} ${link-mode} "${${n}-all}")
- set_property(TARGET "${n}" PROPERTY PREFIX "lib")
+ set_property(TARGET "${n}" PROPERTY PREFIX "")
endif()
set_property(SOURCE ${${n}-moc} ${${n}-uih} ${${n}-rcc} PROPERTY GENERATED TRUE)
diff --git a/compat/macros.hpp b/compat/macros.hpp
index 0807df4c..a6f3d0e9 100644
--- a/compat/macros.hpp
+++ b/compat/macros.hpp
@@ -40,17 +40,26 @@
# define PP_CAT2(x,y) x ## y
#endif
+#ifndef PP_EXPAND
+# define PP_EXPAND(x) PP_EXPAND__2(x)
+# define PP_EXPAND__2(x) PP_EXPAND__3(x) x
+# define PP_EXPAND__3(x) x
+#endif
+
#if defined __cplusplus
// from now only C++
#include <utility>
-//#define once_only(...) do { static bool once__ = false; if (!once__) { once__ = true; __VA_ARGS__; } } while(false)
-//#define once_only(expr) ([&] { static decltype(auto) ret___1132 = (expr); return (decltype(ret___1132) const&) ret___1132; }())
+// causes ICE in Visual Studio 2017 Preview. the ICE was reported and they handle them seriously in due time.
+// the ICE is caused by decltype(auto) and const& return value
+//#define eval_once(expr) ([&]() -> decltype(auto) { static decltype(auto) ret___1132 = (expr); return (decltype(ret___1132) const&) ret___1132; }())
-#define eval_once__2(expr, ident) (([&] { static bool ident = ((expr), true); (void)(ident); }))
-#define eval_once(expr) eval_once__2(expr, PP_CAT(eval_once_init__, __COUNTER__))
+#define eval_once(expr) eval_once__2(expr, PP_CAT(_EVAL_ONCE__, __COUNTER__))
+#define eval_once__2(expr, ident) eval_once__3(expr, ident)
+#define eval_once__3(expr, ident) \
+ ([&]() -> std::decay_t<decltype(expr)> const& { static const std::decay_t<decltype(expr)> INIT##ident = (expr); return INIT##ident; }())
#include <type_traits>
@@ -68,6 +77,7 @@ constexpr cc_forceinline void static_warn<true>() {}
#define static_warning(cond) \
static_warn<(cond)>(); \
+#define typed_progn(type, ...) (([&] () -> type { __VA_ARGS__ })())
#define progn(...) (([&] { __VA_ARGS__ })())
#define prog1(x, ...) (([&] { decltype(auto) ret1324 = (x); __VA_ARGS__; return ret1324; })())
diff --git a/tracker-pt/CMakeLists.txt b/tracker-pt/CMakeLists.txt
index 326f345c..4010b6c1 100644
--- a/tracker-pt/CMakeLists.txt
+++ b/tracker-pt/CMakeLists.txt
@@ -1,7 +1,8 @@
find_package(OpenCV QUIET)
if(OpenCV_FOUND)
otr_module(tracker-pt-base STATIC)
- target_include_directories(opentrack-tracker-pt-base SYSTEM PUBLIC ${OpenCV_INCLUDE_DIRS})
- target_link_libraries(opentrack-tracker-pt-base opentrack-cv opencv_core opencv_imgproc opencv_videoio)
+ target_include_directories(${self} SYSTEM PUBLIC ${OpenCV_INCLUDE_DIRS})
+ target_link_libraries(${self} opentrack-cv opencv_core opencv_imgproc opencv_videoio)
+ set_property(TARGET ${self} PROPERTY OUTPUT_NAME "pt-base")
endif()
add_subdirectory(module)
diff --git a/tracker-pt/module/CMakeLists.txt b/tracker-pt/module/CMakeLists.txt
index f0f90f8a..22b725c9 100644
--- a/tracker-pt/module/CMakeLists.txt
+++ b/tracker-pt/module/CMakeLists.txt
@@ -1,8 +1,6 @@
find_package(OpenCV QUIET)
if(OpenCV_FOUND)
- otr_module(tracker-pt-static STATIC)
+ otr_module(tracker-pt)
target_link_libraries(${self} opentrack-tracker-pt-base)
target_include_directories(${self} PUBLIC "${CMAKE_SOURCE_DIR}/tracker-pt")
- otr_module(tracker-pt)
- target_link_libraries(${self} opentrack-tracker-pt-static)
endif()
diff --git a/tracker-pt/point_tracker.h b/tracker-pt/point_tracker.h
index 5e741c75..cfe3735c 100644
--- a/tracker-pt/point_tracker.h
+++ b/tracker-pt/point_tracker.h
@@ -84,5 +84,5 @@ private:
} // ns pt_impl
-using pt_module::PointTracker;
-using pt_module::PointModel;
+using PointTracker = pt_module::PointTracker;
+using PointModel = pt_module::PointModel;
diff --git a/tracker-pt/pt-api.cpp b/tracker-pt/pt-api.cpp
index 596590dc..d137a60a 100644
--- a/tracker-pt/pt-api.cpp
+++ b/tracker-pt/pt-api.cpp
@@ -3,9 +3,7 @@
using namespace types;
-pt_camera_info::pt_camera_info()
-{
-}
+pt_camera_info::pt_camera_info() = default;
double pt_camera_info::get_focal_length(f fov, int res_x, int res_y)
{
@@ -21,29 +19,12 @@ double pt_camera_info::get_focal_length(f fov, int res_x, int res_y)
//static bool once = false; if (!once) { once = true; qDebug() << "f" << ret << "fov" << (fov * 180/M_PI); }
}
-pt_camera::pt_camera()
-{
-}
-
-pt_camera::~pt_camera()
-{
-}
-
-pt_runtime_traits::pt_runtime_traits()
-{
-}
-
-pt_runtime_traits::~pt_runtime_traits()
-{
-}
-
-pt_point_extractor::pt_point_extractor()
-{
-}
-
-pt_point_extractor::~pt_point_extractor()
-{
-}
+pt_camera::pt_camera() = default;
+pt_camera::~pt_camera() = default;
+pt_runtime_traits::pt_runtime_traits() = default;
+pt_runtime_traits::~pt_runtime_traits() = default;
+pt_point_extractor::pt_point_extractor() = default;
+pt_point_extractor::~pt_point_extractor() = default;
double pt_point_extractor::threshold_radius_value(int w, int h, int threshold)
{
@@ -68,10 +49,6 @@ std::tuple<double, double> pt_pixel_pos_mixin::to_screen_pos(double px, double p
return std::make_tuple((px - w/2.)/w, -(py - h/2.)/w);
}
-pt_frame::pt_frame()
-{
-}
+pt_frame::pt_frame() = default;
-pt_frame::~pt_frame()
-{
-}
+pt_frame::~pt_frame() = default;
diff --git a/tracker-pt/pt-settings.cpp b/tracker-pt/pt-settings.cpp
new file mode 100644
index 00000000..5e9e1e1a
--- /dev/null
+++ b/tracker-pt/pt-settings.cpp
@@ -0,0 +1,8 @@
+#include "pt-settings.hpp"
+
+namespace pt_settings_detail {
+
+pt_settings::pt_settings(const QString& name) : opts(name) {}
+pt_settings::~pt_settings() = default;
+
+} // ns pt_settings_detail
diff --git a/tracker-pt/pt-settings.hpp b/tracker-pt/pt-settings.hpp
index a35c248b..62297713 100644
--- a/tracker-pt/pt-settings.hpp
+++ b/tracker-pt/pt-settings.hpp
@@ -14,12 +14,16 @@ enum pt_color_type
pt_color_blue_only = 6,
};
+namespace pt_settings_detail {
+
+using namespace options;
+
struct pt_settings final : options::opts
{
using slider_value = options::slider_value;
- explicit pt_settings(const QString& name) : opts(name) {}
- ~pt_settings() override = default;
+ explicit pt_settings(const QString& name);
+ ~pt_settings() override;
value<QString> camera_name { b, "camera-name", "" };
value<int> cam_res_x { b, "camera-res-width", 640 },
@@ -54,3 +58,7 @@ struct pt_settings final : options::opts
value<slider_value> threshold_slider { b, "threshold-slider", { 128, 0, 255 } };
};
+
+} // ns pt_settings_detail
+
+using pt_settings = pt_settings_detail::pt_settings;
diff --git a/variant/default/main-window.cpp b/variant/default/main-window.cpp
index 0d817bca..200400e6 100644
--- a/variant/default/main-window.cpp
+++ b/variant/default/main-window.cpp
@@ -866,19 +866,14 @@ void main_window::ensure_tray()
void main_window::toggle_restore_from_tray(QSystemTrayIcon::ActivationReason e)
{
- if (progn(
- switch (e)
- {
- // if we enable double click also then it causes
- // toggle back to the original state
- //case QSystemTrayIcon::DoubleClick:
- case QSystemTrayIcon::Trigger: // single click
- return false;
- default:
- return true;
- }
- ))
+ switch (e)
{
+ // if we enable double click also then it causes
+ // toggle back to the original state
+ //case QSystemTrayIcon::DoubleClick:
+ case QSystemTrayIcon::Trigger: // single click
+ break;
+ default:
return;
}
@@ -891,12 +886,11 @@ void main_window::toggle_restore_from_tray(QSystemTrayIcon::ActivationReason e)
setVisible(is_minimized);
setHidden(!is_minimized);
- setWindowState(progn(
- using ws = Qt::WindowStates;
+ setWindowState(typed_progn(Qt::WindowStates,
if (is_minimized)
- return ws(windowState() & (~Qt::WindowMinimized));
+ return windowState() & ~Qt::WindowMinimized;
else
- return ws(Qt::WindowNoState);
+ return Qt::WindowNoState;
));
if (is_minimized)