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

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

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

revision 3648 by capela, Tue Dec 10 10:34:06 2019 UTC revision 3761 by capela, Tue Mar 31 11:06:16 2020 UTC
# Line 1  Line 1 
1  // qsamplerOptionsForm.cpp  // qsamplerOptionsForm.cpp
2  //  //
3  /****************************************************************************  /****************************************************************************
4     Copyright (C) 2004-2019, rncbc aka Rui Nuno Capela. All rights reserved.     Copyright (C) 2004-2020, 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    
34  #include <QStyleFactory>  #include <QStyleFactory>
35    
 namespace QSampler {  
36    
37  // Default (empty/blank) name.  // Default (empty/blank) name.
38  static const char *g_pszDefName = QT_TR_NOOP("(default)");  static const char *g_pszDefName = QT_TRANSLATE_NOOP("qsamplerOptionsForm", "(default)");
39    
40    
41    namespace QSampler {
42    
43  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
44  // QSampler::OptionsForm -- Options form implementation.  // QSampler::OptionsForm -- Options form implementation.
# Line 343  void OptionsForm::accept (void) Line 345  void OptionsForm::accept (void)
345                  m_pOptions->iMaxRecentFiles  = m_ui.MaxRecentFilesSpinBox->value();                  m_pOptions->iMaxRecentFiles  = m_ui.MaxRecentFilesSpinBox->value();
346                  m_pOptions->iBaseFontSize  = m_ui.BaseFontSizeComboBox->currentText().toInt();                  m_pOptions->iBaseFontSize  = m_ui.BaseFontSizeComboBox->currentText().toInt();
347                  // Custom color/style theme options...                  // Custom color/style theme options...
                 const QString sOldCustomStyleTheme = m_pOptions->sCustomStyleTheme;  
348                  if (m_ui.CustomStyleThemeComboBox->currentIndex() > 0)                  if (m_ui.CustomStyleThemeComboBox->currentIndex() > 0)
349                          m_pOptions->sCustomStyleTheme = m_ui.CustomStyleThemeComboBox->currentText();                          m_pOptions->sCustomStyleTheme = m_ui.CustomStyleThemeComboBox->currentText();
350                  else                  else
351                          m_pOptions->sCustomStyleTheme.clear();                          m_pOptions->sCustomStyleTheme.clear();
                 const QString sOldCustomColorTheme = m_pOptions->sCustomColorTheme;  
352                  if (m_ui.CustomColorThemeComboBox->currentIndex() > 0)                  if (m_ui.CustomColorThemeComboBox->currentIndex() > 0)
353                          m_pOptions->sCustomColorTheme = m_ui.CustomColorThemeComboBox->currentText();                          m_pOptions->sCustomColorTheme = m_ui.CustomColorThemeComboBox->currentText();
354                  else                  else
355                          m_pOptions->sCustomColorTheme.clear();                          m_pOptions->sCustomColorTheme.clear();
                 // Check whether restart is needed or whether  
                 // custom options maybe set up immediately...  
                 int iNeedRestart = 0;  
                 if (m_pOptions->sCustomStyleTheme != sOldCustomStyleTheme) {  
                         if (m_pOptions->sCustomStyleTheme.isEmpty()) {  
                                 ++iNeedRestart;  
                         } else {  
                                 QApplication::setStyle(  
                                         QStyleFactory::create(m_pOptions->sCustomStyleTheme));  
                         }  
                 }  
                 if (m_pOptions->sCustomColorTheme != sOldCustomColorTheme) {  
                         if (m_pOptions->sCustomColorTheme.isEmpty()) {  
                                 ++iNeedRestart;  
                         } else {  
                                 QPalette pal;  
                                 if (PaletteForm::namedPalette(  
                                                 &m_pOptions->settings(), m_pOptions->sCustomColorTheme, pal))  
                                         QApplication::setPalette(pal);  
                         }  
                 }  
                 // Show restart message if needed...  
                 if (iNeedRestart > 0) {  
                         QMessageBox::information(this,  
                                 tr("Information"),  
                                 tr("Some settings may be only effective\n"  
                                 "next time you start this application."));  
                 }  
356                  // Reset dirty flag.                  // Reset dirty flag.
357                  m_iDirtyCount = 0;                  m_iDirtyCount = 0;
358          }          }
359    
360          // if the user modified the limits, apply them to the sampler          // If the user modified the limits, apply them to the sampler
361          // (and store it later in qsampler's configuration)          // (and store it later in qsampler's configuration)
362          if (bMaxVoicesModified && m_ui.MaxVoicesSpinBox->isEnabled())          if (bMaxVoicesModified && m_ui.MaxVoicesSpinBox->isEnabled())
363                  m_pOptions->setMaxVoices(m_ui.MaxVoicesSpinBox->value());                  m_pOptions->setMaxVoices(m_ui.MaxVoicesSpinBox->value());
# Line 591  void OptionsForm::resetCustomColorThemes Line 563  void OptionsForm::resetCustomColorThemes
563                  PaletteForm::namedPaletteList(&m_pOptions->settings()));                  PaletteForm::namedPaletteList(&m_pOptions->settings()));
564    
565          int iCustomColorTheme = 0;          int iCustomColorTheme = 0;
566          if (!sCustomColorTheme.isEmpty())          if (!sCustomColorTheme.isEmpty()) {
567                  iCustomColorTheme = m_ui.CustomColorThemeComboBox->findText(                  iCustomColorTheme = m_ui.CustomColorThemeComboBox->findText(
568                          sCustomColorTheme);                          sCustomColorTheme);
569                    if (iCustomColorTheme < 0)
570                            iCustomColorTheme = 0;
571            }
572          m_ui.CustomColorThemeComboBox->setCurrentIndex(iCustomColorTheme);          m_ui.CustomColorThemeComboBox->setCurrentIndex(iCustomColorTheme);
573  }  }
574    
# Line 608  void OptionsForm::resetCustomStyleThemes Line 583  void OptionsForm::resetCustomStyleThemes
583          m_ui.CustomStyleThemeComboBox->addItems(QStyleFactory::keys());          m_ui.CustomStyleThemeComboBox->addItems(QStyleFactory::keys());
584    
585          int iCustomStyleTheme = 0;          int iCustomStyleTheme = 0;
586          if (!sCustomStyleTheme.isEmpty())          if (!sCustomStyleTheme.isEmpty()) {
587                  iCustomStyleTheme = m_ui.CustomStyleThemeComboBox->findText(                  iCustomStyleTheme = m_ui.CustomStyleThemeComboBox->findText(
588                          sCustomStyleTheme);                          sCustomStyleTheme);
589                    if (iCustomStyleTheme < 0)
590                            iCustomStyleTheme = 0;
591            }
592          m_ui.CustomStyleThemeComboBox->setCurrentIndex(iCustomStyleTheme);          m_ui.CustomStyleThemeComboBox->setCurrentIndex(iCustomStyleTheme);
593  }  }
594    

Legend:
Removed from v.3648  
changed lines
  Added in v.3761

  ViewVC Help
Powered by ViewVC