Skip to content

Commit

Permalink
hide dtls widgets if they are not supported
Browse files Browse the repository at this point in the history
  • Loading branch information
dannagle committed Oct 31, 2024
1 parent e160d16 commit 650a9d2
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 19 deletions.
10 changes: 9 additions & 1 deletion src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ MainWindow::MainWindow(QWidget *parent) :

stopResendingButton->hide();


dtlsServerStatus = new QPushButton("DTLS:" + packetNetwork.getDTLSPortString());
themeTheButton(dtlsServerStatus);
dtlsServerStatus->setIcon(QIcon(DTLSRXICON));
Expand All @@ -309,7 +310,14 @@ MainWindow::MainWindow(QWidget *parent) :
this, SLOT(toggleDTLSServer()));


statusBar()->insertPermanentWidget(2, dtlsServerStatus);

if(PacketNetwork::DTLSisSupported()) {
statusBar()->insertPermanentWidget(2, dtlsServerStatus);
}





udpServerStatus = new QPushButton("UDP:" + packetNetwork.getUDPPortString());
themeTheButton(udpServerStatus);
Expand Down
9 changes: 9 additions & 0 deletions src/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,15 @@ Settings::Settings(QWidget *parent, MainWindow* mw) :
QList<int> tcpList = portsToIntList(settings.value("tcpPort", "0").toString());
QList<int> sslList = portsToIntList(settings.value("sslPort", "0").toString());


if(!PacketNetwork::DTLSisSupported()) {
ui->dtlsServerPortEdit->hide();
ui->dtlsServerEnableCheck->hide();
ui->dtlsServerLabel->hide();
ui->sendSimpleAck->hide();
}


ui->udpServerPortEdit->setText(intListToPorts(udpList));
ui->tcpServerPortEdit->setText(intListToPorts(tcpList));
ui->sslServerPortEdit->setText(intListToPorts(sslList));
Expand Down
36 changes: 18 additions & 18 deletions src/settings.ui
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout_24">
<item>
<widget class="QLabel" name="label_23">
<widget class="QLabel" name="dtlsServerLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
Expand All @@ -130,7 +130,7 @@
<item>
<widget class="QLineEdit" name="dtlsServerPortEdit">
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
<enum>Qt::LayoutDirection::LeftToRight</enum>
</property>
<property name="text">
<string>0</string>
Expand Down Expand Up @@ -438,7 +438,7 @@
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
Expand Down Expand Up @@ -470,7 +470,7 @@
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
Expand Down Expand Up @@ -533,7 +533,7 @@
<item>
<widget class="QTableWidget" name="httpCredentialTable">
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
<enum>QAbstractItemView::SelectionBehavior::SelectRows</enum>
</property>
</widget>
</item>
Expand All @@ -542,7 +542,7 @@
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
Expand Down Expand Up @@ -633,7 +633,7 @@
<item>
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
Expand Down Expand Up @@ -717,7 +717,7 @@
<item>
<spacer name="verticalSpacer_6">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
Expand All @@ -730,7 +730,7 @@
<item>
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
Expand Down Expand Up @@ -762,7 +762,7 @@
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
Expand Down Expand Up @@ -977,10 +977,10 @@
<item>
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
<enum>QFrame::Shape::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
<enum>QFrame::Shadow::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
Expand Down Expand Up @@ -1030,7 +1030,7 @@
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
Expand Down Expand Up @@ -1071,7 +1071,7 @@
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
Expand All @@ -1089,7 +1089,7 @@
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
Expand All @@ -1115,7 +1115,7 @@
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
Expand All @@ -1128,10 +1128,10 @@
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
<set>QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok</set>
</property>
</widget>
</item>
Expand Down

0 comments on commit 650a9d2

Please sign in to comment.