summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2018-04-28 17:26:05 +0200
committerStanislaw Halik <sthalik@misaki.pl>2018-04-28 21:27:35 +0200
commit0c27d726a900b901e8bffafe993a3d3e36bf27f3 (patch)
tree960bcda73075a62826300d7805f6db1b303ac540
parentc80dd2e156e20f028cf4631fd7874a89c3568bab (diff)
random cleanups
-rw-r--r--options/defs.hpp1
-rw-r--r--options/value-traits.hpp6
-rw-r--r--options/value.hpp8
-rw-r--r--tracker-pt/CMakeLists.txt4
-rw-r--r--tracker-pt/module/module.hpp6
-rw-r--r--variant/default/main-window.cpp16
6 files changed, 22 insertions, 19 deletions
diff --git a/options/defs.hpp b/options/defs.hpp
index feaad005..f14a1cbe 100644
--- a/options/defs.hpp
+++ b/options/defs.hpp
@@ -5,7 +5,6 @@
#define OPENTRACK_CONFIG_FILENAME_KEY "settings-filename"
#define OPENTRACK_DEFAULT_CONFIG "default.ini"
-#define OPENTRACK_DEFAULT_CONFIG_Q QStringLiteral("default.ini")
#define OTR_OPTIONS_EXPAND2(x) x
#define OTR_OPTIONS_EXPAND1(x) OTR_OPTIONS_EXPAND2(x)
diff --git a/options/value-traits.hpp b/options/value-traits.hpp
index 680f138c..8a04b46d 100644
--- a/options/value-traits.hpp
+++ b/options/value-traits.hpp
@@ -16,12 +16,12 @@ struct default_value_traits
{
virtual ~default_value_traits() = default;
- using element_type = std::decay_t<t>;
+ using stored_type = std::decay_t<t>;
using value_type = std::decay_t<u>;
static inline value_type from_value(const value_type& val, const value_type&) { return val; }
- static inline value_type from_storage(const element_type& x) { return static_cast<value_type>(x); }
- static inline element_type to_storage(const value_type& val) { return static_cast<element_type>(val); }
+ static inline value_type from_storage(const stored_type& x) { return static_cast<value_type>(x); }
+ static inline stored_type to_storage(const value_type& val) { return static_cast<stored_type>(val); }
};
template<typename t, typename u = t, typename Enable = void>
diff --git a/options/value.hpp b/options/value.hpp
index c8fb02ca..2c2e9dd0 100644
--- a/options/value.hpp
+++ b/options/value.hpp
@@ -34,11 +34,11 @@ template<typename t>
class value final : public base_value
{
using traits = detail::value_traits<t, t, void>;
- using element_type = typename traits::element_type;
+ using stored_type = typename traits::stored_type;
static bool is_equal(const QVariant& val1, const QVariant& val2)
{
- return val1.value<element_type>() == val2.value<element_type>();
+ return val1.value<stored_type>() == val2.value<stored_type>();
}
never_inline
@@ -52,7 +52,7 @@ class value final : public base_value
if (!b->contains(self_name) || variant.type() == QVariant::Invalid)
return def;
- const element_type x(variant.value<element_type>());
+ const stored_type x(variant.value<stored_type>());
return traits::from_value(traits::from_storage(x), def);
}
@@ -75,7 +75,7 @@ public:
never_inline
value(bundle b, const QString& name, t def) :
- base_value(b, name, &is_equal, std::type_index(typeid(element_type))),
+ base_value(b, name, &is_equal, std::type_index(typeid(stored_type))),
def(def)
{
if (!self_name.isEmpty())
diff --git a/tracker-pt/CMakeLists.txt b/tracker-pt/CMakeLists.txt
index c9809dcf..326f345c 100644
--- a/tracker-pt/CMakeLists.txt
+++ b/tracker-pt/CMakeLists.txt
@@ -1,9 +1,7 @@
-set(modules opencv_core opencv_videoio opencv_imgproc)
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 ${modules})
+ target_link_libraries(opentrack-tracker-pt-base opentrack-cv opencv_core opencv_imgproc opencv_videoio)
endif()
add_subdirectory(module)
-
diff --git a/tracker-pt/module/module.hpp b/tracker-pt/module/module.hpp
index 4a2cb919..3afe8bc9 100644
--- a/tracker-pt/module/module.hpp
+++ b/tracker-pt/module/module.hpp
@@ -1,13 +1,15 @@
#pragma once
#include "api/plugin-api.hpp"
-#include <QtGlobal>
#include <QIcon>
+#include <QString>
+
+#include "compat/linkage-macros.hpp"
namespace pt_module
{
-class Q_DECL_EXPORT metadata_pt : public Metadata
+class OTR_GENERIC_EXPORT metadata_pt : public Metadata
{
Q_OBJECT
diff --git a/variant/default/main-window.cpp b/variant/default/main-window.cpp
index c52a806e..1125b8a1 100644
--- a/variant/default/main-window.cpp
+++ b/variant/default/main-window.cpp
@@ -33,6 +33,10 @@ extern "C" const char* const opentrack_version;
# define EXIT_FAILURE 1
#endif
+#if !defined EX_OSFILE
+# define EX_OSFILE 72
+#endif
+
/* FreeBSD sysexits(3)
*
* The input data was incorrect in some way. This
@@ -132,7 +136,7 @@ main_window::main_window() :
bool ok = is_config_listed(cur) ? set_profile(cur) : set_profile(OPENTRACK_DEFAULT_CONFIG);
if (!ok)
{
- exit(64);
+ exit(EX_OSFILE);
return;
}
}
@@ -339,7 +343,7 @@ void main_window::die_on_config_not_writable()
tr("Check permissions for your .ini directory:\n\n\"%1\"%2\n\nExiting now.").arg(group::ini_directory()).arg(pad),
QMessageBox::Close, QMessageBox::NoButton);
- exit(64);
+ exit(EX_OSFILE);
}
bool main_window::maybe_die_on_config_not_writable(const QString& current, QStringList* ini_list_)
@@ -475,7 +479,7 @@ bool main_window::refresh_config_list()
QString current = group::ini_filename();
if (!ini_list.contains(current))
- current = OPENTRACK_DEFAULT_CONFIG_Q;
+ current = OPENTRACK_DEFAULT_CONFIG;
if (maybe_die_on_config_not_writable(current, &ini_list))
return false;
@@ -780,7 +784,7 @@ bool main_window::set_profile(const QString& new_name_)
QString new_name = new_name_;
if (!is_config_listed(new_name))
- new_name = OPENTRACK_DEFAULT_CONFIG_Q;
+ new_name = OPENTRACK_DEFAULT_CONFIG;
if (maybe_die_on_config_not_writable(new_name, nullptr))
return false;
@@ -979,9 +983,9 @@ bool main_window::event(QEvent* event)
case t::WindowStateChange:
case t::FocusIn:
set_is_visible(*this, true);
- /*FALLTHROUGH*/
+ break;
default:
- break;
+ break;
}
}
return QMainWindow::event(event);