reworked GenCertDialog with node type on top level

This commit is contained in:
csoler 2018-07-26 09:39:26 +02:00
parent 62b9a74324
commit 74ec558c45
No known key found for this signature in database
GPG Key ID: 7BCA522266C0804C
2 changed files with 60 additions and 59 deletions

View File

@ -258,26 +258,34 @@ void GenCertDialog::mouseMoveEvent(QMouseEvent *e)
void GenCertDialog::setupState()
{
bool adv_state = ui.adv_checkbox->isChecked();
bool retrotor = false ;
if(!adv_state)
{
ui.reuse_existing_node_CB->setChecked(false) ;
ui.nodeType_CB->setCurrentIndex(retrotor?1:0) ;
ui.keylength_comboBox->setCurrentIndex(0) ;
}
bool hidden_state = ui.nodeType_CB->currentIndex()==1;
bool hidden_state = ui.nodeType_CB->currentIndex()==1 || ui.nodeType_CB->currentIndex()==2;
bool generate_new = !ui.reuse_existing_node_CB->isChecked();
bool tor_auto = ui.nodeType_CB->currentIndex()==1;
genNewGPGKey = generate_new;
switch(ui.nodeType_CB->currentIndex())
{
case 0: ui.nodeTypeExplanation_TE->setText(tr("<b>Your IP is visible to trusted nodes only. You can optionally connect to hidden nodes if running Tor on your machine.</b>"));
break;
case 1: ui.nodeTypeExplanation_TE->setText(tr("<b>Your IP is hidden. All traffic happens over the Tor network. Best choice if you cannot trust friend nodes with your own IP.</b>"));
break;
case 2: ui.nodeTypeExplanation_TE->setText(tr("<b>Hidden node for advanced users only, that allows to use other proxy solutions such as I2P.</b>"));
break;
}
//ui.no_node_label->setVisible(false);
setWindowTitle(generate_new?tr("Create new profile and new Retroshare node"):tr("Create new Retroshare node"));
//ui.headerFrame->setHeaderText(generate_new?tr("Create a new profile and node"):tr("Create a new node"));
ui.label_nodeType->setVisible(adv_state && !retrotor) ;
ui.nodeType_CB->setVisible(adv_state && !retrotor) ;
ui.nodeType_CB->setVisible(true);
ui.reuse_existing_node_CB->setEnabled(adv_state) ;
ui.importIdentity_PB->setVisible(adv_state && !generate_new) ;
ui.exportIdentity_PB->setVisible(adv_state && !generate_new) ;
@ -313,13 +321,13 @@ void GenCertDialog::setupState()
ui.entropy_bar->setVisible(true);
ui.genButton->setVisible(true);
ui.hiddenaddr_input->setVisible(hidden_state && !retrotor);
ui.hiddenaddr_label->setVisible(hidden_state && !retrotor);
ui.hiddenaddr_input->setVisible(hidden_state && !tor_auto);
ui.hiddenaddr_label->setVisible(hidden_state && !tor_auto);
ui.hiddenport_label->setVisible(hidden_state && !retrotor);
ui.hiddenport_spinBox->setVisible(hidden_state && !retrotor);
ui.hiddenport_label->setVisible(hidden_state && !tor_auto);
ui.hiddenport_spinBox->setVisible(hidden_state && !tor_auto);
ui.cbUseBob->setVisible(hidden_state && !retrotor);
ui.cbUseBob->setVisible(hidden_state && !tor_auto);
if(!mAllFieldsOk)
{

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>569</width>
<height>426</height>
<width>978</width>
<height>826</height>
</rect>
</property>
<property name="windowTitle">
@ -50,10 +50,7 @@
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="profileframeVLayout">
<property name="leftMargin">
<number>9</number>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="RSLabel">
<property name="text">
@ -71,7 +68,32 @@
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="toolBarHLayout">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QComboBox" name="nodeType_CB">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>Standard node</string>
</property>
</item>
<item>
<property name="text">
<string>Hidden node (over Tor)</string>
</property>
</item>
<item>
<property name="text">
<string>Hidden node (Tor/I2P - Manually configured)</string>
</property>
</item>
</widget>
</item>
<item>
<spacer name="toolBarHSpacer">
<property name="orientation">
@ -110,6 +132,19 @@
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="nodeTypeExplanation_TE">
<property name="text">
<string>TextLabel</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="profile_groupBox">
<property name="styleSheet">
@ -233,26 +268,6 @@
</property>
</widget>
</item>
<item row="15" column="2">
<widget class="QComboBox" name="nodeType_CB">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>Standard node</string>
</property>
</item>
<item>
<property name="text">
<string>TOR/I2P Hidden node</string>
</property>
</item>
</widget>
</item>
<item row="5" column="2">
<widget class="QLineEdit" name="node_input">
<property name="sizePolicy">
@ -675,28 +690,6 @@
</property>
</widget>
</item>
<item row="15" column="1">
<widget class="QLabel" name="label_nodeType">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="icons.qrc">:/icons/svg/netgraph.svg</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0">