diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CommunitiesList.cc | 2 | ||||
-rw-r--r-- | src/dialogs/PreviewUploadOverlay.cc | 14 |
2 files changed, 12 insertions, 4 deletions
diff --git a/src/CommunitiesList.cc b/src/CommunitiesList.cc index f2fb0438..822ca1d2 100644 --- a/src/CommunitiesList.cc +++ b/src/CommunitiesList.cc @@ -1,5 +1,5 @@ -#include "Cache.h" #include "CommunitiesList.h" +#include "Cache.h" #include "Logging.hpp" #include "MatrixClient.h" diff --git a/src/dialogs/PreviewUploadOverlay.cc b/src/dialogs/PreviewUploadOverlay.cc index e01d2b17..a4e31a7a 100644 --- a/src/dialogs/PreviewUploadOverlay.cc +++ b/src/dialogs/PreviewUploadOverlay.cc @@ -25,6 +25,7 @@ #include "Config.h" #include "Logging.hpp" +#include "MainWindow.h" #include "Utils.h" #include "dialogs/PreviewUploadOverlay.h" @@ -61,9 +62,16 @@ PreviewUploadOverlay::PreviewUploadOverlay(QWidget *parent) void PreviewUploadOverlay::init() { - auto window = QApplication::activeWindow(); - auto winsize = window->frameGeometry().size(); - auto center = window->frameGeometry().center(); + QSize winsize; + QPoint center; + + auto window = MainWindow::instance(); + if (window) { + winsize = window->frameGeometry().size(); + center = window->frameGeometry().center(); + } else { + nhlog::ui()->warn("unable to load the retrieve MainWindow's size"); + } fileName_.setText(QFileInfo{filePath_}.fileName()); |