Improvements on the system theme
This commit is contained in:
parent
f108b8b915
commit
1716502eff
35 changed files with 348 additions and 425 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue