1 |
// qsamplerOptions.cpp |
// qsamplerOptions.cpp |
2 |
// |
// |
3 |
/**************************************************************************** |
/**************************************************************************** |
4 |
Copyright (C) 2004-2014, rncbc aka Rui Nuno Capela. All rights reserved. |
Copyright (C) 2004-2015, rncbc aka Rui Nuno Capela. All rights reserved. |
5 |
Copyright (C) 2007, Christian Schoenebeck |
Copyright (C) 2007,2015 Christian Schoenebeck |
6 |
|
|
7 |
This program is free software; you can redistribute it and/or |
This program is free software; you can redistribute it and/or |
8 |
modify it under the terms of the GNU General Public License |
modify it under the terms of the GNU General Public License |
97 |
bMessagesLimit = m_settings.value("/MessagesLimit", true).toBool(); |
bMessagesLimit = m_settings.value("/MessagesLimit", true).toBool(); |
98 |
iMessagesLimitLines = m_settings.value("/MessagesLimitLines", 1000).toInt(); |
iMessagesLimitLines = m_settings.value("/MessagesLimitLines", 1000).toInt(); |
99 |
bConfirmRemove = m_settings.value("/ConfirmRemove", true).toBool(); |
bConfirmRemove = m_settings.value("/ConfirmRemove", true).toBool(); |
100 |
|
bConfirmReset = m_settings.value("/ConfirmReset", true).toBool(); |
101 |
|
bConfirmRestart = m_settings.value("/ConfirmRestart", true).toBool(); |
102 |
|
bConfirmError = m_settings.value("/ConfirmError", true).toBool(); |
103 |
bKeepOnTop = m_settings.value("/KeepOnTop", true).toBool(); |
bKeepOnTop = m_settings.value("/KeepOnTop", true).toBool(); |
104 |
bStdoutCapture = m_settings.value("/StdoutCapture", true).toBool(); |
bStdoutCapture = m_settings.value("/StdoutCapture", true).toBool(); |
105 |
bCompletePath = m_settings.value("/CompletePath", true).toBool(); |
bCompletePath = m_settings.value("/CompletePath", true).toBool(); |
195 |
m_settings.setValue("/MessagesLimit", bMessagesLimit); |
m_settings.setValue("/MessagesLimit", bMessagesLimit); |
196 |
m_settings.setValue("/MessagesLimitLines", iMessagesLimitLines); |
m_settings.setValue("/MessagesLimitLines", iMessagesLimitLines); |
197 |
m_settings.setValue("/ConfirmRemove", bConfirmRemove); |
m_settings.setValue("/ConfirmRemove", bConfirmRemove); |
198 |
|
m_settings.setValue("/ConfirmReset", bConfirmReset); |
199 |
|
m_settings.setValue("/ConfirmRestart", bConfirmRestart); |
200 |
|
m_settings.setValue("/ConfirmError", bConfirmError); |
201 |
m_settings.setValue("/KeepOnTop", bKeepOnTop); |
m_settings.setValue("/KeepOnTop", bKeepOnTop); |
202 |
m_settings.setValue("/StdoutCapture", bStdoutCapture); |
m_settings.setValue("/StdoutCapture", bStdoutCapture); |
203 |
m_settings.setValue("/CompletePath", bCompletePath); |
m_settings.setValue("/CompletePath", bCompletePath); |
417 |
|
|
418 |
void Options::loadComboBoxHistory ( QComboBox *pComboBox, int iLimit ) |
void Options::loadComboBoxHistory ( QComboBox *pComboBox, int iLimit ) |
419 |
{ |
{ |
420 |
|
const bool bBlockSignals = pComboBox->blockSignals(true); |
421 |
|
|
422 |
// Load combobox list from configuration settings file... |
// Load combobox list from configuration settings file... |
423 |
m_settings.beginGroup("/History/" + pComboBox->objectName()); |
m_settings.beginGroup("/History/" + pComboBox->objectName()); |
424 |
|
|
426 |
pComboBox->setUpdatesEnabled(false); |
pComboBox->setUpdatesEnabled(false); |
427 |
pComboBox->setDuplicatesEnabled(false); |
pComboBox->setDuplicatesEnabled(false); |
428 |
pComboBox->clear(); |
pComboBox->clear(); |
429 |
for (int i = 0; i < iLimit; i++) { |
for (int i = 0; i < iLimit; ++i) { |
430 |
const QString& sText = m_settings.value( |
const QString& sText = m_settings.value( |
431 |
"/Item" + QString::number(i + 1)).toString(); |
"/Item" + QString::number(i + 1)).toString(); |
432 |
if (sText.isEmpty()) |
if (sText.isEmpty()) |
437 |
} |
} |
438 |
|
|
439 |
m_settings.endGroup(); |
m_settings.endGroup(); |
440 |
|
|
441 |
|
pComboBox->blockSignals(bBlockSignals); |
442 |
} |
} |
443 |
|
|
444 |
|
|
445 |
void Options::saveComboBoxHistory ( QComboBox *pComboBox, int iLimit ) |
void Options::saveComboBoxHistory ( QComboBox *pComboBox, int iLimit ) |
446 |
{ |
{ |
447 |
|
const bool bBlockSignals = pComboBox->blockSignals(true); |
448 |
|
|
449 |
// Add current text as latest item... |
// Add current text as latest item... |
450 |
const QString& sCurrentText = pComboBox->currentText(); |
const QString sCurrentText = pComboBox->currentText(); |
451 |
int iCount = pComboBox->count(); |
int iCount = pComboBox->count(); |
452 |
for (int i = 0; i < iCount; i++) { |
for (int i = 0; i < iCount; i++) { |
453 |
const QString& sText = pComboBox->itemText(i); |
const QString& sText = pComboBox->itemText(i); |
454 |
if (sText == sCurrentText) { |
if (sText == sCurrentText) { |
455 |
pComboBox->removeItem(i); |
pComboBox->removeItem(i); |
456 |
iCount--; |
--iCount; |
457 |
break; |
break; |
458 |
} |
} |
459 |
} |
} |
460 |
while (iCount >= iLimit) |
while (iCount >= iLimit) |
461 |
pComboBox->removeItem(--iCount); |
pComboBox->removeItem(--iCount); |
462 |
pComboBox->insertItem(0, sCurrentText); |
pComboBox->insertItem(0, sCurrentText); |
463 |
iCount++; |
pComboBox->setCurrentIndex(0); |
464 |
|
++iCount; |
465 |
|
|
466 |
// Save combobox list to configuration settings file... |
// Save combobox list to configuration settings file... |
467 |
m_settings.beginGroup("/History/" + pComboBox->objectName()); |
m_settings.beginGroup("/History/" + pComboBox->objectName()); |
468 |
for (int i = 0; i < iCount; i++) { |
for (int i = 0; i < iCount; ++i) { |
469 |
const QString& sText = pComboBox->itemText(i); |
const QString& sText = pComboBox->itemText(i); |
470 |
if (sText.isEmpty()) |
if (sText.isEmpty()) |
471 |
break; |
break; |
472 |
m_settings.setValue("/Item" + QString::number(i + 1), sText); |
m_settings.setValue("/Item" + QString::number(i + 1), sText); |
473 |
} |
} |
474 |
m_settings.endGroup(); |
m_settings.endGroup(); |
475 |
|
|
476 |
|
pComboBox->blockSignals(bBlockSignals); |
477 |
} |
} |
478 |
|
|
479 |
|
|
480 |
int Options::getMaxVoices() { |
int Options::getMaxVoices() { |
481 |
#ifndef CONFIG_MAX_VOICES |
#ifndef CONFIG_MAX_VOICES |
482 |
return -1; |
return -1; |