/[svn]/qsampler/trunk/src/qsamplerOptions.cpp
ViewVC logotype

Diff of /qsampler/trunk/src/qsamplerOptions.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1527 by schoenebeck, Mon Nov 26 16:00:21 2007 UTC revision 1749 by capela, Wed Jul 2 13:19:09 2008 UTC
# Line 1  Line 1 
1  // qsamplerOptions.cpp  // qsamplerOptions.cpp
2  //  //
3  /****************************************************************************  /****************************************************************************
4     Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved.     Copyright (C) 2004-2008, rncbc aka Rui Nuno Capela. All rights reserved.
5     Copyright (C) 2007, Christian Schoenebeck     Copyright (C) 2007, 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
# Line 33  Line 33 
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.
# Line 48  qsamplerOptions::qsamplerOptions (void) Line 50  qsamplerOptions::qsamplerOptions (void)
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    
68            // Load logging options...
69            m_settings.beginGroup("/Logging");
70            bMessagesLog     = m_settings.value("/MessagesLog", false).toBool();
71            sMessagesLogPath = m_settings.value("/MessagesLogPath", "qsampler.log").toString();
72            m_settings.endGroup();
73    
74          // Load display options...          // Load display options...
75          m_settings.beginGroup("/Display");          m_settings.beginGroup("/Display");
76          sDisplayFont     = m_settings.value("/DisplayFont").toString();          sDisplayFont     = m_settings.value("/DisplayFont").toString();
# Line 69  qsamplerOptions::qsamplerOptions (void) Line 86  qsamplerOptions::qsamplerOptions (void)
86          bStdoutCapture   = m_settings.value("/StdoutCapture", true).toBool();          bStdoutCapture   = m_settings.value("/StdoutCapture", true).toBool();
87          bCompletePath    = m_settings.value("/CompletePath", true).toBool();          bCompletePath    = m_settings.value("/CompletePath", true).toBool();
88          iMaxRecentFiles  = m_settings.value("/MaxRecentFiles", 5).toInt();          iMaxRecentFiles  = m_settings.value("/MaxRecentFiles", 5).toInt();
89            iBaseFontSize    = m_settings.value("/BaseFontSize", 0).toInt();
90  // if libgig provides a fast way to retrieve instrument names even for large  // if libgig provides a fast way to retrieve instrument names even for large
91  // .gig files, then we enable this feature by default  // .gig files, then we enable this feature by default
92  #if HAVE_LIBGIG_SETAUTOLOAD  #if HAVE_LIBGIG_SETAUTOLOAD
# Line 116  qsamplerOptions::qsamplerOptions (void) Line 134  qsamplerOptions::qsamplerOptions (void)
134    
135    
136  // Default Destructor.  // Default Destructor.
137  qsamplerOptions::~qsamplerOptions (void)  Options::~Options (void)
138  {  {
139          // Make program version available in the future.          // Make program version available in the future.
140          m_settings.beginGroup("/Program");          m_settings.beginGroup("/Program");
# Line 136  qsamplerOptions::~qsamplerOptions (void) Line 154  qsamplerOptions::~qsamplerOptions (void)
154          m_settings.setValue("/StartDelay", iStartDelay);          m_settings.setValue("/StartDelay", iStartDelay);
155          m_settings.endGroup();          m_settings.endGroup();
156    
157            // Save logging options...
158            m_settings.beginGroup("/Logging");
159            m_settings.setValue("/MessagesLog", bMessagesLog);
160            m_settings.setValue("/MessagesLogPath", sMessagesLogPath);
161            m_settings.endGroup();
162    
163          // Save display options.          // Save display options.
164          m_settings.beginGroup("/Display");          m_settings.beginGroup("/Display");
165          m_settings.setValue("/DisplayFont", sDisplayFont);          m_settings.setValue("/DisplayFont", sDisplayFont);
# Line 151  qsamplerOptions::~qsamplerOptions (void) Line 175  qsamplerOptions::~qsamplerOptions (void)
175          m_settings.setValue("/StdoutCapture", bStdoutCapture);          m_settings.setValue("/StdoutCapture", bStdoutCapture);
176          m_settings.setValue("/CompletePath", bCompletePath);          m_settings.setValue("/CompletePath", bCompletePath);
177          m_settings.setValue("/MaxRecentFiles", iMaxRecentFiles);          m_settings.setValue("/MaxRecentFiles", iMaxRecentFiles);
178            m_settings.setValue("/BaseFontSize", iBaseFontSize);
179          m_settings.setValue("/InstrumentNames", bInstrumentNames);          m_settings.setValue("/InstrumentNames", bInstrumentNames);
180          m_settings.endGroup();          m_settings.endGroup();
181    
# Line 191  qsamplerOptions::~qsamplerOptions (void) Line 216  qsamplerOptions::~qsamplerOptions (void)
216  // Settings accessor.  // Settings accessor.
217  //  //
218    
219  QSettings& qsamplerOptions::settings (void)  QSettings& Options::settings (void)
220  {  {
221          return m_settings;          return m_settings;
222  }  }
# Line 202  QSettings& qsamplerOptions::settings (vo Line 227  QSettings& qsamplerOptions::settings (vo
227  //  //
228    
229  // Help about command line options.  // Help about command line options.
230  void qsamplerOptions::print_usage ( const char *arg0 )  void Options::print_usage ( const char *arg0 )
231  {  {
232          QTextStream out(stderr);          QTextStream out(stderr);
233          out << QObject::tr("Usage: %1 [options] [session-file]\n\n"          out << QObject::tr("Usage: %1 [options] [session-file]\n\n"
# Line 218  void qsamplerOptions::print_usage ( cons Line 243  void qsamplerOptions::print_usage ( cons
243    
244    
245  // Parse command line arguments into m_settings.  // Parse command line arguments into m_settings.
246  bool qsamplerOptions::parse_args ( int argc, char **argv )  bool Options::parse_args ( int argc, char **argv )
247  {  {
248          QTextStream out(stderr);          QTextStream out(stderr);
249          const QString sEol = "\n\n";          const QString sEol = "\n\n";
# Line 297  bool qsamplerOptions::parse_args ( int a Line 322  bool qsamplerOptions::parse_args ( int a
322  //---------------------------------------------------------------------------  //---------------------------------------------------------------------------
323  // Widget geometry persistence helper methods.  // Widget geometry persistence helper methods.
324    
325  void qsamplerOptions::loadWidgetGeometry ( QWidget *pWidget )  void Options::loadWidgetGeometry ( QWidget *pWidget )
326  {  {
327          // Try to restore old form window positioning.          // Try to restore old form window positioning.
328          if (pWidget) {          if (pWidget) {
# Line 325  void qsamplerOptions::loadWidgetGeometry Line 350  void qsamplerOptions::loadWidgetGeometry
350  }  }
351    
352    
353  void qsamplerOptions::saveWidgetGeometry ( QWidget *pWidget )  void Options::saveWidgetGeometry ( QWidget *pWidget )
354  {  {
355          // Try to save form window position...          // Try to save form window position...
356          // (due to X11 window managers ideossincrasies, we better          // (due to X11 window managers ideossincrasies, we better
# Line 348  void qsamplerOptions::saveWidgetGeometry Line 373  void qsamplerOptions::saveWidgetGeometry
373  //---------------------------------------------------------------------------  //---------------------------------------------------------------------------
374  // Combo box history persistence helper implementation.  // Combo box history persistence helper implementation.
375    
376  void qsamplerOptions::loadComboBoxHistory ( QComboBox *pComboBox, int iLimit )  void Options::loadComboBoxHistory ( QComboBox *pComboBox, int iLimit )
377  {  {
378          // Load combobox list from configuration settings file...          // Load combobox list from configuration settings file...
379          m_settings.beginGroup("/History/" + pComboBox->objectName());          m_settings.beginGroup("/History/" + pComboBox->objectName());
# Line 371  void qsamplerOptions::loadComboBoxHistor Line 396  void qsamplerOptions::loadComboBoxHistor
396  }  }
397    
398    
399  void qsamplerOptions::saveComboBoxHistory ( QComboBox *pComboBox, int iLimit )  void Options::saveComboBoxHistory ( QComboBox *pComboBox, int iLimit )
400  {  {
401          // Add current text as latest item...          // Add current text as latest item...
402          const QString& sCurrentText = pComboBox->currentText();          const QString& sCurrentText = pComboBox->currentText();
# Line 400  void qsamplerOptions::saveComboBoxHistor Line 425  void qsamplerOptions::saveComboBoxHistor
425          m_settings.endGroup();          m_settings.endGroup();
426  }  }
427    
428    } // namespace QSampler
429    
430    
431  // end of qsamplerOptions.cpp  // end of qsamplerOptions.cpp

Legend:
Removed from v.1527  
changed lines
  Added in v.1749

  ViewVC Help
Powered by ViewVC