Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Qt UI Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Design Studio
QML Viewer Projects
Qt UI Viewer
Commits
304d6f90
Commit
304d6f90
authored
5 months ago
by
Burak Hançerli
Browse files
Options
Downloads
Patches
Plain Diff
QDS-13458
Show ip addresses on the home page
parent
98f060ef
No related branches found
No related tags found
1 merge request
!58
QDS-13458 Show ip addresses on the home page
Pipeline
#76683
passed
5 months ago
Stage: build
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/HomePage.qml
+16
-106
16 additions, 106 deletions
src/HomePage.qml
src/backend/backend.cpp
+19
-0
19 additions, 0 deletions
src/backend/backend.cpp
src/backend/backend.h
+2
-0
2 additions, 0 deletions
src/backend/backend.h
with
37 additions
and
106 deletions
src/HomePage.qml
+
16
−
106
View file @
304d6f90
...
...
@@ -137,117 +137,27 @@ Flickable {
spacing
:
10
Rectangle
{
Label
{
Layout.fillWidth
:
true
Layout.preferredHeight
:
optionLayout1
.
height
color
:
Constants
.
boxBackgroundColor
radius
:
Material
.
MediumScale
border
{
width
:
1
color
:
Constants
.
boxBorderColor
}
ColumnLayout
{
id
:
optionLayout1
width
:
parent
.
width
spacing
:
20
Label
{
Layout.fillWidth
:
true
Layout.topMargin
:
20
horizontalAlignment
:
Qt
.
AlignHCenter
text
:
qsTr
(
"
Option 1
"
)
font.pixelSize
:
Constants
.
lgTextSize
font.bold
:
true
wrapMode
:
Text
.
WordWrap
}
Label
{
Layout.fillWidth
:
true
Layout.leftMargin
:
20
Layout.rightMargin
:
20
horizontalAlignment
:
Qt
.
AlignHCenter
text
:
qsTr
(
"
Click to scan the QR code in Qt Design Studio
"
)
font.pixelSize
:
Constants
.
mdTextSize
wrapMode
:
Text
.
WordWrap
}
QrButton
{
Layout.alignment
:
Qt
.
AlignHCenter
Layout.bottomMargin
:
20
onClicked
:
backend
.
scanQrCode
()
}
}
text
:
qsTr
(
"
This device can be reached at the following IP addresses:
"
)
font.pixelSize
:
Constants
.
lgTextSize
font.bold
:
true
wrapMode
:
Text
.
WordWrap
}
Rectangle
{
Label
{
id
:
ipAddress
Layout.fillWidth
:
true
Layout.preferredHeight
:
optionLayout2
.
height
color
:
Constants
.
boxBackgroundColor
radius
:
Material
.
MediumScale
border
{
width
:
1
color
:
Constants
.
boxBorderColor
}
ColumnLayout
{
id
:
optionLayout2
width
:
parent
.
width
spacing
:
20
Label
{
Layout.fillWidth
:
true
Layout.topMargin
:
20
horizontalAlignment
:
Qt
.
AlignHCenter
text
:
qsTr
(
"
Option 2
"
)
font.pixelSize
:
Constants
.
lgTextSize
font.bold
:
true
wrapMode
:
Text
.
WordWrap
}
TextField
{
id
:
ipAddress
Layout.fillWidth
:
true
Layout.leftMargin
:
20
Layout.rightMargin
:
20
Layout.alignment
:
Qt
.
AlignHCenter
placeholderText
:
qsTr
(
"
IP Address
"
)
text
:
backend
.
lastDesignStudioIp
()
validator
:
RegularExpressionValidator
{
regularExpression
:
/^
(\d{1,3}\.){3}\d{1,3}
$/
}
Connections
{
target
:
backend
function
onConnectedChanged
(
isConnected
,
ip
)
{
ipAddress
.
text
=
ip
;
}
}
}
Button
{
id
:
downloadUserProject
Layout.fillWidth
:
true
Layout.leftMargin
:
20
Layout.rightMargin
:
20
Layout.bottomMargin
:
20
Layout.alignment
:
Qt
.
AlignHCenter
text
:
qsTr
(
"
Connect Design Studio
"
)
enabled
:
true
text
:
qsTr
(
"
xxx.xxx.xxx.xxx
"
)
font.pixelSize
:
Constants
.
lgTextSize
font.bold
:
true
wrapMode
:
Text
.
WordWrap
onClicked
:
backend
.
connectDesignStudio
(
ipAddress
.
text
)
Component.onCompleted
:
{
ipAddress
.
text
=
''
;
var
val
=
backend
.
getIpAddresses
();
for
(
var
i
=
0
;
i
<
val
.
length
;
i
++
)
{
ipAddress
.
text
+=
val
[
i
].
interface
+
'
:
'
+
val
[
i
].
ip
+
'
\n
'
;
}
}
}
...
...
This diff is collapsed.
Click to expand it.
src/backend/backend.cpp
+
19
−
0
View file @
304d6f90
...
...
@@ -26,6 +26,7 @@
#include
"backend.h"
#include
<QDesktopServices>
#include
<QNetworkInterface>
#include
"logger.h"
...
...
@@ -253,3 +254,21 @@ QString Backend::lastDesignStudioIp() const
{
return
m_dsManager
?
m_dsManager
->
getDesignStudioIp
({})
:
QString
();
}
QJsonArray
Backend
::
getIpAddresses
()
const
{
QNetworkInterface
networkInterface
;
QJsonArray
ipAddresses
;
for
(
const
auto
&
interface
:
networkInterface
.
allInterfaces
())
{
for
(
const
auto
&
entry
:
interface
.
addressEntries
())
{
if
(
entry
.
ip
().
protocol
()
==
QAbstractSocket
::
IPv4Protocol
&&
!
entry
.
ip
().
isLoopback
())
{
qDebug
()
<<
"Interface:"
<<
interface
.
name
()
<<
"IP:"
<<
entry
.
ip
().
toString
();
ipAddresses
.
append
(
QJsonObject
{{
"interface"
,
interface
.
name
()},
{
"ip"
,
entry
.
ip
().
toString
()}});
}
}
}
return
ipAddresses
;
}
This diff is collapsed.
Click to expand it.
src/backend/backend.h
+
2
−
0
View file @
304d6f90
...
...
@@ -26,6 +26,7 @@
#ifndef DV_ANDROID_H
#define DV_ANDROID_H
#include
<QJsonArray>
#include
<QThread>
#include
"dsconnector/dsmanager.h"
...
...
@@ -81,6 +82,7 @@ public slots:
void
connectDesignStudio
(
const
QString
&
ipAddr
);
void
parseDesignViewerUrl
(
const
QUrl
&
url
);
void
popupInterrupted
();
QJsonArray
getIpAddresses
()
const
;
bool
autoScaleProject
()
const
;
void
setAutoScaleProject
(
bool
autoScaleProject
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment