Use QPushButton on the preview modal

remotes/origin/HEAD
Konstantinos Sideris 6 years ago
parent 773575ce52
commit adf2019c56
  1. 5
      src/Config.h
  2. 13
      src/dialogs/PreviewUploadOverlay.cpp
  3. 7
      src/dialogs/PreviewUploadOverlay.h

@ -46,9 +46,8 @@ constexpr int TEXT_SPACING = 4;
constexpr int BUTTON_SIZE = 36; constexpr int BUTTON_SIZE = 36;
constexpr int BUTTON_RADIUS = BUTTON_SIZE / 2; constexpr int BUTTON_RADIUS = BUTTON_SIZE / 2;
constexpr float BUTTON_TEXT_SIZE_RATIO = 1.3; constexpr auto LABEL_MEDIUM_SIZE_RATIO = 1.3;
constexpr float LABEL_MEDIUM_SIZE_RATIO = 1.3; constexpr auto LABEL_BIG_SIZE_RATIO = 2;
constexpr float LABEL_BIG_SIZE_RATIO = 2;
} }
namespace strings { namespace strings {

@ -39,14 +39,13 @@ PreviewUploadOverlay::PreviewUploadOverlay(QWidget *parent)
: QWidget{parent} : QWidget{parent}
, titleLabel_{this} , titleLabel_{this}
, fileName_{this} , fileName_{this}
, upload_{tr("Upload").toUpper(), this} , upload_{tr("Upload"), this}
, cancel_{tr("Cancel").toUpper(), this} , cancel_{tr("Cancel"), this}
{ {
auto hlayout = new QHBoxLayout; auto hlayout = new QHBoxLayout;
hlayout->addStretch(1); hlayout->addStretch(1);
hlayout->addWidget(&upload_);
hlayout->addWidget(&cancel_); hlayout->addWidget(&cancel_);
hlayout->setSpacing(0); hlayout->addWidget(&upload_);
hlayout->setMargin(0); hlayout->setMargin(0);
auto vlayout = new QVBoxLayout{this}; auto vlayout = new QVBoxLayout{this};
@ -57,6 +56,7 @@ PreviewUploadOverlay::PreviewUploadOverlay(QWidget *parent)
vlayout->setSpacing(conf::modals::WIDGET_SPACING); vlayout->setSpacing(conf::modals::WIDGET_SPACING);
vlayout->setMargin(conf::modals::WIDGET_MARGIN); vlayout->setMargin(conf::modals::WIDGET_MARGIN);
upload_.setDefault(true);
connect(&upload_, &QPushButton::clicked, [this]() { connect(&upload_, &QPushButton::clicked, [this]() {
emit confirmUpload(data_, mediaType_, fileName_.text()); emit confirmUpload(data_, mediaType_, fileName_.text());
close(); close();
@ -96,11 +96,6 @@ PreviewUploadOverlay::init()
upload_.setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); upload_.setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
cancel_.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_) { if (isImage_) {
infoLabel_.setAlignment(Qt::AlignCenter); infoLabel_.setAlignment(Qt::AlignCenter);

@ -20,10 +20,9 @@
#include <QLabel> #include <QLabel>
#include <QLineEdit> #include <QLineEdit>
#include <QPixmap> #include <QPixmap>
#include <QPushButton>
#include <QWidget> #include <QWidget>
#include "ui/FlatButton.h"
class QMimeData; class QMimeData;
namespace dialogs { namespace dialogs {
@ -55,7 +54,7 @@ private:
QLabel infoLabel_; QLabel infoLabel_;
QLineEdit fileName_; QLineEdit fileName_;
FlatButton upload_; QPushButton upload_;
FlatButton cancel_; QPushButton cancel_;
}; };
} // dialogs } // dialogs

Loading…
Cancel
Save