From 847327cf3273b6569c9aee64fa237bf423368b98 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Sat, 25 Aug 2018 15:37:30 -0400 Subject: [PATCH] Finish implementing the color-highlighting window. --- Configuration.ui | 8 +- colorhighlighting.cpp | 33 ++++++++- colorhighlighting.h | 11 ++- colorhighlighting.ui | 166 +++++++++++++++++++++++++++++++++++++++++- mainwindow.cpp | 10 ++- 5 files changed, 213 insertions(+), 15 deletions(-) diff --git a/Configuration.ui b/Configuration.ui index 9eb94ee8e..bf58ac3fc 100644 --- a/Configuration.ui +++ b/Configuration.ui @@ -3111,12 +3111,12 @@ soundcard changes - - - + + + - + diff --git a/colorhighlighting.cpp b/colorhighlighting.cpp index 1f217c31d..5fd8803ff 100644 --- a/colorhighlighting.cpp +++ b/colorhighlighting.cpp @@ -1,22 +1,51 @@ #include "colorhighlighting.h" #include "ui_colorhighlighting.h" +#include "SettingsGroup.hpp" #include #include -ColorHighlighting::ColorHighlighting(QWidget *parent) : +ColorHighlighting::ColorHighlighting(QSettings *settings, QWidget *parent) : QDialog(parent), + settings_ {settings}, ui(new Ui::ColorHighlighting) { ui->setupUi(this); + read_settings (); } ColorHighlighting::~ColorHighlighting() { + if (isVisible ()) write_settings (); delete ui; } -void ColorHighlighting::colorHighlightlingSetup() +void ColorHighlighting::read_settings () +{ + SettingsGroup group {settings_, "ColorScheme"}; + restoreGeometry (settings_->value ("window/geometry").toByteArray ()); +} + +void ColorHighlighting::write_settings () +{ + SettingsGroup group {settings_, "ColorScheme"}; + settings_->setValue ("window/geometry", saveGeometry ()); +} + + +void ColorHighlighting::colorHighlightlingSetup(QColor color_CQ,QColor color_MyCall, + QColor color_DXCC,QColor color_DXCCband,QColor color_NewCall, + QColor color_NewCallBand,QColor color_NewGrid,QColor color_NewGridBand, + QColor color_TxMsg) { setWindowTitle(QApplication::applicationName() + " - Colors"); + ui->label->setStyleSheet(QString("background: %1").arg(color_CQ.name())); + ui->label_3->setStyleSheet(QString("background: %1").arg(color_MyCall.name())); + ui->label_5->setStyleSheet(QString("background: %1").arg(color_TxMsg.name())); + ui->label_7->setStyleSheet(QString("background: %1").arg(color_DXCC.name())); + ui->label_9->setStyleSheet(QString("background: %1").arg(color_DXCCband.name())); + ui->label_11->setStyleSheet(QString("background: %1").arg(color_NewCall.name())); + ui->label_13->setStyleSheet(QString("background: %1").arg(color_NewCallBand.name())); + ui->label_15->setStyleSheet(QString("background: %1").arg(color_NewGrid.name())); + ui->label_17->setStyleSheet(QString("background: %1").arg(color_NewGridBand.name())); } diff --git a/colorhighlighting.h b/colorhighlighting.h index a7e1c4ba4..3b612a27f 100644 --- a/colorhighlighting.h +++ b/colorhighlighting.h @@ -2,6 +2,7 @@ #define COLORHIGHLIGHTING_H #include +#include namespace Ui { class ColorHighlighting; @@ -12,11 +13,17 @@ class ColorHighlighting : public QDialog Q_OBJECT public: - explicit ColorHighlighting(QWidget *parent = 0); + explicit ColorHighlighting(QSettings *, QWidget *parent = 0); ~ColorHighlighting(); - void colorHighlightlingSetup(); + void colorHighlightlingSetup(QColor color_CQ,QColor color_MyCall, + QColor color_DXCC,QColor color_DXCCband,QColor color_NewCall, + QColor color_NewCallBand,QColor color_NewGrid,QColor color_NewGridBand, + QColor color_TxMsg); private: + QSettings * settings_; + void read_settings (); + void write_settings (); Ui::ColorHighlighting *ui; }; diff --git a/colorhighlighting.ui b/colorhighlighting.ui index b560a01b0..b7865c465 100644 --- a/colorhighlighting.ui +++ b/colorhighlighting.ui @@ -1,17 +1,177 @@ + ColorHighlighting - + 0 0 - 400 - 300 + 196 + 265 Dialog + + + + + + + K1ABC + + + Qt::AlignCenter + + + + + + + CQ in message + + + + + + + K1ABC + + + Qt::AlignCenter + + + + + + + My Call in message + + + + + + + K1ABC + + + Qt::AlignCenter + + + + + + + Transmitted message + + + + + + + K1ABC + + + Qt::AlignCenter + + + + + + + New DXCC + + + + + + + K1ABC + + + Qt::AlignCenter + + + + + + + New DXCC on Band + + + + + + + K1ABC + + + Qt::AlignCenter + + + + + + + New Call + + + + + + + K1ABC + + + Qt::AlignCenter + + + + + + + New Call on Band + + + + + + + K1ABC + + + Qt::AlignCenter + + + + + + + New Grid + + + + + + + K1ABC + + + Qt::AlignCenter + + + + + + + New Grid on Band + + + + + + diff --git a/mainwindow.cpp b/mainwindow.cpp index c07823f64..351cafe82 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -2166,6 +2166,7 @@ void MainWindow::closeEvent(QCloseEvent * e) m_prefixes.reset (); m_shortcuts.reset (); m_mouseCmnds.reset (); + m_colorHighlighting.reset(); if(m_mode!="MSK144" and m_mode!="FT8") killFile(); float sw=0.0; int nw=400; @@ -2179,9 +2180,7 @@ void MainWindow::closeEvent(QCloseEvent * e) bool b=proc_jt9.waitForFinished(1000); if(!b) proc_jt9.close(); quitFile.remove(); - Q_EMIT finished (); - QMainWindow::closeEvent (e); } @@ -2376,12 +2375,15 @@ void MainWindow::on_actionFox_Log_triggered() void MainWindow::on_actionColors_triggered() { if (!m_colorHighlighting) { - m_colorHighlighting.reset (new ColorHighlighting); + m_colorHighlighting.reset (new ColorHighlighting {m_settings}); } m_colorHighlighting->showNormal(); m_colorHighlighting->raise (); m_colorHighlighting->activateWindow (); - m_colorHighlighting->colorHighlightlingSetup(); + m_colorHighlighting->colorHighlightlingSetup(m_config.color_CQ(),m_config.color_MyCall(), + m_config.color_DXCC(),m_config.color_DXCCband(),m_config.color_NewCall(), + m_config.color_NewCallBand(),m_config.color_NewGrid(),m_config.color_NewGridBand(), + m_config.color_TxMsg()); } void MainWindow::on_actionMessage_averaging_triggered()