mirror of
https://abf.rosa.ru/djam/clementine.git
synced 2025-02-24 15:33:02 +00:00
47 lines
1.9 KiB
Diff
47 lines
1.9 KiB
Diff
diff -urN clementine-1.0.0/src/ui/albumcoverchoicecontroller.cpp clementine-1.0.0-patched/src/ui/albumcoverchoicecontroller.cpp
|
|
--- clementine-1.0.0/src/ui/albumcoverchoicecontroller.cpp 2011-12-03 08:24:44.000000000 +1100
|
|
+++ clementine-1.0.0-patched/src/ui/albumcoverchoicecontroller.cpp 2012-01-21 18:45:38.228465474 +1100
|
|
@@ -36,6 +36,8 @@
|
|
#include <QList>
|
|
#include <QMenu>
|
|
#include <QUrl>
|
|
+#include <QApplication>
|
|
+#include <QDesktopWidget>
|
|
|
|
const char* AlbumCoverChoiceController::kLoadImageFileFilter =
|
|
QT_TR_NOOP("Images (*.png *.jpg *.jpeg *.bmp *.gif *.xpm *.pbm *.pgm *.ppm *.xbm)");
|
|
@@ -195,13 +197,28 @@
|
|
if (!song.album().isEmpty())
|
|
title_text += " - " + song.album();
|
|
|
|
+ QLabel* image = new QLabel(dialog);
|
|
+ QPixmap imagePic = AlbumCoverLoader::TryLoadPixmap(song.art_automatic(), song.art_manual(), song.url().toLocalFile());
|
|
+ int screenWidth = QApplication::desktop()->availableGeometry().width() - 40;
|
|
+ int screenHeight = QApplication::desktop()->availableGeometry().height() - 40;
|
|
+ int originalWidth = imagePic.width();
|
|
+ bool resizedPic = false;
|
|
+ if (imagePic.width() > screenWidth)
|
|
+ {
|
|
+ imagePic = imagePic.scaledToWidth(screenWidth, Qt::SmoothTransformation);
|
|
+ resizedPic = true;
|
|
+ }
|
|
+ if (imagePic.height() > screenHeight)
|
|
+ {
|
|
+ imagePic = imagePic.scaledToHeight(screenHeight, Qt::SmoothTransformation);
|
|
+ resizedPic = true;
|
|
+ }
|
|
+ image->setPixmap(imagePic);
|
|
+
|
|
+ dialog->setFixedSize(imagePic.width(), imagePic.height());
|
|
+ if (resizedPic && originalWidth)
|
|
+ title_text += " (" + QString::number(imagePic.width() * 100 / originalWidth) + "%)";
|
|
dialog->setWindowTitle(title_text);
|
|
-
|
|
- QLabel* label = new QLabel(dialog);
|
|
- label->setPixmap(AlbumCoverLoader::TryLoadPixmap(
|
|
- song.art_automatic(), song.art_manual(), song.url().toLocalFile()));
|
|
-
|
|
- dialog->resize(label->pixmap()->size());
|
|
dialog->show();
|
|
}
|
|
|