summary refs log tree commit diff
path: root/src/dialogs/RawMessage.h
diff options
context:
space:
mode:
authorDeepBlueV7.X <nicolas.werner@hotmail.de>2021-08-01 10:51:21 +0000
committerGitHub <noreply@github.com>2021-08-01 10:51:21 +0000
commit619525e62f55ca683b4a8be7a8868bc42d7edc4e (patch)
treed6f9ca51c9ad043ff58a6dac3cebd14aeecaaf8e /src/dialogs/RawMessage.h
parentAdd option to only send encrypted messages to verified devices (diff)
parentFix colors for manual dark theme (diff)
downloadnheko-619525e62f55ca683b4a8be7a8868bc42d7edc4e.tar.xz
Merge pull request #662 from LorenDB/qml-all-the-things
QML all the things, part 3: Raw message dialog
Diffstat (limited to 'src/dialogs/RawMessage.h')
-rw-r--r--src/dialogs/RawMessage.h60
1 files changed, 0 insertions, 60 deletions
diff --git a/src/dialogs/RawMessage.h b/src/dialogs/RawMessage.h
deleted file mode 100644

index e95f675c..00000000 --- a/src/dialogs/RawMessage.h +++ /dev/null
@@ -1,60 +0,0 @@ -// SPDX-FileCopyrightText: 2021 Nheko Contributors -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once - -#include <QFont> -#include <QFontDatabase> -#include <QTextBrowser> -#include <QVBoxLayout> -#include <QWidget> - -#include "nlohmann/json.hpp" - -#include "Logging.h" -#include "MainWindow.h" -#include "ui/FlatButton.h" - -namespace dialogs { - -class RawMessage : public QWidget -{ - Q_OBJECT -public: - RawMessage(QString msg, QWidget *parent = nullptr) - : QWidget{parent} - { - QFont monospaceFont = QFontDatabase::systemFont(QFontDatabase::FixedFont); - - auto layout = new QVBoxLayout{this}; - auto viewer = new QTextBrowser{this}; - viewer->setFont(monospaceFont); - viewer->setText(msg); - - layout->setSpacing(0); - layout->setMargin(0); - layout->addWidget(viewer); - - setAutoFillBackground(true); - setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint); - setAttribute(Qt::WA_DeleteOnClose, true); - - QSize winsize; - QPoint center; - - auto window = MainWindow::instance(); - if (window) { - winsize = window->frameGeometry().size(); - center = window->frameGeometry().center(); - - move(center.x() - (width() * 0.5), center.y() - (height() * 0.5)); - } else { - nhlog::ui()->warn("unable to retrieve MainWindow's size"); - } - - raise(); - show(); - } -}; -} // namespace dialogs