diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 8646895..20afdb9 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -461,6 +461,24 @@ void MainWindow::postToZBoard() { } zb.feeAmount->setText(Settings::getInstance()->getZECUSDDisplayFormat(Utils::getZboardAmount() + Utils::getMinerFee())); + + QObject::connect(zb.memoTxt, &QPlainTextEdit::textChanged, [=] () { + QString txt = zb.memoTxt->toPlainText(); + zb.memoSize->setText(QString::number(txt.toUtf8().size()) + "/512"); + + if (txt.toUtf8().size() <= 512) { + // Everything is fine + zb.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true); + zb.memoSize->setStyleSheet(""); + } + else { + // Overweight + zb.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); + zb.memoSize->setStyleSheet("color: red;"); + } + + }); + zb.memoTxt->setFocus(); if (d.exec() == QDialog::Accepted) { diff --git a/src/zboard.ui b/src/zboard.ui index 504d251..7b8e466 100644 --- a/src/zboard.ui +++ b/src/zboard.ui @@ -14,38 +14,24 @@ Post to z-board.net - - - - - + + - Send From - - - - - - - Qt::Horizontal - - - - - - - (optional) + Total Fee - - + + - Memo + feeamount + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - + 0 / 512 @@ -55,7 +41,7 @@ - + Qt::Horizontal @@ -65,37 +51,38 @@ - - + + - Post As: + Memo - - - - Total Fee + + + + (optional) - - - - - + + - feeamount + Send From - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + Post As: - <html><head/><body><p>ZBoard is a fully anonymous and untraceable chat messages based on the ZCash blockchain. <a href="http://www.z-board.net/"><span style=" text-decoration: underline; color:#0000ff;">http://www.z-board.net/</span></a></p><p>Posting to ZBoard: #Main_Area</p></body></html> + <html><head/><body><p>ZBoard: Fully anonymous and untraceable chat messages based on the ZCash blockchain. <a href="http://www.z-board.net/"><span style=" text-decoration: underline; color:#0000ff;">http://www.z-board.net/</span></a></p><p>Posting to ZBoard: #Main_Area</p></body></html> true @@ -105,7 +92,13 @@ - + + + + + + + color:red; @@ -115,6 +108,13 @@ + + + + Qt::Horizontal + + +