mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 23:49:35 -05:00
Merge pull request #2082 from csoler/v0.6-BugFixing_2
Attempt to improve consistency of HomePage
This commit is contained in:
commit
ea020112a2
@ -49,15 +49,14 @@ HomePage::HomePage(QWidget *parent) :
|
||||
MainPage(parent),
|
||||
ui(new Ui::HomePage),
|
||||
mIncludeAllIPs(false),
|
||||
mUseShortFormat(false)
|
||||
mUseShortFormat(false),
|
||||
mUseBackwardCompatibleCert(false)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
updateOwnCert();
|
||||
updateOwnId();
|
||||
updateCertificate();
|
||||
|
||||
connect(ui->addButton, SIGNAL(clicked()), this, SLOT(addFriend()));
|
||||
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()));
|
||||
@ -83,6 +82,13 @@ HomePage::HomePage(QWidget *parent) :
|
||||
|
||||
menu->addAction(includeIPsAct);
|
||||
}
|
||||
QAction *useOldFormatAct = new QAction(QIcon(), tr("Use old certificate format"),this);
|
||||
useOldFormatAct->setToolTip(tr("Displays the certificate format used up to version 0.6.5\nOld Retroshare nodes will not understand the\nnew short format"));
|
||||
connect(useOldFormatAct, SIGNAL(triggered()), this, SLOT(toggleUseOldFormat()));
|
||||
useOldFormatAct->setCheckable(true);
|
||||
useOldFormatAct->setChecked(mUseBackwardCompatibleCert);
|
||||
menu->addAction(useOldFormatAct);
|
||||
|
||||
menu->addSeparator();
|
||||
menu->addAction(SendAction);
|
||||
menu->addAction(WebMailAction);
|
||||
@ -147,13 +153,12 @@ void HomePage::certContextMenu(QPoint point)
|
||||
void HomePage::toggleUseShortFormat()
|
||||
{
|
||||
mUseShortFormat = !mUseShortFormat;
|
||||
updateOwnCert();
|
||||
updateCertificate();
|
||||
}
|
||||
void HomePage::toggleIncludeAllIPs()
|
||||
{
|
||||
mIncludeAllIPs = !mIncludeAllIPs;
|
||||
updateOwnCert();
|
||||
updateOwnId();
|
||||
updateCertificate();
|
||||
}
|
||||
|
||||
HomePage::~HomePage()
|
||||
@ -161,6 +166,14 @@ HomePage::~HomePage()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void HomePage::updateCertificate()
|
||||
{
|
||||
if(mUseBackwardCompatibleCert)
|
||||
updateOwnCert();
|
||||
else
|
||||
updateOwnId();
|
||||
}
|
||||
|
||||
void HomePage::updateOwnCert()
|
||||
{
|
||||
bool include_extra_locators = mIncludeAllIPs;
|
||||
@ -180,11 +193,11 @@ void HomePage::updateOwnCert()
|
||||
else
|
||||
invite = rsPeers->GetRetroshareInvite(detail.id,false,include_extra_locators);
|
||||
|
||||
ui->userCertEdit->setPlainText(QString::fromUtf8(invite.c_str()));
|
||||
ui->retroshareid->setText("\n"+QString::fromUtf8(invite.c_str())+"\n");
|
||||
|
||||
QString description = ConfCertDialog::getCertificateDescription(detail,false,mUseShortFormat,include_extra_locators);
|
||||
|
||||
ui->userCertEdit->setToolTip(description);
|
||||
ui->retroshareid->setToolTip(description);
|
||||
}
|
||||
|
||||
void HomePage::updateOwnId()
|
||||
@ -202,13 +215,12 @@ void HomePage::updateOwnId()
|
||||
|
||||
rsPeers->getShortInvite(invite,rsPeers->getOwnId(),true,!include_extra_locators);
|
||||
|
||||
#ifdef TODO
|
||||
QString S;
|
||||
QString txt;
|
||||
int i=0;
|
||||
|
||||
for(uint32_t i=0;i<invite.size();)
|
||||
if(QFontMetricsF(font()).width(S) < ui->retroshareid->width())
|
||||
if(S.length() < 100)
|
||||
S += invite[i++];
|
||||
else
|
||||
{
|
||||
@ -218,9 +230,9 @@ void HomePage::updateOwnId()
|
||||
|
||||
txt += S;
|
||||
|
||||
ui->retroshareid->setText(txt);
|
||||
#endif
|
||||
ui->retroshareid->setText(QString::fromUtf8(invite.c_str()));
|
||||
ui->retroshareid->setText("\n"+txt+"\n"); // the "\n" is here to make some space
|
||||
//#endif
|
||||
// ui->retroshareid->setText(QString::fromUtf8(invite.c_str()));
|
||||
}
|
||||
static void sendMail(QString sAddress, QString sSubject, QString sBody)
|
||||
{
|
||||
@ -257,13 +269,13 @@ void HomePage::recommendFriends()
|
||||
|
||||
void HomePage::runEmailClient()
|
||||
{
|
||||
sendMail("", tr("RetroShare Invite"), ui->userCertEdit->toPlainText());
|
||||
sendMail("", tr("RetroShare Invite"), ui->retroshareid->text());
|
||||
}
|
||||
|
||||
void HomePage::copyCert()
|
||||
{
|
||||
QClipboard *clipboard = QApplication::clipboard();
|
||||
clipboard->setText(ui->userCertEdit->toPlainText());
|
||||
clipboard->setText(ui->retroshareid->text());
|
||||
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"));
|
||||
}
|
||||
|
||||
@ -288,7 +300,7 @@ void HomePage::saveCert()
|
||||
|
||||
QTextStream ts(&file);
|
||||
ts.setCodec(QTextCodec::codecForName("UTF-8"));
|
||||
ts << ui->userCertEdit->document()->toPlainText();
|
||||
ts << ui->retroshareid->text();
|
||||
}
|
||||
|
||||
/** Add a Friends Text Certificate */
|
||||
@ -321,18 +333,20 @@ void HomePage::openWebHelp()
|
||||
QDesktopServices::openUrl(QUrl(QString("https://retroshare.readthedocs.io")));
|
||||
}
|
||||
|
||||
void HomePage::doExpand()
|
||||
void HomePage::toggleUseOldFormat()
|
||||
{
|
||||
mUseBackwardCompatibleCert = !mUseBackwardCompatibleCert;
|
||||
updateCertificate();
|
||||
|
||||
if (ui->expandButton->isChecked())
|
||||
if (mUseBackwardCompatibleCert)
|
||||
{
|
||||
ui->userCertEdit->show();
|
||||
ui->expandButton->setToolTip(tr("Hide"));
|
||||
//ui->userCertEdit->show();
|
||||
//ui->expandButton->setToolTip(tr("Revert to normal Retroshare ID"));
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->userCertEdit->hide();
|
||||
ui->expandButton->setToolTip(tr("Show full certificate (old format)"));
|
||||
//ui->userCertEdit->hide();
|
||||
//ui->expandButton->setToolTip(tr("Show full certificate (old format for backward compatibility)"));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -49,6 +49,7 @@ public:
|
||||
private slots:
|
||||
void certContextMenu(QPoint);
|
||||
void updateOwnCert();
|
||||
void updateCertificate();
|
||||
void updateOwnId();
|
||||
void runEmailClient();
|
||||
void copyCert();
|
||||
@ -58,16 +59,17 @@ private slots:
|
||||
void webMail();
|
||||
//void loadCert();
|
||||
void openWebHelp() ;
|
||||
void toggleUseOldFormat() ;
|
||||
void recommendFriends();
|
||||
void toggleIncludeAllIPs();
|
||||
void toggleUseShortFormat();
|
||||
void doExpand();
|
||||
|
||||
private:
|
||||
Ui::HomePage *ui;
|
||||
|
||||
bool mIncludeAllIPs;
|
||||
bool mUseShortFormat;
|
||||
bool mUseBackwardCompatibleCert;
|
||||
|
||||
};
|
||||
|
||||
|
@ -66,177 +66,6 @@ private and secure decentralized communication platform.
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="horizontalSpacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="4">
|
||||
<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>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="6">
|
||||
<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>
|
||||
</font>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="lineWrapMode">
|
||||
<enum>QPlainTextEdit::NoWrap</enum>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="tabStopWidth">
|
||||
<number>80</number>
|
||||
</property>
|
||||
<property name="centerOnScroll">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="5">
|
||||
<widget class="QToolButton" name="expandButton">
|
||||
<property name="toolTip">
|
||||
<string>Show full certificate (old format)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="icons.qrc">
|
||||
<normaloff>:/icons/png/cert.png</normaloff>:/icons/png/cert.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<widget class="QToolButton" name="shareButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Share your RetroShare ID</p></body></html></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="0" colspan="4">
|
||||
<widget class="QLabel" name="retroshareid">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<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="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="4">
|
||||
<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>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>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="2" rowspan="4">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
@ -388,6 +217,152 @@ private and secure decentralized communication platform.
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="horizontalSpacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="2" column="0" colspan="7">
|
||||
<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>
|
||||
</font>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="lineWrapMode">
|
||||
<enum>QPlainTextEdit::NoWrap</enum>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="tabStopWidth">
|
||||
<number>80</number>
|
||||
</property>
|
||||
<property name="centerOnScroll">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="4">
|
||||
<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>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="3" column="0">
|
||||
<widget class="QLabel" name="retroshareid">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Courier New</family>
|
||||
<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="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="6">
|
||||
<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>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="5">
|
||||
<widget class="QToolButton" name="shareButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Share your RetroShare ID</p></body></html></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>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
|
Loading…
Reference in New Issue
Block a user