linphone-desktop/Linphone/tool/providers/ImageProvider.cpp
Gaelle Braud 592d64bc8c Welcome page images
add resources file

belledonne image

Revert "belledonne image"

This reverts commit 4f7ea04c16aaec1ed321590620c61fad6010a148.

image

add images resources

new images

Welcome page images

add resources file

belledonne image

Revert "belledonne image"

This reverts commit 4f7ea04c16aaec1ed321590620c61fad6010a148.

image

add images resources

new images

image

image cmake

providers

Constants

Constants

start welcome page

start welcome page

Welcome page

welcome and login pages

default text item

Item : default input cell for any form

qml items

welcome/login template

add resources files to macro cmake

LoginPage : get username/pwd and call login

make welcome page temporary

icons

main stack view

Add final text + anims welcome page

fix previous

register constants in initCppInterfaces

unify images names

MR thread : clean

move login pages

use styling qml file

mr threads: unify colors

remove anchors warnings

custom combobox + modify custom textinput

mr thread : indent

mr thread : pointsize in style

mr thread : default style singleton

icons as style

change login base layout name

mr thread : color in style
2023-10-31 09:30:21 +01:00

85 lines
2.4 KiB
C++

/*
* Copyright (c) 2010-2024 Belledonne Communications SARL.
*
* This file is part of linphone-desktop
* (see https://www.linphone.org).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QElapsedTimer>
#include <QFileInfo>
#include <QPainter>
#include <QQmlPropertyMap>
#include <QRegularExpression>
#include <QScreen>
#include <QSvgRenderer>
#include "core/App.hpp"
#include "ImageProvider.hpp"
#include "tool/Constants.hpp"
// =============================================================================
using namespace std;
// -----------------------------------------------------------------------------
const QString ImageProvider::ProviderId = "internal";
ImageAsyncImageResponse::ImageAsyncImageResponse(const QString &id, const QSize &requestedSize) {
QString path = ":/data/image/";
QStringList filters;
filters << "*.svg";
QDir imageDir(path);
if (!imageDir.exists()) {
qDebug() << QStringLiteral("[ImageProvider] Dir doesn't exist: `%1`.").arg(path);
return;
}
QFileInfoList files = QDir(path).entryInfoList(filters, QDir::Files, QDir::Name);
for (QFileInfo file : files) {
if (file.fileName() == id) {
mPath = file.absoluteFilePath();
break;
}
}
QFile file(mPath);
if (!file.exists()) {
qDebug() << QStringLiteral("[ImageProvider] File doesn't exist: `%1`.").arg(mPath);
return;
}
QImage originalImage(mPath);
if (!originalImage.isNull()) {
emit imageGrabbed(originalImage);
}
}
void ImageAsyncImageResponse::imageGrabbed(QImage image) {
mImage = image;
emit finished();
}
QQuickTextureFactory *ImageAsyncImageResponse::textureFactory() const {
return QQuickTextureFactory::textureFactoryForImage(mImage);
}
QQuickImageResponse *ImageProvider::requestImageResponse(const QString &id, const QSize &requestedSize) {
ImageAsyncImageResponse *response = new ImageAsyncImageResponse(id, requestedSize);
return response;
}