Reorganize main window and style meter

This commit is contained in:
Jordan Sherer 2018-03-10 16:59:09 -05:00
parent e694d862aa
commit 87cdc7f7e7
6 changed files with 718 additions and 455 deletions

View File

@ -294,7 +294,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
wsprNet {new WSPRNet {&m_network_manager, this}}, wsprNet {new WSPRNet {&m_network_manager, this}},
m_appDir {QApplication::applicationDirPath ()}, m_appDir {QApplication::applicationDirPath ()},
m_palette {"Linrad"}, m_palette {"Linrad"},
m_mode {"JT9"}, m_mode {"FT8"},
m_rpt {"-15"}, m_rpt {"-15"},
m_pfx { m_pfx {
"1A", "1S", "1A", "1S",
@ -838,7 +838,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
if(m_bFast9) m_bFastMode=true; if(m_bFast9) m_bFastMode=true;
ui->cbFast9->setChecked(m_bFast9 or m_bFastMode); ui->cbFast9->setChecked(m_bFast9 or m_bFastMode);
if(m_mode=="FT8") on_actionFT8_triggered(); if(true || m_mode=="FT8") on_actionFT8_triggered();
if(m_mode=="JT4") on_actionJT4_triggered(); if(m_mode=="JT4") on_actionJT4_triggered();
if(m_mode=="JT9") on_actionJT9_triggered(); if(m_mode=="JT9") on_actionJT9_triggered();
if(m_mode=="JT65") on_actionJT65_triggered(); if(m_mode=="JT65") on_actionJT65_triggered();

File diff suppressed because it is too large Load Diff

View File

@ -57,12 +57,14 @@ void MeterWidget::paintEvent (QPaintEvent * event)
auto const& target = contentsRect (); auto const& target = contentsRect ();
QRect r {QPoint {target.left (), static_cast<int> (target.top () + target.height () - m_signal / (double)MAXDB * target.height ())} QRect r {QPoint {target.left (), static_cast<int> (target.top () + target.height () - m_signal / (double)MAXDB * target.height ())}
, QPoint {target.right (), target.bottom ()}}; , QPoint {target.right (), target.bottom ()}};
p.setBrush (QColor(85,170,85)); //p.setBrush (QColor(85,170,85));
p.setBrush (Qt::green);
if (m_sigPeak > 85) { if (m_sigPeak > 85) {
p.setBrush(Qt::red); p.setBrush(Qt::red);
} }
else if (m_noisePeak < 15) { else if (m_noisePeak < 15) {
p.setBrush(QColor(232,81,0)); //p.setBrush(QColor(232,81,0));
p.setBrush(Qt::yellow);
} }
p.drawRect (r); p.drawRect (r);
@ -70,9 +72,11 @@ void MeterWidget::paintEvent (QPaintEvent * event)
{ {
// Draw peak hold indicator // Draw peak hold indicator
auto peak = static_cast<int> (target.top () + target.height () - m_noisePeak / (double)MAXDB * target.height ()); auto peak = static_cast<int> (target.top () + target.height () - m_noisePeak / (double)MAXDB * target.height ());
p.setBrush (Qt::black); //p.setBrush (Qt::black);
p.setBrush (Qt::white);
p.translate (target.left (), peak); p.translate (target.left (), peak);
p.drawPolygon (QPolygon {{{0, -4}, {0, 4}, {target.width (), 0}}}); //p.drawPolygon (QPolygon {{{0, -4}, {0, 4}, {target.width (), 0}}});
p.drawPolygon (QPolygon { { {target.width (), -4}, {target.width (), 4}, {0, 0} } });
} }
} }

View File

@ -83,6 +83,6 @@ QString version (bool include_patch)
QString program_title (QString const& revision) QString program_title (QString const& revision)
{ {
QString id {QCoreApplication::applicationName () + " v" + QCoreApplication::applicationVersion ()}; QString id {"FT8Call by KN4CRD a derivative of " + QCoreApplication::applicationName () + " v" + QCoreApplication::applicationVersion ()};
return id + " " + revision + " by K1JT"; return id + " " + revision + " by K1JT";
} }

View File

@ -44,6 +44,7 @@ protected:
QWidget::paintEvent (event); QWidget::paintEvent (event);
QPainter p {this}; QPainter p {this};
p.setPen(Qt::white);
auto const& target = contentsRect (); auto const& target = contentsRect ();
QFontMetrics font_metrics {p.font (), this}; QFontMetrics font_metrics {p.font (), this};
auto font_offset = font_metrics.ascent () / 2; auto font_offset = font_metrics.ascent () / 2;
@ -82,12 +83,18 @@ SignalMeter::SignalMeter (QWidget * parent)
m_meter = new MeterWidget; m_meter = new MeterWidget;
m_meter->setSizePolicy (QSizePolicy::Minimum, QSizePolicy::Minimum); m_meter->setSizePolicy (QSizePolicy::Minimum, QSizePolicy::Minimum);
inner_layout->addWidget (m_meter); //inner_layout->addWidget (m_meter);
m_scale = new Scale; m_scale = new Scale;
inner_layout->addWidget (m_scale); inner_layout->addWidget (m_scale);
// add this second...
inner_layout->addWidget (m_meter);
m_reading = new QLabel(this); m_reading = new QLabel(this);
auto p = m_reading->palette();
p.setColor(m_reading->foregroundRole(), Qt::white);
m_reading->setPalette(p);
outer_layout->addLayout (inner_layout); outer_layout->addLayout (inner_layout);
outer_layout->addWidget (m_reading); outer_layout->addWidget (m_reading);

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.5.1, 2018-02-02T18:34:55. --> <!-- Written by QtCreator 3.5.1, 2018-03-10T16:32:07. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>EnvironmentId</variable> <variable>EnvironmentId</variable>