mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-22 04:11:16 -05:00
Message averaging window fonts controlled by configuration
Use the decoded text font for the message averaging window. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6684 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
a63e906cbb
commit
21283cd475
@ -897,6 +897,9 @@ void MainWindow::setDecodedTextFont (QFont const& font)
|
|||||||
auto style_sheet = "QLabel {" + font_as_stylesheet (font) + '}';
|
auto style_sheet = "QLabel {" + font_as_stylesheet (font) + '}';
|
||||||
ui->decodedTextLabel->setStyleSheet (ui->decodedTextLabel->styleSheet () + style_sheet);
|
ui->decodedTextLabel->setStyleSheet (ui->decodedTextLabel->styleSheet () + style_sheet);
|
||||||
ui->decodedTextLabel2->setStyleSheet (ui->decodedTextLabel2->styleSheet () + style_sheet);
|
ui->decodedTextLabel2->setStyleSheet (ui->decodedTextLabel2->styleSheet () + style_sheet);
|
||||||
|
if (m_msgAvgWidget) {
|
||||||
|
m_msgAvgWidget->changeFont (font);
|
||||||
|
}
|
||||||
updateGeometry ();
|
updateGeometry ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1619,7 +1622,7 @@ void MainWindow::on_actionMessage_averaging_triggered()
|
|||||||
{
|
{
|
||||||
if (!m_msgAvgWidget)
|
if (!m_msgAvgWidget)
|
||||||
{
|
{
|
||||||
m_msgAvgWidget.reset (new MessageAveraging {m_settings});
|
m_msgAvgWidget.reset (new MessageAveraging {m_settings, m_config.decoded_text_font ()});
|
||||||
|
|
||||||
// Connect signals from Message Averaging window
|
// Connect signals from Message Averaging window
|
||||||
connect (this, &MainWindow::finished, m_msgAvgWidget.data (), &MessageAveraging::close);
|
connect (this, &MainWindow::finished, m_msgAvgWidget.data (), &MessageAveraging::close);
|
||||||
|
@ -1,17 +1,22 @@
|
|||||||
#include "messageaveraging.h"
|
#include "messageaveraging.h"
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
#include <QTextCharFormat>
|
||||||
|
|
||||||
|
#include "SettingsGroup.hpp"
|
||||||
|
#include "qt_helpers.hpp"
|
||||||
#include "ui_messageaveraging.h"
|
#include "ui_messageaveraging.h"
|
||||||
#include "commons.h"
|
|
||||||
#include "moc_messageaveraging.cpp"
|
#include "moc_messageaveraging.cpp"
|
||||||
|
|
||||||
MessageAveraging::MessageAveraging(QSettings * settings, QWidget *parent) :
|
MessageAveraging::MessageAveraging(QSettings * settings, QFont const& font, QWidget *parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
settings_ {settings},
|
settings_ {settings},
|
||||||
ui(new Ui::MessageAveraging)
|
ui(new Ui::MessageAveraging)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setWindowTitle (QApplication::applicationName () + " - " + tr ("Message Averaging"));
|
setWindowTitle (QApplication::applicationName () + " - " + tr ("Message Averaging"));
|
||||||
|
ui->msgAvgPlainTextEdit->setReadOnly (true);
|
||||||
|
changeFont (font);
|
||||||
read_settings ();
|
read_settings ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -21,6 +26,33 @@ MessageAveraging::~MessageAveraging()
|
|||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MessageAveraging::changeFont (QFont const& font)
|
||||||
|
{
|
||||||
|
ui->header_label->setStyleSheet (font_as_stylesheet (font));
|
||||||
|
ui->msgAvgPlainTextEdit->setStyleSheet (font_as_stylesheet (font));
|
||||||
|
setContentFont (font);
|
||||||
|
updateGeometry ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MessageAveraging::setContentFont(QFont const& font)
|
||||||
|
{
|
||||||
|
ui->msgAvgPlainTextEdit->setFont (font);
|
||||||
|
QTextCharFormat charFormat;
|
||||||
|
charFormat.setFont (font);
|
||||||
|
ui->msgAvgPlainTextEdit->selectAll ();
|
||||||
|
auto cursor = ui->msgAvgPlainTextEdit->textCursor ();
|
||||||
|
cursor.mergeCharFormat (charFormat);
|
||||||
|
cursor.clearSelection ();
|
||||||
|
cursor.movePosition (QTextCursor::End);
|
||||||
|
|
||||||
|
// position so viewport scrolled to left
|
||||||
|
cursor.movePosition (QTextCursor::Up);
|
||||||
|
cursor.movePosition (QTextCursor::StartOfLine);
|
||||||
|
|
||||||
|
ui->msgAvgPlainTextEdit->setTextCursor (cursor);
|
||||||
|
ui->msgAvgPlainTextEdit->ensureCursorVisible ();
|
||||||
|
}
|
||||||
|
|
||||||
void MessageAveraging::closeEvent (QCloseEvent * e)
|
void MessageAveraging::closeEvent (QCloseEvent * e)
|
||||||
{
|
{
|
||||||
write_settings ();
|
write_settings ();
|
||||||
@ -29,19 +61,17 @@ void MessageAveraging::closeEvent (QCloseEvent * e)
|
|||||||
|
|
||||||
void MessageAveraging::read_settings ()
|
void MessageAveraging::read_settings ()
|
||||||
{
|
{
|
||||||
settings_->beginGroup ("MessageAveraging");
|
SettingsGroup group {settings_, "MessageAveraging"};
|
||||||
restoreGeometry (settings_->value ("window/geometry").toByteArray ());
|
restoreGeometry (settings_->value ("window/geometry").toByteArray ());
|
||||||
settings_->endGroup ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageAveraging::write_settings ()
|
void MessageAveraging::write_settings ()
|
||||||
{
|
{
|
||||||
settings_->beginGroup ("MessageAveraging");
|
SettingsGroup group {settings_, "MessageAveraging"};
|
||||||
settings_->setValue ("window/geometry", saveGeometry ());
|
settings_->setValue ("window/geometry", saveGeometry ());
|
||||||
settings_->endGroup ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageAveraging::displayAvg(QString t)
|
void MessageAveraging::displayAvg(QString const& t)
|
||||||
{
|
{
|
||||||
ui->msgAvgTextBrowser->setText(t);
|
ui->msgAvgPlainTextEdit->setPlainText(t);
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
|
|
||||||
class QSettings;
|
class QSettings;
|
||||||
|
class QFont;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class MessageAveraging;
|
class MessageAveraging;
|
||||||
@ -18,9 +19,10 @@ class MessageAveraging : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit MessageAveraging(QSettings * settings, QWidget *parent = 0);
|
explicit MessageAveraging(QSettings *, QFont const&, QWidget * parent = 0);
|
||||||
~MessageAveraging();
|
~MessageAveraging();
|
||||||
void displayAvg(QString t);
|
void displayAvg(QString const&);
|
||||||
|
void changeFont (QFont const&);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void closeEvent (QCloseEvent *) override;
|
void closeEvent (QCloseEvent *) override;
|
||||||
@ -28,6 +30,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
void read_settings ();
|
void read_settings ();
|
||||||
void write_settings ();
|
void write_settings ();
|
||||||
|
void setContentFont (QFont const&);
|
||||||
QSettings * settings_;
|
QSettings * settings_;
|
||||||
|
|
||||||
Ui::MessageAveraging *ui;
|
Ui::MessageAveraging *ui;
|
||||||
|
@ -2,14 +2,6 @@
|
|||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>MessageAveraging</class>
|
<class>MessageAveraging</class>
|
||||||
<widget class="QWidget" name="MessageAveraging">
|
<widget class="QWidget" name="MessageAveraging">
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>260</width>
|
|
||||||
<height>287</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Message Averaging</string>
|
<string>Message Averaging</string>
|
||||||
</property>
|
</property>
|
||||||
@ -17,44 +9,19 @@
|
|||||||
<item>
|
<item>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="0" column="0" colspan="2">
|
<item row="0" column="0" colspan="2">
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="header_label">
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>16777215</width>
|
|
||||||
<height>30</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<family>Courier New</family>
|
|
||||||
<pointsize>10</pointsize>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string> UTC Sync DT Freq</string>
|
<string> UTC Sync DT Freq </string>
|
||||||
|
</property>
|
||||||
|
<property name="margin">
|
||||||
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" colspan="2">
|
<item row="1" column="0" colspan="2">
|
||||||
<widget class="QTextBrowser" name="msgAvgTextBrowser">
|
<widget class="QPlainTextEdit" name="msgAvgPlainTextEdit">
|
||||||
<property name="minimumSize">
|
<property name="lineWrapMode">
|
||||||
<size>
|
<enum>QPlainTextEdit::NoWrap</enum>
|
||||||
<width>240</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<family>Courier New</family>
|
|
||||||
<pointsize>10</pointsize>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="html">
|
|
||||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
|
||||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
|
||||||
p, li { white-space: pre-wrap; }
|
|
||||||
</style></head><body style=" font-family:'Courier New'; font-size:10pt; font-weight:400; font-style:normal;">
|
|
||||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html></string>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
Loading…
Reference in New Issue
Block a user