chatgui: invite link dialogs, zxing-cpp QR code, crypto transport, channel improvements; msg_transport: chat protocol support
This commit is contained in:
1 parent
d8c8c1c5b0
commit
22c24d135e
2206 files changed
+33191
-257
No files matched your search
@@ -0,0 +1,47 @@
|
||||
#include "invitedialog.h"
|
||||
#include "qrcode_utils.h"
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
#include <QLabel>
|
||||
#include <QClipboard>
|
||||
#include <QApplication>
|
||||
|
||||
InviteDialog::InviteDialog(const QString& link, QWidget* parent)
|
||||
: QDialog(parent), m_link(link)
|
||||
{
|
||||
setWindowTitle("Пригласительная ссылка");
|
||||
setMinimumWidth(420);
|
||||
setModal(true);
|
||||
|
||||
auto *layout = new QVBoxLayout(this);
|
||||
layout->setSpacing(12);
|
||||
|
||||
auto *linkEdit = new QLineEdit(m_link, this);
|
||||
linkEdit->setReadOnly(true);
|
||||
linkEdit->setStyleSheet("padding: 6px; font-family: monospace;");
|
||||
layout->addWidget(linkEdit);
|
||||
|
||||
auto *btnLayout = new QHBoxLayout();
|
||||
auto *copyBtn = new QPushButton("Скопировать", this);
|
||||
connect(copyBtn, &QPushButton::clicked, this, [this, linkEdit]() {
|
||||
QApplication::clipboard()->setText(m_link);
|
||||
linkEdit->setFocus();
|
||||
});
|
||||
btnLayout->addWidget(copyBtn);
|
||||
btnLayout->addStretch();
|
||||
layout->addLayout(btnLayout);
|
||||
|
||||
auto *qrLabel = new QLabel(this);
|
||||
QImage qrImage = generateQRCode(m_link);
|
||||
if (!qrImage.isNull())
|
||||
qrLabel->setPixmap(QPixmap::fromImage(qrImage).scaled(
|
||||
180, 180, Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
||||
qrLabel->setAlignment(Qt::AlignCenter);
|
||||
layout->addWidget(qrLabel, 0, Qt::AlignCenter);
|
||||
|
||||
auto *closeBtn = new QPushButton("OK", this);
|
||||
connect(closeBtn, &QPushButton::clicked, this, &QDialog::accept);
|
||||
layout->addWidget(closeBtn, 0, Qt::AlignRight);
|
||||
}
|
||||
Reference in new issue
Block a user