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 AppController::devices() const
|
||||||
{
|
{
|
||||||
QVariantList result;
|
QVariantList result;
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -735,91 +735,123 @@ ApplicationWindow {
|
|||||||
anchors.margins: 16
|
anchors.margins: 16
|
||||||
spacing: 16
|
spacing: 16
|
||||||
|
|
||||||
GridLayout {
|
ScrollView {
|
||||||
columns: 2
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.fillHeight: true
|
||||||
|
contentWidth: availableWidth
|
||||||
|
clip: true
|
||||||
|
|
||||||
Label { text: qsTr("Device Alias:") }
|
ColumnLayout {
|
||||||
TextField {
|
width: parent.width
|
||||||
id: aliasField
|
spacing: 16
|
||||||
text: appController.alias
|
|
||||||
onEditingFinished: appController.alias = text
|
|
||||||
Layout.fillWidth: true
|
|
||||||
}
|
|
||||||
|
|
||||||
Label { text: qsTr("Port:") }
|
GridLayout {
|
||||||
SpinBox {
|
columns: 2
|
||||||
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
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
|
||||||
Button {
|
|
||||||
text: qsTr("Browse")
|
|
||||||
onClicked: folderDialog.open()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Label { text: qsTr("Quick Save:") }
|
Label { text: qsTr("Device Alias:") }
|
||||||
CheckBox {
|
TextField {
|
||||||
id: quickSaveCheck
|
id: aliasField
|
||||||
checked: appController.quickSave
|
text: appController.alias
|
||||||
onCheckedChanged: appController.quickSave = checked
|
onEditingFinished: appController.alias = text
|
||||||
}
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
|
||||||
Label { text: qsTr("Receive PIN:") }
|
Label { text: qsTr("Port:") }
|
||||||
RowLayout {
|
SpinBox {
|
||||||
Layout.fillWidth: true
|
id: portField
|
||||||
Label {
|
value: appController.port
|
||||||
text: appController.receivePin.length > 0 ? qsTr("Enabled") : qsTr("Disabled")
|
from: 1
|
||||||
color: appController.receivePin.length > 0 ? "green" : palette.mid
|
to: 65535
|
||||||
}
|
onValueChanged: appController.port = value
|
||||||
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:") }
|
Label { text: qsTr("Download Path:") }
|
||||||
ComboBox {
|
RowLayout {
|
||||||
id: deviceTypeCombo
|
Layout.fillWidth: true
|
||||||
Layout.fillWidth: true
|
TextField {
|
||||||
model: [
|
id: downloadPathField
|
||||||
{ text: qsTr("Mobile"), value: "mobile" },
|
text: appController.downloadPath
|
||||||
{ text: qsTr("Desktop"), value: "desktop" },
|
onEditingFinished: appController.downloadPath = text
|
||||||
{ text: qsTr("Web"), value: "web" },
|
Layout.fillWidth: true
|
||||||
{ text: qsTr("Headless"), value: "headless" },
|
}
|
||||||
{ text: qsTr("Server"), value: "server" }
|
Button {
|
||||||
]
|
text: qsTr("Browse")
|
||||||
textRole: "text"
|
onClicked: folderDialog.open()
|
||||||
Component.onCompleted: {
|
}
|
||||||
for (var i = 0; i < model.length; i++) {
|
}
|
||||||
if (model[i].value === appController.deviceType) {
|
|
||||||
currentIndex = i
|
Label { text: qsTr("Quick Save:") }
|
||||||
break
|
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) {
|
CheckBox {
|
||||||
appController.deviceType = model[currentIndex].value
|
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 {
|
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"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user