@@ -44,6 +44,9 @@ discovery: | |||
plugin: | |||
$(MAKE) -C source/plugin | |||
theme: | |||
$(MAKE) -C source/modules/theme | |||
posix32: | |||
$(MAKE) -C source/bridges posix32 | |||
$(MAKE) -C source/discovery posix32 | |||
@@ -25,6 +25,9 @@ CARLA_VESTIGE_HEADER = true | |||
AR ?= ar | |||
CC ?= gcc | |||
CXX ?= g++ | |||
MOC ?= moc | |||
RCC ?= rcc | |||
UIC ?= uic | |||
# -------------------------------------------------------------- | |||
@@ -82,17 +85,10 @@ HAVE_FLUIDSYNTH = $(shell pkg-config --exists fluidsynth && echo true) | |||
HAVE_LINUXSAMPLER = $(shell pkg-config --exists linuxsampler && echo true) | |||
endif | |||
# -------------------------------------------------------------- | |||
# TODO - move this to theme | |||
ifeq ($(HAVE_QT4),true) | |||
MOC ?= $(shell pkg-config --variable=moc_location QtCore) | |||
RCC ?= $(shell pkg-config --variable=rcc_location QtCore) | |||
UIC ?= $(shell pkg-config --variable=uic_location QtCore) | |||
else | |||
MOC ?= moc | |||
RCC ?= rcc | |||
UIC ?= uic | |||
MOC_QT4 ?= $(shell pkg-config --variable=moc_location QtCore) | |||
RCC_QT4 ?= $(shell pkg-config --variable=rcc_location QtCore) | |||
UIC_QT4 ?= $(shell pkg-config --variable=uic_location QtCore) | |||
endif | |||
# -------------------------------------------------------------- |
@@ -41,11 +41,7 @@ if __name__ == '__main__': | |||
# ------------------------------------------------------------- | |||
# App initialization | |||
app = QApplication(sys.argv) | |||
app.setApplicationName("Carla") | |||
app.setApplicationVersion(VERSION) | |||
app.setOrganizationName("falkTX") | |||
app.setWindowIcon(QIcon(":/scalable/carla.svg")) | |||
app = CarlaApplication() | |||
# ------------------------------------------------------------- | |||
# Set-up custom signal handling | |||
@@ -331,11 +331,7 @@ if __name__ == '__main__': | |||
# ------------------------------------------------------------- | |||
# App initialization | |||
app = QApplication(sys.argv) | |||
app.setApplicationName("Carla") | |||
app.setApplicationVersion(VERSION) | |||
app.setOrganizationName("falkTX") | |||
app.setWindowIcon(QIcon(":/scalable/carla.svg")) | |||
app = CarlaApplication() | |||
# ------------------------------------------------------------- | |||
# Set-up custom signal handling | |||
@@ -21,10 +21,11 @@ | |||
try: | |||
from PyQt5.QtCore import QTimer | |||
from PyQt5.QtGui import QPalette | |||
from PyQt5.QtWidgets import QApplication, QMainWindow | |||
except: | |||
from PyQt4.QtCore import QTimer | |||
from PyQt4.QtGui import QApplication, QMainWindow | |||
from PyQt4.QtGui import QApplication, QMainWindow, QPalette | |||
# ------------------------------------------------------------------------------------------------------------ | |||
# Imports (Custom) | |||
@@ -33,6 +34,7 @@ import ui_carla_host | |||
from carla_database import * | |||
from carla_settings import * | |||
from carla_style import * | |||
from carla_widgets import * | |||
# ------------------------------------------------------------------------------------------------------------ | |||
@@ -507,10 +509,10 @@ class HostWindow(QMainWindow): | |||
# ----------------------------------------------------------------- | |||
# Internal stuff (settings) | |||
def loadSettings(self, doGeometry): | |||
def loadSettings(self, firstTime): | |||
settings = QSettings() | |||
if doGeometry: | |||
if firstTime: | |||
self.restoreGeometry(settings.value("Geometry", "")) | |||
showToolbar = settings.value("ShowToolbar", True, type=bool) | |||
@@ -572,9 +574,6 @@ class HostWindow(QMainWindow): | |||
# --------------------------------------------- | |||
useCustomMiniCanvasPaint = bool(settings.value("Main/UseProTheme", True, type=bool) and | |||
settings.value("Main/ProThemeColor", "Black", type=str) == "Black") | |||
self.fSavedSettings = { | |||
"Main/DefaultProjectFolder": settings.value("Main/DefaultProjectFolder", HOME, type=str), | |||
"Main/RefreshInterval": settings.value("Main/RefreshInterval", 50, type=int), | |||
@@ -585,7 +584,8 @@ class HostWindow(QMainWindow): | |||
"Canvas/UseOpenGL": settings.value("Canvas/UseOpenGL", False, type=bool), | |||
"Canvas/Antialiasing": settings.value("Canvas/Antialiasing", CANVAS_ANTIALIASING_SMALL, type=int), | |||
"Canvas/HighQualityAntialiasing": settings.value("Canvas/HighQualityAntialiasing", False, type=bool), | |||
"UseCustomMiniCanvasPaint": useCustomMiniCanvasPaint | |||
"UseCustomMiniCanvasPaint": (settings.value("Main/UseProTheme", True, type=bool) and | |||
settings.value("Main/ProThemeColor", "Black", type=str).lower() == "black") | |||
} | |||
# --------------------------------------------- | |||
@@ -0,0 +1,212 @@ | |||
#!/usr/bin/env python3 | |||
# -*- coding: utf-8 -*- | |||
# Carla style | |||
# Copyright (C) 2013 Filipe Coelho <falktx@falktx.com> | |||
# | |||
# This program is free software you can redistribute it and/or modify | |||
# it under the terms of the GNU General Public License as published by | |||
# the Free Software Foundation either version 2 of the License, or | |||
# any later version. | |||
# | |||
# This program is distributed in the hope that it will be useful, | |||
# but WITHOUT ANY WARRANTY without even the implied warranty of | |||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
# GNU General Public License for more details. | |||
# | |||
# For a full copy of the GNU General Public License see the GPL.txt file | |||
# ------------------------------------------------------------------------------------------------------------ | |||
# Imports (Global) | |||
try: | |||
from PyQt5.QtCore import QSettings | |||
from PyQt5.QtGui import QColor, QPalette | |||
from PyQt5.QtWidgets import QApplication | |||
except: | |||
from PyQt4.QtCore import QSettings | |||
from PyQt4.QtGui import QApplication, QColor, QPalette | |||
# ------------------------------------------------------------------------------------------------------------ | |||
# Imports (Custom) | |||
from carla_shared import * | |||
# ------------------------------------------------------------------------------------------------------------ | |||
class CarlaApplication(object): | |||
# Colors | |||
COLOR_SYSTEM = 0 | |||
COLOR_BLACK = 1 | |||
COLOR_BLUE = 1 | |||
def __init__(self, appName = "Carla"): | |||
object.__init__(self) | |||
if os.path.exists(os.path.join(CWD, "modules", "theme")): | |||
libdir = os.path.join(os.path.join(CWD, "modules", "theme")) | |||
else: | |||
libdir = CWD | |||
QApplication.addLibraryPath(libdir) | |||
self.fApp = QApplication(sys.argv) | |||
self.fApp.setApplicationName(appName) | |||
self.fApp.setApplicationVersion(VERSION) | |||
self.fApp.setOrganizationName("falkTX") | |||
if appName.lower() == "carla-control": | |||
self.fApp.setWindowIcon(QIcon(":/scalable/carla-control.svg")) | |||
else: | |||
self.fApp.setWindowIcon(QIcon(":/scalable/carla.svg")) | |||
self.fPalSystem = self.fApp.palette() | |||
self.fPalBlack = QPalette() | |||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.Window, QColor(14, 14, 14)) | |||
self.fPalBlack.setColor(QPalette.Active, QPalette.Window, QColor(17, 17, 17)) | |||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.Window, QColor(17, 17, 17)) | |||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.WindowText, QColor(83, 83, 83)) | |||
self.fPalBlack.setColor(QPalette.Active, QPalette.WindowText, QColor(240, 240, 240)) | |||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.WindowText, QColor(240, 240, 240)) | |||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.Base, QColor(6, 6, 6)) | |||
self.fPalBlack.setColor(QPalette.Active, QPalette.Base, QColor(7, 7, 7)) | |||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.Base, QColor(7, 7, 7)) | |||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.AlternateBase, QColor(12, 12, 12)) | |||
self.fPalBlack.setColor(QPalette.Active, QPalette.AlternateBase, QColor(14, 14, 14)) | |||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.AlternateBase, QColor(14, 14, 14)) | |||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.ToolTipBase, QColor(4, 4, 4)) | |||
self.fPalBlack.setColor(QPalette.Active, QPalette.ToolTipBase, QColor(4, 4, 4)) | |||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.ToolTipBase, QColor(4, 4, 4)) | |||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.ToolTipText, QColor(230, 230, 230)) | |||
self.fPalBlack.setColor(QPalette.Active, QPalette.ToolTipText, QColor(230, 230, 230)) | |||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.ToolTipText, QColor(230, 230, 230)) | |||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.Text, QColor(74, 74, 74)) | |||
self.fPalBlack.setColor(QPalette.Active, QPalette.Text, QColor(230, 230, 230)) | |||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.Text, QColor(230, 230, 230)) | |||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.Button, QColor(24, 24, 24)) | |||
self.fPalBlack.setColor(QPalette.Active, QPalette.Button, QColor(28, 28, 28)) | |||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.Button, QColor(28, 28, 28)) | |||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.ButtonText, QColor(90, 90, 90)) | |||
self.fPalBlack.setColor(QPalette.Active, QPalette.ButtonText, QColor(240, 240, 240)) | |||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.ButtonText, QColor(240, 240, 240)) | |||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.BrightText, QColor(255, 255, 255)) | |||
self.fPalBlack.setColor(QPalette.Active, QPalette.BrightText, QColor(255, 255, 255)) | |||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.BrightText, QColor(255, 255, 255)) | |||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.Light, QColor(191, 191, 191)) | |||
self.fPalBlack.setColor(QPalette.Active, QPalette.Light, QColor(191, 191, 191)) | |||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.Light, QColor(191, 191, 191)) | |||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.Midlight, QColor(155, 155, 155)) | |||
self.fPalBlack.setColor(QPalette.Active, QPalette.Midlight, QColor(155, 155, 155)) | |||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.Midlight, QColor(155, 155, 155)) | |||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.Dark, QColor(129, 129, 129)) | |||
self.fPalBlack.setColor(QPalette.Active, QPalette.Dark, QColor(129, 129, 129)) | |||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.Dark, QColor(129, 129, 129)) | |||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.Mid, QColor(94, 94, 94)) | |||
self.fPalBlack.setColor(QPalette.Active, QPalette.Mid, QColor(94, 94, 94)) | |||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.Mid, QColor(94, 94, 94)) | |||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.Shadow, QColor(155, 155, 155)) | |||
self.fPalBlack.setColor(QPalette.Active, QPalette.Shadow, QColor(155, 155, 155)) | |||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.Shadow, QColor(155, 155, 155)) | |||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.Highlight, QColor(14, 14, 14)) | |||
self.fPalBlack.setColor(QPalette.Active, QPalette.Highlight, QColor(60, 60, 60)) | |||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.Highlight, QColor(34, 34, 34)) | |||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.HighlightedText, QColor(83, 83, 83)) | |||
self.fPalBlack.setColor(QPalette.Active, QPalette.HighlightedText, QColor(255, 255, 255)) | |||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.HighlightedText, QColor(240, 240, 240)) | |||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.Link, QColor(34, 34, 74)) | |||
self.fPalBlack.setColor(QPalette.Active, QPalette.Link, QColor(100, 100, 230)) | |||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.Link, QColor(100, 100, 230)) | |||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.LinkVisited, QColor(74, 34, 74)) | |||
self.fPalBlack.setColor(QPalette.Active, QPalette.LinkVisited, QColor(230, 100, 230)) | |||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.LinkVisited, QColor(230, 100, 230)) | |||
self.fPalBlue = QPalette() | |||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.Window, QColor(32, 35, 39)) | |||
self.fPalBlue.setColor(QPalette.Active, QPalette.Window, QColor(37, 40, 45)) | |||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.Window, QColor(37, 40, 45)) | |||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.WindowText, QColor(89, 95, 104)) | |||
self.fPalBlue.setColor(QPalette.Active, QPalette.WindowText, QColor(223, 237, 255)) | |||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.WindowText, QColor(223, 237, 255)) | |||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.Base, QColor(48, 53, 60)) | |||
self.fPalBlue.setColor(QPalette.Active, QPalette.Base, QColor(55, 61, 69)) | |||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.Base, QColor(55, 61, 69)) | |||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.AlternateBase, QColor(60, 64, 67)) | |||
self.fPalBlue.setColor(QPalette.Active, QPalette.AlternateBase, QColor(69, 73, 77)) | |||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.AlternateBase, QColor(69, 73, 77)) | |||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.ToolTipBase, QColor(182, 193, 208)) | |||
self.fPalBlue.setColor(QPalette.Active, QPalette.ToolTipBase, QColor(182, 193, 208)) | |||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.ToolTipBase, QColor(182, 193, 208)) | |||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.ToolTipText, QColor(42, 44, 48)) | |||
self.fPalBlue.setColor(QPalette.Active, QPalette.ToolTipText, QColor(42, 44, 48)) | |||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.ToolTipText, QColor(42, 44, 48)) | |||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.Text, QColor(96, 103, 113)) | |||
self.fPalBlue.setColor(QPalette.Active, QPalette.Text, QColor(210, 222, 240)) | |||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.Text, QColor(210, 222, 240)) | |||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.Button, QColor(51, 55, 62)) | |||
self.fPalBlue.setColor(QPalette.Active, QPalette.Button, QColor(59, 63, 71)) | |||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.Button, QColor(59, 63, 71)) | |||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.ButtonText, QColor(98, 104, 114)) | |||
self.fPalBlue.setColor(QPalette.Active, QPalette.ButtonText, QColor(210, 222, 240)) | |||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.ButtonText, QColor(210, 222, 240)) | |||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.BrightText, QColor(255, 255, 255)) | |||
self.fPalBlue.setColor(QPalette.Active, QPalette.BrightText, QColor(255, 255, 255)) | |||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.BrightText, QColor(255, 255, 255)) | |||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.Light, QColor(59, 64, 72)) | |||
self.fPalBlue.setColor(QPalette.Active, QPalette.Light, QColor(63, 68, 76)) | |||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.Light, QColor(63, 68, 76)) | |||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.Midlight, QColor(48, 52, 59)) | |||
self.fPalBlue.setColor(QPalette.Active, QPalette.Midlight, QColor(51, 56, 63)) | |||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.Midlight, QColor(51, 56, 63)) | |||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.Dark, QColor(18, 19, 22)) | |||
self.fPalBlue.setColor(QPalette.Active, QPalette.Dark, QColor(20, 22, 25)) | |||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.Dark, QColor(20, 22, 25)) | |||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.Mid, QColor(28, 30, 34)) | |||
self.fPalBlue.setColor(QPalette.Active, QPalette.Mid, QColor(32, 35, 39)) | |||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.Mid, QColor(32, 35, 39)) | |||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.Shadow, QColor(13, 14, 16)) | |||
self.fPalBlue.setColor(QPalette.Active, QPalette.Shadow, QColor(15, 16, 18)) | |||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.Shadow, QColor(15, 16, 18)) | |||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.Highlight, QColor(32, 35, 39)) | |||
self.fPalBlue.setColor(QPalette.Active, QPalette.Highlight, QColor(14, 14, 17)) | |||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.Highlight, QColor(27, 28, 33)) | |||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.HighlightedText, QColor(89, 95, 104)) | |||
self.fPalBlue.setColor(QPalette.Active, QPalette.HighlightedText, QColor(217, 234, 253)) | |||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.HighlightedText, QColor(223, 237, 255)) | |||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.Link, QColor(79, 100, 118)) | |||
self.fPalBlue.setColor(QPalette.Active, QPalette.Link, QColor(156, 212, 255)) | |||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.Link, QColor(156, 212, 255)) | |||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.LinkVisited, QColor(51, 74, 118)) | |||
self.fPalBlue.setColor(QPalette.Active, QPalette.LinkVisited, QColor(64, 128, 255)) | |||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.LinkVisited, QColor(64, 128, 255)) | |||
self.loadSettings() | |||
print("TESTING", self.fApp.style().objectName()) | |||
def loadSettings(self): | |||
settings = QSettings() | |||
useProTheme = settings.value("Main/UseProTheme", True, type=bool) | |||
if useProTheme: | |||
print("USING PRO THEME") | |||
self.fApp.setStyle("carla") | |||
proThemeColor = settings.value("Main/ProThemeColor", "Black", type=str) | |||
if proThemeColor.lower() == "black": | |||
print("USING PRO AND BLACK THEME") | |||
self.fApp.setPalette(self.fPalBlack) | |||
elif proThemeColor.lower() == "blue": | |||
print("USING PRO AND BLUE THEME") | |||
self.fApp.setPalette(self.fPalBlue) | |||
def arguments(self): | |||
return self.fApp.arguments() | |||
def exec_(self): | |||
return self.fApp.exec_() | |||
def getApp(self): | |||
return self.fApp |
@@ -1040,7 +1040,7 @@ class PluginEdit(QDialog): | |||
sender = self.sender() | |||
if sender == self.ui.ch_fixed_buffer: | |||
option = PLUGIN_OPTION_FIXED_BUFFER | |||
option = PLUGIN_OPTION_FIXED_BUFFERS | |||
elif sender == self.ui.ch_force_stereo: | |||
option = PLUGIN_OPTION_FORCE_STEREO | |||
elif sender == self.ui.ch_map_program_changes: | |||
@@ -683,6 +683,9 @@ public: | |||
fParameters[offset + 24] = 0.5f; | |||
} | |||
fParameters[76] = 0.3f; // Chorus Rate | |||
fParameters[77] = 0.6f; // Chorus Depth | |||
fParameters[89] = 1.0f; | |||
fSynth.setSampleRate(getSampleRate()); | |||
@@ -523,13 +523,9 @@ CarlaStyle::CarlaStyle() | |||
: QCommonStyle(), | |||
d(new CarlaStylePrivate(this)) | |||
{ | |||
setObjectName(QLatin1String("Carla")); | |||
QApplication* const app(qApp); | |||
if (app == nullptr) | |||
return; | |||
setObjectName(QLatin1String("CarlaStyle")); | |||
#if 0 | |||
fPalSystem = app->palette(); | |||
fPalBlack.setColor(QPalette::Disabled, QPalette::Window, QColor(14, 14, 14)); | |||
@@ -647,8 +643,7 @@ CarlaStyle::CarlaStyle() | |||
fPalBlue.setColor(QPalette::Disabled, QPalette::LinkVisited, QColor(51, 74, 118)); | |||
fPalBlue.setColor(QPalette::Active, QPalette::LinkVisited, QColor(64, 128, 255)); | |||
fPalBlue.setColor(QPalette::Inactive, QPalette::LinkVisited, QColor(64, 128, 255)); | |||
setColorSchemeAsNeeded(); | |||
#endif | |||
} | |||
CarlaStyle::~CarlaStyle() | |||
@@ -656,39 +651,6 @@ CarlaStyle::~CarlaStyle() | |||
delete d; | |||
} | |||
void CarlaStyle::setColorSchemeAsNeeded() | |||
{ | |||
QSettings settings("falkTX", "Carla"); | |||
if (! settings.value("Main/UseProTheme", true).toBool()) | |||
return; | |||
QString color(settings.value("Main/ProThemeColor", "Black").toString()); | |||
if (color == "System") | |||
setColorScheme(CarlaStyle::COLOR_SYSTEM); | |||
else if (color == "Blue") | |||
setColorScheme(CarlaStyle::COLOR_BLUE); | |||
else | |||
setColorScheme(CarlaStyle::COLOR_BLACK); | |||
} | |||
void CarlaStyle::setColorScheme(ColorScheme color) | |||
{ | |||
switch (color) | |||
{ | |||
case COLOR_BLACK: | |||
qApp->setPalette(fPalBlack); | |||
break; | |||
case COLOR_BLUE: | |||
qApp->setPalette(fPalBlue); | |||
break; | |||
case COLOR_SYSTEM: | |||
qApp->setPalette(fPalSystem); | |||
break; | |||
} | |||
} | |||
void printPalette(const QPalette& pal) | |||
{ | |||
#define PAL "fPalBlue" | |||
@@ -44,9 +44,6 @@ public: | |||
CarlaStyle(); | |||
~CarlaStyle(); | |||
void setColorSchemeAsNeeded(); | |||
void setColorScheme(ColorScheme color); | |||
QPalette standardPalette() const override; | |||
void drawPrimitive(PrimitiveElement elem, const QStyleOption* option, QPainter* painter, | |||
const QWidget* widget = nullptr) const override; | |||
@@ -65,10 +62,6 @@ public: | |||
void unpolish(QWidget* widget) override; | |||
private: | |||
QPalette fPalBlack; | |||
QPalette fPalBlue; | |||
QPalette fPalSystem; | |||
CarlaStylePrivate* const d; | |||
friend class CarlaStylePrivate; | |||
}; | |||
@@ -16,6 +16,7 @@ | |||
*/ | |||
#include "CarlaStylePlugin.hpp" | |||
#include "CarlaStyle.hpp" | |||
CarlaStylePlugin::CarlaStylePlugin(QObject* parent) | |||
: QStylePlugin(parent) | |||
@@ -24,12 +25,14 @@ CarlaStylePlugin::CarlaStylePlugin(QObject* parent) | |||
QStyle* CarlaStylePlugin::create(const QString& key) | |||
{ | |||
return (key.toLower() == "carla") ? new CarlaStyle() : nullptr; | |||
return (key.toLower() == "carla") ? new CarlaStyle : nullptr; | |||
} | |||
// QStringList CarlaStylePlugin::keys() const | |||
// { | |||
// return QStringList() << "Carla"; | |||
// } | |||
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) | |||
QStringList CarlaStylePlugin::keys() const | |||
{ | |||
return QStringList() << "Carla"; | |||
} | |||
Q_EXPORT_PLUGIN2(Carla, CarlaStylePlugin) | |||
#endif |
@@ -18,7 +18,7 @@ | |||
#ifndef CARLA_STYLE_PLUGIN_HPP_INCLUDED | |||
#define CARLA_STYLE_PLUGIN_HPP_INCLUDED | |||
#include "CarlaStyle.hpp" | |||
#include <QtCore/Qt> | |||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) | |||
# include <QtWidgets/QStylePlugin> | |||
@@ -29,11 +29,16 @@ | |||
class CarlaStylePlugin : public QStylePlugin | |||
{ | |||
Q_OBJECT | |||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) | |||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QStyleFactoryInterface" FILE "carlastyle.json") | |||
#endif | |||
public: | |||
CarlaStylePlugin(QObject* parent = nullptr); | |||
QStyle* create(const QString& key) override; | |||
//QStringList keys() const override; | |||
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) | |||
QStringList keys() const override; | |||
#endif | |||
}; | |||
#endif // CARLA_STYLE_PLUGIN_HPP_INCLUDED |
@@ -9,20 +9,14 @@ include ../../Makefile.mk | |||
# -------------------------------------------------------------- | |||
BUILD_CXX_FLAGS += -I. -I../../includes -I../../utils | |||
QT5_CXX_FLAGS = $(BUILD_CXX_FLAGS) # FIXME: use copy instead of reference | |||
QT4_CXX_FLAGS = $(BUILD_CXX_FLAGS) # FIXME: use copy instead of reference | |||
ifeq ($(HAVE_QT4),true) | |||
BUILD_CXX_FLAGS += $(shell pkg-config --cflags QtCore QtGui) | |||
LINK_FLAGS += $(shell pkg-config --libs QtCore QtGui) | |||
QT_STYLES_DIR = $(shell pkg-config --variable=libdir QtCore)/qt4/plugins/styles | |||
else | |||
BUILD_CXX_FLAGS += $(shell pkg-config --cflags Qt5Core Qt5Gui Qt5Widgets) | |||
LINK_FLAGS += $(shell pkg-config --libs Qt5Core Qt5Gui Qt5Widgets) | |||
QT_STYLES_DIR = $(shell pkg-config --variable=libdir Qt5Core)/qt5/plugins/styles | |||
endif | |||
ifeq ($(HAVE_QT5),true) | |||
QT5_CXX_FLAGS += $(shell pkg-config --cflags Qt5Core Qt5Gui Qt5Widgets) | |||
ifeq ($(HAVE_QT4),true) | |||
QT4_CXX_FLAGS += $(shell pkg-config --cflags Qt5Core Qt5Gui Qt5Widgets) | |||
endif | |||
# -------------------------------------------------------------- | |||
@@ -34,22 +28,33 @@ FILES = \ | |||
moc_CarlaStylePrivate.cpp \ | |||
resources.cpp | |||
OBJS = \ | |||
FILES_qt4 = \ | |||
moc_CarlaStyle.qt4.cpp \ | |||
moc_CarlaStyleAnimations.qt4.cpp \ | |||
moc_CarlaStylePlugin.qt4.cpp \ | |||
moc_CarlaStylePrivate.qt4.cpp \ | |||
resources.qt4.cpp | |||
# -------------------------------------------------------------- | |||
OBJS = \ | |||
CarlaStyle.cpp.o \ | |||
moc_CarlaStyle.cpp.o \ | |||
moc_CarlaStyleAnimations.cpp.o \ | |||
moc_CarlaStylePlugin.cpp.o \ | |||
moc_CarlaStylePrivate.cpp.o | |||
OBJS_shared = $(OBJS) \ | |||
CarlaStylePlugin.cpp.o \ | |||
moc_CarlaStylePlugin.cpp.o \ | |||
resources.cpp.o | |||
OBJS_qt5 = \ | |||
CarlaStyle.cpp.qt5.o \ | |||
moc_CarlaStyle.cpp.qt5.o \ | |||
moc_CarlaStyleAnimations.cpp.qt5.o \ | |||
moc_CarlaStylePrivate.cpp.qt5.o | |||
# -------------------------------------------------------------- | |||
OBJS_qt4 = \ | |||
CarlaStyle.cpp.qt4.o \ | |||
moc_CarlaStyle.cpp.qt4.o \ | |||
moc_CarlaStyleAnimations.cpp.qt4.o \ | |||
moc_CarlaStylePrivate.cpp.qt4.o | |||
OBJS_posix32 = \ | |||
CarlaStyle.cpp.posix32.o \ | |||
@@ -77,9 +82,21 @@ OBJS_win64 = \ | |||
# -------------------------------------------------------------- | |||
all: ../theme.a | |||
qt5: ../theme.qt5.a | |||
ifeq ($(WIN32),true) | |||
CARLASTYLE = styles/carlastyle.dll | |||
else | |||
ifeq ($(MACOS),true) | |||
CARLASTYLE = styles/carlastyle.dylib | |||
else | |||
CARLASTYLE = styles/carlastyle.so | |||
endif | |||
endif | |||
all: ../theme.a $(CARLASTYLE) | |||
qt4: ../theme.qt4.a | |||
posix32: ../theme.posix32.a | |||
posix64: ../theme.posix64.a | |||
win32: ../theme.win32.a | |||
@@ -88,30 +105,38 @@ win64: ../theme.win64.a | |||
# -------------------------------------------------------------- | |||
../theme.a: $(FILES) $(OBJS) | |||
$(AR) rs $@ $(OBJS) | |||
rm -f $@ | |||
$(AR) crs $@ $(OBJS) | |||
../theme.qt5.a: $(FILES) $(OBJS_qt5) | |||
$(AR) rs $@ $(OBJS_qt5) | |||
../theme.qt4.a: $(FILES_qt4) $(OBJS_qt4) | |||
rm -f $@ | |||
$(AR) crs $@ $(OBJS_qt4) | |||
../theme.posix32.a: $(FILES) $(OBJS_posix32) | |||
$(AR) rs $@ $(OBJS_posix32) | |||
rm -f $@ | |||
$(AR) crs $@ $(OBJS_posix32) | |||
../theme.posix64.a: $(FILES) $(OBJS_posix64) | |||
$(AR) rs $@ $(OBJS_posix64) | |||
rm -f $@ | |||
$(AR) crs $@ $(OBJS_posix64) | |||
../theme.win32.a: $(FILES) $(OBJS_win32) | |||
$(AR) rs $@ $(OBJS_win32) | |||
rm -f $@ | |||
$(AR) crs $@ $(OBJS_win32) | |||
../theme.win64.a: $(FILES) $(OBJS_win64) | |||
$(AR) rs $@ $(OBJS_win64) | |||
rm -f $@ | |||
$(AR) crs $@ $(OBJS_win64) | |||
# -------------------------------------------------------------- | |||
../carlastyle.dll: $(FILES) $(OBJS_shared) | |||
styles/carlastyle.dll: $(FILES) $(OBJS_shared) | |||
$(CXX) $(OBJS_shared) -shared $(LINK_FLAGS) -o $@ | |||
../carlastyle.dynlib: $(FILES) $(OBJS_shared) | |||
styles/carlastyle.dynlib: $(FILES) $(OBJS_shared) | |||
$(CXX) $(OBJS_shared) -dynamiclib $(LINK_FLAGS) -o $@ | |||
../carlastyle.so: $(FILES) $(OBJS_shared) | |||
styles/carlastyle.so: $(FILES) $(OBJS_shared) | |||
$(CXX) $(OBJS_shared) -shared $(LINK_FLAGS) -o $@ | |||
# -------------------------------------------------------------- | |||
@@ -119,8 +144,8 @@ win64: ../theme.win64.a | |||
%.cpp.o: %.cpp CarlaStyle.hpp moc_CarlaStyle.cpp | |||
$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@ | |||
%.cpp.qt5.o: %.cpp CarlaStyle.hpp moc_CarlaStyle.cpp | |||
$(CXX) $< $(QT5_CXX_FLAGS) -c -o $@ | |||
%.cpp.qt4.o: %.cpp CarlaStyle.hpp moc_CarlaStyle.cpp | |||
$(CXX) $< $(QT4_CXX_FLAGS) -c -o $@ | |||
%.cpp.posix32.o: %.cpp CarlaStyle.hpp moc_CarlaStyle.cpp | |||
$(CXX) $< $(BUILD_CXX_FLAGS) $(32BIT_FLAGS) -c -o $@ | |||
@@ -134,20 +159,26 @@ win64: ../theme.win64.a | |||
%.cpp.win64.o: %.cpp CarlaStyle.hpp moc_CarlaStyle.cpp | |||
$(CXX) $< $(BUILD_CXX_FLAGS) $(64BIT_FLAGS) -c -o $@ | |||
moc_%.qt4.cpp: %.hpp | |||
$(MOC_QT4) $< -o $@ | |||
moc_%.cpp: %.hpp | |||
$(MOC) $< -o $@ | |||
resources.cpp: ../../../resources/resources-theme.qrc | |||
$(RCC) $< -o $@ | |||
# -------------------------------------------------------------- | |||
resources.qt4.cpp: ../../../resources/resources-theme.qrc | |||
$(RCC_QT4) $< -o $@ | |||
install: ../carlastyle.so | |||
install -d $(QT_STYLES_DIR) | |||
install -m 644 $< $(QT_STYLES_DIR) | |||
# -------------------------------------------------------------- | |||
clean: | |||
rm -f *.o ../theme*.a $(FILES) | |||
rm -f *.o ../theme*.a $(CARLASTYLE) $(FILES) | |||
debug: | |||
$(MAKE) DEBUG=true | |||
install: $(THEMESTYLE) | |||
install -d $(QT_STYLES_DIR) | |||
install -m 644 $< styles/carlastyle.json $(QT_STYLES_DIR) |
@@ -0,0 +1 @@ | |||
{ "Keys": [ "Carla" ] } |