Initial performance improvements

This commit is contained in:
Sebastian J. Wolf 2020-08-29 16:32:43 +02:00
parent 6c269780b2
commit 391dd597e2
12 changed files with 38 additions and 18 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View file

@ -107,19 +107,21 @@ Item {
width: parent.width width: parent.width
height: parent.height height: parent.height
anchors.centerIn: parent anchors.centerIn: parent
asynchronous: true
fillMode: Image.PreserveAspectCrop fillMode: Image.PreserveAspectCrop
visible: status === Image.Ready ? true : false visible: status === Image.Ready ? true : false
} }
Image { Image {
id: imageLoadingBackgroundImage id: imageLoadingBackgroundImage
source: "../../images/background" + ( Theme.colorScheme ? "-black" : "-white" ) + ".png" source: "../../images/background-" + ( Theme.colorScheme ? "black" : "white" ) + "-small.png"
anchors { anchors {
centerIn: parent centerIn: parent
} }
width: parent.width - Theme.paddingSmall width: parent.width - Theme.paddingSmall
height: parent.height - Theme.paddingSmall height: parent.height - Theme.paddingSmall
visible: placeholderImage.status !== Image.Ready visible: placeholderImage.status !== Image.Ready
asynchronous: true
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
opacity: 0.15 opacity: 0.15
@ -146,6 +148,7 @@ Item {
width: Theme.iconSizeLarge width: Theme.iconSizeLarge
height: Theme.iconSizeLarge height: Theme.iconSizeLarge
source: "image://theme/icon-l-play?white" source: "image://theme/icon-l-play?white"
asynchronous: true
visible: placeholderImage.status === Image.Ready ? true : false visible: placeholderImage.status === Image.Ready ? true : false
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
@ -343,6 +346,7 @@ Item {
anchors.centerIn: parent anchors.centerIn: parent
width: Theme.iconSizeLarge width: Theme.iconSizeLarge
height: Theme.iconSizeLarge height: Theme.iconSizeLarge
asynchronous: true
source: "image://theme/icon-l-play?white" source: "image://theme/icon-l-play?white"
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent

View file

@ -84,13 +84,14 @@ Item {
Image { Image {
id: imageLoadingBackgroundImage id: imageLoadingBackgroundImage
source: "../../images/background" + ( Theme.colorScheme ? "-black" : "-white" ) + ".png" source: "../../images/background-" + ( Theme.colorScheme ? "black" : "white" ) + "-small.png"
anchors { anchors {
centerIn: parent centerIn: parent
} }
width: parent.width - Theme.paddingMedium width: parent.width - Theme.paddingMedium
height: parent.height - Theme.paddingMedium height: parent.height - Theme.paddingMedium
visible: singleImage.status !== Image.Ready visible: singleImage.status !== Image.Ready
asynchronous: true
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
opacity: 0.15 opacity: 0.15

View file

@ -96,13 +96,14 @@ Item {
Image { Image {
id: imageLoadingBackgroundImage id: imageLoadingBackgroundImage
source: "../../images/background" + ( Theme.colorScheme ? "-black" : "-white" ) + ".png" source: "../../images/background-" + ( Theme.colorScheme ? "black" : "white" ) + "-small.png"
anchors { anchors {
centerIn: parent centerIn: parent
} }
width: ( ( parent.width - Theme.paddingSmall ) >= stickerData.width ) ? stickerData.width : ( parent.width - Theme.paddingSmall ) width: ( ( parent.width - Theme.paddingSmall ) >= stickerData.width ) ? stickerData.width : ( parent.width - Theme.paddingSmall )
height: ( ( parent.height - Theme.paddingSmall ) >= stickerData.height ) ? stickerData.height : ( parent.height - Theme.paddingSmall ) height: ( ( parent.height - Theme.paddingSmall ) >= stickerData.height ) ? stickerData.height : ( parent.height - Theme.paddingSmall )
visible: singleImage.status !== Image.Ready visible: singleImage.status !== Image.Ready
asynchronous: true
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
opacity: 0.15 opacity: 0.15

View file

@ -129,18 +129,20 @@ Item {
height: parent.height height: parent.height
anchors.centerIn: parent anchors.centerIn: parent
fillMode: Image.PreserveAspectCrop fillMode: Image.PreserveAspectCrop
asynchronous: true
visible: status === Image.Ready ? true : false visible: status === Image.Ready ? true : false
} }
Image { Image {
id: imageLoadingBackgroundImage id: imageLoadingBackgroundImage
source: "../../images/background" + ( Theme.colorScheme ? "-black" : "-white" ) + ".png" source: "../../images/background-" + ( Theme.colorScheme ? "black" : "white" ) + "-small.png"
anchors { anchors {
centerIn: parent centerIn: parent
} }
width: parent.width - Theme.paddingSmall width: parent.width - Theme.paddingSmall
height: parent.height - Theme.paddingSmall height: parent.height - Theme.paddingSmall
visible: placeholderImage.status !== Image.Ready visible: placeholderImage.status !== Image.Ready
asynchronous: true
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
opacity: 0.15 opacity: 0.15
@ -167,6 +169,7 @@ Item {
width: Theme.iconSizeLarge width: Theme.iconSizeLarge
height: Theme.iconSizeLarge height: Theme.iconSizeLarge
source: "image://theme/icon-l-play?white" source: "image://theme/icon-l-play?white"
asynchronous: true
visible: placeholderImage.status === Image.Ready ? true : false visible: placeholderImage.status === Image.Ready ? true : false
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
@ -194,6 +197,7 @@ Item {
anchors.centerIn: parent anchors.centerIn: parent
width: Theme.iconSizeLarge width: Theme.iconSizeLarge
height: Theme.iconSizeLarge height: Theme.iconSizeLarge
asynchronous: true
source: "../../images/icon-l-fullscreen.png" source: "../../images/icon-l-fullscreen.png"
visible: ( placeholderImage.status === Image.Ready && !videoMessageComponent.fullscreen ) ? true : false visible: ( placeholderImage.status === Image.Ready && !videoMessageComponent.fullscreen ) ? true : false
MouseArea { MouseArea {
@ -402,6 +406,7 @@ Item {
anchors.centerIn: parent anchors.centerIn: parent
width: Theme.iconSizeLarge width: Theme.iconSizeLarge
height: Theme.iconSizeLarge height: Theme.iconSizeLarge
asynchronous: true
source: "image://theme/icon-l-play?white" source: "image://theme/icon-l-play?white"
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
@ -423,6 +428,7 @@ Item {
anchors.centerIn: parent anchors.centerIn: parent
width: Theme.iconSizeLarge width: Theme.iconSizeLarge
height: Theme.iconSizeLarge height: Theme.iconSizeLarge
asynchronous: true
source: "../../images/icon-l-fullscreen.png" source: "../../images/icon-l-fullscreen.png"
visible: ( videoComponentLoader.active && messageVideo.playbackState === MediaPlayer.PausedState ) ? true : false visible: ( videoComponentLoader.active && messageVideo.playbackState === MediaPlayer.PausedState ) ? true : false
MouseArea { MouseArea {

View file

@ -38,7 +38,7 @@ Column {
} }
function updateWebPage() { function updateWebPage() {
if (typeof webPageData === "object") { if (webPageData) {
if (typeof webPageData.photo !== "undefined") { if (typeof webPageData.photo !== "undefined") {
hasImage = true; hasImage = true;
// Check first which size fits best... // Check first which size fits best...
@ -48,12 +48,11 @@ Column {
break; break;
} }
} }
} if (pictureFileInformation.local.is_downloading_completed) {
singleImage.source = pictureFileInformation.local.path;
if (pictureFileInformation.local.is_downloading_completed) { } else {
singleImage.source = pictureFileInformation.local.path; tdLibWrapper.downloadFile(pictureFileInformation.id);
} else { }
tdLibWrapper.downloadFile(pictureFileInformation.id);
} }
} }
} }
@ -74,7 +73,7 @@ Column {
id: siteNameText id: siteNameText
width: parent.width width: parent.width
text: Emoji.emojify(webPageData.site_name, font.pixelSize) text: webPageData.site_name ? Emoji.emojify(webPageData.site_name, font.pixelSize) : 0
font.pixelSize: Theme.fontSizeExtraSmall font.pixelSize: Theme.fontSizeExtraSmall
font.bold: true font.bold: true
color: Theme.secondaryHighlightColor color: Theme.secondaryHighlightColor
@ -88,7 +87,7 @@ Column {
id: titleText id: titleText
width: parent.width width: parent.width
text: Emoji.emojify(webPageData.title, font.pixelSize) text: webPageData.title ? Emoji.emojify(webPageData.title, font.pixelSize) : 0
font.pixelSize: Theme.fontSizeExtraSmall font.pixelSize: Theme.fontSizeExtraSmall
font.bold: true font.bold: true
color: Theme.primaryColor color: Theme.primaryColor
@ -103,7 +102,7 @@ Column {
id: descriptionText id: descriptionText
width: parent.width width: parent.width
text: Emoji.emojify(webPageData.description, font.pixelSize) text: webPageData.description ? Emoji.emojify(webPageData.description, font.pixelSize) : 0
font.pixelSize: Theme.fontSizeExtraSmall font.pixelSize: Theme.fontSizeExtraSmall
color: Theme.primaryColor color: Theme.primaryColor
elide: Text.ElideRight elide: Text.ElideRight
@ -141,13 +140,14 @@ Column {
Image { Image {
id: imageLoadingBackgroundImage id: imageLoadingBackgroundImage
source: "../../images/background" + ( Theme.colorScheme ? "-black" : "-white" ) + ".png" source: "../../images/background-" + ( Theme.colorScheme ? "black" : "white" ) + "-small.png"
anchors { anchors {
centerIn: parent centerIn: parent
} }
width: parent.width - Theme.paddingMedium width: parent.width - Theme.paddingMedium
height: parent.height - Theme.paddingMedium height: parent.height - Theme.paddingMedium
visible: hasImage && singleImage.status !== Image.Ready visible: hasImage && singleImage.status !== Image.Ready
asynchronous: true
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
opacity: 0.15 opacity: 0.15

View file

@ -50,6 +50,7 @@ Page {
} }
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
asynchronous: true
width: 2/3 * parent.width width: 2/3 * parent.width
} }

View file

@ -91,7 +91,7 @@ CoverBackground {
Image { Image {
id: backgroundImage id: backgroundImage
source: "../../images/background" + ( Theme.colorScheme ? "-black" : "-white" ) + ".png" source: "../../images/background-" + ( Theme.colorScheme ? "black" : "white" ) + ".png"
anchors { anchors {
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
@ -100,6 +100,7 @@ CoverBackground {
right: parent.right right: parent.right
rightMargin: Theme.paddingMedium rightMargin: Theme.paddingMedium
asynchronous: true
} }
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit

View file

@ -137,6 +137,7 @@ Page {
anchors.centerIn: parent anchors.centerIn: parent
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
asynchronous: true
visible: status === Image.Ready ? true : false visible: status === Image.Ready ? true : false
opacity: status === Image.Ready ? 1 : 0 opacity: status === Image.Ready ? 1 : 0
@ -171,13 +172,14 @@ Page {
Image { Image {
id: imageLoadingBackgroundImage id: imageLoadingBackgroundImage
source: "../../images/background" + ( Theme.colorScheme ? "-black" : "-white" ) + ".png" source: "../../images/background-" + ( Theme.colorScheme ? "black" : "white" ) + "-small.png"
anchors { anchors {
centerIn: parent centerIn: parent
} }
width: parent.width - Theme.paddingMedium width: parent.width - Theme.paddingMedium
height: parent.height - Theme.paddingMedium height: parent.height - Theme.paddingMedium
visible: singleImage.status !== Image.Ready visible: singleImage.status !== Image.Ready
asynchronous: true
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
opacity: 0.15 opacity: 0.15

View file

@ -79,6 +79,7 @@ Page {
} }
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
asynchronous: true
width: 1/2 * parent.width width: 1/2 * parent.width
} }
@ -119,6 +120,7 @@ Page {
} }
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
asynchronous: true
width: 1/2 * parent.width width: 1/2 * parent.width
} }
@ -171,6 +173,7 @@ Page {
} }
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
asynchronous: true
width: 1/2 * parent.width width: 1/2 * parent.width
} }
@ -229,6 +232,7 @@ Page {
} }
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
asynchronous: true
width: 1/2 * parent.width width: 1/2 * parent.width
} }

View file

@ -42,7 +42,7 @@ void TDLibReceiver::receiverLoop()
const char *result = td_json_client_receive(this->tdLibClient, WAIT_TIMEOUT); const char *result = td_json_client_receive(this->tdLibClient, WAIT_TIMEOUT);
if (result) { if (result) {
QJsonDocument receivedJsonDocument = QJsonDocument::fromJson(QByteArray(result)); QJsonDocument receivedJsonDocument = QJsonDocument::fromJson(QByteArray(result));
qDebug().noquote() << "[TDLibReceiver] Raw result: " << receivedJsonDocument.toJson(QJsonDocument::Indented); // qDebug().noquote() << "[TDLibReceiver] Raw result: " << receivedJsonDocument.toJson(QJsonDocument::Indented);
processReceivedDocument(receivedJsonDocument); processReceivedDocument(receivedJsonDocument);
} }
} }