/[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 3668 by schoenebeck, Sun Dec 22 13:47:40 2019 UTC
# Line 2792  void MainForm::timerSlot (void) Line 2792  void MainForm::timerSlot (void)
2792                                  }                                  }
2793                          }                          }
2794                  }                  }
2795    
2796    #if CONFIG_LSCP_CLIENT_CONNECTION_LOST
2797                    // If we lost connection to server: Try to automatically reconnect if we
2798                    // did not start the server.
2799                    //
2800                    // TODO: If we started the server, then we might inform the user that
2801                    // the server probably crashed and asking user ONCE whether we should
2802                    // restart the server.
2803                    if (lscp_client_connection_lost(m_pClient) && !m_pServer)
2804                            startAutoReconnectClient();
2805    #endif // CONFIG_LSCP_CLIENT_CONNECTION_LOST
2806          }          }
2807    
2808          // Register the next timer slot.          // Register the next timer slot.
# Line 2990  lscp_status_t qsampler_client_callback ( Line 3001  lscp_status_t qsampler_client_callback (
3001    
3002    
3003  // Start our almighty client...  // Start our almighty client...
3004  bool MainForm::startClient (void)  bool MainForm::startClient (bool bReconnectOnly)
3005  {  {
3006          // Have it a setup?          // Have it a setup?
3007          if (m_pOptions == nullptr)          if (m_pOptions == nullptr)
# Line 3011  bool MainForm::startClient (void) Line 3022  bool MainForm::startClient (void)
3022                  // Is this the first try?                  // Is this the first try?
3023                  // maybe we need to start a local server...                  // maybe we need to start a local server...
3024                  if ((m_pServer && m_pServer->state() == QProcess::Running)                  if ((m_pServer && m_pServer->state() == QProcess::Running)
3025                          || !m_pOptions->bServerStart) {                          || !m_pOptions->bServerStart || bReconnectOnly)
3026                          appendMessagesError(                  {
3027                                  tr("Could not connect to server as client.\n\nSorry."));                          // if this method is called from doAutoReconnect() then don't bother
3028                            // user with an error message
3029                            if (!bReconnectOnly) {
3030                                    appendMessagesError(
3031                                            tr("Could not connect to server as client.\n\nSorry.")
3032                                    );
3033                            }
3034                  } else {                  } else {
3035                          startServer();                          startServer();
3036                  }                  }
# Line 3141  void MainForm::stopClient (void) Line 3158  void MainForm::stopClient (void)
3158          stabilizeForm();          stabilizeForm();
3159  }  }
3160    
3161    void MainForm::startAutoReconnectClient() {
3162            stopClient();
3163            appendMessages("Trying to reconnect.");
3164            QTimer::singleShot(QSAMPLER_TIMER_MSECS, this, SLOT(doAutoReconnectClient()));
3165    }
3166    
3167    void MainForm::doAutoReconnectClient() {
3168            bool success = startClient(true);
3169            if (!success)
3170                    QTimer::singleShot(QSAMPLER_TIMER_MSECS, this, SLOT(doAutoReconnectClient()));
3171    }
3172    
3173    
3174  // Channel strip activation/selection.  // Channel strip activation/selection.
3175  void MainForm::activateStrip ( QMdiSubWindow *pMdiSubWindow )  void MainForm::activateStrip ( QMdiSubWindow *pMdiSubWindow )

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

  ViewVC Help
Powered by ViewVC