Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Qt Design 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 Design Viewer
Commits
c39f7265
Commit
c39f7265
authored
1 year ago
by
Burak Hançerli
Browse files
Options
Downloads
Patches
Plain Diff
QDS-10704
Show download progress
parent
89869f87
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.md
+4
-2
4 additions, 2 deletions
README.md
design-viewer/src/dv_android.cpp
+24
-10
24 additions, 10 deletions
design-viewer/src/dv_android.cpp
design-viewer/src/main.cpp
+1
-1
1 addition, 1 deletion
design-viewer/src/main.cpp
with
29 additions
and
13 deletions
README.md
+
4
−
2
View file @
c39f7265
...
@@ -37,6 +37,7 @@ cmake \
...
@@ -37,6 +37,7 @@ cmake \
-B
build
\
-B
build
\
-G
Ninja
\
-G
Ninja
\
-DCMAKE_TOOLCHAIN_FILE
=
<qt-android-path>/lib/cmake/Qt6/qt.toolchain.cmake
\
-DCMAKE_TOOLCHAIN_FILE
=
<qt-android-path>/lib/cmake/Qt6/qt.toolchain.cmake
\
-DCMAKE_INSTALL_PREFIX
=
<qt-android-path>
\
-DANDROID_SDK_ROOT
=
<android-sdk-path>
\
-DANDROID_SDK_ROOT
=
<android-sdk-path>
\
-DANDROID_NDK_ROOT
=
<android-sdk-path>/ndk/<ndk-version>
\
-DANDROID_NDK_ROOT
=
<android-sdk-path>/ndk/<ndk-version>
\
-DANDROID_OPENSSL_PATH
=
<openssl-path>
-DANDROID_OPENSSL_PATH
=
<openssl-path>
...
@@ -73,7 +74,7 @@ source ./emsdk_env.sh
...
@@ -73,7 +74,7 @@ source ./emsdk_env.sh
cd
..
cd
..
```
```
Then build and install QtQuickDesigner Components for
Android
:
Then build and install QtQuickDesigner Components for
WebAssembly
:
```
bash
```
bash
cd
qtquickdesigner-components
cd
qtquickdesigner-components
...
@@ -81,7 +82,8 @@ cmake \
...
@@ -81,7 +82,8 @@ cmake \
-S
.
\
-S
.
\
-B
build
\
-B
build
\
-G
Ninja
\
-G
Ninja
\
-DCMAKE_TOOLCHAIN_FILE
=
<qt-wasm-path>/wasm/lib/cmake/Qt6/qt.toolchain.cmake
-DCMAKE_TOOLCHAIN_FILE
=
<qt-wasm-path>/wasm/lib/cmake/Qt6/qt.toolchain.cmake
\
-DCMAKE_INSTALL_PREFIX
=
<qt-wasm-path>
cmake
--build
build
cmake
--build
build
cmake
--install
build
cmake
--install
build
...
...
This diff is collapsed.
Click to expand it.
design-viewer/src/dv_android.cpp
+
24
−
10
View file @
c39f7265
...
@@ -77,15 +77,24 @@ QSharedPointer<QNetworkReply> DvAndroid::fetchResource(const QString &url)
...
@@ -77,15 +77,24 @@ QSharedPointer<QNetworkReply> DvAndroid::fetchResource(const QString &url)
&
QNetworkReply
::
sslErrors
,
&
QNetworkReply
::
sslErrors
,
this
,
this
,
[
&
](
const
QList
<
QSslError
>
&
errors
)
{
[
&
](
const
QList
<
QSslError
>
&
errors
)
{
print
Log
(
errors
.
first
().
errorString
());
print
Err
(
errors
.
first
().
errorString
());
});
});
QEventLoop
loop
;
QEventLoop
loop
;
QObject
::
connect
(
reply
.
data
(),
&
QNetworkReply
::
finished
,
&
loop
,
&
QEventLoop
::
quit
);
QObject
::
connect
(
reply
.
data
(),
&
QNetworkReply
::
finished
,
&
loop
,
&
QEventLoop
::
quit
);
QObject
::
connect
(
reply
.
data
(),
&
QNetworkReply
::
downloadProgress
,
this
,
[
&
](
qint64
bytesReceived
,
qint64
bytesTotal
)
{
float
percentage
=
roundf
((
float
)
bytesReceived
/
(
float
)
bytesTotal
*
100
);
printLog
(
"Download progress "
+
QString
::
number
(
percentage
)
+
"% - "
+
QString
::
number
(
bytesReceived
)
+
"/"
+
QString
::
number
(
bytesTotal
));
});
loop
.
exec
();
loop
.
exec
();
if
(
reply
->
error
()
!=
QNetworkReply
::
NoError
)
{
if
(
reply
->
error
()
!=
QNetworkReply
::
NoError
)
{
print
Log
(
reply
->
errorString
());
print
Err
(
reply
->
errorString
());
}
else
{
}
else
{
printLog
(
"Resource fetched successfully"
);
printLog
(
"Resource fetched successfully"
);
}
}
...
@@ -106,7 +115,11 @@ void DvAndroid::setupUi()
...
@@ -106,7 +115,11 @@ void DvAndroid::setupUi()
m_layout
->
addWidget
(
m_button
);
m_layout
->
addWidget
(
m_button
);
// show build info
// show build info
m_buildInfo
->
setText
(
QCoreApplication
::
applicationVersion
());
QString
buildInfo
=
"Qt Design Viewer for Android
\n
"
+
QCoreApplication
::
applicationVersion
()
+
"
\n
"
+
"Built with Qt "
+
QString
(
QT_VERSION_STR
)
+
"
\n
"
+
"OpenSSL support: "
+
QVariant
(
QSslSocket
::
supportsSsl
()).
toString
();
m_buildInfo
->
setText
(
buildInfo
);
m_buildInfo
->
setAlignment
(
Qt
::
AlignHCenter
);
// configure logs area
// configure logs area
m_logs
->
setWordWrap
(
true
);
m_logs
->
setWordWrap
(
true
);
...
@@ -121,8 +134,7 @@ void DvAndroid::setupUi()
...
@@ -121,8 +134,7 @@ void DvAndroid::setupUi()
});
});
// configure line edit
// configure line edit
m_lineEdit
->
setText
(
m_lineEdit
->
setPlaceholderText
(
"Enter project URL here"
);
"https://designviewer.qt.io/#17e8907b3b84b8206d45be4f551f4e25/TestTwo.qmlrc"
);
// configure the button
// configure the button
m_button
->
setText
(
"Download and run project"
);
m_button
->
setText
(
"Download and run project"
);
...
@@ -134,21 +146,25 @@ void DvAndroid::setupUi()
...
@@ -134,21 +146,25 @@ void DvAndroid::setupUi()
void
DvAndroid
::
printSysInfo
()
void
DvAndroid
::
printSysInfo
()
{
{
const
QRect
screenGeometry
=
QGuiApplication
::
primaryScreen
()
->
geometry
();
printLog
(
"Qt Design Viewer"
);
printLog
(
"Qt Design Viewer"
);
printLog
(
"System information:"
);
printLog
(
"System information:"
);
printLog
(
"-- Qt version: "
+
QString
(
QT_VERSION_STR
));
printLog
(
"-- Qt version: "
+
QString
(
QT_VERSION_STR
));
printLog
(
"-- OpenSSL support: "
+
QVariant
(
QSslSocket
::
supportsSsl
()).
toString
());
printLog
(
"-- OpenSSL support: "
+
QVariant
(
QSslSocket
::
supportsSsl
()).
toString
());
printLog
(
"--
Window
height: "
+
QString
::
number
(
m_mainWindow
.
height
()));
printLog
(
"--
Screen
height: "
+
QString
::
number
(
screenGeometry
.
height
()));
printLog
(
"--
Window
width: "
+
QString
::
number
(
m_mainWindow
.
width
()));
printLog
(
"--
Screen
width: "
+
QString
::
number
(
screenGeometry
.
width
()));
}
}
void
DvAndroid
::
updateLogo
()
void
DvAndroid
::
updateLogo
()
{
{
printLog
(
"Fetching logo..."
);
printLog
(
"Fetching logo..."
);
m_logo
->
setText
(
"Fetching logo..."
);
auto
logoReply
=
fetchResource
(
"https://designviewer.qt.io/qtdesignstudioviewer-256.png"
);
auto
logoReply
=
fetchResource
(
"https://designviewer.qt.io/qtdesignstudioviewer-256.png"
);
if
(
logoReply
->
error
()
!=
QNetworkReply
::
NoError
)
{
if
(
logoReply
->
error
()
!=
QNetworkReply
::
NoError
)
{
printErr
(
"Could not fetch logo"
);
printErr
(
"Could not fetch logo"
);
m_logo
->
setText
(
"Could not fetch logo"
);
return
;
return
;
}
}
...
@@ -176,8 +192,6 @@ void DvAndroid::fetchAndRunProject()
...
@@ -176,8 +192,6 @@ void DvAndroid::fetchAndRunProject()
printLog
(
"========================="
);
printLog
(
"========================="
);
printLog
(
"Fetching a new project..."
);
printLog
(
"Fetching a new project..."
);
// https://designviewer.qt.io/#17e8907b3b84b8206d45be4f551f4e25/TestTwo.qmlrc
// https://designviewer.qt.io/qmlprojects/17e8907b3b84b8206d45be4f551f4e25/TestTwo.qmlrc
QString
projectUrl
=
m_lineEdit
->
text
();
QString
projectUrl
=
m_lineEdit
->
text
();
if
(
projectUrl
.
startsWith
(
"https://designviewer.qt.io/#"
))
{
if
(
projectUrl
.
startsWith
(
"https://designviewer.qt.io/#"
))
{
...
@@ -216,7 +230,7 @@ void DvAndroid::showAppWindow()
...
@@ -216,7 +230,7 @@ void DvAndroid::showAppWindow()
printLog
(
"Calculating the new size and scale..."
);
printLog
(
"Calculating the new size and scale..."
);
const
QSizeF
contentSize
=
childItem
->
size
();
const
QSizeF
contentSize
=
childItem
->
size
();
const
QSizeF
newContentSize
=
contentSize
.
scaled
(
m_mainWindow
.
size
().
toSizeF
(),
const
QSizeF
newContentSize
=
contentSize
.
scaled
(
screenGeometry
.
size
().
toSizeF
(),
Qt
::
AspectRatioMode
::
KeepAspectRatio
);
Qt
::
AspectRatioMode
::
KeepAspectRatio
);
const
qreal
newScale
=
newContentSize
.
width
()
/
contentSize
.
width
();
const
qreal
newScale
=
newContentSize
.
width
()
/
contentSize
.
width
();
const
int
leftOffset
=
childItem
->
width
()
-
screenGeometry
.
width
();
const
int
leftOffset
=
childItem
->
width
()
-
screenGeometry
.
width
();
...
...
This diff is collapsed.
Click to expand it.
design-viewer/src/main.cpp
+
1
−
1
View file @
c39f7265
...
@@ -39,7 +39,7 @@ int main(int argc, char *argv[])
...
@@ -39,7 +39,7 @@ int main(int argc, char *argv[])
QSurfaceFormat
::
setDefaultFormat
(
format
);
QSurfaceFormat
::
setDefaultFormat
(
format
);
QScopedPointer
<
DvBase
>
dv
;
QScopedPointer
<
DvBase
>
dv
;
QCoreApplication
::
setApplicationVersion
(
QString
(
"Built on %1 %2
\n
"
).
arg
(
__DATE__
,
__TIME__
));
QCoreApplication
::
setApplicationVersion
(
QString
(
"Built on %1 %2"
).
arg
(
__DATE__
,
__TIME__
));
#ifdef Q_OS_WASM
#ifdef Q_OS_WASM
QGuiApplication
app
(
argc
,
argv
);
QGuiApplication
app
(
argc
,
argv
);
...
...
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