https option in settings page, and make settings page scrollable

This commit is contained in:
2026-05-26 17:30:10 +08:00
parent d9751a82ff
commit 3a0529edf8
3 changed files with 139 additions and 85 deletions

View File

@@ -165,6 +165,24 @@ void AppController::setDeviceType(const QString& type)
} }
} }
bool AppController::https() const
{
return m_settings->https();
}
void AppController::setHttps(bool enabled)
{
if (m_settings->https() != enabled) {
m_settings->setHttps(enabled);
emit httpsChanged();
LocalSend::InfoDto info = buildInfoDto();
m_server->setLocalInfo(info, m_security->fingerprint());
m_discovery->setLocalInfo(info, m_security->fingerprint(), m_settings->port(),
enabled ? LocalSend::ProtocolType::Https : LocalSend::ProtocolType::Http);
}
}
QVariantList AppController::devices() const QVariantList AppController::devices() const
{ {
QVariantList result; QVariantList result;

View File

@@ -34,6 +34,7 @@ class AppController : public QObject
Q_PROPERTY(int totalReceiveFiles READ totalReceiveFiles NOTIFY receivingChanged) Q_PROPERTY(int totalReceiveFiles READ totalReceiveFiles NOTIFY receivingChanged)
Q_PROPERTY(QString currentReceiveSenderAlias READ currentReceiveSenderAlias NOTIFY receivingChanged) Q_PROPERTY(QString currentReceiveSenderAlias READ currentReceiveSenderAlias NOTIFY receivingChanged)
Q_PROPERTY(QString deviceType READ deviceType WRITE setDeviceType NOTIFY deviceTypeChanged) Q_PROPERTY(QString deviceType READ deviceType WRITE setDeviceType NOTIFY deviceTypeChanged)
Q_PROPERTY(bool https READ https WRITE setHttps NOTIFY httpsChanged)
public: public:
explicit AppController(QObject* parent = nullptr); explicit AppController(QObject* parent = nullptr);
@@ -76,6 +77,9 @@ public:
QString deviceType() const; QString deviceType() const;
void setDeviceType(const QString& type); void setDeviceType(const QString& type);
bool https() const;
void setHttps(bool enabled);
Q_INVOKABLE void startDiscovery(); Q_INVOKABLE void startDiscovery();
Q_INVOKABLE void stopDiscovery(); Q_INVOKABLE void stopDiscovery();
Q_INVOKABLE void refreshDevices(); Q_INVOKABLE void refreshDevices();
@@ -116,6 +120,7 @@ signals:
void receivingChanged(); void receivingChanged();
void receiveProgressChanged(); void receiveProgressChanged();
void deviceTypeChanged(); void deviceTypeChanged();
void httpsChanged();
private slots: private slots:
void onDeviceDiscovered(const LocalSend::Device& device); void onDeviceDiscovered(const LocalSend::Device& device);

View File

@@ -735,6 +735,16 @@ ApplicationWindow {
anchors.margins: 16 anchors.margins: 16
spacing: 16 spacing: 16
ScrollView {
Layout.fillWidth: true
Layout.fillHeight: true
contentWidth: availableWidth
clip: true
ColumnLayout {
width: parent.width
spacing: 16
GridLayout { GridLayout {
columns: 2 columns: 2
Layout.fillWidth: true Layout.fillWidth: true
@@ -825,6 +835,28 @@ ApplicationWindow {
} }
} }
CheckBox {
id: advancedCheck
Layout.fillWidth: true
text: qsTr("Advanced Options")
checked: false
}
GridLayout {
columns: 2
Layout.fillWidth: true
visible: advancedCheck.checked
Label { text: qsTr("HTTPS:") }
CheckBox {
id: httpsCheck
checked: appController.https
onCheckedChanged: appController.https = checked
}
}
}
}
FolderDialog { FolderDialog {
id: folderDialog id: folderDialog
onAccepted: { onAccepted: {
@@ -833,9 +865,8 @@ ApplicationWindow {
} }
} }
Item { Layout.fillHeight: true }
Label { Label {
Layout.fillWidth: true
text: qsTr("Server Status: %1").arg(appController.serverRunning ? qsTr("Running") : qsTr("Stopped")) text: qsTr("Server Status: %1").arg(appController.serverRunning ? qsTr("Running") : qsTr("Stopped"))
color: appController.serverRunning ? "green" : "red" color: appController.serverRunning ? "green" : "red"
} }