Added warning to IdEditDialog, when the lenght of the nickname is too short or too long.

Used StyledElidedLabel for the nickname in Idialog to avoid the horizontal growing of the right widget.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8402 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2015-06-09 08:33:34 +00:00
parent 578e15ffa7
commit 50cad976a9
3 changed files with 24 additions and 2 deletions

View File

@ -212,7 +212,7 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="layoutWidget">
<widget class="QWidget" name="layoutWidget1">
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QFrame" name="headerFrame">
@ -252,7 +252,7 @@
</widget>
</item>
<item row="0" column="1" rowspan="2" colspan="2">
<widget class="StyledLabel" name="headerTextLabel">
<widget class="StyledElidedLabel" name="headerTextLabel">
<property name="text">
<string>People</string>
</property>
@ -702,6 +702,11 @@
</action>
</widget>
<customwidgets>
<customwidget>
<class>StyledElidedLabel</class>
<extends>QLabel</extends>
<header>gui/common/StyledElidedLabel.h</header>
</customwidget>
<customwidget>
<class>StyledLabel</class>
<extends>QLabel</extends>

View File

@ -22,6 +22,7 @@
*/
#include <QBuffer>
#include <QMessageBox>
#include "IdEditDialog.h"
#include "ui_IdEditDialog.h"
@ -87,6 +88,9 @@ IdEditDialog::IdEditDialog(QWidget *parent) :
connect(ui->toolButton_Tag5, SIGNAL(clicked(bool)), this, SLOT(rmTag5()));
connect(ui->avatarButton, SIGNAL(clicked(bool)), this, SLOT(changeAvatar()));
/* Initialize ui */
ui->lineEdit_Nickname->setMaxLength(RSID_MAXIMUM_NICKNAME_SIZE);
mIdQueue = new TokenQueue(rsIdentity->getTokenService(), this);
ui->pushButton_Tag->setEnabled(false);
}
@ -489,12 +493,17 @@ void IdEditDialog::createId()
{
std::cerr << "IdEditDialog::createId() Nickname too short";
std::cerr << std::endl;
QMessageBox::warning(this, "", tr("The nickname is too short. Please input at least %1 characters.").arg(2), QMessageBox::Ok, QMessageBox::Ok);
return;
}
if (groupname.size() > RSID_MAXIMUM_NICKNAME_SIZE)
{
std::cerr << "IdEditDialog::createId() Nickname too long (max " << RSID_MAXIMUM_NICKNAME_SIZE<< " chars)";
std::cerr << std::endl;
QMessageBox::warning(this, "", tr("The nickname is too long. Please reduce the length to %1 characters.").arg(RSID_MAXIMUM_NICKNAME_SIZE), QMessageBox::Ok, QMessageBox::Ok);
return;
}
RsIdentityParameters params;

View File

@ -7208,6 +7208,14 @@ p, li { white-space: pre-wrap; }
<source>You can have one or more identities. They are used when you write in chat lobbies, forums and channel comments. They act as the destination for distant chat and the Retroshare distant mail system.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The nickname is too short. Please input at least %1 characters.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The nickname is too long. Please reduce the length to %1 characters.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>IdentityWidget</name>