|
|
|
@@ -18,6 +18,7 @@
|
|
|
|
#include <QGraphicsPixmapItem>
|
|
|
|
#include <QGraphicsPixmapItem>
|
|
|
|
#include <QApplication>
|
|
|
|
#include <QApplication>
|
|
|
|
#include <QScreen>
|
|
|
|
#include <QScreen>
|
|
|
|
|
|
|
|
#include <QTransform>
|
|
|
|
|
|
|
|
|
|
|
|
MainWindow::MainWindow(QWidget *parent) :
|
|
|
|
MainWindow::MainWindow(QWidget *parent) :
|
|
|
|
QMainWindow(parent),
|
|
|
|
QMainWindow(parent),
|
|
|
|
@@ -170,11 +171,11 @@ void MainWindow::updateImage()
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
QLabel *label = this->findChild<QLabel*>("image");
|
|
|
|
QLabel *label = this->findChild<QLabel*>("image");
|
|
|
|
const QPixmap* oldImage = label->pixmap();
|
|
|
|
QPixmap oldImage = label->pixmap(Qt::ReturnByValue);
|
|
|
|
if (oldImage != NULL && transitionSeconds > 0)
|
|
|
|
if (!oldImage.isNull() && transitionSeconds > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
QPalette palette;
|
|
|
|
QPalette palette;
|
|
|
|
palette.setBrush(QPalette::Background, *oldImage);
|
|
|
|
palette.setBrush(QPalette::Window, oldImage);
|
|
|
|
this->setPalette(palette);
|
|
|
|
this->setPalette(palette);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -213,7 +214,7 @@ void MainWindow::updateImage()
|
|
|
|
|
|
|
|
|
|
|
|
label->setPixmap(background);
|
|
|
|
label->setPixmap(background);
|
|
|
|
|
|
|
|
|
|
|
|
if (oldImage != NULL && transitionSeconds > 0)
|
|
|
|
if (!oldImage.isNull() && transitionSeconds > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
auto effect = new QGraphicsOpacityEffect(label);
|
|
|
|
auto effect = new QGraphicsOpacityEffect(label);
|
|
|
|
effect->setOpacity(0.0);
|
|
|
|
effect->setOpacity(0.0);
|
|
|
|
@@ -273,9 +274,9 @@ QPixmap MainWindow::getBlurredBackground(const QPixmap& originalSize, const QPix
|
|
|
|
|
|
|
|
|
|
|
|
QPixmap MainWindow::getRotatedPixmap(const QPixmap& p)
|
|
|
|
QPixmap MainWindow::getRotatedPixmap(const QPixmap& p)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
QMatrix matrix;
|
|
|
|
QTransform transform;
|
|
|
|
matrix.rotate(currentImage.rotation);
|
|
|
|
transform.rotate(currentImage.rotation);
|
|
|
|
return p.transformed(matrix);
|
|
|
|
return p.transformed(transform);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QPixmap MainWindow::getScaledPixmap(const QPixmap& p)
|
|
|
|
QPixmap MainWindow::getScaledPixmap(const QPixmap& p)
|
|
|
|
@@ -325,12 +326,12 @@ void MainWindow::drawBackground(const QPixmap& originalSize, const QPixmap& scal
|
|
|
|
QPixmap background = blur(originalSize.scaledToHeight(height()));
|
|
|
|
QPixmap background = blur(originalSize.scaledToHeight(height()));
|
|
|
|
QRect rect((background.width() - width())/2, 0, width(), height());
|
|
|
|
QRect rect((background.width() - width())/2, 0, width(), height());
|
|
|
|
background = background.copy(rect);
|
|
|
|
background = background.copy(rect);
|
|
|
|
palette.setBrush(QPalette::Background, background);
|
|
|
|
palette.setBrush(QPalette::Window, background);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
QPixmap background = blur(originalSize.scaledToHeight(height()));
|
|
|
|
QPixmap background = blur(originalSize.scaledToHeight(height()));
|
|
|
|
QRect rect((background.width() - width())/2, 0, width(), height());
|
|
|
|
QRect rect((background.width() - width())/2, 0, width(), height());
|
|
|
|
background = background.copy(rect);
|
|
|
|
background = background.copy(rect);
|
|
|
|
palette.setBrush(QPalette::Background, background);
|
|
|
|
palette.setBrush(QPalette::Window, background);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this->setPalette(palette);
|
|
|
|
this->setPalette(palette);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|