From 27a0182ab7a6643db95cf065ad741a1018e1fb0e Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Mon, 6 May 2019 22:24:51 +0100 Subject: [PATCH 1/3] Revert "Revert to colouring just the OK Log QSO button to help with colour-blindness accessibility" This reverts commit b9e194b74f68cca2d9061d3d4a4d19409c45204e. --- widgets/logqso.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/widgets/logqso.cpp b/widgets/logqso.cpp index b4b936d75..75ded8bca 100644 --- a/widgets/logqso.cpp +++ b/widgets/logqso.cpp @@ -42,6 +42,7 @@ LogQSO::LogQSO(QString const& programTitle, QSettings * settings ok_->setAutoDefault (false); ok_->setFocusPolicy (Qt::ClickFocus); ok_->setStyleSheet ("background-color: green"); + cancel_->setStyleSheet ("background-color: red"); cancel_->setAutoDefault (false); ui->button_layout->addStretch (); ui->button_layout->addWidget (ok_); From 1a914e980b9039d4671681f917f916a60cb569e6 Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Mon, 6 May 2019 22:25:01 +0100 Subject: [PATCH 2/3] Revert "Add background colour to Log QSO buttons as stronger visual cue" This reverts commit a8a1d8d0a7701610061e2e3e98c543e198aae981. --- widgets/logqso.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/widgets/logqso.cpp b/widgets/logqso.cpp index 75ded8bca..eae82aacc 100644 --- a/widgets/logqso.cpp +++ b/widgets/logqso.cpp @@ -41,8 +41,6 @@ LogQSO::LogQSO(QString const& programTitle, QSettings * settings ok_->setAutoDefault (false); ok_->setFocusPolicy (Qt::ClickFocus); - ok_->setStyleSheet ("background-color: green"); - cancel_->setStyleSheet ("background-color: red"); cancel_->setAutoDefault (false); ui->button_layout->addStretch (); ui->button_layout->addWidget (ok_); From 1c3b5543845d6bb6b284315dfb235ad8ddb9a80c Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Mon, 6 May 2019 22:25:06 +0100 Subject: [PATCH 3/3] Revert "Log buttons" This reverts commit 9e75b5c2b5d9827e14ef0d92470e56455edcec7f. --- widgets/logqso.cpp | 45 ++------------------------------------------- widgets/logqso.h | 3 --- widgets/logqso.ui | 44 ++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 44 insertions(+), 48 deletions(-) diff --git a/widgets/logqso.cpp b/widgets/logqso.cpp index eae82aacc..acbb340bc 100644 --- a/widgets/logqso.cpp +++ b/widgets/logqso.cpp @@ -1,12 +1,9 @@ #include "logqso.h" -#include -#include #include #include #include #include -#include #include "logbook/logbook.h" #include "MessageBox.hpp" @@ -18,40 +15,17 @@ #include "ui_logqso.h" #include "moc_logqso.cpp" -namespace -{ - using dist_type = std::uniform_int_distribution; - std::random_device rd; - std::mt19937 twister (rd ()); - dist_type int_distribution; -} - LogQSO::LogQSO(QString const& programTitle, QSettings * settings , Configuration const * config, QWidget *parent) : QDialog {parent, Qt::WindowStaysOnTopHint | Qt::WindowTitleHint | Qt::WindowSystemMenuHint} , ui(new Ui::LogQSO) - , ok_ {new QPushButton {"OK", this}} - , cancel_ {new QPushButton {"Cancel", this}} , m_settings (settings) , m_config {config} { ui->setupUi(this); setWindowTitle(programTitle + " - Log QSO"); - ui->grid->setValidator (new MaidenheadLocatorValidator {this}); - - ok_->setAutoDefault (false); - ok_->setFocusPolicy (Qt::ClickFocus); - cancel_->setAutoDefault (false); - ui->button_layout->addStretch (); - ui->button_layout->addWidget (ok_); - ui->button_layout->addStretch (); - ui->button_layout->addWidget (cancel_); - ui->button_layout->addStretch (); - loadSettings (); - - connect (ok_, &QAbstractButton::clicked, [this] (bool) {accept ();}); - connect (cancel_, &QAbstractButton::clicked, [this] (bool) {reject ();}); + ui->grid->setValidator (new MaidenheadLocatorValidator {this}); } LogQSO::~LogQSO () @@ -139,22 +113,7 @@ void LogQSO::initLogQSO(QString const& hisCall, QString const& hisGrid, QString } else { - // randomize accessible name of buttons - ok_->setAccessibleName (QString::number (int_distribution (twister))); - cancel_->setAccessibleName (QString::number (int_distribution (twister))); - // random sibling order of buttons - if (int_distribution (twister, dist_type::param_type {0, 1})) ok_->stackUnder (cancel_); else cancel_->stackUnder (ok_); - // random shuffle of layout items - for (int item = ui->button_layout->count () - 1; item > 0; --item) - { - auto other_item = int_distribution (twister, dist_type::param_type {0, item}); - if (item != other_item) - { - ui->button_layout->insertItem (other_item, ui->button_layout->takeAt (item)); - ui->button_layout->insertItem (item, ui->button_layout->takeAt (other_item + 1)); - } - } - show (); + show(); } } diff --git a/widgets/logqso.h b/widgets/logqso.h index 5cbb2044d..82a75b7bd 100644 --- a/widgets/logqso.h +++ b/widgets/logqso.h @@ -18,7 +18,6 @@ class QSettings; class Configuration; class QByteArray; class CabrilloLog; -class QPushButton; class LogQSO : public QDialog { @@ -53,8 +52,6 @@ private: void storeSettings () const; QScopedPointer ui; - QPushButton * ok_; - QPushButton * cancel_; QSettings * m_settings; Configuration const * m_config; QString m_txPower; diff --git a/widgets/logqso.ui b/widgets/logqso.ui index 7d249677d..a03a3028a 100644 --- a/widgets/logqso.ui +++ b/widgets/logqso.ui @@ -461,7 +461,14 @@ - + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + @@ -481,5 +488,38 @@ cbComments - + + + buttonBox + accepted() + LogQSO + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + LogQSO + reject() + + + 316 + 260 + + + 286 + 274 + + + +