diff --git a/retroshare-gui/src/gui/HomePage.cpp b/retroshare-gui/src/gui/HomePage.cpp index 385e6c075..0cfacb041 100644 --- a/retroshare-gui/src/gui/HomePage.cpp +++ b/retroshare-gui/src/gui/HomePage.cpp @@ -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())); @@ -66,9 +67,24 @@ 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)")); + } + +} diff --git a/retroshare-gui/src/gui/HomePage.h b/retroshare-gui/src/gui/HomePage.h index 58a7c65b9..8345d0715 100644 --- a/retroshare-gui/src/gui/HomePage.h +++ b/retroshare-gui/src/gui/HomePage.h @@ -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; diff --git a/retroshare-gui/src/gui/HomePage.ui b/retroshare-gui/src/gui/HomePage.ui index fea881a6f..3e303b4e9 100644 --- a/retroshare-gui/src/gui/HomePage.ui +++ b/retroshare-gui/src/gui/HomePage.ui @@ -6,14 +6,121 @@ 0 0 - 1334 - 867 + 800 + 600 Form + + + + + + + + + + + 11 + + + + + + + Did you receive a Retroshare id from a friend? + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Add friend + + + + :/icons/png/invite.png:/icons/png/invite.png + + + + 24 + 24 + + + + Qt::ToolButtonTextBesideIcon + + + false + + + + + + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + 11 + + + + Do you need help with Retroshare? + + + + + + + Open Web Help + + + + :/icons/settings/webinterface.svg:/icons/settings/webinterface.svg + + + + 24 + 24 + + + + Qt::ToolButtonTextBesideIcon + + + + + + @@ -33,7 +140,24 @@ - + + + + + 12 + + + + Open Source cross-platform, +private and secure decentralized communication platform. + + + + Qt::AlignCenter + + + + 9 @@ -44,27 +168,6 @@ 2 - - - - - 0 - 0 - - - - - 11 - - - - The text below is your own Retroshare certificate. Send it to your friends - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - @@ -77,10 +180,71 @@ true + + true + - + + + + + 0 + 0 + + + + Qt::NoFocus + + + <html><head/><body><p>Share your RetroShare ID</p></body></html> + + + + :/icons/svg/share.svg:/icons/svg/share.svg + + + + 24 + 24 + + + + QToolButton::InstantPopup + + + true + + + + + + + + 10 + 75 + true + + + + Qt::DefaultContextMenu + + + + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + 0 + 0 + + Courier New @@ -109,23 +273,38 @@ - - + + - + 0 0 - - Qt::NoFocus + + + 11 + + + This is your Retroshare ID. Copy and share with your friends! + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + - Share your RetroShare Key + Show full certificate (old format) + + + ... - :/icons/svg/share.svg:/icons/svg/share.svg + :/icons/png/cert.png:/icons/png/cert.png @@ -133,8 +312,8 @@ 24 - - QToolButton::InstantPopup + + true true @@ -143,165 +322,20 @@ - - - - - 12 - - - - Open Source cross-platform, -private and secure decentralized communication platform. - - - - Qt::AlignCenter - - - - - - + + + Qt::Vertical - - QFrame::StyledPanel + + + 20 + 40 + - - QFrame::Raised - - - - - - - 11 - - - - Do you need help with RetroShare? - - - - - - - Open Web Help - - - - :/icons/settings/webinterface.svg:/icons/settings/webinterface.svg - - - - 24 - 24 - - - - Qt::ToolButtonTextBesideIcon - - - - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - - - - - - - - 11 - - - - - - - Did you receive a certificate from a friend? - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Add friends certificate - - - - :/icons/png/invite.png:/icons/png/invite.png - - - - 24 - 24 - - - - Qt::ToolButtonTextBesideIcon - - - false - - - - - - - - - - QFrame::StyledPanel - - - QFrame::Raised - - + - label - addFrame - label_2 - addframe - frame - helpframe diff --git a/retroshare-gui/src/gui/connect/ConnectFriendWizard.ui b/retroshare-gui/src/gui/connect/ConnectFriendWizard.ui index 8aadc22db..1c097627e 100644 --- a/retroshare-gui/src/gui/connect/ConnectFriendWizard.ui +++ b/retroshare-gui/src/gui/connect/ConnectFriendWizard.ui @@ -6,8 +6,8 @@ 0 0 - 1139 - 1171 + 600 + 500 @@ -19,10 +19,10 @@ - RetroShare certificate + RetroShare ID - Please paste below your friend's Retroshare certificate + Please paste below your friend's Retroshare ID ConnectFriendWizard::Page_Text @@ -207,7 +207,7 @@ - The text below is your Retroshare certificate. You have to provide it to your friend + The text below is your Retroshare ID. You have to provide it to your friend @@ -229,10 +229,10 @@ Qt::NoFocus - Paste Cert of your friend from Clipboard + Paste ID of your friend from Clipboard - Paste certificate + Paste @@ -267,7 +267,7 @@ Open Cert of your friend from File - Open certificate + Open @@ -314,7 +314,7 @@ QPlainTextEdit::NoWrap - Please, paste your friend's Retroshare certificate into the box below + Please, paste your friend's Retroshare ID into the box below diff --git a/retroshare-gui/src/gui/icons.qrc b/retroshare-gui/src/gui/icons.qrc index a1bdb46a5..d510544a8 100644 --- a/retroshare-gui/src/gui/icons.qrc +++ b/retroshare-gui/src/gui/icons.qrc @@ -71,6 +71,7 @@ icons/png/add.png icons/png/attach-image.png icons/png/attach.png + icons/png/cert.png icons/png/channels-notify.png icons/png/channels.png icons/png/chat-bubble-notify.png diff --git a/retroshare-gui/src/gui/icons/png/cert.png b/retroshare-gui/src/gui/icons/png/cert.png new file mode 100644 index 000000000..39c9cb6bb Binary files /dev/null and b/retroshare-gui/src/gui/icons/png/cert.png differ diff --git a/retroshare-gui/src/gui/qss/stylesheet/Standard.qss b/retroshare-gui/src/gui/qss/stylesheet/Standard.qss index f1420a0a3..52df70d2f 100644 --- a/retroshare-gui/src/gui/qss/stylesheet/Standard.qss +++ b/retroshare-gui/src/gui/qss/stylesheet/Standard.qss @@ -740,9 +740,8 @@ ConnectFriendWizard QPlainTextEdit#friendCertEdit { } HomePage QPlainTextEdit#userCertEdit { - border: 2px solid #0099cc; - border-radius: 6px; - background: white; + + background: transparent; } HomePage QFrame#addframe{