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

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

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

revision 3760 by capela, Mon Mar 30 16:38:22 2020 UTC revision 4030 by capela, Fri Mar 4 15:17:30 2022 UTC
# Line 1  Line 1 
1  // qsamplerMainForm.cpp  // qsamplerMainForm.cpp
2  //  //
3  /****************************************************************************  /****************************************************************************
4     Copyright (C) 2004-2020, rncbc aka Rui Nuno Capela. All rights reserved.     Copyright (C) 2004-2022, rncbc aka Rui Nuno Capela. All rights reserved.
5     Copyright (C) 2007-2019 Christian Schoenebeck     Copyright (C) 2007-2019 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 46  Line 46 
46  #include <QProcess>  #include <QProcess>
47  #include <QMessageBox>  #include <QMessageBox>
48    
 #include <QRegExp>  
49  #include <QTextStream>  #include <QTextStream>
50  #include <QFileDialog>  #include <QFileDialog>
51  #include <QFileInfo>  #include <QFileInfo>
# Line 74  const WindowFlags WindowCloseButtonHint Line 73  const WindowFlags WindowCloseButtonHint
73  }  }
74  #endif  #endif
75    
76    #ifdef CONFIG_LIBGIG
77    #if defined(Q_CC_GNU) || defined(Q_CC_MINGW)
78    #pragma GCC diagnostic push
79    #pragma GCC diagnostic ignored "-Wunused-parameter"
80    #endif
81    #include <gig.h>
82    #if defined(Q_CC_GNU) || defined(Q_CC_MINGW)
83    #pragma GCC diagnostic pop
84    #endif
85    #endif
86    
87  // Deprecated QTextStreamFunctions/Qt namespaces workaround.  // Deprecated QTextStreamFunctions/Qt namespaces workaround.
88  #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)  #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
89  #define endl    Qt::endl  #define endl    Qt::endl
90  #endif  #endif
91    
   
 #ifdef CONFIG_LIBGIG  
 #include <gig.h>  
 #endif  
   
92  // Needed for lroundf()  // Needed for lroundf()
93  #include <math.h>  #ifdef CONFIG_ROUND
94    #include <cmath>
95  #ifndef CONFIG_ROUND  #else
96  static inline long lroundf ( float x )  static inline long lroundf ( float x )
97  {  {
98          if (x >= 0.0f)          if (x >= 0.0f)
# Line 125  static void qsampler_sigusr1_handler ( i Line 130  static void qsampler_sigusr1_handler ( i
130  {  {
131          char c = 1;          char c = 1;
132    
133          (::write(g_fdSigusr1[0], &c, sizeof(c)) > 0);          (void) (::write(g_fdSigusr1[0], &c, sizeof(c)) > 0);
134  }  }
135    
136  // File descriptor for SIGTERM notifier.  // File descriptor for SIGTERM notifier.
# Line 136  static void qsampler_sigterm_handler ( i Line 141  static void qsampler_sigterm_handler ( i
141  {  {
142          char c = 1;          char c = 1;
143    
144          (::write(g_fdSigterm[0], &c, sizeof(c)) > 0);          (void) (::write(g_fdSigterm[0], &c, sizeof(c)) > 0);
145  }  }
146    
147  #endif  // HAVE_SIGNAL_H  #endif  // HAVE_SIGNAL_H
# Line 1918  void MainForm::viewOptions (void) Line 1923  void MainForm::viewOptions (void)
1923                          // Check whether restart is needed or whether                          // Check whether restart is needed or whether
1924                          // custom options maybe set up immediately...                          // custom options maybe set up immediately...
1925                          if (m_pOptions->sCustomStyleTheme != sOldCustomStyleTheme) {                          if (m_pOptions->sCustomStyleTheme != sOldCustomStyleTheme) {
                         #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)  
                                 ++iNeedRestart;  
                         #else            
1926                                  if (m_pOptions->sCustomStyleTheme.isEmpty()) {                                  if (m_pOptions->sCustomStyleTheme.isEmpty()) {
1927                                          ++iNeedRestart;                                          ++iNeedRestart;
1928                                  } else {                                  } else {
1929                                          QApplication::setStyle(                                          QApplication::setStyle(
1930                                                  QStyleFactory::create(m_pOptions->sCustomStyleTheme));                                                  QStyleFactory::create(m_pOptions->sCustomStyleTheme));
1931                                  }                                  }
                         #endif  
1932                          }                          }
1933                          if (m_pOptions->sCustomColorTheme != sOldCustomColorTheme) {                          if (m_pOptions->sCustomColorTheme != sOldCustomColorTheme) {
                         #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)  
                                 ++iNeedRestart;  
                         #else  
1934                                  if (m_pOptions->sCustomColorTheme.isEmpty()) {                                  if (m_pOptions->sCustomColorTheme.isEmpty()) {
1935                                          ++iNeedRestart;                                          ++iNeedRestart;
1936                                  } else {                                  } else {
# Line 1941  void MainForm::viewOptions (void) Line 1939  void MainForm::viewOptions (void)
1939                                                          &m_pOptions->settings(), m_pOptions->sCustomColorTheme, pal))                                                          &m_pOptions->settings(), m_pOptions->sCustomColorTheme, pal))
1940                                                  QApplication::setPalette(pal);                                                  QApplication::setPalette(pal);
1941                                  }                                  }
                         #endif  
1942                          }                          }
1943                          // Check wheather something immediate has changed.                          // Check wheather something immediate has changed.
1944                          if (( bOldMessagesLog && !m_pOptions->bMessagesLog) ||                          if (( bOldMessagesLog && !m_pOptions->bMessagesLog) ||
# Line 2110  void MainForm::helpAbout (void) Line 2107  void MainForm::helpAbout (void)
2107                  sText += "</font></small>";                  sText += "</font></small>";
2108          }          }
2109          sText += "<br />\n";          sText += "<br />\n";
2110          sText += tr("Using") + ": ";          sText += tr("Using: Qt %1").arg(qVersion());
2111    #if defined(QT_STATIC)
2112            sText += "-static";
2113    #endif
2114            sText += ", ";
2115          sText += ::lscp_client_package();          sText += ::lscp_client_package();
2116          sText += " ";          sText += " ";
2117          sText += ::lscp_client_version();          sText += ::lscp_client_version();
# Line 2503  void MainForm::updateMaxVolume (void) Line 2504  void MainForm::updateMaxVolume (void)
2504  // QSampler::MainForm -- Messages window form handlers.  // QSampler::MainForm -- Messages window form handlers.
2505    
2506  // Messages output methods.  // Messages output methods.
2507  void MainForm::appendMessages( const QString& s )  void MainForm::appendMessages ( const QString& s )
2508  {  {
2509          if (m_pMessages)          if (m_pMessages)
2510                  m_pMessages->appendMessages(s);                  m_pMessages->appendMessages(s);
# Line 2511  void MainForm::appendMessages( const QSt Line 2512  void MainForm::appendMessages( const QSt
2512          statusBar()->showMessage(s, 3000);          statusBar()->showMessage(s, 3000);
2513  }  }
2514    
2515  void MainForm::appendMessagesColor( const QString& s, const QString& c )  void MainForm::appendMessagesColor ( const QString& s, const QColor& rgb )
2516  {  {
2517          if (m_pMessages)          if (m_pMessages)
2518                  m_pMessages->appendMessagesColor(s, c);                  m_pMessages->appendMessagesColor(s, rgb);
2519    
2520          statusBar()->showMessage(s, 3000);          statusBar()->showMessage(s, 3000);
2521  }  }
2522    
2523  void MainForm::appendMessagesText( const QString& s )  void MainForm::appendMessagesText ( const QString& s )
2524  {  {
2525          if (m_pMessages)          if (m_pMessages)
2526                  m_pMessages->appendMessagesText(s);                  m_pMessages->appendMessagesText(s);
2527  }  }
2528    
2529  void MainForm::appendMessagesError( const QString& sText )  void MainForm::appendMessagesError ( const QString& s )
2530  {  {
2531          if (m_pMessages)          if (m_pMessages)
2532                  m_pMessages->show();                  m_pMessages->show();
2533    
2534          appendMessagesColor(sText.simplified(), "#ff0000");          appendMessagesColor(s.simplified(), Qt::red);
2535    
2536          // Make it look responsive...:)          // Make it look responsive...:)
2537          QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);          QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
# Line 2543  void MainForm::appendMessagesError( cons Line 2544  void MainForm::appendMessagesError( cons
2544                  QMessageBox mbox(this);                  QMessageBox mbox(this);
2545                  mbox.setIcon(QMessageBox::Critical);                  mbox.setIcon(QMessageBox::Critical);
2546                  mbox.setWindowTitle(sTitle);                  mbox.setWindowTitle(sTitle);
2547                  mbox.setText(sText);                  mbox.setText(s);
2548                  mbox.setStandardButtons(QMessageBox::Cancel);                  mbox.setStandardButtons(QMessageBox::Cancel);
2549                  QCheckBox cbox(tr("Don't show this again"));                  QCheckBox cbox(tr("Don't show this again"));
2550                  cbox.setChecked(false);                  cbox.setChecked(false);
# Line 2928  void MainForm::startServer (void) Line 2929  void MainForm::startServer (void)
2929    
2930          // Show startup results...          // Show startup results...
2931          appendMessages(          appendMessages(
2932                  tr("Server was started with PID=%1.").arg((long) m_pServer->pid()));                  tr("Server was started with PID=%1.")
2933                    #if QT_VERSION < QT_VERSION_CHECK(5, 3, 0)
2934                            .arg(quint64(m_pServer->pid())));
2935                    #else
2936                            .arg(quint64(m_pServer->processId())));
2937                    #endif
2938    
2939          // Reset (yet again) the timer counters,          // Reset (yet again) the timer counters,
2940          // but this time is deferred as the user opted.          // but this time is deferred as the user opted.

Legend:
Removed from v.3760  
changed lines
  Added in v.4030

  ViewVC Help
Powered by ViewVC