Browse Source

Don't allow NSM without project, be clear when NSM cant be used

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.1-rc1
falkTX 4 years ago
parent
commit
45fc5b7d96
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
12 changed files with 130 additions and 29 deletions
  1. +69
    -5
      resources/ui/carla_add_jack.ui
  2. +1
    -1
      source/backend/CarlaBackend.h
  3. +1
    -1
      source/backend/CarlaStandalone.cpp
  4. +1
    -1
      source/backend/engine/CarlaEngine.cpp
  5. +1
    -1
      source/frontend/carla_backend.py
  6. +31
    -6
      source/frontend/carla_database.cpp
  7. +1
    -1
      source/frontend/carla_database.hpp
  8. +19
    -7
      source/frontend/carla_database.py
  9. +1
    -1
      source/frontend/carla_host.cpp
  10. +2
    -2
      source/frontend/carla_host.py
  11. +1
    -1
      source/frontend/carla_widgets.py
  12. +2
    -2
      source/modules/water/processors/AudioProcessorGraph.cpp

+ 69
- 5
resources/ui/carla_add_jack.ui View File

@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>487</width>
<height>572</height>
<width>458</width>
<height>546</height>
</rect>
</property>
<property name="windowTitle">
@@ -15,7 +15,7 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label_9">
<widget class="QLabel" name="l_note_features">
<property name="text">
<string>Note: Features not implemented yet are greyed out</string>
</property>
@@ -54,7 +54,14 @@
</widget>
</item>
<item row="0" column="2" colspan="2">
<widget class="QLineEdit" name="le_name"/>
<widget class="QLineEdit" name="le_name">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="0" column="4" rowspan="3">
<spacer name="horizontalSpacer_3">
@@ -468,7 +475,7 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<widget class="QGroupBox" name="group_workarounds">
<property name="title">
<string>Workarounds</string>
</property>
@@ -536,6 +543,63 @@
</layout>
</widget>
</item>
<item>
<widget class="QFrame" name="group_error">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="ico_error">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>16</horstretch>
<verstretch>16</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../resources.qrc">:/16x16/dialog-cancel.svgz</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="l_error">
<property name="text">
<string>Error here</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">


+ 1
- 1
source/backend/CarlaBackend.h View File

@@ -1,6 +1,6 @@
/*
* Carla Plugin Host
* Copyright (C) 2011-2019 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2011-2020 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


+ 1
- 1
source/backend/CarlaStandalone.cpp View File

@@ -1,6 +1,6 @@
/*
* Carla Standalone
* Copyright (C) 2011-2019 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2011-2020 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


+ 1
- 1
source/backend/engine/CarlaEngine.cpp View File

@@ -1,6 +1,6 @@
/*
* Carla Plugin Host
* Copyright (C) 2011-2019 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2011-2020 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


+ 1
- 1
source/frontend/carla_backend.py View File

@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-

# Carla Backend code
# Copyright (C) 2011-2019 Filipe Coelho <falktx@falktx.com>
# Copyright (C) 2011-2020 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


+ 31
- 6
source/frontend/carla_database.cpp View File

@@ -1,6 +1,6 @@
/*
* Carla plugin database code
* Copyright (C) 2011-2019 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2011-2020 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
@@ -326,11 +326,16 @@ enum UiSessionManager {
struct JackApplicationW::PrivateData {
Ui::Dialog ui;

PrivateData(JackApplicationW* const dialog)
: ui()
const QString fProjectFilename;

PrivateData(JackApplicationW* const dialog, const QString& projectFilename)
: ui(),
fProjectFilename(projectFilename)
{
ui.setupUi(dialog);

ui.group_error->setVisible(false);

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

@@ -342,10 +347,29 @@ struct JackApplicationW::PrivateData {
static QList<QChar> badFirstChars = { '.', '/' };

bool enabled = text.length() > 0;
QCarlaString showErr;

// NSM applications must not be abstract or absolute paths, and must not contain arguments
if (enabled && index == UI_SESSION_NSM)
enabled = ! (badFirstChars.contains(text[0]) || text.contains(' '));
{
if (badFirstChars.contains(text[0]))
showErr = tr("NSM applications cannot use abstract or absolute paths");
else if (text.contains(' ') || text.contains(';') || text.contains('&'))
showErr = tr("NSM applications cannot use CLI arguments");
else if (fProjectFilename.isEmpty())
showErr = tr("You need to save the current Carla project before NSM can be used");
}

if (showErr.isNotEmpty())
{
enabled = false;
ui.l_error->setText(showErr);
ui.group_error->setVisible(true);
}
else
{
ui.group_error->setVisible(false);
}

if (QPushButton* const button = ui.buttonBox->button(QDialogButtonBox::Ok))
button->setEnabled(enabled);
@@ -396,10 +420,11 @@ struct JackApplicationW::PrivateData {
CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(PrivateData)
};

JackApplicationW::JackApplicationW(QWidget* parent)
JackApplicationW::JackApplicationW(QWidget* parent, const QString& projectFilename)
: QDialog(parent),
self(new PrivateData(this))
self(new PrivateData(this, projectFilename))
{
adjustSize();
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);

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


+ 1
- 1
source/frontend/carla_database.hpp View File

@@ -139,7 +139,7 @@ class JackApplicationW : public QDialog
Q_OBJECT

public:
JackApplicationW(QWidget* parent);
JackApplicationW(QWidget* parent, const QString& projectFilename);
~JackApplicationW() override;

void getCommandAndFlags(QString& command, QString& name, QString& labelSetup);


+ 19
- 7
source/frontend/carla_database.py View File

@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-

# Carla plugin database code
# Copyright (C) 2011-2019 Filipe Coelho <falktx@falktx.com>
# Copyright (C) 2011-2020 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
@@ -2112,16 +2112,15 @@ class JackApplicationW(QDialog):
FLAG_MIDI_OUTPUT_CHANNEL_MIXDOWN = 0x20
FLAG_EXTERNAL_START = 0x40

def __init__(self, parent, host):
def __init__(self, parent, projectFilename):
QDialog.__init__(self, parent)
self.host = host
self.ui = ui_carla_add_jack.Ui_Dialog()
self.ui.setupUi(self)

if False:
# kdevelop likes this :)
self.host = host = CarlaHostNull()
self.fProjectFilename = projectFilename
self.ui.group_error.setVisible(False)

self.adjustSize()
self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint)

# --------------------------------------------------------------------------------------------------------------
@@ -2175,10 +2174,23 @@ class JackApplicationW(QDialog):

def checkIfButtonBoxShouldBeEnabled(self, index, text):
enabled = len(text) > 0
showErr = ""

# NSM applications must not be abstract or absolute paths, and must not contain arguments
if enabled and index == self.UI_SESSION_NSM:
enabled = text[0] not in (".", "/") and " " not in text
if text[0] in (".", "/"):
showErr = self.tr("NSM applications cannot use abstract or absolute paths")
elif " " in text or ";" in text or "&" in text:
showErr = self.tr("NSM applications cannot use CLI arguments")
elif len(self.fProjectFilename) == 0:
showErr = self.tr("You need to save the current Carla project before NSM can be used")

if showErr:
enabled = False
self.ui.l_error.setText(showErr)
self.ui.group_error.setVisible(True)
else:
self.ui.group_error.setVisible(False)

self.ui.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enabled)



+ 1
- 1
source/frontend/carla_host.cpp View File

@@ -1,6 +1,6 @@
/*
* Carla plugin host
* Copyright (C) 2011-2019 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2011-2020 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


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

@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-

# Carla host code
# Copyright (C) 2011-2019 Filipe Coelho <falktx@falktx.com>
# Copyright (C) 2011-2020 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
@@ -1099,7 +1099,7 @@ class HostWindow(QMainWindow):
return (btype, ptype, filename, label, uniqueId, extraPtr)

def showAddJackAppDialog(self):
dialog = JackApplicationW(self.fParentOrSelf, self.host)
dialog = JackApplicationW(self.fParentOrSelf, self.fProjectFilename)

if not dialog.exec_():
return


+ 1
- 1
source/frontend/carla_widgets.py View File

@@ -68,7 +68,7 @@ class CarlaAboutW(QDialog):
self.ui.l_about.setText(self.tr(""
"<br>Version %s"
"<br>Carla is a fully-featured audio plugin host%s.<br>"
"<br>Copyright (C) 2011-2019 falkTX<br>"
"<br>Copyright (C) 2011-2020 falkTX<br>"
"" % (VERSION, extraInfo)))

if self.ui.about.palette().color(QPalette.Background).blackF() < 0.5:


+ 2
- 2
source/modules/water/processors/AudioProcessorGraph.cpp View File

@@ -3,7 +3,7 @@
This file is part of the Water library.
Copyright (c) 2015 ROLI Ltd.
Copyright (C) 2017-2018 Filipe Coelho <falktx@falktx.com>
Copyright (C) 2017-2020 Filipe Coelho <falktx@falktx.com>
Permission is granted to use this software under the terms of the GNU
General Public License as published by the Free Software Foundation;
@@ -1121,11 +1121,11 @@ void AudioProcessorGraph::Node::prepare (const double newSampleRate, const int n
{
if (! isPrepared)
{
isPrepared = true;
setParentGraph (graph);
processor->setRateAndBufferSizeDetails (newSampleRate, newBlockSize);
processor->prepareToPlay (newSampleRate, newBlockSize);
isPrepared = true;
}
}


Loading…
Cancel
Save