33 |
#endif |
#endif |
34 |
|
|
35 |
|
|
36 |
|
namespace QSampler { |
37 |
|
|
38 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
39 |
// qsamplerOptions - Prototype settings structure. |
// QSampler::Options - Prototype settings structure. |
40 |
// |
// |
41 |
|
|
42 |
// Constructor. |
// Constructor. |
43 |
qsamplerOptions::qsamplerOptions (void) |
Options::Options (void) |
44 |
: m_settings(QSAMPLER_DOMAIN, QSAMPLER_TITLE) |
: m_settings(QSAMPLER_DOMAIN, QSAMPLER_TITLE) |
45 |
{ |
{ |
46 |
// Begin into general options group. |
// Begin into general options group. |
50 |
m_settings.beginGroup("/Server"); |
m_settings.beginGroup("/Server"); |
51 |
sServerHost = m_settings.value("/ServerHost", "localhost").toString(); |
sServerHost = m_settings.value("/ServerHost", "localhost").toString(); |
52 |
iServerPort = m_settings.value("/ServerPort", 8888).toInt(); |
iServerPort = m_settings.value("/ServerPort", 8888).toInt(); |
53 |
|
#if defined(__APPLE__) // Toshi Nagata 20080105 |
54 |
|
// TODO: Should this be a configure option? |
55 |
|
iServerTimeout = m_settings.value("/ServerTimeout", 10000).toInt(); |
56 |
|
#else |
57 |
iServerTimeout = m_settings.value("/ServerTimeout", 1000).toInt(); |
iServerTimeout = m_settings.value("/ServerTimeout", 1000).toInt(); |
58 |
|
#endif |
59 |
bServerStart = m_settings.value("/ServerStart", true).toBool(); |
bServerStart = m_settings.value("/ServerStart", true).toBool(); |
60 |
|
#if defined(__APPLE__) // Toshi Nagata 20080113 |
61 |
|
sServerCmdLine = m_settings.value("/ServerCmdLine", "linuxsampler.starter").toString(); |
62 |
|
#else |
63 |
sServerCmdLine = m_settings.value("/ServerCmdLine", "linuxsampler").toString(); |
sServerCmdLine = m_settings.value("/ServerCmdLine", "linuxsampler").toString(); |
64 |
|
#endif |
65 |
iStartDelay = m_settings.value("/StartDelay", 3).toInt(); |
iStartDelay = m_settings.value("/StartDelay", 3).toInt(); |
66 |
m_settings.endGroup(); |
m_settings.endGroup(); |
67 |
|
|
80 |
bStdoutCapture = m_settings.value("/StdoutCapture", true).toBool(); |
bStdoutCapture = m_settings.value("/StdoutCapture", true).toBool(); |
81 |
bCompletePath = m_settings.value("/CompletePath", true).toBool(); |
bCompletePath = m_settings.value("/CompletePath", true).toBool(); |
82 |
iMaxRecentFiles = m_settings.value("/MaxRecentFiles", 5).toInt(); |
iMaxRecentFiles = m_settings.value("/MaxRecentFiles", 5).toInt(); |
83 |
|
// if libgig provides a fast way to retrieve instrument names even for large |
84 |
|
// .gig files, then we enable this feature by default |
85 |
|
#if HAVE_LIBGIG_SETAUTOLOAD |
86 |
|
bInstrumentNames = m_settings.value("/InstrumentNames", true).toBool(); |
87 |
|
#else |
88 |
bInstrumentNames = m_settings.value("/InstrumentNames", false).toBool(); |
bInstrumentNames = m_settings.value("/InstrumentNames", false).toBool(); |
89 |
|
#endif |
90 |
m_settings.endGroup(); |
m_settings.endGroup(); |
91 |
|
|
92 |
// And go into view options group. |
// And go into view options group. |
127 |
|
|
128 |
|
|
129 |
// Default Destructor. |
// Default Destructor. |
130 |
qsamplerOptions::~qsamplerOptions (void) |
Options::~Options (void) |
131 |
{ |
{ |
132 |
// Make program version available in the future. |
// Make program version available in the future. |
133 |
m_settings.beginGroup("/Program"); |
m_settings.beginGroup("/Program"); |
202 |
// Settings accessor. |
// Settings accessor. |
203 |
// |
// |
204 |
|
|
205 |
QSettings& qsamplerOptions::settings (void) |
QSettings& Options::settings (void) |
206 |
{ |
{ |
207 |
return m_settings; |
return m_settings; |
208 |
} |
} |
213 |
// |
// |
214 |
|
|
215 |
// Help about command line options. |
// Help about command line options. |
216 |
void qsamplerOptions::print_usage ( const char *arg0 ) |
void Options::print_usage ( const char *arg0 ) |
217 |
{ |
{ |
218 |
QTextStream out(stderr); |
QTextStream out(stderr); |
219 |
out << QObject::tr("Usage: %1 [options] [session-file]\n\n" |
out << QObject::tr("Usage: %1 [options] [session-file]\n\n" |
229 |
|
|
230 |
|
|
231 |
// Parse command line arguments into m_settings. |
// Parse command line arguments into m_settings. |
232 |
bool qsamplerOptions::parse_args ( int argc, char **argv ) |
bool Options::parse_args ( int argc, char **argv ) |
233 |
{ |
{ |
234 |
QTextStream out(stderr); |
QTextStream out(stderr); |
235 |
const QString sEol = "\n\n"; |
const QString sEol = "\n\n"; |
308 |
//--------------------------------------------------------------------------- |
//--------------------------------------------------------------------------- |
309 |
// Widget geometry persistence helper methods. |
// Widget geometry persistence helper methods. |
310 |
|
|
311 |
void qsamplerOptions::loadWidgetGeometry ( QWidget *pWidget ) |
void Options::loadWidgetGeometry ( QWidget *pWidget ) |
312 |
{ |
{ |
313 |
// Try to restore old form window positioning. |
// Try to restore old form window positioning. |
314 |
if (pWidget) { |
if (pWidget) { |
336 |
} |
} |
337 |
|
|
338 |
|
|
339 |
void qsamplerOptions::saveWidgetGeometry ( QWidget *pWidget ) |
void Options::saveWidgetGeometry ( QWidget *pWidget ) |
340 |
{ |
{ |
341 |
// Try to save form window position... |
// Try to save form window position... |
342 |
// (due to X11 window managers ideossincrasies, we better |
// (due to X11 window managers ideossincrasies, we better |
359 |
//--------------------------------------------------------------------------- |
//--------------------------------------------------------------------------- |
360 |
// Combo box history persistence helper implementation. |
// Combo box history persistence helper implementation. |
361 |
|
|
362 |
void qsamplerOptions::loadComboBoxHistory ( QComboBox *pComboBox, int iLimit ) |
void Options::loadComboBoxHistory ( QComboBox *pComboBox, int iLimit ) |
363 |
{ |
{ |
364 |
// Load combobox list from configuration settings file... |
// Load combobox list from configuration settings file... |
365 |
m_settings.beginGroup("/History/" + pComboBox->objectName()); |
m_settings.beginGroup("/History/" + pComboBox->objectName()); |
382 |
} |
} |
383 |
|
|
384 |
|
|
385 |
void qsamplerOptions::saveComboBoxHistory ( QComboBox *pComboBox, int iLimit ) |
void Options::saveComboBoxHistory ( QComboBox *pComboBox, int iLimit ) |
386 |
{ |
{ |
387 |
// Add current text as latest item... |
// Add current text as latest item... |
388 |
const QString& sCurrentText = pComboBox->currentText(); |
const QString& sCurrentText = pComboBox->currentText(); |
411 |
m_settings.endGroup(); |
m_settings.endGroup(); |
412 |
} |
} |
413 |
|
|
414 |
|
} // namespace QSampler |
415 |
|
|
416 |
|
|
417 |
// end of qsamplerOptions.cpp |
// end of qsamplerOptions.cpp |