Changed the standard dialog buttons from single buttons to buttonbox to have a standard layout and a standard translation.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5657 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2012-10-10 10:51:53 +00:00
parent e10ce3ff35
commit b67f9f88fe
39 changed files with 110 additions and 671 deletions

View file

@ -22,6 +22,7 @@
#include "CreateLobbyDialog.h"
#include <QMessageBox>
#include <QPushButton>
#include <algorithm>
#include <retroshare/rsmsgs.h>
@ -48,8 +49,8 @@ CreateLobbyDialog::CreateLobbyDialog(const std::list<std::string>& peer_list, in
#endif
ui->nickName_LE->setText(QString::fromUtf8(default_nick.c_str())) ;
connect( ui->shareButton, SIGNAL( clicked ( bool ) ), this, SLOT( createLobby( ) ) );
connect( ui->cancelButton, SIGNAL( clicked ( bool ) ), this, SLOT( cancel( ) ) );
connect( ui->buttonBox, SIGNAL(accepted()), this, SLOT(createLobby()));
connect( ui->buttonBox, SIGNAL(rejected()), this, SLOT(close()));
connect( ui->lobbyName_LE, SIGNAL( textChanged ( QString ) ), this, SLOT( checkTextFields( ) ) );
connect( ui->lobbyTopic_LE, SIGNAL( textChanged ( QString ) ), this, SLOT( checkTextFields( ) ) );
connect( ui->nickName_LE, SIGNAL( textChanged ( QString ) ), this, SLOT( checkTextFields( ) ) );
@ -89,9 +90,9 @@ void CreateLobbyDialog::changeEvent(QEvent *e)
void CreateLobbyDialog::checkTextFields()
{
if(ui->lobbyName_LE->text() == "" || ui->nickName_LE->text() == "")
ui->shareButton->setEnabled(false) ;
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false) ;
else
ui->shareButton->setEnabled(true) ;
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true) ;
}
void CreateLobbyDialog::createLobby()
@ -128,8 +129,3 @@ void CreateLobbyDialog::createLobby()
close();
}
void CreateLobbyDialog::cancel()
{
close();
}

View file

@ -24,7 +24,6 @@ private:
private slots:
void createLobby();
void checkTextFields();
void cancel();
};
#endif // CREATELOBBYDIALOG_H

View file

@ -239,29 +239,9 @@
<number>0</number>
</property>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="shareButton">
<property name="text">
<string>Create</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cancelButton">
<property name="text">
<string>Cancel</string>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>