mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-12 11:02:30 -04:00
* Fixed Add Friend and Invite Frieds Dialogs
* Set minimum size for Channels frame * Set minimum size for Friends TreeWidget git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@856 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
b9236dc91e
commit
505b5c6363
6 changed files with 217 additions and 150 deletions
|
@ -17,13 +17,13 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
|
||||
#include "AddFriendWizard.h"
|
||||
****************************************************************/
|
||||
|
||||
#include "AddFriendWizard.h"
|
||||
//#include "rshare.h"
|
||||
//#include "config/gconfig.h"
|
||||
|
||||
#include "rsiface/rsiface.h"
|
||||
//#include "config/gconfig.h"
|
||||
|
||||
#include "rsiface/rsiface.h"
|
||||
#include "rsiface/rspeers.h"
|
||||
|
||||
#include <sstream>
|
||||
|
@ -37,148 +37,171 @@
|
|||
#include <QPoint>
|
||||
|
||||
#include "gui/NetworkDialog.h"
|
||||
|
||||
/** Constructor */
|
||||
AddFriendWizard::AddFriendWizard(NetworkDialog *cd, QWidget *parent, Qt::WFlags flags)
|
||||
: QDialog(parent, flags), cDialog(cd)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
|
||||
/** Constructor */
|
||||
AddFriendWizard::AddFriendWizard(NetworkDialog *cd, QWidget *parent, Qt::WFlags flags)
|
||||
: QDialog(parent, flags), cDialog(cd)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui.setupUi(this);
|
||||
|
||||
//GConfig config;
|
||||
//config.loadWidgetInformation(this);
|
||||
//GConfig config;
|
||||
//config.loadWidgetInformation(this);
|
||||
|
||||
connect(ui.loadfileButton, SIGNAL(clicked()), this, SLOT(loadfile()));
|
||||
connect(ui.loadfileButton, SIGNAL(clicked()), this, SLOT(loadfile()));
|
||||
|
||||
|
||||
setFixedSize(QSize(508, 312));
|
||||
|
||||
/* Hide platform specific features */
|
||||
#ifdef Q_WS_WIN
|
||||
|
||||
#endif
|
||||
setFixedSize(QSize(508, 312));
|
||||
|
||||
/* Hide platform specific features */
|
||||
#ifdef Q_WS_WIN
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/*!
|
||||
* The destructor for AddFriendWizard
|
||||
*/
|
||||
AddFriendWizard::~AddFriendWizard()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void AddFriendWizard::reset(QSettings *settingsPointer)
|
||||
{
|
||||
// set the labelstackedWidget and textstackedWidget to the first position
|
||||
//labelstackedWidget->setCurrentIndex(0);
|
||||
ui.textstackedWidget->setCurrentIndex(0);
|
||||
// disable the backButton: We don't need it if we are on the first position
|
||||
ui.backButton->setEnabled(false);
|
||||
// and we aren't at the last step, were the next button becomes the finish button
|
||||
lastStep = false;
|
||||
|
||||
settings = settingsPointer;
|
||||
|
||||
/*!
|
||||
* The destructor for AddFriendWizard
|
||||
*/
|
||||
AddFriendWizard::~AddFriendWizard()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void AddFriendWizard::on_nextButton_clicked()
|
||||
{
|
||||
// The current index position
|
||||
int index = ui.textstackedWidget->currentIndex();
|
||||
// Test the different widgets
|
||||
switch ( ui.textstackedWidget->currentIndex()) {
|
||||
//
|
||||
case 0 :
|
||||
{
|
||||
if ( ui.keyradioButton->isChecked() )
|
||||
{
|
||||
ui.textstackedWidget->setCurrentWidget(ui.keypage);
|
||||
|
||||
}
|
||||
if ( ui.pqipemradioButton->isChecked() )
|
||||
{
|
||||
ui.textstackedWidget->setCurrentWidget(ui.pqipempage);
|
||||
|
||||
void AddFriendWizard::reset(QSettings *settingsPointer)
|
||||
{
|
||||
// set the labelstackedWidget and textstackedWidget to the first position
|
||||
//labelstackedWidget->setCurrentIndex(0);
|
||||
ui.textstackedWidget->setCurrentIndex(0);
|
||||
// disable the backButton: We don't need it if we are on the first position
|
||||
ui.backButton->setEnabled(false);
|
||||
// and we aren't at the last step, were the next button becomes the finish button
|
||||
lastStep = false;
|
||||
|
||||
settings = settingsPointer;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void AddFriendWizard::on_nextButton_clicked()
|
||||
{
|
||||
// The current index position
|
||||
int index = ui.textstackedWidget->currentIndex();
|
||||
// Test the different widgets
|
||||
switch ( ui.textstackedWidget->currentIndex()) {
|
||||
//
|
||||
case 0 :
|
||||
{
|
||||
if ( ui.keyradioButton->isChecked() )
|
||||
{
|
||||
ui.textstackedWidget->setCurrentWidget(ui.keypage);
|
||||
/* something complicated ;) */
|
||||
|
||||
|
||||
std::string id;
|
||||
|
||||
/* get the text from the window */
|
||||
/* load into string */
|
||||
std::string certstr = ui.keyText->toPlainText().toStdString();
|
||||
|
||||
/* ask retroshare to load */
|
||||
if ((cDialog) && (rsPeers->LoadCertificateFromString(certstr, id)))
|
||||
{
|
||||
close();
|
||||
cDialog->showpeerdetails(id);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* error message */
|
||||
int ret = QMessageBox::warning(this, tr("RetroShare"),
|
||||
tr("Certificate Load Failed"),
|
||||
QMessageBox::Ok, QMessageBox::Ok);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if ( ui.inviteradioButton->isChecked() )
|
||||
{
|
||||
ui.textstackedWidget->setCurrentWidget(ui.invitepage);
|
||||
|
||||
}
|
||||
|
||||
if ( ui.pqipemradioButton->isChecked() )
|
||||
{
|
||||
ui.textstackedWidget->setCurrentWidget(ui.pqipempage);
|
||||
|
||||
}
|
||||
if ( ui.inviteradioButton->isChecked() )
|
||||
{
|
||||
ui.textstackedWidget->setCurrentWidget(ui.invitepage);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* move to the next widget, with the signal/slot also labelstackedWidget,
|
||||
* it's also moved
|
||||
*/
|
||||
index++;
|
||||
// activate the backButton, because we are at the second widget or higher
|
||||
ui.backButton->setEnabled(true);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*!
|
||||
* The on_backButton_clicked function is called when the back button is clicked.
|
||||
* First it set the variable index to the currentIndex of textstackedWidget minus 1.
|
||||
* So we have the previous position. Then it tests if the index goes lower then 0.
|
||||
* Because of there is no value prior 0, it sets the index back to 0.
|
||||
* If we was at the last widget, the button was named "Finish". If we go back, it's
|
||||
* named "Next" again and the lastStep is set to false.
|
||||
*/
|
||||
void AddFriendWizard::on_backButton_clicked()
|
||||
{
|
||||
int index = ui.textstackedWidget->currentIndex() - 1;
|
||||
if ( index <= 0 )
|
||||
{
|
||||
index = 0;
|
||||
ui.backButton->setEnabled(false);
|
||||
}
|
||||
//ui.nextButton->setText(tr("Next"));
|
||||
lastStep = false;
|
||||
ui.textstackedWidget->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
/*!
|
||||
* This function closes the dialog without saving the values
|
||||
*/
|
||||
void AddFriendWizard::on_cancelButton_clicked()
|
||||
{
|
||||
// if cancel is pressed, use the standard settings
|
||||
//writeSettings();
|
||||
// leave but show that cancel was pressed
|
||||
reject();
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* move to the next widget, with the signal/slot also labelstackedWidget,
|
||||
* it's also moved
|
||||
*/
|
||||
index++;
|
||||
// activate the backButton, because we are at the second widget or higher
|
||||
ui.backButton->setEnabled(true);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void AddFriendWizard::loadfile()
|
||||
{
|
||||
|
||||
/* show file dialog,
|
||||
* load file into screen,
|
||||
* push done button!
|
||||
*/
|
||||
std::string id;
|
||||
if (cDialog)
|
||||
{
|
||||
id = cDialog->loadneighbour();
|
||||
}
|
||||
|
||||
/* call make Friend */
|
||||
if (id != "")
|
||||
{
|
||||
close();
|
||||
cDialog->showpeerdetails(id);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* error message */
|
||||
int ret = QMessageBox::warning(this, tr("RetroShare"),
|
||||
tr("Certificate Load Failed"),
|
||||
QMessageBox::Ok, QMessageBox::Ok);
|
||||
}
|
||||
/*!
|
||||
* The on_backButton_clicked function is called when the back button is clicked.
|
||||
* First it set the variable index to the currentIndex of textstackedWidget minus 1.
|
||||
* So we have the previous position. Then it tests if the index goes lower then 0.
|
||||
* Because of there is no value prior 0, it sets the index back to 0.
|
||||
* If we was at the last widget, the button was named "Finish". If we go back, it's
|
||||
* named "Next" again and the lastStep is set to false.
|
||||
*/
|
||||
void AddFriendWizard::on_backButton_clicked()
|
||||
{
|
||||
int index = ui.textstackedWidget->currentIndex() - 1;
|
||||
if ( index <= 0 )
|
||||
{
|
||||
index = 0;
|
||||
ui.backButton->setEnabled(false);
|
||||
}
|
||||
//ui.nextButton->setText(tr("Next"));
|
||||
lastStep = false;
|
||||
ui.textstackedWidget->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
/*!
|
||||
* This function closes the dialog without saving the values
|
||||
*/
|
||||
void AddFriendWizard::on_cancelButton_clicked()
|
||||
{
|
||||
// if cancel is pressed, use the standard settings
|
||||
//writeSettings();
|
||||
// leave but show that cancel was pressed
|
||||
reject();
|
||||
}
|
||||
|
||||
void AddFriendWizard::loadfile()
|
||||
{
|
||||
|
||||
/* show file dialog,
|
||||
* load file into screen,
|
||||
* push done button!
|
||||
*/
|
||||
std::string id;
|
||||
if (cDialog)
|
||||
{
|
||||
id = cDialog->loadneighbour();
|
||||
}
|
||||
|
||||
/* call make Friend */
|
||||
if (id != "")
|
||||
{
|
||||
close();
|
||||
cDialog->showpeerdetails(id);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* error message */
|
||||
int ret = QMessageBox::warning(this, tr("RetroShare"),
|
||||
tr("Certificate Load Failed"),
|
||||
QMessageBox::Ok, QMessageBox::Ok);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue