Changed the buttons to use QPushButton which is easier with stylesheets

* Changed the buttons to use QPushButton which is easier with stylesheets
* Use standard strings Create or Post or Update ( not more OK or Send)
*Added default stylesheet colors for Create & Post Buttons
This commit is contained in:
defnax 2020-10-12 21:46:06 +02:00
parent ce6fb603c7
commit df29e22be0
11 changed files with 339 additions and 237 deletions

View file

@ -66,19 +66,19 @@ CreateGxsForumMsg::CreateGxsForumMsg(const RsGxsGroupId &fId, const RsGxsMessage
/* Setup UI helper */
mStateHelper = new UIStateHelper(this);
mStateHelper->addWidget(CREATEGXSFORUMMSG_FORUMINFO, ui.buttonBox->button(QDialogButtonBox::Ok));
mStateHelper->addWidget(CREATEGXSFORUMMSG_FORUMINFO, ui.postButton);
mStateHelper->addWidget(CREATEGXSFORUMMSG_FORUMINFO, ui.innerFrame);
mStateHelper->addLoadPlaceholder(CREATEGXSFORUMMSG_FORUMINFO, ui.forumName);
mStateHelper->addLoadPlaceholder(CREATEGXSFORUMMSG_FORUMINFO, ui.forumSubject);
mStateHelper->addClear(CREATEGXSFORUMMSG_FORUMINFO, ui.forumName);
mStateHelper->addWidget(CREATEGXSFORUMMSG_PARENTMSG, ui.buttonBox->button(QDialogButtonBox::Ok));
mStateHelper->addWidget(CREATEGXSFORUMMSG_PARENTMSG, ui.postButton);
mStateHelper->addWidget(CREATEGXSFORUMMSG_PARENTMSG, ui.innerFrame);
mStateHelper->addLoadPlaceholder(CREATEGXSFORUMMSG_PARENTMSG, ui.forumName);
mStateHelper->addLoadPlaceholder(CREATEGXSFORUMMSG_PARENTMSG, ui.forumSubject);
mStateHelper->addClear(CREATEGXSFORUMMSG_PARENTMSG, ui.forumName);
mStateHelper->addWidget(CREATEGXSFORUMMSG_ORIGMSG, ui.buttonBox->button(QDialogButtonBox::Ok));
mStateHelper->addWidget(CREATEGXSFORUMMSG_ORIGMSG, ui.postButton);
mStateHelper->addWidget(CREATEGXSFORUMMSG_ORIGMSG, ui.innerFrame);
mStateHelper->addLoadPlaceholder(CREATEGXSFORUMMSG_ORIGMSG, ui.forumName);
mStateHelper->addLoadPlaceholder(CREATEGXSFORUMMSG_ORIGMSG, ui.forumSubject);
@ -99,12 +99,9 @@ CreateGxsForumMsg::CreateGxsForumMsg(const RsGxsGroupId &fId, const RsGxsMessage
connect(ui.hashBox, SIGNAL(fileHashingFinished(QList<HashedFile>)), this, SLOT(fileHashingFinished(QList<HashedFile>)));
/* Rename Ok button */
ui.buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Send"));
// connect up the buttons.
connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(createMsg()));
connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
connect(ui.postButton, SIGNAL(clicked()), this, SLOT(createMsg()));
connect(ui.cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
connect(ui.emoticonButton, SIGNAL(clicked()), this, SLOT(smileyWidgetForums()));
connect(ui.attachFileButton, SIGNAL(clicked()), this, SLOT(addFile()));
connect(ui.attachPictureButton, SIGNAL(clicked()), this, SLOT(addPicture()));
@ -363,8 +360,8 @@ void CreateGxsForumMsg::checkLength()
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.postButton->setToolTip(text);
ui.postButton->setEnabled(charRemains>=0);
ui.infoLabel->setText(text);
}