Improvements to the GettingStarted Tab.

* Re-written the text.
 * Enabled buttons for "Invite Friends" and "Add Friend". Linked to Email Invite, and Connect Friend Wizard.
 * Switched out FAQ for links to website, and email support buttons.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4499 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2011-07-30 12:41:28 +00:00
parent 91e10f1590
commit a1e112934d
3 changed files with 590 additions and 141 deletions

View file

@ -20,10 +20,17 @@
****************************************************************/
#include "gui/GetStartedDialog.h"
#include "gui/connect/ConnectFriendWizard.h"
#include "retroshare/rspeers.h"
#include "retroshare/rsdisc.h"
#include "retroshare/rsconfig.h"
#include "gui/RsAutoUpdatePage.h"
#include <QDesktopServices>
#include <iostream>
#include <sstream>
/** Constructor */
GetStartedDialog::GetStartedDialog(QWidget *parent)
@ -32,6 +39,9 @@ GetStartedDialog::GetStartedDialog(QWidget *parent)
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
mTimer = NULL;
mInviteTimer = NULL;
/* we use a flag to setup the GettingStarted Flags, so that RS has a bit of time to initialise itself
*/
@ -42,6 +52,15 @@ GetStartedDialog::GetStartedDialog(QWidget *parent)
connect(ui.connectCheckBox, SIGNAL(stateChanged( int )), this, SLOT(tickConnectChanged()));
connect(ui.firewallCheckBox, SIGNAL(stateChanged( int )), this, SLOT(tickFirewallChanged()));
connect(ui.pushButton_InviteFriends, SIGNAL(clicked( bool )), this, SLOT(inviteFriends()));
connect(ui.pushButton_AddFriend, SIGNAL(clicked( bool )), this, SLOT(addFriends()));
connect(ui.pushButton_FAQ, SIGNAL(clicked( bool )), this, SLOT(OpenFAQ()));
connect(ui.pushButton_Forums, SIGNAL(clicked( bool )), this, SLOT(OpenForums()));
connect(ui.pushButton_Website, SIGNAL(clicked( bool )), this, SLOT(OpenWebsite()));
connect(ui.pushButton_EmailFeedback, SIGNAL(clicked( bool )), this, SLOT(emailFeedback()));
connect(ui.pushButton_EmailSupport, SIGNAL(clicked( bool )), this, SLOT(emailSupport()));
/* Hide platform specific features */
#ifdef Q_WS_WIN
@ -169,3 +188,317 @@ void GetStartedDialog::tickFirewallChanged()
}
static void sendMail(std::string sAddress, std::string sSubject, std::string sBody)
{
/* Only under windows do we need to do this! */
#ifdef Q_WS_WIN
/* search and replace the end of lines with: "%0D%0A" */
size_t loc;
while ((loc = sBody.find("\n")) != sBody.npos) {
sBody.replace(loc, 1, "%0D%0A");
}
#endif
std::string mailstr = "mailto:" + sAddress;
mailstr += "?subject=" + sSubject;
mailstr += "&body=" + sBody;
std::cerr << "MAIL STRING:" << mailstr.c_str() << std::endl;
/* pass the url directly to QDesktopServices::openUrl */
QDesktopServices::openUrl (QUrl (QString::fromUtf8(mailstr.c_str())));
}
void GetStartedDialog::addFriends()
{
ConnectFriendWizard connwiz(this);
connwiz.show();
connwiz.next();
connwiz.exec();
}
void GetStartedDialog::inviteFriends()
{
if (RsAutoUpdatePage::eventsLocked() == true)
{
std::cerr << "GetStartedDialog::inviteFriends() EventsLocked... waiting";
std::cerr << std::endl;
if (!mInviteTimer)
{
mInviteTimer = new QTimer(this);
mInviteTimer->connect(mTimer, SIGNAL(timeout()), this, SLOT(inviteFriends()));
mInviteTimer->setInterval(100); /* 1/10 second */
mInviteTimer->setSingleShot(true);
}
mInviteTimer->start();
return;
}
std::string cert;
{
RsAutoUpdatePage::lockAllEvents();
bool shouldAddSignatures = false;
cert = rsPeers->GetRetroshareInvite(shouldAddSignatures);
RsAutoUpdatePage::unlockAllEvents() ;
}
std::ostringstream out;
QString trstr;
trstr = tr("You are cordially invited to join the Retroshare Network,");
out << trstr.toStdString() << std::endl;
out << std::endl;
trstr = tr("Retroshare is a Secure P2P Sharing Network");
out << trstr.toStdString() << std::endl;
trstr = tr("We use direct connections between you and your friends to maintain your Privacy");
out << trstr.toStdString() << std::endl;
out << std::endl;
trstr = tr("Install the client to chat, share data and converse in the forums");
out << trstr.toStdString() << std::endl;
out << std::endl;
out << std::endl;
trstr = tr("Get Retroshare here: http://retroshare.sourceforge.net/download");
out << trstr.toStdString() << std::endl;
out << std::endl;
trstr = tr("Below is your friends ID Certificate. Cut and paste this into your Retroshare client");
out << trstr.toStdString() << std::endl;
trstr = tr("and send them your ID Certificate to enable the secure connection");
out << trstr.toStdString() << std::endl;
out << std::endl;
out << cert;
out << std::endl;
sendMail("", tr("Retroshare Invitation").toStdString(), out.str());
}
void GetStartedDialog::emailSubscribe()
{
std::ostringstream out;
out << "Please let me know when Retroshare has a new release, or exciting news";
out << std::endl;
out << std::endl;
out << "Furthermore, I'd like to say ... ";
out << std::endl;
out << std::endl;
sendMail("lists@retroshare.org", "Subscribe", out.str());
}
void GetStartedDialog::emailUnsubscribe()
{
std::ostringstream out;
out << "I am no longer interested in Retroshare News.";
out << std::endl;
out << "Please remove me from the Mailing List";
out << std::endl;
sendMail("lists@retroshare.org", "Unsubscribe", out.str());
}
void GetStartedDialog::emailFeedback()
{
std::ostringstream out;
out << "Dear Retroshare Developers";
out << std::endl;
out << std::endl;
out << "I've tried out Retroshare and would like provide feedback:";
out << std::endl;
out << std::endl;
out << "To make Retroshare more user friendly, please [ what do you think? ] ";
out << std::endl;
out << "The best feature of Retroshare is [ what do you think? ] ";
out << std::endl;
out << "and the biggest missing feature is [ what do you think? ] ";
out << std::endl;
out << std::endl;
out << "Furthermore, I'd like to say ... ";
out << std::endl;
out << std::endl;
sendMail("feedback@retroshare.org", tr("RetroShare Feedback").toStdString(), out.str());
}
void GetStartedDialog::emailSupport()
{
if (RsAutoUpdatePage::eventsLocked() == true)
{
std::cerr << "GetStartedDialog::emailSupport() EventsLocked... waiting";
std::cerr << std::endl;
if (!mTimer)
{
mTimer = new QTimer(this);
mTimer->connect(mTimer, SIGNAL(timeout()), this, SLOT(emailSupport()));
mTimer->setInterval(100); /* 1/10 second */
mTimer->setSingleShot(true);
}
mTimer->start();
return;
}
std::string versionString;
uint32_t userLevel;
{
RsAutoUpdatePage::lockAllEvents();
/* set retroshare version */
std::map<std::string, std::string>::iterator vit;
std::map<std::string, std::string> versions;
bool retv = rsDisc->getDiscVersions(versions);
std::string id = rsPeers->getOwnId();
if (retv && versions.end() != (vit = versions.find(id)))
{
versionString = vit->second;
}
userLevel = rsConfig->getUserLevel();
RsAutoUpdatePage::unlockAllEvents() ;
}
std::ostringstream out;
out << "Hello";
out << std::endl;
out << std::endl;
out << "My Retroshare Configuration is: (" << versionString;
out << ", ";
#ifdef __APPLE__
#ifdef Q_WS_MAC
switch(QSysInfo::MacintoshVersion)
{
case QSysInfo::MV_9:
out << "Mac OS 9";
break;
case QSysInfo::MV_10_0:
out << "Mac OSX 10.0";
break;
case QSysInfo::MV_10_1:
out << "Mac OSX 10.1";
break;
case QSysInfo::MV_10_2:
out << "Mac OSX 10.2";
break;
case QSysInfo::MV_10_3:
out << "Mac OSX 10.3";
break;
case QSysInfo::MV_10_4:
out << "Mac OSX 10.4";
break;
case QSysInfo::MV_10_5:
out << "Mac OSX 10.5";
break;
case QSysInfo::MV_10_6:
out << "Mac OSX 10.6";
break;
// case QSysInfo::MV_10_7:
// out << "Mac OSX 10.7";
// break;
default:
out << "Mac Unknown";
break;
}
#else
out << "OSX Unknown";
#endif
#else
#if defined(_WIN32) || defined(__MINGW32__)
// Windows
#ifdef Q_WS_WIN
switch(QSysInfo::windowsVersion())
{
case QSysInfo::WV_32s:
out << "Windows 2.1";
break;
case QSysInfo::WV_95:
out << "Windows 95";
break;
case QSysInfo::WV_98:
out << "Windows 98";
break;
case QSysInfo::WV_Me:
out << "Windows Me";
break;
case QSysInfo::WV_NT:
out << "Windows NT";
break;
case QSysInfo::WV_2000:
out << "Windows 2000";
break;
case QSysInfo::WV_XP:
out << "Windows XP";
break;
case QSysInfo::WV_2003:
out << "Windows 2003";
break;
case QSysInfo::WV_VISTA:
out << "Windows Vista";
break;
case QSysInfo::WV_WINDOWS7
out << "Windows 7";
break;
default:
out << "Windows";
break;
}
#else
out << "Windows Unknown";
#endif
#else
// Linux
out << "Linux";
#endif
#endif
out << ", 0x60" << std::hex << userLevel << std::dec;
out << ")" << std::endl;
out << std::endl;
out << "I am having trouble with Retroshare.";
out << " Can you help me with....";
out << std::endl;
out << std::endl;
sendMail("support@retroshare.org", tr("RetroShare Support").toStdString(), out.str());
}
void GetStartedDialog::OpenFAQ()
{
/* pass the url directly to QDesktopServices::openUrl */
std::string faq_url("http://retroshare.sourceforge.net/wiki/index.php/Frequently_Asked_Questions");
QDesktopServices::openUrl (QUrl (QString::fromStdString(faq_url)));
}
void GetStartedDialog::OpenForums()
{
/* pass the url directly to QDesktopServices::openUrl */
std::string forum_url("http://retroshare.sourceforge.net/forum/");
QDesktopServices::openUrl (QUrl (QString::fromStdString(forum_url)));
}
void GetStartedDialog::OpenWebsite()
{
/* pass the url directly to QDesktopServices::openUrl */
std::string website_url("http://retroshare.org");
QDesktopServices::openUrl (QUrl (QString::fromStdString(website_url)));
}