Browse Source

CarlaStyle fixes, apply on start

tags/1.9.4
falkTX 11 years ago
parent
commit
076fbeb72d
11 changed files with 80 additions and 76 deletions
  1. +1
    -0
      .gitignore
  2. +6
    -0
      resources/resources-theme.qrc
  3. +0
    -2
      source/backend/CarlaStandalone.hpp
  4. +5
    -28
      source/backend/standalone/CarlaStandalone.cpp
  5. +0
    -1
      source/carla.py
  6. +0
    -8
      source/carla_backend.py
  7. +1
    -0
      source/libs/Makefile
  8. +50
    -24
      source/theme/CarlaStyle.cpp
  9. +7
    -12
      source/theme/CarlaStyle.hpp
  10. +6
    -1
      source/theme/CarlaStyleAnimations.hpp
  11. +4
    -0
      source/utils/CarlaUtils.hpp

+ 1
- 0
.gitignore View File

@@ -27,6 +27,7 @@
*.moc *.moc
moc_*.cpp moc_*.cpp
ui_*.h ui_*.h
resources.cpp


# Python files # Python files
*.pyc *.pyc


+ 6
- 0
resources/resources-theme.qrc View File

@@ -0,0 +1,6 @@
<RCC version="1.0">
<qresource prefix="/">
<file>bitmaps/style/arrow.png</file>
<file>bitmaps/style/groupbox.png</file>
</qresource>
</RCC>

+ 0
- 2
source/backend/CarlaStandalone.hpp View File

@@ -183,8 +183,6 @@ struct CarlaTransportInfo {
CARLA_EXPORT const char* carla_get_extended_license_text(); CARLA_EXPORT const char* carla_get_extended_license_text();
CARLA_EXPORT const char* carla_get_supported_file_types(); 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 unsigned int carla_get_engine_driver_count();
CARLA_EXPORT const char* carla_get_engine_driver_name(unsigned int index); CARLA_EXPORT const char* carla_get_engine_driver_name(unsigned int index);




+ 5
- 28
source/backend/standalone/CarlaStandalone.cpp View File

@@ -60,7 +60,11 @@ struct CarlaBackendStandalone {
callbackPtr(nullptr), callbackPtr(nullptr),
engine(nullptr), engine(nullptr),
app(qApp), app(qApp),
needsInit(app == nullptr) {}
needsInit(app == nullptr)
{
if (app != nullptr)
app->setStyle(new CarlaStyle());
}


void init() void init()
{ {
@@ -87,18 +91,6 @@ struct CarlaBackendStandalone {
app = nullptr; 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) CARLA_DECLARE_NON_COPY_STRUCT_WITH_LEAK_DETECTOR(CarlaBackendStandalone)


} standalone; } 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() unsigned int carla_get_engine_driver_count()
{ {
carla_debug("carla_get_engine_driver_count()"); carla_debug("carla_get_engine_driver_count()");


+ 0
- 1
source/carla.py View File

@@ -1951,7 +1951,6 @@ if __name__ == '__main__':
Carla.host = Host(libName) Carla.host = Host(libName)
Carla.host.set_engine_callback(engineCallback) Carla.host.set_engine_callback(engineCallback)
Carla.host.set_engine_option(OPTION_PROCESS_NAME, 0, "carla") Carla.host.set_engine_option(OPTION_PROCESS_NAME, 0, "carla")
Carla.host.set_up_qt(app)


# Set bridge paths # Set bridge paths
if carla_bridge_native: if carla_bridge_native:


+ 0
- 8
source/carla_backend.py View File

@@ -21,7 +21,6 @@


from ctypes import * from ctypes import *
from platform import architecture from platform import architecture
from sip import unwrapinstance
from sys import platform, maxsize from sys import platform, maxsize


# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
@@ -254,7 +253,6 @@ else:


c_enum = c_int c_enum = c_int
c_nullptr = None 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) 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.argtypes = None
self.lib.carla_get_supported_file_types.restype = c_char_p 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.argtypes = None
self.lib.carla_get_engine_driver_count.restype = c_uint self.lib.carla_get_engine_driver_count.restype = c_uint


@@ -612,9 +607,6 @@ class Host(object):
def get_supported_file_types(self): def get_supported_file_types(self):
return self.lib.carla_get_supported_file_types() 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): def get_engine_driver_count(self):
return self.lib.carla_get_engine_driver_count() return self.lib.carla_get_engine_driver_count()




+ 1
- 0
source/libs/Makefile View File

@@ -60,3 +60,4 @@ clean:
$(MAKE) clean -C lilv $(MAKE) clean -C lilv
$(MAKE) clean -C rtmempool $(MAKE) clean -C rtmempool
$(MAKE) clean -C ../widgets $(MAKE) clean -C ../widgets
$(MAKE) clean -C ../theme

+ 50
- 24
source/theme/CarlaStyle.cpp View File

@@ -22,17 +22,36 @@
#include <QtGui/QPainter> #include <QtGui/QPainter>
#include <QtGui/QPixmapCache> #include <QtGui/QPixmapCache>


#include <QtGui/QApplication>
#include <QtGui/QComboBox>
#include <QtGui/QGroupBox>
#include <QtGui/QMainWindow>
#include <QtGui/QProgressBar>
#include <QtGui/QPushButton>
#include <QtGui/QScrollBar>
#include <QtGui/QSlider>
#include <QtGui/QSpinBox>
#include <QtGui/QSplitter>
#include <QtGui/QWizard>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
# include <QtWidgets/qdrawutil.h>
# include <QtWidgets/QApplication>
# include <QtWidgets/QComboBox>
# include <QtWidgets/QGroupBox>
# include <QtWidgets/QMainWindow>
# include <QtWidgets/QProgressBar>
# include <QtWidgets/QPushButton>
# include <QtWidgets/QScrollBar>
# include <QtWidgets/QSlider>
# include <QtWidgets/QSpinBox>
# include <QtWidgets/QSplitter>
# include <QtWidgets/QWizard>
#else
# include <QtGui/QApplication>
# include <QtGui/QComboBox>
# include <QtGui/QGroupBox>
# include <QtGui/QMainWindow>
# include <QtGui/QProgressBar>
# include <QtGui/QPushButton>
# include <QtGui/QScrollBar>
# include <QtGui/QSlider>
# include <QtGui/QSpinBox>
# include <QtGui/QSplitter>
# include <QtGui/QWizard>
#endif

#ifdef CARLA_EXPORT_STYLE
# include <QtGui/QStylePlugin>
#endif


#define BEGIN_STYLE_PIXMAPCACHE(a) \ #define BEGIN_STYLE_PIXMAPCACHE(a) \
QRect rect = option->rect; \ QRect rect = option->rect; \
@@ -3457,21 +3476,28 @@ QRect CarlaStyle::subElementRect(SubElement sr, const QStyleOption *opt, const Q
return r; 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

+ 7
- 12
source/theme/CarlaStyle.hpp View File

@@ -19,8 +19,13 @@
#ifndef __CARLA_STYLE_HPP__ #ifndef __CARLA_STYLE_HPP__
#define __CARLA_STYLE_HPP__ #define __CARLA_STYLE_HPP__


#include <QtGui/QCommonStyle>
#include <QtGui/QStylePlugin>
#include <QtCore/Qt>

#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
# include <QtWidgets/QCommonStyle>
#else
# include <QtGui/QCommonStyle>
#endif


class CarlaStylePrivate; class CarlaStylePrivate;


@@ -59,14 +64,4 @@ private:
friend class CarlaStylePrivate; 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__ #endif // __CARLA_STYLE_HPP__

+ 6
- 1
source/theme/CarlaStyleAnimations.hpp View File

@@ -23,7 +23,12 @@
#include <QtCore/QCoreApplication> #include <QtCore/QCoreApplication>
#include <QtCore/QDateTime> #include <QtCore/QDateTime>
#include <QtGui/QImage> #include <QtGui/QImage>
#include <QtGui/QWidget>

#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
# include <QtWidgets/QWidget>
#else
# include <QtGui/QWidget>
#endif


class CarlaStyleAnimation : public QAbstractAnimation class CarlaStyleAnimation : public QAbstractAnimation
{ {


+ 4
- 0
source/utils/CarlaUtils.hpp View File

@@ -62,6 +62,8 @@ void carla_debug(const char* const fmt, ...)
std::vfprintf(stdout, fmt, args); std::vfprintf(stdout, fmt, args);
#ifndef CARLA_OS_WIN #ifndef CARLA_OS_WIN
std::fprintf(stdout, "\x1b[0m\n"); std::fprintf(stdout, "\x1b[0m\n");
#else
std::fprintf(stdout, "\n");
#endif #endif
va_end(args); va_end(args);
} }
@@ -98,6 +100,8 @@ void carla_stderr2(const char* const fmt, ...)
std::vfprintf(stderr, fmt, args); std::vfprintf(stderr, fmt, args);
#ifndef CARLA_OS_WIN #ifndef CARLA_OS_WIN
std::fprintf(stderr, "\x1b[0m\n"); std::fprintf(stderr, "\x1b[0m\n");
#else
std::fprintf(stderr, "\n");
#endif #endif
va_end(args); va_end(args);
} }


Loading…
Cancel
Save