|
|
|
@ -26,7 +26,7 @@ ShareInviteDialog::ShareInviteDialog(const QString& channelId, DbManager* db, QW |
|
|
|
, m_db(db) |
|
|
|
, m_db(db) |
|
|
|
{ |
|
|
|
{ |
|
|
|
setWindowTitle(QString::fromUtf8("Пригласительная ссылка")); |
|
|
|
setWindowTitle(QString::fromUtf8("Пригласительная ссылка")); |
|
|
|
setMinimumWidth(420); |
|
|
|
setMinimumSize(420, 560); |
|
|
|
setModal(true); |
|
|
|
setModal(true); |
|
|
|
|
|
|
|
|
|
|
|
auto *layout = new QVBoxLayout(this); |
|
|
|
auto *layout = new QVBoxLayout(this); |
|
|
|
@ -34,21 +34,23 @@ ShareInviteDialog::ShareInviteDialog(const QString& channelId, DbManager* db, QW |
|
|
|
|
|
|
|
|
|
|
|
auto *nodeLabel = new QLabel(QString::fromUtf8("Узел входа:"), this); |
|
|
|
auto *nodeLabel = new QLabel(QString::fromUtf8("Узел входа:"), this); |
|
|
|
nodeLabel->setStyleSheet("font-size: 12px; color: palette(window-text);"); |
|
|
|
nodeLabel->setStyleSheet("font-size: 12px; color: palette(window-text);"); |
|
|
|
layout->addWidget(nodeLabel); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_nodeCombo = new QComboBox(this); |
|
|
|
m_nodeCombo = new QComboBox(this); |
|
|
|
m_nodeCombo->setStyleSheet( |
|
|
|
m_nodeCombo->setStyleSheet( |
|
|
|
"QComboBox { border: 1px solid palette(mid); border-radius: 4px;" |
|
|
|
"QComboBox { border: 1px solid palette(mid); border-radius: 4px;" |
|
|
|
" padding: 6px 10px; font-size: 13px; background: palette(base); }"); |
|
|
|
" padding: 6px 10px; font-size: 13px; background: palette(base); }"); |
|
|
|
layout->addWidget(m_nodeCombo); |
|
|
|
|
|
|
|
|
|
|
|
auto *nodeRow = new QHBoxLayout(); |
|
|
|
|
|
|
|
nodeRow->setSpacing(8); |
|
|
|
|
|
|
|
nodeRow->addWidget(nodeLabel); |
|
|
|
|
|
|
|
nodeRow->addWidget(m_nodeCombo, 1); |
|
|
|
|
|
|
|
layout->addLayout(nodeRow); |
|
|
|
|
|
|
|
|
|
|
|
m_linkEdit = new QLineEdit(this); |
|
|
|
m_linkEdit = new QLineEdit(this); |
|
|
|
m_linkEdit->setReadOnly(true); |
|
|
|
m_linkEdit->setReadOnly(true); |
|
|
|
m_linkEdit->setPlaceholderText(QString::fromUtf8("Генерация ссылки...")); |
|
|
|
m_linkEdit->setPlaceholderText(QString::fromUtf8("Генерация ссылки...")); |
|
|
|
m_linkEdit->setStyleSheet("padding: 6px; font-family: monospace;"); |
|
|
|
m_linkEdit->setStyleSheet("padding: 6px; font-family: monospace;"); |
|
|
|
layout->addWidget(m_linkEdit); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
auto *btnLayout = new QHBoxLayout(); |
|
|
|
|
|
|
|
auto *copyBtn = new QPushButton(QString::fromUtf8("Копировать"), this); |
|
|
|
auto *copyBtn = new QPushButton(QString::fromUtf8("Копировать"), this); |
|
|
|
connect(copyBtn, &QPushButton::clicked, this, [this]() { |
|
|
|
connect(copyBtn, &QPushButton::clicked, this, [this]() { |
|
|
|
QClipboard* cb = QApplication::clipboard(); |
|
|
|
QClipboard* cb = QApplication::clipboard(); |
|
|
|
@ -57,12 +59,16 @@ ShareInviteDialog::ShareInviteDialog(const QString& channelId, DbManager* db, QW |
|
|
|
cb->setText(m_linkEdit->text(), QClipboard::Selection); |
|
|
|
cb->setText(m_linkEdit->text(), QClipboard::Selection); |
|
|
|
m_linkEdit->setFocus(); |
|
|
|
m_linkEdit->setFocus(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
btnLayout->addWidget(copyBtn); |
|
|
|
|
|
|
|
btnLayout->addStretch(); |
|
|
|
auto *linkRow = new QHBoxLayout(); |
|
|
|
layout->addLayout(btnLayout); |
|
|
|
linkRow->setSpacing(8); |
|
|
|
|
|
|
|
linkRow->addWidget(m_linkEdit, 1); |
|
|
|
|
|
|
|
linkRow->addWidget(copyBtn); |
|
|
|
|
|
|
|
layout->addLayout(linkRow); |
|
|
|
|
|
|
|
|
|
|
|
m_qrLabel = new QLabel(this); |
|
|
|
m_qrLabel = new QLabel(this); |
|
|
|
m_qrLabel->setAlignment(Qt::AlignCenter); |
|
|
|
m_qrLabel->setAlignment(Qt::AlignCenter); |
|
|
|
|
|
|
|
m_qrLabel->setMinimumSize(180, 180); |
|
|
|
layout->addWidget(m_qrLabel, 0, Qt::AlignCenter); |
|
|
|
layout->addWidget(m_qrLabel, 0, Qt::AlignCenter); |
|
|
|
|
|
|
|
|
|
|
|
auto *closeBtn = new QPushButton("OK", this); |
|
|
|
auto *closeBtn = new QPushButton("OK", this); |
|
|
|
@ -120,6 +126,7 @@ void ShareInviteDialog::setLink(const QString& link) { |
|
|
|
if (!qrImage.isNull()) |
|
|
|
if (!qrImage.isNull()) |
|
|
|
m_qrLabel->setPixmap(QPixmap::fromImage(qrImage).scaled( |
|
|
|
m_qrLabel->setPixmap(QPixmap::fromImage(qrImage).scaled( |
|
|
|
180, 180, Qt::KeepAspectRatio, Qt::SmoothTransformation)); |
|
|
|
180, 180, Qt::KeepAspectRatio, Qt::SmoothTransformation)); |
|
|
|
|
|
|
|
adjustSize(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void ShareInviteDialog::onCandidates(const char* chId, int chIdLen, const uint8_t* data, int len) { |
|
|
|
void ShareInviteDialog::onCandidates(const char* chId, int chIdLen, const uint8_t* data, int len) { |
|
|
|
|