From 5069ba86dd33d411e3ce0f253ca59f33c83f3e22 Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 12 Feb 2017 21:45:22 +0100 Subject: [PATCH] improved style/layout of gen cert dialog --- retroshare-gui/src/gui/GenCertDialog.cpp | 45 +- retroshare-gui/src/gui/GenCertDialog.h | 1 + retroshare-gui/src/gui/GenCertDialog.ui | 628 ++++++++++-------- .../src/gui/qss/stylesheet/Standard.qss | 4 +- 4 files changed, 397 insertions(+), 281 deletions(-) diff --git a/retroshare-gui/src/gui/GenCertDialog.cpp b/retroshare-gui/src/gui/GenCertDialog.cpp index 7412519ba..40a2bb74c 100644 --- a/retroshare-gui/src/gui/GenCertDialog.cpp +++ b/retroshare-gui/src/gui/GenCertDialog.cpp @@ -44,6 +44,9 @@ #include #include +#define IMAGE_GOOD ":/images/accepted16.png" +#define IMAGE_BAD ":/images/deletemail24.png" + class EntropyCollectorWidget: public QTextBrowser { public: @@ -110,12 +113,15 @@ void GenCertDialog::grabMouse() ui.genButton->setEnabled(false) ; //ui.genButton->setIcon(QIcon(":/images/delete.png")) ; ui.genButton->setToolTip(tr("Currently disabled. Please move your mouse around until you reach at least 20%")) ; + + ui.randomness_check_LB->setPixmap(QPixmap(IMAGE_BAD)) ; } else { ui.genButton->setEnabled(true) ; //ui.genButton->setIcon(QIcon(":/images/resume.png")) ; ui.genButton->setToolTip(tr("Click to create your node and/or profile")) ; + ui.randomness_check_LB->setPixmap(QPixmap(IMAGE_GOOD)) ; } RsInit::collectEntropy(E+(F << 16)) ; @@ -145,6 +151,11 @@ GenCertDialog::GenCertDialog(bool onlyGenerateIdentity, QWidget *parent) connect(ui.importIdentity_PB, SIGNAL(clicked()), this, SLOT(importIdentity())); connect(ui.exportIdentity_PB, SIGNAL(clicked()), this, SLOT(exportIdentity())); + connect(ui.password_input, SIGNAL(textChanged(QString)), this, SLOT(updateCheckLabels())); + connect(ui.password_input_2, SIGNAL(textChanged(QString)), this, SLOT(updateCheckLabels())); + connect(ui.name_input, SIGNAL(textChanged(QString)), this, SLOT(updateCheckLabels())); + connect(ui.node_input, SIGNAL(textChanged(QString)), this, SLOT(updateCheckLabels())); + entropy_timer = new QTimer ; entropy_timer->start(20) ; QObject::connect(entropy_timer,SIGNAL(timeout()),this,SLOT(grabMouse())) ; @@ -158,7 +169,7 @@ GenCertDialog::GenCertDialog(bool onlyGenerateIdentity, QWidget *parent) #if QT_VERSION >= 0x040700 ui.node_input->setPlaceholderText(tr("[Required] Examples: Home, Laptop,...")) ; - ui.hiddenaddr_input->setPlaceholderText(tr("[Required] Tor/I2P address - Examples: xa76giaf6ifda7ri63i263.onion (obtained by you from Tor)")) ; + ui.hiddenaddr_input->setPlaceholderText(tr("[Optional] Tor/I2P address - Examples: xa76giaf6ifda7ri63i263.onion (obtained by you from Tor)")) ; ui.name_input->setPlaceholderText(tr("[Required] Identifies your Retrohare node(s). Visible to your friends, and friends of friends.")); ui.nickname_input->setPlaceholderText(tr("[Optional] Used when you write in chat lobbies, forums and channel comments. Can be setup later if you need one.")); ui.password_input->setPlaceholderText(tr("[Required] This password protects your data and is required when re-start.")); @@ -273,15 +284,15 @@ void GenCertDialog::setupState() ui.node_label->setVisible(true); ui.node_input->setVisible(true); - ui.password_label->setVisible(true); - ui.password_label_2->setVisible(true); ui.password_input->setVisible(true); - ui.password_input_2->setVisible(true); + ui.password_label->setVisible(true); + + ui.password_input_2->setVisible(generate_new); + ui.password_label_2->setVisible(generate_new); ui.keylength_label->setVisible(adv_state); ui.keylength_comboBox->setVisible(adv_state); - ui.entropy_label->setVisible(true); ui.entropy_bar->setVisible(true); ui.genButton->setVisible(true); @@ -289,9 +300,10 @@ void GenCertDialog::setupState() ui.hiddenaddr_input->setVisible(hidden_state); ui.hiddenaddr_label->setVisible(hidden_state); - ui.label_hiddenaddr->setVisible(hidden_state); ui.hiddenport_label->setVisible(hidden_state); ui.hiddenport_spinBox->setVisible(hidden_state); + + updateCheckLabels(); } void GenCertDialog::exportIdentity() @@ -310,6 +322,17 @@ void GenCertDialog::exportIdentity() QMessageBox::information(this,tr("Profile not saved"),tr("Your profile was not saved. An error occurred.")) ; } +void GenCertDialog::updateCheckLabels() +{ + QPixmap good( IMAGE_GOOD ) ; + QPixmap bad ( IMAGE_BAD ) ; + + ui.node_name_check_LB ->setPixmap( (ui.node_input->text().length() > 3)?good:bad ) ; + ui.profile_name_check_LB->setPixmap( (ui.name_input->text().length() > 3)?good:bad ) ; + ui.password_check_LB ->setPixmap( (ui.password_input->text().length() > 3)?good:bad ) ; + ui.password2_check_LB ->setPixmap( (ui.password_input->text().length() > 3 && ui.password_input->text() == ui.password_input_2->text())?good:bad) ; +} + bool GenCertDialog::importIdentity() { QString fname ; @@ -386,7 +409,9 @@ void GenCertDialog::genPerson() isHiddenLoc = true; } - if (!genNewGPGKey) { + + if (!genNewGPGKey) + { if (genLoc.length() < 3) { /* Message Dialog */ QMessageBox::warning(this, @@ -470,11 +495,9 @@ void GenCertDialog::genPerson() err_string); setCursor(Qt::ArrowCursor) ; - - // now cache the PGP password so that it's not asked again for immediately signing the key - - rsNotify->cachePgpPassphrase(ui.password_input->text().toUtf8().constData()) ; } + // now cache the PGP password so that it's not asked again for immediately signing the key + rsNotify->cachePgpPassphrase(ui.password_input->text().toUtf8().constData()) ; //generate a random ssl password std::string sslPasswd = RSRandom::random_alphaNumericString(RsInit::getSslPwdLen()) ; diff --git a/retroshare-gui/src/gui/GenCertDialog.h b/retroshare-gui/src/gui/GenCertDialog.h index 51cfaa19c..c9c1c2699 100644 --- a/retroshare-gui/src/gui/GenCertDialog.h +++ b/retroshare-gui/src/gui/GenCertDialog.h @@ -44,6 +44,7 @@ private slots: void setupState(); void switchReuseExistingNode(); void grabMouse(); + void updateCheckLabels(); private: void initKeyList(); diff --git a/retroshare-gui/src/gui/GenCertDialog.ui b/retroshare-gui/src/gui/GenCertDialog.ui index ffef7a78c..fd87030b1 100644 --- a/retroshare-gui/src/gui/GenCertDialog.ui +++ b/retroshare-gui/src/gui/GenCertDialog.ui @@ -6,7 +6,7 @@ 0 0 - 1745 + 1278 1296 @@ -35,6 +35,12 @@ + + + 0 + 0 + + QFrame::StyledPanel @@ -42,6 +48,19 @@ QFrame::Raised + + + + + + + :/images/logo/logo_splash.png + + + Qt::AlignCenter + + + @@ -88,19 +107,6 @@ - - - - - - - :/images/logo/logo_splash.png - - - Qt::AlignCenter - - - @@ -284,75 +290,10 @@ Alternatively you can use an existing profile. Just uncheck "Create a new p - - + + - Node type - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - This password is for PGP - - - Password (check) - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - Put a strong password here. This password protects your private PGP key. - - - - - - 1024 - - - QLineEdit::Password - - - - - - - Profile name - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - 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. - - - - - - - - - - Chat identity + hidden address Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -372,101 +313,93 @@ Alternatively you can use an existing profile. Just uncheck "Create a new p - - - - - - - Put a strong password here. This password protects your private PGP key. - - - - - - 1024 - - - QLineEdit::Password + + + + + 0 + 0 + - - + + + + This password is for PGP + - hidden address + Password (check) Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - 6 + + + + - - - - - 0 - 0 - - - - - 16777215 - 32 - - - - 64 - - - - - - - Port - - - - - - - <html><head/><body><p>This is your connection port.</p><p>Any value between 1024 and 65535 </p><p>should be ok. You can change it later.</p></body></html> - - - 1 - - - 65535 - - - 7812 - - - - + - - + + - + 0 0 - - <html><head/><body><p>This can be a Tor Onion address of the form: xa76giaf6ifda7ri63i263.onion <br/>or an I2P address in the form: [52 characters].b32.i2p </p><p>In order to get one, you must configure either Tor or I2P to create a new hidden service / server tunnel. If you do not yet have one, you can still go on, and make it right later in RetroShare's Options-&gt;Network-&gt;Hidden Service configuration panel.</p></body></html> - - - true + + 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. - + + + + + 0 + 0 + + + + <html><head/><body><p>Please move your mouse around in order to collect as much randomness as possible. A minimum of 20% is needed to create your node keys.</p></body></html> + + + 24 + + + + + + + + + + + + + + + + + + + + + + + + Chat identity + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + PGP key length @@ -478,6 +411,12 @@ Alternatively you can use an existing profile. Just uncheck "Create a new p + + + 0 + 0 + + 0 @@ -489,20 +428,6 @@ Alternatively you can use an existing profile. Just uncheck "Create a new p - - - - - Standard node - - - - - TOR/I2P Hidden node - - - - @@ -513,12 +438,39 @@ Alternatively you can use an existing profile. Just uncheck "Create a new p + + + + + + + + + + + + 0 + 0 + + + + + Standard node + + + + + TOR/I2P Hidden node + + + + - + 0 0 @@ -548,6 +500,12 @@ Alternatively you can use an existing profile. Just uncheck "Create a new p + + + 0 + 0 + + Your profile is associated with a PGP key pair. RetroShare currently ignores DSA keys. @@ -556,7 +514,7 @@ Alternatively you can use an existing profile. Just uncheck "Create a new p - + 0 0 @@ -569,7 +527,7 @@ Alternatively you can use an existing profile. Just uncheck "Create a new p - + 0 0 @@ -581,6 +539,12 @@ Alternatively you can use an existing profile. Just uncheck "Create a new p + + + 0 + 0 + + Re-use an existing profile @@ -588,6 +552,157 @@ Alternatively you can use an existing profile. Just uncheck "Create a new p + + + + 6 + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 32 + + + + <html><head/><body><p>This should be a Tor Onion address of the form: xa76giaf6ifda7ri63i263.onion <br/>or an I2P address in the form: [52 characters].b32.i2p </p><p>In order to get one, you must configure either Tor or I2P to create a new hidden service / server tunnel. </p><p>You can also leave this blank now, but your node will only work if you correctly set the Tor/I2P service address in Options-&gt;Network-&gt;Hidden Service configuration panel.</p></body></html> + + + 64 + + + + + + + Port + + + + + + + + 0 + 0 + + + + <html><head/><body><p>This is your connection port.</p><p>Any value between 1024 and 65535 </p><p>should be ok. You can change it later.</p></body></html> + + + 1 + + + 65535 + + + 7812 + + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + Put a strong password here. This password protects your private PGP key. + + + + + + 1024 + + + QLineEdit::Password + + + + + + + + + + + + + + + 0 + 0 + + + + Put a strong password here. This password protects your private PGP key. + + + + + + 1024 + + + QLineEdit::Password + + + + + + + Profile name + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Node type + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Randomness + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + @@ -604,101 +719,70 @@ Alternatively you can use an existing profile. Just uncheck "Create a new p - - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 178 - - - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 178 - - - - - - - - - 255 - 255 - 178 - - - - - - - 255 - 255 - 178 - - - - - - - - true - - - QFrame::Box - - - <html><head/><body><p align="justify">Before proceeding, move your mouse around to help Retroshare collect as much randomness as possible. Filling the progressbar to 20% is required, 100% is advised.</p></body></html> - - - true - - + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + + + Go! + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + - - - 24 + + + Qt::Vertical - - - - - - + + + 20 + 40 + - - Go! - - + @@ -713,15 +797,25 @@ Alternatively you can use an existing profile. Just uncheck "Create a new p - nickname_input + name_input + node_input password_input password_input_2 + adv_checkbox + keylength_comboBox + nodeType_CB + exportIdentity_PB + reuse_existing_node_CB + nickname_input + genPGPuser hiddenaddr_input hiddenport_spinBox + genButton + importIdentity_PB - + diff --git a/retroshare-gui/src/gui/qss/stylesheet/Standard.qss b/retroshare-gui/src/gui/qss/stylesheet/Standard.qss index f4fbd36e5..b183eb77c 100644 --- a/retroshare-gui/src/gui/qss/stylesheet/Standard.qss +++ b/retroshare-gui/src/gui/qss/stylesheet/Standard.qss @@ -715,8 +715,6 @@ GenCertDialog QLineEdit#name_input { GenCertDialog QPushButton#genButton { border-image: url(:/images/btn_blue.png) 4; border-width: 4; -/* padding: 0px 6px;*/ -/* font-size: 16px; */ font: bold; color: white; } @@ -727,7 +725,7 @@ GenCertDialog QPushButton#genButton:hover { GenCertDialog QPushButton#genButton:disabled { border-image: url(:/images/btn_27.png) 4; - font-size: 16px; +/* font-size: 16px; */ font: bold; color: black; }