jamulus icon indicating copy to clipboard operation
jamulus copied to clipboard

Refactor CClientDlgOnConnectDisconnectBut()

Open ann0see opened this issue 1 year ago • 0 comments

          This should be implemented by switching the `connect` setting for the signal handler for the button, rather than having one signal handler with an if that consults the state of the client.

Button life-cycle:

  • (public) ConnectDlg onClickConnect is connected to (private) ClientDlg onConnectDlgConnect
  • onClickConnect launches ConnectDlg if it's not already open (and nothing else)
  • onConnectDlgConnect disables the button and asks the client to connect to the provided address
  • onConnect switches the onClick handler to onClickDisconnect and enables the button
  • onConnectFailed just enables the button (keeping the onClickConnect handler) -- although, if Client is passing an error, here's where it would get displayed to the user
  • onClickDisconnect disables the button and asks the client to disconnect
  • onDisconnect (which should be handled) switches the onClick handler to onClickDisconnect and enables the button

Originally posted by @pljones in https://github.com/jamulussoftware/jamulus/pull/3372#discussion_r1761635248

ann0see avatar Oct 08 '24 18:10 ann0see