Browse Source

More C++ conversion, initial common frontend code split

pull/1723/head
falkTX 2 years ago
parent
commit
3bd590cc91
20 changed files with 384 additions and 99 deletions
  1. +12
    -1
      Makefile
  2. +19
    -15
      source/frontend/Makefile
  3. +5
    -34
      source/frontend/carla_backend.py
  4. +7
    -0
      source/frontend/carla_frontend.py
  5. +2
    -2
      source/frontend/carla_host.py
  6. +2
    -6
      source/frontend/carla_shared.py
  7. +0
    -26
      source/frontend/carla_widgets.py
  8. +64
    -0
      source/frontend/common/__init__.py
  9. +20
    -0
      source/frontend/dialogs/__init__.py
  10. +96
    -0
      source/frontend/dialogs/aboutjucedialog.cpp
  11. +61
    -0
      source/frontend/dialogs/aboutjucedialog.hpp
  12. +74
    -0
      source/frontend/dialogs/aboutjucedialog.py
  13. +4
    -4
      source/frontend/dialogs/aboutjucedialog.ui
  14. +7
    -1
      source/frontend/dialogs/jackappdialog.cpp
  15. +1
    -3
      source/frontend/dialogs/jackappdialog.hpp
  16. +2
    -2
      source/frontend/dialogs/jackappdialog.py
  17. +4
    -4
      source/frontend/dialogs/jackappdialog.ui
  18. +0
    -1
      source/frontend/pluginlist/__init__.py
  19. +2
    -0
      source/frontend/utils/qcarlastring.hpp
  20. +2
    -0
      source/frontend/utils/qsafesettings.hpp

+ 12
- 1
Makefile View File

@@ -467,6 +467,8 @@ ifeq ($(HAVE_PYQT),true)
install -d $(DESTDIR)$(DATADIR)/icons/hicolor/scalable/apps install -d $(DESTDIR)$(DATADIR)/icons/hicolor/scalable/apps
install -d $(DESTDIR)$(DATADIR)/mime/packages install -d $(DESTDIR)$(DATADIR)/mime/packages
install -d $(DESTDIR)$(DATADIR)/carla/resources/translations install -d $(DESTDIR)$(DATADIR)/carla/resources/translations
install -d $(DESTDIR)$(DATADIR)/carla/common
install -d $(DESTDIR)$(DATADIR)/carla/dialogs
install -d $(DESTDIR)$(DATADIR)/carla/modgui install -d $(DESTDIR)$(DATADIR)/carla/modgui
install -d $(DESTDIR)$(DATADIR)/carla/patchcanvas install -d $(DESTDIR)$(DATADIR)/carla/patchcanvas
install -d $(DESTDIR)$(DATADIR)/carla/pluginlist install -d $(DESTDIR)$(DATADIR)/carla/pluginlist
@@ -620,6 +622,14 @@ endif
source/frontend/*.py \ source/frontend/*.py \
$(DESTDIR)$(DATADIR)/carla/ $(DESTDIR)$(DATADIR)/carla/


install -m 644 \
source/frontend/common/*.py \
$(DESTDIR)$(DATADIR)/carla/common/

install -m 644 \
source/frontend/dialogs/*.py \
$(DESTDIR)$(DATADIR)/carla/dialogs/

install -m 644 \ install -m 644 \
source/frontend/modgui/*.py \ source/frontend/modgui/*.py \
$(DESTDIR)$(DATADIR)/carla/modgui/ $(DESTDIR)$(DATADIR)/carla/modgui/
@@ -704,6 +714,8 @@ endif
install -m 644 resources/scalable/carla-control.svg $(DESTDIR)$(DATADIR)/icons/hicolor/scalable/apps install -m 644 resources/scalable/carla-control.svg $(DESTDIR)$(DATADIR)/icons/hicolor/scalable/apps


# Install resources (re-use python files) # Install resources (re-use python files)
$(LINK) ../common $(DESTDIR)$(DATADIR)/carla/resources
$(LINK) ../dialogs $(DESTDIR)$(DATADIR)/carla/resources
$(LINK) ../modgui $(DESTDIR)$(DATADIR)/carla/resources $(LINK) ../modgui $(DESTDIR)$(DATADIR)/carla/resources
$(LINK) ../patchcanvas $(DESTDIR)$(DATADIR)/carla/resources $(LINK) ../patchcanvas $(DESTDIR)$(DATADIR)/carla/resources
$(LINK) ../pluginlist $(DESTDIR)$(DATADIR)/carla/resources $(LINK) ../pluginlist $(DESTDIR)$(DATADIR)/carla/resources
@@ -722,7 +734,6 @@ endif
$(LINK) ../externalui.py $(DESTDIR)$(DATADIR)/carla/resources $(LINK) ../externalui.py $(DESTDIR)$(DATADIR)/carla/resources
$(LINK) ../resources_rc.py $(DESTDIR)$(DATADIR)/carla/resources $(LINK) ../resources_rc.py $(DESTDIR)$(DATADIR)/carla/resources
$(LINK) ../ui_carla_about.py $(DESTDIR)$(DATADIR)/carla/resources $(LINK) ../ui_carla_about.py $(DESTDIR)$(DATADIR)/carla/resources
$(LINK) ../ui_carla_about_juce.py $(DESTDIR)$(DATADIR)/carla/resources
$(LINK) ../ui_carla_edit.py $(DESTDIR)$(DATADIR)/carla/resources $(LINK) ../ui_carla_edit.py $(DESTDIR)$(DATADIR)/carla/resources
$(LINK) ../ui_carla_host.py $(DESTDIR)$(DATADIR)/carla/resources $(LINK) ../ui_carla_host.py $(DESTDIR)$(DATADIR)/carla/resources
$(LINK) ../ui_carla_parameter.py $(DESTDIR)$(DATADIR)/carla/resources $(LINK) ../ui_carla_parameter.py $(DESTDIR)$(DATADIR)/carla/resources


+ 19
- 15
source/frontend/Makefile View File

@@ -24,6 +24,7 @@ BUILD_CXX_FLAGS += -Iutils


BUILD_CXX_FLAGS += -I../backend BUILD_CXX_FLAGS += -I../backend
BUILD_CXX_FLAGS += -I../includes BUILD_CXX_FLAGS += -I../includes
BUILD_CXX_FLAGS += -I../modules
BUILD_CXX_FLAGS += -I../utils BUILD_CXX_FLAGS += -I../utils


# --------------------------------------------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------------------------------------
@@ -46,6 +47,15 @@ else
$(error Trying to build frontend without Qt5, cannot continue) $(error Trying to build frontend without Qt5, cannot continue)
endif endif


QT5_LINK_FLAGS += -L$(BINDIR) -lcarla_utils

ifeq ($(MACOS),true)
QT5_LINK_FLAGS += -install_name @rpath/libcarla_frontend.dylib
# FIXME this does not work: -Wl,-rpath,@loader_path
else
QT5_LINK_FLAGS += -Wl,-rpath,'$${ORIGIN}'
endif

# --------------------------------------------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------------------------------------
# Translations # Translations


@@ -57,7 +67,8 @@ QMs = $(patsubst %,translations/carla_%.qm,$(I18N_LANGUAGES))


CPP_FILES = \ CPP_FILES = \
carla_frontend.cpp \ carla_frontend.cpp \
pluginlist/jackappdialog.cpp
dialogs/aboutjucedialog.cpp \
dialogs/jackappdialog.cpp


OBJS = $(CPP_FILES:%=$(OBJDIR)/%.o) OBJS = $(CPP_FILES:%=$(OBJDIR)/%.o)


@@ -89,7 +100,6 @@ RES = \
$(BINDIR)/resources/xycontroller-ui \ $(BINDIR)/resources/xycontroller-ui \
$(BINDIR)/resources/resources_rc.py \ $(BINDIR)/resources/resources_rc.py \
$(BINDIR)/resources/ui_carla_about.py \ $(BINDIR)/resources/ui_carla_about.py \
$(BINDIR)/resources/ui_carla_about_juce.py \
$(BINDIR)/resources/ui_carla_edit.py \ $(BINDIR)/resources/ui_carla_edit.py \
$(BINDIR)/resources/ui_carla_host.py \ $(BINDIR)/resources/ui_carla_host.py \
$(BINDIR)/resources/ui_carla_osc_connect.py \ $(BINDIR)/resources/ui_carla_osc_connect.py \
@@ -116,7 +126,8 @@ endif
# --------------------------------------------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------------------------------------
# UI code # UI code


UI_FILES = $(wildcard pluginlist/*.ui)
UI_FILES = $(wildcard dialogs/*.ui)
UI_FILES += $(wildcard pluginlist/*.ui)


UIs = $(UI_FILES:%.ui=%_ui.hpp) UIs = $(UI_FILES:%.ui=%_ui.hpp)
UIs += $(UI_FILES:%.ui=%_ui.py) UIs += $(UI_FILES:%.ui=%_ui.py)
@@ -124,7 +135,6 @@ UIs += $(UI_FILES:%.ui=%_ui.py)
# old stuff, not yet converted # old stuff, not yet converted
UIs += \ UIs += \
ui_carla_about.py \ ui_carla_about.py \
ui_carla_about_juce.py \
ui_carla_edit.py \ ui_carla_edit.py \
ui_carla_host.py \ ui_carla_host.py \
ui_carla_osc_connect.py \ ui_carla_osc_connect.py \
@@ -176,6 +186,10 @@ $(BINDIR)/libcarla_frontend$(LIB_EXT): $(OBJS) $(LIBS)
-@mkdir -p $(BINDIR) -@mkdir -p $(BINDIR)
@echo "Linking libcarla_frontend$(LIB_EXT)" @echo "Linking libcarla_frontend$(LIB_EXT)"
$(SILENT)$(CXX) $(OBJS) $(BUILD_CXX_FLAGS) $(QT5_LINK_FLAGS) $(SHARED) -o $@ $(SILENT)$(CXX) $(OBJS) $(BUILD_CXX_FLAGS) $(QT5_LINK_FLAGS) $(SHARED) -o $@
ifeq ($(MACOS),true)
# FIXME this does not work: -Wl,-rpath,@loader_path
$(SILENT)install_name_tool -change ../../../bin/libcarla_utils.dylib @loader_path/libcarla_utils.dylib $@
endif


$(OBJDIR)/%.cpp.o: %.cpp $(UIs) $(OBJDIR)/%.cpp.o: %.cpp $(UIs)
-@mkdir -p $(shell dirname $@) -@mkdir -p $(shell dirname $@)
@@ -189,6 +203,7 @@ $(OBJDIR)/%.cpp.o: %.cpp $(UIs)
clean: clean:
rm -rf $(BINDIR)/libcarla_frontend$(LIB_EXT) $(UIs) $(RES) $(QMs) __pycache__ *.pyc rm -rf $(BINDIR)/libcarla_frontend$(LIB_EXT) $(UIs) $(RES) $(QMs) __pycache__ *.pyc
# old files # old files
rm -f ui_carla_about_juce.py
rm -f ui_carla_add_jack.py rm -f ui_carla_add_jack.py
rm -f ui_carla_database.py rm -f ui_carla_database.py
rm -f ui_carla_refresh.py rm -f ui_carla_refresh.py
@@ -198,17 +213,6 @@ debug:


# --------------------------------------------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------------------------------------


tests: pluginlist/jackappdialog$(APP_EXT)
# $(UI_FILES:%.ui=%$(APP_EXT))

pluginlist/jackappdialog$(APP_EXT): pluginlist/jackappdialog.cpp pluginlist/jackappdialog.ui pluginlist/jackappdialog_ui.hpp
$(CXX) $< $(BUILD_CXX_FLAGS) $(QT5_LINK_FLAGS) -o $@

pluginlist/pluginlistdialog$(APP_EXT): pluginlist/pluginlistdialog.cpp pluginlist/pluginlistdialog.ui pluginlist/pluginlistdialog_ui.hpp
$(CXX) $< $(BUILD_CXX_FLAGS) $(QT5_LINK_FLAGS) -o $@

# ---------------------------------------------------------------------------------------------------------------------

lint: lint:
pylint \ pylint \
--extension-pkg-whitelist=PyQt5 \ --extension-pkg-whitelist=PyQt5 \


+ 5
- 34
source/frontend/carla_backend.py View File

@@ -20,9 +20,7 @@
# Imports (Global) # Imports (Global)


from abc import abstractmethod from abc import abstractmethod
from platform import architecture
from struct import pack from struct import pack
from sys import platform, maxsize


# --------------------------------------------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------------------------------------
# Imports (ctypes) # Imports (ctypes)
@@ -34,10 +32,12 @@ from ctypes import (
CDLL, CFUNCTYPE, RTLD_GLOBAL, RTLD_LOCAL, POINTER CDLL, CFUNCTYPE, RTLD_GLOBAL, RTLD_LOCAL, POINTER
) )


# ---------------------------------------------------------------------------------------------------------------------
# 64bit check
# ------------------------------------------------------------------------------------------------------------
# Imports (Custom)


kIs64bit = bool(architecture()[0] == "64bit" and maxsize > 2**32)
from common import (
kIs64bit, HAIKU, LINUX, MACOS, WINDOWS, VERSION
)


# --------------------------------------------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------------------------------------
# Define custom types # Define custom types
@@ -45,35 +45,6 @@ kIs64bit = bool(architecture()[0] == "64bit" and maxsize > 2**32)
c_enum = c_int c_enum = c_int
c_uintptr = c_uint64 if kIs64bit else c_uint32 c_uintptr = c_uint64 if kIs64bit else c_uint32


# ---------------------------------------------------------------------------------------------------------------------
# Set Platform

if platform == "darwin":
HAIKU = False
LINUX = False
MACOS = True
WINDOWS = False
elif "haiku" in platform:
HAIKU = True
LINUX = False
MACOS = False
WINDOWS = False
elif "linux" in platform:
HAIKU = False
LINUX = True
MACOS = False
WINDOWS = False
elif platform in ("win32", "win64", "cygwin"):
HAIKU = False
LINUX = False
MACOS = False
WINDOWS = True
else:
HAIKU = False
LINUX = False
MACOS = False
WINDOWS = False

# --------------------------------------------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------------------------------------
# Convert a ctypes c_char_p into a python string # Convert a ctypes c_char_p into a python string




+ 7
- 0
source/frontend/carla_frontend.py View File

@@ -60,11 +60,18 @@ class CarlaFrontendLib():
def __init__(self, filename): def __init__(self, filename):
self.lib = cdll.LoadLibrary(filename) self.lib = cdll.LoadLibrary(filename)


self.lib.carla_frontend_createAndExecAboutJuceW.argtypes = (c_void_p,)
self.lib.carla_frontend_createAndExecAboutJuceW.restype = None

self.lib.carla_frontend_createAndExecJackApplicationW.argtypes = (c_void_p, c_char_p) self.lib.carla_frontend_createAndExecJackApplicationW.argtypes = (c_void_p, c_char_p)
self.lib.carla_frontend_createAndExecJackApplicationW.restype = POINTER(JackApplicationDialogResults) self.lib.carla_frontend_createAndExecJackApplicationW.restype = POINTER(JackApplicationDialogResults)


# -------------------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------------------


def createAndExecAboutJuceW(self, parent):
# FIXME cast(c_void_p, voidptr(parent))
self.lib.carla_frontend_createAndExecAboutJuceW(None)

def createAndExecJackApplicationW(self, parent, projectFilename): def createAndExecJackApplicationW(self, parent, projectFilename):
# FIXME cast(c_void_p, voidptr(parent)) # FIXME cast(c_void_p, voidptr(parent))
return structToDictOrNull(self.lib.carla_frontend_createAndExecJackApplicationW(None, projectFilename.encode("utf-8"))) return structToDictOrNull(self.lib.carla_frontend_createAndExecJackApplicationW(None, projectFilename.encode("utf-8")))


+ 2
- 2
source/frontend/carla_host.py View File

@@ -62,7 +62,7 @@ from carla_utils import *
from carla_widgets import * from carla_widgets import *


from patchcanvas import patchcanvas from patchcanvas import patchcanvas
from pluginlist import PluginDatabaseW, JackApplicationW
from pluginlist import PluginDatabaseW
from widgets.digitalpeakmeter import DigitalPeakMeter from widgets.digitalpeakmeter import DigitalPeakMeter
from widgets.pixmapkeyboard import PixmapKeyboardHArea from widgets.pixmapkeyboard import PixmapKeyboardHArea


@@ -2109,7 +2109,7 @@ class HostWindow(QMainWindow):


@pyqtSlot() @pyqtSlot()
def slot_aboutJuce(self): def slot_aboutJuce(self):
JuceAboutW(self.fParentOrSelf).exec_()
gCarla.felib.createAndExecAboutJuceW(self.fParentOrSelf)


@pyqtSlot() @pyqtSlot()
def slot_aboutQt(self): def slot_aboutQt(self):


+ 2
- 6
source/frontend/carla_shared.py View File

@@ -47,7 +47,6 @@ from PyQt5.QtWidgets import QFileDialog, QMessageBox
# Imports (Custom) # Imports (Custom)


from carla_backend import ( from carla_backend import (
kIs64bit, HAIKU, LINUX, MACOS, WINDOWS,
MAX_DEFAULT_PARAMETERS, MAX_DEFAULT_PARAMETERS,
ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS, ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS,
ENGINE_PROCESS_MODE_PATCHBAY, ENGINE_PROCESS_MODE_PATCHBAY,
@@ -55,6 +54,8 @@ from carla_backend import (
ENGINE_TRANSPORT_MODE_JACK ENGINE_TRANSPORT_MODE_JACK
) )


from common import kIs64bit, HAIKU, LINUX, MACOS, WINDOWS, VERSION

# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Config # Config


@@ -68,11 +69,6 @@ X_DATADIR_X = None
if WINDOWS: if WINDOWS:
WINDIR = os.getenv("WINDIR") WINDIR = os.getenv("WINDIR")


# ------------------------------------------------------------------------------------------------------------
# Set Version

VERSION = "2.6.0-alpha1"

# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Set TMP # Set TMP




+ 0
- 26
source/frontend/carla_widgets.py View File

@@ -32,7 +32,6 @@ from PyQt5.QtWidgets import QDialog, QFileDialog, QInputDialog, QMenu, QMessageB
# Imports (Custom) # Imports (Custom)


import ui_carla_about import ui_carla_about
import ui_carla_about_juce
import ui_carla_edit import ui_carla_edit
import ui_carla_parameter import ui_carla_parameter


@@ -239,31 +238,6 @@ class CarlaAboutW(QDialog):
if MACOS: if MACOS:
self.setWindowModality(Qt.WindowModal) self.setWindowModality(Qt.WindowModal)


# ------------------------------------------------------------------------------------------------------------
# JUCE About dialog

class JuceAboutW(QDialog):
def __init__(self, parent):
QDialog.__init__(self, parent)
self.ui = ui_carla_about_juce.Ui_JuceAboutW()
self.ui.setupUi(self)

self.ui.l_text2.setText(self.tr("This program uses JUCE version %s." % gCarla.utils.get_juce_version()))

self.adjustSize()
self.setFixedSize(self.size())

flags = self.windowFlags()
flags &= ~Qt.WindowContextHelpButtonHint

if WINDOWS:
flags |= Qt.MSWindowsFixedSizeDialogHint

self.setWindowFlags(flags)

if MACOS:
self.setWindowModality(Qt.WindowModal)

# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Plugin Parameter # Plugin Parameter




+ 64
- 0
source/frontend/common/__init__.py View File

@@ -0,0 +1,64 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# Common Carla code
# Copyright (C) 2011-2022 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.

# ---------------------------------------------------------------------------------------------------------------------
# Imports (Global)

from platform import architecture
from sys import platform, maxsize

# ---------------------------------------------------------------------------------------------------------------------
# Set Version

VERSION = "2.6.0-alpha1"

# ---------------------------------------------------------------------------------------------------------------------
# 64bit check

kIs64bit = bool(architecture()[0] == "64bit" and maxsize > 2**32)

# ---------------------------------------------------------------------------------------------------------------------
# Set Platform

if platform == "darwin":
HAIKU = False
LINUX = False
MACOS = True
WINDOWS = False
elif "haiku" in platform:
HAIKU = True
LINUX = False
MACOS = False
WINDOWS = False
elif "linux" in platform:
HAIKU = False
LINUX = True
MACOS = False
WINDOWS = False
elif platform in ("win32", "win64", "cygwin"):
HAIKU = False
LINUX = False
MACOS = False
WINDOWS = True
else:
HAIKU = False
LINUX = False
MACOS = False
WINDOWS = False

# ---------------------------------------------------------------------------------------------------------------------

+ 20
- 0
source/frontend/dialogs/__init__.py View File

@@ -0,0 +1,20 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# Carla plugin host
# Copyright (C) 2011-2022 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.

from .aboutjucedialog import AboutJuceW
from .jackappdialog import JackApplicationW

+ 96
- 0
source/frontend/dialogs/aboutjucedialog.cpp View File

@@ -0,0 +1,96 @@
/*
* Carla plugin host
* Copyright (C) 2011-2022 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 "aboutjucedialog.hpp"

#ifdef __clang__
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wdeprecated-copy-with-user-provided-copy"
# pragma clang diagnostic ignored "-Wdeprecated-register"
#elif defined(__GNUC__) && __GNUC__ >= 8
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wclass-memaccess"
# pragma GCC diagnostic ignored "-Wdeprecated-copy"
#endif

#include "aboutjucedialog_ui.hpp"

#ifdef __clang__
# pragma clang diagnostic pop
#elif defined(__GNUC__) && __GNUC__ >= 8
# pragma GCC diagnostic pop
#endif

#include "CarlaUtils.h"

// --------------------------------------------------------------------------------------------------------------------
// Jack Application Dialog

struct AboutJuceW::Self {
Ui_AboutJuceDialog ui;

Self() {}

static Self& create()
{
Self* const self = new Self();
return *self;
}
};

AboutJuceW::AboutJuceW(QWidget* const parent)
: QDialog(parent),
self(Self::create())
{
self.ui.setupUi(this);

// -------------------------------------------------------------------------------------------------------------
// UI setup

self.ui.l_text2->setText(tr("This program uses JUCE version") + " " + carla_get_juce_version() + ".");

adjustSize();
setFixedSize(size());

Qt::WindowFlags flags = windowFlags();
flags &= ~Qt::WindowContextHelpButtonHint;

#ifdef CARLA_OS_WIN
flags |= Qt::MSWindowsFixedSizeDialogHint;
#endif

setWindowFlags(flags);

#ifdef CARLA_OS_MAC
if (parent != nullptr)
setWindowModality(Qt::WindowModal);
#endif
}

AboutJuceW::~AboutJuceW()
{
delete &self;
}

// --------------------------------------------------------------------------------------------------------------------

void carla_frontend_createAndExecAboutJuceW(void* const parent)
{
AboutJuceW(reinterpret_cast<QWidget*>(parent)).exec();
}

// --------------------------------------------------------------------------------------------------------------------

+ 61
- 0
source/frontend/dialogs/aboutjucedialog.hpp View File

@@ -0,0 +1,61 @@
/*
* Carla plugin host
* Copyright (C) 2011-2022 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.
*/

#ifdef __clang__
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wdeprecated-copy-with-user-provided-copy"
# pragma clang diagnostic ignored "-Wdeprecated-register"
#elif defined(__GNUC__) && __GNUC__ >= 8
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wclass-memaccess"
# pragma GCC diagnostic ignored "-Wdeprecated-copy"
#endif

#include <QtWidgets/QDialog>

#ifdef __clang__
# pragma clang diagnostic pop
#elif defined(__GNUC__) && __GNUC__ >= 8
# pragma GCC diagnostic pop
#endif

#include "CarlaDefines.h"

// --------------------------------------------------------------------------------------------------------------------
// About JUCE dialog

class AboutJuceW : public QDialog
{
struct Self;
Self& self;

// ----------------------------------------------------------------------------------------------------------------

public:
explicit AboutJuceW(QWidget* parent);
~AboutJuceW() override;
};

// --------------------------------------------------------------------------------------------------------------------

extern "C" {

CARLA_API void carla_frontend_createAndExecAboutJuceW(void* parent);

}

// --------------------------------------------------------------------------------------------------------------------

+ 74
- 0
source/frontend/dialogs/aboutjucedialog.py View File

@@ -0,0 +1,74 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# Carla plugin host
# Copyright (C) 2011-2022 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.

# ---------------------------------------------------------------------------------------------------------------------
# Imports (Global)

from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QDialog

# ---------------------------------------------------------------------------------------------------------------------
# Imports (Carla)

from common import MACOS, WINDOWS
from carla_shared import gCarla

# ---------------------------------------------------------------------------------------------------------------------
# Imports (Local)

from .aboutjucedialog_ui import Ui_AboutJuceDialog

# ------------------------------------------------------------------------------------------------------------
# About JUCE dialog

class AboutJuceW(QDialog):
def __init__(self, parent):
QDialog.__init__(self, parent)
self.ui = Ui_AboutJuceDialog()
self.ui.setupUi(self)

self.ui.l_text2.setText(self.tr("This program uses JUCE version %s." % gCarla.utils.get_juce_version()))

self.adjustSize()
self.setFixedSize(self.size())

flags = self.windowFlags()
flags &= ~Qt.WindowContextHelpButtonHint

if WINDOWS:
flags |= Qt.MSWindowsFixedSizeDialogHint

self.setWindowFlags(flags)

if MACOS:
self.setWindowModality(Qt.WindowModal)

# ---------------------------------------------------------------------------------------------------------------------
# Testing

if __name__ == '__main__':
import sys
# pylint: disable=ungrouped-imports
from PyQt5.QtWidgets import QApplication
# pylint: enable=ungrouped-imports

_app = QApplication(sys.argv)
_gui = AboutJuceW(None, "")
_gui.exec_()

# ---------------------------------------------------------------------------------------------------------------------

resources/ui/carla_about_juce.ui → source/frontend/dialogs/aboutjucedialog.ui View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>JuceAboutW</class>
<widget class="QDialog" name="JuceAboutW">
<class>AboutJuceDialog</class>
<widget class="QDialog" name="AboutJuceDialog">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
@@ -154,7 +154,7 @@ Copyright (C) 2022 Raw Material Software Limited.</string>
<connection> <connection>
<sender>buttonBox</sender> <sender>buttonBox</sender>
<signal>accepted()</signal> <signal>accepted()</signal>
<receiver>JuceAboutW</receiver>
<receiver>AboutJuceDialog</receiver>
<slot>accept()</slot> <slot>accept()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
@@ -170,7 +170,7 @@ Copyright (C) 2022 Raw Material Software Limited.</string>
<connection> <connection>
<sender>buttonBox</sender> <sender>buttonBox</sender>
<signal>rejected()</signal> <signal>rejected()</signal>
<receiver>JuceAboutW</receiver>
<receiver>AboutJuceDialog</receiver>
<slot>reject()</slot> <slot>reject()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">

source/frontend/pluginlist/jackappdialog.cpp → source/frontend/dialogs/jackappdialog.cpp View File

@@ -53,7 +53,7 @@ enum {
}; };


struct JackApplicationW::Self { struct JackApplicationW::Self {
Ui_Dialog ui;
Ui_JackAppDialog ui;
const QString fProjectFilename; const QString fProjectFilename;


Self(const char* const projectFilename) Self(const char* const projectFilename)
@@ -76,9 +76,15 @@ JackApplicationW::JackApplicationW(QWidget* const parent, const char* const proj
// UI setup // UI setup


self.ui.group_error->setVisible(false); self.ui.group_error->setVisible(false);

adjustSize(); adjustSize();
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);


#ifdef CARLA_OS_MAC
if (parent != nullptr)
setWindowModality(Qt::WindowModal);
#endif

// ------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------
// Load settings // Load settings



source/frontend/pluginlist/jackappdialog.hpp → source/frontend/dialogs/jackappdialog.hpp View File

@@ -33,9 +33,7 @@
# pragma GCC diagnostic pop # pragma GCC diagnostic pop
#endif #endif


#include "../utils/qcarlastring.hpp"

#include "CarlaDefines.h"
#include "qcarlastring.hpp"


// -------------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------------
// Jack Application Dialog // Jack Application Dialog

source/frontend/pluginlist/jackappdialog.py → source/frontend/dialogs/jackappdialog.py View File

@@ -32,7 +32,7 @@ from utils import QSafeSettings
# --------------------------------------------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------------------------------------
# Imports (Local) # Imports (Local)


from .jackappdialog_ui import Ui_Dialog
from .jackappdialog_ui import Ui_JackAppDialog


# --------------------------------------------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------------------------------------
# Imports (API) # Imports (API)
@@ -59,7 +59,7 @@ UI_SESSION_NSM = 2
class JackApplicationW(QDialog): class JackApplicationW(QDialog):
def __init__(self, parent: QWidget, projectFilename: str): def __init__(self, parent: QWidget, projectFilename: str):
QDialog.__init__(self, parent) QDialog.__init__(self, parent)
self.ui = Ui_Dialog()
self.ui = Ui_JackAppDialog()
self.ui.setupUi(self) self.ui.setupUi(self)


self.fProjectFilename = projectFilename self.fProjectFilename = projectFilename

source/frontend/pluginlist/jackappdialog.ui → source/frontend/dialogs/jackappdialog.ui View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<class>JackAppDialog</class>
<widget class="QDialog" name="JackAppDialog">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
@@ -619,7 +619,7 @@
<connection> <connection>
<sender>buttonBox</sender> <sender>buttonBox</sender>
<signal>accepted()</signal> <signal>accepted()</signal>
<receiver>Dialog</receiver>
<receiver>JackAppDialog</receiver>
<slot>accept()</slot> <slot>accept()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
@@ -635,7 +635,7 @@
<connection> <connection>
<sender>buttonBox</sender> <sender>buttonBox</sender>
<signal>rejected()</signal> <signal>rejected()</signal>
<receiver>Dialog</receiver>
<receiver>JackAppDialog</receiver>
<slot>reject()</slot> <slot>reject()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">

+ 0
- 1
source/frontend/pluginlist/__init__.py View File

@@ -16,5 +16,4 @@
# #
# For a full copy of the GNU General Public License see the doc/GPL.txt file. # For a full copy of the GNU General Public License see the doc/GPL.txt file.


from .jackappdialog import JackApplicationW
from .pluginlistdialog import PluginDatabaseW from .pluginlistdialog import PluginDatabaseW

+ 2
- 0
source/frontend/utils/qcarlastring.hpp View File

@@ -35,6 +35,8 @@
# pragma GCC diagnostic pop # pragma GCC diagnostic pop
#endif #endif


#include "CarlaDefines.h"

//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
// Custom QString class with a few extra methods // Custom QString class with a few extra methods




+ 2
- 0
source/frontend/utils/qsafesettings.hpp View File

@@ -35,6 +35,8 @@
# pragma GCC diagnostic pop # pragma GCC diagnostic pop
#endif #endif


#include "CarlaDefines.h"

//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
// Safer QSettings class, which does not throw if type mismatches // Safer QSettings class, which does not throw if type mismatches




Loading…
Cancel
Save