summary refs log tree commit diff
path: root/src/dialogs/LeaveRoom.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/dialogs/LeaveRoom.cpp')
-rw-r--r--src/dialogs/LeaveRoom.cpp38
1 files changed, 13 insertions, 25 deletions
diff --git a/src/dialogs/LeaveRoom.cpp b/src/dialogs/LeaveRoom.cpp

index 30f8dace..5ac62615 100644 --- a/src/dialogs/LeaveRoom.cpp +++ b/src/dialogs/LeaveRoom.cpp
@@ -1,11 +1,11 @@ #include <QLabel> +#include <QPushButton> #include <QStyleOption> #include <QVBoxLayout> #include "dialogs/LeaveRoom.h" #include "Config.h" -#include "ui/FlatButton.h" #include "ui/Theme.h" using namespace dialogs; @@ -13,6 +13,11 @@ using namespace dialogs; LeaveRoom::LeaveRoom(QWidget *parent) : QFrame(parent) { + setAutoFillBackground(true); + setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint); + setWindowModality(Qt::WindowModal); + setAttribute(Qt::WA_DeleteOnClose, true); + setMinimumWidth(conf::modals::MIN_WIDGET_WIDTH); setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum); @@ -24,37 +29,20 @@ LeaveRoom::LeaveRoom(QWidget *parent) buttonLayout->setSpacing(0); buttonLayout->setMargin(0); - QFont buttonFont; - buttonFont.setPointSizeF(buttonFont.pointSizeF() * conf::modals::BUTTON_TEXT_SIZE_RATIO); - - confirmBtn_ = new FlatButton("LEAVE", this); - confirmBtn_->setFont(buttonFont); - - cancelBtn_ = new FlatButton(tr("CANCEL"), this); - cancelBtn_->setFont(buttonFont); + confirmBtn_ = new QPushButton("Leave", this); + cancelBtn_ = new QPushButton(tr("Cancel"), this); + cancelBtn_->setDefault(true); buttonLayout->addStretch(1); - buttonLayout->addWidget(confirmBtn_); + buttonLayout->setSpacing(15); buttonLayout->addWidget(cancelBtn_); - - QFont font; - font.setPointSizeF(font.pointSizeF() * conf::modals::LABEL_MEDIUM_SIZE_RATIO); + buttonLayout->addWidget(confirmBtn_); auto label = new QLabel(tr("Are you sure you want to leave?"), this); - label->setFont(font); layout->addWidget(label); layout->addLayout(buttonLayout); - connect(confirmBtn_, &QPushButton::clicked, [this]() { emit closing(true); }); - connect(cancelBtn_, &QPushButton::clicked, [this]() { emit closing(false); }); -} - -void -LeaveRoom::paintEvent(QPaintEvent *) -{ - QStyleOption opt; - opt.init(this); - QPainter p(this); - style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); + connect(confirmBtn_, &QPushButton::clicked, this, &LeaveRoom::leaving); + connect(cancelBtn_, &QPushButton::clicked, this, &LeaveRoom::close); }