- merge from main
This commit is contained in:
@@ -119,8 +119,9 @@ bool MainWindow::event(QEvent* event)
|
||||
|
||||
void MainWindow::resizeEvent(QResizeEvent* event)
|
||||
{
|
||||
QMainWindow::resizeEvent(event);
|
||||
updateImage(true);
|
||||
QMainWindow::resizeEvent(event);
|
||||
this->findChild<QLabel*>("image")->clear();
|
||||
updateImage();
|
||||
}
|
||||
|
||||
void MainWindow::checkWindowSize()
|
||||
@@ -133,7 +134,7 @@ void MainWindow::checkWindowSize()
|
||||
{
|
||||
Log("Resizing Window", screenSize.width(), "," , screenSize.height() );
|
||||
setFixedSize(screenSize);
|
||||
updateImage(true);
|
||||
updateImage();
|
||||
}
|
||||
|
||||
if (imageAspectMatchesMonitor)
|
||||
@@ -166,7 +167,7 @@ void MainWindow::setImage(const ImageDetails &imageDetails)
|
||||
{
|
||||
pendingReply->abort();
|
||||
}
|
||||
updateImage(false);
|
||||
updateImage();
|
||||
}
|
||||
|
||||
void MainWindow::fileDownloaded(QNetworkReply* netReply)
|
||||
@@ -179,12 +180,12 @@ void MainWindow::fileDownloaded(QNetworkReply* netReply)
|
||||
{
|
||||
downloadedData = netReply->readAll();
|
||||
netReply->deleteLater();
|
||||
updateImage(false);
|
||||
updateImage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::updateImage(bool immediately)
|
||||
void MainWindow::updateImage()
|
||||
{
|
||||
checkWindowSize();
|
||||
if (currentImage.filename == "")
|
||||
@@ -203,7 +204,7 @@ void MainWindow::updateImage(bool immediately)
|
||||
|
||||
QLabel *label = this->findChild<QLabel*>("image");
|
||||
const QPixmap* oldImage = label->pixmap();
|
||||
if (oldImage != NULL && !immediately)
|
||||
if (oldImage != NULL && transitionSeconds > 0)
|
||||
{
|
||||
QPalette palette;
|
||||
palette.setBrush(QPalette::Background, *oldImage);
|
||||
@@ -256,13 +257,13 @@ void MainWindow::updateImage(bool immediately)
|
||||
|
||||
label->setPixmap(background);
|
||||
|
||||
if (oldImage != NULL && !immediately)
|
||||
if (oldImage != NULL && transitionSeconds > 0)
|
||||
{
|
||||
auto effect = new QGraphicsOpacityEffect(label);
|
||||
effect->setOpacity(0.0);
|
||||
label->setGraphicsEffect(effect);
|
||||
QPropertyAnimation* animation = new QPropertyAnimation(effect, "opacity");
|
||||
animation->setDuration(1000);
|
||||
animation->setDuration(transitionSeconds*1000);
|
||||
animation->setStartValue(0);
|
||||
animation->setEndValue(1);
|
||||
animation->start(QAbstractAnimation::DeleteWhenStopped);
|
||||
@@ -393,6 +394,11 @@ void MainWindow::setOverlayHexRGB(QString overlayHexRGB)
|
||||
this->overlayHexRGB = overlayHexRGB;
|
||||
}
|
||||
|
||||
void MainWindow::setTransitionTime(unsigned int transitionSeconds)
|
||||
{
|
||||
this->transitionSeconds = transitionSeconds;
|
||||
}
|
||||
|
||||
void MainWindow::warn(std::string text)
|
||||
{
|
||||
QLabel *label = this->findChild<QLabel*>("image");
|
||||
|
||||
Reference in New Issue
Block a user