Cross-Platform build scripts for audio plugins
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

761 lines
29KB

  1. From 626731e752b4694051b3d447cebb90116fd37186 Mon Sep 17 00:00:00 2001
  2. From: rncbc <rncbc@rncbc.org>
  3. Date: Sat, 19 Dec 2020 16:25:19 +0000
  4. Subject: [PATCH] - Add Clear preset button to Setup dialog (refactored from
  5. an original patch by kmatheussen #113)
  6. - Use default values for most preset parameters: sample
  7. rate, frames/period (aka. buffer-size), periods/buffer,
  8. realtime priority, port maximum, client timeout, word
  9. length, wait time, channel maximum (refactored from an
  10. original patch by kmatheussen #112)
  11. ---
  12. ChangeLog | 12 ++
  13. src/images/clear1.png | Bin 0 -> 579 bytes
  14. src/qjackctl.qrc | 1 +
  15. src/qjackctlMainForm.cpp | 21 ++-
  16. src/qjackctlSetup.cpp | 271 ++++++++++++++++++++++++--------------
  17. src/qjackctlSetup.h | 7 +
  18. src/qjackctlSetupForm.cpp | 55 +++++++-
  19. src/qjackctlSetupForm.h | 1 +
  20. src/qjackctlSetupForm.ui | 57 ++++----
  21. 9 files changed, 274 insertions(+), 151 deletions(-)
  22. create mode 100644 src/images/clear1.png
  23. diff --git a/ChangeLog b/ChangeLog
  24. index d79615ce..2cf233b2 100644
  25. --- a/ChangeLog
  26. +++ b/ChangeLog
  27. @@ -4,6 +4,18 @@ QjackCtl - JACK Audio Connection Kit Qt GUI Interface
  28. ChangeLog
  29. +GIT HEAD
  30. +
  31. +- Add Clear preset button to Setup dialog (refactored
  32. + from an original patch by kmatheussen #113)
  33. +
  34. +- Use default values for most preset parameters: sample
  35. + rate, frames/period (aka. buffer-size), periods/buffer,
  36. + realtime priority, port maximum, client timeout, word
  37. + length, wait time, channel maximum (refactored from an
  38. + original patch by kmatheussen #112)
  39. +
  40. +
  41. 0.9.0 2020-12-17 A Winter'20 Release.
  42. - List only available backend drivers when JACK D-BUS
  43. diff --git a/src/qjackctl.qrc b/src/qjackctl.qrc
  44. index 55d8d1c7..21303a4e 100644
  45. --- a/src/qjackctl.qrc
  46. +++ b/src/qjackctl.qrc
  47. @@ -38,6 +38,7 @@
  48. <file>images/asocketi.png</file>
  49. <file>images/asocketo.png</file>
  50. <file>images/backward1.png</file>
  51. + <file>images/clear1.png</file>
  52. <file>images/client1.png</file>
  53. <file>images/connect1.png</file>
  54. <file>images/connections1.png</file>
  55. diff --git a/src/qjackctlMainForm.cpp b/src/qjackctlMainForm.cpp
  56. index ee9afa45..28d916b1 100644
  57. --- a/src/qjackctlMainForm.cpp
  58. +++ b/src/qjackctlMainForm.cpp
  59. @@ -1449,12 +1449,11 @@ void qjackctlMainForm::startJack (void)
  60. const QString sPath = QString::fromUtf8(::getenv("PATH"));
  61. QStringList paths = sPath.split(chPathSep);
  62. #if defined(__WIN32__) || defined(_WIN32) || defined(WIN32)
  63. - paths = paths << QString("%1\\JACK2").arg(getenv("PROGRAMFILES"))
  64. - << QString("%1\\JACK2").arg(getenv("PROGRAMFILES(x86)"));
  65. + paths.append(QString("%1\\JACK2").arg(::getenv("PROGRAMFILES")));
  66. + paths.append(QString("%1\\JACK2").arg(::getenv("PROGRAMFILES(x86)")));
  67. + #elif defined(__APPLE__)
  68. + paths.append("/usr/local/bin/");
  69. #endif
  70. - #if defined(__APPLE__)
  71. - paths = paths << "/usr/local/bin/";
  72. - #endif
  73. QStringListIterator iter(paths);
  74. while (iter.hasNext()) {
  75. const QString& sDirectory = iter.next();
  76. @@ -1514,7 +1513,7 @@ void qjackctlMainForm::startJack (void)
  77. if (m_preset.iFrames > 0 && !bNet)
  78. args.append("-p" + QString::number(m_preset.iFrames));
  79. if (bAlsa || bSun || bOss || bFirewire) {
  80. - if (m_preset.iPeriods > 0)
  81. + if (m_preset.iPeriods > 1)
  82. args.append("-n" + QString::number(m_preset.iPeriods));
  83. }
  84. if (bAlsa) {
  85. @@ -1570,7 +1569,7 @@ void qjackctlMainForm::startJack (void)
  86. else if (bOss || bSun) {
  87. if (m_preset.bIgnoreHW)
  88. args.append("-b");
  89. - if (m_preset.iWordLength > 0)
  90. + if (m_preset.iWordLength > 0 && m_preset.iWordLength != 16)
  91. args.append("-w" + QString::number(m_preset.iWordLength));
  92. if (!m_preset.sInDevice.isEmpty() && m_preset.iAudio != QJACKCTL_PLAYBACK)
  93. args.append("-C" + formatQuoted(m_preset.sInDevice));
  94. @@ -4365,7 +4364,7 @@ void qjackctlMainForm::setDBusParameters ( const qjackctlPreset& preset )
  95. if (bAlsa || bSun || bOss || bFirewire) {
  96. setDBusDriverParameter("nperiods",
  97. (unsigned int) preset.iPeriods,
  98. - preset.iPeriods > 0);
  99. + preset.iPeriods > 1);
  100. }
  101. if (bAlsa) {
  102. setDBusDriverParameter("softmode", preset.bSoftMode);
  103. @@ -4436,7 +4435,7 @@ void qjackctlMainForm::setDBusParameters ( const qjackctlPreset& preset )
  104. !sOutDevice.isEmpty() && preset.iAudio != QJACKCTL_CAPTURE);
  105. setDBusDriverParameter("inchannels",
  106. (unsigned int) preset.iInChannels,
  107. - preset.iInChannels > 0 && preset.iAudio != QJACKCTL_PLAYBACK);
  108. + preset.iInChannels > 0 && preset.iAudio != QJACKCTL_PLAYBACK);
  109. setDBusDriverParameter("outchannels",
  110. (unsigned int) preset.iOutChannels,
  111. preset.iOutChannels > 0 && preset.iAudio != QJACKCTL_CAPTURE);
  112. @@ -4444,7 +4443,7 @@ void qjackctlMainForm::setDBusParameters ( const qjackctlPreset& preset )
  113. else if (bCoreaudio || bFirewire || bNet) {
  114. setDBusDriverParameter("inchannels",
  115. (unsigned int) preset.iInChannels,
  116. - preset.iInChannels > 0 && preset.iAudio != QJACKCTL_PLAYBACK);
  117. + preset.iInChannels > 0 && preset.iAudio != QJACKCTL_PLAYBACK);
  118. setDBusDriverParameter("outchannels",
  119. (unsigned int) preset.iOutChannels,
  120. preset.iOutChannels > 0 && preset.iAudio != QJACKCTL_CAPTURE);
  121. @@ -4452,7 +4451,7 @@ void qjackctlMainForm::setDBusParameters ( const qjackctlPreset& preset )
  122. if (bDummy) {
  123. setDBusDriverParameter("wait",
  124. (unsigned int) preset.iWait,
  125. - preset.iWait > 0);
  126. + preset.iWait > 0 && preset.iWait != 21333);
  127. }
  128. else
  129. if (!bNet) {
  130. diff --git a/src/qjackctlSetup.cpp b/src/qjackctlSetup.cpp
  131. index 8294606c..963cdfff 100644
  132. --- a/src/qjackctlSetup.cpp
  133. +++ b/src/qjackctlSetup.cpp
  134. @@ -40,14 +40,6 @@
  135. #include <jack/jack.h>
  136. #endif
  137. -#if defined(__WIN32__) || defined(_WIN32) || defined(WIN32)
  138. -#define DEFAULT_DRIVER "portaudio"
  139. -#elif defined(__APPLE__)
  140. -#define DEFAULT_DRIVER "coreaudio"
  141. -#else
  142. -#define DEFAULT_DRIVER "alsa"
  143. -#endif
  144. -
  145. // Constructor.
  146. qjackctlSetup::qjackctlSetup (void)
  147. @@ -370,6 +362,170 @@ bool qjackctlSetup::saveAliases (void)
  148. }
  149. +//---------------------------------------------------------------------------
  150. +// Preset struct methods.
  151. +
  152. +void qjackctlPreset::clear (void)
  153. +{
  154. + sServerPrefix.clear();
  155. + sServerName .clear();
  156. + bRealtime = true;
  157. + bSoftMode = false;
  158. + bMonitor = false;
  159. + bShorts = false;
  160. + bNoMemLock = false;
  161. + bUnlockMem = false;
  162. + bHWMeter = false;
  163. + bIgnoreHW = false;
  164. + iPriority = 0;
  165. + iFrames = 0;
  166. + iSampleRate = 0;
  167. + iPeriods = 0;
  168. + iWordLength = 0;
  169. + iWait = 0;
  170. + iChan = 0;
  171. + sDriver .clear();
  172. + sInterface .clear();
  173. + iAudio = 0;
  174. + iDither = 0;
  175. + iTimeout = 0;
  176. + sInDevice .clear();
  177. + sOutDevice .clear();
  178. + iInChannels = 0;
  179. + iOutChannels = 0;
  180. + iInLatency = 0;
  181. + iOutLatency = 0;
  182. + iStartDelay = 2;
  183. + bSync = false;
  184. + bVerbose = false;
  185. + iPortMax = 0;
  186. + sMidiDriver .clear();
  187. + sServerSuffix.clear();
  188. + uClockSource = 0;
  189. + ucSelfConnectMode = ' ';
  190. +
  191. + fixup();
  192. +}
  193. +
  194. +
  195. +void qjackctlPreset::load ( QSettings& settings, const QString& sSuffix )
  196. +{
  197. + settings.beginGroup("/Settings" + sSuffix);
  198. +
  199. + sServerPrefix = settings.value("/Server", sServerPrefix).toString();
  200. + sServerName = settings.value("/ServerName", sServerName).toString();
  201. + bRealtime = settings.value("/Realtime", bRealtime).toBool();
  202. + bSoftMode = settings.value("/SoftMode", bSoftMode).toBool();
  203. + bMonitor = settings.value("/Monitor", bMonitor).toBool();
  204. + bShorts = settings.value("/Shorts", bShorts).toBool();
  205. + bNoMemLock = settings.value("/NoMemLock", bNoMemLock).toBool();
  206. + bUnlockMem = settings.value("/UnlockMem", bUnlockMem).toBool();
  207. + bHWMeter = settings.value("/HWMeter", bHWMeter).toBool();
  208. + bIgnoreHW = settings.value("/IgnoreHW", bIgnoreHW).toBool();
  209. + iPriority = settings.value("/Priority", iPriority).toInt();
  210. + iFrames = settings.value("/Frames", iFrames).toInt();
  211. + iSampleRate = settings.value("/SampleRate", iSampleRate).toInt();
  212. + iPeriods = settings.value("/Periods", iPeriods).toInt();
  213. + iWordLength = settings.value("/WordLength", iWordLength).toInt();
  214. + iWait = settings.value("/Wait", iWait).toInt();
  215. + iChan = settings.value("/Chan", iChan).toInt();
  216. + sDriver = settings.value("/Driver", sDriver).toString();
  217. + sInterface = settings.value("/Interface", sInterface).toString();
  218. + iAudio = settings.value("/Audio", iAudio).toInt();
  219. + iDither = settings.value("/Dither", iDither).toInt();
  220. + iTimeout = settings.value("/Timeout", iTimeout).toInt();
  221. + sInDevice = settings.value("/InDevice", sInDevice).toString();
  222. + sOutDevice = settings.value("/OutDevice", sOutDevice).toString();
  223. + iInChannels = settings.value("/InChannels", iInChannels).toInt();
  224. + iOutChannels = settings.value("/OutChannels", iOutChannels).toInt();
  225. + iInLatency = settings.value("/InLatency", iInLatency).toInt();
  226. + iOutLatency = settings.value("/OutLatency", iOutLatency).toInt();
  227. + iStartDelay = settings.value("/StartDelay", iStartDelay).toInt();
  228. + bSync = settings.value("/Sync", bSync).toBool();
  229. + bVerbose = settings.value("/Verbose", bVerbose).toBool();
  230. + iPortMax = settings.value("/PortMax", iPortMax).toInt();
  231. + sMidiDriver = settings.value("/MidiDriver", sMidiDriver).toString();
  232. + sServerSuffix = settings.value("/ServerSuffix", sServerSuffix).toString();
  233. + uClockSource = settings.value("/ClockSource", uClockSource).toUInt();
  234. + ucSelfConnectMode = settings.value("/SelfConnectMode", ucSelfConnectMode).value<uchar>();
  235. +
  236. + settings.endGroup();
  237. +
  238. + fixup();
  239. +}
  240. +
  241. +void qjackctlPreset::save ( QSettings& settings, const QString& sSuffix )
  242. +{
  243. + settings.beginGroup("/Settings" + sSuffix);
  244. +
  245. + settings.setValue("/Server", sServerPrefix);
  246. + settings.setValue("/ServerName", sServerName);
  247. + settings.setValue("/Realtime", bRealtime);
  248. + settings.setValue("/SoftMode", bSoftMode);
  249. + settings.setValue("/Monitor", bMonitor);
  250. + settings.setValue("/Shorts", bShorts);
  251. + settings.setValue("/NoMemLock", bNoMemLock);
  252. + settings.setValue("/UnlockMem", bUnlockMem);
  253. + settings.setValue("/HWMeter", bHWMeter);
  254. + settings.setValue("/IgnoreHW", bIgnoreHW);
  255. + settings.setValue("/Priority", iPriority);
  256. + settings.setValue("/Frames", iFrames);
  257. + settings.setValue("/SampleRate", iSampleRate);
  258. + settings.setValue("/Periods", iPeriods);
  259. + settings.setValue("/WordLength", iWordLength);
  260. + settings.setValue("/Wait", iWait);
  261. + settings.setValue("/Chan", iChan);
  262. + settings.setValue("/Driver", sDriver);
  263. + settings.setValue("/Interface", sInterface);
  264. + settings.setValue("/Audio", iAudio);
  265. + settings.setValue("/Dither", iDither);
  266. + settings.setValue("/Timeout", iTimeout);
  267. + settings.setValue("/InDevice", sInDevice);
  268. + settings.setValue("/OutDevice", sOutDevice);
  269. + settings.setValue("/InChannels", iInChannels);
  270. + settings.setValue("/OutChannels", iOutChannels);
  271. + settings.setValue("/InLatency", iInLatency);
  272. + settings.setValue("/OutLatency", iOutLatency);
  273. + settings.setValue("/StartDelay", iStartDelay);
  274. + settings.setValue("/Sync", bSync);
  275. + settings.setValue("/Verbose", bVerbose);
  276. + settings.setValue("/PortMax", iPortMax);
  277. + settings.setValue("/MidiDriver", sMidiDriver);
  278. + settings.setValue("/ServerSuffix", sServerSuffix);
  279. + settings.setValue("/ClockSource", uClockSource);
  280. + settings.setValue("/SelfConnectMode", ucSelfConnectMode);
  281. +
  282. + settings.endGroup();
  283. +}
  284. +
  285. +void qjackctlPreset::fixup (void)
  286. +{
  287. + if (sServerPrefix.isEmpty()) {
  288. + sServerPrefix = "jackd";
  289. + #if defined(__WIN32__) || defined(_WIN32) || defined(WIN32)
  290. + sServerPrefix += " -S -X winmme";
  291. + #endif
  292. + }
  293. +
  294. + if (sDriver.isEmpty()) {
  295. + #if defined(__WIN32__) || defined(_WIN32) || defined(WIN32)
  296. + sDriver = "portaudio";
  297. + #elif defined(__APPLE__)
  298. + sDriver = "coreaudio";
  299. + #else
  300. + sDriver = "alsa";
  301. + #endif
  302. + }
  303. +
  304. +#ifdef CONFIG_JACK_MIDI
  305. + if (!sMidiDriver.isEmpty()
  306. + && sMidiDriver != "raw"
  307. + && sMidiDriver != "seq")
  308. + sMidiDriver.clear();
  309. +#endif
  310. +}
  311. +
  312. +
  313. //---------------------------------------------------------------------------
  314. // Preset management methods.
  315. @@ -383,56 +539,7 @@ bool qjackctlSetup::loadPreset ( qjackctlPreset& preset, const QString& sPreset
  316. return false;
  317. }
  318. - m_settings.beginGroup("/Settings" + sSuffix);
  319. -#if defined(__WIN32__) || defined(_WIN32) || defined(WIN32)
  320. - preset.sServerPrefix = m_settings.value("/Server", "jackd -S -X winmme").toString();
  321. -#else
  322. - preset.sServerPrefix = m_settings.value("/Server", "jackd").toString();
  323. -#endif
  324. - preset.sServerName = m_settings.value("/ServerName").toString();
  325. - preset.bRealtime = m_settings.value("/Realtime", true).toBool();
  326. - preset.bSoftMode = m_settings.value("/SoftMode", false).toBool();
  327. - preset.bMonitor = m_settings.value("/Monitor", false).toBool();
  328. - preset.bShorts = m_settings.value("/Shorts", false).toBool();
  329. - preset.bNoMemLock = m_settings.value("/NoMemLock", false).toBool();
  330. - preset.bUnlockMem = m_settings.value("/UnlockMem", false).toBool();
  331. - preset.bHWMeter = m_settings.value("/HWMeter", false).toBool();
  332. - preset.bIgnoreHW = m_settings.value("/IgnoreHW", false).toBool();
  333. - preset.iPriority = m_settings.value("/Priority", 0).toInt();
  334. - preset.iFrames = m_settings.value("/Frames", 1024).toInt();
  335. - preset.iSampleRate = m_settings.value("/SampleRate", 48000).toInt();
  336. - preset.iPeriods = m_settings.value("/Periods", 2).toInt();
  337. - preset.iWordLength = m_settings.value("/WordLength", 16).toInt();
  338. - preset.iWait = m_settings.value("/Wait", 21333).toInt();
  339. - preset.iChan = m_settings.value("/Chan", 0).toInt();
  340. - preset.sDriver = m_settings.value("/Driver", DEFAULT_DRIVER).toString();
  341. - preset.sInterface = m_settings.value("/Interface").toString();
  342. - preset.iAudio = m_settings.value("/Audio", 0).toInt();
  343. - preset.iDither = m_settings.value("/Dither", 0).toInt();
  344. - preset.iTimeout = m_settings.value("/Timeout", 500).toInt();
  345. - preset.sInDevice = m_settings.value("/InDevice").toString();
  346. - preset.sOutDevice = m_settings.value("/OutDevice").toString();
  347. - preset.iInChannels = m_settings.value("/InChannels", 0).toInt();
  348. - preset.iOutChannels = m_settings.value("/OutChannels", 0).toInt();
  349. - preset.iInLatency = m_settings.value("/InLatency", 0).toInt();
  350. - preset.iOutLatency = m_settings.value("/OutLatency", 0).toInt();
  351. - preset.iStartDelay = m_settings.value("/StartDelay", 2).toInt();
  352. - preset.bSync = m_settings.value("/Sync", false).toBool();
  353. - preset.bVerbose = m_settings.value("/Verbose", false).toBool();
  354. - preset.iPortMax = m_settings.value("/PortMax", 256).toInt();
  355. - preset.sMidiDriver = m_settings.value("/MidiDriver").toString();
  356. - preset.sServerSuffix = m_settings.value("/ServerSuffix").toString();
  357. - preset.uClockSource = m_settings.value("/ClockSource", 0).toUInt();
  358. - preset.ucSelfConnectMode = m_settings.value("/SelfConnectMode", ' ').value<uchar>();
  359. - m_settings.endGroup();
  360. -
  361. -#ifdef CONFIG_JACK_MIDI
  362. - if (!preset.sMidiDriver.isEmpty() &&
  363. - preset.sMidiDriver != "raw" &&
  364. - preset.sMidiDriver != "seq")
  365. - preset.sMidiDriver.clear();
  366. -#endif
  367. -
  368. + preset.load(m_settings, sSuffix);
  369. return true;
  370. }
  371. @@ -446,45 +553,7 @@ bool qjackctlSetup::savePreset ( qjackctlPreset& preset, const QString& sPreset
  372. presets.prepend(sPreset);
  373. }
  374. - m_settings.beginGroup("/Settings" + sSuffix);
  375. - m_settings.setValue("/Server", preset.sServerPrefix);
  376. - m_settings.setValue("/ServerName", preset.sServerName);
  377. - m_settings.setValue("/Realtime", preset.bRealtime);
  378. - m_settings.setValue("/SoftMode", preset.bSoftMode);
  379. - m_settings.setValue("/Monitor", preset.bMonitor);
  380. - m_settings.setValue("/Shorts", preset.bShorts);
  381. - m_settings.setValue("/NoMemLock", preset.bNoMemLock);
  382. - m_settings.setValue("/UnlockMem", preset.bUnlockMem);
  383. - m_settings.setValue("/HWMeter", preset.bHWMeter);
  384. - m_settings.setValue("/IgnoreHW", preset.bIgnoreHW);
  385. - m_settings.setValue("/Priority", preset.iPriority);
  386. - m_settings.setValue("/Frames", preset.iFrames);
  387. - m_settings.setValue("/SampleRate", preset.iSampleRate);
  388. - m_settings.setValue("/Periods", preset.iPeriods);
  389. - m_settings.setValue("/WordLength", preset.iWordLength);
  390. - m_settings.setValue("/Wait", preset.iWait);
  391. - m_settings.setValue("/Chan", preset.iChan);
  392. - m_settings.setValue("/Driver", preset.sDriver);
  393. - m_settings.setValue("/Interface", preset.sInterface);
  394. - m_settings.setValue("/Audio", preset.iAudio);
  395. - m_settings.setValue("/Dither", preset.iDither);
  396. - m_settings.setValue("/Timeout", preset.iTimeout);
  397. - m_settings.setValue("/InDevice", preset.sInDevice);
  398. - m_settings.setValue("/OutDevice", preset.sOutDevice);
  399. - m_settings.setValue("/InChannels", preset.iInChannels);
  400. - m_settings.setValue("/OutChannels", preset.iOutChannels);
  401. - m_settings.setValue("/InLatency", preset.iInLatency);
  402. - m_settings.setValue("/OutLatency", preset.iOutLatency);
  403. - m_settings.setValue("/StartDelay", preset.iStartDelay);
  404. - m_settings.setValue("/Sync", preset.bSync);
  405. - m_settings.setValue("/Verbose", preset.bVerbose);
  406. - m_settings.setValue("/PortMax", preset.iPortMax);
  407. - m_settings.setValue("/MidiDriver", preset.sMidiDriver);
  408. - m_settings.setValue("/ServerSuffix", preset.sServerSuffix);
  409. - m_settings.setValue("/ClockSource", preset.uClockSource);
  410. - m_settings.setValue("/SelfConnectMode", preset.ucSelfConnectMode);
  411. - m_settings.endGroup();
  412. -
  413. + preset.save(m_settings, sSuffix);
  414. return true;
  415. }
  416. @@ -493,13 +562,15 @@ bool qjackctlSetup::deletePreset ( const QString& sPreset )
  417. QString sSuffix;
  418. if (sPreset != sDefPresetName && !sPreset.isEmpty()) {
  419. sSuffix = '/' + sPreset;
  420. - int iPreset = presets.indexOf(sPreset);
  421. + const int iPreset = presets.indexOf(sPreset);
  422. if (iPreset < 0)
  423. return false;
  424. presets.removeAt(iPreset);
  425. - m_settings.remove("/Settings" + sSuffix);
  426. - m_settings.remove("/Aliases" + sSuffix);
  427. }
  428. +
  429. + m_settings.remove("/Settings" + sSuffix);
  430. + m_settings.remove("/Aliases" + sSuffix);
  431. +
  432. return true;
  433. }
  434. diff --git a/src/qjackctlSetup.h b/src/qjackctlSetup.h
  435. index 18ca99e9..e03f60d9 100644
  436. --- a/src/qjackctlSetup.h
  437. +++ b/src/qjackctlSetup.h
  438. @@ -47,6 +47,13 @@ class QSplitter;
  439. // Server settings preset struct.
  440. struct qjackctlPreset
  441. {
  442. + qjackctlPreset() { clear(); }
  443. +
  444. + void clear();
  445. + void load(QSettings& settings, const QString& sSuffix);
  446. + void save(QSettings& settings, const QString& sSuffix);
  447. + void fixup();
  448. +
  449. QString sServerPrefix;
  450. QString sServerName;
  451. bool bRealtime;
  452. diff --git a/src/qjackctlSetupForm.cpp b/src/qjackctlSetupForm.cpp
  453. index ee64fa3b..4b934fab 100644
  454. --- a/src/qjackctlSetupForm.cpp
  455. +++ b/src/qjackctlSetupForm.cpp
  456. @@ -95,8 +95,9 @@ qjackctlSetupForm::qjackctlSetupForm ( QWidget *pParent )
  457. m_pTimeDisplayButtonGroup->setExclusive(true);
  458. // Setup clock-source combo-box.
  459. + const QString& sDefName = tr(g_pszDefName);
  460. m_ui.ClockSourceComboBox->clear();
  461. - m_ui.ClockSourceComboBox->addItem(g_pszDefName, uint(0));
  462. + m_ui.ClockSourceComboBox->addItem(sDefName, uint(0));
  463. m_ui.ClockSourceComboBox->addItem(tr("System"), uint('s'));
  464. m_ui.ClockSourceComboBox->addItem(tr("Cycle"), uint('c'));
  465. m_ui.ClockSourceComboBox->addItem(tr("HPET"), uint('h'));
  466. @@ -157,11 +158,28 @@ qjackctlSetupForm::qjackctlSetupForm ( QWidget *pParent )
  467. m_ui.ServerPrefixComboBox->setCompleter(nullptr);
  468. m_ui.ServerSuffixComboBox->setCompleter(nullptr);
  469. + m_ui.PrioritySpinBox->setSpecialValueText(sDefName);
  470. + m_ui.SampleRateComboBox->insertItem(0, sDefName);
  471. + m_ui.FramesComboBox->insertItem(0, sDefName);
  472. + m_ui.PeriodsSpinBox->setSpecialValueText(sDefName);
  473. + m_ui.PortMaxComboBox->insertItem(0, sDefName);
  474. + m_ui.TimeoutComboBox->insertItem(0, sDefName);
  475. + m_ui.WaitComboBox->insertItem(0, sDefName);
  476. + m_ui.WordLengthComboBox->insertItem(0, sDefName);
  477. + m_ui.ChanSpinBox->setSpecialValueText(sDefName);
  478. + m_ui.InChannelsSpinBox->setSpecialValueText(sDefName);
  479. + m_ui.OutChannelsSpinBox->setSpecialValueText(sDefName);
  480. + m_ui.InLatencySpinBox->setSpecialValueText(sDefName);
  481. + m_ui.OutLatencySpinBox->setSpecialValueText(sDefName);
  482. +
  483. // UI connections...
  484. QObject::connect(m_ui.PresetComboBox,
  485. SIGNAL(editTextChanged(const QString&)),
  486. SLOT(changeCurrentPreset(const QString&)));
  487. + QObject::connect(m_ui.PresetClearPushButton,
  488. + SIGNAL(clicked()),
  489. + SLOT(clearCurrentPreset()));
  490. QObject::connect(m_ui.PresetSavePushButton,
  491. SIGNAL(clicked()),
  492. SLOT(saveCurrentPreset()));
  493. @@ -766,15 +784,24 @@ void qjackctlSetupForm::setCurrentPreset ( const qjackctlPreset& preset )
  494. m_ui.HWMeterCheckBox->setChecked(preset.bHWMeter);
  495. m_ui.IgnoreHWCheckBox->setChecked(preset.bIgnoreHW);
  496. m_ui.PrioritySpinBox->setValue(preset.iPriority);
  497. + const QString& sDefName = tr(g_pszDefName);
  498. setComboBoxCurrentText(m_ui.FramesComboBox,
  499. - QString::number(preset.iFrames));
  500. + preset.iFrames > 0
  501. + ? QString::number(preset.iFrames)
  502. + : sDefName);
  503. setComboBoxCurrentText(m_ui.SampleRateComboBox,
  504. - QString::number(preset.iSampleRate));
  505. + preset.iSampleRate > 0
  506. + ? QString::number(preset.iSampleRate)
  507. + : sDefName);
  508. m_ui.PeriodsSpinBox->setValue(preset.iPeriods);
  509. setComboBoxCurrentText(m_ui.WordLengthComboBox,
  510. - QString::number(preset.iWordLength));
  511. + preset.iWordLength > 0 && preset.iWordLength != 16
  512. + ? QString::number(preset.iWordLength)
  513. + : sDefName);
  514. setComboBoxCurrentText(m_ui.WaitComboBox,
  515. - QString::number(preset.iWait));
  516. + preset.iWait > 0 && preset.iWait != 21333
  517. + ? QString::number(preset.iWait)
  518. + : sDefName);
  519. m_ui.ChanSpinBox->setValue(preset.iChan);
  520. setComboBoxCurrentText(m_ui.DriverComboBox, preset.sDriver);
  521. setComboBoxCurrentText(m_ui.InterfaceComboBox,
  522. @@ -784,7 +811,9 @@ void qjackctlSetupForm::setCurrentPreset ( const qjackctlPreset& preset )
  523. m_ui.AudioComboBox->setCurrentIndex(preset.iAudio);
  524. m_ui.DitherComboBox->setCurrentIndex(preset.iDither);
  525. setComboBoxCurrentText(m_ui.TimeoutComboBox,
  526. - QString::number(preset.iTimeout));
  527. + preset.iTimeout > 0 && preset.iTimeout != 500
  528. + ? QString::number(preset.iTimeout)
  529. + : sDefName);
  530. setComboBoxCurrentData(m_ui.ClockSourceComboBox,
  531. uint(preset.uClockSource));
  532. setComboBoxCurrentText(m_ui.InDeviceComboBox,
  533. @@ -805,7 +834,9 @@ void qjackctlSetupForm::setCurrentPreset ( const qjackctlPreset& preset )
  534. QVariant::fromValue<uchar> (preset.ucSelfConnectMode));
  535. m_ui.VerboseCheckBox->setChecked(preset.bVerbose);
  536. setComboBoxCurrentText(m_ui.PortMaxComboBox,
  537. - QString::number(preset.iPortMax));
  538. + preset.iPortMax > 0 && preset.iPortMax != 256
  539. + ? QString::number(preset.iPortMax)
  540. + : sDefName);
  541. #ifdef CONFIG_JACK_MIDI
  542. setComboBoxCurrentText(m_ui.MidiDriverComboBox,
  543. preset.sMidiDriver);
  544. @@ -995,6 +1026,16 @@ void qjackctlSetupForm::changeCurrentPreset ( const QString& sPreset )
  545. optionsChanged();
  546. }
  547. +
  548. +void qjackctlSetupForm::clearCurrentPreset (void)
  549. +{
  550. + // Clear current settings...
  551. + qjackctlPreset preset;
  552. + setCurrentPreset(preset);
  553. + settingsChanged();
  554. +}
  555. +
  556. +
  557. void qjackctlSetupForm::saveCurrentPreset (void)
  558. {
  559. const QString sPreset = m_ui.PresetComboBox->currentText();
  560. diff --git a/src/qjackctlSetupForm.h b/src/qjackctlSetupForm.h
  561. index 97e1a32f..cbd70dff 100644
  562. --- a/src/qjackctlSetupForm.h
  563. +++ b/src/qjackctlSetupForm.h
  564. @@ -54,6 +54,7 @@ class qjackctlSetupForm : public QDialog
  565. protected slots:
  566. void changeCurrentPreset(const QString&);
  567. + void clearCurrentPreset();
  568. void saveCurrentPreset();
  569. void deleteCurrentPreset();
  570. diff --git a/src/qjackctlSetupForm.ui b/src/qjackctlSetupForm.ui
  571. index e78624b7..bb064f7d 100644
  572. --- a/src/qjackctlSetupForm.ui
  573. +++ b/src/qjackctlSetupForm.ui
  574. @@ -95,6 +95,22 @@
  575. </item>
  576. </widget>
  577. </item>
  578. + <item>
  579. + <widget class="QPushButton" name="PresetClearPushButton">
  580. + <property name="toolTip">
  581. + <string>Clear settings of current preset name</string>
  582. + </property>
  583. + <property name="text">
  584. + <string>Clea&amp;r</string>
  585. + </property>
  586. + <property name="icon">
  587. + <iconset resource="qjackctl.qrc">:/images/clear1.png</iconset>
  588. + </property>
  589. + <property name="autoDefault">
  590. + <bool>false</bool>
  591. + </property>
  592. + </widget>
  593. + </item>
  594. <item>
  595. <widget class="QPushButton" name="PresetSavePushButton">
  596. <property name="toolTip">
  597. @@ -597,11 +613,14 @@
  598. <string>Number of periods in the hardware buffer</string>
  599. </property>
  600. <property name="minimum">
  601. - <number>2</number>
  602. + <number>1</number>
  603. </property>
  604. <property name="maximum">
  605. <number>999</number>
  606. </property>
  607. + <property name="value">
  608. + <number>1</number>
  609. + </property>
  610. </widget>
  611. </item>
  612. </layout>
  613. @@ -1064,9 +1083,6 @@
  614. <property name="toolTip">
  615. <string>Scheduler priority when running realtime</string>
  616. </property>
  617. - <property name="specialValueText">
  618. - <string>(default)</string>
  619. - </property>
  620. <property name="singleStep">
  621. <number>1</number>
  622. </property>
  623. @@ -1074,7 +1090,7 @@
  624. <number>5</number>
  625. </property>
  626. <property name="maximum">
  627. - <number>99</number>
  628. + <number>95</number>
  629. </property>
  630. </widget>
  631. </item>
  632. @@ -1108,9 +1124,6 @@
  633. <bold>false</bold>
  634. </font>
  635. </property>
  636. - <property name="acceptDrops">
  637. - <bool>false</bool>
  638. - </property>
  639. <property name="toolTip">
  640. <string>Word length</string>
  641. </property>
  642. @@ -1165,9 +1178,6 @@
  643. <bold>false</bold>
  644. </font>
  645. </property>
  646. - <property name="acceptDrops">
  647. - <bool>false</bool>
  648. - </property>
  649. <property name="toolTip">
  650. <string>Number of microseconds to wait between engine processes (dummy)</string>
  651. </property>
  652. @@ -1217,9 +1227,6 @@
  653. <property name="toolTip">
  654. <string>Maximum number of audio channels to allocate</string>
  655. </property>
  656. - <property name="specialValueText">
  657. - <string>(default)</string>
  658. - </property>
  659. <property name="maximum">
  660. <number>999</number>
  661. </property>
  662. @@ -1268,7 +1275,7 @@
  663. <bool>true</bool>
  664. </property>
  665. <property name="currentIndex">
  666. - <number>1</number>
  667. + <number>0</number>
  668. </property>
  669. <item>
  670. <property name="text">
  671. @@ -1330,7 +1337,7 @@
  672. <bool>true</bool>
  673. </property>
  674. <property name="currentIndex">
  675. - <number>1</number>
  676. + <number>0</number>
  677. </property>
  678. <item>
  679. <property name="text">
  680. @@ -1357,11 +1364,6 @@
  681. <string>5000</string>
  682. </property>
  683. </item>
  684. - <item>
  685. - <property name="text">
  686. - <string>10000</string>
  687. - </property>
  688. - </item>
  689. </widget>
  690. </item>
  691. <item row="6" column="0">
  692. @@ -1710,9 +1712,6 @@
  693. <property name="toolTip">
  694. <string>Maximum input audio hardware channels to allocate</string>
  695. </property>
  696. - <property name="specialValueText">
  697. - <string>(default)</string>
  698. - </property>
  699. <property name="maximum">
  700. <number>999</number>
  701. </property>
  702. @@ -1741,9 +1740,6 @@
  703. <property name="toolTip">
  704. <string>Maximum output audio hardware channels to allocate</string>
  705. </property>
  706. - <property name="specialValueText">
  707. - <string>(default)</string>
  708. - </property>
  709. <property name="maximum">
  710. <number>999</number>
  711. </property>
  712. @@ -1794,9 +1790,6 @@
  713. <property name="toolTip">
  714. <string>External input latency (frames)</string>
  715. </property>
  716. - <property name="specialValueText">
  717. - <string>(default)</string>
  718. - </property>
  719. <property name="maximum">
  720. <number>9999999</number>
  721. </property>
  722. @@ -1825,9 +1818,6 @@
  723. <property name="toolTip">
  724. <string>External output latency (frames)</string>
  725. </property>
  726. - <property name="specialValueText">
  727. - <string>(default)</string>
  728. - </property>
  729. <property name="maximum">
  730. <number>9999999</number>
  731. </property>
  732. @@ -4209,6 +4199,7 @@
  733. <tabstops>
  734. <tabstop>SetupTabWidget</tabstop>
  735. <tabstop>PresetComboBox</tabstop>
  736. + <tabstop>PresetClearPushButton</tabstop>
  737. <tabstop>PresetSavePushButton</tabstop>
  738. <tabstop>PresetDeletePushButton</tabstop>
  739. <tabstop>SettingsTabWidget</tabstop>