Browse Source

A few more C++ frontend details, stub for plugin list dialog

Signed-off-by: falkTX <falktx@falktx.com>
pull/1723/head
falkTX 2 years ago
parent
commit
680c46c153
18 changed files with 283 additions and 60 deletions
  1. +0
    -1
      bin/carla.lv2/resources
  2. +2
    -1
      source/frontend/Makefile
  3. +23
    -9
      source/frontend/carla_frontend.py
  4. +10
    -5
      source/frontend/carla_host.py
  5. +6
    -0
      source/frontend/dialogs/.kdev_include_paths
  6. +2
    -2
      source/frontend/dialogs/__init__.py
  7. +5
    -5
      source/frontend/dialogs/aboutjucedialog.cpp
  8. +6
    -4
      source/frontend/dialogs/aboutjucedialog.hpp
  9. +2
    -2
      source/frontend/dialogs/aboutjucedialog.py
  10. +17
    -17
      source/frontend/dialogs/jackappdialog.cpp
  11. +7
    -5
      source/frontend/dialogs/jackappdialog.hpp
  12. +2
    -2
      source/frontend/dialogs/jackappdialog.py
  13. +6
    -0
      source/frontend/pluginlist/.kdev_include_paths
  14. +1
    -1
      source/frontend/pluginlist/__init__.py
  15. +108
    -0
      source/frontend/pluginlist/pluginlistdialog.cpp
  16. +80
    -0
      source/frontend/pluginlist/pluginlistdialog.hpp
  17. +4
    -4
      source/frontend/pluginlist/pluginlistdialog.py
  18. +2
    -2
      source/frontend/pluginlist/pluginlistdialog.ui

+ 0
- 1
bin/carla.lv2/resources View File

@@ -1 +0,0 @@
../resources

+ 2
- 1
source/frontend/Makefile View File

@@ -68,7 +68,8 @@ QMs = $(patsubst %,translations/carla_%.qm,$(I18N_LANGUAGES))
CPP_FILES = \ CPP_FILES = \
carla_frontend.cpp \ carla_frontend.cpp \
dialogs/aboutjucedialog.cpp \ dialogs/aboutjucedialog.cpp \
dialogs/jackappdialog.cpp
dialogs/jackappdialog.cpp \
pluginlist/pluginlistdialog.cpp


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




+ 23
- 9
source/frontend/carla_frontend.py View File

@@ -23,7 +23,7 @@
# Imports (ctypes) # Imports (ctypes)


from ctypes import ( from ctypes import (
c_char_p, c_void_p, cast,
c_bool, c_char_p, c_int, c_void_p, cast,
cdll, Structure, cdll, Structure,
POINTER POINTER
) )
@@ -53,6 +53,14 @@ class JackApplicationDialogResults(Structure):
("labelSetup", c_char_p) ("labelSetup", c_char_p)
] ]


class PluginListDialogResults(Structure):
_fields_ = [
("btype", c_int),
("ptype", c_int),
("binary", c_char_p),
("label", c_char_p)
]

# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Carla Frontend object using a DLL # Carla Frontend object using a DLL


@@ -60,18 +68,24 @@ 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_createAndExecAboutJuceDialog.argtypes = (c_void_p,)
self.lib.carla_frontend_createAndExecAboutJuceDialog.restype = None


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

self.lib.carla_frontend_createAndExecPluginListDialog.argtypes = (c_void_p, c_bool)
self.lib.carla_frontend_createAndExecPluginListDialog.restype = POINTER(JackApplicationDialogResults)


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


def createAndExecAboutJuceW(self, parent):
self.lib.carla_frontend_createAndExecAboutJuceW(unwrapinstance(parent))
def createAndExecAboutJuceDialog(self, parent):
self.lib.carla_frontend_createAndExecAboutJuceDialog(unwrapinstance(parent))

def createAndExecJackAppDialog(self, parent, projectFilename):
return structToDictOrNull(self.lib.carla_frontend_createAndExecJackAppDialog(unwrapinstance(parent), projectFilename.encode("utf-8")))


def createAndExecJackApplicationW(self, parent, projectFilename):
return structToDictOrNull(self.lib.carla_frontend_createAndExecJackApplicationW(unwrapinstance(parent), projectFilename.encode("utf-8")))
def createAndExecPluginListDialog(self, parent, useSystemIcons):
self.lib.carla_frontend_createAndExecPluginListDialog(unwrapinstance(parent), useSystemIcons)


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

+ 10
- 5
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
from pluginlist import PluginListDialog
from widgets.digitalpeakmeter import DigitalPeakMeter from widgets.digitalpeakmeter import DigitalPeakMeter
from widgets.pixmapkeyboard import PixmapKeyboardHArea from widgets.pixmapkeyboard import PixmapKeyboardHArea


@@ -1208,9 +1208,14 @@ class HostWindow(QMainWindow):
# Plugins (menu actions) # Plugins (menu actions)


def showAddPluginDialog(self): def showAddPluginDialog(self):
#ret = gCarla.felib.createAndExecPluginListDialog(self.fParentOrSelf,
#self.fSavedSettings[CARLA_KEY_MAIN_SYSTEM_ICONS])
#print(ret)
#return

if self.fPluginDatabaseDialog is None: if self.fPluginDatabaseDialog is None:
self.fPluginDatabaseDialog = PluginDatabaseW(self.fParentOrSelf, self.host,
self.fSavedSettings[CARLA_KEY_MAIN_SYSTEM_ICONS])
self.fPluginDatabaseDialog = PluginListDialog(self.fParentOrSelf, self.host,
self.fSavedSettings[CARLA_KEY_MAIN_SYSTEM_ICONS])
dialog = self.fPluginDatabaseDialog dialog = self.fPluginDatabaseDialog
dialog.hasLoadedLv2Plugins = self.fHasLoadedLv2Plugins dialog.hasLoadedLv2Plugins = self.fHasLoadedLv2Plugins


@@ -1236,7 +1241,7 @@ class HostWindow(QMainWindow):
return (btype, ptype, filename, label, uniqueId, extraPtr) return (btype, ptype, filename, label, uniqueId, extraPtr)


def showAddJackAppDialog(self): def showAddJackAppDialog(self):
ret = gCarla.felib.createAndExecJackApplicationW(self.fParentOrSelf, self.fProjectFilename)
ret = gCarla.felib.createAndExecJackAppDialog(self.fParentOrSelf, self.fProjectFilename)


if not ret: if not ret:
return return
@@ -2109,7 +2114,7 @@ class HostWindow(QMainWindow):


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


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


+ 6
- 0
source/frontend/dialogs/.kdev_include_paths View File

@@ -0,0 +1,6 @@
/usr/include/x86_64-linux-gnu/qt5
../utils/
../../backend/
../../includes/
../../modules/
../../utils/

+ 2
- 2
source/frontend/dialogs/__init__.py View File

@@ -16,5 +16,5 @@
# #
# 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 .aboutjucedialog import AboutJuceW
from .jackappdialog import JackApplicationW
from .aboutjucedialog import AboutJuceDialog
from .jackappdialog import JackAppDialog

+ 5
- 5
source/frontend/dialogs/aboutjucedialog.cpp View File

@@ -40,7 +40,7 @@
// -------------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------------
// Jack Application Dialog // Jack Application Dialog


struct AboutJuceW::Self {
struct AboutJuceDialog::Self {
Ui_AboutJuceDialog ui; Ui_AboutJuceDialog ui;


Self() {} Self() {}
@@ -52,7 +52,7 @@ struct AboutJuceW::Self {
} }
}; };


AboutJuceW::AboutJuceW(QWidget* const parent)
AboutJuceDialog::AboutJuceDialog(QWidget* const parent)
: QDialog(parent), : QDialog(parent),
self(Self::create()) self(Self::create())
{ {
@@ -81,16 +81,16 @@ AboutJuceW::AboutJuceW(QWidget* const parent)
#endif #endif
} }


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


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


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


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

+ 6
- 4
source/frontend/dialogs/aboutjucedialog.hpp View File

@@ -15,6 +15,8 @@
* 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.
*/ */


#pragma once

#ifdef __clang__ #ifdef __clang__
# pragma clang diagnostic push # pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wdeprecated-copy-with-user-provided-copy" # pragma clang diagnostic ignored "-Wdeprecated-copy-with-user-provided-copy"
@@ -38,7 +40,7 @@
// -------------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------------
// About JUCE dialog // About JUCE dialog


class AboutJuceW : public QDialog
class AboutJuceDialog : public QDialog
{ {
struct Self; struct Self;
Self& self; Self& self;
@@ -46,15 +48,15 @@ class AboutJuceW : public QDialog
// ---------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------


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


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


extern "C" { extern "C" {


CARLA_API void carla_frontend_createAndExecAboutJuceW(void* parent);
CARLA_API void carla_frontend_createAndExecAboutJuceDialog(void* parent);


} }




+ 2
- 2
source/frontend/dialogs/aboutjucedialog.py View File

@@ -36,7 +36,7 @@ from aboutjucedialog_ui import Ui_AboutJuceDialog
# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# About JUCE dialog # About JUCE dialog


class AboutJuceW(QDialog):
class AboutJuceDialog(QDialog):
def __init__(self, parent): def __init__(self, parent):
QDialog.__init__(self, parent) QDialog.__init__(self, parent)
self.ui = Ui_AboutJuceDialog() self.ui = Ui_AboutJuceDialog()
@@ -71,7 +71,7 @@ if __name__ == '__main__':
# gCarla.utils = CarlaUtils(os.path.dirname(__file__) + "/../../../bin/libcarla_utils.dylib") # gCarla.utils = CarlaUtils(os.path.dirname(__file__) + "/../../../bin/libcarla_utils.dylib")


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


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

+ 17
- 17
source/frontend/dialogs/jackappdialog.cpp View File

@@ -52,7 +52,7 @@ enum {
UI_SESSION_NSM = 2, UI_SESSION_NSM = 2,
}; };


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


@@ -66,7 +66,7 @@ struct JackApplicationW::Self {
} }
}; };


JackApplicationW::JackApplicationW(QWidget* const parent, const char* const projectFilename)
JackAppDialog::JackAppDialog(QWidget* const parent, const char* const projectFilename)
: QDialog(parent), : QDialog(parent),
self(Self::create(projectFilename)) self(Self::create(projectFilename))
{ {
@@ -94,14 +94,14 @@ JackApplicationW::JackApplicationW(QWidget* const parent, const char* const proj
// Set-up connections // Set-up connections


connect(this, &QDialog::finished, connect(this, &QDialog::finished,
this, &JackApplicationW::slot_saveSettings);
this, &JackAppDialog::slot_saveSettings);
connect(self.ui.cb_session_mgr, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), connect(self.ui.cb_session_mgr, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &JackApplicationW::slot_sessionManagerChanged);
this, &JackAppDialog::slot_sessionManagerChanged);
connect(self.ui.le_command, &QLineEdit::textChanged, connect(self.ui.le_command, &QLineEdit::textChanged,
this, &JackApplicationW::slot_commandChanged);
this, &JackAppDialog::slot_commandChanged);
} }


JackApplicationW::~JackApplicationW()
JackAppDialog::~JackAppDialog()
{ {
delete &self; delete &self;
} }
@@ -109,7 +109,7 @@ JackApplicationW::~JackApplicationW()
// ----------------------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------------------
// public methods // public methods


JackApplicationW::CommandAndFlags JackApplicationW::getCommandAndFlags() const
JackAppDialog::CommandAndFlags JackAppDialog::getCommandAndFlags() const
{ {
const QString command = self.ui.le_command->text(); const QString command = self.ui.le_command->text();
QString name = self.ui.le_name->text(); QString name = self.ui.le_name->text();
@@ -159,7 +159,7 @@ JackApplicationW::CommandAndFlags JackApplicationW::getCommandAndFlags() const
// ----------------------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------------------
// private methods // private methods


void JackApplicationW::checkIfButtonBoxShouldBeEnabled(const int index, const QCarlaString& command)
void JackAppDialog::checkIfButtonBoxShouldBeEnabled(const int index, const QCarlaString& command)
{ {
bool enabled = command.isNotEmpty(); bool enabled = command.isNotEmpty();
QCarlaString showErr; QCarlaString showErr;
@@ -190,7 +190,7 @@ void JackApplicationW::checkIfButtonBoxShouldBeEnabled(const int index, const QC
button->setEnabled(enabled); button->setEnabled(enabled);
} }


void JackApplicationW::loadSettings()
void JackAppDialog::loadSettings()
{ {
const QSafeSettings settings("falkTX", "CarlaAddJackApp"); const QSafeSettings settings("falkTX", "CarlaAddJackApp");


@@ -221,17 +221,17 @@ void JackApplicationW::loadSettings()
// ----------------------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------------------
// private slots // private slots


void JackApplicationW::slot_commandChanged(const QString& command)
void JackAppDialog::slot_commandChanged(const QString& command)
{ {
checkIfButtonBoxShouldBeEnabled(self.ui.cb_session_mgr->currentIndex(), command); checkIfButtonBoxShouldBeEnabled(self.ui.cb_session_mgr->currentIndex(), command);
} }


void JackApplicationW::slot_sessionManagerChanged(const int index)
void JackAppDialog::slot_sessionManagerChanged(const int index)
{ {
checkIfButtonBoxShouldBeEnabled(index, self.ui.le_command->text()); checkIfButtonBoxShouldBeEnabled(index, self.ui.le_command->text());
} }


void JackApplicationW::slot_saveSettings()
void JackAppDialog::slot_saveSettings()
{ {
QSafeSettings settings("falkTX", "CarlaAddJackApp"); QSafeSettings settings("falkTX", "CarlaAddJackApp");
settings.setValue("Command", self.ui.le_command->text()); settings.setValue("Command", self.ui.le_command->text());
@@ -248,18 +248,18 @@ void JackApplicationW::slot_saveSettings()


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


JackApplicationDialogResults* carla_frontend_createAndExecJackApplicationW(void* const parent, const char* const projectFilename)
JackAppDialogResults* carla_frontend_createAndExecJackAppDialog(void* const parent, const char* const projectFilename)
{ {
JackApplicationW gui(reinterpret_cast<QWidget*>(parent), projectFilename);
JackAppDialog gui(reinterpret_cast<QWidget*>(parent), projectFilename);


if (gui.exec()) if (gui.exec())
{ {
static JackApplicationDialogResults ret = {};
static JackAppDialogResults ret = {};
static CarlaString retCommand; static CarlaString retCommand;
static CarlaString retName; static CarlaString retName;
static CarlaString retLabelSetup; static CarlaString retLabelSetup;


const JackApplicationW::CommandAndFlags cafs = gui.getCommandAndFlags();
const JackAppDialog::CommandAndFlags cafs = gui.getCommandAndFlags();
retCommand = cafs.command.toUtf8().constData(); retCommand = cafs.command.toUtf8().constData();
retName = cafs.name.toUtf8().constData(); retName = cafs.name.toUtf8().constData();
retLabelSetup = cafs.labelSetup.toUtf8().constData(); retLabelSetup = cafs.labelSetup.toUtf8().constData();
@@ -284,7 +284,7 @@ int main(int argc, char* argv[])
{ {
QApplication app(argc, argv); QApplication app(argc, argv);


if (JackApplicationDialogResults* const res = carla_frontend_createAndExecJackApplicationW(nullptr, ""))
if (JackAppDialogResults* const res = carla_frontend_createAndExecJackAppDialog(nullptr, ""))
{ {
printf("Results:\n"); printf("Results:\n");
printf("\tCommand: %s\n", res->command); printf("\tCommand: %s\n", res->command);


+ 7
- 5
source/frontend/dialogs/jackappdialog.hpp View File

@@ -15,6 +15,8 @@
* 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.
*/ */


#pragma once

#ifdef __clang__ #ifdef __clang__
# pragma clang diagnostic push # pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wdeprecated-copy-with-user-provided-copy" # pragma clang diagnostic ignored "-Wdeprecated-copy-with-user-provided-copy"
@@ -38,7 +40,7 @@
// -------------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------------
// Jack Application Dialog // Jack Application Dialog


class JackApplicationW : public QDialog
class JackAppDialog : public QDialog
{ {
struct Self; struct Self;
Self& self; Self& self;
@@ -46,8 +48,8 @@ class JackApplicationW : public QDialog
// ---------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------


public: public:
explicit JackApplicationW(QWidget* parent, const char* projectFilename);
~JackApplicationW() override;
explicit JackAppDialog(QWidget* parent, const char* projectFilename);
~JackAppDialog() override;


// ---------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------
// public methods // public methods
@@ -79,13 +81,13 @@ private slots:


extern "C" { extern "C" {


struct JackApplicationDialogResults {
struct JackAppDialogResults {
const char* command; const char* command;
const char* name; const char* name;
const char* labelSetup; const char* labelSetup;
}; };


CARLA_API JackApplicationDialogResults* carla_frontend_createAndExecJackApplicationW(void* parent, const char* projectFilename);
CARLA_API JackAppDialogResults* carla_frontend_createAndExecJackAppDialog(void* parent, const char* projectFilename);


} }




+ 2
- 2
source/frontend/dialogs/jackappdialog.py View File

@@ -56,7 +56,7 @@ UI_SESSION_NONE = 0
UI_SESSION_LADISH = 1 UI_SESSION_LADISH = 1
UI_SESSION_NSM = 2 UI_SESSION_NSM = 2


class JackApplicationW(QDialog):
class JackAppDialog(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_JackAppDialog() self.ui = Ui_JackAppDialog()
@@ -209,7 +209,7 @@ if __name__ == '__main__':
# pylint: enable=ungrouped-imports # pylint: enable=ungrouped-imports


_app = QApplication(sys.argv) _app = QApplication(sys.argv)
_gui = JackApplicationW(None, "")
_gui = JackAppDialog(None, "")


if _gui.exec_(): if _gui.exec_():
_command, _name, _labelSetup = _gui.getCommandAndFlags() _command, _name, _labelSetup = _gui.getCommandAndFlags()


+ 6
- 0
source/frontend/pluginlist/.kdev_include_paths View File

@@ -0,0 +1,6 @@
/usr/include/x86_64-linux-gnu/qt5
../utils/
../../backend/
../../includes/
../../modules/
../../utils/

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

@@ -16,4 +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 .pluginlistdialog import PluginDatabaseW
from .pluginlistdialog import PluginListDialog

+ 108
- 0
source/frontend/pluginlist/pluginlistdialog.cpp View File

@@ -0,0 +1,108 @@
/*
* 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 "pluginlistdialog.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 "pluginlistdialog_ui.hpp"

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

#include "CarlaString.hpp"

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

struct PluginListDialog::Self {
Ui_PluginListDialog ui;

Self() {}

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

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

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

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

// -------------------------------------------------------------------------------------------------------------
// Set-up connections
}

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

// -----------------------------------------------------------------------------------------------------------------
// public methods

// -----------------------------------------------------------------------------------------------------------------
// private methods

// -----------------------------------------------------------------------------------------------------------------
// private slots

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

PluginListDialogResults* carla_frontend_createAndExecPluginListDialog(void* const parent, const bool useSystemIcons)
{
PluginListDialog gui(reinterpret_cast<QWidget*>(parent), useSystemIcons);

if (gui.exec())
{
static PluginListDialogResults ret = {};
static CarlaString retBinary;
static CarlaString retLabel;

// TODO

ret.binary = retBinary;
ret.label = retLabel;

return &ret;
}

return nullptr;
}

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

+ 80
- 0
source/frontend/pluginlist/pluginlistdialog.hpp View File

@@ -0,0 +1,80 @@
/*
* 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.
*/

#pragma once

#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"

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

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

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

public:
explicit PluginListDialog(QWidget* parent, bool useSystemIcons);
~PluginListDialog() override;

// ----------------------------------------------------------------------------------------------------------------
// public methods

// ----------------------------------------------------------------------------------------------------------------
// private methods

// ----------------------------------------------------------------------------------------------------------------
// private slots
};

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

extern "C" {

struct PluginListDialogResults {
int btype;
int ptype;
const char* binary;
const char* label;
// TODO
};

CARLA_API PluginListDialogResults* carla_frontend_createAndExecPluginListDialog(void* parent, bool useSystemIcons);

}

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

+ 4
- 4
source/frontend/pluginlist/pluginlistdialog.py View File

@@ -74,13 +74,13 @@ from utils import QSafeSettings
# Imports (Local) # Imports (Local)


from .discovery import PLUGIN_QUERY_API_VERSION, checkPluginCached from .discovery import PLUGIN_QUERY_API_VERSION, checkPluginCached
from .pluginlistdialog_ui import Ui_PluginDatabaseW
from .pluginlistdialog_ui import Ui_PluginListDialog
from .pluginlistrefreshdialog import PluginRefreshW from .pluginlistrefreshdialog import PluginRefreshW


# --------------------------------------------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------------------------------------
# Plugin Database Dialog # Plugin Database Dialog


class PluginDatabaseW(QDialog):
class PluginListDialog(QDialog):
TABLEWIDGET_ITEM_FAVORITE = 0 TABLEWIDGET_ITEM_FAVORITE = 0
TABLEWIDGET_ITEM_NAME = 1 TABLEWIDGET_ITEM_NAME = 1
TABLEWIDGET_ITEM_LABEL = 2 TABLEWIDGET_ITEM_LABEL = 2
@@ -90,7 +90,7 @@ class PluginDatabaseW(QDialog):
def __init__(self, parent: QWidget, host, useSystemIcons: bool): def __init__(self, parent: QWidget, host, useSystemIcons: bool):
QDialog.__init__(self, parent) QDialog.__init__(self, parent)
self.host = host self.host = host
self.ui = Ui_PluginDatabaseW()
self.ui = Ui_PluginListDialog()
self.ui.setupUi(self) self.ui.setupUi(self)


# To be changed by parent # To be changed by parent
@@ -987,7 +987,7 @@ if __name__ == '__main__':
_host = _host() _host = _host()


_app = QApplication(sys.argv) _app = QApplication(sys.argv)
_gui = PluginDatabaseW(None, _host, True)
_gui = PluginListDialog(None, _host, True)


if _gui.exec_(): if _gui.exec_():
print(f"Result: {_gui.fRetPlugin}") print(f"Result: {_gui.fRetPlugin}")


+ 2
- 2
source/frontend/pluginlist/pluginlistdialog.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>PluginDatabaseW</class>
<widget class="QDialog" name="PluginDatabaseW">
<class>PluginListDialog</class>
<widget class="QDialog" name="PluginListDialog">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>


Loading…
Cancel
Save