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
c4ecf286
Commit
c4ecf286
authored
1 year ago
by
Burak Hançerli
Browse files
Options
Downloads
Patches
Plain Diff
QDS-11911
Project list dropdown update issues
parent
20733343
No related branches found
No related tags found
1 merge request
!37
QDS-11911 Project list dropdown update issues
Pipeline
#67177
passed
1 year ago
Stage: build
Stage: release
Changes
4
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
android/AndroidManifest.xml
+1
-1
1 addition, 1 deletion
android/AndroidManifest.xml
src/backend.cpp
+17
-35
17 additions, 35 deletions
src/backend.cpp
src/backend.h
+13
-6
13 additions, 6 deletions
src/backend.h
ui/HomePage.qml
+12
-17
12 additions, 17 deletions
ui/HomePage.qml
with
43 additions
and
59 deletions
android/AndroidManifest.xml
+
1
−
1
View file @
c4ecf286
<?xml version="1.0"?>
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
package=
"io.qt.qtdesignviewer"
android:installLocation=
"auto"
android:versionCode=
"2
4
"
android:versionName=
"1.2"
>
android:installLocation=
"auto"
android:versionCode=
"2
5
"
android:versionName=
"1.2"
>
<!-- %%INSERT_PERMISSIONS -->
<!-- %%INSERT_FEATURES -->
<supports-screens
android:anyDensity=
"true"
android:largeScreens=
"true"
...
...
This diff is collapsed.
Click to expand it.
src/backend.cpp
+
17
−
35
View file @
c4ecf286
...
...
@@ -92,7 +92,9 @@ void Backend::initialize()
updateUserProjectList
();
}
// Check if updateInBackground is enabled
// Initialize background update
connect
(
&
m_backgroundTimer
,
&
QTimer
::
timeout
,
this
,
&
Backend
::
updateUserProjectList
);
m_backgroundTimer
.
setInterval
(
1000
*
10
);
enableBackgroundUpdate
(
updateInBackground
());
qDebug
()
<<
"Initialization complete"
;
}
...
...
@@ -100,26 +102,6 @@ void Backend::initialize()
void
Backend
::
enableBackgroundUpdate
(
const
bool
&
enabled
)
{
if
(
enabled
)
{
m_backgroundTimer
.
setInterval
(
1000
*
10
);
connect
(
&
m_backgroundTimer
,
&
QTimer
::
timeout
,
this
,
[
&
]
{
qDebug
()
<<
"Checking for updates in background"
;
const
QString
userHash
=
Backend
::
userHash
();
if
(
userHash
.
isEmpty
())
return
;
QJsonArray
projectList
=
m_serviceConnector
.
fetchUserProjectList
(
userHash
);
if
(
projectList
.
isEmpty
())
{
qWarning
()
<<
"Could not fetch project list. Please check your internet "
"connection and try again"
;
return
;
}
qDebug
()
<<
"New projects available. Updating project list"
;
updateUserProjectList
();
});
m_backgroundTimer
.
start
();
}
else
{
m_backgroundTimer
.
stop
();
...
...
@@ -150,7 +132,7 @@ void Backend::setAutoScaleProject(const bool &enabled)
void
Backend
::
setUserHash
(
const
QString
&
userHash
)
{
QSettings
().
setValue
(
"user/hash"
,
userHash
);
emit
user
Register
ed
();
emit
user
HashChang
ed
();
}
bool
Backend
::
updateInBackground
()
...
...
@@ -504,23 +486,23 @@ void Backend::updateUserProjectList()
qDebug
()
<<
"Fetching available project list for user:"
<<
userHash
;
QJsonArray
projectList
=
m_serviceConnector
.
fetchUserProjectList
(
userHash
);
if
(
projectList
.
isEmpty
())
{
qCritical
(
"Could not fetch available project list"
);
return
;
}
if
(
projectList
==
m_projectList
)
{
qDebug
(
"No new projects available"
);
return
;
qDebug
(
"No new projects are available"
);
}
else
if
(
projectList
.
isEmpty
())
{
qWarning
(
"Could not fetch project list. Either there are no projects or there is a "
"network issue"
);
}
else
{
qDebug
(
"List of available projects fetched:"
);
for
(
const
auto
&
project
:
projectList
)
{
const
QString
projectName
{
project
.
toObject
().
value
(
"appName"
).
toString
()};
qDebug
()
<<
"--"
<<
projectName
;
}
}
// we need to set m_projectList even if it is empty
// because this triggers the onModelChanged function in the QML
// in order to update the UI
m_projectList
=
projectList
;
qDebug
(
"List of available projects fetched:"
);
for
(
const
auto
&
project
:
projectList
)
{
const
QString
projectName
{
project
.
toObject
().
value
(
"appName"
).
toString
()};
qDebug
()
<<
"--"
<<
projectName
;
}
emit
projectListChanged
();
}
...
...
This diff is collapsed.
Click to expand it.
src/backend.h
+
13
−
6
View file @
c4ecf286
...
...
@@ -89,23 +89,29 @@ private:
QTimer
m_backgroundTimer
;
// member functions
void
updateUserProjectList
();
void
updatePopup
(
const
QString
&
text
,
bool
indeterminate
=
true
);
signals
:
// UI signals
// UI signals - Home page
void
projectListChanged
();
void
urlUpdated
(
QString
);
void
userHashChanged
();
// UI signals - Logs page
void
logsChanged
(
QString
);
// UI signals - About page
void
buildInfoChanged
(
QString
);
// UI signals - Popup
void
downloadProgress
(
float
);
void
projectListChanged
();
void
popupProgressIndeterminateChanged
(
bool
indeterminate
);
void
popupTextChanged
(
QString
text
);
void
popupOpen
();
void
popupClose
();
void
userRegistered
();
// UI signals - Network page
void
networkUpdated
(
QString
);
void
urlUpdated
(
QString
);
void
userHashChanged
(
QString
);
public
slots
:
void
scanQrCode
();
...
...
@@ -133,6 +139,7 @@ public slots:
private
slots
:
void
initializeProjectManager
();
void
enableBackgroundUpdate
(
const
bool
&
enabled
);
void
updateUserProjectList
();
};
#endif // DV_ANDROID_H
This diff is collapsed.
Click to expand it.
ui/HomePage.qml
+
12
−
17
View file @
c4ecf286
...
...
@@ -27,7 +27,7 @@ Item {
Layout.fillWidth
:
true
Connections
{
target
:
backend
function
onUser
Register
ed
(){
function
onUser
HashChang
ed
(){
qrCodeStatus
.
text
=
"
User registration is completed.
\n
Scan a new QR code to access the shared project from a different user.
"
;
qrCodeInstructions
.
text
=
""
;
}
...
...
@@ -67,11 +67,19 @@ Item {
id
:
projectList
Layout.fillWidth
:
true
enabled
:
true
onCurrentIndexChanged
:
{
displayText
=
textAt
(
currentIndex
)
}
textRole
:
"
appName
"
model
:
backend
.
projectList
onModelChanged
:
{
if
(
backend
.
projectList
.
length
>
0
)
{
projectList
.
displayText
=
backend
.
projectList
[
0
].
appName
;
projectList
.
enabled
=
true
;
downloadUserProject
.
enabled
=
true
;
}
else
{
projectList
.
displayText
=
"
No projects are available
"
;
projectList
.
enabled
=
false
;
downloadUserProject
.
enabled
=
false
;
}
}
displayText
:
"
Scan QR code to access your projects
"
;
currentIndex
:
-
1
Layout.preferredHeight
:
50
...
...
@@ -85,19 +93,6 @@ Item {
Layout.fillWidth
:
true
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
{
...
...
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