|
|
@@ -1,760 +0,0 @@ |
|
|
|
From 626731e752b4694051b3d447cebb90116fd37186 Mon Sep 17 00:00:00 2001 |
|
|
|
From: rncbc <rncbc@rncbc.org> |
|
|
|
Date: Sat, 19 Dec 2020 16:25:19 +0000 |
|
|
|
Subject: [PATCH] - Add Clear preset button to Setup dialog (refactored from |
|
|
|
an original patch by kmatheussen #113) |
|
|
|
|
|
|
|
- Use default values for most preset parameters: sample |
|
|
|
rate, frames/period (aka. buffer-size), periods/buffer, |
|
|
|
realtime priority, port maximum, client timeout, word |
|
|
|
length, wait time, channel maximum (refactored from an |
|
|
|
original patch by kmatheussen #112) |
|
|
|
--- |
|
|
|
ChangeLog | 12 ++ |
|
|
|
src/images/clear1.png | Bin 0 -> 579 bytes |
|
|
|
src/qjackctl.qrc | 1 + |
|
|
|
src/qjackctlMainForm.cpp | 21 ++- |
|
|
|
src/qjackctlSetup.cpp | 271 ++++++++++++++++++++++++-------------- |
|
|
|
src/qjackctlSetup.h | 7 + |
|
|
|
src/qjackctlSetupForm.cpp | 55 +++++++- |
|
|
|
src/qjackctlSetupForm.h | 1 + |
|
|
|
src/qjackctlSetupForm.ui | 57 ++++---- |
|
|
|
9 files changed, 274 insertions(+), 151 deletions(-) |
|
|
|
create mode 100644 src/images/clear1.png |
|
|
|
|
|
|
|
diff --git a/ChangeLog b/ChangeLog |
|
|
|
index d79615ce..2cf233b2 100644 |
|
|
|
--- a/ChangeLog |
|
|
|
+++ b/ChangeLog |
|
|
|
@@ -4,6 +4,18 @@ QjackCtl - JACK Audio Connection Kit Qt GUI Interface |
|
|
|
ChangeLog |
|
|
|
|
|
|
|
|
|
|
|
+GIT HEAD |
|
|
|
+ |
|
|
|
+- Add Clear preset button to Setup dialog (refactored |
|
|
|
+ from an original patch by kmatheussen #113) |
|
|
|
+ |
|
|
|
+- Use default values for most preset parameters: sample |
|
|
|
+ rate, frames/period (aka. buffer-size), periods/buffer, |
|
|
|
+ realtime priority, port maximum, client timeout, word |
|
|
|
+ length, wait time, channel maximum (refactored from an |
|
|
|
+ original patch by kmatheussen #112) |
|
|
|
+ |
|
|
|
+ |
|
|
|
0.9.0 2020-12-17 A Winter'20 Release. |
|
|
|
|
|
|
|
- List only available backend drivers when JACK D-BUS |
|
|
|
diff --git a/src/qjackctl.qrc b/src/qjackctl.qrc |
|
|
|
index 55d8d1c7..21303a4e 100644 |
|
|
|
--- a/src/qjackctl.qrc |
|
|
|
+++ b/src/qjackctl.qrc |
|
|
|
@@ -38,6 +38,7 @@ |
|
|
|
<file>images/asocketi.png</file> |
|
|
|
<file>images/asocketo.png</file> |
|
|
|
<file>images/backward1.png</file> |
|
|
|
+ <file>images/clear1.png</file> |
|
|
|
<file>images/client1.png</file> |
|
|
|
<file>images/connect1.png</file> |
|
|
|
<file>images/connections1.png</file> |
|
|
|
diff --git a/src/qjackctlMainForm.cpp b/src/qjackctlMainForm.cpp |
|
|
|
index ee9afa45..28d916b1 100644 |
|
|
|
--- a/src/qjackctlMainForm.cpp |
|
|
|
+++ b/src/qjackctlMainForm.cpp |
|
|
|
@@ -1449,12 +1449,11 @@ void qjackctlMainForm::startJack (void) |
|
|
|
const QString sPath = QString::fromUtf8(::getenv("PATH")); |
|
|
|
QStringList paths = sPath.split(chPathSep); |
|
|
|
#if defined(__WIN32__) || defined(_WIN32) || defined(WIN32) |
|
|
|
- paths = paths << QString("%1\\JACK2").arg(getenv("PROGRAMFILES")) |
|
|
|
- << QString("%1\\JACK2").arg(getenv("PROGRAMFILES(x86)")); |
|
|
|
+ paths.append(QString("%1\\JACK2").arg(::getenv("PROGRAMFILES"))); |
|
|
|
+ paths.append(QString("%1\\JACK2").arg(::getenv("PROGRAMFILES(x86)"))); |
|
|
|
+ #elif defined(__APPLE__) |
|
|
|
+ paths.append("/usr/local/bin/"); |
|
|
|
#endif |
|
|
|
- #if defined(__APPLE__) |
|
|
|
- paths = paths << "/usr/local/bin/"; |
|
|
|
- #endif |
|
|
|
QStringListIterator iter(paths); |
|
|
|
while (iter.hasNext()) { |
|
|
|
const QString& sDirectory = iter.next(); |
|
|
|
@@ -1514,7 +1513,7 @@ void qjackctlMainForm::startJack (void) |
|
|
|
if (m_preset.iFrames > 0 && !bNet) |
|
|
|
args.append("-p" + QString::number(m_preset.iFrames)); |
|
|
|
if (bAlsa || bSun || bOss || bFirewire) { |
|
|
|
- if (m_preset.iPeriods > 0) |
|
|
|
+ if (m_preset.iPeriods > 1) |
|
|
|
args.append("-n" + QString::number(m_preset.iPeriods)); |
|
|
|
} |
|
|
|
if (bAlsa) { |
|
|
|
@@ -1570,7 +1569,7 @@ void qjackctlMainForm::startJack (void) |
|
|
|
else if (bOss || bSun) { |
|
|
|
if (m_preset.bIgnoreHW) |
|
|
|
args.append("-b"); |
|
|
|
- if (m_preset.iWordLength > 0) |
|
|
|
+ if (m_preset.iWordLength > 0 && m_preset.iWordLength != 16) |
|
|
|
args.append("-w" + QString::number(m_preset.iWordLength)); |
|
|
|
if (!m_preset.sInDevice.isEmpty() && m_preset.iAudio != QJACKCTL_PLAYBACK) |
|
|
|
args.append("-C" + formatQuoted(m_preset.sInDevice)); |
|
|
|
@@ -4365,7 +4364,7 @@ void qjackctlMainForm::setDBusParameters ( const qjackctlPreset& preset ) |
|
|
|
if (bAlsa || bSun || bOss || bFirewire) { |
|
|
|
setDBusDriverParameter("nperiods", |
|
|
|
(unsigned int) preset.iPeriods, |
|
|
|
- preset.iPeriods > 0); |
|
|
|
+ preset.iPeriods > 1); |
|
|
|
} |
|
|
|
if (bAlsa) { |
|
|
|
setDBusDriverParameter("softmode", preset.bSoftMode); |
|
|
|
@@ -4436,7 +4435,7 @@ void qjackctlMainForm::setDBusParameters ( const qjackctlPreset& preset ) |
|
|
|
!sOutDevice.isEmpty() && preset.iAudio != QJACKCTL_CAPTURE); |
|
|
|
setDBusDriverParameter("inchannels", |
|
|
|
(unsigned int) preset.iInChannels, |
|
|
|
- preset.iInChannels > 0 && preset.iAudio != QJACKCTL_PLAYBACK); |
|
|
|
+ preset.iInChannels > 0 && preset.iAudio != QJACKCTL_PLAYBACK); |
|
|
|
setDBusDriverParameter("outchannels", |
|
|
|
(unsigned int) preset.iOutChannels, |
|
|
|
preset.iOutChannels > 0 && preset.iAudio != QJACKCTL_CAPTURE); |
|
|
|
@@ -4444,7 +4443,7 @@ void qjackctlMainForm::setDBusParameters ( const qjackctlPreset& preset ) |
|
|
|
else if (bCoreaudio || bFirewire || bNet) { |
|
|
|
setDBusDriverParameter("inchannels", |
|
|
|
(unsigned int) preset.iInChannels, |
|
|
|
- preset.iInChannels > 0 && preset.iAudio != QJACKCTL_PLAYBACK); |
|
|
|
+ preset.iInChannels > 0 && preset.iAudio != QJACKCTL_PLAYBACK); |
|
|
|
setDBusDriverParameter("outchannels", |
|
|
|
(unsigned int) preset.iOutChannels, |
|
|
|
preset.iOutChannels > 0 && preset.iAudio != QJACKCTL_CAPTURE); |
|
|
|
@@ -4452,7 +4451,7 @@ void qjackctlMainForm::setDBusParameters ( const qjackctlPreset& preset ) |
|
|
|
if (bDummy) { |
|
|
|
setDBusDriverParameter("wait", |
|
|
|
(unsigned int) preset.iWait, |
|
|
|
- preset.iWait > 0); |
|
|
|
+ preset.iWait > 0 && preset.iWait != 21333); |
|
|
|
} |
|
|
|
else |
|
|
|
if (!bNet) { |
|
|
|
diff --git a/src/qjackctlSetup.cpp b/src/qjackctlSetup.cpp |
|
|
|
index 8294606c..963cdfff 100644 |
|
|
|
--- a/src/qjackctlSetup.cpp |
|
|
|
+++ b/src/qjackctlSetup.cpp |
|
|
|
@@ -40,14 +40,6 @@ |
|
|
|
#include <jack/jack.h> |
|
|
|
#endif |
|
|
|
|
|
|
|
-#if defined(__WIN32__) || defined(_WIN32) || defined(WIN32) |
|
|
|
-#define DEFAULT_DRIVER "portaudio" |
|
|
|
-#elif defined(__APPLE__) |
|
|
|
-#define DEFAULT_DRIVER "coreaudio" |
|
|
|
-#else |
|
|
|
-#define DEFAULT_DRIVER "alsa" |
|
|
|
-#endif |
|
|
|
- |
|
|
|
|
|
|
|
// Constructor. |
|
|
|
qjackctlSetup::qjackctlSetup (void) |
|
|
|
@@ -370,6 +362,170 @@ bool qjackctlSetup::saveAliases (void) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
+//--------------------------------------------------------------------------- |
|
|
|
+// Preset struct methods. |
|
|
|
+ |
|
|
|
+void qjackctlPreset::clear (void) |
|
|
|
+{ |
|
|
|
+ sServerPrefix.clear(); |
|
|
|
+ sServerName .clear(); |
|
|
|
+ bRealtime = true; |
|
|
|
+ bSoftMode = false; |
|
|
|
+ bMonitor = false; |
|
|
|
+ bShorts = false; |
|
|
|
+ bNoMemLock = false; |
|
|
|
+ bUnlockMem = false; |
|
|
|
+ bHWMeter = false; |
|
|
|
+ bIgnoreHW = false; |
|
|
|
+ iPriority = 0; |
|
|
|
+ iFrames = 0; |
|
|
|
+ iSampleRate = 0; |
|
|
|
+ iPeriods = 0; |
|
|
|
+ iWordLength = 0; |
|
|
|
+ iWait = 0; |
|
|
|
+ iChan = 0; |
|
|
|
+ sDriver .clear(); |
|
|
|
+ sInterface .clear(); |
|
|
|
+ iAudio = 0; |
|
|
|
+ iDither = 0; |
|
|
|
+ iTimeout = 0; |
|
|
|
+ sInDevice .clear(); |
|
|
|
+ sOutDevice .clear(); |
|
|
|
+ iInChannels = 0; |
|
|
|
+ iOutChannels = 0; |
|
|
|
+ iInLatency = 0; |
|
|
|
+ iOutLatency = 0; |
|
|
|
+ iStartDelay = 2; |
|
|
|
+ bSync = false; |
|
|
|
+ bVerbose = false; |
|
|
|
+ iPortMax = 0; |
|
|
|
+ sMidiDriver .clear(); |
|
|
|
+ sServerSuffix.clear(); |
|
|
|
+ uClockSource = 0; |
|
|
|
+ ucSelfConnectMode = ' '; |
|
|
|
+ |
|
|
|
+ fixup(); |
|
|
|
+} |
|
|
|
+ |
|
|
|
+ |
|
|
|
+void qjackctlPreset::load ( QSettings& settings, const QString& sSuffix ) |
|
|
|
+{ |
|
|
|
+ settings.beginGroup("/Settings" + sSuffix); |
|
|
|
+ |
|
|
|
+ sServerPrefix = settings.value("/Server", sServerPrefix).toString(); |
|
|
|
+ sServerName = settings.value("/ServerName", sServerName).toString(); |
|
|
|
+ bRealtime = settings.value("/Realtime", bRealtime).toBool(); |
|
|
|
+ bSoftMode = settings.value("/SoftMode", bSoftMode).toBool(); |
|
|
|
+ bMonitor = settings.value("/Monitor", bMonitor).toBool(); |
|
|
|
+ bShorts = settings.value("/Shorts", bShorts).toBool(); |
|
|
|
+ bNoMemLock = settings.value("/NoMemLock", bNoMemLock).toBool(); |
|
|
|
+ bUnlockMem = settings.value("/UnlockMem", bUnlockMem).toBool(); |
|
|
|
+ bHWMeter = settings.value("/HWMeter", bHWMeter).toBool(); |
|
|
|
+ bIgnoreHW = settings.value("/IgnoreHW", bIgnoreHW).toBool(); |
|
|
|
+ iPriority = settings.value("/Priority", iPriority).toInt(); |
|
|
|
+ iFrames = settings.value("/Frames", iFrames).toInt(); |
|
|
|
+ iSampleRate = settings.value("/SampleRate", iSampleRate).toInt(); |
|
|
|
+ iPeriods = settings.value("/Periods", iPeriods).toInt(); |
|
|
|
+ iWordLength = settings.value("/WordLength", iWordLength).toInt(); |
|
|
|
+ iWait = settings.value("/Wait", iWait).toInt(); |
|
|
|
+ iChan = settings.value("/Chan", iChan).toInt(); |
|
|
|
+ sDriver = settings.value("/Driver", sDriver).toString(); |
|
|
|
+ sInterface = settings.value("/Interface", sInterface).toString(); |
|
|
|
+ iAudio = settings.value("/Audio", iAudio).toInt(); |
|
|
|
+ iDither = settings.value("/Dither", iDither).toInt(); |
|
|
|
+ iTimeout = settings.value("/Timeout", iTimeout).toInt(); |
|
|
|
+ sInDevice = settings.value("/InDevice", sInDevice).toString(); |
|
|
|
+ sOutDevice = settings.value("/OutDevice", sOutDevice).toString(); |
|
|
|
+ iInChannels = settings.value("/InChannels", iInChannels).toInt(); |
|
|
|
+ iOutChannels = settings.value("/OutChannels", iOutChannels).toInt(); |
|
|
|
+ iInLatency = settings.value("/InLatency", iInLatency).toInt(); |
|
|
|
+ iOutLatency = settings.value("/OutLatency", iOutLatency).toInt(); |
|
|
|
+ iStartDelay = settings.value("/StartDelay", iStartDelay).toInt(); |
|
|
|
+ bSync = settings.value("/Sync", bSync).toBool(); |
|
|
|
+ bVerbose = settings.value("/Verbose", bVerbose).toBool(); |
|
|
|
+ iPortMax = settings.value("/PortMax", iPortMax).toInt(); |
|
|
|
+ sMidiDriver = settings.value("/MidiDriver", sMidiDriver).toString(); |
|
|
|
+ sServerSuffix = settings.value("/ServerSuffix", sServerSuffix).toString(); |
|
|
|
+ uClockSource = settings.value("/ClockSource", uClockSource).toUInt(); |
|
|
|
+ ucSelfConnectMode = settings.value("/SelfConnectMode", ucSelfConnectMode).value<uchar>(); |
|
|
|
+ |
|
|
|
+ settings.endGroup(); |
|
|
|
+ |
|
|
|
+ fixup(); |
|
|
|
+} |
|
|
|
+ |
|
|
|
+void qjackctlPreset::save ( QSettings& settings, const QString& sSuffix ) |
|
|
|
+{ |
|
|
|
+ settings.beginGroup("/Settings" + sSuffix); |
|
|
|
+ |
|
|
|
+ settings.setValue("/Server", sServerPrefix); |
|
|
|
+ settings.setValue("/ServerName", sServerName); |
|
|
|
+ settings.setValue("/Realtime", bRealtime); |
|
|
|
+ settings.setValue("/SoftMode", bSoftMode); |
|
|
|
+ settings.setValue("/Monitor", bMonitor); |
|
|
|
+ settings.setValue("/Shorts", bShorts); |
|
|
|
+ settings.setValue("/NoMemLock", bNoMemLock); |
|
|
|
+ settings.setValue("/UnlockMem", bUnlockMem); |
|
|
|
+ settings.setValue("/HWMeter", bHWMeter); |
|
|
|
+ settings.setValue("/IgnoreHW", bIgnoreHW); |
|
|
|
+ settings.setValue("/Priority", iPriority); |
|
|
|
+ settings.setValue("/Frames", iFrames); |
|
|
|
+ settings.setValue("/SampleRate", iSampleRate); |
|
|
|
+ settings.setValue("/Periods", iPeriods); |
|
|
|
+ settings.setValue("/WordLength", iWordLength); |
|
|
|
+ settings.setValue("/Wait", iWait); |
|
|
|
+ settings.setValue("/Chan", iChan); |
|
|
|
+ settings.setValue("/Driver", sDriver); |
|
|
|
+ settings.setValue("/Interface", sInterface); |
|
|
|
+ settings.setValue("/Audio", iAudio); |
|
|
|
+ settings.setValue("/Dither", iDither); |
|
|
|
+ settings.setValue("/Timeout", iTimeout); |
|
|
|
+ settings.setValue("/InDevice", sInDevice); |
|
|
|
+ settings.setValue("/OutDevice", sOutDevice); |
|
|
|
+ settings.setValue("/InChannels", iInChannels); |
|
|
|
+ settings.setValue("/OutChannels", iOutChannels); |
|
|
|
+ settings.setValue("/InLatency", iInLatency); |
|
|
|
+ settings.setValue("/OutLatency", iOutLatency); |
|
|
|
+ settings.setValue("/StartDelay", iStartDelay); |
|
|
|
+ settings.setValue("/Sync", bSync); |
|
|
|
+ settings.setValue("/Verbose", bVerbose); |
|
|
|
+ settings.setValue("/PortMax", iPortMax); |
|
|
|
+ settings.setValue("/MidiDriver", sMidiDriver); |
|
|
|
+ settings.setValue("/ServerSuffix", sServerSuffix); |
|
|
|
+ settings.setValue("/ClockSource", uClockSource); |
|
|
|
+ settings.setValue("/SelfConnectMode", ucSelfConnectMode); |
|
|
|
+ |
|
|
|
+ settings.endGroup(); |
|
|
|
+} |
|
|
|
+ |
|
|
|
+void qjackctlPreset::fixup (void) |
|
|
|
+{ |
|
|
|
+ if (sServerPrefix.isEmpty()) { |
|
|
|
+ sServerPrefix = "jackd"; |
|
|
|
+ #if defined(__WIN32__) || defined(_WIN32) || defined(WIN32) |
|
|
|
+ sServerPrefix += " -S -X winmme"; |
|
|
|
+ #endif |
|
|
|
+ } |
|
|
|
+ |
|
|
|
+ if (sDriver.isEmpty()) { |
|
|
|
+ #if defined(__WIN32__) || defined(_WIN32) || defined(WIN32) |
|
|
|
+ sDriver = "portaudio"; |
|
|
|
+ #elif defined(__APPLE__) |
|
|
|
+ sDriver = "coreaudio"; |
|
|
|
+ #else |
|
|
|
+ sDriver = "alsa"; |
|
|
|
+ #endif |
|
|
|
+ } |
|
|
|
+ |
|
|
|
+#ifdef CONFIG_JACK_MIDI |
|
|
|
+ if (!sMidiDriver.isEmpty() |
|
|
|
+ && sMidiDriver != "raw" |
|
|
|
+ && sMidiDriver != "seq") |
|
|
|
+ sMidiDriver.clear(); |
|
|
|
+#endif |
|
|
|
+} |
|
|
|
+ |
|
|
|
+ |
|
|
|
//--------------------------------------------------------------------------- |
|
|
|
// Preset management methods. |
|
|
|
|
|
|
|
@@ -383,56 +539,7 @@ bool qjackctlSetup::loadPreset ( qjackctlPreset& preset, const QString& sPreset |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
- m_settings.beginGroup("/Settings" + sSuffix); |
|
|
|
-#if defined(__WIN32__) || defined(_WIN32) || defined(WIN32) |
|
|
|
- preset.sServerPrefix = m_settings.value("/Server", "jackd -S -X winmme").toString(); |
|
|
|
-#else |
|
|
|
- preset.sServerPrefix = m_settings.value("/Server", "jackd").toString(); |
|
|
|
-#endif |
|
|
|
- preset.sServerName = m_settings.value("/ServerName").toString(); |
|
|
|
- preset.bRealtime = m_settings.value("/Realtime", true).toBool(); |
|
|
|
- preset.bSoftMode = m_settings.value("/SoftMode", false).toBool(); |
|
|
|
- preset.bMonitor = m_settings.value("/Monitor", false).toBool(); |
|
|
|
- preset.bShorts = m_settings.value("/Shorts", false).toBool(); |
|
|
|
- preset.bNoMemLock = m_settings.value("/NoMemLock", false).toBool(); |
|
|
|
- preset.bUnlockMem = m_settings.value("/UnlockMem", false).toBool(); |
|
|
|
- preset.bHWMeter = m_settings.value("/HWMeter", false).toBool(); |
|
|
|
- preset.bIgnoreHW = m_settings.value("/IgnoreHW", false).toBool(); |
|
|
|
- preset.iPriority = m_settings.value("/Priority", 0).toInt(); |
|
|
|
- preset.iFrames = m_settings.value("/Frames", 1024).toInt(); |
|
|
|
- preset.iSampleRate = m_settings.value("/SampleRate", 48000).toInt(); |
|
|
|
- preset.iPeriods = m_settings.value("/Periods", 2).toInt(); |
|
|
|
- preset.iWordLength = m_settings.value("/WordLength", 16).toInt(); |
|
|
|
- preset.iWait = m_settings.value("/Wait", 21333).toInt(); |
|
|
|
- preset.iChan = m_settings.value("/Chan", 0).toInt(); |
|
|
|
- preset.sDriver = m_settings.value("/Driver", DEFAULT_DRIVER).toString(); |
|
|
|
- preset.sInterface = m_settings.value("/Interface").toString(); |
|
|
|
- preset.iAudio = m_settings.value("/Audio", 0).toInt(); |
|
|
|
- preset.iDither = m_settings.value("/Dither", 0).toInt(); |
|
|
|
- preset.iTimeout = m_settings.value("/Timeout", 500).toInt(); |
|
|
|
- preset.sInDevice = m_settings.value("/InDevice").toString(); |
|
|
|
- preset.sOutDevice = m_settings.value("/OutDevice").toString(); |
|
|
|
- preset.iInChannels = m_settings.value("/InChannels", 0).toInt(); |
|
|
|
- preset.iOutChannels = m_settings.value("/OutChannels", 0).toInt(); |
|
|
|
- preset.iInLatency = m_settings.value("/InLatency", 0).toInt(); |
|
|
|
- preset.iOutLatency = m_settings.value("/OutLatency", 0).toInt(); |
|
|
|
- preset.iStartDelay = m_settings.value("/StartDelay", 2).toInt(); |
|
|
|
- preset.bSync = m_settings.value("/Sync", false).toBool(); |
|
|
|
- preset.bVerbose = m_settings.value("/Verbose", false).toBool(); |
|
|
|
- preset.iPortMax = m_settings.value("/PortMax", 256).toInt(); |
|
|
|
- preset.sMidiDriver = m_settings.value("/MidiDriver").toString(); |
|
|
|
- preset.sServerSuffix = m_settings.value("/ServerSuffix").toString(); |
|
|
|
- preset.uClockSource = m_settings.value("/ClockSource", 0).toUInt(); |
|
|
|
- preset.ucSelfConnectMode = m_settings.value("/SelfConnectMode", ' ').value<uchar>(); |
|
|
|
- m_settings.endGroup(); |
|
|
|
- |
|
|
|
-#ifdef CONFIG_JACK_MIDI |
|
|
|
- if (!preset.sMidiDriver.isEmpty() && |
|
|
|
- preset.sMidiDriver != "raw" && |
|
|
|
- preset.sMidiDriver != "seq") |
|
|
|
- preset.sMidiDriver.clear(); |
|
|
|
-#endif |
|
|
|
- |
|
|
|
+ preset.load(m_settings, sSuffix); |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
@@ -446,45 +553,7 @@ bool qjackctlSetup::savePreset ( qjackctlPreset& preset, const QString& sPreset |
|
|
|
presets.prepend(sPreset); |
|
|
|
} |
|
|
|
|
|
|
|
- m_settings.beginGroup("/Settings" + sSuffix); |
|
|
|
- m_settings.setValue("/Server", preset.sServerPrefix); |
|
|
|
- m_settings.setValue("/ServerName", preset.sServerName); |
|
|
|
- m_settings.setValue("/Realtime", preset.bRealtime); |
|
|
|
- m_settings.setValue("/SoftMode", preset.bSoftMode); |
|
|
|
- m_settings.setValue("/Monitor", preset.bMonitor); |
|
|
|
- m_settings.setValue("/Shorts", preset.bShorts); |
|
|
|
- m_settings.setValue("/NoMemLock", preset.bNoMemLock); |
|
|
|
- m_settings.setValue("/UnlockMem", preset.bUnlockMem); |
|
|
|
- m_settings.setValue("/HWMeter", preset.bHWMeter); |
|
|
|
- m_settings.setValue("/IgnoreHW", preset.bIgnoreHW); |
|
|
|
- m_settings.setValue("/Priority", preset.iPriority); |
|
|
|
- m_settings.setValue("/Frames", preset.iFrames); |
|
|
|
- m_settings.setValue("/SampleRate", preset.iSampleRate); |
|
|
|
- m_settings.setValue("/Periods", preset.iPeriods); |
|
|
|
- m_settings.setValue("/WordLength", preset.iWordLength); |
|
|
|
- m_settings.setValue("/Wait", preset.iWait); |
|
|
|
- m_settings.setValue("/Chan", preset.iChan); |
|
|
|
- m_settings.setValue("/Driver", preset.sDriver); |
|
|
|
- m_settings.setValue("/Interface", preset.sInterface); |
|
|
|
- m_settings.setValue("/Audio", preset.iAudio); |
|
|
|
- m_settings.setValue("/Dither", preset.iDither); |
|
|
|
- m_settings.setValue("/Timeout", preset.iTimeout); |
|
|
|
- m_settings.setValue("/InDevice", preset.sInDevice); |
|
|
|
- m_settings.setValue("/OutDevice", preset.sOutDevice); |
|
|
|
- m_settings.setValue("/InChannels", preset.iInChannels); |
|
|
|
- m_settings.setValue("/OutChannels", preset.iOutChannels); |
|
|
|
- m_settings.setValue("/InLatency", preset.iInLatency); |
|
|
|
- m_settings.setValue("/OutLatency", preset.iOutLatency); |
|
|
|
- m_settings.setValue("/StartDelay", preset.iStartDelay); |
|
|
|
- m_settings.setValue("/Sync", preset.bSync); |
|
|
|
- m_settings.setValue("/Verbose", preset.bVerbose); |
|
|
|
- m_settings.setValue("/PortMax", preset.iPortMax); |
|
|
|
- m_settings.setValue("/MidiDriver", preset.sMidiDriver); |
|
|
|
- m_settings.setValue("/ServerSuffix", preset.sServerSuffix); |
|
|
|
- m_settings.setValue("/ClockSource", preset.uClockSource); |
|
|
|
- m_settings.setValue("/SelfConnectMode", preset.ucSelfConnectMode); |
|
|
|
- m_settings.endGroup(); |
|
|
|
- |
|
|
|
+ preset.save(m_settings, sSuffix); |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
@@ -493,13 +562,15 @@ bool qjackctlSetup::deletePreset ( const QString& sPreset ) |
|
|
|
QString sSuffix; |
|
|
|
if (sPreset != sDefPresetName && !sPreset.isEmpty()) { |
|
|
|
sSuffix = '/' + sPreset; |
|
|
|
- int iPreset = presets.indexOf(sPreset); |
|
|
|
+ const int iPreset = presets.indexOf(sPreset); |
|
|
|
if (iPreset < 0) |
|
|
|
return false; |
|
|
|
presets.removeAt(iPreset); |
|
|
|
- m_settings.remove("/Settings" + sSuffix); |
|
|
|
- m_settings.remove("/Aliases" + sSuffix); |
|
|
|
} |
|
|
|
+ |
|
|
|
+ m_settings.remove("/Settings" + sSuffix); |
|
|
|
+ m_settings.remove("/Aliases" + sSuffix); |
|
|
|
+ |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
diff --git a/src/qjackctlSetup.h b/src/qjackctlSetup.h |
|
|
|
index 18ca99e9..e03f60d9 100644 |
|
|
|
--- a/src/qjackctlSetup.h |
|
|
|
+++ b/src/qjackctlSetup.h |
|
|
|
@@ -47,6 +47,13 @@ class QSplitter; |
|
|
|
// Server settings preset struct. |
|
|
|
struct qjackctlPreset |
|
|
|
{ |
|
|
|
+ qjackctlPreset() { clear(); } |
|
|
|
+ |
|
|
|
+ void clear(); |
|
|
|
+ void load(QSettings& settings, const QString& sSuffix); |
|
|
|
+ void save(QSettings& settings, const QString& sSuffix); |
|
|
|
+ void fixup(); |
|
|
|
+ |
|
|
|
QString sServerPrefix; |
|
|
|
QString sServerName; |
|
|
|
bool bRealtime; |
|
|
|
diff --git a/src/qjackctlSetupForm.cpp b/src/qjackctlSetupForm.cpp |
|
|
|
index ee64fa3b..4b934fab 100644 |
|
|
|
--- a/src/qjackctlSetupForm.cpp |
|
|
|
+++ b/src/qjackctlSetupForm.cpp |
|
|
|
@@ -95,8 +95,9 @@ qjackctlSetupForm::qjackctlSetupForm ( QWidget *pParent ) |
|
|
|
m_pTimeDisplayButtonGroup->setExclusive(true); |
|
|
|
|
|
|
|
// Setup clock-source combo-box. |
|
|
|
+ const QString& sDefName = tr(g_pszDefName); |
|
|
|
m_ui.ClockSourceComboBox->clear(); |
|
|
|
- m_ui.ClockSourceComboBox->addItem(g_pszDefName, uint(0)); |
|
|
|
+ m_ui.ClockSourceComboBox->addItem(sDefName, uint(0)); |
|
|
|
m_ui.ClockSourceComboBox->addItem(tr("System"), uint('s')); |
|
|
|
m_ui.ClockSourceComboBox->addItem(tr("Cycle"), uint('c')); |
|
|
|
m_ui.ClockSourceComboBox->addItem(tr("HPET"), uint('h')); |
|
|
|
@@ -157,11 +158,28 @@ qjackctlSetupForm::qjackctlSetupForm ( QWidget *pParent ) |
|
|
|
m_ui.ServerPrefixComboBox->setCompleter(nullptr); |
|
|
|
m_ui.ServerSuffixComboBox->setCompleter(nullptr); |
|
|
|
|
|
|
|
+ m_ui.PrioritySpinBox->setSpecialValueText(sDefName); |
|
|
|
+ m_ui.SampleRateComboBox->insertItem(0, sDefName); |
|
|
|
+ m_ui.FramesComboBox->insertItem(0, sDefName); |
|
|
|
+ m_ui.PeriodsSpinBox->setSpecialValueText(sDefName); |
|
|
|
+ m_ui.PortMaxComboBox->insertItem(0, sDefName); |
|
|
|
+ m_ui.TimeoutComboBox->insertItem(0, sDefName); |
|
|
|
+ m_ui.WaitComboBox->insertItem(0, sDefName); |
|
|
|
+ m_ui.WordLengthComboBox->insertItem(0, sDefName); |
|
|
|
+ m_ui.ChanSpinBox->setSpecialValueText(sDefName); |
|
|
|
+ m_ui.InChannelsSpinBox->setSpecialValueText(sDefName); |
|
|
|
+ m_ui.OutChannelsSpinBox->setSpecialValueText(sDefName); |
|
|
|
+ m_ui.InLatencySpinBox->setSpecialValueText(sDefName); |
|
|
|
+ m_ui.OutLatencySpinBox->setSpecialValueText(sDefName); |
|
|
|
+ |
|
|
|
// UI connections... |
|
|
|
|
|
|
|
QObject::connect(m_ui.PresetComboBox, |
|
|
|
SIGNAL(editTextChanged(const QString&)), |
|
|
|
SLOT(changeCurrentPreset(const QString&))); |
|
|
|
+ QObject::connect(m_ui.PresetClearPushButton, |
|
|
|
+ SIGNAL(clicked()), |
|
|
|
+ SLOT(clearCurrentPreset())); |
|
|
|
QObject::connect(m_ui.PresetSavePushButton, |
|
|
|
SIGNAL(clicked()), |
|
|
|
SLOT(saveCurrentPreset())); |
|
|
|
@@ -766,15 +784,24 @@ void qjackctlSetupForm::setCurrentPreset ( const qjackctlPreset& preset ) |
|
|
|
m_ui.HWMeterCheckBox->setChecked(preset.bHWMeter); |
|
|
|
m_ui.IgnoreHWCheckBox->setChecked(preset.bIgnoreHW); |
|
|
|
m_ui.PrioritySpinBox->setValue(preset.iPriority); |
|
|
|
+ const QString& sDefName = tr(g_pszDefName); |
|
|
|
setComboBoxCurrentText(m_ui.FramesComboBox, |
|
|
|
- QString::number(preset.iFrames)); |
|
|
|
+ preset.iFrames > 0 |
|
|
|
+ ? QString::number(preset.iFrames) |
|
|
|
+ : sDefName); |
|
|
|
setComboBoxCurrentText(m_ui.SampleRateComboBox, |
|
|
|
- QString::number(preset.iSampleRate)); |
|
|
|
+ preset.iSampleRate > 0 |
|
|
|
+ ? QString::number(preset.iSampleRate) |
|
|
|
+ : sDefName); |
|
|
|
m_ui.PeriodsSpinBox->setValue(preset.iPeriods); |
|
|
|
setComboBoxCurrentText(m_ui.WordLengthComboBox, |
|
|
|
- QString::number(preset.iWordLength)); |
|
|
|
+ preset.iWordLength > 0 && preset.iWordLength != 16 |
|
|
|
+ ? QString::number(preset.iWordLength) |
|
|
|
+ : sDefName); |
|
|
|
setComboBoxCurrentText(m_ui.WaitComboBox, |
|
|
|
- QString::number(preset.iWait)); |
|
|
|
+ preset.iWait > 0 && preset.iWait != 21333 |
|
|
|
+ ? QString::number(preset.iWait) |
|
|
|
+ : sDefName); |
|
|
|
m_ui.ChanSpinBox->setValue(preset.iChan); |
|
|
|
setComboBoxCurrentText(m_ui.DriverComboBox, preset.sDriver); |
|
|
|
setComboBoxCurrentText(m_ui.InterfaceComboBox, |
|
|
|
@@ -784,7 +811,9 @@ void qjackctlSetupForm::setCurrentPreset ( const qjackctlPreset& preset ) |
|
|
|
m_ui.AudioComboBox->setCurrentIndex(preset.iAudio); |
|
|
|
m_ui.DitherComboBox->setCurrentIndex(preset.iDither); |
|
|
|
setComboBoxCurrentText(m_ui.TimeoutComboBox, |
|
|
|
- QString::number(preset.iTimeout)); |
|
|
|
+ preset.iTimeout > 0 && preset.iTimeout != 500 |
|
|
|
+ ? QString::number(preset.iTimeout) |
|
|
|
+ : sDefName); |
|
|
|
setComboBoxCurrentData(m_ui.ClockSourceComboBox, |
|
|
|
uint(preset.uClockSource)); |
|
|
|
setComboBoxCurrentText(m_ui.InDeviceComboBox, |
|
|
|
@@ -805,7 +834,9 @@ void qjackctlSetupForm::setCurrentPreset ( const qjackctlPreset& preset ) |
|
|
|
QVariant::fromValue<uchar> (preset.ucSelfConnectMode)); |
|
|
|
m_ui.VerboseCheckBox->setChecked(preset.bVerbose); |
|
|
|
setComboBoxCurrentText(m_ui.PortMaxComboBox, |
|
|
|
- QString::number(preset.iPortMax)); |
|
|
|
+ preset.iPortMax > 0 && preset.iPortMax != 256 |
|
|
|
+ ? QString::number(preset.iPortMax) |
|
|
|
+ : sDefName); |
|
|
|
#ifdef CONFIG_JACK_MIDI |
|
|
|
setComboBoxCurrentText(m_ui.MidiDriverComboBox, |
|
|
|
preset.sMidiDriver); |
|
|
|
@@ -995,6 +1026,16 @@ void qjackctlSetupForm::changeCurrentPreset ( const QString& sPreset ) |
|
|
|
optionsChanged(); |
|
|
|
} |
|
|
|
|
|
|
|
+ |
|
|
|
+void qjackctlSetupForm::clearCurrentPreset (void) |
|
|
|
+{ |
|
|
|
+ // Clear current settings... |
|
|
|
+ qjackctlPreset preset; |
|
|
|
+ setCurrentPreset(preset); |
|
|
|
+ settingsChanged(); |
|
|
|
+} |
|
|
|
+ |
|
|
|
+ |
|
|
|
void qjackctlSetupForm::saveCurrentPreset (void) |
|
|
|
{ |
|
|
|
const QString sPreset = m_ui.PresetComboBox->currentText(); |
|
|
|
diff --git a/src/qjackctlSetupForm.h b/src/qjackctlSetupForm.h |
|
|
|
index 97e1a32f..cbd70dff 100644 |
|
|
|
--- a/src/qjackctlSetupForm.h |
|
|
|
+++ b/src/qjackctlSetupForm.h |
|
|
|
@@ -54,6 +54,7 @@ class qjackctlSetupForm : public QDialog |
|
|
|
protected slots: |
|
|
|
|
|
|
|
void changeCurrentPreset(const QString&); |
|
|
|
+ void clearCurrentPreset(); |
|
|
|
void saveCurrentPreset(); |
|
|
|
void deleteCurrentPreset(); |
|
|
|
|
|
|
|
diff --git a/src/qjackctlSetupForm.ui b/src/qjackctlSetupForm.ui |
|
|
|
index e78624b7..bb064f7d 100644 |
|
|
|
--- a/src/qjackctlSetupForm.ui |
|
|
|
+++ b/src/qjackctlSetupForm.ui |
|
|
|
@@ -95,6 +95,22 @@ |
|
|
|
</item> |
|
|
|
</widget> |
|
|
|
</item> |
|
|
|
+ <item> |
|
|
|
+ <widget class="QPushButton" name="PresetClearPushButton"> |
|
|
|
+ <property name="toolTip"> |
|
|
|
+ <string>Clear settings of current preset name</string> |
|
|
|
+ </property> |
|
|
|
+ <property name="text"> |
|
|
|
+ <string>Clea&r</string> |
|
|
|
+ </property> |
|
|
|
+ <property name="icon"> |
|
|
|
+ <iconset resource="qjackctl.qrc">:/images/clear1.png</iconset> |
|
|
|
+ </property> |
|
|
|
+ <property name="autoDefault"> |
|
|
|
+ <bool>false</bool> |
|
|
|
+ </property> |
|
|
|
+ </widget> |
|
|
|
+ </item> |
|
|
|
<item> |
|
|
|
<widget class="QPushButton" name="PresetSavePushButton"> |
|
|
|
<property name="toolTip"> |
|
|
|
@@ -597,11 +613,14 @@ |
|
|
|
<string>Number of periods in the hardware buffer</string> |
|
|
|
</property> |
|
|
|
<property name="minimum"> |
|
|
|
- <number>2</number> |
|
|
|
+ <number>1</number> |
|
|
|
</property> |
|
|
|
<property name="maximum"> |
|
|
|
<number>999</number> |
|
|
|
</property> |
|
|
|
+ <property name="value"> |
|
|
|
+ <number>1</number> |
|
|
|
+ </property> |
|
|
|
</widget> |
|
|
|
</item> |
|
|
|
</layout> |
|
|
|
@@ -1064,9 +1083,6 @@ |
|
|
|
<property name="toolTip"> |
|
|
|
<string>Scheduler priority when running realtime</string> |
|
|
|
</property> |
|
|
|
- <property name="specialValueText"> |
|
|
|
- <string>(default)</string> |
|
|
|
- </property> |
|
|
|
<property name="singleStep"> |
|
|
|
<number>1</number> |
|
|
|
</property> |
|
|
|
@@ -1074,7 +1090,7 @@ |
|
|
|
<number>5</number> |
|
|
|
</property> |
|
|
|
<property name="maximum"> |
|
|
|
- <number>99</number> |
|
|
|
+ <number>95</number> |
|
|
|
</property> |
|
|
|
</widget> |
|
|
|
</item> |
|
|
|
@@ -1108,9 +1124,6 @@ |
|
|
|
<bold>false</bold> |
|
|
|
</font> |
|
|
|
</property> |
|
|
|
- <property name="acceptDrops"> |
|
|
|
- <bool>false</bool> |
|
|
|
- </property> |
|
|
|
<property name="toolTip"> |
|
|
|
<string>Word length</string> |
|
|
|
</property> |
|
|
|
@@ -1165,9 +1178,6 @@ |
|
|
|
<bold>false</bold> |
|
|
|
</font> |
|
|
|
</property> |
|
|
|
- <property name="acceptDrops"> |
|
|
|
- <bool>false</bool> |
|
|
|
- </property> |
|
|
|
<property name="toolTip"> |
|
|
|
<string>Number of microseconds to wait between engine processes (dummy)</string> |
|
|
|
</property> |
|
|
|
@@ -1217,9 +1227,6 @@ |
|
|
|
<property name="toolTip"> |
|
|
|
<string>Maximum number of audio channels to allocate</string> |
|
|
|
</property> |
|
|
|
- <property name="specialValueText"> |
|
|
|
- <string>(default)</string> |
|
|
|
- </property> |
|
|
|
<property name="maximum"> |
|
|
|
<number>999</number> |
|
|
|
</property> |
|
|
|
@@ -1268,7 +1275,7 @@ |
|
|
|
<bool>true</bool> |
|
|
|
</property> |
|
|
|
<property name="currentIndex"> |
|
|
|
- <number>1</number> |
|
|
|
+ <number>0</number> |
|
|
|
</property> |
|
|
|
<item> |
|
|
|
<property name="text"> |
|
|
|
@@ -1330,7 +1337,7 @@ |
|
|
|
<bool>true</bool> |
|
|
|
</property> |
|
|
|
<property name="currentIndex"> |
|
|
|
- <number>1</number> |
|
|
|
+ <number>0</number> |
|
|
|
</property> |
|
|
|
<item> |
|
|
|
<property name="text"> |
|
|
|
@@ -1357,11 +1364,6 @@ |
|
|
|
<string>5000</string> |
|
|
|
</property> |
|
|
|
</item> |
|
|
|
- <item> |
|
|
|
- <property name="text"> |
|
|
|
- <string>10000</string> |
|
|
|
- </property> |
|
|
|
- </item> |
|
|
|
</widget> |
|
|
|
</item> |
|
|
|
<item row="6" column="0"> |
|
|
|
@@ -1710,9 +1712,6 @@ |
|
|
|
<property name="toolTip"> |
|
|
|
<string>Maximum input audio hardware channels to allocate</string> |
|
|
|
</property> |
|
|
|
- <property name="specialValueText"> |
|
|
|
- <string>(default)</string> |
|
|
|
- </property> |
|
|
|
<property name="maximum"> |
|
|
|
<number>999</number> |
|
|
|
</property> |
|
|
|
@@ -1741,9 +1740,6 @@ |
|
|
|
<property name="toolTip"> |
|
|
|
<string>Maximum output audio hardware channels to allocate</string> |
|
|
|
</property> |
|
|
|
- <property name="specialValueText"> |
|
|
|
- <string>(default)</string> |
|
|
|
- </property> |
|
|
|
<property name="maximum"> |
|
|
|
<number>999</number> |
|
|
|
</property> |
|
|
|
@@ -1794,9 +1790,6 @@ |
|
|
|
<property name="toolTip"> |
|
|
|
<string>External input latency (frames)</string> |
|
|
|
</property> |
|
|
|
- <property name="specialValueText"> |
|
|
|
- <string>(default)</string> |
|
|
|
- </property> |
|
|
|
<property name="maximum"> |
|
|
|
<number>9999999</number> |
|
|
|
</property> |
|
|
|
@@ -1825,9 +1818,6 @@ |
|
|
|
<property name="toolTip"> |
|
|
|
<string>External output latency (frames)</string> |
|
|
|
</property> |
|
|
|
- <property name="specialValueText"> |
|
|
|
- <string>(default)</string> |
|
|
|
- </property> |
|
|
|
<property name="maximum"> |
|
|
|
<number>9999999</number> |
|
|
|
</property> |
|
|
|
@@ -4209,6 +4199,7 @@ |
|
|
|
<tabstops> |
|
|
|
<tabstop>SetupTabWidget</tabstop> |
|
|
|
<tabstop>PresetComboBox</tabstop> |
|
|
|
+ <tabstop>PresetClearPushButton</tabstop> |
|
|
|
<tabstop>PresetSavePushButton</tabstop> |
|
|
|
<tabstop>PresetDeletePushButton</tabstop> |
|
|
|
<tabstop>SettingsTabWidget</tabstop> |