Browse Source

Fix theme build for Windows; add trick to make it all work

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.1-rc1
falkTX 5 years ago
parent
commit
a92c54fd39
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
3 changed files with 28 additions and 5 deletions
  1. +13
    -2
      source/frontend/carla_app.py
  2. +13
    -1
      source/theme/CarlaStylePlugin.cpp
  3. +2
    -2
      source/theme/Makefile

+ 13
- 2
source/frontend/carla_app.py View File

@@ -42,12 +42,16 @@ class CarlaApplication(object):

# Needed for local wine build
if WINDOWS and CWD.endswith(("frontend", "resources")) and os.getenv("CXFREEZE") is None:
QApplication.addLibraryPath("H:\\builds\\msys2-i686\\mingw32\\share\\qt5\\plugins")
if kIs64bit:
path = "H:\\builds\\msys2-x86_64\\mingw64\\share\\qt5\\plugins"
else:
path = "H:\\builds\\msys2-i686\\mingw32\\share\\qt5\\plugins"
QApplication.addLibraryPath(path)

# Use binary dir as library path
if os.path.exists(pathBinaries):
QApplication.addLibraryPath(pathBinaries)
stylesDir = pathBinaries if not WINDOWS else "" # FIXME
stylesDir = pathBinaries

# If style is not available we can still fake it
else:
@@ -72,6 +76,13 @@ class CarlaApplication(object):

self.fApp.setStyle("carla" if stylesDir else "fusion")

if WINDOWS:
carlastyle = os.path.join(pathBinaries, "styles", "carlastyle.dll")
self._stylelib = CDLL(carlastyle, RTLD_GLOBAL)
self._stylelib.set_qt_app_style.argtypes = None
self._stylelib.set_qt_app_style.restype = None
self._stylelib.set_qt_app_style()

# set palette
proThemeColor = settings.value(CARLA_KEY_MAIN_PRO_THEME_COLOR, CARLA_DEFAULT_MAIN_PRO_THEME_COLOR, type=str).lower()



+ 13
- 1
source/theme/CarlaStylePlugin.cpp View File

@@ -1,7 +1,7 @@
/*
* Carla Style, based on Qt5 fusion style
* Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies)
* Copyright (C) 2013-2014 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2013-2019 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -18,6 +18,10 @@
#include "CarlaStylePlugin.hpp"
#include "CarlaStyle.hpp"

#ifdef CARLA_OS_WIN
# include <QtWidgets/QApplication>
#endif

CarlaStylePlugin::CarlaStylePlugin(QObject* parentObj)
: QStylePlugin(parentObj) {}

@@ -34,3 +38,11 @@ QStringList CarlaStylePlugin::keys() const

Q_EXPORT_PLUGIN2(Carla, CarlaStylePlugin)
#endif

#ifdef CARLA_OS_WIN
CARLA_EXPORT void set_qt_app_style()
{
qApp->setStyle(new CarlaStyle());
}
#endif


+ 2
- 2
source/theme/Makefile View File

@@ -11,7 +11,7 @@ include ../modules/Makefile.mk
# ---------------------------------------------------------------------------------------------------------------------

ifeq ($(WIN32),true)
NON_STATIC_LINK_FLAGS = $(shell echo $(LINK_FLAGS) | awk 'sub(" -static","")')
NON_STATIC_LINK_FLAGS = $(shell echo $(LINK_FLAGS) | awk 'sub(" -static","")') -static-libgcc
else
NON_STATIC_LINK_FLAGS = $(LINK_FLAGS)
endif
@@ -118,7 +118,7 @@ $(MODULEDIR)/$(MODULENAME).qt5.a: $(FILES_qt5) $(OBJS_qt5)
$(BINDIR)/styles/carlastyle.dll: $(FILES_qt5) $(OBJS_qt5_shared)
-@mkdir -p $(BINDIR)/styles
@echo "Linking carlastyle.dll"
@$(CXX) $(OBJS_qt5_shared) $(QT5_LINK_FLAGS) -luuid -lwinspool -lgdi32 -limm32 -lole32 -lshell32 -lws2_32 -shared -o $@
@$(CXX) $(OBJS_qt5_shared) $(QT5_LINK_FLAGS) -shared -o $@

$(BINDIR)/styles/carlastyle.dylib: $(FILES_qt5) $(OBJS_qt5_shared)
-@mkdir -p $(BINDIR)/styles


Loading…
Cancel
Save