| @@ -188,7 +188,7 @@ class CarlaApplication(object): | |||
| if WINDOWS: return | |||
| self.fApp.setStyle("carla") | |||
| #QApplication.setStyle("carla") | |||
| QApplication.setStyle("carla") | |||
| proThemeColor = settings.value("Main/ProThemeColor", "Black", type=str).lower() | |||
| @@ -0,0 +1,63 @@ | |||
| # QtCreator project file | |||
| QT = core gui | |||
| TARGET = carla-frontend | |||
| TEMPLATE = app | |||
| VERSION = 1.9.0 | |||
| # ------------------------------------------------------- | |||
| CONFIG = debug | |||
| CONFIG += qt resources warn_on | |||
| DEFINES = DEBUG | |||
| DEFINES += REAL_BUILD | |||
| # ------------------------------------------------------- | |||
| SOURCES = \ | |||
| carla_host.cpp \ | |||
| carla_shared.cpp \ | |||
| carla_style.cpp | |||
| HEADERS += \ | |||
| carla_shared.hpp \ | |||
| carla_style.hpp | |||
| RESOURCES = ../../resources/resources.qrc | |||
| # ------------------------------------------------------- | |||
| HEADERS += \ | |||
| ../includes/CarlaDefines.h | |||
| HEADERS += \ | |||
| ../backend/CarlaBackend.h \ | |||
| ../backend/CarlaHost.h | |||
| # ------------------------------------------------------- | |||
| INCLUDEPATH = \ | |||
| ../backend \ | |||
| ../includes \ | |||
| ../modules \ | |||
| ../utils | |||
| # ------------------------------------------------------- | |||
| LIBS = ../modules/theme.qt4.a | |||
| LIBS += -L../backend -lcarla_standalone2 | |||
| # ------------------------------------------------------- | |||
| QMAKE_CXXFLAGS += -Wall -Wextra -pipe | |||
| QMAKE_CXXFLAGS += -Werror -Wcast-align -Wcast-qual -Wconversion -Wformat-security -Wredundant-decls -Wshadow -Wstrict-overflow -fstrict-overflow -Wundef -Wunsafe-loop-optimizations -Wwrite-strings | |||
| QMAKE_CXXFLAGS += -Wnon-virtual-dtor -Woverloaded-virtual | |||
| QMAKE_CXXFLAGS += -Wlogical-op -Wsign-conversion | |||
| # -Wmissing-declarations | |||
| QMAKE_CXXFLAGS += -O0 -g | |||
| QMAKE_CXXFLAGS += -std=c++0x -std=gnu++0x | |||
| QMAKE_CXXFLAGS += -isystem /opt/kxstudio/include -isystem /usr/include/qt4 | |||
| # ------------------------------------------------------- | |||
| @@ -0,0 +1,28 @@ | |||
| /* | |||
| * Carla host code | |||
| * Copyright (C) 2011-2014 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 doc/GPL.txt file. | |||
| */ | |||
| #include "carla_shared.hpp" | |||
| #include "carla_style.hpp" | |||
| int main(int argc, char* argv[]) | |||
| { | |||
| CarlaApplication app(argc, argv); | |||
| initHost("TestApp"); | |||
| return 0; | |||
| } | |||
| @@ -0,0 +1,643 @@ | |||
| /* | |||
| * Common Carla code | |||
| * Copyright (C) 2011-2014 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 doc/GPL.txt file. | |||
| */ | |||
| #include "carla_shared.hpp" | |||
| #include <QtCore/QDir> | |||
| #include <QtCore/QFile> | |||
| #include <QtGui/QFileDialog> | |||
| //#ifdef CARLA_OS_MAC | |||
| //#endif | |||
| CARLA_BACKEND_USE_NAMESPACE | |||
| // ------------------------------------------------------------------------------------------------------------ | |||
| // Misc functions | |||
| static | |||
| QString getenvWithFallback(const char* const key, const QString& fallback) | |||
| { | |||
| if (const char* const value = std::getenv(key)) | |||
| return key; | |||
| return fallback; | |||
| } | |||
| // ------------------------------------------------------------------------------------------------------------ | |||
| // Global objects | |||
| QString TMP; | |||
| QString HOME; | |||
| QStringList PATH; | |||
| QStringList MIDI_CC_LIST; | |||
| CarlaObject gCarla; | |||
| // ------------------------------------------------------------------------------------------------------------ | |||
| // init | |||
| static | |||
| void init() | |||
| { | |||
| // -------------------------------------------------------------------------------------------------------- | |||
| // Platform specific stuff | |||
| #if defined(CARLA_OS_MAC) | |||
| qt_mac_set_menubar_icons(false); | |||
| #elif defined(CARLA_OS_WIN) | |||
| QString WINDIR = std::getenv("WINDIR"); | |||
| #endif | |||
| // -------------------------------------------------------------------------------------------------------- | |||
| // Set TMP | |||
| const char* const envTMP = std::getenv("TMP"); | |||
| if (envTMP == nullptr) | |||
| { | |||
| #ifdef CARLA_OS_WIN | |||
| qWarning("TMP variable not set"); | |||
| #endif | |||
| TMP = QDir::tempPath(); | |||
| } | |||
| else | |||
| TMP = envTMP; | |||
| if (! QDir(TMP).exists()) | |||
| { | |||
| qWarning("TMP does not exist"); | |||
| TMP = "/"; | |||
| } | |||
| // -------------------------------------------------------------------------------------------------------- | |||
| // Set HOME | |||
| const char* const envHOME = std::getenv("HOME"); | |||
| if (envHOME == nullptr) | |||
| { | |||
| #if defined(CARLA_OS_LINUX) || defined(CARLA_OS_MAC) | |||
| qWarning("HOME variable not set"); | |||
| #endif | |||
| HOME = QDir::homePath(); | |||
| } | |||
| else | |||
| HOME = envHOME; | |||
| if (! QDir(HOME).exists()) | |||
| { | |||
| qWarning("HOME does not exist"); | |||
| HOME = TMP; | |||
| } | |||
| // -------------------------------------------------------------------------------------------------------- | |||
| // Set PATH | |||
| const char* const envPATH = std::getenv("PATH"); | |||
| if (envPATH == nullptr) | |||
| { | |||
| qWarning("PATH variable not set"); | |||
| PATH.clear(); | |||
| #if defined(CARLA_OS_MAC) | |||
| PATH << "/opt/local/bin"; | |||
| PATH << "/usr/local/bin"; | |||
| PATH << "/usr/bin"; | |||
| PATH << "/bin"; | |||
| #elif defined(CARLA_OS_WIN) | |||
| PATH << QDir(WINDIR).filePath("system32"); | |||
| PATH << WINDIR; | |||
| #else | |||
| PATH << "/usr/local/bin"; | |||
| PATH << "/usr/bin"; | |||
| PATH << "/bin"; | |||
| #endif | |||
| } | |||
| else | |||
| { | |||
| #ifdef CARLA_OS_WIN | |||
| PATH = QString(envPATH).split(":"); | |||
| #else | |||
| PATH = QString(envPATH).split(";"); | |||
| #endif | |||
| } | |||
| // -------------------------------------------------------------------------------------------------------- | |||
| // Static MIDI CC list | |||
| MIDI_CC_LIST.clear(); | |||
| MIDI_CC_LIST << "0x01 Modulation"; | |||
| MIDI_CC_LIST << "0x02 Breath"; | |||
| MIDI_CC_LIST << "0x03 (Undefined)"; | |||
| MIDI_CC_LIST << "0x04 Foot"; | |||
| MIDI_CC_LIST << "0x05 Portamento"; | |||
| MIDI_CC_LIST << "0x07 Volume"; | |||
| MIDI_CC_LIST << "0x08 Balance"; | |||
| MIDI_CC_LIST << "0x09 (Undefined)"; | |||
| MIDI_CC_LIST << "0x0A Pan"; | |||
| MIDI_CC_LIST << "0x0B Expression"; | |||
| MIDI_CC_LIST << "0x0C FX Control 1"; | |||
| MIDI_CC_LIST << "0x0D FX Control 2"; | |||
| MIDI_CC_LIST << "0x0E (Undefined)"; | |||
| MIDI_CC_LIST << "0x0F (Undefined)"; | |||
| MIDI_CC_LIST << "0x10 General Purpose 1"; | |||
| MIDI_CC_LIST << "0x11 General Purpose 2"; | |||
| MIDI_CC_LIST << "0x12 General Purpose 3"; | |||
| MIDI_CC_LIST << "0x13 General Purpose 4"; | |||
| MIDI_CC_LIST << "0x14 (Undefined)"; | |||
| MIDI_CC_LIST << "0x15 (Undefined)"; | |||
| MIDI_CC_LIST << "0x16 (Undefined)"; | |||
| MIDI_CC_LIST << "0x17 (Undefined)"; | |||
| MIDI_CC_LIST << "0x18 (Undefined)"; | |||
| MIDI_CC_LIST << "0x19 (Undefined)"; | |||
| MIDI_CC_LIST << "0x1A (Undefined)"; | |||
| MIDI_CC_LIST << "0x1B (Undefined)"; | |||
| MIDI_CC_LIST << "0x1C (Undefined)"; | |||
| MIDI_CC_LIST << "0x1D (Undefined)"; | |||
| MIDI_CC_LIST << "0x1E (Undefined)"; | |||
| MIDI_CC_LIST << "0x1F (Undefined)"; | |||
| MIDI_CC_LIST << "0x46 Control 1 [Variation]"; | |||
| MIDI_CC_LIST << "0x47 Control 2 [Timbre]"; | |||
| MIDI_CC_LIST << "0x48 Control 3 [Release]"; | |||
| MIDI_CC_LIST << "0x49 Control 4 [Attack]"; | |||
| MIDI_CC_LIST << "0x4A Control 5 [Brightness]"; | |||
| MIDI_CC_LIST << "0x4B Control 6 [Decay]"; | |||
| MIDI_CC_LIST << "0x4C Control 7 [Vib Rate]"; | |||
| MIDI_CC_LIST << "0x4D Control 8 [Vib Depth]"; | |||
| MIDI_CC_LIST << "0x4E Control 9 [Vib Delay]"; | |||
| MIDI_CC_LIST << "0x4F Control 10 [Undefined]"; | |||
| MIDI_CC_LIST << "0x50 General Purpose 5"; | |||
| MIDI_CC_LIST << "0x51 General Purpose 6"; | |||
| MIDI_CC_LIST << "0x52 General Purpose 7"; | |||
| MIDI_CC_LIST << "0x53 General Purpose 8"; | |||
| MIDI_CC_LIST << "0x54 Portamento Control"; | |||
| MIDI_CC_LIST << "0x5B FX 1 Depth [Reverb]"; | |||
| MIDI_CC_LIST << "0x5C FX 2 Depth [Tremolo]"; | |||
| MIDI_CC_LIST << "0x5D FX 3 Depth [Chorus]"; | |||
| MIDI_CC_LIST << "0x5E FX 4 Depth [Detune]"; | |||
| MIDI_CC_LIST << "0x5F FX 5 Depth [Phaser]"; | |||
| // -------------------------------------------------------------------------------------------------------- | |||
| // Global Carla object | |||
| gCarla.host = nullptr; | |||
| gCarla.gui = nullptr; | |||
| gCarla.isControl = false; | |||
| gCarla.isLocal = true; | |||
| gCarla.isPlugin = false; | |||
| gCarla.bufferSize = 0; | |||
| gCarla.sampleRate = 0.0; | |||
| #ifdef CARLA_OS_LINUX | |||
| gCarla.processMode = CarlaBackend::ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS; | |||
| gCarla.transportMode = CarlaBackend::ENGINE_TRANSPORT_MODE_JACK; | |||
| #else | |||
| gCarla.processMode = CarlaBackend::ENGINE_PROCESS_MODE_CONTINUOUS_RACK; | |||
| gCarla.transportMode = CarlaBackend::ENGINE_TRANSPORT_MODE_INTERNAL; | |||
| #endif | |||
| gCarla.maxParameters = CarlaBackend::MAX_DEFAULT_PARAMETERS; | |||
| // -------------------------------------------------------------------------------------------------------- | |||
| // Default Plugin Folders (get) | |||
| QString splitter; | |||
| QString DEFAULT_LADSPA_PATH, DEFAULT_DSSI_PATH, DEFAULT_LV2_PATH, DEFAULT_VST_PATH, DEFAULT_VST3_PATH, DEFAULT_AU_PATH; | |||
| QString DEFAULT_CSOUND_PATH, DEFAULT_GIG_PATH, DEFAULT_SF2_PATH, DEFAULT_SFZ_PATH; | |||
| #if defined(CARLA_OS_WIN) | |||
| splitter = ";"; | |||
| const char* const envAPPDATA = std::getenv("APPDATA"); | |||
| const char* const envPROGRAMFILES = std::getenv("PROGRAMFILES"); | |||
| const char* const envPROGRAMFILESx86 = std::getenv("PROGRAMFILES(x86)"); | |||
| const char* const envCOMMONPROGRAMFILES = std::getenv("COMMONPROGRAMFILES"); | |||
| // Small integrity tests | |||
| if (envAPPDATA == nullptr) | |||
| { | |||
| qFatal("APPDATA variable not set, cannot continue"); | |||
| std::exit(1); | |||
| } | |||
| if (envPROGRAMFILES == nullptr) | |||
| { | |||
| qFatal("PROGRAMFILES variable not set, cannot continue"); | |||
| std::exit(1); | |||
| } | |||
| if (envCOMMONPROGRAMFILES == nullptr) | |||
| { | |||
| qFatal("COMMONPROGRAMFILES variable not set, cannot continue"); | |||
| std::exit(1); | |||
| } | |||
| QString APPDATA(envAPPDATA); | |||
| QString PROGRAMFILES(envPROGRAMFILES); | |||
| QString COMMONPROGRAMFILES(envCOMMONPROGRAMFILES); | |||
| DEFAULT_LADSPA_PATH = APPDATA + "\\LADSPA"; | |||
| DEFAULT_LADSPA_PATH += ";" + PROGRAMFILES + "\\LADSPA"; | |||
| DEFAULT_DSSI_PATH = APPDATA + "\\DSSI"; | |||
| DEFAULT_DSSI_PATH += ";" + PROGRAMFILES + "\\DSSI"; | |||
| DEFAULT_LV2_PATH = APPDATA + "\\LV2"; | |||
| DEFAULT_LV2_PATH += ";" + COMMONPROGRAMFILES + "\\LV2"; | |||
| DEFAULT_VST_PATH = PROGRAMFILES + "\\VstPlugins"; | |||
| DEFAULT_VST_PATH += ";" + PROGRAMFILES + "\\Steinberg\\VstPlugins"; | |||
| DEFAULT_VST3_PATH = PROGRAMFILES + "\\Vst3"; | |||
| DEFAULT_GIG_PATH = APPDATA + "\\GIG"; | |||
| DEFAULT_SF2_PATH = APPDATA + "\\SF2"; | |||
| DEFAULT_SFZ_PATH = APPDATA + "\\SFZ"; | |||
| if (envPROGRAMFILESx86 != nullptr) | |||
| { | |||
| QString PROGRAMFILESx86(envPROGRAMFILESx86); | |||
| DEFAULT_LADSPA_PATH += ";" + PROGRAMFILESx86 + "\\LADSPA"; | |||
| DEFAULT_DSSI_PATH += ";" + PROGRAMFILESx86 + "\\DSSI"; | |||
| DEFAULT_VST_PATH += ";" + PROGRAMFILESx86 + "\\VstPlugins"; | |||
| DEFAULT_VST_PATH += ";" + PROGRAMFILESx86 + "\\Steinberg\\VstPlugins"; | |||
| } | |||
| #elif defined(CARLA_OS_HAIKU) | |||
| splitter = ":"; | |||
| DEFAULT_LADSPA_PATH = HOME + "/.ladspa"; | |||
| DEFAULT_LADSPA_PATH += ":/boot/common/add-ons/ladspa"; | |||
| DEFAULT_DSSI_PATH = HOME + "/.dssi"; | |||
| DEFAULT_DSSI_PATH += ":/boot/common/add-ons/dssi"; | |||
| DEFAULT_LV2_PATH = HOME + "/.lv2"; | |||
| DEFAULT_LV2_PATH += ":/boot/common/add-ons/lv2"; | |||
| DEFAULT_VST_PATH = HOME + "/.vst"; | |||
| DEFAULT_VST_PATH += ":/boot/common/add-ons/vst"; | |||
| DEFAULT_VST3_PATH = HOME + "/.vst3"; | |||
| DEFAULT_VST3_PATH += ":/boot/common/add-ons/vst3"; | |||
| #elif defined(CARLA_OS_MAC) | |||
| splitter = ":"; | |||
| DEFAULT_LADSPA_PATH = HOME + "/Library/Audio/Plug-Ins/LADSPA"; | |||
| DEFAULT_LADSPA_PATH += ":/Library/Audio/Plug-Ins/LADSPA"; | |||
| DEFAULT_DSSI_PATH = HOME + "/Library/Audio/Plug-Ins/DSSI"; | |||
| DEFAULT_DSSI_PATH += ":/Library/Audio/Plug-Ins/DSSI"; | |||
| DEFAULT_LV2_PATH = HOME + "/Library/Audio/Plug-Ins/LV2"; | |||
| DEFAULT_LV2_PATH += ":/Library/Audio/Plug-Ins/LV2"; | |||
| DEFAULT_VST_PATH = HOME + "/Library/Audio/Plug-Ins/VST"; | |||
| DEFAULT_VST_PATH += ":/Library/Audio/Plug-Ins/VST"; | |||
| DEFAULT_VST3_PATH = HOME + "/Library/Audio/Plug-Ins/VST3"; | |||
| DEFAULT_VST3_PATH += ":/Library/Audio/Plug-Ins/VST3"; | |||
| DEFAULT_AU_PATH = HOME + "/Library/Audio/Plug-Ins/Components"; | |||
| DEFAULT_AU_PATH += ":/Library/Audio/Plug-Ins/Components"; | |||
| #else | |||
| splitter = ":"; | |||
| DEFAULT_LADSPA_PATH = HOME + "/.ladspa"; | |||
| DEFAULT_LADSPA_PATH += ":/usr/lib/ladspa"; | |||
| DEFAULT_LADSPA_PATH += ":/usr/local/lib/ladspa"; | |||
| DEFAULT_DSSI_PATH = HOME + "/.dssi"; | |||
| DEFAULT_DSSI_PATH += ":/usr/lib/dssi"; | |||
| DEFAULT_DSSI_PATH += ":/usr/local/lib/dssi"; | |||
| DEFAULT_LV2_PATH = HOME + "/.lv2"; | |||
| DEFAULT_LV2_PATH += ":/usr/lib/lv2"; | |||
| DEFAULT_LV2_PATH += ":/usr/local/lib/lv2"; | |||
| DEFAULT_VST_PATH = HOME + "/.vst"; | |||
| DEFAULT_VST_PATH += ":/usr/lib/vst"; | |||
| DEFAULT_VST_PATH += ":/usr/local/lib/vst"; | |||
| DEFAULT_VST3_PATH = HOME + "/.vst3"; | |||
| DEFAULT_VST3_PATH += ":/usr/lib/vst3"; | |||
| DEFAULT_VST3_PATH += ":/usr/local/lib/vst3"; | |||
| DEFAULT_GIG_PATH = HOME + "/.sounds/gig"; | |||
| DEFAULT_GIG_PATH += ":/usr/share/sounds/gig"; | |||
| DEFAULT_SF2_PATH = HOME + "/.sounds/sf2"; | |||
| DEFAULT_SF2_PATH += ":/usr/share/sounds/sf2"; | |||
| DEFAULT_SFZ_PATH = HOME + "/.sounds/sfz"; | |||
| DEFAULT_SFZ_PATH += ":/usr/share/sounds/sfz"; | |||
| #endif | |||
| // -------------------------------------------------------------------------------------------------------- | |||
| // Default Plugin Folders (set) | |||
| bool readEnvVars = true; | |||
| #if 0 //def CARLA_OS_WIN | |||
| // Check if running Wine. If yes, ignore env vars | |||
| from winreg import ConnectRegistry, OpenKey, CloseKey, HKEY_CURRENT_USER; | |||
| reg = ConnectRegistry(None, HKEY_CURRENT_USER); | |||
| key = OpenKey(reg, r"SOFTWARE\Wine"); | |||
| CloseKey(key); | |||
| readEnvVars = False; | |||
| CloseKey(reg); | |||
| #endif | |||
| if (readEnvVars) | |||
| { | |||
| gCarla.DEFAULT_LADSPA_PATH = getenvWithFallback("LADSPA_PATH", DEFAULT_LADSPA_PATH).split(splitter); | |||
| gCarla.DEFAULT_DSSI_PATH = getenvWithFallback("DSSI_PATH", DEFAULT_DSSI_PATH).split(splitter); | |||
| gCarla.DEFAULT_LV2_PATH = getenvWithFallback("LV2_PATH", DEFAULT_LV2_PATH).split(splitter); | |||
| gCarla.DEFAULT_VST_PATH = getenvWithFallback("VST_PATH", DEFAULT_VST_PATH).split(splitter); | |||
| gCarla.DEFAULT_VST3_PATH = getenvWithFallback("VST3_PATH", DEFAULT_VST3_PATH).split(splitter); | |||
| gCarla.DEFAULT_AU_PATH = getenvWithFallback("AU_PATH", DEFAULT_AU_PATH).split(splitter); | |||
| gCarla.DEFAULT_CSOUND_PATH = getenvWithFallback("CSOUND_PATH", DEFAULT_CSOUND_PATH).split(splitter); | |||
| gCarla.DEFAULT_GIG_PATH = getenvWithFallback("GIG_PATH", DEFAULT_GIG_PATH).split(splitter); | |||
| gCarla.DEFAULT_SF2_PATH = getenvWithFallback("SF2_PATH", DEFAULT_SF2_PATH).split(splitter); | |||
| gCarla.DEFAULT_SFZ_PATH = getenvWithFallback("SFZ_PATH", DEFAULT_SFZ_PATH).split(splitter); | |||
| } | |||
| else | |||
| { | |||
| gCarla.DEFAULT_LADSPA_PATH = DEFAULT_LADSPA_PATH.split(splitter); | |||
| gCarla.DEFAULT_DSSI_PATH = DEFAULT_DSSI_PATH.split(splitter); | |||
| gCarla.DEFAULT_LV2_PATH = DEFAULT_LV2_PATH.split(splitter); | |||
| gCarla.DEFAULT_VST_PATH = DEFAULT_VST_PATH.split(splitter); | |||
| gCarla.DEFAULT_VST3_PATH = DEFAULT_VST3_PATH.split(splitter); | |||
| gCarla.DEFAULT_AU_PATH = DEFAULT_AU_PATH.split(splitter); | |||
| gCarla.DEFAULT_CSOUND_PATH = DEFAULT_CSOUND_PATH.split(splitter); | |||
| gCarla.DEFAULT_GIG_PATH = DEFAULT_GIG_PATH.split(splitter); | |||
| gCarla.DEFAULT_SF2_PATH = DEFAULT_SF2_PATH.split(splitter); | |||
| gCarla.DEFAULT_SFZ_PATH = DEFAULT_SFZ_PATH.split(splitter); | |||
| } | |||
| } | |||
| // ------------------------------------------------------------------------------------------------------------ | |||
| // Search for Carla tools | |||
| static | |||
| QString findTool(const QString& toolDir, const QString& toolName) | |||
| { | |||
| QDir tmp(QDir::current()); | |||
| tmp.cd(toolDir); | |||
| QString path = tmp.filePath(toolName); | |||
| if (QFile(path).exists()) | |||
| return path; | |||
| foreach (const QString& p, PATH) | |||
| { | |||
| path = QDir(p).filePath(toolName); | |||
| if (QFile(path).exists()) | |||
| return path; | |||
| } | |||
| return ""; | |||
| } | |||
| // ------------------------------------------------------------------------------------------------------------ | |||
| // Init host | |||
| void initHost(const QString& /*appName*/, const char* const libPrefix, bool failError) | |||
| { | |||
| init(); | |||
| // ------------------------------------------------------------- | |||
| // Set Carla library name | |||
| QString libname = "libcarla_"; | |||
| if (gCarla.isControl) | |||
| libname += "control2"; | |||
| else | |||
| libname += "standalone2"; | |||
| #if defined(CARLA_OS_WIN) | |||
| libname += ".dll"; | |||
| #elif defined(CARLA_OS_MAC) | |||
| libname += ".dylib"; | |||
| #else | |||
| libname += ".so"; | |||
| #endif | |||
| // ------------------------------------------------------------- | |||
| // Search for the Carla library | |||
| QString libfilename = ""; | |||
| if (libPrefix != nullptr) | |||
| { | |||
| QDir tmp(libPrefix); | |||
| tmp.cd("lib"); | |||
| tmp.cd("carla"); | |||
| libfilename = tmp.filePath(libname); | |||
| } | |||
| else | |||
| { | |||
| QDir tmp(QDir::current()); | |||
| tmp.cdUp(); | |||
| tmp.cd("backend"); | |||
| QString path = tmp.filePath(libname); | |||
| if (QFile(path).exists()) | |||
| { | |||
| libfilename = path; | |||
| } | |||
| else | |||
| { | |||
| QStringList CARLA_LIB_PATH; | |||
| const char* const envLibPath = std::getenv("CARLA_LIB_PATH"); | |||
| if (envLibPath != nullptr && QDir(envLibPath).exists()) | |||
| { | |||
| CARLA_LIB_PATH << envLibPath; | |||
| } | |||
| else | |||
| { | |||
| #if defined(CARLA_OS_WIN) | |||
| //CARLA_LIB_PATH << (os.path.join(PROGRAMFILES, "Carla"),); | |||
| #elif defined(CARLA_OS_MAC) | |||
| CARLA_LIB_PATH << "/opt/local/lib"; | |||
| CARLA_LIB_PATH << "/usr/local/lib/"; | |||
| CARLA_LIB_PATH << "/usr/lib"; | |||
| #else | |||
| CARLA_LIB_PATH << "/usr/local/lib/"; | |||
| CARLA_LIB_PATH << "/usr/lib"; | |||
| #endif | |||
| } | |||
| foreach (const QString& libpath, CARLA_LIB_PATH) | |||
| { | |||
| tmp = libpath; | |||
| tmp.cd("carla"); | |||
| path = tmp.filePath(libname); | |||
| if (QFile(path).exists()) | |||
| { | |||
| libfilename = path; | |||
| break; | |||
| } | |||
| } | |||
| } | |||
| } | |||
| // ------------------------------------------------------------- | |||
| // find windows tools | |||
| gCarla.discovery_win32 = findTool("discovery", "carla-discovery-win32.exe"); | |||
| gCarla.discovery_win64 = findTool("discovery", "carla-discovery-win64.exe"); | |||
| #ifndef CARLA_OS_WIN | |||
| // ------------------------------------------------------------- | |||
| // find native and posix tools | |||
| gCarla.discovery_native = findTool("discovery", "carla-discovery-native"); | |||
| gCarla.discovery_posix32 = findTool("discovery", "carla-discovery-posix32"); | |||
| gCarla.discovery_posix64 = findTool("discovery", "carla-discovery-posix64"); | |||
| #endif | |||
| // ------------------------------------------------------------- | |||
| if (libfilename.isEmpty() && ! gCarla.isPlugin) | |||
| { | |||
| if (failError) | |||
| { | |||
| QMessageBox::critical(nullptr, "Error", "Failed to find the carla library, cannot continue"); | |||
| std::exit(1); | |||
| } | |||
| return; | |||
| } | |||
| // ------------------------------------------------------------- | |||
| // Set binary path | |||
| QDir tmp; | |||
| QString libfolder, localBinaries, systemBinaries; | |||
| libfolder = libfilename.replace(libname, ""); | |||
| tmp = libfolder; | |||
| tmp.cdUp(); | |||
| tmp.cd("bridges"); | |||
| localBinaries = tmp.absolutePath(); | |||
| tmp = libfolder; | |||
| tmp.cd("bridges"); | |||
| systemBinaries = tmp.absolutePath(); | |||
| if (QDir(libfolder).exists()) | |||
| carla_set_engine_option(ENGINE_OPTION_PATH_BINARIES, 0, libfolder.toUtf8().constData()); | |||
| else if (QDir(localBinaries).exists()) | |||
| carla_set_engine_option(ENGINE_OPTION_PATH_BINARIES, 0, localBinaries.toUtf8().constData()); | |||
| else if (QDir(systemBinaries).exists()) | |||
| carla_set_engine_option(ENGINE_OPTION_PATH_BINARIES, 0, systemBinaries.toUtf8().constData()); | |||
| // ------------------------------------------------------------- | |||
| // Set resource path | |||
| QString localResources, systemResources; | |||
| tmp = libfolder; | |||
| tmp.cdUp(); | |||
| tmp.cd("modules"); | |||
| tmp.cd("native-plugins"); | |||
| tmp.cd("resources"); | |||
| localResources = tmp.absolutePath(); | |||
| tmp = libfolder; | |||
| tmp.cd("resources"); | |||
| systemResources = tmp.absolutePath(); | |||
| if (QDir(localResources).exists()) | |||
| carla_set_engine_option(ENGINE_OPTION_PATH_RESOURCES, 0, localResources.toUtf8().constData()); | |||
| else if (QDir(systemResources).exists()) | |||
| carla_set_engine_option(ENGINE_OPTION_PATH_RESOURCES, 0, systemResources.toUtf8().constData()); | |||
| } | |||
| // ------------------------------------------------------------------------------------------------------------ | |||
| // Get Icon from user theme, using our own as backup (Oxygen) | |||
| QIcon getIcon(const QString& icon, const int size) | |||
| { | |||
| return QIcon::fromTheme(icon, QIcon(QString(":/%ix%i/%s.png").arg(size).arg(size).arg(icon))); | |||
| } | |||
| // ------------------------------------------------------------------------------------------------------------ | |||
| // Signal handler | |||
| static inline // TODO - remove inline | |||
| void signalHandler(/*sig, frame*/) | |||
| { | |||
| if (gCarla.gui == nullptr) | |||
| return; | |||
| // if (sig == SIGINT || sig == SIGTERM) | |||
| // emit(gCarla.gui.SIGTERM); | |||
| #ifdef HAVE_SIGUSR1 | |||
| // else if (sig == SIGUSR1) | |||
| // emit(gCarla.gui.SIGUSR1); | |||
| #endif | |||
| } | |||
| void setUpSignals() | |||
| { | |||
| //signal(SIGINT, signalHandler); | |||
| //signal(SIGTERM, signalHandler); | |||
| #ifdef HAVE_SIGUSR1 | |||
| //signal(SIGUSR1, signalHandler); | |||
| #endif | |||
| } | |||
| // ------------------------------------------------------------------------------------------------------------ | |||
| // QLineEdit and QPushButton combo | |||
| QString getAndSetPath(QWidget* const parent, const QString& currentPath, QLineEdit* const lineEdit) | |||
| { | |||
| QString newPath = QFileDialog::getExistingDirectory(parent, parent->tr("Set Path"), currentPath, QFileDialog::ShowDirsOnly); | |||
| if (! newPath.isEmpty()) | |||
| lineEdit->setText(newPath); | |||
| return newPath; | |||
| } | |||
| // ------------------------------------------------------------------------------------------------------------ | |||
| // Custom MessageBox | |||
| int CustomMessageBox(QWidget* const parent, const QMessageBox::Icon icon, const QString& title, const QString& text, const QString& extraText, const QMessageBox::StandardButtons buttons, const QMessageBox::StandardButton defButton) | |||
| { | |||
| QMessageBox msgBox(parent); | |||
| msgBox.setIcon(icon); | |||
| msgBox.setWindowTitle(title); | |||
| msgBox.setText(text); | |||
| msgBox.setInformativeText(extraText); | |||
| msgBox.setStandardButtons(buttons); | |||
| msgBox.setDefaultButton(defButton); | |||
| return msgBox.exec(); | |||
| } | |||
| // ------------------------------------------------------------------------------------------------------------ | |||
| @@ -0,0 +1,175 @@ | |||
| /* | |||
| * Common Carla code | |||
| * Copyright (C) 2011-2014 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 doc/GPL.txt file. | |||
| */ | |||
| #ifndef FRONTEND_CARLA_SHARED_HPP_INCLUDED | |||
| #define FRONTEND_CARLA_SHARED_HPP_INCLUDED | |||
| // ------------------------------------------------------------------------------------------------------------ | |||
| // Imports (Global) | |||
| #include <QtGui/QIcon> | |||
| #include <QtGui/QLineEdit> | |||
| #include <QtGui/QMessageBox> | |||
| class QLineEdit; | |||
| // ------------------------------------------------------------------------------------------------------------ | |||
| // Imports (Custom) | |||
| #include "CarlaBackendUtils.hpp" | |||
| #include "CarlaHost.h" | |||
| // ------------------------------------------------------------------------------------------------------------ | |||
| // Set Version | |||
| #define VERSION "1.9.0" | |||
| // ------------------------------------------------------------------------------------------------------------ | |||
| // Set TMP | |||
| extern QString TMP; | |||
| // ------------------------------------------------------------------------------------------------------------ | |||
| // Set HOME | |||
| extern QString HOME; | |||
| // ------------------------------------------------------------------------------------------------------------ | |||
| // Set PATH | |||
| extern QStringList PATH; | |||
| // ------------------------------------------------------------------------------------------------------------ | |||
| // Static MIDI CC list | |||
| extern QStringList MIDI_CC_LIST; | |||
| // ------------------------------------------------------------------------------------------------------------ | |||
| // Carla Settings keys | |||
| #define CARLA_KEY_MAIN_PROJECT_FOLDER "Main/ProjectFolder" // str | |||
| #define CARLA_KEY_MAIN_USE_PRO_THEME "Main/UseProTheme" // bool | |||
| #define CARLA_KEY_MAIN_PRO_THEME_COLOR "Main/ProThemeColor" // str | |||
| #define CARLA_KEY_MAIN_REFRESH_INTERVAL "Main/RefreshInterval" // int | |||
| #define CARLA_KEY_CANVAS_THEME "Canvas/Theme" // str | |||
| #define CARLA_KEY_CANVAS_SIZE "Canvas/Size" // str "NxN" | |||
| #define CARLA_KEY_CANVAS_USE_BEZIER_LINES "Canvas/UseBezierLines" // bool | |||
| #define CARLA_KEY_CANVAS_AUTO_HIDE_GROUPS "Canvas/AutoHideGroups" // bool | |||
| #define CARLA_KEY_CANVAS_EYE_CANDY "Canvas/EyeCandy" // enum | |||
| #define CARLA_KEY_CANVAS_USE_OPENGL "Canvas/UseOpenGL" // bool | |||
| #define CARLA_KEY_CANVAS_ANTIALIASING "Canvas/Antialiasing" // enum | |||
| #define CARLA_KEY_CANVAS_HQ_ANTIALIASING "Canvas/HQAntialiasing" // bool | |||
| #define CARLA_KEY_CUSTOM_PAINTING "UseCustomPainting" // bool | |||
| #define CARLA_KEY_ENGINE_DRIVER_PREFIX "Engine/Driver-" | |||
| #define CARLA_KEY_ENGINE_AUDIO_DRIVER "Engine/AudioDriver" // str | |||
| #define CARLA_KEY_ENGINE_PROCESS_MODE "Engine/ProcessMode" // enum | |||
| #define CARLA_KEY_ENGINE_TRANSPORT_MODE "Engine/TransportMode" // enum | |||
| #define CARLA_KEY_ENGINE_FORCE_STEREO "Engine/ForceStereo" // bool | |||
| #define CARLA_KEY_ENGINE_PREFER_PLUGIN_BRIDGES "Engine/PreferPluginBridges" // bool | |||
| #define CARLA_KEY_ENGINE_PREFER_UI_BRIDGES "Engine/PreferUiBridges" // bool | |||
| #define CARLA_KEY_ENGINE_UIS_ALWAYS_ON_TOP "Engine/UIsAlwaysOnTop" // bool | |||
| #define CARLA_KEY_ENGINE_MAX_PARAMETERS "Engine/MaxParameters" // int | |||
| #define CARLA_KEY_ENGINE_UI_BRIDGES_TIMEOUT "Engine/UiBridgesTimeout" // int | |||
| #define CARLA_KEY_PATHS_LADSPA "Paths/LADSPA" | |||
| #define CARLA_KEY_PATHS_DSSI "Paths/DSSI" | |||
| #define CARLA_KEY_PATHS_LV2 "Paths/LV2" | |||
| #define CARLA_KEY_PATHS_VST "Paths/VST" | |||
| #define CARLA_KEY_PATHS_VST3 "Paths/VST3" | |||
| #define CARLA_KEY_PATHS_AU "Paths/AU" | |||
| #define CARLA_KEY_PATHS_CSD "Paths/CSD" | |||
| #define CARLA_KEY_PATHS_GIG "Paths/GIG" | |||
| #define CARLA_KEY_PATHS_SF2 "Paths/SF2" | |||
| #define CARLA_KEY_PATHS_SFZ "Paths/SFZ" | |||
| // ------------------------------------------------------------------------------------------------------------ | |||
| // Global Carla object | |||
| struct CarlaObject { | |||
| // Host library object | |||
| void* host; | |||
| // Host Window | |||
| void* gui; | |||
| // is controller | |||
| bool isControl; | |||
| // is running local | |||
| bool isLocal; | |||
| // is plugin | |||
| bool isPlugin; | |||
| // current buffer size | |||
| uint32_t bufferSize; | |||
| // current sample rate | |||
| double sampleRate; | |||
| // current process mode | |||
| EngineProcessMode processMode; | |||
| // current transport mode | |||
| EngineTransportMode transportMode; | |||
| // current max parameters | |||
| uint maxParameters; | |||
| // discovery tools | |||
| QString discovery_native; | |||
| QString discovery_posix32; | |||
| QString discovery_posix64; | |||
| QString discovery_win32; | |||
| QString discovery_win64; | |||
| // default paths | |||
| QStringList DEFAULT_LADSPA_PATH; | |||
| QStringList DEFAULT_DSSI_PATH; | |||
| QStringList DEFAULT_LV2_PATH; | |||
| QStringList DEFAULT_VST_PATH; | |||
| QStringList DEFAULT_VST3_PATH; | |||
| QStringList DEFAULT_AU_PATH; | |||
| QStringList DEFAULT_CSOUND_PATH; | |||
| QStringList DEFAULT_GIG_PATH; | |||
| QStringList DEFAULT_SF2_PATH; | |||
| QStringList DEFAULT_SFZ_PATH; | |||
| }; | |||
| extern CarlaObject gCarla; | |||
| // ------------------------------------------------------------------------------------------------------------ | |||
| // Init host | |||
| void initHost(const QString& appName, const char* const libPrefix = nullptr, bool failError = true); | |||
| // ------------------------------------------------------------------------------------------------------------ | |||
| // Get Icon from user theme, using our own as backup (Oxygen) | |||
| QIcon getIcon(const QString& icon, const int size=16); | |||
| // ------------------------------------------------------------------------------------------------------------ | |||
| // Signal handler | |||
| void setUpSignals(); | |||
| // ------------------------------------------------------------------------------------------------------------ | |||
| // QLineEdit and QPushButton combo | |||
| QString getAndSetPath(QWidget* const parent, const QString& currentPath, QLineEdit* const lineEdit); | |||
| // ------------------------------------------------------------------------------------------------------------ | |||
| // Custom MessageBox | |||
| int CustomMessageBox(QWidget* const parent, const QMessageBox::Icon icon, const QString& title, const QString& text, const QString& extraText = "", | |||
| const QMessageBox::StandardButtons buttons = QMessageBox::Yes|QMessageBox::No, | |||
| const QMessageBox::StandardButton defButton = QMessageBox::No); | |||
| // ------------------------------------------------------------------------------------------------------------ | |||
| #endif // FRONTEND_CARLA_SHARED_HPP_INCLUDED | |||
| @@ -0,0 +1,211 @@ | |||
| /* | |||
| * Carla style | |||
| * Copyright (C) 2013-2014 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 doc/GPL.txt file. | |||
| */ | |||
| #include "carla_shared.hpp" | |||
| #include "carla_style.hpp" | |||
| #include "theme/CarlaStyle.hpp" | |||
| #include <QtCore/QDir> | |||
| #include <QtCore/QSettings> | |||
| // ------------------------------------------------------------------------------------------------------------ | |||
| CarlaApplication::CarlaApplication(int& argc, char* argv[], const QString& appName) | |||
| : fApp(nullptr), | |||
| fStyle(nullptr) | |||
| { | |||
| fApp = new QApplication(argc, argv, true); | |||
| fApp->setApplicationName(appName); | |||
| fApp->setApplicationVersion(VERSION); | |||
| fApp->setOrganizationName("falkTX"); | |||
| if (appName.toLower() == "carla-control") | |||
| fApp->setWindowIcon(QIcon(":/scalable/carla-control.svg")); | |||
| else | |||
| fApp->setWindowIcon(QIcon(":/scalable/carla.svg")); | |||
| fPalSystem = fApp->palette(); | |||
| fPalBlack.setColor(QPalette::Disabled, QPalette::Window, QColor(14, 14, 14)); | |||
| fPalBlack.setColor(QPalette::Active, QPalette::Window, QColor(17, 17, 17)); | |||
| fPalBlack.setColor(QPalette::Inactive, QPalette::Window, QColor(17, 17, 17)); | |||
| fPalBlack.setColor(QPalette::Disabled, QPalette::WindowText, QColor(83, 83, 83)); | |||
| fPalBlack.setColor(QPalette::Active, QPalette::WindowText, QColor(240, 240, 240)); | |||
| fPalBlack.setColor(QPalette::Inactive, QPalette::WindowText, QColor(240, 240, 240)); | |||
| fPalBlack.setColor(QPalette::Disabled, QPalette::Base, QColor(6, 6, 6)); | |||
| fPalBlack.setColor(QPalette::Active, QPalette::Base, QColor(7, 7, 7)); | |||
| fPalBlack.setColor(QPalette::Inactive, QPalette::Base, QColor(7, 7, 7)); | |||
| fPalBlack.setColor(QPalette::Disabled, QPalette::AlternateBase, QColor(12, 12, 12)); | |||
| fPalBlack.setColor(QPalette::Active, QPalette::AlternateBase, QColor(14, 14, 14)); | |||
| fPalBlack.setColor(QPalette::Inactive, QPalette::AlternateBase, QColor(14, 14, 14)); | |||
| fPalBlack.setColor(QPalette::Disabled, QPalette::ToolTipBase, QColor(4, 4, 4)); | |||
| fPalBlack.setColor(QPalette::Active, QPalette::ToolTipBase, QColor(4, 4, 4)); | |||
| fPalBlack.setColor(QPalette::Inactive, QPalette::ToolTipBase, QColor(4, 4, 4)); | |||
| fPalBlack.setColor(QPalette::Disabled, QPalette::ToolTipText, QColor(230, 230, 230)); | |||
| fPalBlack.setColor(QPalette::Active, QPalette::ToolTipText, QColor(230, 230, 230)); | |||
| fPalBlack.setColor(QPalette::Inactive, QPalette::ToolTipText, QColor(230, 230, 230)); | |||
| fPalBlack.setColor(QPalette::Disabled, QPalette::Text, QColor(74, 74, 74)); | |||
| fPalBlack.setColor(QPalette::Active, QPalette::Text, QColor(230, 230, 230)); | |||
| fPalBlack.setColor(QPalette::Inactive, QPalette::Text, QColor(230, 230, 230)); | |||
| fPalBlack.setColor(QPalette::Disabled, QPalette::Button, QColor(24, 24, 24)); | |||
| fPalBlack.setColor(QPalette::Active, QPalette::Button, QColor(28, 28, 28)); | |||
| fPalBlack.setColor(QPalette::Inactive, QPalette::Button, QColor(28, 28, 28)); | |||
| fPalBlack.setColor(QPalette::Disabled, QPalette::ButtonText, QColor(90, 90, 90)); | |||
| fPalBlack.setColor(QPalette::Active, QPalette::ButtonText, QColor(240, 240, 240)); | |||
| fPalBlack.setColor(QPalette::Inactive, QPalette::ButtonText, QColor(240, 240, 240)); | |||
| fPalBlack.setColor(QPalette::Disabled, QPalette::BrightText, QColor(255, 255, 255)); | |||
| fPalBlack.setColor(QPalette::Active, QPalette::BrightText, QColor(255, 255, 255)); | |||
| fPalBlack.setColor(QPalette::Inactive, QPalette::BrightText, QColor(255, 255, 255)); | |||
| fPalBlack.setColor(QPalette::Disabled, QPalette::Light, QColor(191, 191, 191)); | |||
| fPalBlack.setColor(QPalette::Active, QPalette::Light, QColor(191, 191, 191)); | |||
| fPalBlack.setColor(QPalette::Inactive, QPalette::Light, QColor(191, 191, 191)); | |||
| fPalBlack.setColor(QPalette::Disabled, QPalette::Midlight, QColor(155, 155, 155)); | |||
| fPalBlack.setColor(QPalette::Active, QPalette::Midlight, QColor(155, 155, 155)); | |||
| fPalBlack.setColor(QPalette::Inactive, QPalette::Midlight, QColor(155, 155, 155)); | |||
| fPalBlack.setColor(QPalette::Disabled, QPalette::Dark, QColor(129, 129, 129)); | |||
| fPalBlack.setColor(QPalette::Active, QPalette::Dark, QColor(129, 129, 129)); | |||
| fPalBlack.setColor(QPalette::Inactive, QPalette::Dark, QColor(129, 129, 129)); | |||
| fPalBlack.setColor(QPalette::Disabled, QPalette::Mid, QColor(94, 94, 94)); | |||
| fPalBlack.setColor(QPalette::Active, QPalette::Mid, QColor(94, 94, 94)); | |||
| fPalBlack.setColor(QPalette::Inactive, QPalette::Mid, QColor(94, 94, 94)); | |||
| fPalBlack.setColor(QPalette::Disabled, QPalette::Shadow, QColor(155, 155, 155)); | |||
| fPalBlack.setColor(QPalette::Active, QPalette::Shadow, QColor(155, 155, 155)); | |||
| fPalBlack.setColor(QPalette::Inactive, QPalette::Shadow, QColor(155, 155, 155)); | |||
| fPalBlack.setColor(QPalette::Disabled, QPalette::Highlight, QColor(14, 14, 14)); | |||
| fPalBlack.setColor(QPalette::Active, QPalette::Highlight, QColor(60, 60, 60)); | |||
| fPalBlack.setColor(QPalette::Inactive, QPalette::Highlight, QColor(34, 34, 34)); | |||
| fPalBlack.setColor(QPalette::Disabled, QPalette::HighlightedText, QColor(83, 83, 83)); | |||
| fPalBlack.setColor(QPalette::Active, QPalette::HighlightedText, QColor(255, 255, 255)); | |||
| fPalBlack.setColor(QPalette::Inactive, QPalette::HighlightedText, QColor(240, 240, 240)); | |||
| fPalBlack.setColor(QPalette::Disabled, QPalette::Link, QColor(34, 34, 74)); | |||
| fPalBlack.setColor(QPalette::Active, QPalette::Link, QColor(100, 100, 230)); | |||
| fPalBlack.setColor(QPalette::Inactive, QPalette::Link, QColor(100, 100, 230)); | |||
| fPalBlack.setColor(QPalette::Disabled, QPalette::LinkVisited, QColor(74, 34, 74)); | |||
| fPalBlack.setColor(QPalette::Active, QPalette::LinkVisited, QColor(230, 100, 230)); | |||
| fPalBlack.setColor(QPalette::Inactive, QPalette::LinkVisited, QColor(230, 100, 230)); | |||
| fPalBlue.setColor(QPalette::Disabled, QPalette::Window, QColor(32, 35, 39)); | |||
| fPalBlue.setColor(QPalette::Active, QPalette::Window, QColor(37, 40, 45)); | |||
| fPalBlue.setColor(QPalette::Inactive, QPalette::Window, QColor(37, 40, 45)); | |||
| fPalBlue.setColor(QPalette::Disabled, QPalette::WindowText, QColor(89, 95, 104)); | |||
| fPalBlue.setColor(QPalette::Active, QPalette::WindowText, QColor(223, 237, 255)); | |||
| fPalBlue.setColor(QPalette::Inactive, QPalette::WindowText, QColor(223, 237, 255)); | |||
| fPalBlue.setColor(QPalette::Disabled, QPalette::Base, QColor(48, 53, 60)); | |||
| fPalBlue.setColor(QPalette::Active, QPalette::Base, QColor(55, 61, 69)); | |||
| fPalBlue.setColor(QPalette::Inactive, QPalette::Base, QColor(55, 61, 69)); | |||
| fPalBlue.setColor(QPalette::Disabled, QPalette::AlternateBase, QColor(60, 64, 67)); | |||
| fPalBlue.setColor(QPalette::Active, QPalette::AlternateBase, QColor(69, 73, 77)); | |||
| fPalBlue.setColor(QPalette::Inactive, QPalette::AlternateBase, QColor(69, 73, 77)); | |||
| fPalBlue.setColor(QPalette::Disabled, QPalette::ToolTipBase, QColor(182, 193, 208)); | |||
| fPalBlue.setColor(QPalette::Active, QPalette::ToolTipBase, QColor(182, 193, 208)); | |||
| fPalBlue.setColor(QPalette::Inactive, QPalette::ToolTipBase, QColor(182, 193, 208)); | |||
| fPalBlue.setColor(QPalette::Disabled, QPalette::ToolTipText, QColor(42, 44, 48)); | |||
| fPalBlue.setColor(QPalette::Active, QPalette::ToolTipText, QColor(42, 44, 48)); | |||
| fPalBlue.setColor(QPalette::Inactive, QPalette::ToolTipText, QColor(42, 44, 48)); | |||
| fPalBlue.setColor(QPalette::Disabled, QPalette::Text, QColor(96, 103, 113)); | |||
| fPalBlue.setColor(QPalette::Active, QPalette::Text, QColor(210, 222, 240)); | |||
| fPalBlue.setColor(QPalette::Inactive, QPalette::Text, QColor(210, 222, 240)); | |||
| fPalBlue.setColor(QPalette::Disabled, QPalette::Button, QColor(51, 55, 62)); | |||
| fPalBlue.setColor(QPalette::Active, QPalette::Button, QColor(59, 63, 71)); | |||
| fPalBlue.setColor(QPalette::Inactive, QPalette::Button, QColor(59, 63, 71)); | |||
| fPalBlue.setColor(QPalette::Disabled, QPalette::ButtonText, QColor(98, 104, 114)); | |||
| fPalBlue.setColor(QPalette::Active, QPalette::ButtonText, QColor(210, 222, 240)); | |||
| fPalBlue.setColor(QPalette::Inactive, QPalette::ButtonText, QColor(210, 222, 240)); | |||
| fPalBlue.setColor(QPalette::Disabled, QPalette::BrightText, QColor(255, 255, 255)); | |||
| fPalBlue.setColor(QPalette::Active, QPalette::BrightText, QColor(255, 255, 255)); | |||
| fPalBlue.setColor(QPalette::Inactive, QPalette::BrightText, QColor(255, 255, 255)); | |||
| fPalBlue.setColor(QPalette::Disabled, QPalette::Light, QColor(59, 64, 72)); | |||
| fPalBlue.setColor(QPalette::Active, QPalette::Light, QColor(63, 68, 76)); | |||
| fPalBlue.setColor(QPalette::Inactive, QPalette::Light, QColor(63, 68, 76)); | |||
| fPalBlue.setColor(QPalette::Disabled, QPalette::Midlight, QColor(48, 52, 59)); | |||
| fPalBlue.setColor(QPalette::Active, QPalette::Midlight, QColor(51, 56, 63)); | |||
| fPalBlue.setColor(QPalette::Inactive, QPalette::Midlight, QColor(51, 56, 63)); | |||
| fPalBlue.setColor(QPalette::Disabled, QPalette::Dark, QColor(18, 19, 22)); | |||
| fPalBlue.setColor(QPalette::Active, QPalette::Dark, QColor(20, 22, 25)); | |||
| fPalBlue.setColor(QPalette::Inactive, QPalette::Dark, QColor(20, 22, 25)); | |||
| fPalBlue.setColor(QPalette::Disabled, QPalette::Mid, QColor(28, 30, 34)); | |||
| fPalBlue.setColor(QPalette::Active, QPalette::Mid, QColor(32, 35, 39)); | |||
| fPalBlue.setColor(QPalette::Inactive, QPalette::Mid, QColor(32, 35, 39)); | |||
| fPalBlue.setColor(QPalette::Disabled, QPalette::Shadow, QColor(13, 14, 16)); | |||
| fPalBlue.setColor(QPalette::Active, QPalette::Shadow, QColor(15, 16, 18)); | |||
| fPalBlue.setColor(QPalette::Inactive, QPalette::Shadow, QColor(15, 16, 18)); | |||
| fPalBlue.setColor(QPalette::Disabled, QPalette::Highlight, QColor(32, 35, 39)); | |||
| fPalBlue.setColor(QPalette::Active, QPalette::Highlight, QColor(14, 14, 17)); | |||
| fPalBlue.setColor(QPalette::Inactive, QPalette::Highlight, QColor(27, 28, 33)); | |||
| fPalBlue.setColor(QPalette::Disabled, QPalette::HighlightedText, QColor(89, 95, 104)); | |||
| fPalBlue.setColor(QPalette::Active, QPalette::HighlightedText, QColor(217, 234, 253)); | |||
| fPalBlue.setColor(QPalette::Inactive, QPalette::HighlightedText, QColor(223, 237, 255)); | |||
| fPalBlue.setColor(QPalette::Disabled, QPalette::Link, QColor(79, 100, 118)); | |||
| fPalBlue.setColor(QPalette::Active, QPalette::Link, QColor(156, 212, 255)); | |||
| fPalBlue.setColor(QPalette::Inactive, QPalette::Link, QColor(156, 212, 255)); | |||
| 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)); | |||
| loadSettings(); | |||
| } | |||
| CarlaApplication::~CarlaApplication() | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(fApp != nullptr,); | |||
| if (fStyle != nullptr) | |||
| { | |||
| //delete fStyle; | |||
| fStyle = nullptr; | |||
| } | |||
| delete fApp; | |||
| fApp = nullptr; | |||
| } | |||
| void CarlaApplication::loadSettings() | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(fApp != nullptr,); | |||
| QSettings settings; | |||
| const bool useProTheme(settings.value("Main/UseProTheme", true).toBool()); | |||
| if (useProTheme) | |||
| { | |||
| //QFont font("DejaVu Sans [Book]", 8, QFont::Normal); | |||
| //fApp->setFont(font); | |||
| //QApplication::setFont(font); | |||
| // TODO | |||
| if (fStyle == nullptr) | |||
| fStyle = new CarlaStyle(); | |||
| fApp->setStyle(fStyle); | |||
| QApplication::setStyle(fStyle); | |||
| const QString proThemeColor(settings.value("Main/ProThemeColor", "Black").toString().toLower()); | |||
| if (proThemeColor == "black") | |||
| fApp->setPalette(fPalBlack); | |||
| else if (proThemeColor == "blue") | |||
| fApp->setPalette(fPalBlue); | |||
| } | |||
| carla_stdout("Using \"%s\" theme", fApp->style()->objectName().toUtf8().constData()); | |||
| } | |||
| // ------------------------------------------------------------------------------------------------------------ | |||
| @@ -0,0 +1,50 @@ | |||
| /* | |||
| * Carla style | |||
| * Copyright (C) 2013-2014 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 doc/GPL.txt file. | |||
| */ | |||
| #ifndef FRONTEND_CARLA_STYLE_HPP_INCLUDED | |||
| #define FRONTEND_CARLA_STYLE_HPP_INCLUDED | |||
| // ------------------------------------------------------------------------------------------------------------ | |||
| // Imports (Global) | |||
| #include <QtGui/QApplication> | |||
| #include <QtGui/QPalette> | |||
| class CarlaStyle; | |||
| // ------------------------------------------------------------------------------------------------------------ | |||
| class CarlaApplication | |||
| { | |||
| public: | |||
| CarlaApplication(int& argc, char* argv[], const QString& appName = "Carla2"); | |||
| ~CarlaApplication(); | |||
| private: | |||
| QApplication* fApp; | |||
| CarlaStyle* fStyle; | |||
| QPalette fPalSystem; | |||
| QPalette fPalBlack; | |||
| QPalette fPalBlue; | |||
| void loadSettings(); | |||
| }; | |||
| // ------------------------------------------------------------------------------------------------------------ | |||
| #endif // FRONTEND_CARLA_STYLE_HPP_INCLUDED | |||