From ae67eeb9f42b882f41f359322863f608e05a568a Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Fri, 13 May 2022 18:58:48 +0200 Subject: Only enable cast button when connection is active (and disable if connection is lost) --- src/mainwindow.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/mainwindow.cc b/src/mainwindow.cc index 1e988bf..a443476 100644 --- a/src/mainwindow.cc +++ b/src/mainwindow.cc @@ -76,6 +76,17 @@ MainWindow::MainWindow(Database& db) const auto& html = viewer->getHtml(); client.writeData(title, html.toUtf8()); }); + act->setEnabled(false); + QObject::connect(&client, &Client::isConnected, + [act]() + { + act->setEnabled(true); + }); + QObject::connect(&client, &Client::isDisconnected, + [act]() + { + act->setEnabled(false); + }); } addToolBar(Qt::TopToolBarArea, toolbar); -- cgit v1.2.3