diff options
author | Saturneric <[email protected]> | 2023-07-14 14:31:18 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2023-07-14 14:31:18 +0000 |
commit | 5fce8319125dbdc38ffedaacb636cc4cdf21419d (patch) | |
tree | 6f33ae39ecdd2e159f47e49a584389e9c4478e94 | |
parent | fix: improve ui (diff) | |
download | GpgFrontend-5fce8319125dbdc38ffedaacb636cc4cdf21419d.tar.gz GpgFrontend-5fce8319125dbdc38ffedaacb636cc4cdf21419d.zip |
fix: improve waiting dialog
-rw-r--r-- | src/ui/dialog/WaitingDialog.cpp | 24 | ||||
-rw-r--r-- | src/ui/dialog/WaitingDialog.h | 3 |
2 files changed, 5 insertions, 22 deletions
diff --git a/src/ui/dialog/WaitingDialog.cpp b/src/ui/dialog/WaitingDialog.cpp index afdd55b8..b0888581 100644 --- a/src/ui/dialog/WaitingDialog.cpp +++ b/src/ui/dialog/WaitingDialog.cpp @@ -28,10 +28,12 @@ #include "WaitingDialog.h" +#include "dialog/GeneralDialog.h" + namespace GpgFrontend::UI { WaitingDialog::WaitingDialog(const QString& title, QWidget* parent) - : QDialog(parent) { + : GeneralDialog("WaitingDialog", parent) { auto* pb = new QProgressBar(); pb->setRange(0, 0); pb->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); @@ -51,26 +53,6 @@ WaitingDialog::WaitingDialog(const QString& title, QWidget* parent) this->setAttribute(Qt::WA_DeleteOnClose); this->setFixedSize(240, 42); - if (parentWidget() == nullptr) { - auto* screen = QGuiApplication::primaryScreen(); - QRect geo = screen->availableGeometry(); - int screen_width = geo.width(); - int screen_height = geo.height(); - - SPDLOG_DEBUG("primary screen available geometry: {} {}", screen_width, - screen_height); - - auto pos = QPoint((screen_width - QWidget::width()) / 2, - (screen_height - QWidget::height()) / 2); - this->move(pos); - - } else { - auto pos = QPoint(parent->x() + (parent->width() - QWidget::width()) / 2, - parent->y() + (parent->height() - QWidget::height()) / 2); - SPDLOG_DEBUG("pos: {} {}", pos.x(), pos.y()); - this->move(pos); - } - this->show(); } diff --git a/src/ui/dialog/WaitingDialog.h b/src/ui/dialog/WaitingDialog.h index 1bb6a22b..c8193cba 100644 --- a/src/ui/dialog/WaitingDialog.h +++ b/src/ui/dialog/WaitingDialog.h @@ -30,6 +30,7 @@ #define __UI_WAITING_DIALOG_H__ #include "ui/GpgFrontendUI.h" +#include "ui/dialog/GeneralDialog.h" namespace GpgFrontend::UI { @@ -37,7 +38,7 @@ namespace GpgFrontend::UI { * @brief * */ -class WaitingDialog : public QDialog { +class WaitingDialog : public GeneralDialog { Q_OBJECT public: /** |