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,75 +14,14 @@ Post to z-board.net - - - - - - - Send From - - - - - - - Qt::Horizontal - - - - - - - (optional) - - - - - - - Memo - - - - - - - 0 / 512 - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - Post As: - - - - + Total Fee - - - - + feeamount @@ -92,10 +31,58 @@ + + + + 0 / 512 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + Memo + + + + + + + (optional) + + + + + + + Send From + + + + + + + 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 + + +