Added configuration options to style transmit and receive text

This commit is contained in:
Jordan Sherer 2018-09-07 10:12:40 -04:00
parent b0937ffe18
commit 775008be48
5 changed files with 811 additions and 607 deletions

View File

@ -433,7 +433,6 @@ private:
void insert_station ();
Q_SLOT void on_font_push_button_clicked ();
Q_SLOT void on_decoded_text_font_push_button_clicked ();
Q_SLOT void on_PTT_port_combo_box_activated (int);
Q_SLOT void on_CAT_port_combo_box_activated (int);
Q_SLOT void on_CAT_serial_baud_combo_box_currentIndexChanged (int);
@ -467,9 +466,13 @@ private:
Q_SLOT void handle_transceiver_failure (QString const& reason);
Q_SLOT void on_pbCQmsg_clicked();
Q_SLOT void on_pbMyCall_clicked();
Q_SLOT void on_pbTxMsg_clicked();
Q_SLOT void on_pbNewDXCC_clicked();
Q_SLOT void on_pbNewCall_clicked();
Q_SLOT void on_rxBackgroundButton_clicked();
Q_SLOT void on_rxForegroundButton_clicked();
Q_SLOT void on_rxFontButton_clicked();
Q_SLOT void on_txBackgroundButton_clicked();
Q_SLOT void on_txForegroundButton_clicked();
Q_SLOT void on_txFontButton_clicked();
Q_SLOT void on_cbFox_clicked (bool);
Q_SLOT void on_cbHound_clicked (bool);
Q_SLOT void on_cbx2ToneSpacing_clicked(bool);
@ -503,8 +506,11 @@ private:
QFont font_;
QFont next_font_;
QFont decoded_text_font_;
QFont next_decoded_text_font_;
QFont rx_text_font_;
QFont next_rx_text_font_;
QFont tx_text_font_;
QFont next_tx_text_font_;
bool restart_sound_input_device_;
bool restart_sound_output_device_;
@ -561,12 +567,18 @@ private:
QString reply_;
int callsign_aging_;
int activity_aging_;
QColor color_CQ_;
QColor next_color_CQ_;
QColor color_MyCall_;
QColor next_color_MyCall_;
QColor color_ReceivedMsg_;
QColor next_color_ReceivedMsg_;
QColor color_cq_;
QColor next_color_cq_;
QColor color_mycall_;
QColor next_color_mycall_;
QColor color_rx_background_;
QColor next_color_rx_background_;
QColor color_rx_foreground_;
QColor next_color_rx_foreground_;
QColor color_tx_background_;
QColor next_color_tx_background_;
QColor color_tx_foreground_;
QColor next_color_tx_foreground_;
QColor color_DXCC_;
QColor next_color_DXCC_;
QColor color_NewCall_;
@ -671,13 +683,17 @@ bool Configuration::restart_audio_output () const {return m_->restart_sound_outp
auto Configuration::type_2_msg_gen () const -> Type2MsgGen {return m_->type_2_msg_gen_;}
bool Configuration::use_dynamic_grid() const {return m_->use_dynamic_info_; }
QString Configuration::my_callsign () const {return m_->my_callsign_;}
QColor Configuration::color_CQ () const {return m_->color_CQ_;}
QColor Configuration::color_MyCall () const {return m_->color_MyCall_;}
QColor Configuration::color_ReceivedMsg () const {return m_->color_ReceivedMsg_;}
QColor Configuration::color_CQ () const {return m_->color_cq_;}
QColor Configuration::color_MyCall () const {return m_->color_mycall_;}
QColor Configuration::color_rx_background () const {return m_->color_rx_background_;}
QColor Configuration::color_rx_foreground () const {return m_->color_rx_foreground_;}
QColor Configuration::color_tx_background () const {return m_->color_tx_background_;}
QColor Configuration::color_tx_foreground () const {return m_->color_tx_foreground_;}
QColor Configuration::color_DXCC () const {return m_->color_DXCC_;}
QColor Configuration::color_NewCall () const {return m_->color_NewCall_;}
QFont Configuration::text_font () const {return m_->font_;}
QFont Configuration::decoded_text_font () const {return m_->decoded_text_font_;}
QFont Configuration::rx_text_font () const {return m_->rx_text_font_;}
QFont Configuration::tx_text_font () const {return m_->tx_text_font_;}
qint32 Configuration::id_interval () const {return m_->id_interval_;}
qint32 Configuration::ntrials() const {return m_->ntrials_;}
qint32 Configuration::aggressive() const {return m_->aggressive_;}
@ -1244,11 +1260,14 @@ void Configuration::impl::initialize_models ()
ui_->cq_message_line_edit->setText(cq_.toUpper());
ui_->reply_message_line_edit->setText (reply_.toUpper());
ui_->use_dynamic_grid->setChecked(use_dynamic_info_);
ui_->labCQ->setStyleSheet(QString("background: %1").arg(color_CQ_.name()));
ui_->labMyCall->setStyleSheet(QString("background: %1").arg(color_MyCall_.name()));
ui_->labTx->setStyleSheet(QString("background: %1").arg(color_ReceivedMsg_.name()));
ui_->labDXCC->setStyleSheet(QString("background: %1").arg(color_DXCC_.name()));
ui_->labNewCall->setStyleSheet(QString("background: %1").arg(color_NewCall_.name()));
ui_->labCQ->setStyleSheet(QString("background: %1").arg(color_cq_.name()));
ui_->labMyCall->setStyleSheet(QString("background: %1").arg(color_mycall_.name()));
ui_->rxLabel->setStyleSheet(QString("background: %1").arg(color_rx_background_.name()));
ui_->txLabel->setStyleSheet(QString("background: %1").arg(color_tx_background_.name()));
ui_->rxForegroundLabel->setStyleSheet(QString("background: %1; color: %2").arg(color_rx_background_.name()).arg(color_rx_foreground_.name()));
ui_->txForegroundLabel->setStyleSheet(QString("background: %1; color: %2").arg(color_rx_background_.name()).arg(color_tx_foreground_.name()));
ui_->CW_id_interval_spin_box->setValue (id_interval_);
ui_->sbNtrials->setValue (ntrials_);
ui_->sbTxDelay->setValue (txDelay_);
@ -1376,9 +1395,12 @@ void Configuration::impl::read_settings ()
my_qth_ = settings_->value("MyQTH", QString {}).toString();
cq_ = settings_->value("CQMessage", QString {"CQCQCQ"}).toString();
reply_ = settings_->value("Reply", QString {"HW CPY?"}).toString();
next_color_CQ_ = color_CQ_ = settings_->value("colorCQ","#66ff66").toString();
next_color_MyCall_ = color_MyCall_ = settings_->value("colorMyCall","#ff6666").toString();
next_color_ReceivedMsg_ = color_ReceivedMsg_ = settings_->value("colorReceivedMsg","#ffeaa7").toString();
next_color_cq_ = color_cq_ = settings_->value("colorCQ","#66ff66").toString();
next_color_mycall_ = color_mycall_ = settings_->value("colorMyCall","#ff6666").toString();
next_color_rx_background_ = color_rx_background_ = settings_->value("color_rx_background","#ffeaa7").toString();
next_color_rx_foreground_ = color_rx_foreground_ = settings_->value("color_rx_foreground","#000000").toString();
next_color_tx_background_ = color_tx_background_ = settings_->value("color_tx_background","#ffffff").toString();
next_color_tx_foreground_ = color_tx_foreground_ = settings_->value("color_tx_foreground","#000000").toString();
next_color_DXCC_ = color_DXCC_ = settings_->value("colorDXCC","#ff00ff").toString();
next_color_NewCall_ = color_NewCall_ = settings_->value("colorNewCall","#ffaaff").toString();
@ -1386,23 +1408,39 @@ void Configuration::impl::read_settings ()
&& next_font_ != font_)
{
font_ = next_font_;
Q_EMIT self_->text_font_changed (font_);
Q_EMIT self_->gui_text_font_changed (font_);
}
else
{
next_font_ = font_;
}
if (next_decoded_text_font_.fromString (settings_->value ("DecodedTextFont", "Courier, 10").toString ())
&& next_decoded_text_font_ != decoded_text_font_)
if (next_tx_text_font_.fromString (settings_->value ("TXTextFont", QGuiApplication::font ().toString ()).toString ())
&& next_tx_text_font_ != tx_text_font_)
{
decoded_text_font_ = next_decoded_text_font_;
Q_EMIT self_->decoded_text_font_changed (decoded_text_font_);
tx_text_font_ = next_tx_text_font_;
Q_EMIT self_->tx_text_font_changed (tx_text_font_);
}
else
{
next_decoded_text_font_ = decoded_text_font_;
next_tx_text_font_ = tx_text_font_;
}
ui_->txFontButton->setText(QString("Font (%1 %2)").arg(next_tx_text_font_.family()).arg(next_tx_text_font_.pointSize()));
if (next_rx_text_font_.fromString (settings_->value ("RXTextFont", QGuiApplication::font ().toString ()).toString ())
&& next_rx_text_font_ != rx_text_font_)
{
rx_text_font_ = next_rx_text_font_;
Q_EMIT self_->rx_text_font_changed (rx_text_font_);
}
else
{
next_rx_text_font_ = rx_text_font_;
}
ui_->rxFontButton->setText(QString("Font (%1 %2)").arg(next_rx_text_font_.family()).arg(next_rx_text_font_.pointSize()));
id_interval_ = settings_->value ("IDint", 0).toInt ();
ntrials_ = settings_->value ("nTrials", 6).toInt ();
txDelay_ = settings_->value ("TxDelay",0.2).toDouble();
@ -1575,13 +1613,17 @@ void Configuration::impl::write_settings ()
settings_->setValue ("Reply", reply_);
settings_->setValue ("CallsignAging", callsign_aging_);
settings_->setValue ("ActivityAging", activity_aging_);
settings_->setValue("colorCQ",color_CQ_);
settings_->setValue("colorMyCall",color_MyCall_);
settings_->setValue("colorReceivedMsg",color_ReceivedMsg_);
settings_->setValue("colorCQ",color_cq_);
settings_->setValue("colorMyCall",color_mycall_);
settings_->setValue("color_rx_background",color_rx_background_);
settings_->setValue("color_rx_foreground",color_rx_foreground_);
settings_->setValue("color_tx_background",color_tx_background_);
settings_->setValue("color_tx_foreground",color_tx_foreground_);
settings_->setValue("colorDXCC",color_DXCC_);
settings_->setValue("colorNewCall",color_NewCall_);
settings_->setValue ("Font", font_.toString ());
settings_->setValue ("DecodedTextFont", decoded_text_font_.toString ());
settings_->setValue ("RXTextFont", rx_text_font_.toString ());
settings_->setValue ("TXTextFont", tx_text_font_.toString ());
settings_->setValue ("IDint", id_interval_);
settings_->setValue ("nTrials", ntrials_);
settings_->setValue ("TxDelay", txDelay_);
@ -1937,18 +1979,27 @@ void Configuration::impl::accept ()
if (next_font_ != font_)
{
font_ = next_font_;
Q_EMIT self_->text_font_changed (font_);
Q_EMIT self_->gui_text_font_changed (font_);
}
if (next_decoded_text_font_ != decoded_text_font_)
if (next_tx_text_font_ != tx_text_font_)
{
decoded_text_font_ = next_decoded_text_font_;
Q_EMIT self_->decoded_text_font_changed (decoded_text_font_);
tx_text_font_ = next_tx_text_font_;
Q_EMIT self_->tx_text_font_changed (tx_text_font_);
}
color_CQ_ = next_color_CQ_;
color_MyCall_ = next_color_MyCall_;
color_ReceivedMsg_ = next_color_ReceivedMsg_;
if (next_rx_text_font_ != rx_text_font_)
{
rx_text_font_ = next_rx_text_font_;
Q_EMIT self_->rx_text_font_changed (rx_text_font_);
}
color_cq_ = next_color_cq_;
color_mycall_ = next_color_mycall_;
color_rx_background_ = next_color_rx_background_;
color_rx_foreground_ = next_color_rx_foreground_;
color_tx_background_ = next_color_tx_background_;
color_tx_foreground_ = next_color_tx_foreground_;
color_DXCC_ = next_color_DXCC_;
color_NewCall_ = next_color_NewCall_;
@ -2176,64 +2227,115 @@ void Configuration::impl::on_font_push_button_clicked ()
next_font_ = QFontDialog::getFont (0, next_font_, this);
}
QColor getColor(QColor initial, QWidget *parent, QString title){
QList<QColor> custom = {
QColor("#66FF66"),
QColor("#FF6666"),
QColor("#FFEAA7")
};
auto d = new QColorDialog(initial, parent);
d->setWindowTitle(title);
for(int i = 0; i < custom.length(); i++){
d->setCustomColor(i, custom.at(i));
}
if(d->exec() == QColorDialog::Accepted){
return d->selectedColor();
} else {
return initial;
}
}
void Configuration::impl::on_pbCQmsg_clicked()
{
auto new_color = QColorDialog::getColor(next_color_CQ_, this, "CQ and BEACON Messages Color");
auto new_color = getColor(next_color_cq_, this, "CQ Messages Color");
if (new_color.isValid ())
{
next_color_CQ_ = new_color;
ui_->labCQ->setStyleSheet(QString("background: %1").arg(next_color_CQ_.name()));
next_color_cq_ = new_color;
ui_->labCQ->setStyleSheet(QString("background: %1").arg(next_color_cq_.name()));
}
}
void Configuration::impl::on_pbMyCall_clicked()
{
auto new_color = QColorDialog::getColor(next_color_MyCall_, this, "Directed Messages Color");
auto new_color = getColor(next_color_mycall_, this, "Directed Messages Color");
if (new_color.isValid ())
{
next_color_MyCall_ = new_color;
ui_->labMyCall->setStyleSheet(QString("background: %1").arg(next_color_MyCall_.name()));
next_color_mycall_ = new_color;
ui_->labMyCall->setStyleSheet(QString("background: %1").arg(next_color_mycall_.name()));
}
}
void Configuration::impl::on_pbTxMsg_clicked()
void Configuration::impl::on_rxBackgroundButton_clicked()
{
auto new_color = QColorDialog::getColor(next_color_ReceivedMsg_, this, "Received Messages Textarea Color");
auto new_color = getColor(next_color_rx_background_, this, "Received Messages Background Color");
if (new_color.isValid ())
{
next_color_ReceivedMsg_ = new_color;
ui_->labTx->setStyleSheet(QString("background: %1").arg(next_color_ReceivedMsg_.name()));
next_color_rx_background_ = new_color;
ui_->rxLabel->setStyleSheet(QString("background: %1").arg(next_color_rx_background_.name()));
ui_->rxForegroundLabel->setStyleSheet(QString("background: %1; color: %2").arg(next_color_rx_background_.name()).arg(next_color_rx_foreground_.name()));
ui_->txForegroundLabel->setStyleSheet(QString("background: %1; color: %2").arg(next_color_rx_background_.name()).arg(next_color_tx_foreground_.name()));
}
}
void Configuration::impl::on_pbNewDXCC_clicked()
void Configuration::impl::on_rxForegroundButton_clicked()
{
auto new_color = QColorDialog::getColor(next_color_DXCC_, this, "New DXCC Messages Color");
auto new_color = getColor(next_color_rx_foreground_, this, "Received Messages Foreground Color");
if (new_color.isValid ())
{
next_color_DXCC_ = new_color;
ui_->labDXCC->setStyleSheet(QString("background: %1").arg(next_color_DXCC_.name()));
next_color_rx_foreground_ = new_color;
ui_->rxLabel->setStyleSheet(QString("background: %1").arg(next_color_rx_background_.name()));
ui_->rxForegroundLabel->setStyleSheet(QString("background: %1; color: %2").arg(next_color_rx_background_.name()).arg(next_color_rx_foreground_.name()));
ui_->txForegroundLabel->setStyleSheet(QString("background: %1; color: %2").arg(next_color_rx_background_.name()).arg(next_color_tx_foreground_.name()));
}
}
void Configuration::impl::on_pbNewCall_clicked()
void Configuration::impl::on_rxFontButton_clicked ()
{
auto new_color = QColorDialog::getColor(next_color_NewCall_, this, "New Call Messages Color");
if (new_color.isValid ())
{
next_color_NewCall_ = new_color;
ui_->labNewCall->setStyleSheet(QString("background: %1").arg(next_color_NewCall_.name()));
}
}
void Configuration::impl::on_decoded_text_font_push_button_clicked ()
{
next_decoded_text_font_ = QFontDialog::getFont (0, decoded_text_font_ , this
next_rx_text_font_ = QFontDialog::getFont (0, rx_text_font_ , this
, tr ("Font Chooser")
#if QT_VERSION >= 0x050201
, QFontDialog::MonospacedFonts
, 0
#endif
);
ui_->rxFontButton->setText(QString("Font (%1 %2)").arg(next_rx_text_font_.family()).arg(next_rx_text_font_.pointSize()));
}
void Configuration::impl::on_txBackgroundButton_clicked()
{
auto new_color = getColor(next_color_tx_background_, this, "Transmitted Messages Background Color");
if (new_color.isValid ())
{
next_color_tx_background_ = new_color;
ui_->txLabel->setStyleSheet(QString("background: %1").arg(next_color_tx_background_.name()));
ui_->rxForegroundLabel->setStyleSheet(QString("background: %1; color: %2").arg(next_color_rx_background_.name()).arg(next_color_rx_foreground_.name()));
ui_->txForegroundLabel->setStyleSheet(QString("background: %1; color: %2").arg(next_color_rx_background_.name()).arg(next_color_tx_foreground_.name()));
}
}
void Configuration::impl::on_txForegroundButton_clicked()
{
auto new_color = getColor(next_color_tx_foreground_, this, "Transmitted Messages Foreground Color");
if (new_color.isValid ())
{
next_color_tx_foreground_ = new_color;
ui_->txLabel->setStyleSheet(QString("background: %1").arg(next_color_tx_background_.name()));
ui_->rxForegroundLabel->setStyleSheet(QString("background: %1; color: %2").arg(next_color_rx_background_.name()).arg(next_color_rx_foreground_.name()));
ui_->txForegroundLabel->setStyleSheet(QString("background: %1; color: %2").arg(next_color_rx_background_.name()).arg(next_color_tx_foreground_.name()));
}
}
void Configuration::impl::on_txFontButton_clicked ()
{
next_tx_text_font_ = QFontDialog::getFont (0, tx_text_font_ , this
, tr ("Font Chooser")
#if QT_VERSION >= 0x050201
, 0
#endif
);
ui_->txFontButton->setText(QString("Font (%1 %2)").arg(next_tx_text_font_.family()).arg(next_tx_text_font_.pointSize()));
}
void Configuration::impl::on_PTT_port_combo_box_activated (int /* index */)

View File

@ -104,7 +104,8 @@ public:
QString cq_message () const;
QString reply_message () const;
QFont text_font () const;
QFont decoded_text_font () const;
QFont rx_text_font () const;
QFont tx_text_font () const;
qint32 id_interval () const;
qint32 ntrials() const;
qint32 aggressive() const;
@ -178,7 +179,10 @@ public:
Type2MsgGen type_2_msg_gen () const;
QColor color_CQ () const;
QColor color_MyCall () const;
QColor color_ReceivedMsg () const;
QColor color_rx_background () const;
QColor color_rx_foreground () const;
QColor color_tx_background () const;
QColor color_tx_foreground () const;
QColor color_DXCC () const;
QColor color_NewCall () const;
bool pwrBandTxMemory () const;
@ -271,8 +275,9 @@ public:
// These signals indicate a font has been selected and accepted for
// the application text and decoded text respectively.
//
Q_SIGNAL void text_font_changed (QFont);
Q_SIGNAL void decoded_text_font_changed (QFont);
Q_SIGNAL void gui_text_font_changed (QFont);
Q_SIGNAL void tx_text_font_changed (QFont);
Q_SIGNAL void rx_text_font_changed (QFont);
Q_SIGNAL void colors_changed ();
//

View File

@ -2569,15 +2569,9 @@ Right click for insert and delete options.</string>
<attribute name="title">
<string>UI</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_15">
<item>
<widget class="QWidget" name="xQ" native="true">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>671</width>
<height>621</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
@ -2586,11 +2580,108 @@ Right click for insert and delete options.</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<layout class="QGridLayout" name="gridLayout_5" rowstretch="1" columnstretch="0">
<widget class="QGroupBox" name="groupBox_10">
<property name="title">
<string>Global</string>
</property>
<layout class="QGridLayout" name="gridLayout_17">
<item row="0" column="0">
<widget class="QPushButton" name="font_push_button">
<property name="enabled">
<bool>true</bool>
</property>
<property name="toolTip">
<string>Set the font characteristics for the application.</string>
</property>
<property name="text">
<string>Application Font</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_9">
<property name="title">
<string>Band Activity Background</string>
</property>
<layout class="QGridLayout" name="gridLayout_15">
<item row="0" column="0">
<widget class="QLabel" name="labCQ">
<property name="minimumSize">
<size>
<width>80</width>
<height>20</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QLabel{background-color: #66ff66}</string>
</property>
<property name="text">
<string>K1ABC</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="pbCQmsg">
<property name="minimumSize">
<size>
<width>140</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>CQ Color</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="pbMyCall">
<property name="minimumSize">
<size>
<width>140</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Directed Message Color</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labMyCall">
<property name="minimumSize">
<size>
<width>80</width>
<height>20</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QLabel{background-color: #ff6666}</string>
</property>
<property name="text">
<string>K1ABC</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_12">
<property name="title">
<string>Message Background</string>
</property>
<layout class="QGridLayout" name="gridLayout_13">
<item row="2" column="1">
<widget class="QLabel" name="labTx">
<item row="0" column="0">
<widget class="QLabel" name="rxLabel">
<property name="enabled">
<bool>true</bool>
</property>
@ -2611,178 +2702,35 @@ Right click for insert and delete options.</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="labMyCall">
<property name="minimumSize">
<size>
<width>80</width>
<height>20</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QLabel{background-color: #ff6666}</string>
</property>
<property name="text">
<string>K1ABC</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="pbCQmsg">
<property name="minimumSize">
<size>
<width>140</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>CQ</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QPushButton" name="pbNewDXCC">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>140</width>
<height>0</height>
</size>
</property>
<property name="visible">
<bool>false</bool>
</property>
<property name="text">
<string>New DXCC</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QPushButton" name="font_push_button">
<item row="0" column="1">
<widget class="QPushButton" name="rxBackgroundButton">
<property name="enabled">
<bool>true</bool>
</property>
<property name="toolTip">
<string>Set the font characteristics for the application.</string>
<property name="minimumSize">
<size>
<width>140</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>UI Font...</string>
<string>Receive Background Color</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="pbMyCall">
<property name="minimumSize">
<size>
<width>140</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Directed Message</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="labCQ">
<property name="minimumSize">
<size>
<width>80</width>
<height>20</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QLabel{background-color: #66ff66}</string>
</property>
<property name="text">
<string>K1ABC</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLabel" name="labNewCall">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>20</height>
</size>
</property>
<property name="visible">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">QLabel{background-color: #66ffff}</string>
</property>
<property name="text">
<string>K1ABC</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="pbTxMsg">
<widget class="QLabel" name="txLabel">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>140</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Received Message Textarea</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QPushButton" name="pbNewCall">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>140</width>
<height>0</height>
</size>
</property>
<property name="visible">
<bool>false</bool>
</property>
<property name="text">
<string>New Call</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLabel" name="labDXCC">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>20</height>
</size>
</property>
<property name="visible">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">QLabel{background-color: #ff66ff}</string>
<string notr="true">QLabel{background-color: #FFF}</string>
</property>
<property name="text">
<string>K1ABC</string>
@ -2792,22 +2740,87 @@ Right click for insert and delete options.</string>
</property>
</widget>
</item>
<item row="4" column="0">
<spacer name="verticalSpacer_6">
<property name="orientation">
<enum>Qt::Vertical</enum>
<item row="1" column="1">
<widget class="QPushButton" name="txBackgroundButton">
<property name="text">
<string>Transmit Background Color</string>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_8">
<property name="title">
<string>Messages Received</string>
</property>
<layout class="QGridLayout" name="gridLayout_8">
<item row="3" column="1">
<widget class="QPushButton" name="rxFontButton">
<property name="text">
<string>Font</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="rxForegroundButton">
<property name="text">
<string>Foreground Color</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="rxForegroundLabel">
<property name="styleSheet">
<string notr="true">QLabel{background-color: #ffeaa7}</string>
</property>
<property name="text">
<string>K1ABC</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_11">
<property name="title">
<string>Messages Transmitted</string>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<item row="1" column="1">
<widget class="QPushButton" name="txForegroundButton">
<property name="text">
<string>Foreground Color</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QPushButton" name="txFontButton">
<property name="text">
<string>Font</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="txForegroundLabel">
<property name="styleSheet">
<string notr="true">QLabel{background-color: #ffeaa7}</string>
</property>
<property name="text">
<string>K1ABC</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
@ -3093,6 +3106,8 @@ Right click for insert and delete options.</string>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
@ -3184,11 +3199,6 @@ soundcard changes</string>
<tabstop>calibration_intercept_spin_box</tabstop>
<tabstop>frequencies_table_view</tabstop>
<tabstop>stations_table_view</tabstop>
<tabstop>pbCQmsg</tabstop>
<tabstop>pbMyCall</tabstop>
<tabstop>pbTxMsg</tabstop>
<tabstop>pbNewDXCC</tabstop>
<tabstop>pbNewCall</tabstop>
<tabstop>sbNtrials</tabstop>
<tabstop>sbAggressive</tabstop>
<tabstop>cbTwoPass</tabstop>

View File

@ -65,6 +65,9 @@
#include "ui_mainwindow.h"
#include "moc_mainwindow.cpp"
#define STATE_RX 1
#define STATE_TX 2
extern "C" {
//----------------------------------------------------- C and Fortran routines
@ -277,6 +280,52 @@ namespace
}
return "";
}
void setTextEditFont(QTextEdit *edit, QFont font){
edit->setFont(font);
edit->setFontFamily(font.family());
edit->setFontItalic(font.italic());
edit->setFontPointSize(font.pointSize());
edit->setFontUnderline(font.underline());
edit->setFontWeight(font.weight());
auto d = edit->document();
d->setDefaultFont(font);
edit->setDocument(d);
auto c = edit->textCursor();
c.select(QTextCursor::Document);
auto cf = c.blockCharFormat();
cf.setFont(font);
c.mergeBlockCharFormat(cf);
edit->updateGeometry();
}
void setTextEditBackground(QTextEdit *edit, QColor color){
edit->setStyleSheet(QString("QTextEdit{ background: %1 }").arg(color.name()));
}
void highlightBlock(QTextBlock block, QFont font, QColor foreground, QColor background){
QTextCursor cursor(block);
// Set background color
QTextBlockFormat blockFormat = cursor.blockFormat();
blockFormat.setBackground(background);
cursor.setBlockFormat(blockFormat);
// Set font
for (QTextBlock::iterator it = cursor.block().begin(); !(it.atEnd()); ++it) {
QTextCharFormat charFormat = it.fragment().charFormat();
charFormat.setFont(font);
charFormat.setForeground(QBrush(foreground));
QTextCursor tempCursor = cursor;
tempCursor.setPosition(it.fragment().position());
tempCursor.setPosition(it.fragment().position() + it.fragment().length(), QTextCursor::KeepAnchor);
tempCursor.setCharFormat(charFormat);
}
}
}
//--------------------------------------------------- MainWindow constructor
@ -628,14 +677,37 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
// defer initialization until after construction otherwise menu
// fonts do not get set
QTimer::singleShot (0, this, SLOT (initialize_fonts ()));
connect (&m_config, &Configuration::text_font_changed, [this] (QFont const& font) {
connect (&m_config, &Configuration::gui_text_font_changed, [this] (QFont const& font) {
set_application_font (font);
});
connect (&m_config, &Configuration::decoded_text_font_changed, [this] (QFont const& font) {
setDecodedTextFont (font);
connect (&m_config, &Configuration::rx_text_font_changed, [this] (QFont const&) {
setTextEditFont(ui->textEditRX, m_config.rx_text_font());
});
connect (&m_config, &Configuration::tx_text_font_changed, [this] (QFont const&) {
setTextEditFont(ui->extFreeTextMsgEdit, m_config.tx_text_font());
});
connect (&m_config, &Configuration::colors_changed, [this](){
ui->textEditRX->setStyleSheet(QString("QTextEdit{ background: %1 }").arg(m_config.color_ReceivedMsg().name()));
setTextEditBackground(ui->textEditRX, m_config.color_rx_background());
setTextEditBackground(ui->extFreeTextMsgEdit, m_config.color_tx_background());
// rehighlight
auto d = ui->textEditRX->document();
if(d){
for(int i = 0; i < d->lineCount(); i++){
auto b = d->findBlockByLineNumber(i);
switch(b.userState()){
case STATE_RX:
highlightBlock(b, m_config.rx_text_font(), m_config.color_rx_foreground(), QColor(Qt::transparent));
break;
case STATE_TX:
highlightBlock(b, m_config.tx_text_font(), m_config.color_tx_foreground(), QColor(Qt::transparent));
break;
}
}
}
});
setWindowTitle (program_title ());
@ -1376,7 +1448,9 @@ void MainWindow::not_GA_warning_message ()
void MainWindow::initialize_fonts ()
{
set_application_font (m_config.text_font ());
setDecodedTextFont (m_config.decoded_text_font ());
setTextEditFont(ui->textEditRX, m_config.rx_text_font());
setTextEditFont(ui->extFreeTextMsgEdit, m_config.tx_text_font());
}
void MainWindow::splash_done ()
@ -1716,7 +1790,7 @@ void MainWindow::readSettings()
//ui->bandHorizontalWidget->setGeometry( m_settings->value("PanelWaterfallGeometry", ui->bandHorizontalWidget->geometry()).toRect());
//qDebug() << m_settings->value("PanelTopGeometry") << ui->extFreeTextMsg;
ui->textEditRX->setStyleSheet(QString("QTextEdit { background: %1 }").arg(m_config.color_ReceivedMsg().name()));
ui->textEditRX->setStyleSheet(QString("QTextEdit { background: %1 }").arg(m_config.color_rx_background().name()));
{
auto const& coeffs = m_settings->value ("PhaseEqualizationCoefficients"
@ -2898,6 +2972,7 @@ void MainWindow::on_actionFox_Log_triggered()
void MainWindow::on_actionMessage_averaging_triggered()
{
#if 0
if (!m_msgAvgWidget)
{
m_msgAvgWidget.reset (new MessageAveraging {m_settings, m_config.decoded_text_font ()});
@ -2908,6 +2983,7 @@ void MainWindow::on_actionMessage_averaging_triggered()
m_msgAvgWidget->showNormal();
m_msgAvgWidget->raise ();
m_msgAvgWidget->activateWindow ();
#endif
}
void MainWindow::on_actionOpen_triggered() //Open File
@ -4347,7 +4423,7 @@ void MainWindow::guiUpdate()
write_transmit_entry ("ALL.TXT");
if (m_config.TX_messages ()) {
ui->decodedTextBrowser2->displayTransmittedText(m_currentMessage,m_modeTx,
ui->TxFreqSpinBox->value(),m_config.color_ReceivedMsg(),m_bFastMode);
ui->TxFreqSpinBox->value(),m_config.color_rx_background(),m_bFastMode);
}
}
@ -4451,7 +4527,7 @@ void MainWindow::guiUpdate()
if (m_config.TX_messages () && !m_tune && !m_config.bFox()) {
ui->decodedTextBrowser2->displayTransmittedText(current_message, m_modeTx,
ui->TxFreqSpinBox->value(),m_config.color_ReceivedMsg(),m_bFastMode);
ui->TxFreqSpinBox->value(),m_config.color_rx_background(),m_bFastMode);
}
switch (m_ntx)
@ -5904,7 +5980,6 @@ void MainWindow::writeNoticeTextToUI(QDateTime date, QString text){
ui->textEditRX->verticalScrollBar()->setValue(ui->textEditRX->verticalScrollBar()->maximum());
}
int MainWindow::writeMessageTextToUI(QDateTime date, QString text, int freq, bool bold, int block){
auto c = ui->textEditRX->textCursor();
@ -5943,7 +6018,13 @@ int MainWindow::writeMessageTextToUI(QDateTime date, QString text, int freq, boo
c.insertHtml(QString("<strong>%1 - (%2)</strong> - %3").arg(date.time().toString()).arg(freq).arg(text));
}
c.movePosition(QTextCursor::End);
if(bold){
c.block().setUserState(STATE_TX);
highlightBlock(c.block(), m_config.tx_text_font(), m_config.color_tx_foreground(), QColor(Qt::transparent));
} else {
c.block().setUserState(STATE_RX);
highlightBlock(c.block(), m_config.rx_text_font(), m_config.color_rx_foreground(), QColor(Qt::transparent));
}
ui->textEditRX->ensureCursorVisible();
ui->textEditRX->verticalScrollBar()->setValue(ui->textEditRX->verticalScrollBar()->maximum());
@ -6110,6 +6191,9 @@ void MainWindow::on_extFreeTextMsgEdit_currentTextChanged (QString const& text)
ui->extFreeTextMsgEdit->setPlainText(x);
QTextCursor c = ui->extFreeTextMsgEdit->textCursor();
c.setPosition(pos < maxpos ? pos : maxpos, QTextCursor::MoveAnchor);
highlightBlock(c.block(), m_config.tx_text_font(), QColor(Qt::black), QColor(Qt::transparent));
ui->extFreeTextMsgEdit->setTextCursor(c);
}
@ -6121,6 +6205,9 @@ void MainWindow::on_extFreeTextMsgEdit_currentTextChanged (QString const& text)
ui->startTxButton->setText("Send");
ui->startTxButton->setEnabled(false);
}
}
int MainWindow::currentFreqOffset(){
@ -11235,7 +11322,7 @@ void MainWindow::foxGenWaveform(int i,QString fm)
QString txModeArg;
txModeArg.sprintf("FT8fox %d",i+1);
ui->decodedTextBrowser2->displayTransmittedText(fm.trimmed(), txModeArg,
ui->TxFreqSpinBox->value()+60*i,m_config.color_ReceivedMsg(),m_bFastMode);
ui->TxFreqSpinBox->value()+60*i,m_config.color_rx_background(),m_bFastMode);
foxcom_.i3bit[i]=0;
if(fm.indexOf("<")>0) foxcom_.i3bit[i]=1;
strncpy(&foxcom_.cmsg[i][0],fm.toLatin1(),40); //Copy this message into cmsg[i]

View File

@ -1073,7 +1073,7 @@ background-color: #00ff00;
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
<pointsize>14</pointsize>
<italic>false</italic>
</font>
</property>
@ -1102,7 +1102,7 @@ background-color: #00ff00;
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
<pointsize>14</pointsize>
</font>
</property>
<property name="styleSheet">