Changed the toolbar icons & hide hashing groupbox by default

* Changed the toolbar icons
* Hide the hashing group box when there is no file attached
* Show the warning text color in red when the size is too  big
This commit is contained in:
defnax 2019-10-12 22:32:14 +02:00
parent 1ce3bd4f62
commit 32718c673f
2 changed files with 18 additions and 8 deletions

View File

@ -118,6 +118,8 @@ CreateGxsForumMsg::CreateGxsForumMsg(const RsGxsGroupId &fId, const RsGxsMessage
newMsg();
ui.hashGroupBox->hide();
#ifndef ENABLE_GENERATE
ui.generateCheckBox->hide();
ui.generateSpinBox->hide();
@ -348,10 +350,13 @@ void CreateGxsForumMsg::checkLength()
RsHtml::optimizeHtml(ui.forumMessage, text);
std::wstring msg = text.toStdWString();
int charRemains = MAX_ALLOWED_GXS_MESSAGE_SIZE - msg.length();
if(charRemains >= 0)
if(charRemains >= 0) {
text = tr("It remains %1 characters after HTML conversion.").arg(charRemains);
else
ui.infoLabel->setStyleSheet("QLabel#infoLabel { }");
}else{
text = tr("Warning: This message is too big of %1 characters after HTML conversion.").arg((0-charRemains));
ui.infoLabel->setStyleSheet("QLabel#infoLabel {color: red; font: bold; }");
}
ui.buttonBox->button(QDialogButtonBox::Ok)->setToolTip(text);
ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(charRemains>=0);
ui.infoLabel->setText(text);
@ -506,6 +511,7 @@ void CreateGxsForumMsg::addFile()
QStringList files;
if (misc::getOpenFileNames(this, RshareSettings::LASTDIR_EXTRAFILE, tr("Add Extra File"), "", files)) {
ui.hashBox->addAttachments(files,RS_FILE_REQ_ANONYMOUS_ROUTING);
ui.hashGroupBox->show();
}
}
@ -542,6 +548,7 @@ void CreateGxsForumMsg::fileHashingFinished(QList<HashedFile> hashedFiles)
}
ui.forumMessage->setFocus( Qt::OtherFocusReason );
ui.hashGroupBox->hide();
}
void CreateGxsForumMsg::loadForumInfo(const uint32_t &token)

View File

@ -139,14 +139,17 @@
<enum>QFrame::Sunken</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>1</number>
<number>6</number>
</property>
<property name="topMargin">
<number>1</number>
</property>
<property name="rightMargin">
<number>1</number>
<number>6</number>
</property>
<property name="bottomMargin">
<number>1</number>
@ -163,8 +166,8 @@
<string/>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/add-share24.png</normaloff>:/images/add-share24.png</iconset>
<iconset resource="../icons.qrc">
<normaloff>:/icons/png/attach.png</normaloff>:/icons/png/attach.png</iconset>
</property>
<property name="iconSize">
<size>
@ -186,8 +189,8 @@
<string/>
</property>
<property name="icon">
<iconset resource="../emojione.qrc">
<normaloff>:/emojione/1F603.png</normaloff>:/emojione/1F603.png</iconset>
<iconset resource="../icons.qrc">
<normaloff>:/icons/png/smiley.png</normaloff>:/icons/png/smiley.png</iconset>
</property>
<property name="iconSize">
<size>