mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-22 04:11:16 -05:00
Merge branch 'release-2.1.0' of bitbucket.org:k1jt/wsjtx into release-2.1.0
This commit is contained in:
commit
10b3debe8f
@ -1,12 +1,9 @@
|
|||||||
#include "logqso.h"
|
#include "logqso.h"
|
||||||
|
|
||||||
#include <random>
|
|
||||||
#include <limits>
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QPushButton>
|
|
||||||
|
|
||||||
#include "logbook/logbook.h"
|
#include "logbook/logbook.h"
|
||||||
#include "MessageBox.hpp"
|
#include "MessageBox.hpp"
|
||||||
@ -18,41 +15,17 @@
|
|||||||
#include "ui_logqso.h"
|
#include "ui_logqso.h"
|
||||||
#include "moc_logqso.cpp"
|
#include "moc_logqso.cpp"
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
using dist_type = std::uniform_int_distribution<int>;
|
|
||||||
std::random_device rd;
|
|
||||||
std::mt19937 twister (rd ());
|
|
||||||
dist_type int_distribution;
|
|
||||||
}
|
|
||||||
|
|
||||||
LogQSO::LogQSO(QString const& programTitle, QSettings * settings
|
LogQSO::LogQSO(QString const& programTitle, QSettings * settings
|
||||||
, Configuration const * config, QWidget *parent)
|
, Configuration const * config, QWidget *parent)
|
||||||
: QDialog {parent, Qt::WindowStaysOnTopHint | Qt::WindowTitleHint | Qt::WindowSystemMenuHint}
|
: QDialog {parent, Qt::WindowStaysOnTopHint | Qt::WindowTitleHint | Qt::WindowSystemMenuHint}
|
||||||
, ui(new Ui::LogQSO)
|
, ui(new Ui::LogQSO)
|
||||||
, ok_ {new QPushButton {"OK", this}}
|
|
||||||
, cancel_ {new QPushButton {"Cancel", this}}
|
|
||||||
, m_settings (settings)
|
, m_settings (settings)
|
||||||
, m_config {config}
|
, m_config {config}
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setWindowTitle(programTitle + " - Log QSO");
|
setWindowTitle(programTitle + " - Log QSO");
|
||||||
ui->grid->setValidator (new MaidenheadLocatorValidator {this});
|
|
||||||
|
|
||||||
ok_->setAutoDefault (false);
|
|
||||||
ok_->setFocusPolicy (Qt::ClickFocus);
|
|
||||||
ok_->setStyleSheet ("background-color: green");
|
|
||||||
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 ();
|
loadSettings ();
|
||||||
|
ui->grid->setValidator (new MaidenheadLocatorValidator {this});
|
||||||
connect (ok_, &QAbstractButton::clicked, [this] (bool) {accept ();});
|
|
||||||
connect (cancel_, &QAbstractButton::clicked, [this] (bool) {reject ();});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LogQSO::~LogQSO ()
|
LogQSO::~LogQSO ()
|
||||||
@ -140,22 +113,7 @@ void LogQSO::initLogQSO(QString const& hisCall, QString const& hisGrid, QString
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// randomize accessible name of buttons
|
show();
|
||||||
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 ();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,6 @@ class QSettings;
|
|||||||
class Configuration;
|
class Configuration;
|
||||||
class QByteArray;
|
class QByteArray;
|
||||||
class CabrilloLog;
|
class CabrilloLog;
|
||||||
class QPushButton;
|
|
||||||
|
|
||||||
class LogQSO : public QDialog
|
class LogQSO : public QDialog
|
||||||
{
|
{
|
||||||
@ -53,8 +52,6 @@ private:
|
|||||||
void storeSettings () const;
|
void storeSettings () const;
|
||||||
|
|
||||||
QScopedPointer<Ui::LogQSO> ui;
|
QScopedPointer<Ui::LogQSO> ui;
|
||||||
QPushButton * ok_;
|
|
||||||
QPushButton * cancel_;
|
|
||||||
QSettings * m_settings;
|
QSettings * m_settings;
|
||||||
Configuration const * m_config;
|
Configuration const * m_config;
|
||||||
QString m_txPower;
|
QString m_txPower;
|
||||||
|
@ -461,7 +461,14 @@
|
|||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="button_layout"/>
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
@ -481,5 +488,38 @@
|
|||||||
<tabstop>cbComments</tabstop>
|
<tabstop>cbComments</tabstop>
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>accepted()</signal>
|
||||||
|
<receiver>LogQSO</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>248</x>
|
||||||
|
<y>254</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>157</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>LogQSO</receiver>
|
||||||
|
<slot>reject()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>316</x>
|
||||||
|
<y>260</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>286</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
</ui>
|
</ui>
|
||||||
|
Loading…
Reference in New Issue
Block a user