diff --git a/.gitignore b/.gitignore
index 59696c5a1..ec2225d08 100644
--- a/.gitignore
+++ b/.gitignore
@@ -27,6 +27,7 @@
*.moc
moc_*.cpp
ui_*.h
+resources.cpp
# Python files
*.pyc
diff --git a/resources/resources-theme.qrc b/resources/resources-theme.qrc
new file mode 100644
index 000000000..f8e7e1136
--- /dev/null
+++ b/resources/resources-theme.qrc
@@ -0,0 +1,6 @@
+
+
+ bitmaps/style/arrow.png
+ bitmaps/style/groupbox.png
+
+
diff --git a/source/backend/CarlaStandalone.hpp b/source/backend/CarlaStandalone.hpp
index 824078f74..ec3a13c3a 100644
--- a/source/backend/CarlaStandalone.hpp
+++ b/source/backend/CarlaStandalone.hpp
@@ -183,8 +183,6 @@ struct CarlaTransportInfo {
CARLA_EXPORT const char* carla_get_extended_license_text();
CARLA_EXPORT const char* carla_get_supported_file_types();
-CARLA_EXPORT void carla_set_up_qt(uintptr_t app);
-
CARLA_EXPORT unsigned int carla_get_engine_driver_count();
CARLA_EXPORT const char* carla_get_engine_driver_name(unsigned int index);
diff --git a/source/backend/standalone/CarlaStandalone.cpp b/source/backend/standalone/CarlaStandalone.cpp
index 398722c3e..9735664b6 100644
--- a/source/backend/standalone/CarlaStandalone.cpp
+++ b/source/backend/standalone/CarlaStandalone.cpp
@@ -60,7 +60,11 @@ struct CarlaBackendStandalone {
callbackPtr(nullptr),
engine(nullptr),
app(qApp),
- needsInit(app == nullptr) {}
+ needsInit(app == nullptr)
+ {
+ if (app != nullptr)
+ app->setStyle(new CarlaStyle());
+ }
void init()
{
@@ -87,18 +91,6 @@ struct CarlaBackendStandalone {
app = nullptr;
}
- void registerThemeIfPossible(QApplication* const hostApp)
- {
- if (needsInit)
- return;
-
- CARLA_ASSERT(app != nullptr);
- CARLA_ASSERT(app == hostApp);
-
- if (app == hostApp)
- hostApp->setStyle(new CarlaStyle());
- }
-
CARLA_DECLARE_NON_COPY_STRUCT_WITH_LEAK_DETECTOR(CarlaBackendStandalone)
} standalone;
@@ -198,21 +190,6 @@ const char* carla_get_supported_file_types()
// -------------------------------------------------------------------------------------------------------------------
-void carla_set_up_qt(uintptr_t app)
-{
- carla_debug("carla_set_up_qt(" P_UINTPTR ")", app);
-
- CARLA_ASSERT(app != 0);
-
- if (app == 0)
- return;
-
- QApplication* hostApp = (QApplication*)CarlaBackend::getPointerFromAddress(app);
- standalone.registerThemeIfPossible(hostApp);
-}
-
-// -------------------------------------------------------------------------------------------------------------------
-
unsigned int carla_get_engine_driver_count()
{
carla_debug("carla_get_engine_driver_count()");
diff --git a/source/carla.py b/source/carla.py
index f9b382f5c..c10c17806 100755
--- a/source/carla.py
+++ b/source/carla.py
@@ -1951,7 +1951,6 @@ if __name__ == '__main__':
Carla.host = Host(libName)
Carla.host.set_engine_callback(engineCallback)
Carla.host.set_engine_option(OPTION_PROCESS_NAME, 0, "carla")
- Carla.host.set_up_qt(app)
# Set bridge paths
if carla_bridge_native:
diff --git a/source/carla_backend.py b/source/carla_backend.py
index 71cecde39..e642aced7 100644
--- a/source/carla_backend.py
+++ b/source/carla_backend.py
@@ -21,7 +21,6 @@
from ctypes import *
from platform import architecture
-from sip import unwrapinstance
from sys import platform, maxsize
# ------------------------------------------------------------------------------------------------------------
@@ -254,7 +253,6 @@ else:
c_enum = c_int
c_nullptr = None
-c_uintptr = c_uint64 if kIs64bit else c_uint32
CallbackFunc = CFUNCTYPE(None, c_void_p, c_enum, c_uint, c_int, c_int, c_float, c_char_p)
@@ -373,9 +371,6 @@ class Host(object):
self.lib.carla_get_supported_file_types.argtypes = None
self.lib.carla_get_supported_file_types.restype = c_char_p
- self.lib.carla_set_up_qt.argtypes = [c_uintptr]
- self.lib.carla_set_up_qt.restype = None
-
self.lib.carla_get_engine_driver_count.argtypes = None
self.lib.carla_get_engine_driver_count.restype = c_uint
@@ -612,9 +607,6 @@ class Host(object):
def get_supported_file_types(self):
return self.lib.carla_get_supported_file_types()
- def set_up_qt(self, app):
- self.lib.carla_set_up_qt(unwrapinstance(app))
-
def get_engine_driver_count(self):
return self.lib.carla_get_engine_driver_count()
diff --git a/source/libs/Makefile b/source/libs/Makefile
index 562b47103..390d9c9eb 100644
--- a/source/libs/Makefile
+++ b/source/libs/Makefile
@@ -60,3 +60,4 @@ clean:
$(MAKE) clean -C lilv
$(MAKE) clean -C rtmempool
$(MAKE) clean -C ../widgets
+ $(MAKE) clean -C ../theme
diff --git a/source/theme/CarlaStyle.cpp b/source/theme/CarlaStyle.cpp
index 6ae0b3cac..18df33293 100644
--- a/source/theme/CarlaStyle.cpp
+++ b/source/theme/CarlaStyle.cpp
@@ -22,17 +22,36 @@
#include
#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
+# include
+# include
+# include
+# include
+# include
+# include
+# include
+# include
+# include
+# include
+# include
+# include
+#else
+# include
+# include
+# include
+# include
+# include
+# include
+# include
+# include
+# include
+# include
+# include
+#endif
+
+#ifdef CARLA_EXPORT_STYLE
+# include
+#endif
#define BEGIN_STYLE_PIXMAPCACHE(a) \
QRect rect = option->rect; \
@@ -3457,21 +3476,28 @@ QRect CarlaStyle::subElementRect(SubElement sr, const QStyleOption *opt, const Q
return r;
}
-CarlaStylePlugin::CarlaStylePlugin(QObject* parent)
- : QStylePlugin(parent)
-{
-}
+#ifdef CARLA_EXPORT_STYLE
+# include "resources.cpp"
-QStyle* CarlaStylePlugin::create(const QString& key)
+class CarlaStylePlugin : public QStylePlugin
{
- return (key.toLower() == "carla") ? new CarlaStyle : nullptr;
-}
+ Q_OBJECT
-QStringList CarlaStylePlugin::keys() const
-{
- return QStringList() << "carla";
-}
+public:
+ CarlaStylePlugin(QObject* parent = nullptr)
+ : QStylePlugin(parent) {}
-Q_EXPORT_PLUGIN2(carla, CarlaStylePlugin)
+ QStyle* create(const QString& key)
+ {
+ return (key.toLower() == "Carla") ? new CarlaStyle() : nullptr;
+ }
+
+ QStringList keys() const
+ {
+ return QStringList() << "Carla";
+ }
+};
-#include "resources.cpp"
+Q_EXPORT_PLUGIN2(Carla, CarlaStylePlugin)
+
+#endif
diff --git a/source/theme/CarlaStyle.hpp b/source/theme/CarlaStyle.hpp
index efb76271d..02a581ff6 100644
--- a/source/theme/CarlaStyle.hpp
+++ b/source/theme/CarlaStyle.hpp
@@ -19,8 +19,13 @@
#ifndef __CARLA_STYLE_HPP__
#define __CARLA_STYLE_HPP__
-#include
-#include
+#include
+
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
+# include
+#else
+# include
+#endif
class CarlaStylePrivate;
@@ -59,14 +64,4 @@ private:
friend class CarlaStylePrivate;
};
-class CarlaStylePlugin : public QStylePlugin
-{
- Q_OBJECT
-
-public:
- CarlaStylePlugin(QObject* parent = nullptr);
- QStyle* create(const QString& key);
- QStringList keys() const;
-};
-
#endif // __CARLA_STYLE_HPP__
diff --git a/source/theme/CarlaStyleAnimations.hpp b/source/theme/CarlaStyleAnimations.hpp
index e6967a57e..1ec04130e 100644
--- a/source/theme/CarlaStyleAnimations.hpp
+++ b/source/theme/CarlaStyleAnimations.hpp
@@ -23,7 +23,12 @@
#include
#include
#include
-#include
+
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
+# include
+#else
+# include
+#endif
class CarlaStyleAnimation : public QAbstractAnimation
{
diff --git a/source/utils/CarlaUtils.hpp b/source/utils/CarlaUtils.hpp
index 284b5cb9b..b83aae61e 100644
--- a/source/utils/CarlaUtils.hpp
+++ b/source/utils/CarlaUtils.hpp
@@ -62,6 +62,8 @@ void carla_debug(const char* const fmt, ...)
std::vfprintf(stdout, fmt, args);
#ifndef CARLA_OS_WIN
std::fprintf(stdout, "\x1b[0m\n");
+#else
+ std::fprintf(stdout, "\n");
#endif
va_end(args);
}
@@ -98,6 +100,8 @@ void carla_stderr2(const char* const fmt, ...)
std::vfprintf(stderr, fmt, args);
#ifndef CARLA_OS_WIN
std::fprintf(stderr, "\x1b[0m\n");
+#else
+ std::fprintf(stderr, "\n");
#endif
va_end(args);
}