mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-27 07:47:03 -05:00
Merge pull request #1346 from csoler/v0.6-ImprovedGUI
V0.6 improved gui
This commit is contained in:
commit
1e32c1db00
@ -22,9 +22,12 @@
|
||||
#include "HomePage.h"
|
||||
#include "ui_HomePage.h"
|
||||
|
||||
#include "retroshare/rsinit.h"
|
||||
|
||||
#include "gui/notifyqt.h"
|
||||
#include "gui/msgs/MessageComposer.h"
|
||||
#include "gui/connect/ConnectFriendWizard.h"
|
||||
#include "gui/connect/ConfCertDialog.h"
|
||||
#include <gui/QuickStartWizard.h>
|
||||
#include "gui/connect/FriendRecommendDialog.h"
|
||||
|
||||
@ -54,36 +57,32 @@ HomePage::HomePage(QWidget *parent) :
|
||||
connect(ui->addButton, SIGNAL(clicked()), this, SLOT(addFriend()));
|
||||
connect(ui->LoadCertFileButton, SIGNAL(clicked()), this, SLOT(loadCert()));
|
||||
|
||||
QAction *CopyAction = new QAction(QIcon(),tr("Copy your Cert to Clipboard"), this);
|
||||
connect(CopyAction, SIGNAL(triggered()), this, SLOT(copyCert()));
|
||||
|
||||
QAction *SaveAction = new QAction(QIcon(),tr("Save your Cert into a File"), this);
|
||||
connect(SaveAction, SIGNAL(triggered()), this, SLOT(saveCert()));
|
||||
|
||||
QAction *SendAction = new QAction(QIcon(),tr("Send via Email"), this);
|
||||
connect(SendAction, SIGNAL(triggered()), this, SLOT(runEmailClient()));
|
||||
|
||||
QAction *WebMailAction = new QAction(QIcon(),tr("Invite via WebMail"), this);
|
||||
connect(WebMailAction, SIGNAL(triggered()), this, SLOT(webMail()));
|
||||
|
||||
QAction *RecAction = new QAction(QIcon(),tr("Recommend friends to each others"), this);
|
||||
connect(RecAction, SIGNAL(triggered()), this, SLOT(recommendFriends()));
|
||||
|
||||
QAction *SendAction = new QAction(QIcon(),tr("Send via Email"), this);
|
||||
connect(SendAction, SIGNAL(triggered()), this, SLOT(runEmailClient()));
|
||||
|
||||
QMenu *menu = new QMenu();
|
||||
menu->addAction(CopyAction);
|
||||
menu->addAction(SaveAction);
|
||||
menu->addAction(SendAction);
|
||||
menu->addAction(WebMailAction);
|
||||
menu->addAction(RecAction);
|
||||
|
||||
ui->shareButton->setMenu(menu);
|
||||
|
||||
QObject::connect(ui->userCertEdit,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(certContextMenu(QPoint)));
|
||||
|
||||
connect(ui->runStartWizard_PB,SIGNAL(clicked()), this,SLOT(runStartWizard())) ;
|
||||
connect(ui->openwebhelp,SIGNAL(clicked()), this,SLOT(openWebHelp())) ;
|
||||
|
||||
ui->runStartWizard_PB->hide(); // until future rework
|
||||
ui->LoadCertFileButton->hide(); // duplicates functionality => not good.
|
||||
|
||||
mIncludeAllIPs = false;
|
||||
|
||||
int S = QFontMetricsF(font()).height();
|
||||
QString help_str = tr(
|
||||
" <h1><img width=\"%1\" src=\":/icons/help_64.png\"> Welcome to Retroshare!</h1>\
|
||||
@ -99,6 +98,37 @@ HomePage::HomePage(QWidget *parent) :
|
||||
registerHelpButton(ui->helpButton,help_str,"HomePage") ;
|
||||
}
|
||||
|
||||
void HomePage::certContextMenu(QPoint point)
|
||||
{
|
||||
QMenu menu(this) ;
|
||||
|
||||
QAction *CopyAction = new QAction(QIcon(),tr("Copy your Cert to Clipboard"), this);
|
||||
connect(CopyAction, SIGNAL(triggered()), this, SLOT(copyCert()));
|
||||
|
||||
QAction *SaveAction = new QAction(QIcon(),tr("Save your Cert into a File"), this);
|
||||
connect(SaveAction, SIGNAL(triggered()), this, SLOT(saveCert()));
|
||||
|
||||
menu.addAction(CopyAction);
|
||||
menu.addAction(SaveAction);
|
||||
|
||||
if(!RsAccounts::isHiddenNode())
|
||||
{
|
||||
QAction *includeIPsAct = new QAction(QIcon(), mIncludeAllIPs? tr("Include only current IP"):tr("Include all your known IPs"),this);
|
||||
connect(includeIPsAct, SIGNAL(triggered()), this, SLOT(toggleIncludeAllIPs()));
|
||||
includeIPsAct->setCheckable(true);
|
||||
|
||||
menu.addAction(includeIPsAct);
|
||||
}
|
||||
|
||||
menu.exec(QCursor::pos());
|
||||
}
|
||||
|
||||
void HomePage::toggleIncludeAllIPs()
|
||||
{
|
||||
mIncludeAllIPs = !mIncludeAllIPs;
|
||||
updateOwnCert();
|
||||
}
|
||||
|
||||
HomePage::~HomePage()
|
||||
{
|
||||
delete ui;
|
||||
@ -106,9 +136,23 @@ HomePage::~HomePage()
|
||||
|
||||
void HomePage::updateOwnCert()
|
||||
{
|
||||
std::string invite = rsPeers->GetRetroshareInvite(false);
|
||||
bool include_extra_locators = mIncludeAllIPs;
|
||||
|
||||
RsPeerDetails detail;
|
||||
|
||||
if (!rsPeers->getPeerDetails(rsPeers->getOwnId(), detail))
|
||||
{
|
||||
std::cerr << "(EE) Cannot retrieve information about own certificate. That is a real problem!!" << std::endl;
|
||||
return ;
|
||||
}
|
||||
|
||||
std::string invite = rsPeers->GetRetroshareInvite(detail.id,false,include_extra_locators);
|
||||
|
||||
ui->userCertEdit->setPlainText(QString::fromUtf8(invite.c_str()));
|
||||
|
||||
QString description = ConfCertDialog::getCertificateDescription(detail,false,include_extra_locators);
|
||||
|
||||
ui->userCertEdit->setToolTip(description);
|
||||
}
|
||||
|
||||
static void sendMail(QString sAddress, QString sSubject, QString sBody)
|
||||
|
@ -48,6 +48,7 @@ public:
|
||||
virtual QString helpText() const { return ""; } //MainPage
|
||||
|
||||
private slots:
|
||||
void certContextMenu(QPoint);
|
||||
void updateOwnCert();
|
||||
void runEmailClient();
|
||||
void copyCert();
|
||||
@ -58,10 +59,12 @@ private slots:
|
||||
void runStartWizard() ;
|
||||
void openWebHelp() ;
|
||||
void recommendFriends();
|
||||
void toggleIncludeAllIPs();
|
||||
|
||||
private:
|
||||
Ui::HomePage *ui;
|
||||
|
||||
bool mIncludeAllIPs;
|
||||
|
||||
};
|
||||
|
||||
|
@ -25,6 +25,41 @@
|
||||
<property name="verticalSpacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="userCertLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>The text below is your own Retroshare certificate. Send it to your friends</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QToolButton" name="helpButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="icons.qrc">
|
||||
<normaloff>:/icons/help_64.png</normaloff>:/icons/help_64.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="4">
|
||||
<widget class="QPlainTextEdit" name="userCertEdit">
|
||||
<property name="font">
|
||||
@ -32,6 +67,9 @@
|
||||
<family>Courier New</family>
|
||||
</font>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string/>
|
||||
</property>
|
||||
@ -84,41 +122,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QToolButton" name="helpButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="icons.qrc">
|
||||
<normaloff>:/icons/help_64.png</normaloff>:/icons/help_64.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="userCertLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>The text below is your own Retroshare certificate. Send it to your friends</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2">
|
||||
|
@ -270,34 +270,9 @@ void ConfCertDialog::loadInvitePage()
|
||||
// ui.userCertificateText_2->setFont(font);
|
||||
// ui.userCertificateText_2->setText(QString::fromUtf8(pgp_key.c_str()));
|
||||
|
||||
std::string invite = rsPeers->GetRetroshareInvite(detail.id,ui._shouldAddSignatures_CB->isChecked()) ; // this needs to be a SSL id
|
||||
std::string invite = rsPeers->GetRetroshareInvite(detail.id,ui._shouldAddSignatures_CB->isChecked()) ; // this needs to be a SSL id
|
||||
|
||||
QString infotext ;
|
||||
|
||||
//infotext += tr("<p>Use this certificate to make new friends. Send it by email, or give it hand to hand.</p>") ;
|
||||
infotext += tr("<p>This certificate contains:") ;
|
||||
infotext += "<UL>" ;
|
||||
infotext += "<li> a <b>Profile key</b>";
|
||||
infotext += " (" + QString::fromUtf8(detail.name.c_str()) + "@" + detail.gpg_id.toStdString().c_str()+") " ;
|
||||
if(ui._shouldAddSignatures_CB->isChecked())
|
||||
infotext += tr("with")+" "+QString::number(detail.gpgSigners.size()-1)+" "+tr("external signatures</li>") ;
|
||||
else
|
||||
infotext += "</li>" ;
|
||||
|
||||
infotext += tr("<li>a <b>node ID</b> and <b>name</b>") +" (" + detail.id.toStdString().c_str() + ", " + QString::fromUtf8(detail.location.c_str()) +")" ;
|
||||
infotext += "</li>" ;
|
||||
|
||||
infotext += "<li>" ;
|
||||
if(detail.isHiddenNode)
|
||||
infotext += tr("an <b>onion address</b> and <b>port</b>") +" (" + detail.hiddenNodeAddress.c_str() + ":" + QString::number(detail.hiddenNodePort)+ ")";
|
||||
else
|
||||
infotext += tr("an <b>IP address</b> and <b>port</b>") +" (" + detail.connectAddr.c_str() + ":" + QString::number(detail.connectPort)+ ")";
|
||||
infotext += "</li>" ;
|
||||
|
||||
infotext += QString("</p>") ;
|
||||
|
||||
if(rsPeers->getOwnId() == detail.id)
|
||||
infotext += tr("<p>You can use this certificate to make new friends. Send it by email, or give it hand to hand.</p>") ;
|
||||
QString infotext = getCertificateDescription(detail,ui._shouldAddSignatures_CB->isChecked(),true); // true, because default parameter in GetRetroshareInvite is true
|
||||
|
||||
ui.userCertificateText->setToolTip(infotext) ;
|
||||
|
||||
@ -311,6 +286,44 @@ void ConfCertDialog::loadInvitePage()
|
||||
ui.userCertificateText->setText(QString::fromUtf8(invite.c_str()));
|
||||
}
|
||||
|
||||
QString ConfCertDialog::getCertificateDescription(const RsPeerDetails& detail,bool signatures_included,bool include_additional_locators)
|
||||
{
|
||||
//infotext += tr("<p>Use this certificate to make new friends. Send it by email, or give it hand to hand.</p>") ;
|
||||
QString infotext = QObject::tr("<p>This certificate contains:") ;
|
||||
infotext += "<UL>" ;
|
||||
infotext += "<li> a <b>Profile key</b>";
|
||||
infotext += " (" + QString::fromUtf8(detail.name.c_str()) + "@" + detail.gpg_id.toStdString().c_str()+") " ;
|
||||
|
||||
if(signatures_included)
|
||||
infotext += tr("with")+" "+QString::number(detail.gpgSigners.size()-1)+" "+tr("external signatures</li>") ;
|
||||
else
|
||||
infotext += "</li>" ;
|
||||
|
||||
infotext += tr("<li>a <b>node ID</b> and <b>name</b>") +" (" + detail.id.toStdString().c_str() + ", " + QString::fromUtf8(detail.location.c_str()) +")" ;
|
||||
infotext += "</li>" ;
|
||||
|
||||
if(detail.isHiddenNode)
|
||||
infotext += tr("<li> <b>onion address</b> and <b>port</b>") +" (" + detail.hiddenNodeAddress.c_str() + ":" + QString::number(detail.hiddenNodePort)+ ")</li>";
|
||||
else if(!include_additional_locators)
|
||||
{
|
||||
if(!detail.localAddr.empty()) infotext += tr("<li><b>IP address</b> and <b>port</b>: ") + detail.localAddr.c_str() + ":" + QString::number(detail.localPort)+ "</li>";
|
||||
if(!detail.extAddr.empty()) infotext += tr("<li><b>IP address</b> and <b>port</b>: ") + detail.extAddr.c_str() + ":" + QString::number(detail.extPort)+ "</li>";
|
||||
}
|
||||
else for(auto it(detail.ipAddressList.begin());it!=detail.ipAddressList.end();++it)
|
||||
{
|
||||
infotext += "<li>" ;
|
||||
infotext += tr("<b>IP address</b> and <b>port</b>: ") + QString::fromStdString(*it) ;
|
||||
infotext += "</li>" ;
|
||||
}
|
||||
|
||||
infotext += QString("</p>") ;
|
||||
|
||||
if(rsPeers->getOwnId() == detail.id)
|
||||
infotext += tr("<p>You can use this certificate to make new friends. Send it by email, or give it hand to hand.</p>") ;
|
||||
|
||||
return infotext;
|
||||
}
|
||||
|
||||
|
||||
void ConfCertDialog::applyDialog()
|
||||
{
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
#include "ui_ConfCertDialog.h"
|
||||
#include <retroshare/rstypes.h>
|
||||
#include <retroshare/rspeers.h>
|
||||
|
||||
class ConfCertDialog : public QDialog
|
||||
{
|
||||
@ -59,6 +60,7 @@ public:
|
||||
/* window will destroy itself! */
|
||||
}
|
||||
static void loadAll();
|
||||
static QString getCertificateDescription(const RsPeerDetails& det,bool signatures_included,bool extra_locators_included);
|
||||
|
||||
signals:
|
||||
void configChanged();
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>760</width>
|
||||
<height>538</height>
|
||||
<width>1157</width>
|
||||
<height>873</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -1618,8 +1618,8 @@ resources.</string>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../images.qrc"/>
|
||||
<include location="../icons.qrc"/>
|
||||
<include location="../images.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
@ -26,7 +26,7 @@
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tabNetConf">
|
||||
<attribute name="title">
|
||||
|
Loading…
x
Reference in New Issue
Block a user