summaryrefslogtreecommitdiffstats
path: root/src/server/mainwindow/mainwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/mainwindow/mainwindow.cpp')
-rw-r--r--src/server/mainwindow/mainwindow.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/server/mainwindow/mainwindow.cpp b/src/server/mainwindow/mainwindow.cpp
index 88ed17d..7b95982 100644
--- a/src/server/mainwindow/mainwindow.cpp
+++ b/src/server/mainwindow/mainwindow.cpp
@@ -19,6 +19,9 @@
#include <QtGui>
#include <QFileDialog>
#include <QNetworkInterface>
+#include <QSvgRenderer>
+#include <QPainter>
+#include <QImage>
// Other custom UI elements
#include "../clicklabel/clicklabel.h"
#include "../sessionnamewindow/sessionnamewindow.h"
@@ -596,7 +599,6 @@ void MainWindow::resizeEvent(QResizeEvent* e)
(*it)->setSize(getTileWidthPx() * clientSize.width(), getTileHeightPx() * clientSize.height());
(*it)->move(newPos);
}
-
}
@@ -834,9 +836,18 @@ void MainWindow::switchRoomTo(QString roomToReload) {
ui->imageLabel->setPixmap(empty);
} else {
qDebug() << "set background image path: " << imgPath;
- QImage backgroundImage;
- backgroundImage.load(imgPath);
- ui->imageLabel->setPixmap(QPixmap::fromImage(backgroundImage));
+ QImage image;
+ if (imgPath.endsWith("svg")) {
+ /* render once with maximal screen size */
+ const QSize &s = QApplication::desktop()->screenGeometry().size(); // ui->frmRoom->geometry().size();
+ QSvgRenderer renderer(imgPath);
+ image = QImage(s, QImage::Format_ARGB32);
+ QPainter painter(&image);
+ renderer.render(&painter);
+ } else {
+ image.load(imgPath);
+ }
+ ui->imageLabel->setPixmap(QPixmap::fromImage(image));
ui->imageLabel->setScaledContents(true);
}