- Change the object ownership semantics to take ownership of unique_ptr's rather than references

- Add helper functions for setting up config
- Add support for dynamically updating more config options (path related ones in particular)
This commit is contained in:
Alfred Reynolds
2021-08-11 14:01:18 +12:00
parent 8ac20f4b43
commit 24a4a07593
7 changed files with 121 additions and 81 deletions

View File

@@ -194,7 +194,7 @@ void MainWindow::updateImage(bool immediately)
QPixmap background = getBlurredBackground(rotated, scaled);
drawForeground(background, scaled);
if (overlay != NULL)
if (overlay != nullptr)
{
drawText(background, overlay->getMarginTopLeft(), overlay->getFontsizeTopLeft(), overlay->getRenderedTopLeft(currentImage.filename).c_str(), Qt::AlignTop|Qt::AlignLeft);
drawText(background, overlay->getMarginTopRight(), overlay->getFontsizeTopRight(), overlay->getRenderedTopRight(currentImage.filename).c_str(), Qt::AlignTop|Qt::AlignRight);
@@ -254,9 +254,9 @@ void MainWindow::drawForeground(QPixmap& background, const QPixmap& foreground)
pt.drawPixmap((background.width()-foreground.width())/2, (background.height()-foreground.height())/2, foreground);
}
void MainWindow::setOverlay(Overlay* o)
void MainWindow::setOverlay(std::unique_ptr<Overlay> &o)
{
overlay = o;
overlay = std::move(o);
}
QPixmap MainWindow::getBlurredBackground(const QPixmap& originalSize, const QPixmap& scaled)