mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-17 11:28:07 +00:00
Upgrade icons quality.
CMake: Automatic load for images.
This commit is contained in:
parent
8817396fa5
commit
b645696528
4 changed files with 42 additions and 83 deletions
|
|
@ -1,84 +1,13 @@
|
|||
list(APPEND _LINPHONEAPP_RC_FILES data/assistant/use-app-sip-account.rc
|
||||
data/assistant/create-app-sip-account.rc
|
||||
data/assistant/use-other-sip-account.rc
|
||||
"data/image/info.svg"
|
||||
"data/image/belledonne.svg"
|
||||
"data/image/user-circle.svg"
|
||||
"data/image/user-circle-gear.svg"
|
||||
"data/image/logo.svg"
|
||||
"data/image/login_image.svg"
|
||||
"data/image/eye-slash.svg"
|
||||
"data/image/linphone.svg"
|
||||
"data/image/secured.svg"
|
||||
"data/image/open_source.svg"
|
||||
"data/image/eye.svg"
|
||||
"data/image/caret-down.svg"
|
||||
"data/image/caret-left.svg"
|
||||
"data/image/caret-right.svg"
|
||||
"data/image/caret-up.svg"
|
||||
"data/image/verif_page_image.svg"
|
||||
"data/image/check.svg"
|
||||
"data/image/dialer.svg"
|
||||
"data/image/dialer-selected.svg"
|
||||
"data/image/chiffrement.svg"
|
||||
"data/image/interoperable.svg"
|
||||
"data/image/phone.svg"
|
||||
"data/image/phone-selected.svg"
|
||||
"data/image/phone-plus.svg"
|
||||
"data/image/phone-disconnect.svg"
|
||||
"data/image/phone-list.svg"
|
||||
"data/image/phone-transfer.svg"
|
||||
"data/image/address-book.svg"
|
||||
"data/image/address-book-selected.svg"
|
||||
"data/image/chat-teardrop-text.svg"
|
||||
"data/image/chat-teardrop-text-selected.svg"
|
||||
"data/image/users-three.svg"
|
||||
"data/image/users-three-selected.svg"
|
||||
"data/image/noItemImage.svg"
|
||||
"data/image/dots-three-vertical.svg"
|
||||
"data/image/more.svg"
|
||||
"data/image/plus-circle.svg"
|
||||
"data/image/microphone-stage.svg"
|
||||
"data/image/group-call.svg"
|
||||
"data/image/magnifying-glass.svg"
|
||||
"data/image/backspace-fill.svg"
|
||||
"data/image/x.svg"
|
||||
"data/image/play.svg"
|
||||
"data/image/incoming_call.svg"
|
||||
"data/image/incoming_call_missed.svg"
|
||||
"data/image/incoming_call_rejected.svg"
|
||||
"data/image/outgoing_call.svg"
|
||||
"data/image/outgoing_call_missed.svg"
|
||||
"data/image/outgoing_call_rejected.svg"
|
||||
"data/image/microphone.svg"
|
||||
"data/image/microphone-slash.svg"
|
||||
"data/image/camera.svg"
|
||||
"data/image/video-camera.svg"
|
||||
"data/image/video-camera-slash.svg"
|
||||
"data/image/speaker-high.svg"
|
||||
"data/image/speaker-slash.svg"
|
||||
"data/image/trusted.svg"
|
||||
"data/image/randomAvatar.png"
|
||||
"data/image/pause.svg"
|
||||
"data/image/smiley.svg"
|
||||
"data/image/trash-simple.svg"
|
||||
"data/image/copy.svg"
|
||||
"data/image/empty.svg"
|
||||
"data/image/heart.svg"
|
||||
"data/image/heart-fill.svg"
|
||||
"data/image/record-fill.svg"
|
||||
"data/image/pencil-simple.svg"
|
||||
"data/image/share-network.svg"
|
||||
"data/image/bell-simple.svg"
|
||||
"data/image/bell-simple-slash.svg"
|
||||
"data/image/media_encryption_zrtp_pq.svg"
|
||||
"data/image/question.svg"
|
||||
"data/image/settings.svg"
|
||||
"data/image/user-plus.svg"
|
||||
|
||||
data/shaders/roundEffect.vert.qsb
|
||||
data/shaders/roundEffect.frag.qsb
|
||||
|
||||
)
|
||||
|
||||
file(GLOB files LIST_DIRECTORIES false image/*)
|
||||
foreach(f ${files})
|
||||
get_filename_component(filename ${f} NAME)
|
||||
list(APPEND _LINPHONEAPP_RC_FILES data/image/${filename})
|
||||
endforeach()
|
||||
set(_LINPHONEAPP_RC_FILES ${_LINPHONEAPP_RC_FILES} PARENT_SCOPE)
|
||||
|
|
|
|||
|
|
@ -49,11 +49,14 @@ ImageAsyncImageResponse::ImageAsyncImageResponse(const QString &id, const QSize
|
|||
QDir imageDir(path);
|
||||
if (!imageDir.exists()) {
|
||||
qDebug() << QStringLiteral("[ImageProvider] Dir doesn't exist: `%1`.").arg(path);
|
||||
emit imageGrabbed(QImage(":/data/image/warning-circle.svg"));
|
||||
return;
|
||||
}
|
||||
QFileInfoList files = QDir(path).entryInfoList(filters, QDir::Files, QDir::Name);
|
||||
QFileInfo fileInfo;
|
||||
for (QFileInfo file : files) {
|
||||
if (file.fileName() == id) {
|
||||
fileInfo = file;
|
||||
mPath = file.absoluteFilePath();
|
||||
break;
|
||||
}
|
||||
|
|
@ -63,13 +66,44 @@ ImageAsyncImageResponse::ImageAsyncImageResponse(const QString &id, const QSize
|
|||
|
||||
if (!file.exists()) {
|
||||
qDebug() << QStringLiteral("[ImageProvider] File doesn't exist: `%1`.").arg(path + id);
|
||||
emit imageGrabbed(QImage(":/data/image/warning-circle.svg"));
|
||||
return;
|
||||
}
|
||||
QImage originalImage(mPath);
|
||||
|
||||
if (!originalImage.isNull()) {
|
||||
emit imageGrabbed(originalImage);
|
||||
if (Q_UNLIKELY(!file.open(QIODevice::ReadOnly))) {
|
||||
qWarning() << QStringLiteral("[ImageProvider] Unable to open file: `%1`.").arg(path);
|
||||
emit imageGrabbed(QImage(":/data/image/warning-circle.svg"));
|
||||
return;
|
||||
}
|
||||
|
||||
QImage image;
|
||||
|
||||
if (fileInfo.suffix() == "svg") {
|
||||
QSvgRenderer renderer(mPath);
|
||||
if (Q_UNLIKELY(!renderer.isValid())) {
|
||||
qWarning() << QStringLiteral("Invalid svg file: `%1`.").arg(path);
|
||||
image = QImage(mPath); // Fallback to QImage
|
||||
} else {
|
||||
renderer.setAspectRatioMode(Qt::KeepAspectRatio);
|
||||
QSize askedSize = !requestedSize.isEmpty()
|
||||
? requestedSize
|
||||
: renderer.defaultSize() * QGuiApplication::primaryScreen()->devicePixelRatio();
|
||||
// 3. Create image.
|
||||
image = QImage(askedSize, QImage::Format_ARGB32_Premultiplied);
|
||||
if (Q_UNLIKELY(image.isNull())) {
|
||||
qWarning() << QStringLiteral("Unable to create image from path: `%1`.").arg(path);
|
||||
image = QImage(mPath); // Fallback to QImage
|
||||
} else {
|
||||
image.fill(Qt::transparent); // Fill with transparent to set alpha channel
|
||||
// 4. Paint!
|
||||
QPainter painter(&image);
|
||||
renderer.render(&painter);
|
||||
}
|
||||
}
|
||||
} else image = QImage(mPath);
|
||||
|
||||
if (!image.isNull()) emit imageGrabbed(image);
|
||||
else emit imageGrabbed(QImage(":/data/image/warning-circle.svg"));
|
||||
}
|
||||
|
||||
void ImageAsyncImageResponse::imageGrabbed(QImage image) {
|
||||
|
|
|
|||
|
|
@ -68,8 +68,6 @@ Control.TabBar {
|
|||
imageSource: mainItem.currentIndex === index ? modelData.selectedIcon : modelData.icon
|
||||
Layout.preferredWidth: buttonSize
|
||||
Layout.preferredHeight: buttonSize
|
||||
width: buttonSize
|
||||
height: buttonSize
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
fillMode: Image.PreserveAspectFit
|
||||
colorizationColor: DefaultStyle.grey_0
|
||||
|
|
|
|||
|
|
@ -534,8 +534,6 @@ AbstractMainPage {
|
|||
property color colorizationColor: DefaultStyle.main2_500main
|
||||
EffectImage {
|
||||
imageSource: iconLabel.iconSource
|
||||
width: 24 * DefaultStyle.dp
|
||||
height: 24 * DefaultStyle.dp
|
||||
Layout.preferredWidth: 24 * DefaultStyle.dp
|
||||
Layout.preferredHeight: 24 * DefaultStyle.dp
|
||||
fillMode: Image.PreserveAspectFit
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue