Improvements for ProgressDialog.

- Launch progress dialog after connectWizard.
 - fix display of location on connectWizard.
 - add cleanup code to ProgressDialog.
 - Qt4.7 bugfix.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6616 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2013-08-26 07:24:37 +00:00
parent 5dffde209a
commit fd66a963d2
5 changed files with 56 additions and 10 deletions

@ -237,7 +237,7 @@ FriendsDialog::FriendsDialog(QWidget *parent)
#if QT_VERSION < 0x040700
// embedded images are not supported before QT 4.7.0
ui->attachPictureButton->setVisible(false);
ui.attachPictureButton->setVisible(false);
#endif
}

@ -51,10 +51,7 @@
#include "util/misc.h"
#include "vmessagebox.h"
#define PROGRESS_DIALOG 1
#ifdef PROGRESS_DIALOG
#include "gui/connect/ConnectProgressDialog.h"
#endif
#include "FriendList.h"
#include "ui_FriendList.h"
@ -1490,15 +1487,20 @@ void FriendList::connectfriend()
if (item->type() == TYPE_SSL) {
rsPeers->connectAttempt(getRsId(item));
item->setIcon(COLUMN_NAME,(QIcon(IMAGE_CONNECT2)));
// Launch ProgressDialog, only if single SSL child.
if (childCount == 1)
{
ConnectProgressDialog::showProgress(getRsId(item));
}
}
}
} else {
//this is a SSL key
rsPeers->connectAttempt(getRsId(c));
c->setIcon(COLUMN_NAME,(QIcon(IMAGE_CONNECT2)));
#ifdef PROGRESS_DIALOG
// Launch ProgressDialog.
ConnectProgressDialog::showProgress(getRsId(c));
#endif
}
}
}

@ -35,6 +35,8 @@
#include <retroshare/rsiface.h>
#include "ConnectProgressDialog.h"
//#define FRIEND_WIZARD_DEBUG
ConnectFriendPage::ConnectFriendPage(QWidget *parent) : QWizardPage(parent)
@ -313,7 +315,22 @@ void ConnectFriendWizard::initializePage(int id)
ui->nameEdit->setText(QString::fromUtf8(peerDetails.name.c_str()));
ui->trustEdit->setText(trustString);
ui->emailEdit->setText(QString::fromUtf8(peerDetails.email.c_str()));
ui->locationEdit->setText(QString::fromUtf8(peerDetails.location.c_str()));
QString loc = QString::fromUtf8(peerDetails.location.c_str());
if (!loc.isEmpty())
{
loc += " (";
loc += QString::fromStdString(peerDetails.id);
loc += ")";
}
else
{
if (!peerDetails.id.empty())
{
loc += QString::fromStdString(peerDetails.id);
}
}
ui->locationEdit->setText(loc);
ui->signersEdit->setPlainText(ts);
fillGroups(this, ui->groupComboBox, groupId);
@ -561,14 +578,18 @@ void ConnectFriendWizard::accept()
}
}
bool runProgressDialog = false;
if (!peerDetails.gpg_id.empty()) {
if (sign) {
std::cerr << "ConclusionPage::validatePage() signing GPG key." << std::endl;
rsPeers->signGPGCertificate(peerDetails.gpg_id); //bye default sign set accept_connection to true;
runProgressDialog = true;
} else if (accept_connection) {
std::cerr << "ConclusionPage::validatePage() accepting GPG key for connection." << std::endl;
rsPeers->addFriend("", peerDetails.gpg_id,serviceFlags()) ;
rsPeers->setServicePermissionFlags(peerDetails.gpg_id,serviceFlags()) ;
runProgressDialog = true;
}
if (!groupId.isEmpty()) {
@ -578,6 +599,7 @@ void ConnectFriendWizard::accept()
if (peerDetails.id != "") {
rsPeers->addFriend(peerDetails.id, peerDetails.gpg_id,serviceFlags()) ;
runProgressDialog = true;
//let's check if there is ip adresses in the wizard.
if (!peerDetails.extAddr.empty() && peerDetails.extPort) {
@ -597,6 +619,13 @@ void ConnectFriendWizard::accept()
rsPeers->setLocation(peerDetails.id, peerDetails.location);
}
}
if (runProgressDialog)
{
std::string ssl_id = peerDetails.id;
// its okay if ssl_id is invalid - dialog will show error.
ConnectProgressDialog::showProgress(ssl_id);
}
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_NEIGHBOURS,1) ;
@ -927,3 +956,5 @@ void ConnectFriendWizard::groupCurrentIndexChanged(int index)
groupId = comboBox->itemData(index, Qt::UserRole).toString();
}
}

@ -63,7 +63,7 @@ ConnectProgressDialog::ConnectProgressDialog(const std::string& id, QWidget *par
ui->headerFrame->setHeaderImage(QPixmap(":/images/user/identityinfo64.png"));
ui->headerFrame->setHeaderText(tr("Connection Assistant"));
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(close()));
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(stopAndClose()));
}
ConnectProgressDialog::~ConnectProgressDialog()
@ -88,12 +88,12 @@ void ConnectProgressDialog::showProgress(const std::string& peer_id)
/* window will destroy itself! */
}
const uint32_t CONNECT_STATE_INIT = 0;
const uint32_t CONNECT_STATE_PROGRESS = 1;
const uint32_t CONNECT_STATE_CONNECTED = 2;
const uint32_t CONNECT_STATE_DENIED = 3;
const uint32_t CONNECT_STATE_FAILED = 4;
const uint32_t CONNECT_STATE_CLOSED = 4;
const uint32_t CONNECT_STATE_FAILED = 5;
const uint32_t CONNECT_DHT_INIT = 0;
const uint32_t CONNECT_DHT_OKAY = 2;
@ -227,6 +227,7 @@ void ConnectProgressDialog::updateStatus()
break;
default:
case CONNECT_STATE_CLOSED:
case CONNECT_STATE_FAILED:
case CONNECT_STATE_DENIED:
case CONNECT_STATE_CONNECTED:
@ -238,6 +239,17 @@ void ConnectProgressDialog::updateStatus()
mTimer->stop();
}
void ConnectProgressDialog::stopAndClose()
{
mState = CONNECT_STATE_CLOSED;
if (mTimer)
{
mTimer->stop();
}
close();
}
void ConnectProgressDialog::updateNetworkStatus()
{
uint32_t netState = rsConfig->getNetState();

@ -45,6 +45,7 @@ private:
private slots:
void updateStatus();
void stopAndClose();
private: