diff --git a/images/background-black-small.png b/images/background-black-small.png new file mode 100644 index 0000000..7b59b4b Binary files /dev/null and b/images/background-black-small.png differ diff --git a/images/background-white-small.png b/images/background-white-small.png new file mode 100644 index 0000000..250afb0 Binary files /dev/null and b/images/background-white-small.png differ diff --git a/qml/components/AudioPreview.qml b/qml/components/AudioPreview.qml index 652b56c..05139e9 100644 --- a/qml/components/AudioPreview.qml +++ b/qml/components/AudioPreview.qml @@ -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 diff --git a/qml/components/ImagePreview.qml b/qml/components/ImagePreview.qml index 1a7d4ea..67798c3 100644 --- a/qml/components/ImagePreview.qml +++ b/qml/components/ImagePreview.qml @@ -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 diff --git a/qml/components/StickerPreview.qml b/qml/components/StickerPreview.qml index 57dc882..974768e 100644 --- a/qml/components/StickerPreview.qml +++ b/qml/components/StickerPreview.qml @@ -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 diff --git a/qml/components/VideoPreview.qml b/qml/components/VideoPreview.qml index 96941b6..e5a6b8b 100644 --- a/qml/components/VideoPreview.qml +++ b/qml/components/VideoPreview.qml @@ -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 { diff --git a/qml/components/WebPagePreview.qml b/qml/components/WebPagePreview.qml index b984331..5072f62 100644 --- a/qml/components/WebPagePreview.qml +++ b/qml/components/WebPagePreview.qml @@ -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 diff --git a/qml/pages/AboutPage.qml b/qml/pages/AboutPage.qml index 087a5b3..d7ea27c 100644 --- a/qml/pages/AboutPage.qml +++ b/qml/pages/AboutPage.qml @@ -50,6 +50,7 @@ Page { } fillMode: Image.PreserveAspectFit + asynchronous: true width: 2/3 * parent.width } diff --git a/qml/pages/CoverPage.qml b/qml/pages/CoverPage.qml index 115d296..ac22f40 100644 --- a/qml/pages/CoverPage.qml +++ b/qml/pages/CoverPage.qml @@ -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 diff --git a/qml/pages/ImagePage.qml b/qml/pages/ImagePage.qml index b02bb17..e580171 100644 --- a/qml/pages/ImagePage.qml +++ b/qml/pages/ImagePage.qml @@ -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 diff --git a/qml/pages/InitializationPage.qml b/qml/pages/InitializationPage.qml index 8e9b5aa..d52f912 100644 --- a/qml/pages/InitializationPage.qml +++ b/qml/pages/InitializationPage.qml @@ -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 } diff --git a/src/tdlibreceiver.cpp b/src/tdlibreceiver.cpp index d8c51f5..dfe762a 100644 --- a/src/tdlibreceiver.cpp +++ b/src/tdlibreceiver.cpp @@ -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); } }