/[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 3038 by capela, Thu Nov 10 16:23:30 2016 UTC revision 3518 by capela, Sun Jun 30 16:58:30 2019 UTC
# Line 1  Line 1 
1  // qsamplerMainForm.cpp  // qsamplerMainForm.cpp
2  //  //
3  /****************************************************************************  /****************************************************************************
4     Copyright (C) 2004-2016, rncbc aka Rui Nuno Capela. All rights reserved.     Copyright (C) 2004-2019, rncbc aka Rui Nuno Capela. All rights reserved.
5     Copyright (C) 2007,2008,2015 Christian Schoenebeck     Copyright (C) 2007,2008,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
# Line 68  const WindowFlags WindowCloseButtonHint Line 68  const WindowFlags WindowCloseButtonHint
68  }  }
69  #endif  #endif
70    
 #ifdef HAVE_SIGNAL_H  
 #include <signal.h>  
 #endif  
   
71  #ifdef CONFIG_LIBGIG  #ifdef CONFIG_LIBGIG
72  #include <gig.h>  #include <gig.h>
73  #endif  #endif
# Line 91  static inline long lroundf ( float x ) Line 87  static inline long lroundf ( float x )
87    
88    
89  // All winsock apps needs this.  // All winsock apps needs this.
90  #if defined(WIN32)  #if defined(__WIN32__) || defined(_WIN32) || defined(WIN32)
91  static WSADATA _wsaData;  static WSADATA _wsaData;
92    #undef HAVE_SIGNAL_H
93  #endif  #endif
94    
95    
# Line 103  static WSADATA _wsaData; Line 100  static WSADATA _wsaData;
100    
101  #include <QSocketNotifier>  #include <QSocketNotifier>
102    
103    #include <unistd.h>
104  #include <sys/types.h>  #include <sys/types.h>
105  #include <sys/socket.h>  #include <sys/socket.h>
   
106  #include <signal.h>  #include <signal.h>
107    
108  // File descriptor for SIGUSR1 notifier.  // File descriptor for SIGUSR1 notifier.
109  static int g_fdUsr1[2];  static int g_fdSigusr1[2] = { -1, -1 };
110    
111  // Unix SIGUSR1 signal handler.  // Unix SIGUSR1 signal handler.
112  static void qsampler_sigusr1_handler ( int /* signo */ )  static void qsampler_sigusr1_handler ( int /* signo */ )
113  {  {
114          char c = 1;          char c = 1;
115    
116          (::write(g_fdUsr1[0], &c, sizeof(c)) > 0);          (::write(g_fdSigusr1[0], &c, sizeof(c)) > 0);
117    }
118    
119    // File descriptor for SIGTERM notifier.
120    static int g_fdSigterm[2] = { -1, -1 };
121    
122    // Unix SIGTERM signal handler.
123    static void qsampler_sigterm_handler ( int /* signo */ )
124    {
125            char c = 1;
126    
127            (::write(g_fdSigterm[0], &c, sizeof(c)) > 0);
128  }  }
129    
130  #endif  // HAVE_SIGNAL_H  #endif  // HAVE_SIGNAL_H
# Line 233  MainForm::MainForm ( QWidget *pParent ) Line 241  MainForm::MainForm ( QWidget *pParent )
241          // LADISH Level 1 suport.          // LADISH Level 1 suport.
242    
243          // Initialize file descriptors for SIGUSR1 socket notifier.          // Initialize file descriptors for SIGUSR1 socket notifier.
244          ::socketpair(AF_UNIX, SOCK_STREAM, 0, g_fdUsr1);          ::socketpair(AF_UNIX, SOCK_STREAM, 0, g_fdSigusr1);
245          m_pUsr1Notifier          m_pSigusr1Notifier
246                  = new QSocketNotifier(g_fdUsr1[1], QSocketNotifier::Read, this);                  = new QSocketNotifier(g_fdSigusr1[1], QSocketNotifier::Read, this);
247    
248          QObject::connect(m_pUsr1Notifier,          QObject::connect(m_pSigusr1Notifier,
249                  SIGNAL(activated(int)),                  SIGNAL(activated(int)),
250                  SLOT(handle_sigusr1()));                  SLOT(handle_sigusr1()));
251    
252          // Install SIGUSR1 signal handler.          // Install SIGUSR1 signal handler.
253      struct sigaction usr1;          struct sigaction sigusr1;
254      usr1.sa_handler = qsampler_sigusr1_handler;          sigusr1.sa_handler = qsampler_sigusr1_handler;
255      sigemptyset(&usr1.sa_mask);          sigemptyset(&sigusr1.sa_mask);
256      usr1.sa_flags = 0;          sigusr1.sa_flags = 0;
257      usr1.sa_flags |= SA_RESTART;          sigusr1.sa_flags |= SA_RESTART;
258      ::sigaction(SIGUSR1, &usr1, NULL);          ::sigaction(SIGUSR1, &sigusr1, NULL);
259    
260            // Initialize file descriptors for SIGTERM socket notifier.
261            ::socketpair(AF_UNIX, SOCK_STREAM, 0, g_fdSigterm);
262            m_pSigtermNotifier
263                    = new QSocketNotifier(g_fdSigterm[1], QSocketNotifier::Read, this);
264    
265            QObject::connect(m_pSigtermNotifier,
266                    SIGNAL(activated(int)),
267                    SLOT(handle_sigterm()));
268    
269            // Install SIGTERM signal handler.
270            struct sigaction sigterm;
271            sigterm.sa_handler = qsampler_sigterm_handler;
272            ::sigemptyset(&sigterm.sa_mask);
273            sigterm.sa_flags = 0;
274            sigterm.sa_flags |= SA_RESTART;
275            ::sigaction(SIGTERM, &sigterm, NULL);
276            ::sigaction(SIGQUIT, &sigterm, NULL);
277    
278            // Ignore SIGHUP/SIGINT signals.
279            ::signal(SIGHUP, SIG_IGN);
280            ::signal(SIGINT, SIG_IGN);
281    
282  #else   // HAVE_SIGNAL_H  #else   // HAVE_SIGNAL_H
283    
284          m_pUsr1Notifier = NULL;          m_pSigusr1Notifier = NULL;
285            m_pSigtermNotifier = NULL;
286                    
287  #endif  // !HAVE_SIGNAL_H  #endif  // !HAVE_SIGNAL_H
288    
# Line 324  MainForm::MainForm ( QWidget *pParent ) Line 355  MainForm::MainForm ( QWidget *pParent )
355          m_statusItem[QSAMPLER_STATUS_SESSION] = pLabel;          m_statusItem[QSAMPLER_STATUS_SESSION] = pLabel;
356          statusBar()->addWidget(pLabel);          statusBar()->addWidget(pLabel);
357    
358  #if defined(WIN32)  #if defined(__WIN32__) || defined(_WIN32) || defined(WIN32)
359          WSAStartup(MAKEWORD(1, 1), &_wsaData);          WSAStartup(MAKEWORD(1, 1), &_wsaData);
360  #endif  #endif
361    
# Line 425  MainForm::~MainForm() Line 456  MainForm::~MainForm()
456          // Do final processing anyway.          // Do final processing anyway.
457          processServerExit();          processServerExit();
458    
459  #if defined(WIN32)  #if defined(__WIN32__) || defined(_WIN32) || defined(WIN32)
460          WSACleanup();          WSACleanup();
461  #endif  #endif
462    
463  #if defined(HAVE_SIGNAL_H) && defined(HAVE_SYS_SOCKET_H)  #if defined(HAVE_SIGNAL_H) && defined(HAVE_SYS_SOCKET_H)
464          if (m_pUsr1Notifier)          if (m_pSigusr1Notifier)
465                  delete m_pUsr1Notifier;                  delete m_pSigusr1Notifier;
466            if (m_pSigtermNotifier)
467                    delete m_pSigtermNotifier;
468  #endif  #endif
469    
470          // Finally drop any widgets around...          // Finally drop any widgets around...
# Line 721  void MainForm::handle_sigusr1 (void) Line 754  void MainForm::handle_sigusr1 (void)
754    
755          char c;          char c;
756    
757          if (::read(g_fdUsr1[1], &c, sizeof(c)) > 0)          if (::read(g_fdSigusr1[1], &c, sizeof(c)) > 0)
758                  saveSession(false);                  saveSession(false);
759    
760  #endif  #endif
761  }  }
762    
763    
764    void MainForm::handle_sigterm (void)
765    {
766    #if defined(HAVE_SIGNAL_H) && defined(HAVE_SYS_SOCKET_H)
767    
768            char c;
769    
770            if (::read(g_fdSigterm[1], &c, sizeof(c)) > 0)
771                    close();
772    
773    #endif
774    }
775    
776    
777  void MainForm::updateViewMidiDeviceStatusMenu (void)  void MainForm::updateViewMidiDeviceStatusMenu (void)
778  {  {
779          m_ui.viewMidiDeviceStatusMenu->clear();          m_ui.viewMidiDeviceStatusMenu->clear();
# Line 806  bool MainForm::newSession (void) Line 852  bool MainForm::newSession (void)
852          m_iUntitled++;          m_iUntitled++;
853    
854          // Stabilize form.          // Stabilize form.
855          m_sFilename = QString::null;          m_sFilename = QString();
856          m_iDirtyCount = 0;          m_iDirtyCount = 0;
857          appendMessages(tr("New session: \"%1\".").arg(sessionName(m_sFilename)));          appendMessages(tr("New session: \"%1\".").arg(sessionName(m_sFilename)));
858          stabilizeForm();          stabilizeForm();
# Line 866  bool MainForm::saveSession ( bool bPromp Line 912  bool MainForm::saveSession ( bool bPromp
912                  // Enforce .lscp extension...                  // Enforce .lscp extension...
913                  if (QFileInfo(sFilename).suffix().isEmpty())                  if (QFileInfo(sFilename).suffix().isEmpty())
914                          sFilename += ".lscp";                          sFilename += ".lscp";
915            #if 0
916                  // Check if already exists...                  // Check if already exists...
917                  if (sFilename != m_sFilename && QFileInfo(sFilename).exists()) {                  if (sFilename != m_sFilename && QFileInfo(sFilename).exists()) {
918                          if (QMessageBox::warning(this,                          if (QMessageBox::warning(this,
# Line 878  bool MainForm::saveSession ( bool bPromp Line 925  bool MainForm::saveSession ( bool bPromp
925                                  == QMessageBox::No)                                  == QMessageBox::No)
926                                  return false;                                  return false;
927                  }                  }
928            #endif
929          }          }
930    
931          // Save it right away.          // Save it right away.
# Line 1046  bool MainForm::saveSessionFile ( const Q Line 1094  bool MainForm::saveSessionFile ( const Q
1094          int iErrors = 0;          int iErrors = 0;
1095          QTextStream ts(&file);          QTextStream ts(&file);
1096          ts << "# " << QSAMPLER_TITLE " - " << tr(QSAMPLER_SUBTITLE) << endl;          ts << "# " << QSAMPLER_TITLE " - " << tr(QSAMPLER_SUBTITLE) << endl;
1097          ts << "# " << tr("Version")          ts << "# " << tr("Version") << ": " CONFIG_BUILD_VERSION << endl;
1098          << ": " CONFIG_BUILD_VERSION << endl;  //      ts << "# " << tr("Build") << ": " CONFIG_BUILD_DATE << endl;
         ts << "# " << tr("Build")  
         << ": " CONFIG_BUILD_DATE << endl;  
1099          ts << "#"  << endl;          ts << "#"  << endl;
1100          ts << "# " << tr("File")          ts << "# " << tr("File")
1101          << ": " << QFileInfo(sFilename).fileName() << endl;          << ": " << QFileInfo(sFilename).fileName() << endl;
# Line 1062  bool MainForm::saveSessionFile ( const Q Line 1108  bool MainForm::saveSessionFile ( const Q
1108          // It is assumed that this new kind of device+session file          // It is assumed that this new kind of device+session file
1109          // will be loaded from a complete initialized server...          // will be loaded from a complete initialized server...
1110          int *piDeviceIDs;          int *piDeviceIDs;
1111          int  iDevice;          int  i, iDevice;
1112          ts << "RESET" << endl;          ts << "RESET" << endl;
1113    
1114          // Audio device mapping.          // Audio device mapping.
1115          QMap<int, int> audioDeviceMap;          QMap<int, int> audioDeviceMap; iDevice = 0;
1116          piDeviceIDs = Device::getDevices(m_pClient, Device::Audio);          piDeviceIDs = Device::getDevices(m_pClient, Device::Audio);
1117          for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) {          for (i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; ++i) {
1118                  ts << endl;                  Device device(Device::Audio, piDeviceIDs[i]);
1119                  Device device(Device::Audio, piDeviceIDs[iDevice]);                  // Avoid plug-in driver devices...
1120                    if (device.driverName().toUpper() == "PLUGIN")
1121                            continue;
1122                  // Audio device specification...                  // Audio device specification...
1123                    ts << endl;
1124                  ts << "# " << device.deviceTypeName() << " " << device.driverName()                  ts << "# " << device.deviceTypeName() << " " << device.driverName()
1125                          << " " << tr("Device") << " " << iDevice << endl;                          << " " << tr("Device") << " " << iDevice << endl;
1126                  ts << "CREATE AUDIO_OUTPUT_DEVICE " << device.driverName();                  ts << "CREATE AUDIO_OUTPUT_DEVICE " << device.driverName();
# Line 1102  bool MainForm::saveSessionFile ( const Q Line 1151  bool MainForm::saveSessionFile ( const Q
1151                          iPort++;                          iPort++;
1152                  }                  }
1153                  // Audio device index/id mapping.                  // Audio device index/id mapping.
1154                  audioDeviceMap[device.deviceID()] = iDevice;                  audioDeviceMap.insert(device.deviceID(), iDevice++);
1155                  // Try to keep it snappy :)                  // Try to keep it snappy :)
1156                  QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);                  QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
1157          }          }
1158    
1159          // MIDI device mapping.          // MIDI device mapping.
1160          QMap<int, int> midiDeviceMap;          QMap<int, int> midiDeviceMap; iDevice = 0;
1161          piDeviceIDs = Device::getDevices(m_pClient, Device::Midi);          piDeviceIDs = Device::getDevices(m_pClient, Device::Midi);
1162          for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) {          for (i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; ++i) {
1163                  ts << endl;                  Device device(Device::Midi, piDeviceIDs[i]);
1164                  Device device(Device::Midi, piDeviceIDs[iDevice]);                  // Avoid plug-in driver devices...
1165                    if (device.driverName().toUpper() == "PLUGIN")
1166                            continue;
1167                  // MIDI device specification...                  // MIDI device specification...
1168                    ts << endl;
1169                  ts << "# " << device.deviceTypeName() << " " << device.driverName()                  ts << "# " << device.deviceTypeName() << " " << device.driverName()
1170                          << " " << tr("Device") << " " << iDevice << endl;                          << " " << tr("Device") << " " << iDevice << endl;
1171                  ts << "CREATE MIDI_INPUT_DEVICE " << device.driverName();                  ts << "CREATE MIDI_INPUT_DEVICE " << device.driverName();
# Line 1144  bool MainForm::saveSessionFile ( const Q Line 1196  bool MainForm::saveSessionFile ( const Q
1196                          iPort++;                          iPort++;
1197                  }                  }
1198                  // MIDI device index/id mapping.                  // MIDI device index/id mapping.
1199                  midiDeviceMap[device.deviceID()] = iDevice;                  midiDeviceMap.insert(device.deviceID(), iDevice++);
1200                  // Try to keep it snappy :)                  // Try to keep it snappy :)
1201                  QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);                  QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
1202          }          }
# Line 1212  bool MainForm::saveSessionFile ( const Q Line 1264  bool MainForm::saveSessionFile ( const Q
1264                          iErrors++;                          iErrors++;
1265                  }                  }
1266                  // MIDI strument index/id mapping.                  // MIDI strument index/id mapping.
1267                  midiInstrumentMap[iMidiMap] = iMap;                  midiInstrumentMap.insert(iMidiMap, iMap);
1268          }          }
1269          // Check for errors...          // Check for errors...
1270          if (piMaps == NULL && ::lscp_client_get_errno(m_pClient)) {          if (piMaps == NULL && ::lscp_client_get_errno(m_pClient)) {
# Line 1221  bool MainForm::saveSessionFile ( const Q Line 1273  bool MainForm::saveSessionFile ( const Q
1273          }          }
1274  #endif  // CONFIG_MIDI_INSTRUMENT  #endif  // CONFIG_MIDI_INSTRUMENT
1275    
1276          // Sampler channel mapping.          // Sampler channel mapping...
1277            int iChannelID = 0;
1278          const QList<QMdiSubWindow *>& wlist          const QList<QMdiSubWindow *>& wlist
1279                  = m_pWorkspace->subWindowList();                  = m_pWorkspace->subWindowList();
1280          const int iStripCount = wlist.count();          const int iStripCount = wlist.count();
# Line 1233  bool MainForm::saveSessionFile ( const Q Line 1286  bool MainForm::saveSessionFile ( const Q
1286                  if (pChannelStrip) {                  if (pChannelStrip) {
1287                          Channel *pChannel = pChannelStrip->channel();                          Channel *pChannel = pChannelStrip->channel();
1288                          if (pChannel) {                          if (pChannel) {
1289                                  const int iChannelID = pChannel->channelID();                                  // Avoid "artifial" plug-in devices...
1290                                    const int iAudioDevice = pChannel->audioDevice();
1291                                    if (!audioDeviceMap.contains(iAudioDevice))
1292                                            continue;
1293                                    const int iMidiDevice = pChannel->midiDevice();
1294                                    if (!midiDeviceMap.contains(iMidiDevice))
1295                                            continue;
1296                                    // Go for regular, canonical devices...
1297                                  ts << "# " << tr("Channel") << " " << iChannelID << endl;                                  ts << "# " << tr("Channel") << " " << iChannelID << endl;
1298                                  ts << "ADD CHANNEL" << endl;                                  ts << "ADD CHANNEL" << endl;
1299                                  if (audioDeviceMap.isEmpty()) {                                  if (audioDeviceMap.isEmpty()) {
# Line 1241  bool MainForm::saveSessionFile ( const Q Line 1301  bool MainForm::saveSessionFile ( const Q
1301                                                  << " " << pChannel->audioDriver() << endl;                                                  << " " << pChannel->audioDriver() << endl;
1302                                  } else {                                  } else {
1303                                          ts << "SET CHANNEL AUDIO_OUTPUT_DEVICE " << iChannelID                                          ts << "SET CHANNEL AUDIO_OUTPUT_DEVICE " << iChannelID
1304                                                  << " " << audioDeviceMap[pChannel->audioDevice()] << endl;                                                  << " " << audioDeviceMap.value(iAudioDevice) << endl;
1305                                  }                                  }
1306                                  if (midiDeviceMap.isEmpty()) {                                  if (midiDeviceMap.isEmpty()) {
1307                                          ts << "SET CHANNEL MIDI_INPUT_TYPE " << iChannelID                                          ts << "SET CHANNEL MIDI_INPUT_TYPE " << iChannelID
1308                                                  << " " << pChannel->midiDriver() << endl;                                                  << " " << pChannel->midiDriver() << endl;
1309                                  } else {                                  } else {
1310                                          ts << "SET CHANNEL MIDI_INPUT_DEVICE " << iChannelID                                          ts << "SET CHANNEL MIDI_INPUT_DEVICE " << iChannelID
1311                                                  << " " << midiDeviceMap[pChannel->midiDevice()] << endl;                                                  << " " << midiDeviceMap.value(iMidiDevice) << endl;
1312                                  }                                  }
1313                                  ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannelID                                  ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannelID
1314                                          << " " << pChannel->midiPort() << endl;                                          << " " << pChannel->midiPort() << endl;
# Line 1279  bool MainForm::saveSessionFile ( const Q Line 1339  bool MainForm::saveSessionFile ( const Q
1339                                  if (pChannel->channelSolo())                                  if (pChannel->channelSolo())
1340                                          ts << "SET CHANNEL SOLO " << iChannelID << " 1" << endl;                                          ts << "SET CHANNEL SOLO " << iChannelID << " 1" << endl;
1341                          #ifdef CONFIG_MIDI_INSTRUMENT                          #ifdef CONFIG_MIDI_INSTRUMENT
1342                                  if (pChannel->midiMap() >= 0) {                                  const int iMidiMap = pChannel->midiMap();
1343                                    if (midiInstrumentMap.contains(iMidiMap)) {
1344                                          ts << "SET CHANNEL MIDI_INSTRUMENT_MAP " << iChannelID                                          ts << "SET CHANNEL MIDI_INSTRUMENT_MAP " << iChannelID
1345                                                  << " " << midiInstrumentMap[pChannel->midiMap()] << endl;                                                  << " " << midiInstrumentMap.value(iMidiMap) << endl;
1346                                  }                                  }
1347                          #endif                          #endif
1348                          #ifdef CONFIG_FXSEND                          #ifdef CONFIG_FXSEND
# Line 1320  bool MainForm::saveSessionFile ( const Q Line 1381  bool MainForm::saveSessionFile ( const Q
1381                                  }                                  }
1382                          #endif                          #endif
1383                                  ts << endl;                                  ts << endl;
1384                                    // Go for next channel...
1385                                    ++iChannelID;
1386                          }                          }
1387                  }                  }
1388                  // Try to keep it snappy :)                  // Try to keep it snappy :)
# Line 1960  void MainForm::helpAboutQt (void) Line 2023  void MainForm::helpAboutQt (void)
2023  // Show information about application program.  // Show information about application program.
2024  void MainForm::helpAbout (void)  void MainForm::helpAbout (void)
2025  {  {
2026          // Stuff the about box text...          QStringList list;
         QString sText = "<p>\n";  
         sText += "<b>" QSAMPLER_TITLE " - " + tr(QSAMPLER_SUBTITLE) + "</b><br />\n";  
         sText += "<br />\n";  
         sText += tr("Version") + ": <b>" CONFIG_BUILD_VERSION "</b><br />\n";  
         sText += "<small>" + tr("Build") + ": " CONFIG_BUILD_DATE "</small><br />\n";  
2027  #ifdef CONFIG_DEBUG  #ifdef CONFIG_DEBUG
2028          sText += "<small><font color=\"red\">";          list << tr("Debugging option enabled.");
         sText += tr("Debugging option enabled.");  
         sText += "</font></small><br />";  
2029  #endif  #endif
2030  #ifndef CONFIG_LIBGIG  #ifndef CONFIG_LIBGIG
2031          sText += "<small><font color=\"red\">";          list << tr("GIG (libgig) file support disabled.");
         sText += tr("GIG (libgig) file support disabled.");  
         sText += "</font></small><br />";  
2032  #endif  #endif
2033  #ifndef CONFIG_INSTRUMENT_NAME  #ifndef CONFIG_INSTRUMENT_NAME
2034          sText += "<small><font color=\"red\">";          list << tr("LSCP (liblscp) instrument_name support disabled.");
         sText += tr("LSCP (liblscp) instrument_name support disabled.");  
         sText += "</font></small><br />";  
2035  #endif  #endif
2036  #ifndef CONFIG_MUTE_SOLO  #ifndef CONFIG_MUTE_SOLO
2037          sText += "<small><font color=\"red\">";          list << tr("Sampler channel Mute/Solo support disabled.");
         sText += tr("Sampler channel Mute/Solo support disabled.");  
         sText += "</font></small><br />";  
2038  #endif  #endif
2039  #ifndef CONFIG_AUDIO_ROUTING  #ifndef CONFIG_AUDIO_ROUTING
2040          sText += "<small><font color=\"red\">";          list << tr("LSCP (liblscp) audio_routing support disabled.");
         sText += tr("LSCP (liblscp) audio_routing support disabled.");  
         sText += "</font></small><br />";  
2041  #endif  #endif
2042  #ifndef CONFIG_FXSEND  #ifndef CONFIG_FXSEND
2043          sText += "<small><font color=\"red\">";          list << tr("Sampler channel Effect Sends support disabled.");
         sText += tr("Sampler channel Effect Sends support disabled.");  
         sText += "</font></small><br />";  
2044  #endif  #endif
2045  #ifndef CONFIG_VOLUME  #ifndef CONFIG_VOLUME
2046          sText += "<small><font color=\"red\">";          list << tr("Global volume support disabled.");
         sText += tr("Global volume support disabled.");  
         sText += "</font></small><br />";  
2047  #endif  #endif
2048  #ifndef CONFIG_MIDI_INSTRUMENT  #ifndef CONFIG_MIDI_INSTRUMENT
2049          sText += "<small><font color=\"red\">";          list << tr("MIDI instrument mapping support disabled.");
         sText += tr("MIDI instrument mapping support disabled.");  
         sText += "</font></small><br />";  
2050  #endif  #endif
2051  #ifndef CONFIG_EDIT_INSTRUMENT  #ifndef CONFIG_EDIT_INSTRUMENT
2052          sText += "<small><font color=\"red\">";          list << tr("Instrument editing support disabled.");
         sText += tr("Instrument editing support disabled.");  
         sText += "</font></small><br />";  
2053  #endif  #endif
2054  #ifndef CONFIG_EVENT_CHANNEL_MIDI  #ifndef CONFIG_EVENT_CHANNEL_MIDI
2055          sText += "<small><font color=\"red\">";          list << tr("Channel MIDI event support disabled.");
         sText += tr("Channel MIDI event support disabled.");  
         sText += "</font></small><br />";  
2056  #endif  #endif
2057  #ifndef CONFIG_EVENT_DEVICE_MIDI  #ifndef CONFIG_EVENT_DEVICE_MIDI
2058          sText += "<small><font color=\"red\">";          list << tr("Device MIDI event support disabled.");
         sText += tr("Device MIDI event support disabled.");  
         sText += "</font></small><br />";  
2059  #endif  #endif
2060  #ifndef CONFIG_MAX_VOICES  #ifndef CONFIG_MAX_VOICES
2061          sText += "<small><font color=\"red\">";          list << tr("Runtime max. voices / disk streams support disabled.");
         sText += tr("Runtime max. voices / disk streams support disabled.");  
         sText += "</font></small><br />";  
2062  #endif  #endif
2063    
2064            // Stuff the about box text...
2065            QString sText = "<p>\n";
2066            sText += "<b>" QSAMPLER_TITLE " - " + tr(QSAMPLER_SUBTITLE) + "</b><br />\n";
2067            sText += "<br />\n";
2068            sText += tr("Version") + ": <b>" CONFIG_BUILD_VERSION "</b><br />\n";
2069    //      sText += "<small>" + tr("Build") + ": " CONFIG_BUILD_DATE "</small><br />\n";
2070            if (!list.isEmpty()) {
2071                    sText += "<small><font color=\"red\">";
2072                    sText += list.join("<br />\n");
2073                    sText += "</font></small>";
2074            }
2075          sText += "<br />\n";          sText += "<br />\n";
2076          sText += tr("Using") + ": ";          sText += tr("Using") + ": ";
2077          sText += ::lscp_client_package();          sText += ::lscp_client_package();
# Line 2820  void MainForm::startServer (void) Line 2866  void MainForm::startServer (void)
2866    
2867          // OK. Let's build the startup process...          // OK. Let's build the startup process...
2868          m_pServer = new QProcess();          m_pServer = new QProcess();
2869          bForceServerStop = true;          m_bForceServerStop = true;
2870    
2871          // Setup stdout/stderr capture...          // Setup stdout/stderr capture...
2872          m_pServer->setProcessChannelMode(QProcess::ForwardedChannels);          m_pServer->setProcessChannelMode(QProcess::ForwardedChannels);
# Line 2864  void MainForm::startServer (void) Line 2910  void MainForm::startServer (void)
2910    
2911    
2912  // Stop linuxsampler server...  // Stop linuxsampler server...
2913  void MainForm::stopServer (bool bInteractive)  void MainForm::stopServer ( bool bInteractive )
2914  {  {
2915          // Stop client code.          // Stop client code.
2916          stopClient();          stopClient();
# Line 2878  void MainForm::stopServer (bool bInterac Line 2924  void MainForm::stopServer (bool bInterac
2924                          "sampler session at any time by relaunching QSampler.\n\n"                          "sampler session at any time by relaunching QSampler.\n\n"
2925                          "Do you want LinuxSampler to stop?"),                          "Do you want LinuxSampler to stop?"),
2926                          QMessageBox::Yes | QMessageBox::No,                          QMessageBox::Yes | QMessageBox::No,
2927                          QMessageBox::Yes) == QMessageBox::No)                          QMessageBox::Yes) == QMessageBox::No) {
2928                  {                          m_bForceServerStop = false;
                         bForceServerStop = false;  
2929                  }                  }
2930          }          }
2931    
2932            bool bGraceWait = true;
2933    
2934          // And try to stop server.          // And try to stop server.
2935          if (m_pServer && bForceServerStop) {          if (m_pServer && m_bForceServerStop) {
2936                  appendMessages(tr("Server is stopping..."));                  appendMessages(tr("Server is stopping..."));
2937                  if (m_pServer->state() == QProcess::Running) {                  if (m_pServer->state() == QProcess::Running) {
2938                  #if defined(WIN32)                  #if defined(__WIN32__) || defined(_WIN32) || defined(WIN32)
2939                          // Try harder...                          // Try harder...
2940                          m_pServer->kill();                          m_pServer->kill();
2941                  #else                  #else
2942                          // Try softly...                          // Try softly...
2943                          m_pServer->terminate();                          m_pServer->terminate();
2944                            bool bFinished = m_pServer->waitForFinished(QSAMPLER_TIMER_MSECS * 1000);
2945                            if (bFinished) bGraceWait = false;
2946                  #endif                  #endif
2947                  }                  }
2948          }       // Do final processing anyway.          }       // Do final processing anyway.
2949          else processServerExit();          else processServerExit();
2950    
2951          // Give it some time to terminate gracefully and stabilize...          // Give it some time to terminate gracefully and stabilize...
2952          QTime t;          if (bGraceWait) {
2953          t.start();                  QTime t;
2954          while (t.elapsed() < QSAMPLER_TIMER_MSECS)                  t.start();
2955                  QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);                  while (t.elapsed() < QSAMPLER_TIMER_MSECS)
2956                            QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
2957            }
2958  }  }
2959    
2960    
# Line 2925  void MainForm::processServerExit (void) Line 2976  void MainForm::processServerExit (void)
2976          if (m_pMessages)          if (m_pMessages)
2977                  m_pMessages->flushStdoutBuffer();                  m_pMessages->flushStdoutBuffer();
2978    
2979          if (m_pServer && bForceServerStop) {          if (m_pServer && m_bForceServerStop) {
2980                  if (m_pServer->state() != QProcess::NotRunning) {                  if (m_pServer->state() != QProcess::NotRunning) {
2981                          appendMessages(tr("Server is being forced..."));                          appendMessages(tr("Server is being forced..."));
2982                          // Force final server shutdown...                          // Force final server shutdown...
# Line 3002  bool MainForm::startClient (void) Line 3053  bool MainForm::startClient (void)
3053                  stabilizeForm();                  stabilizeForm();
3054                  return false;                  return false;
3055          }          }
3056    
3057          // Just set receive timeout value, blindly.          // Just set receive timeout value, blindly.
3058          ::lscp_client_set_timeout(m_pClient, m_pOptions->iServerTimeout);          ::lscp_client_set_timeout(m_pClient, m_pOptions->iServerTimeout);
3059          appendMessages(          appendMessages(
# Line 3057  bool MainForm::startClient (void) Line 3109  bool MainForm::startClient (void)
3109          if (!m_pOptions->sSessionFile.isEmpty()) {          if (!m_pOptions->sSessionFile.isEmpty()) {
3110                  // Just load the prabably startup session...                  // Just load the prabably startup session...
3111                  if (loadSessionFile(m_pOptions->sSessionFile)) {                  if (loadSessionFile(m_pOptions->sSessionFile)) {
3112                          m_pOptions->sSessionFile = QString::null;                          m_pOptions->sSessionFile = QString();
3113                          return true;                          return true;
3114                  }                  }
3115          }          }

Legend:
Removed from v.3038  
changed lines
  Added in v.3518

  ViewVC Help
Powered by ViewVC