Disable various tabs when websocket is disabled

This commit is contained in:
tobtoht
2022-03-15 13:36:20 +01:00
parent 15bed134af
commit b8db796479
10 changed files with 52 additions and 9 deletions
+9
View File
@@ -47,6 +47,8 @@ NodeWidget::NodeWidget(QWidget *parent)
connect(ui->customView, &QTreeView::doubleClicked, this, &NodeWidget::onContextConnect);
connect(ui->wsView, &QTreeView::doubleClicked, this, &NodeWidget::onContextConnect);
this->onWebsocketStatusChanged();
}
void NodeWidget::onShowWSContextMenu(const QPoint &pos) {
@@ -65,6 +67,13 @@ void NodeWidget::onShowCustomContextMenu(const QPoint &pos) {
this->showContextMenu(pos, node);
}
void NodeWidget::onWebsocketStatusChanged() {
bool disabled = config()->get(Config::disableWebsocket).toBool() || config()->get(Config::offlineMode).toBool();
QString labelText = disabled ? "From cached list" : "From websocket (recommended)";
ui->radioButton_websocket->setText(labelText);
ui->wsView->setColumnHidden(1, disabled);
}
void NodeWidget::showContextMenu(const QPoint &pos, const FeatherNode &node) {
QMenu menu(this);