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() void GenCertDialog::setupState()
{ {
bool adv_state = ui.adv_checkbox->isChecked(); bool adv_state = ui.adv_checkbox->isChecked();
bool retrotor = false ;
if(!adv_state) if(!adv_state)
{ {
ui.reuse_existing_node_CB->setChecked(false) ; ui.reuse_existing_node_CB->setChecked(false) ;
ui.nodeType_CB->setCurrentIndex(retrotor?1:0) ;
ui.keylength_comboBox->setCurrentIndex(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 generate_new = !ui.reuse_existing_node_CB->isChecked();
bool tor_auto = ui.nodeType_CB->currentIndex()==1;
genNewGPGKey = generate_new; 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); //ui.no_node_label->setVisible(false);
setWindowTitle(generate_new?tr("Create new profile and new Retroshare node"):tr("Create new Retroshare node")); 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.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(true);
ui.nodeType_CB->setVisible(adv_state && !retrotor) ;
ui.reuse_existing_node_CB->setEnabled(adv_state) ; ui.reuse_existing_node_CB->setEnabled(adv_state) ;
ui.importIdentity_PB->setVisible(adv_state && !generate_new) ; ui.importIdentity_PB->setVisible(adv_state && !generate_new) ;
ui.exportIdentity_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.entropy_bar->setVisible(true);
ui.genButton->setVisible(true); ui.genButton->setVisible(true);
ui.hiddenaddr_input->setVisible(hidden_state && !retrotor); ui.hiddenaddr_input->setVisible(hidden_state && !tor_auto);
ui.hiddenaddr_label->setVisible(hidden_state && !retrotor); ui.hiddenaddr_label->setVisible(hidden_state && !tor_auto);
ui.hiddenport_label->setVisible(hidden_state && !retrotor); ui.hiddenport_label->setVisible(hidden_state && !tor_auto);
ui.hiddenport_spinBox->setVisible(hidden_state && !retrotor); ui.hiddenport_spinBox->setVisible(hidden_state && !tor_auto);
ui.cbUseBob->setVisible(hidden_state && !retrotor); ui.cbUseBob->setVisible(hidden_state && !tor_auto);
if(!mAllFieldsOk) if(!mAllFieldsOk)
{ {

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>569</width> <width>978</width>
<height>426</height> <height>826</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -50,10 +50,7 @@
<property name="frameShadow"> <property name="frameShadow">
<enum>QFrame::Raised</enum> <enum>QFrame::Raised</enum>
</property> </property>
<layout class="QVBoxLayout" name="profileframeVLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<property name="leftMargin">
<number>9</number>
</property>
<item> <item>
<widget class="QLabel" name="RSLabel"> <widget class="QLabel" name="RSLabel">
<property name="text"> <property name="text">
@ -71,7 +68,32 @@
</widget> </widget>
</item> </item>
<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> <item>
<spacer name="toolBarHSpacer"> <spacer name="toolBarHSpacer">
<property name="orientation"> <property name="orientation">
@ -110,6 +132,19 @@
</item> </item>
</layout> </layout>
</item> </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> <item>
<widget class="QGroupBox" name="profile_groupBox"> <widget class="QGroupBox" name="profile_groupBox">
<property name="styleSheet"> <property name="styleSheet">
@ -233,26 +268,6 @@
</property> </property>
</widget> </widget>
</item> </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"> <item row="5" column="2">
<widget class="QLineEdit" name="node_input"> <widget class="QLineEdit" name="node_input">
<property name="sizePolicy"> <property name="sizePolicy">
@ -675,28 +690,6 @@
</property> </property>
</widget> </widget>
</item> </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> </layout>
</item> </item>
<item row="0" column="0"> <item row="0" column="0">