diff options
| author | Christoph Berg <myon@debian.org> | 2018-12-19 23:01:50 +0100 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2018-12-19 23:01:50 +0100 |
| commit | 5c60c77adff9a54fd5f94f9915b22ccd8c4c5a3b (patch) | |
| tree | 410fa358a5f73260a579b4d669730f319a4d2609 /messageaveraging.cpp | |
| parent | 6c82050de806dcdafaed0077400a6c3396a4a159 (diff) | |
| parent | e0737c56c1e384e05064a0c6e1ac46979371041b (diff) | |
Update upstream source from tag 'upstream/2.0.0+repack'
Update to upstream version '2.0.0+repack'
with Debian dir 55dbb3a6a7eb189e187dd79f732623ca0b56116d
Diffstat (limited to 'messageaveraging.cpp')
| -rw-r--r-- | messageaveraging.cpp | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/messageaveraging.cpp b/messageaveraging.cpp deleted file mode 100644 index 36dd9b42..00000000 --- a/messageaveraging.cpp +++ /dev/null @@ -1,76 +0,0 @@ -#include "messageaveraging.h" - -#include <QSettings> -#include <QApplication> -#include <QTextCharFormat> - -#include "SettingsGroup.hpp" -#include "qt_helpers.hpp" -#include "ui_messageaveraging.h" - -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 (); -} - -MessageAveraging::~MessageAveraging() -{ - if (isVisible ()) write_settings (); -} - -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 (); - QWidget::closeEvent (e); -} - -void MessageAveraging::read_settings () -{ - SettingsGroup group {settings_, "MessageAveraging"}; - restoreGeometry (settings_->value ("window/geometry").toByteArray ()); -} - -void MessageAveraging::write_settings () -{ - SettingsGroup group {settings_, "MessageAveraging"}; - settings_->setValue ("window/geometry", saveGeometry ()); -} - -void MessageAveraging::displayAvg(QString const& t) -{ - ui->msgAvgPlainTextEdit->setPlainText(t); -} |
