From 00a3effd0beb0ebb8f5ca1a5e721af01add89f79 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sun, 8 Oct 2017 11:44:39 +0200 Subject: [PATCH] Save&restore last add-jack configuration, remove "do not use" label --- resources/ui/carla_add_jack.ui | 86 +--------------------------------- source/carla_database.py | 55 +++++++++++++++++++--- 2 files changed, 50 insertions(+), 91 deletions(-) diff --git a/resources/ui/carla_add_jack.ui b/resources/ui/carla_add_jack.ui index 1c19624bf..9a92104b4 100644 --- a/resources/ui/carla_add_jack.ui +++ b/resources/ui/carla_add_jack.ui @@ -7,88 +7,13 @@ 0 0 418 - 306 + 278 Add JACK Application - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 22 - 22 - - - - - - - :/16x16/dialog-warning.png - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Very experimental feature! Do not use! - - - - - - - - 22 - 22 - - - - - - - :/16x16/dialog-warning.png - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - @@ -162,9 +87,6 @@ Take control of main applicaton window - - true - @@ -294,9 +216,6 @@ 64 - - 2 - @@ -344,9 +263,6 @@ 64 - - 2 - diff --git a/source/carla_database.py b/source/carla_database.py index e6e4e9652..bec1865f5 100755 --- a/source/carla_database.py +++ b/source/carla_database.py @@ -29,10 +29,10 @@ from subprocess import Popen, PIPE if config_UseQt5: from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QThread, QSettings - from PyQt5.QtWidgets import QDialog, QTableWidgetItem + from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QTableWidgetItem else: from PyQt4.QtCore import pyqtSignal, pyqtSlot, Qt, QThread, QSettings - from PyQt4.QtGui import QDialog, QTableWidgetItem + from PyQt4.QtGui import QDialog, QDialogButtonBox, QTableWidgetItem # ---------------------------------------------------------------------------------------------------------------------- # Imports (Custom) @@ -1899,8 +1899,20 @@ class JackApplicationW(QDialog): if False: # kdevelop likes this :) - host = CarlaHostNull() - self.host = host + self.host = host = CarlaHostNull() + + # -------------------------------------------------------------------------------------------------------------- + # Load settings + + self.loadSettings() + + # -------------------------------------------------------------------------------------------------------------- + # Set-up connections + + self.finished.connect(self.slot_saveSettings) + self.ui.le_command.textChanged.connect(self.slot_commandChanged) + + # ------------------------------------------------------------------------------------------------------------------ def getCommandAndFlags(self): name = self.ui.le_name.text() @@ -1926,13 +1938,44 @@ class JackApplicationW(QDialog): chr(baseIntVal+flags)) return (command, name, labelSetup) - # -------------------------------------------------------------------------------------------------------- + def loadSettings(self): + settings = QSettings("falkTX", "CarlaAddJackApp") + + command = settings.value("Command", "", type=str) + self.ui.le_command.setText(command) + self.ui.buttonBox.button(QDialogButtonBox.Ok).setEnabled(len(command) > 0) + + self.ui.le_name.setText(settings.value("Name", "", type=str)) + self.ui.sb_audio_ins.setValue(settings.value("NumAudioIns", 2, type=int)) + self.ui.sb_audio_outs.setValue(settings.value("NumAudioOuts", 2, type=int)) + self.ui.sb_midi_ins.setValue(settings.value("NumMidiIns", 0, type=int)) + self.ui.sb_midi_outs.setValue(settings.value("NumMidiOuts", 0, type=int)) + self.ui.cb_manage_window.setChecked(settings.value("ManageWindow", True, type=bool)) + + # ------------------------------------------------------------------------------------------------------------------ + + @pyqtSlot(str) + def slot_commandChanged(self, text): + self.ui.buttonBox.button(QDialogButtonBox.Ok).setEnabled(len(text) > 0) + + @pyqtSlot() + def slot_saveSettings(self): + settings = QSettings("falkTX", "CarlaAddJackApp") + settings.setValue("Command", self.ui.le_command.text()) + settings.setValue("Name", self.ui.le_name.text()) + settings.setValue("NumAudioIns", self.ui.sb_audio_ins.value()) + settings.setValue("NumAudioOuts", self.ui.sb_audio_outs.value()) + settings.setValue("NumMidiIns", self.ui.sb_midi_ins.value()) + settings.setValue("NumMidiOuts", self.ui.sb_midi_outs.value()) + settings.setValue("ManageWindow", self.ui.cb_manage_window.isChecked()) + + # ------------------------------------------------------------------------------------------------------------------ def done(self, r): QDialog.done(self, r) self.close() -# ------------------------------------------------------------------------------------------------------------ +# ---------------------------------------------------------------------------------------------------------------------- # Main if __name__ == '__main__':