https option in settings page, and make settings page scrollable
This commit is contained in:
@@ -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 result;
|
||||
|
||||
@@ -34,6 +34,7 @@ class AppController : public QObject
|
||||
Q_PROPERTY(int totalReceiveFiles READ totalReceiveFiles NOTIFY receivingChanged)
|
||||
Q_PROPERTY(QString currentReceiveSenderAlias READ currentReceiveSenderAlias NOTIFY receivingChanged)
|
||||
Q_PROPERTY(QString deviceType READ deviceType WRITE setDeviceType NOTIFY deviceTypeChanged)
|
||||
Q_PROPERTY(bool https READ https WRITE setHttps NOTIFY httpsChanged)
|
||||
|
||||
public:
|
||||
explicit AppController(QObject* parent = nullptr);
|
||||
@@ -76,6 +77,9 @@ public:
|
||||
QString deviceType() const;
|
||||
void setDeviceType(const QString& type);
|
||||
|
||||
bool https() const;
|
||||
void setHttps(bool enabled);
|
||||
|
||||
Q_INVOKABLE void startDiscovery();
|
||||
Q_INVOKABLE void stopDiscovery();
|
||||
Q_INVOKABLE void refreshDevices();
|
||||
@@ -116,6 +120,7 @@ signals:
|
||||
void receivingChanged();
|
||||
void receiveProgressChanged();
|
||||
void deviceTypeChanged();
|
||||
void httpsChanged();
|
||||
|
||||
private slots:
|
||||
void onDeviceDiscovered(const LocalSend::Device& device);
|
||||
|
||||
@@ -735,91 +735,123 @@ ApplicationWindow {
|
||||
anchors.margins: 16
|
||||
spacing: 16
|
||||
|
||||
GridLayout {
|
||||
columns: 2
|
||||
ScrollView {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
contentWidth: availableWidth
|
||||
clip: true
|
||||
|
||||
Label { text: qsTr("Device Alias:") }
|
||||
TextField {
|
||||
id: aliasField
|
||||
text: appController.alias
|
||||
onEditingFinished: appController.alias = text
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
ColumnLayout {
|
||||
width: parent.width
|
||||
spacing: 16
|
||||
|
||||
Label { text: qsTr("Port:") }
|
||||
SpinBox {
|
||||
id: portField
|
||||
value: appController.port
|
||||
from: 1
|
||||
to: 65535
|
||||
onValueChanged: appController.port = value
|
||||
}
|
||||
|
||||
Label { text: qsTr("Download Path:") }
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
TextField {
|
||||
id: downloadPathField
|
||||
text: appController.downloadPath
|
||||
onEditingFinished: appController.downloadPath = text
|
||||
GridLayout {
|
||||
columns: 2
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
Button {
|
||||
text: qsTr("Browse")
|
||||
onClicked: folderDialog.open()
|
||||
}
|
||||
}
|
||||
|
||||
Label { text: qsTr("Quick Save:") }
|
||||
CheckBox {
|
||||
id: quickSaveCheck
|
||||
checked: appController.quickSave
|
||||
onCheckedChanged: appController.quickSave = checked
|
||||
}
|
||||
Label { text: qsTr("Device Alias:") }
|
||||
TextField {
|
||||
id: aliasField
|
||||
text: appController.alias
|
||||
onEditingFinished: appController.alias = text
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
Label { text: qsTr("Receive PIN:") }
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
Label {
|
||||
text: appController.receivePin.length > 0 ? qsTr("Enabled") : qsTr("Disabled")
|
||||
color: appController.receivePin.length > 0 ? "green" : palette.mid
|
||||
}
|
||||
Item { Layout.fillWidth: true }
|
||||
Button {
|
||||
text: appController.receivePin.length > 0 ? qsTr("Change") : qsTr("Set PIN")
|
||||
onClicked: setPinDialog.open()
|
||||
}
|
||||
Button {
|
||||
text: qsTr("Remove")
|
||||
visible: appController.receivePin.length > 0
|
||||
onClicked: appController.receivePin = ""
|
||||
}
|
||||
}
|
||||
Label { text: qsTr("Port:") }
|
||||
SpinBox {
|
||||
id: portField
|
||||
value: appController.port
|
||||
from: 1
|
||||
to: 65535
|
||||
onValueChanged: appController.port = value
|
||||
}
|
||||
|
||||
Label { text: qsTr("Device Type:") }
|
||||
ComboBox {
|
||||
id: deviceTypeCombo
|
||||
Layout.fillWidth: true
|
||||
model: [
|
||||
{ text: qsTr("Mobile"), value: "mobile" },
|
||||
{ text: qsTr("Desktop"), value: "desktop" },
|
||||
{ text: qsTr("Web"), value: "web" },
|
||||
{ text: qsTr("Headless"), value: "headless" },
|
||||
{ text: qsTr("Server"), value: "server" }
|
||||
]
|
||||
textRole: "text"
|
||||
Component.onCompleted: {
|
||||
for (var i = 0; i < model.length; i++) {
|
||||
if (model[i].value === appController.deviceType) {
|
||||
currentIndex = i
|
||||
break
|
||||
Label { text: qsTr("Download Path:") }
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
TextField {
|
||||
id: downloadPathField
|
||||
text: appController.downloadPath
|
||||
onEditingFinished: appController.downloadPath = text
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
Button {
|
||||
text: qsTr("Browse")
|
||||
onClicked: folderDialog.open()
|
||||
}
|
||||
}
|
||||
|
||||
Label { text: qsTr("Quick Save:") }
|
||||
CheckBox {
|
||||
id: quickSaveCheck
|
||||
checked: appController.quickSave
|
||||
onCheckedChanged: appController.quickSave = checked
|
||||
}
|
||||
|
||||
Label { text: qsTr("Receive PIN:") }
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
Label {
|
||||
text: appController.receivePin.length > 0 ? qsTr("Enabled") : qsTr("Disabled")
|
||||
color: appController.receivePin.length > 0 ? "green" : palette.mid
|
||||
}
|
||||
Item { Layout.fillWidth: true }
|
||||
Button {
|
||||
text: appController.receivePin.length > 0 ? qsTr("Change") : qsTr("Set PIN")
|
||||
onClicked: setPinDialog.open()
|
||||
}
|
||||
Button {
|
||||
text: qsTr("Remove")
|
||||
visible: appController.receivePin.length > 0
|
||||
onClicked: appController.receivePin = ""
|
||||
}
|
||||
}
|
||||
|
||||
Label { text: qsTr("Device Type:") }
|
||||
ComboBox {
|
||||
id: deviceTypeCombo
|
||||
Layout.fillWidth: true
|
||||
model: [
|
||||
{ text: qsTr("Mobile"), value: "mobile" },
|
||||
{ text: qsTr("Desktop"), value: "desktop" },
|
||||
{ text: qsTr("Web"), value: "web" },
|
||||
{ text: qsTr("Headless"), value: "headless" },
|
||||
{ text: qsTr("Server"), value: "server" }
|
||||
]
|
||||
textRole: "text"
|
||||
Component.onCompleted: {
|
||||
for (var i = 0; i < model.length; i++) {
|
||||
if (model[i].value === appController.deviceType) {
|
||||
currentIndex = i
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
onCurrentIndexChanged: {
|
||||
if (currentIndex >= 0 && currentIndex < model.length) {
|
||||
appController.deviceType = model[currentIndex].value
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
onCurrentIndexChanged: {
|
||||
if (currentIndex >= 0 && currentIndex < model.length) {
|
||||
appController.deviceType = model[currentIndex].value
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -833,9 +865,8 @@ ApplicationWindow {
|
||||
}
|
||||
}
|
||||
|
||||
Item { Layout.fillHeight: true }
|
||||
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
text: qsTr("Server Status: %1").arg(appController.serverRunning ? qsTr("Running") : qsTr("Stopped"))
|
||||
color: appController.serverRunning ? "green" : "red"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user