From 807b7378df8a52edff0bd3ff8a97398596b31d41 Mon Sep 17 00:00:00 2001 From: electron128 Date: Thu, 21 May 2015 09:03:58 +0000 Subject: [PATCH] improved GenCertDialog (patch from Henry) git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8281 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/GenCertDialog.cpp | 61 ++++++---- retroshare-gui/src/gui/GenCertDialog.h | 1 + retroshare-gui/src/gui/GenCertDialog.ui | 112 +++++++++++++----- .../src/gui/qss/stylesheet/Standard.qss | 9 ++ 4 files changed, 129 insertions(+), 54 deletions(-) diff --git a/retroshare-gui/src/gui/GenCertDialog.cpp b/retroshare-gui/src/gui/GenCertDialog.cpp index 122d8b557..0576bb954 100644 --- a/retroshare-gui/src/gui/GenCertDialog.cpp +++ b/retroshare-gui/src/gui/GenCertDialog.cpp @@ -196,8 +196,11 @@ void GenCertDialog::init() std::list pgpIds; std::list::iterator it; - bool foundGPGKeys = false; + haveGPGKeys = false; +#ifdef TO_REMOVE + /* replace with true/false below */ if (!mOnlyGenerateIdentity) { +#endif if (RsAccounts::GetPGPLogins(pgpIds)) { for(it = pgpIds.begin(); it != pgpIds.end(); ++it) { @@ -207,13 +210,15 @@ void GenCertDialog::init() std::cerr << "Adding PGPUser: " << name << " id: " << *it << std::endl; QString gid = QString::fromStdString( (*it).toStdString()).right(8) ; ui.genPGPuser->addItem(QString::fromUtf8(name.c_str()) + " <" + QString::fromUtf8(email.c_str()) + "> (" + gid + ")", userData); - foundGPGKeys = true; + haveGPGKeys = true; } } +#ifdef TO_REMOVE } - - if (foundGPGKeys) { +#endif + if (haveGPGKeys) { ui.no_gpg_key_label->hide(); + ui.header_label->show(); ui.new_gpg_key_checkbox->setChecked(false); setWindowTitle(tr("Create new node")); ui.genButton2->setText(tr("Generate new node")); @@ -221,6 +226,7 @@ void GenCertDialog::init() genNewGPGKey = false; } else { ui.no_gpg_key_label->setVisible(!mOnlyGenerateIdentity); + ui.header_label->setVisible(mOnlyGenerateIdentity); ui.new_gpg_key_checkbox->setChecked(true); ui.new_gpg_key_checkbox->setEnabled(true); setWindowTitle(tr("Create new profile")); @@ -229,19 +235,22 @@ void GenCertDialog::init() genNewGPGKey = true; } +#ifdef TO_REMOVE QString text; /*= ui.header_label->text() + "\n";*/ text += tr("You can create a new profile with this form."); if (mOnlyGenerateIdentity) { ui.new_gpg_key_checkbox->setChecked(true); ui.new_gpg_key_checkbox->hide(); +#endif ui.genprofileinfo_label->hide(); +#ifdef TO_REMOVE } else { text += "\n"; text += tr("Alternatively you can use an existing profile. Just uncheck \"Create a new profile\""); } ui.header_label->setText(text); - +#endif newGPGKeyGenUiSetup(); //updateUiSetup(); } @@ -275,24 +284,28 @@ void GenCertDialog::newGPGKeyGenUiSetup() { setWindowTitle(tr("Create new profile")); ui.genButton2->setText(tr("Generate new profile and node")); ui.headerFrame->setHeaderText(tr("Create a new profile and node")); - ui.no_gpg_key_label->setText(tr("Please fill out this form to create a profile and node.")); + ui.no_gpg_key_label->setText(tr("Welcome to Retroshare. Before you can proceed you need to create a profile and associate a node with it. To do so please fill out this form.\nAlternatively you can import a (previously exported) profile. Just uncheck \"Create a new profile\"")); ui.genButton2->setVisible(true); ui.adv_checkbox->setVisible(true); ui.node_label->setVisible(true); ui.node_input->setVisible(true); ui.entropy_label->setVisible(true); ui.entropy_bar->setVisible(true); - ui.genprofileinfo_label->hide(); - ui.header_label->show(); + ui.genprofileinfo_label->setVisible(false); + if (!mOnlyGenerateIdentity) { + ui.header_label->setVisible(haveGPGKeys); + } //ui.keylength_label->show(); //ui.keylength_comboBox->show(); } else { - bool havePGPkeys = (ui.genPGPuser->count() != 0)?true:false; - if (havePGPkeys) { + //haveGPGKeys = (ui.genPGPuser->count() != 0)?true:false; + if (haveGPGKeys) { QVariant data = ui.genPGPuser->itemData(ui.genPGPuser->currentIndex()); if (!rsAccounts->selectAccountByString(data.toString().toStdString())) { ui.no_node_label->setText(tr("No node is associated with the profile named") + " " + ui.genPGPuser->currentText() + ". " +tr("Please create a node for it by providing a node name.")); ui.no_node_label->setVisible(true); + } else { + ui.genprofileinfo_label->show(); } } genNewGPGKey = false; @@ -307,23 +320,23 @@ void GenCertDialog::newGPGKeyGenUiSetup() { ui.genPGPuserlabel->show(); ui.genPGPuser->show(); ui.importIdentity_PB->setVisible(!mOnlyGenerateIdentity); - ui.exportIdentity_PB->setVisible(havePGPkeys); - ui.exportIdentity_PB->setEnabled(havePGPkeys); + ui.exportIdentity_PB->setVisible(haveGPGKeys); + ui.exportIdentity_PB->setEnabled(haveGPGKeys); setWindowTitle(tr("Create new node")); ui.genButton2->setText(tr("Generate new node")); ui.headerFrame->setHeaderText(tr("Create a new node")); - ui.no_gpg_key_label->setText(tr("No valid profile found!\nPlease import one first.")); - ui.genButton2->setVisible(havePGPkeys); - ui.adv_checkbox->setVisible(havePGPkeys); - ui.adv_checkbox->setChecked(havePGPkeys && adv_state); - ui.genPGPuser->setVisible(havePGPkeys); - ui.genPGPuserlabel->setVisible(havePGPkeys); - ui.node_label->setVisible(havePGPkeys); - ui.node_input->setVisible(havePGPkeys); - ui.entropy_label->setVisible(havePGPkeys); - ui.entropy_bar->setVisible(havePGPkeys); - ui.genprofileinfo_label->show(); - ui.header_label->hide(); + ui.no_gpg_key_label->setText(tr("Welcome to Retroshare. Before you can proceed you need to import a profile and after that associate a node with it.")); + ui.genButton2->setVisible(haveGPGKeys); + ui.adv_checkbox->setVisible(haveGPGKeys); + ui.adv_checkbox->setChecked(haveGPGKeys && adv_state); + ui.genPGPuser->setVisible(haveGPGKeys); + ui.genPGPuserlabel->setVisible(haveGPGKeys); + ui.node_label->setVisible(haveGPGKeys); + ui.node_input->setVisible(haveGPGKeys); + ui.entropy_label->setVisible(haveGPGKeys); + ui.entropy_bar->setVisible(haveGPGKeys); + //ui.genprofileinfo_label->show(); + ui.header_label->setVisible(false); ui.keylength_label->hide(); ui.keylength_comboBox->hide(); } diff --git a/retroshare-gui/src/gui/GenCertDialog.h b/retroshare-gui/src/gui/GenCertDialog.h index 3080207a9..6dfff2476 100644 --- a/retroshare-gui/src/gui/GenCertDialog.h +++ b/retroshare-gui/src/gui/GenCertDialog.h @@ -51,6 +51,7 @@ private: Ui::GenCertDialog ui; bool genNewGPGKey; + bool haveGPGKeys; bool mOnlyGenerateIdentity; QTimer *entropy_timer ; diff --git a/retroshare-gui/src/gui/GenCertDialog.ui b/retroshare-gui/src/gui/GenCertDialog.ui index 3d2ff1cdb..887b819c0 100644 --- a/retroshare-gui/src/gui/GenCertDialog.ui +++ b/retroshare-gui/src/gui/GenCertDialog.ui @@ -46,7 +46,8 @@ - + You can create a new profile with this form. +Alternatively you can use an existing profile. Just uncheck "Create a new profile" true @@ -223,34 +224,25 @@ - - - - - 0 - 30 - - - - 1 - - - <html><head/><body><p>This is a TOR Onion address of the form: xa76giaf6ifda7ri63i263.onion </p><p>In order to get one, you must configure TOR to create a new hidden service. If you do not yet have one, you can still go on, and make it right later in Retroshare's Options-&gt;Server-&gt;TOR configuration panel.</p></body></html> - - - false - - - true - - - + + + + 120 + 32 + + + + + 120 + 32 + + Use profile @@ -258,6 +250,18 @@ + + + 120 + 32 + + + + + 120 + 32 + + Name @@ -304,13 +308,6 @@ - - - - PGP key length - - - @@ -462,6 +459,61 @@ anonymous, you can use a fake email. + + + + + + + + + + + 0 + 30 + + + + 1 + + + <html><head/><body><p>This is a TOR Onion address of the form: xa76giaf6ifda7ri63i263.onion </p><p>In order to get one, you must configure TOR to create a new hidden service. If you do not yet have one, you can still go on, and make it right later in Retroshare's Options-&gt;Server-&gt;TOR configuration panel.</p></body></html> + + + false + + + true + + + + + + + + + + + + 120 + 32 + + + + + 120 + 32 + + + + PGP key length + + + + + + + diff --git a/retroshare-gui/src/gui/qss/stylesheet/Standard.qss b/retroshare-gui/src/gui/qss/stylesheet/Standard.qss index e2b41e544..f1774a49d 100644 --- a/retroshare-gui/src/gui/qss/stylesheet/Standard.qss +++ b/retroshare-gui/src/gui/qss/stylesheet/Standard.qss @@ -34,6 +34,14 @@ GenCertDialog QLabel#label_hiddenaddr2 { background: #CCFFCC; background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #CCFFCC, stop:1 #AAFFAA); } +GenCertDialog QLabel#no_node_label, GenCertDialog QLabel#no_gpg_key_label { + border: 1px solid #FFC550; + border-radius: 6px; + background: #FFEECC; + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #FFEECC, stop:1 #FFE3AB); + padding: 4px; + font-size: 14px; +} GenCertDialog > QFrame#headerFrame > QLabel#headerLabel { color: rgb(255, 255, 255); @@ -57,6 +65,7 @@ GenCertDialog QPushButton#genButton:hover { border-image: url(:/images/btn_blue_hover.png) 4; } + /* FriendsDialog */ FriendsDialog QFrame#headFrame {