Server selection always in range (#130)
* Server selection stays always in the list's range * Removed the usage of QZxing module from PageQrDecoder page * Fixed null spelling on qml instead of nil
This commit is contained in:
parent
814b66c04a
commit
f20f528a11
6 changed files with 18 additions and 8 deletions
|
|
@ -15,6 +15,7 @@ void ServerListLogic::onServerListPushbuttonDefaultClicked(int index)
|
||||||
{
|
{
|
||||||
m_settings->setDefaultServer(index);
|
m_settings->setDefaultServer(index);
|
||||||
uiLogic()->onUpdateAllPages();
|
uiLogic()->onUpdateAllPages();
|
||||||
|
emit currServerIdxChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerListLogic::onServerListPushbuttonSettingsClicked(int index)
|
void ServerListLogic::onServerListPushbuttonSettingsClicked(int index)
|
||||||
|
|
@ -23,6 +24,11 @@ void ServerListLogic::onServerListPushbuttonSettingsClicked(int index)
|
||||||
uiLogic()->goToPage(Page::ServerSettings);
|
uiLogic()->goToPage(Page::ServerSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ServerListLogic::currServerIdx() const
|
||||||
|
{
|
||||||
|
return m_settings->defaultServerIndex();
|
||||||
|
}
|
||||||
|
|
||||||
void ServerListLogic::onUpdatePage()
|
void ServerListLogic::onUpdatePage()
|
||||||
{
|
{
|
||||||
const QJsonArray &servers = m_settings->serversArray();
|
const QJsonArray &servers = m_settings->serversArray();
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,11 @@ class ServerListLogic : public PageLogicBase
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
READONLY_PROPERTY(QObject *, serverListModel)
|
READONLY_PROPERTY(QObject *, serverListModel)
|
||||||
|
Q_PROPERTY(int currServerIdx READ currServerIdx NOTIFY currServerIdxChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
int currServerIdx() const;
|
||||||
|
|
||||||
Q_INVOKABLE void onUpdatePage() override;
|
Q_INVOKABLE void onUpdatePage() override;
|
||||||
Q_INVOKABLE void onServerListPushbuttonDefaultClicked(int index);
|
Q_INVOKABLE void onServerListPushbuttonDefaultClicked(int index);
|
||||||
Q_INVOKABLE void onServerListPushbuttonSettingsClicked(int index);
|
Q_INVOKABLE void onServerListPushbuttonSettingsClicked(int index);
|
||||||
|
|
@ -20,5 +23,8 @@ public:
|
||||||
explicit ServerListLogic(UiLogic *uiLogic, QObject *parent = nullptr);
|
explicit ServerListLogic(UiLogic *uiLogic, QObject *parent = nullptr);
|
||||||
~ServerListLogic() = default;
|
~ServerListLogic() = default;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void currServerIdxChanged();
|
||||||
|
|
||||||
};
|
};
|
||||||
#endif // SERVER_LIST_LOGIC_H
|
#endif // SERVER_LIST_LOGIC_H
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ PageBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: Qt.platform.os != "ios" ? QrDecoderLogic : nil
|
target: Qt.platform.os != "ios" ? QrDecoderLogic : null
|
||||||
function onStartDecode() {
|
function onStartDecode() {
|
||||||
console.debug("Starting QR decoder")
|
console.debug("Starting QR decoder")
|
||||||
loader.sourceComponent = component
|
loader.sourceComponent = component
|
||||||
|
|
@ -71,7 +71,7 @@ PageBase {
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
autoOrientation: true
|
autoOrientation: true
|
||||||
fillMode: VideoOutput.PreserveAspectFit
|
fillMode: VideoOutput.PreserveAspectFit
|
||||||
filters: [ zxingFilter ]
|
// filters: [ zxingFilter ]
|
||||||
|
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ PageBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: Qt.platform.os == "ios" ? QrDecoderLogic : nil
|
target: Qt.platform.os == "ios" ? QrDecoderLogic : null
|
||||||
function onStartDecode() {
|
function onStartDecode() {
|
||||||
console.debug("Starting QR decoder")
|
console.debug("Starting QR decoder")
|
||||||
loader.sourceComponent = component
|
loader.sourceComponent = component
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,9 @@ PageBase {
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.bottomMargin: 20
|
anchors.bottomMargin: 20
|
||||||
model: ServerListLogic.serverListModel
|
model: ServerListLogic.serverListModel
|
||||||
|
highlightRangeMode: ListView.ApplyRange
|
||||||
|
highlightMoveVelocity: -1
|
||||||
|
currentIndex: ServerListLogic.currServerIdx
|
||||||
spacing: 5
|
spacing: 5
|
||||||
clip: true
|
clip: true
|
||||||
delegate: Item {
|
delegate: Item {
|
||||||
|
|
@ -55,10 +58,6 @@ PageBase {
|
||||||
if (GC.isMobile()) {
|
if (GC.isMobile()) {
|
||||||
ServerListLogic.onServerListPushbuttonSettingsClicked(index)
|
ServerListLogic.onServerListPushbuttonSettingsClicked(index)
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
listWidget_servers.currentIndex = index
|
|
||||||
}
|
|
||||||
|
|
||||||
mouse.accepted = false
|
mouse.accepted = false
|
||||||
}
|
}
|
||||||
onEntered: {
|
onEntered: {
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@ PageProtocolBase {
|
||||||
anchors.top: caption.bottom
|
anchors.top: caption.bottom
|
||||||
anchors.left: root.left
|
anchors.left: root.left
|
||||||
anchors.right: root.right
|
anchors.right: root.right
|
||||||
anchors.bottom: pb_save.top
|
|
||||||
anchors.margins: 20
|
anchors.margins: 20
|
||||||
anchors.topMargin: 10
|
anchors.topMargin: 10
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue