Skip to content
Snippets Groups Projects
Commit adf2019c authored by Konstantinos Sideris's avatar Konstantinos Sideris
Browse files

Use QPushButton on the preview modal

parent 773575ce
No related branches found
No related tags found
No related merge requests found
......@@ -46,9 +46,8 @@ constexpr int TEXT_SPACING = 4;
constexpr int BUTTON_SIZE = 36;
constexpr int BUTTON_RADIUS = BUTTON_SIZE / 2;
constexpr float BUTTON_TEXT_SIZE_RATIO = 1.3;
constexpr float LABEL_MEDIUM_SIZE_RATIO = 1.3;
constexpr float LABEL_BIG_SIZE_RATIO = 2;
constexpr auto LABEL_MEDIUM_SIZE_RATIO = 1.3;
constexpr auto LABEL_BIG_SIZE_RATIO = 2;
}
namespace strings {
......
......@@ -39,14 +39,13 @@ PreviewUploadOverlay::PreviewUploadOverlay(QWidget *parent)
: QWidget{parent}
, titleLabel_{this}
, fileName_{this}
, upload_{tr("Upload").toUpper(), this}
, cancel_{tr("Cancel").toUpper(), this}
, upload_{tr("Upload"), this}
, cancel_{tr("Cancel"), this}
{
auto hlayout = new QHBoxLayout;
hlayout->addStretch(1);
hlayout->addWidget(&upload_);
hlayout->addWidget(&cancel_);
hlayout->setSpacing(0);
hlayout->addWidget(&upload_);
hlayout->setMargin(0);
auto vlayout = new QVBoxLayout{this};
......@@ -57,6 +56,7 @@ PreviewUploadOverlay::PreviewUploadOverlay(QWidget *parent)
vlayout->setSpacing(conf::modals::WIDGET_SPACING);
vlayout->setMargin(conf::modals::WIDGET_MARGIN);
upload_.setDefault(true);
connect(&upload_, &QPushButton::clicked, [this]() {
emit confirmUpload(data_, mediaType_, fileName_.text());
close();
......@@ -96,11 +96,6 @@ PreviewUploadOverlay::init()
upload_.setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
cancel_.setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
QFont buttonFont;
buttonFont.setPointSizeF(buttonFont.pointSizeF() * conf::modals::BUTTON_TEXT_SIZE_RATIO);
upload_.setFont(buttonFont);
cancel_.setFont(buttonFont);
if (isImage_) {
infoLabel_.setAlignment(Qt::AlignCenter);
......
......@@ -20,10 +20,9 @@
#include <QLabel>
#include <QLineEdit>
#include <QPixmap>
#include <QPushButton>
#include <QWidget>
#include "ui/FlatButton.h"
class QMimeData;
namespace dialogs {
......@@ -55,7 +54,7 @@ private:
QLabel infoLabel_;
QLineEdit fileName_;
FlatButton upload_;
FlatButton cancel_;
QPushButton upload_;
QPushButton cancel_;
};
} // dialogs
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment