Merge pull request #802 from csoler/v0.6-ImprovedGUI

moved passphrase box into start dialog, and removed blank logo, repla…
This commit is contained in:
csoler 2017-05-08 10:57:00 +02:00 committed by GitHub
commit 9714409309
3 changed files with 48 additions and 148 deletions

View File

@ -19,11 +19,13 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
****************************************************************/ ****************************************************************/
#include <rshare.h> #include <QMessageBox>
#include <retroshare/rsinit.h>
#include "rshare.h"
#include "retroshare/rsinit.h"
#include "StartDialog.h" #include "StartDialog.h"
#include "LogoBar.h" #include "LogoBar.h"
#include <QMessageBox> #include "retroshare/rsnotify.h"
#include "settings/rsharesettings.h" #include "settings/rsharesettings.h"
#include <iostream> #include <iostream>
@ -43,10 +45,6 @@ StartDialog::StartDialog(QWidget *parent)
Settings->loadWidgetInformation(this); Settings->loadWidgetInformation(this);
ui.loadButton->setFocus();
connect(ui.loadButton, SIGNAL(clicked()), this, SLOT(loadPerson()));
/* get all available pgp private certificates.... /* get all available pgp private certificates....
* mark last one as default. * mark last one as default.
*/ */
@ -75,12 +73,21 @@ StartDialog::StartDialog(QWidget *parent)
} }
} }
QObject::connect(ui.loadName,SIGNAL(currentIndexChanged(int)),this,SLOT(updateSelectedProfile(int))) ;
QObject::connect(ui.password_input,SIGNAL(returnPressed()),this,SLOT(loadPerson())) ;
if (pidx > 0) if (pidx > 0)
{ {
ui.loadName->setCurrentIndex(pidx); ui.loadName->setCurrentIndex(pidx);
} }
} }
void StartDialog::updateSelectedProfile(int)
{
ui.password_input->clear();
ui.password_input->setFocus();
}
void StartDialog::closeEvent (QCloseEvent * event) void StartDialog::closeEvent (QCloseEvent * event)
{ {
Settings->saveWidgetInformation(this); Settings->saveWidgetInformation(this);
@ -101,18 +108,22 @@ void StartDialog::loadPerson()
QVariant data = ui.loadName->itemData(pgpidx); QVariant data = ui.loadName->itemData(pgpidx);
RsPeerId accountId = RsPeerId((data.toString()).toStdString()); RsPeerId accountId = RsPeerId((data.toString()).toStdString());
if (Rshare::loadCertificate(accountId, ui.autologin_checkbox->isChecked())) { // Cache the passphrase, so that it is not asked again.
rsNotify->cachePgpPassphrase(ui.password_input->text().toUtf8().constData()) ;
bool res = Rshare::loadCertificate(accountId, ui.autologin_checkbox->isChecked()) ;
rsNotify->clearPgpPassphrase();
if(res)
accept(); accept();
}
} }
void StartDialog::on_labelProfile_linkActivated(QString /*link*/) void StartDialog::on_labelProfile_linkActivated(QString /*link*/)
{ {
// if ((QMessageBox::question(this, tr("Create a New Profile"),tr("This will generate a new Profile\n Are you sure you want to continue?"),QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes))== QMessageBox::Yes)
// {
reqNewCert = true; reqNewCert = true;
accept(); accept();
// }
} }
bool StartDialog::requestedNewCert() bool StartDialog::requestedNewCert()

View File

@ -39,6 +39,7 @@ protected:
private slots: private slots:
void loadPerson(); void loadPerson();
void updateSelectedProfile(int);
#ifdef RS_AUTOLOGIN #ifdef RS_AUTOLOGIN
/** /**

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>430</width> <width>656</width>
<height>552</height> <height>645</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -42,76 +42,6 @@
<number>0</number> <number>0</number>
</property> </property>
<item row="0" column="0" colspan="4"> <item row="0" column="0" colspan="4">
<layout class="QGridLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="0">
<spacer>
<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 row="0" column="1">
<widget class="QToolButton" name="toolButton">
<property name="styleSheet">
<string notr="true">QToolButton {
border-image: url(:/images/avatar_background.png);
}</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/user/personal64.png</normaloff>:/images/user/personal64.png</iconset>
</property>
<property name="iconSize">
<size>
<width>96</width>
<height>96</height>
</size>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="2">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="0" colspan="4">
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0"> <item row="0" column="0">
<spacer name="horizontalSpacer"> <spacer name="horizontalSpacer">
@ -134,12 +64,6 @@
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>32</height>
</size>
</property>
<property name="palette"> <property name="palette">
<palette> <palette>
<active> <active>
@ -183,7 +107,10 @@
</font> </font>
</property> </property>
<property name="text"> <property name="text">
<string>Login</string> <string/>
</property>
<property name="pixmap">
<pixmap resource="images.qrc">:/images/logo/logo_splash.png</pixmap>
</property> </property>
</widget> </widget>
</item> </item>
@ -202,7 +129,7 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="3" column="1" rowspan="2" colspan="2"> <item row="2" column="1" rowspan="2" colspan="2">
<widget class="QGroupBox" name="groupBox"> <widget class="QGroupBox" name="groupBox">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
@ -220,13 +147,27 @@
<item> <item>
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label_3">
<property name="text"> <property name="text">
<string>Profile - Location</string> <string>Profile - Location:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QComboBox" name="loadName"/> <widget class="QComboBox" name="loadName"/>
</item> </item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Password:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="password_input">
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item> <item>
<widget class="QCheckBox" name="autologin_checkbox"> <widget class="QCheckBox" name="autologin_checkbox">
<property name="text"> <property name="text">
@ -240,56 +181,7 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="5" column="0" colspan="4"> <item row="4" column="1" colspan="2">
<layout class="QGridLayout" name="gridLayout_3">
<property name="topMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<item row="0" column="1">
<widget class="QPushButton" name="loadButton">
<property name="text">
<string>Log In</string>
</property>
<property name="default">
<bool>true</bool>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>61</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>71</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="6" column="1" colspan="2">
<widget class="QLabel" name="labelProfile"> <widget class="QLabel" name="labelProfile">
<property name="toolTip"> <property name="toolTip">
<string>Opens a dialog for creating a new profile or <string>Opens a dialog for creating a new profile or
@ -305,7 +197,7 @@ p, li { white-space: pre-wrap; }
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="0" colspan="4"> <item row="5" column="0" colspan="4">
<widget class="LogoBar" name="callBarFrame"> <widget class="LogoBar" name="callBarFrame">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
@ -333,10 +225,6 @@ p, li { white-space: pre-wrap; }
<container>1</container> <container>1</container>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<tabstops>
<tabstop>loadButton</tabstop>
<tabstop>toolButton</tabstop>
</tabstops>
<resources> <resources>
<include location="images.qrc"/> <include location="images.qrc"/>
</resources> </resources>