* 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:
defnax 2008-11-30 02:21:02 +00:00
parent b9236dc91e
commit 505b5c6363
6 changed files with 217 additions and 150 deletions

View file

@ -204,6 +204,12 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="minimumSize" >
<size>
<width>220</width>
<height>0</height>
</size>
</property>
<property name="maximumSize" > <property name="maximumSize" >
<size> <size>
<width>220</width> <width>220</width>

View file

@ -5,7 +5,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>825</width> <width>721</width>
<height>516</height> <height>516</height>
</rect> </rect>
</property> </property>
@ -526,6 +526,18 @@ p, li { white-space: pre-wrap; }
</item> </item>
<item row="1" column="0" colspan="2" > <item row="1" column="0" colspan="2" >
<widget class="QTreeWidget" name="peertreeWidget" > <widget class="QTreeWidget" name="peertreeWidget" >
<property name="minimumSize" >
<size>
<width>250</width>
<height>0</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>1677215</width>
<height>16777215</height>
</size>
</property>
<property name="contextMenuPolicy" > <property name="contextMenuPolicy" >
<enum>Qt::CustomContextMenu</enum> <enum>Qt::CustomContextMenu</enum>
</property> </property>

View file

@ -5,8 +5,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>439</width> <width>539</width>
<height>336</height> <height>402</height>
</rect> </rect>
</property> </property>
<property name="windowTitle" > <property name="windowTitle" >
@ -37,8 +37,10 @@
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="html" > <property name="html" >
<string> <string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
</string> p, li { white-space: pre-wrap; }
&lt;/style>&lt;/head>&lt;body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
&lt;p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;/p>&lt;/body>&lt;/html></string>
</property> </property>
<property name="acceptRichText" > <property name="acceptRichText" >
<bool>true</bool> <bool>true</bool>
@ -112,6 +114,12 @@
</item> </item>
<item row="0" column="0" colspan="5" > <item row="0" column="0" colspan="5" >
<widget class="QLabel" name="addfriendLabel" > <widget class="QLabel" name="addfriendLabel" >
<property name="maximumSize" >
<size>
<width>16777215</width>
<height>73</height>
</size>
</property>
<property name="palette" > <property name="palette" >
<palette> <palette>
<active> <active>
@ -531,10 +539,13 @@
<string>background-image: url(:/images/addfriendlabel.png)</string> <string>background-image: url(:/images/addfriendlabel.png)</string>
</property> </property>
<property name="text" > <property name="text" >
<string> Add a new Friend <string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
To add a new Friend, cut and paste their email p, li { white-space: pre-wrap; }
invitation into the box below, and click done. &lt;/style>&lt;/head>&lt;body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
</string> &lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-size:16pt; font-weight:600; color:#32cd32;">Add a new Friend&lt;/span>&lt;/p>
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">To add a new Friend, cut and paste their email &lt;/p>
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">invitation into the box below, and click done.&lt;/p>
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> &lt;/p>&lt;/body>&lt;/html></string>
</property> </property>
<property name="alignment" > <property name="alignment" >
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>

View file

@ -17,13 +17,13 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, * Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
****************************************************************/ ****************************************************************/
#include "AddFriendWizard.h" #include "AddFriendWizard.h"
//#include "rshare.h" //#include "rshare.h"
//#include "config/gconfig.h" //#include "config/gconfig.h"
#include "rsiface/rsiface.h" #include "rsiface/rsiface.h"
#include "rsiface/rspeers.h" #include "rsiface/rspeers.h"
#include <sstream> #include <sstream>
@ -37,148 +37,171 @@
#include <QPoint> #include <QPoint>
#include "gui/NetworkDialog.h" #include "gui/NetworkDialog.h"
/** Constructor */ /** Constructor */
AddFriendWizard::AddFriendWizard(NetworkDialog *cd, QWidget *parent, Qt::WFlags flags) AddFriendWizard::AddFriendWizard(NetworkDialog *cd, QWidget *parent, Qt::WFlags flags)
: QDialog(parent, flags), cDialog(cd) : QDialog(parent, flags), cDialog(cd)
{ {
/* Invoke the Qt Designer generated object setup routine */ /* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this); ui.setupUi(this);
//GConfig config; //GConfig config;
//config.loadWidgetInformation(this); //config.loadWidgetInformation(this);
connect(ui.loadfileButton, SIGNAL(clicked()), this, SLOT(loadfile())); connect(ui.loadfileButton, SIGNAL(clicked()), this, SLOT(loadfile()));
setFixedSize(QSize(508, 312)); setFixedSize(QSize(508, 312));
/* Hide platform specific features */ /* Hide platform specific features */
#ifdef Q_WS_WIN #ifdef Q_WS_WIN
#endif #endif
} }
/*! /*!
* The destructor for AddFriendWizard * The destructor for AddFriendWizard
*/ */
AddFriendWizard::~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;
} }
void AddFriendWizard::on_nextButton_clicked() void AddFriendWizard::reset(QSettings *settingsPointer)
{ {
// The current index position // set the labelstackedWidget and textstackedWidget to the first position
int index = ui.textstackedWidget->currentIndex(); //labelstackedWidget->setCurrentIndex(0);
// Test the different widgets ui.textstackedWidget->setCurrentIndex(0);
switch ( ui.textstackedWidget->currentIndex()) { // disable the backButton: We don't need it if we are on the first position
// ui.backButton->setEnabled(false);
case 0 : // and we aren't at the last step, were the next button becomes the finish button
{ lastStep = false;
if ( ui.keyradioButton->isChecked() )
{ settings = settingsPointer;
ui.textstackedWidget->setCurrentWidget(ui.keypage);
}
}
if ( ui.pqipemradioButton->isChecked() )
{ void AddFriendWizard::on_nextButton_clicked()
ui.textstackedWidget->setCurrentWidget(ui.pqipempage); {
// 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() ) if ( ui.pqipemradioButton->isChecked() )
{ {
ui.textstackedWidget->setCurrentWidget(ui.invitepage); ui.textstackedWidget->setCurrentWidget(ui.pqipempage);
} }
if ( ui.inviteradioButton->isChecked() )
{
ui.textstackedWidget->setCurrentWidget(ui.invitepage);
}
} }
return; return;
} }
/* /*
* move to the next widget, with the signal/slot also labelstackedWidget, * move to the next widget, with the signal/slot also labelstackedWidget,
* it's also moved * it's also moved
*/ */
index++; index++;
// activate the backButton, because we are at the second widget or higher // activate the backButton, because we are at the second widget or higher
ui.backButton->setEnabled(true); 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();
} }
void AddFriendWizard::loadfile() /*!
{ * 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.
/* show file dialog, * So we have the previous position. Then it tests if the index goes lower then 0.
* load file into screen, * Because of there is no value prior 0, it sets the index back to 0.
* push done button! * 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.
std::string id; */
if (cDialog) void AddFriendWizard::on_backButton_clicked()
{ {
id = cDialog->loadneighbour(); int index = ui.textstackedWidget->currentIndex() - 1;
} if ( index <= 0 )
{
/* call make Friend */ index = 0;
if (id != "") ui.backButton->setEnabled(false);
{ }
close(); //ui.nextButton->setText(tr("Next"));
cDialog->showpeerdetails(id); lastStep = false;
} ui.textstackedWidget->setCurrentIndex(0);
else }
{
/* error message */ /*!
int ret = QMessageBox::warning(this, tr("RetroShare"), * This function closes the dialog without saving the values
tr("Certificate Load Failed"), */
QMessageBox::Ok, QMessageBox::Ok); 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);
}
} }

View file

@ -52,7 +52,7 @@
<property name="html" > <property name="html" >
<string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css"> <string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
p, li { white-space: pre-wrap; } p, li { white-space: pre-wrap; }
&lt;/style>&lt;/head>&lt;body style=" font-family:'Helvetica'; font-size:10pt; font-weight:400; font-style:normal;"> &lt;/style>&lt;/head>&lt;body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
&lt;p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Arial'; font-size:8pt;">&lt;/p>&lt;/body>&lt;/html></string> &lt;p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Arial'; font-size:8pt;">&lt;/p>&lt;/body>&lt;/html></string>
</property> </property>
<property name="acceptRichText" > <property name="acceptRichText" >
@ -62,6 +62,12 @@ p, li { white-space: pre-wrap; }
</item> </item>
<item row="0" column="0" colspan="7" > <item row="0" column="0" colspan="7" >
<widget class="QLabel" name="invitefriendLabel" > <widget class="QLabel" name="invitefriendLabel" >
<property name="maximumSize" >
<size>
<width>16777215</width>
<height>93</height>
</size>
</property>
<property name="palette" > <property name="palette" >
<palette> <palette>
<active> <active>
@ -478,13 +484,13 @@ p, li { white-space: pre-wrap; }
</palette> </palette>
</property> </property>
<property name="styleSheet" > <property name="styleSheet" >
<string>background-image: url(:/images/invitefriendlabel.png)</string> <string>background-image: url(:/images/invitefriendlabel.png);</string>
</property> </property>
<property name="text" > <property name="text" >
<string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css"> <string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
p, li { white-space: pre-wrap; } p, li { white-space: pre-wrap; }
&lt;/style>&lt;/head>&lt;body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;"> &lt;/style>&lt;/head>&lt;body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Arial'; font-size:8pt;">&lt;span style=" font-size:16pt;">Invite a Friend&lt;/span>&lt;br />&lt;br />&lt;span style=" font-size:10pt;">To Invite your friends to join you with Retroshare: &lt;/span>&lt;/p> &lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Arial'; font-size:8pt;">&lt;span style=" font-size:16pt; font-weight:600; color:#32cd32;">Invite a Friend&lt;/span>&lt;br />&lt;span style=" font-size:10pt;">To Invite your friends to join you with Retroshare: &lt;/span>&lt;/p>
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Arial'; font-size:10pt;">Cut and paste the text below into an email.&lt;/p> &lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Arial'; font-size:10pt;">Cut and paste the text below into an email.&lt;/p>
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Arial'; font-size:10pt;">and send it to all your friends!&lt;/p>&lt;/body>&lt;/html></string> &lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Arial'; font-size:10pt;">and send it to all your friends!&lt;/p>&lt;/body>&lt;/html></string>
</property> </property>

View file

@ -249,7 +249,16 @@ RemoteDirModel::RemoteDirModel(bool mode, QObject *parent)
switch(coln) switch(coln)
{ {
case 0: case 0:
return(QIcon(":/images/folder16.png")); QString ext = QFileInfo(QString::fromStdString(details.name)).suffix();
if (ext == "avi" || ext == "mpg" || ext == "movie")
{
QIcon icon(":/images/folder_video.png");
return icon;
}
else
{
return(QIcon(":/images/folder16.png"));
}
break; break;
} }
} }