Merge pull request #1648 from defnax/home-view-changes-for-short-invites

Home view changes for short invites
This commit is contained in:
defnax 2019-09-30 19:58:50 +02:00 committed by GitHub
commit 99caf1f07f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 300 additions and 205 deletions

View File

@ -49,14 +49,15 @@ HomePage::HomePage(QWidget *parent) :
MainPage(parent),
ui(new Ui::HomePage),
mIncludeAllIPs(false),
mUseShortFormat(true)
mUseShortFormat(false)
{
ui->setupUi(this);
updateOwnCert();
updateOwnId();
connect(ui->addButton, SIGNAL(clicked()), this, SLOT(addFriend()));
//connect(ui->LoadCertFileButton, SIGNAL(clicked()), this, SLOT(loadCert()));
connect(ui->expandButton, SIGNAL(clicked()), this, SLOT(doExpand()));
QAction *WebMailAction = new QAction(QIcon(),tr("Invite via WebMail"), this);
connect(WebMailAction, SIGNAL(triggered()), this, SLOT(webMail()));
@ -67,8 +68,23 @@ HomePage::HomePage(QWidget *parent) :
QAction *SendAction = new QAction(QIcon(),tr("Send via Email"), this);
connect(SendAction, SIGNAL(triggered()), this, SLOT(runEmailClient()));
QAction *CopyIdAction = new QAction(QIcon(),tr("Copy your Retroshare ID to Clipboard"), this);
connect(CopyIdAction, SIGNAL(triggered()), this, SLOT(copyId()));
QMenu *menu = new QMenu();
menu->addAction(SendAction);
menu->addAction(CopyIdAction);
if(!RsAccounts::isHiddenNode())
{
QAction *includeIPsAct = new QAction(QIcon(), tr("Include all your known IPs"),this);
connect(includeIPsAct, SIGNAL(triggered()), this, SLOT(toggleIncludeAllIPs()));
includeIPsAct->setCheckable(true);
includeIPsAct->setChecked(mIncludeAllIPs);
menu->addAction(includeIPsAct);
}
menu->addSeparator();
menu->addAction(SendAction);
menu->addAction(WebMailAction);
menu->addAction(RecAction);
@ -78,7 +94,7 @@ HomePage::HomePage(QWidget *parent) :
connect(ui->openwebhelp,SIGNAL(clicked()), this,SLOT(openWebHelp())) ;
//ui->LoadCertFileButton->hide(); // duplicates functionality => not good.
ui->userCertEdit->hide();
int S = QFontMetricsF(font()).height();
QString help_str = tr(
@ -137,6 +153,7 @@ void HomePage::toggleIncludeAllIPs()
{
mIncludeAllIPs = !mIncludeAllIPs;
updateOwnCert();
updateOwnId();
}
HomePage::~HomePage()
@ -170,6 +187,24 @@ void HomePage::updateOwnCert()
ui->userCertEdit->setToolTip(description);
}
void HomePage::updateOwnId()
{
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->getShortInvite(invite,rsPeers->getOwnId(),true,!mIncludeAllIPs);
ui->retroshareid->setText(QString::fromUtf8(invite.c_str()));
}
static void sendMail(QString sAddress, QString sSubject, QString sBody)
{
#ifdef Q_OS_WIN
@ -212,7 +247,14 @@ void HomePage::copyCert()
{
QClipboard *clipboard = QApplication::clipboard();
clipboard->setText(ui->userCertEdit->toPlainText());
QMessageBox::information(this, "RetroShare", tr("Your Cert is copied to Clipboard, paste and send it to your friend via email or some other way"));
QMessageBox::information(this, "RetroShare", tr("Your Retroshare certificate is copied to Clipboard, paste and send it to your friend via email or some other way"));
}
void HomePage::copyId()
{
QClipboard *clipboard = QApplication::clipboard();
clipboard->setText(ui->retroshareid->text());
QMessageBox::information(this, "RetroShare", tr("Your Retroshare ID is copied to Clipboard, paste and send it to your friend via email or some other way"));
}
void HomePage::saveCert()
@ -261,3 +303,19 @@ void HomePage::openWebHelp()
{
QDesktopServices::openUrl(QUrl(QString("https://retroshare.readthedocs.io")));
}
void HomePage::doExpand()
{
if (ui->expandButton->isChecked())
{
ui->userCertEdit->show();
ui->expandButton->setToolTip(tr("Hide"));
}
else
{
ui->userCertEdit->hide();
ui->expandButton->setToolTip(tr("Show full certificate (old format)"));
}
}

View File

@ -49,8 +49,10 @@ public:
private slots:
void certContextMenu(QPoint);
void updateOwnCert();
void updateOwnId();
void runEmailClient();
void copyCert();
void copyId();
void saveCert();
void addFriend();
void webMail();
@ -59,6 +61,7 @@ private slots:
void recommendFriends();
void toggleIncludeAllIPs();
void toggleUseShortFormat();
void doExpand();
private:
Ui::HomePage *ui;

View File

@ -6,14 +6,121 @@
<rect>
<x>0</x>
<y>0</y>
<width>1334</width>
<height>867</height>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="3" column="1" colspan="2">
<widget class="QFrame" name="addframe">
<property name="styleSheet">
<string notr="true"/>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<pointsize>11</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>Did you receive a Retroshare id from a friend?</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<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>
<widget class="QToolButton" name="addButton">
<property name="text">
<string>Add friend</string>
</property>
<property name="icon">
<iconset resource="icons.qrc">
<normaloff>:/icons/png/invite.png</normaloff>:/icons/png/invite.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
<property name="autoRaise">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="4" column="1" colspan="2">
<widget class="QFrame" name="helpframe">
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_4">
<property name="font">
<font>
<pointsize>11</pointsize>
</font>
</property>
<property name="text">
<string>Do you need help with Retroshare?</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="openwebhelp">
<property name="text">
<string>Open Web Help</string>
</property>
<property name="icon">
<iconset resource="icons.qrc">
<normaloff>:/icons/settings/webinterface.svg</normaloff>:/icons/settings/webinterface.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="0" colspan="4">
<widget class="QLabel" name="label">
<property name="sizePolicy">
@ -33,7 +140,24 @@
</property>
</widget>
</item>
<item row="4" column="1" colspan="2">
<item row="1" column="1" colspan="2">
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>Open Source cross-platform,
private and secure decentralized communication platform.
</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<layout class="QGridLayout" name="gridLayout">
<property name="topMargin">
<number>9</number>
@ -44,27 +168,6 @@
<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">
@ -77,10 +180,71 @@
<property name="checkable">
<bool>true</bool>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0" colspan="4">
<item row="1" column="4">
<widget class="QToolButton" name="shareButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Share your RetroShare ID&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="icon">
<iconset resource="icons.qrc">
<normaloff>:/icons/svg/share.svg</normaloff>:/icons/svg/share.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="popupMode">
<enum>QToolButton::InstantPopup</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="retroshareid">
<property name="font">
<font>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="contextMenuPolicy">
<enum>Qt::DefaultContextMenu</enum>
</property>
<property name="text">
<string/>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="3" column="0" colspan="5">
<widget class="QPlainTextEdit" name="userCertEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>Courier New</family>
@ -109,23 +273,38 @@
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QToolButton" name="shareButton">
<item row="0" column="2">
<widget class="QLabel" name="userCertLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
<property name="font">
<font>
<pointsize>11</pointsize>
</font>
</property>
<property name="text">
<string>This is your Retroshare ID. Copy and share with your friends!</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QToolButton" name="expandButton">
<property name="toolTip">
<string>Share your RetroShare Key</string>
<string>Show full certificate (old format)</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="icons.qrc">
<normaloff>:/icons/svg/share.svg</normaloff>:/icons/svg/share.svg</iconset>
<normaloff>:/icons/png/cert.png</normaloff>:/icons/png/cert.png</iconset>
</property>
<property name="iconSize">
<size>
@ -133,8 +312,8 @@
<height>24</height>
</size>
</property>
<property name="popupMode">
<enum>QToolButton::InstantPopup</enum>
<property name="checkable">
<bool>true</bool>
</property>
<property name="autoRaise">
<bool>true</bool>
@ -143,165 +322,20 @@
</item>
</layout>
</item>
<item row="1" column="1" colspan="2">
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>Open Source cross-platform,
private and secure decentralized communication platform.
</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="5" column="1" colspan="2">
<widget class="QFrame" name="helpframe">
<property name="styleSheet">
<string notr="true"/>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_4">
<property name="font">
<font>
<pointsize>11</pointsize>
</font>
</property>
<property name="text">
<string>Do you need help with RetroShare?</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="openwebhelp">
<property name="text">
<string>Open Web Help</string>
</property>
<property name="icon">
<iconset resource="icons.qrc">
<normaloff>:/icons/settings/webinterface.svg</normaloff>:/icons/settings/webinterface.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="6" column="1">
<widget class="QFrame" name="addFrame">
<layout class="QGridLayout" name="gridLayout_3">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
</layout>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QFrame" name="addframe">
<property name="styleSheet">
<string notr="true"/>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<pointsize>11</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>Did you receive a certificate from a friend?</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<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>
<widget class="QToolButton" name="addButton">
<property name="text">
<string>Add friends certificate</string>
</property>
<property name="icon">
<iconset resource="icons.qrc">
<normaloff>:/icons/png/invite.png</normaloff>:/icons/png/invite.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
<property name="autoRaise">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
</spacer>
</item>
</layout>
<zorder>label</zorder>
<zorder>addFrame</zorder>
<zorder>label_2</zorder>
<zorder>addframe</zorder>
<zorder>frame</zorder>
<zorder>helpframe</zorder>
</widget>
<resources>
<include location="images.qrc"/>

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>1139</width>
<height>1171</height>
<width>600</width>
<height>500</height>
</rect>
</property>
<property name="windowTitle">
@ -19,10 +19,10 @@
</property>
<widget class="ConnectFriendPage" name="TextPage">
<property name="title">
<string>RetroShare certificate</string>
<string>RetroShare ID</string>
</property>
<property name="subTitle">
<string>Please paste below your friend's Retroshare certificate</string>
<string>Please paste below your friend's Retroshare ID</string>
</property>
<attribute name="pageId">
<string notr="true">ConnectFriendWizard::Page_Text</string>
@ -207,7 +207,7 @@
<item row="0" column="0">
<widget class="QLabel" name="userCertLabel">
<property name="text">
<string>The text below is your Retroshare certificate. You have to provide it to your friend</string>
<string>The text below is your Retroshare ID. You have to provide it to your friend</string>
</property>
</widget>
</item>
@ -229,10 +229,10 @@
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Paste Cert of your friend from Clipboard</string>
<string>Paste ID of your friend from Clipboard</string>
</property>
<property name="text">
<string>Paste certificate</string>
<string>Paste</string>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
@ -267,7 +267,7 @@
<string>Open Cert of your friend from File</string>
</property>
<property name="text">
<string>Open certificate</string>
<string>Open</string>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
@ -314,7 +314,7 @@
<enum>QPlainTextEdit::NoWrap</enum>
</property>
<property name="placeholderText">
<string>Please, paste your friend's Retroshare certificate into the box below</string>
<string>Please, paste your friend's Retroshare ID into the box below</string>
</property>
</widget>
</item>

View File

@ -71,6 +71,7 @@
<file>icons/png/add.png</file>
<file>icons/png/attach-image.png</file>
<file>icons/png/attach.png</file>
<file>icons/png/cert.png</file>
<file>icons/png/channels-notify.png</file>
<file>icons/png/channels.png</file>
<file>icons/png/chat-bubble-notify.png</file>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

@ -740,9 +740,8 @@ ConnectFriendWizard QPlainTextEdit#friendCertEdit {
}
HomePage QPlainTextEdit#userCertEdit {
border: 2px solid #0099cc;
border-radius: 6px;
background: white;
background: transparent;
}
HomePage QFrame#addframe{