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
20733343
Commit
20733343
authored
1 year ago
by
Burak Hançerli
Browse files
Options
Downloads
Patches
Plain Diff
QDS-11912
Project list and run project button are enabled/disabled properly
parent
16db45fc
No related branches found
No related tags found
1 merge request
!36
QDS-11912 Project list and run project button are enabled/disabled properly
Pipeline
#67155
passed
1 year ago
Stage: build
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/backend.cpp
+6
-8
6 additions, 8 deletions
src/backend.cpp
src/backend.h
+3
-4
3 additions, 4 deletions
src/backend.h
ui/HomePage.qml
+17
-8
17 additions, 8 deletions
ui/HomePage.qml
ui/SettingsPage.qml
+2
-1
2 additions, 1 deletion
ui/SettingsPage.qml
with
28 additions
and
21 deletions
src/backend.cpp
+
6
−
8
View file @
20733343
...
@@ -150,7 +150,7 @@ void Backend::setAutoScaleProject(const bool &enabled)
...
@@ -150,7 +150,7 @@ void Backend::setAutoScaleProject(const bool &enabled)
void
Backend
::
setUserHash
(
const
QString
&
userHash
)
void
Backend
::
setUserHash
(
const
QString
&
userHash
)
{
{
QSettings
().
setValue
(
"user/hash"
,
userHash
);
QSettings
().
setValue
(
"user/hash"
,
userHash
);
updateUserProjectList
();
emit
userRegistered
();
}
}
bool
Backend
::
updateInBackground
()
bool
Backend
::
updateInBackground
()
...
@@ -494,8 +494,6 @@ void Backend::runOnlineProject(const QString &url)
...
@@ -494,8 +494,6 @@ void Backend::runOnlineProject(const QString &url)
void
Backend
::
updateUserProjectList
()
void
Backend
::
updateUserProjectList
()
{
{
emit
userRegistered
();
const
QString
userHash
=
Backend
::
userHash
();
const
QString
userHash
=
Backend
::
userHash
();
if
(
userHash
.
isEmpty
())
{
if
(
userHash
.
isEmpty
())
{
...
@@ -511,17 +509,16 @@ void Backend::updateUserProjectList()
...
@@ -511,17 +509,16 @@ void Backend::updateUserProjectList()
return
;
return
;
}
}
if
(
projectList
==
m_projectList
Array
)
{
if
(
projectList
==
m_projectList
)
{
qDebug
(
"No new projects available"
);
qDebug
(
"No new projects available"
);
return
;
return
;
}
}
m_projectListArray
=
projectList
;
m_projectList
.
clear
()
;
m_projectList
=
projectList
;
qDebug
(
"List of available projects fetched:"
);
qDebug
(
"List of available projects fetched:"
);
for
(
const
auto
&
project
:
projectList
)
{
for
(
const
auto
&
project
:
projectList
)
{
const
QString
projectName
{
project
.
toObject
().
value
(
"appName"
).
toString
()};
const
QString
projectName
{
project
.
toObject
().
value
(
"appName"
).
toString
()};
qDebug
()
<<
"--"
<<
projectName
;
qDebug
()
<<
"--"
<<
projectName
;
m_projectList
<<
projectName
;
}
}
emit
projectListChanged
();
emit
projectListChanged
();
...
@@ -534,7 +531,7 @@ void Backend::parseDesignViewerUrl(const QUrl &url)
...
@@ -534,7 +531,7 @@ void Backend::parseDesignViewerUrl(const QUrl &url)
// If it is a user hash, we register the user and fetch the project list
// If it is a user hash, we register the user and fetch the project list
// If it is a project url, we submit the url to the text field
// If it is a project url, we submit the url to the text field
// sample url: https://<url>/<project_name>.qmlrc
// sample url: https://<url>/<project_name>.qmlrc
// sample user hash: qtdesignviewer://1
7e
8907b
3b
84029384hs8djshdu38476
// sample user hash: qtdesignviewer://1
9f
8907b
6t
84029384hs8djshdu38476
if
(
urlData
.
isEmpty
())
if
(
urlData
.
isEmpty
())
return
;
return
;
else
if
(
urlData
.
startsWith
(
"https//"
))
{
else
if
(
urlData
.
startsWith
(
"https//"
))
{
...
@@ -545,6 +542,7 @@ void Backend::parseDesignViewerUrl(const QUrl &url)
...
@@ -545,6 +542,7 @@ void Backend::parseDesignViewerUrl(const QUrl &url)
}
else
if
(
urlData
.
startsWith
(
"qtdesignviewer://"
))
{
}
else
if
(
urlData
.
startsWith
(
"qtdesignviewer://"
))
{
qDebug
()
<<
"Registering user from QR code"
;
qDebug
()
<<
"Registering user from QR code"
;
setUserHash
(
url
.
toString
().
remove
(
"qtdesignviewer://"
));
setUserHash
(
url
.
toString
().
remove
(
"qtdesignviewer://"
));
updateUserProjectList
();
}
else
{
}
else
{
qWarning
()
<<
"Unknown QR code data: "
<<
urlData
;
qWarning
()
<<
"Unknown QR code data: "
<<
urlData
;
}
}
...
...
This diff is collapsed.
Click to expand it.
src/backend.h
+
3
−
4
View file @
20733343
...
@@ -58,7 +58,7 @@ signals:
...
@@ -58,7 +58,7 @@ signals:
class
Backend
:
public
QObject
class
Backend
:
public
QObject
{
{
Q_OBJECT
Q_OBJECT
Q_PROPERTY
(
Q
StringList
projectList
READ
projectList
NOTIFY
projectListChanged
FINAL
)
Q_PROPERTY
(
Q
JsonArray
projectList
READ
projectList
NOTIFY
projectListChanged
)
public:
public:
explicit
Backend
(
QObject
*
parent
=
nullptr
);
explicit
Backend
(
QObject
*
parent
=
nullptr
);
...
@@ -69,13 +69,12 @@ public:
...
@@ -69,13 +69,12 @@ public:
emit
logsChanged
(
m_logs
);
emit
logsChanged
(
m_logs
);
}
}
Q
StringList
projectList
()
const
{
return
m_projectList
;
}
Q
JsonArray
projectList
()
const
{
return
m_projectList
;
}
private
:
private
:
// UI data
// UI data
QString
m_logs
;
QString
m_logs
;
QStringList
m_projectList
;
QJsonArray
m_projectList
;
QJsonArray
m_projectListArray
;
// Other members
// Other members
ServiceConnector
m_serviceConnector
;
ServiceConnector
m_serviceConnector
;
...
...
This diff is collapsed.
Click to expand it.
ui/HomePage.qml
+
17
−
8
View file @
20733343
...
@@ -62,33 +62,42 @@ Item {
...
@@ -62,33 +62,42 @@ Item {
ColumnLayout
{
ColumnLayout
{
id
:
column2
id
:
column2
Layout.fillWidth
:
true
Layout.fillWidth
:
true
ComboBox
{
ComboBox
{
id
:
projectList
id
:
projectList
Layout.fillWidth
:
true
Layout.fillWidth
:
true
enabled
:
backend
.
userHash
()
!==
''
enabled
:
true
onCurrentIndexChanged
:
{
onCurrentIndexChanged
:
{
displayText
=
textAt
(
currentIndex
)
displayText
=
textAt
(
currentIndex
)
}
}
textRole
:
"
appName
"
model
:
backend
.
projectList
model
:
backend
.
projectList
displayText
:
"
Scan QR code to access your projects
"
;
displayText
:
"
Scan QR code to access your projects
"
;
currentIndex
:
-
1
currentIndex
:
-
1
Layout.preferredHeight
:
50
Layout.preferredHeight
:
50
Connections
{
target
:
backend
function
onUserRegistered
(){
projectList
.
enabled
=
true
;
}
}
}
}
Button
{
Button
{
id
:
downloadUserProject
id
:
downloadUserProject
text
:
qsTr
(
"
Run Project
"
)
text
:
qsTr
(
"
Run Project
"
)
onClicked
:
backend
.
runUserProject
(
projectList
.
currentText
)
onClicked
:
backend
.
runUserProject
(
projectList
.
currentText
)
enabled
:
backend
.
userHash
()
!==
''
enabled
:
false
Layout.fillWidth
:
true
Layout.fillWidth
:
true
Layout.alignment
:
Qt
.
AlignHCenter
|
Qt
.
AlignVCenter
Layout.alignment
:
Qt
.
AlignHCenter
|
Qt
.
AlignVCenter
}
}
Connections
{
target
:
backend
function
onUserRegistered
(){
projectList
.
displayText
=
"
No projects available for the user
"
;
projectList
.
enabled
=
false
;
downloadUserProject
.
enabled
=
false
;
}
function
onProjectListChanged
(){
projectList
.
enabled
=
true
;
downloadUserProject
.
enabled
=
true
;
}
}
}
}
Item
{
Item
{
...
...
This diff is collapsed.
Click to expand it.
ui/SettingsPage.qml
+
2
−
1
View file @
20733343
...
@@ -45,8 +45,9 @@ Item {
...
@@ -45,8 +45,9 @@ Item {
Text
{
Text
{
leftPadding
:
45
leftPadding
:
45
text
:
qsTr
(
"
Scales the project to fit it to the current
display and orientation
"
)
text
:
qsTr
(
"
Scales the project to fit it to the current
\n
display and orientation
"
)
font.pointSize
:
12
font.pointSize
:
12
wrapMode
:
Text
.
WordWrap
}
}
}
}
...
...
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