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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -79,6 +79,7 @@ Page {
}
fillMode: Image.PreserveAspectFit
asynchronous: true
width: 1/2 * parent.width
}
@ -119,6 +120,7 @@ Page {
}
fillMode: Image.PreserveAspectFit
asynchronous: true
width: 1/2 * parent.width
}
@ -171,6 +173,7 @@ Page {
}
fillMode: Image.PreserveAspectFit
asynchronous: true
width: 1/2 * parent.width
}
@ -229,6 +232,7 @@ Page {
}
fillMode: Image.PreserveAspectFit
asynchronous: true
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);
if (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);
}
}