/[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 3613 by capela, Tue Oct 1 08:35:49 2019 UTC revision 3758 by capela, Fri Mar 27 17:57:40 2020 UTC
# Line 1  Line 1 
1  // qsamplerMainForm.cpp  // qsamplerMainForm.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,2008,2015 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
8     modify it under the terms of the GNU General Public License     modify it under the terms of the GNU General Public License
# Line 58  Line 58 
58  #include <QTimer>  #include <QTimer>
59  #include <QDateTime>  #include <QDateTime>
60    
61    #include <QElapsedTimer>
62    
63  #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)  #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
64  #include <QMimeData>  #include <QMimeData>
65  #endif  #endif
# Line 1089  bool MainForm::saveSessionFile ( const Q Line 1091  bool MainForm::saveSessionFile ( const Q
1091          // Write the file.          // Write the file.
1092          int iErrors = 0;          int iErrors = 0;
1093          QTextStream ts(&file);          QTextStream ts(&file);
1094          ts << "# " << QSAMPLER_TITLE " - " << tr(QSAMPLER_SUBTITLE) << endl;          ts << "# " << QSAMPLER_TITLE " - " << tr(QSAMPLER_SUBTITLE) << Qt::endl;
1095          ts << "# " << tr("Version") << ": " CONFIG_BUILD_VERSION << endl;          ts << "# " << tr("Version") << ": " CONFIG_BUILD_VERSION << Qt::endl;
1096  //      ts << "# " << tr("Build") << ": " CONFIG_BUILD_DATE << endl;  //      ts << "# " << tr("Build") << ": " CONFIG_BUILD_DATE << Qt::endl;
1097          ts << "#"  << endl;          ts << "#"  << Qt::endl;
1098          ts << "# " << tr("File")          ts << "# " << tr("File")
1099          << ": " << QFileInfo(sFilename).fileName() << endl;          << ": " << QFileInfo(sFilename).fileName() << Qt::endl;
1100          ts << "# " << tr("Date")          ts << "# " << tr("Date")
1101          << ": " << QDate::currentDate().toString("MMM dd yyyy")          << ": " << QDate::currentDate().toString("MMM dd yyyy")
1102          << " "  << QTime::currentTime().toString("hh:mm:ss") << endl;          << " "  << QTime::currentTime().toString("hh:mm:ss") << Qt::endl;
1103          ts << "#"  << endl;          ts << "#"  << Qt::endl;
1104          ts << endl;          ts << Qt::endl;
1105    
1106          // It is assumed that this new kind of device+session file          // It is assumed that this new kind of device+session file
1107          // will be loaded from a complete initialized server...          // will be loaded from a complete initialized server...
1108          int *piDeviceIDs;          int *piDeviceIDs;
1109          int  i, iDevice;          int  i, iDevice;
1110          ts << "RESET" << endl;          ts << "RESET" << Qt::endl;
1111    
1112          // Audio device mapping.          // Audio device mapping.
1113          QMap<int, int> audioDeviceMap; iDevice = 0;          QMap<int, int> audioDeviceMap; iDevice = 0;
# Line 1116  bool MainForm::saveSessionFile ( const Q Line 1118  bool MainForm::saveSessionFile ( const Q
1118                  if (device.driverName().toUpper() == "PLUGIN")                  if (device.driverName().toUpper() == "PLUGIN")
1119                          continue;                          continue;
1120                  // Audio device specification...                  // Audio device specification...
1121                  ts << endl;                  ts << Qt::endl;
1122                  ts << "# " << device.deviceTypeName() << " " << device.driverName()                  ts << "# " << device.deviceTypeName() << " " << device.driverName()
1123                          << " " << tr("Device") << " " << iDevice << endl;                          << " " << tr("Device") << " " << iDevice << Qt::endl;
1124                  ts << "CREATE AUDIO_OUTPUT_DEVICE " << device.driverName();                  ts << "CREATE AUDIO_OUTPUT_DEVICE " << device.driverName();
1125                  DeviceParamMap::ConstIterator deviceParam;                  DeviceParamMap::ConstIterator deviceParam;
1126                  for (deviceParam = device.params().begin();                  for (deviceParam = device.params().begin();
# Line 1128  bool MainForm::saveSessionFile ( const Q Line 1130  bool MainForm::saveSessionFile ( const Q
1130                          if (param.value.isEmpty()) ts << "# ";                          if (param.value.isEmpty()) ts << "# ";
1131                          ts << " " << deviceParam.key() << "='" << param.value << "'";                          ts << " " << deviceParam.key() << "='" << param.value << "'";
1132                  }                  }
1133                  ts << endl;                  ts << Qt::endl;
1134                  // Audio channel parameters...                  // Audio channel parameters...
1135                  int iPort = 0;                  int iPort = 0;
1136                  QListIterator<DevicePort *> iter(device.ports());                  QListIterator<DevicePort *> iter(device.ports());
# Line 1142  bool MainForm::saveSessionFile ( const Q Line 1144  bool MainForm::saveSessionFile ( const Q
1144                                  if (param.fix || param.value.isEmpty()) ts << "# ";                                  if (param.fix || param.value.isEmpty()) ts << "# ";
1145                                  ts << "SET AUDIO_OUTPUT_CHANNEL_PARAMETER " << iDevice                                  ts << "SET AUDIO_OUTPUT_CHANNEL_PARAMETER " << iDevice
1146                                          << " " << iPort << " " << portParam.key()                                          << " " << iPort << " " << portParam.key()
1147                                          << "='" << param.value << "'" << endl;                                          << "='" << param.value << "'" << Qt::endl;
1148                          }                          }
1149                          iPort++;                          iPort++;
1150                  }                  }
# Line 1161  bool MainForm::saveSessionFile ( const Q Line 1163  bool MainForm::saveSessionFile ( const Q
1163                  if (device.driverName().toUpper() == "PLUGIN")                  if (device.driverName().toUpper() == "PLUGIN")
1164                          continue;                          continue;
1165                  // MIDI device specification...                  // MIDI device specification...
1166                  ts << endl;                  ts << Qt::endl;
1167                  ts << "# " << device.deviceTypeName() << " " << device.driverName()                  ts << "# " << device.deviceTypeName() << " " << device.driverName()
1168                          << " " << tr("Device") << " " << iDevice << endl;                          << " " << tr("Device") << " " << iDevice << Qt::endl;
1169                  ts << "CREATE MIDI_INPUT_DEVICE " << device.driverName();                  ts << "CREATE MIDI_INPUT_DEVICE " << device.driverName();
1170                  DeviceParamMap::ConstIterator deviceParam;                  DeviceParamMap::ConstIterator deviceParam;
1171                  for (deviceParam = device.params().begin();                  for (deviceParam = device.params().begin();
# Line 1173  bool MainForm::saveSessionFile ( const Q Line 1175  bool MainForm::saveSessionFile ( const Q
1175                          if (param.value.isEmpty()) ts << "# ";                          if (param.value.isEmpty()) ts << "# ";
1176                          ts << " " << deviceParam.key() << "='" << param.value << "'";                          ts << " " << deviceParam.key() << "='" << param.value << "'";
1177                  }                  }
1178                  ts << endl;                  ts << Qt::endl;
1179                  // MIDI port parameters...                  // MIDI port parameters...
1180                  int iPort = 0;                  int iPort = 0;
1181                  QListIterator<DevicePort *> iter(device.ports());                  QListIterator<DevicePort *> iter(device.ports());
# Line 1187  bool MainForm::saveSessionFile ( const Q Line 1189  bool MainForm::saveSessionFile ( const Q
1189                                  if (param.fix || param.value.isEmpty()) ts << "# ";                                  if (param.fix || param.value.isEmpty()) ts << "# ";
1190                                  ts << "SET MIDI_INPUT_PORT_PARAMETER " << iDevice                                  ts << "SET MIDI_INPUT_PORT_PARAMETER " << iDevice
1191                                  << " " << iPort << " " << portParam.key()                                  << " " << iPort << " " << portParam.key()
1192                                  << "='" << param.value << "'" << endl;                                  << "='" << param.value << "'" << Qt::endl;
1193                          }                          }
1194                          iPort++;                          iPort++;
1195                  }                  }
# Line 1196  bool MainForm::saveSessionFile ( const Q Line 1198  bool MainForm::saveSessionFile ( const Q
1198                  // Try to keep it snappy :)                  // Try to keep it snappy :)
1199                  QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);                  QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
1200          }          }
1201          ts << endl;          ts << Qt::endl;
1202    
1203  #ifdef CONFIG_MIDI_INSTRUMENT  #ifdef CONFIG_MIDI_INSTRUMENT
1204          // MIDI instrument mapping...          // MIDI instrument mapping...
# Line 1209  bool MainForm::saveSessionFile ( const Q Line 1211  bool MainForm::saveSessionFile ( const Q
1211                  ts << "# " << tr("MIDI instrument map") << " " << iMap;                  ts << "# " << tr("MIDI instrument map") << " " << iMap;
1212                  if (pszMapName)                  if (pszMapName)
1213                          ts << " - " << pszMapName;                          ts << " - " << pszMapName;
1214                  ts << endl;                  ts << Qt::endl;
1215                  ts << "ADD MIDI_INSTRUMENT_MAP";                  ts << "ADD MIDI_INSTRUMENT_MAP";
1216                  if (pszMapName)                  if (pszMapName)
1217                          ts << " '" << pszMapName << "'";                          ts << " '" << pszMapName << "'";
1218                  ts << endl;                  ts << Qt::endl;
1219                  // MIDI instrument mapping...                  // MIDI instrument mapping...
1220                  lscp_midi_instrument_t *pInstrs                  lscp_midi_instrument_t *pInstrs
1221                          = ::lscp_list_midi_instruments(m_pClient, iMidiMap);                          = ::lscp_list_midi_instruments(m_pClient, iMidiMap);
# Line 1244  bool MainForm::saveSessionFile ( const Q Line 1246  bool MainForm::saveSessionFile ( const Q
1246                                  }                                  }
1247                                  if (pInstrInfo->name)                                  if (pInstrInfo->name)
1248                                          ts << " '" << pInstrInfo->name << "'";                                          ts << " '" << pInstrInfo->name << "'";
1249                                  ts << endl;                                  ts << Qt::endl;
1250                          }       // Check for errors...                          }       // Check for errors...
1251                          else if (::lscp_client_get_errno(m_pClient)) {                          else if (::lscp_client_get_errno(m_pClient)) {
1252                                  appendMessagesClient("lscp_get_midi_instrument_info");                                  appendMessagesClient("lscp_get_midi_instrument_info");
# Line 1253  bool MainForm::saveSessionFile ( const Q Line 1255  bool MainForm::saveSessionFile ( const Q
1255                          // Try to keep it snappy :)                          // Try to keep it snappy :)
1256                          QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);                          QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
1257                  }                  }
1258                  ts << endl;                  ts << Qt::endl;
1259                  // Check for errors...                  // Check for errors...
1260                  if (pInstrs == nullptr && ::lscp_client_get_errno(m_pClient)) {                  if (pInstrs == nullptr && ::lscp_client_get_errno(m_pClient)) {
1261                          appendMessagesClient("lscp_list_midi_instruments");                          appendMessagesClient("lscp_list_midi_instruments");
# Line 1287  bool MainForm::saveSessionFile ( const Q Line 1289  bool MainForm::saveSessionFile ( const Q
1289                                  if (!midiDeviceMap.contains(iMidiDevice))                                  if (!midiDeviceMap.contains(iMidiDevice))
1290                                          continue;                                          continue;
1291                                  // Go for regular, canonical devices...                                  // Go for regular, canonical devices...
1292                                  ts << "# " << tr("Channel") << " " << iChannelID << endl;                                  ts << "# " << tr("Channel") << " " << iChannelID << Qt::endl;
1293                                  ts << "ADD CHANNEL" << endl;                                  ts << "ADD CHANNEL" << Qt::endl;
1294                                  if (audioDeviceMap.isEmpty()) {                                  if (audioDeviceMap.isEmpty()) {
1295                                          ts << "SET CHANNEL AUDIO_OUTPUT_TYPE " << iChannelID                                          ts << "SET CHANNEL AUDIO_OUTPUT_TYPE " << iChannelID
1296                                                  << " " << pChannel->audioDriver() << endl;                                                  << " " << pChannel->audioDriver() << Qt::endl;
1297                                  } else {                                  } else {
1298                                          ts << "SET CHANNEL AUDIO_OUTPUT_DEVICE " << iChannelID                                          ts << "SET CHANNEL AUDIO_OUTPUT_DEVICE " << iChannelID
1299                                                  << " " << audioDeviceMap.value(iAudioDevice) << endl;                                                  << " " << audioDeviceMap.value(iAudioDevice) << Qt::endl;
1300                                  }                                  }
1301                                  if (midiDeviceMap.isEmpty()) {                                  if (midiDeviceMap.isEmpty()) {
1302                                          ts << "SET CHANNEL MIDI_INPUT_TYPE " << iChannelID                                          ts << "SET CHANNEL MIDI_INPUT_TYPE " << iChannelID
1303                                                  << " " << pChannel->midiDriver() << endl;                                                  << " " << pChannel->midiDriver() << Qt::endl;
1304                                  } else {                                  } else {
1305                                          ts << "SET CHANNEL MIDI_INPUT_DEVICE " << iChannelID                                          ts << "SET CHANNEL MIDI_INPUT_DEVICE " << iChannelID
1306                                                  << " " << midiDeviceMap.value(iMidiDevice) << endl;                                                  << " " << midiDeviceMap.value(iMidiDevice) << Qt::endl;
1307                                  }                                  }
1308                                  ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannelID                                  ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannelID
1309                                          << " " << pChannel->midiPort() << endl;                                          << " " << pChannel->midiPort() << Qt::endl;
1310                                  ts << "SET CHANNEL MIDI_INPUT_CHANNEL " << iChannelID << " ";                                  ts << "SET CHANNEL MIDI_INPUT_CHANNEL " << iChannelID << " ";
1311                                  if (pChannel->midiChannel() == LSCP_MIDI_CHANNEL_ALL)                                  if (pChannel->midiChannel() == LSCP_MIDI_CHANNEL_ALL)
1312                                          ts << "ALL";                                          ts << "ALL";
1313                                  else                                  else
1314                                          ts << pChannel->midiChannel();                                          ts << pChannel->midiChannel();
1315                                  ts << endl;                                  ts << Qt::endl;
1316                                  ts << "LOAD ENGINE " << pChannel->engineName()                                  ts << "LOAD ENGINE " << pChannel->engineName()
1317                                          << " " << iChannelID << endl;                                          << " " << iChannelID << Qt::endl;
1318                                  if (pChannel->instrumentStatus() < 100) ts << "# ";                                  if (pChannel->instrumentStatus() < 100) ts << "# ";
1319                                  ts << "LOAD INSTRUMENT NON_MODAL '"                                  ts << "LOAD INSTRUMENT NON_MODAL '"
1320                                          << pChannel->instrumentFile() << "' "                                          << pChannel->instrumentFile() << "' "
1321                                          << pChannel->instrumentNr() << " " << iChannelID << endl;                                          << pChannel->instrumentNr() << " " << iChannelID << Qt::endl;
1322                                  ChannelRoutingMap::ConstIterator audioRoute;                                  ChannelRoutingMap::ConstIterator audioRoute;
1323                                  for (audioRoute = pChannel->audioRouting().begin();                                  for (audioRoute = pChannel->audioRouting().begin();
1324                                                  audioRoute != pChannel->audioRouting().end();                                                  audioRoute != pChannel->audioRouting().end();
1325                                                          ++audioRoute) {                                                          ++audioRoute) {
1326                                          ts << "SET CHANNEL AUDIO_OUTPUT_CHANNEL " << iChannelID                                          ts << "SET CHANNEL AUDIO_OUTPUT_CHANNEL " << iChannelID
1327                                                  << " " << audioRoute.key()                                                  << " " << audioRoute.key()
1328                                                  << " " << audioRoute.value() << endl;                                                  << " " << audioRoute.value() << Qt::endl;
1329                                  }                                  }
1330                                  ts << "SET CHANNEL VOLUME " << iChannelID                                  ts << "SET CHANNEL VOLUME " << iChannelID
1331                                          << " " << pChannel->volume() << endl;                                          << " " << pChannel->volume() << Qt::endl;
1332                                  if (pChannel->channelMute())                                  if (pChannel->channelMute())
1333                                          ts << "SET CHANNEL MUTE " << iChannelID << " 1" << endl;                                          ts << "SET CHANNEL MUTE " << iChannelID << " 1" << Qt::endl;
1334                                  if (pChannel->channelSolo())                                  if (pChannel->channelSolo())
1335                                          ts << "SET CHANNEL SOLO " << iChannelID << " 1" << endl;                                          ts << "SET CHANNEL SOLO " << iChannelID << " 1" << Qt::endl;
1336                          #ifdef CONFIG_MIDI_INSTRUMENT                          #ifdef CONFIG_MIDI_INSTRUMENT
1337                                  const int iMidiMap = pChannel->midiMap();                                  const int iMidiMap = pChannel->midiMap();
1338                                  if (midiInstrumentMap.contains(iMidiMap)) {                                  if (midiInstrumentMap.contains(iMidiMap)) {
1339                                          ts << "SET CHANNEL MIDI_INSTRUMENT_MAP " << iChannelID                                          ts << "SET CHANNEL MIDI_INSTRUMENT_MAP " << iChannelID
1340                                                  << " " << midiInstrumentMap.value(iMidiMap) << endl;                                                  << " " << midiInstrumentMap.value(iMidiMap) << Qt::endl;
1341                                  }                                  }
1342                          #endif                          #endif
1343                          #ifdef CONFIG_FXSEND                          #ifdef CONFIG_FXSEND
# Line 1350  bool MainForm::saveSessionFile ( const Q Line 1352  bool MainForm::saveSessionFile ( const Q
1352                                                          << " " << pFxSendInfo->midi_controller;                                                          << " " << pFxSendInfo->midi_controller;
1353                                                  if (pFxSendInfo->name)                                                  if (pFxSendInfo->name)
1354                                                          ts << " '" << pFxSendInfo->name << "'";                                                          ts << " '" << pFxSendInfo->name << "'";
1355                                                  ts << endl;                                                  ts << Qt::endl;
1356                                                  int *piRouting = pFxSendInfo->audio_routing;                                                  int *piRouting = pFxSendInfo->audio_routing;
1357                                                  for (int iAudioSrc = 0;                                                  for (int iAudioSrc = 0;
1358                                                                  piRouting && piRouting[iAudioSrc] >= 0;                                                                  piRouting && piRouting[iAudioSrc] >= 0;
# Line 1359  bool MainForm::saveSessionFile ( const Q Line 1361  bool MainForm::saveSessionFile ( const Q
1361                                                                  << iChannelID                                                                  << iChannelID
1362                                                                  << " " << iFxSend                                                                  << " " << iFxSend
1363                                                                  << " " << iAudioSrc                                                                  << " " << iAudioSrc
1364                                                                  << " " << piRouting[iAudioSrc] << endl;                                                                  << " " << piRouting[iAudioSrc] << Qt::endl;
1365                                                  }                                                  }
1366                                          #ifdef CONFIG_FXSEND_LEVEL                                          #ifdef CONFIG_FXSEND_LEVEL
1367                                                  ts << "SET FX_SEND LEVEL " << iChannelID                                                  ts << "SET FX_SEND LEVEL " << iChannelID
1368                                                          << " " << iFxSend                                                          << " " << iFxSend
1369                                                          << " " << pFxSendInfo->level << endl;                                                          << " " << pFxSendInfo->level << Qt::endl;
1370                                          #endif                                          #endif
1371                                          }       // Check for errors...                                          }       // Check for errors...
1372                                          else if (::lscp_client_get_errno(m_pClient)) {                                          else if (::lscp_client_get_errno(m_pClient)) {
# Line 1373  bool MainForm::saveSessionFile ( const Q Line 1375  bool MainForm::saveSessionFile ( const Q
1375                                          }                                          }
1376                                  }                                  }
1377                          #endif                          #endif
1378                                  ts << endl;                                  ts << Qt::endl;
1379                                  // Go for next channel...                                  // Go for next channel...
1380                                  ++iChannelID;                                  ++iChannelID;
1381                          }                          }
# Line 1383  bool MainForm::saveSessionFile ( const Q Line 1385  bool MainForm::saveSessionFile ( const Q
1385          }          }
1386    
1387  #ifdef CONFIG_VOLUME  #ifdef CONFIG_VOLUME
1388          ts << "# " << tr("Global volume level") << endl;          ts << "# " << tr("Global volume level") << Qt::endl;
1389          ts << "SET VOLUME " << ::lscp_get_volume(m_pClient) << endl;          ts << "SET VOLUME " << ::lscp_get_volume(m_pClient) << Qt::endl;
1390          ts << endl;          ts << Qt::endl;
1391  #endif  #endif
1392    
1393          // Ok. we've wrote it.          // Ok. we've wrote it.
# Line 2792  void MainForm::timerSlot (void) Line 2794  void MainForm::timerSlot (void)
2794                                  }                                  }
2795                          }                          }
2796                  }                  }
2797    
2798            #if CONFIG_LSCP_CLIENT_CONNECTION_LOST
2799                    // If we lost connection to server: Try to automatically reconnect if we
2800                    // did not start the server.
2801                    //
2802                    // TODO: If we started the server, then we might inform the user that
2803                    // the server probably crashed and asking user ONCE whether we should
2804                    // restart the server.
2805                    if (lscp_client_connection_lost(m_pClient) && !m_pServer)
2806                            startAutoReconnectClient();
2807            #endif // CONFIG_LSCP_CLIENT_CONNECTION_LOST
2808          }          }
2809    
2810          // Register the next timer slot.          // Register the next timer slot.
# Line 2918  void MainForm::stopServer ( bool bIntera Line 2931  void MainForm::stopServer ( bool bIntera
2931    
2932          // Give it some time to terminate gracefully and stabilize...          // Give it some time to terminate gracefully and stabilize...
2933          if (bGraceWait) {          if (bGraceWait) {
2934                  QTime t;                  QElapsedTimer timer;
2935                  t.start();                  timer.start();
2936                  while (t.elapsed() < QSAMPLER_TIMER_MSECS)                  while (timer.elapsed() < QSAMPLER_TIMER_MSECS)
2937                          QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);                          QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
2938          }          }
2939  }  }
# Line 2950  void MainForm::processServerExit (void) Line 2963  void MainForm::processServerExit (void)
2963                          // Force final server shutdown...                          // Force final server shutdown...
2964                          m_pServer->kill();                          m_pServer->kill();
2965                          // Give it some time to terminate gracefully and stabilize...                          // Give it some time to terminate gracefully and stabilize...
2966                          QTime t;                          QElapsedTimer timer;
2967                          t.start();                          timer.start();
2968                          while (t.elapsed() < QSAMPLER_TIMER_MSECS)                          while (timer.elapsed() < QSAMPLER_TIMER_MSECS)
2969                                  QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);                                  QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
2970                  }                  }
2971                  // Force final server shutdown...                  // Force final server shutdown...
# Line 2990  lscp_status_t qsampler_client_callback ( Line 3003  lscp_status_t qsampler_client_callback (
3003    
3004    
3005  // Start our almighty client...  // Start our almighty client...
3006  bool MainForm::startClient (void)  bool MainForm::startClient (bool bReconnectOnly)
3007  {  {
3008          // Have it a setup?          // Have it a setup?
3009          if (m_pOptions == nullptr)          if (m_pOptions == nullptr)
# Line 3011  bool MainForm::startClient (void) Line 3024  bool MainForm::startClient (void)
3024                  // Is this the first try?                  // Is this the first try?
3025                  // maybe we need to start a local server...                  // maybe we need to start a local server...
3026                  if ((m_pServer && m_pServer->state() == QProcess::Running)                  if ((m_pServer && m_pServer->state() == QProcess::Running)
3027                          || !m_pOptions->bServerStart) {                          || !m_pOptions->bServerStart || bReconnectOnly)
3028                          appendMessagesError(                  {
3029                                  tr("Could not connect to server as client.\n\nSorry."));                          // if this method is called from autoReconnectClient()
3030                            // then don't bother user with an error message...
3031                            if (!bReconnectOnly) {
3032                                    appendMessagesError(
3033                                            tr("Could not connect to server as client.\n\nSorry.")
3034                                    );
3035                            }
3036                  } else {                  } else {
3037                          startServer();                          startServer();
3038                  }                  }
# Line 3142  void MainForm::stopClient (void) Line 3161  void MainForm::stopClient (void)
3161  }  }
3162    
3163    
3164    void MainForm::startAutoReconnectClient (void)
3165    {
3166            stopClient();
3167            appendMessages(tr("Trying to reconnect..."));
3168            QTimer::singleShot(QSAMPLER_TIMER_MSECS, this, SLOT(autoReconnectClient()));
3169    }
3170    
3171    
3172    void MainForm::autoReconnectClient (void)
3173    {
3174            const bool bSuccess = startClient(true);
3175            if (!bSuccess)
3176                    QTimer::singleShot(QSAMPLER_TIMER_MSECS, this, SLOT(autoReconnectClient()));
3177    }
3178    
3179    
3180  // Channel strip activation/selection.  // Channel strip activation/selection.
3181  void MainForm::activateStrip ( QMdiSubWindow *pMdiSubWindow )  void MainForm::activateStrip ( QMdiSubWindow *pMdiSubWindow )
3182  {  {

Legend:
Removed from v.3613  
changed lines
  Added in v.3758

  ViewVC Help
Powered by ViewVC