mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-10-31 15:47:10 -04: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
89278c9b62
commit
966e40782c
@ -897,6 +897,9 @@ void MainWindow::setDecodedTextFont (QFont const& font)
|
||||
auto style_sheet = "QLabel {" + font_as_stylesheet (font) + '}';
|
||||
ui->decodedTextLabel->setStyleSheet (ui->decodedTextLabel->styleSheet () + style_sheet);
|
||||
ui->decodedTextLabel2->setStyleSheet (ui->decodedTextLabel2->styleSheet () + style_sheet);
|
||||
if (m_msgAvgWidget) {
|
||||
m_msgAvgWidget->changeFont (font);
|
||||
}
|
||||
updateGeometry ();
|
||||
}
|
||||
|
||||
@ -1619,7 +1622,7 @@ void MainWindow::on_actionMessage_averaging_triggered()
|
||||
{
|
||||
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 (this, &MainWindow::finished, m_msgAvgWidget.data (), &MessageAveraging::close);
|
||||
|
@ -1,17 +1,22 @@
|
||||
#include "messageaveraging.h"
|
||||
#include <QSettings>
|
||||
#include <QApplication>
|
||||
#include <QTextCharFormat>
|
||||
|
||||
#include "SettingsGroup.hpp"
|
||||
#include "qt_helpers.hpp"
|
||||
#include "ui_messageaveraging.h"
|
||||
#include "commons.h"
|
||||
#include "moc_messageaveraging.cpp"
|
||||
|
||||
MessageAveraging::MessageAveraging(QSettings * settings, QWidget *parent) :
|
||||
MessageAveraging::MessageAveraging(QSettings * settings, QFont const& font, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
settings_ {settings},
|
||||
ui(new Ui::MessageAveraging)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setWindowTitle (QApplication::applicationName () + " - " + tr ("Message Averaging"));
|
||||
ui->msgAvgPlainTextEdit->setReadOnly (true);
|
||||
changeFont (font);
|
||||
read_settings ();
|
||||
}
|
||||
|
||||
@ -21,6 +26,33 @@ MessageAveraging::~MessageAveraging()
|
||||
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)
|
||||
{
|
||||
write_settings ();
|
||||
@ -29,19 +61,17 @@ void MessageAveraging::closeEvent (QCloseEvent * e)
|
||||
|
||||
void MessageAveraging::read_settings ()
|
||||
{
|
||||
settings_->beginGroup ("MessageAveraging");
|
||||
SettingsGroup group {settings_, "MessageAveraging"};
|
||||
restoreGeometry (settings_->value ("window/geometry").toByteArray ());
|
||||
settings_->endGroup ();
|
||||
}
|
||||
|
||||
void MessageAveraging::write_settings ()
|
||||
{
|
||||
settings_->beginGroup ("MessageAveraging");
|
||||
SettingsGroup group {settings_, "MessageAveraging"};
|
||||
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>
|
||||
|
||||
class QSettings;
|
||||
class QFont;
|
||||
|
||||
namespace Ui {
|
||||
class MessageAveraging;
|
||||
@ -18,9 +19,10 @@ class MessageAveraging : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MessageAveraging(QSettings * settings, QWidget *parent = 0);
|
||||
explicit MessageAveraging(QSettings *, QFont const&, QWidget * parent = 0);
|
||||
~MessageAveraging();
|
||||
void displayAvg(QString t);
|
||||
void displayAvg(QString const&);
|
||||
void changeFont (QFont const&);
|
||||
|
||||
protected:
|
||||
void closeEvent (QCloseEvent *) override;
|
||||
@ -28,6 +30,7 @@ protected:
|
||||
private:
|
||||
void read_settings ();
|
||||
void write_settings ();
|
||||
void setContentFont (QFont const&);
|
||||
QSettings * settings_;
|
||||
|
||||
Ui::MessageAveraging *ui;
|
||||
|
@ -2,14 +2,6 @@
|
||||
<ui version="4.0">
|
||||
<class>MessageAveraging</class>
|
||||
<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">
|
||||
<string>Message Averaging</string>
|
||||
</property>
|
||||
@ -17,44 +9,19 @@
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QLabel" name="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>
|
||||
<widget class="QLabel" name="header_label">
|
||||
<property name="text">
|
||||
<string> UTC Sync DT Freq </string>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QTextBrowser" name="msgAvgTextBrowser">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<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>
|
||||
<widget class="QPlainTextEdit" name="msgAvgPlainTextEdit">
|
||||
<property name="lineWrapMode">
|
||||
<enum>QPlainTextEdit::NoWrap</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
Loading…
Reference in New Issue
Block a user