mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 23:49:35 -05:00
Added new ProfileView and ProfileEdit to Blog Feed.
Added Context menus to BlogDialog to open windows. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@588 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
4a58c71f9e
commit
9f8f0e46f5
@ -25,6 +25,8 @@
|
|||||||
#include "rsiface/rsQblog.h"
|
#include "rsiface/rsQblog.h"
|
||||||
#include "rsiface/rspeers.h" //to retrieve peer/usrId info
|
#include "rsiface/rspeers.h" //to retrieve peer/usrId info
|
||||||
|
|
||||||
|
#include "profile/ProfileView.h"
|
||||||
|
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
BlogDialog::BlogDialog(QWidget *parent)
|
BlogDialog::BlogDialog(QWidget *parent)
|
||||||
: MainPage (parent)
|
: MainPage (parent)
|
||||||
@ -39,6 +41,8 @@ BlogDialog::BlogDialog(QWidget *parent)
|
|||||||
connect(italicBtn, SIGNAL(clicked()), this, SLOT(setFont()));
|
connect(italicBtn, SIGNAL(clicked()), this, SLOT(setFont()));
|
||||||
connect(refreshBtn, SIGNAL(clicked()), this, SLOT(update()));
|
connect(refreshBtn, SIGNAL(clicked()), this, SLOT(update()));
|
||||||
|
|
||||||
|
connect(userList, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( peerCustomPopupMenu( QPoint ) ) );
|
||||||
|
|
||||||
/* Current Font */
|
/* Current Font */
|
||||||
mCurrentFont = QFont("Comic Sans MS", 8);
|
mCurrentFont = QFont("Comic Sans MS", 8);
|
||||||
|
|
||||||
@ -48,6 +52,55 @@ BlogDialog::BlogDialog(QWidget *parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void BlogDialog::peerCustomPopupMenu( QPoint point )
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
*/
|
||||||
|
|
||||||
|
QMenu contextMnu( this );
|
||||||
|
QMouseEvent *mevent = new QMouseEvent( QEvent::MouseButtonPress, point, Qt::RightButton, Qt::RightButton, Qt::NoModifier );
|
||||||
|
|
||||||
|
QAction *profileAct = new QAction( tr( "Show Profile" ), this );
|
||||||
|
QAction *onlyoneAct = new QAction( tr( "Show Only This Blog" ), this );
|
||||||
|
QAction *allAct = new QAction( tr( "Show All Blogs" ), this );
|
||||||
|
|
||||||
|
connect( profileAct , SIGNAL( triggered() ), this, SLOT( showuserprofile() ) );
|
||||||
|
connect( onlyoneAct , SIGNAL( triggered() ), this, SLOT( showoneblog() ) );
|
||||||
|
connect( allAct , SIGNAL( triggered() ), this, SLOT( showallblogs() ) );
|
||||||
|
|
||||||
|
contextMnu.clear();
|
||||||
|
contextMnu.addAction( profileAct );
|
||||||
|
contextMnu.addAction( onlyoneAct );
|
||||||
|
contextMnu.addAction( allAct );
|
||||||
|
contextMnu.exec( mevent->globalPos() );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void BlogDialog::showuserprofile()
|
||||||
|
{
|
||||||
|
showprofile("");
|
||||||
|
}
|
||||||
|
|
||||||
|
void BlogDialog::showprofile(std::string id)
|
||||||
|
{
|
||||||
|
static ProfileView *oneProfile = new ProfileView(NULL);
|
||||||
|
|
||||||
|
oneProfile -> setPeerId(id);
|
||||||
|
oneProfile -> show();
|
||||||
|
}
|
||||||
|
|
||||||
|
void BlogDialog::showoneblog()
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void BlogDialog::showallblogs()
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void BlogDialog::sendBlog()
|
void BlogDialog::sendBlog()
|
||||||
{
|
{
|
||||||
QString blogMsg = lineEdit->toPlainText();
|
QString blogMsg = lineEdit->toPlainText();
|
||||||
|
@ -35,7 +35,7 @@ public:
|
|||||||
/** Default Destructor */
|
/** Default Destructor */
|
||||||
|
|
||||||
/** Qt Designer generated object */
|
/** Qt Designer generated object */
|
||||||
Ui::BlogDialog ui;
|
//Ui::BlogDialog ui;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void sendBlog();
|
void sendBlog();
|
||||||
@ -44,9 +44,17 @@ public slots:
|
|||||||
/// populates blog service with current information from core
|
/// populates blog service with current information from core
|
||||||
void update();
|
void update();
|
||||||
|
|
||||||
|
void showprofile(std::string id);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
/*nothing here yet */
|
|
||||||
|
/** context popup menus */
|
||||||
|
void peerCustomPopupMenu( QPoint point );
|
||||||
|
|
||||||
|
/* peer ContextMenu Actions */
|
||||||
|
void showuserprofile();
|
||||||
|
void showoneblog();
|
||||||
|
void showallblogs();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>606</width>
|
<width>640</width>
|
||||||
<height>400</height>
|
<height>454</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy" >
|
<property name="sizePolicy" >
|
||||||
@ -504,14 +504,81 @@
|
|||||||
<property name="windowIcon" >
|
<property name="windowIcon" >
|
||||||
<iconset/>
|
<iconset/>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="layoutWidget" >
|
<layout class="QGridLayout" >
|
||||||
<property name="geometry" >
|
<item row="0" column="0" colspan="3" >
|
||||||
<rect>
|
<layout class="QGridLayout" >
|
||||||
<x>460</x>
|
<property name="topMargin" >
|
||||||
<y>6</y>
|
<number>2</number>
|
||||||
<width>141</width>
|
</property>
|
||||||
<height>391</height>
|
<property name="horizontalSpacing" >
|
||||||
</rect>
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="verticalSpacing" >
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0" >
|
||||||
|
<layout class="QGridLayout" >
|
||||||
|
<property name="leftMargin" >
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin" >
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin" >
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin" >
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="horizontalSpacing" >
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<property name="verticalSpacing" >
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0" >
|
||||||
|
<layout class="QGridLayout" >
|
||||||
|
<property name="leftMargin" >
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin" >
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin" >
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin" >
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="horizontalSpacing" >
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<property name="verticalSpacing" >
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0" >
|
||||||
|
<widget class="QLabel" name="label" >
|
||||||
|
<property name="sizeIncrement" >
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="pixmap" >
|
||||||
|
<pixmap resource="images.qrc" >:/images/chat.png</pixmap>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1" >
|
||||||
|
<widget class="QLabel" name="label_12" >
|
||||||
|
<property name="sizePolicy" >
|
||||||
|
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeIncrement" >
|
<property name="sizeIncrement" >
|
||||||
<size>
|
<size>
|
||||||
@ -519,6 +586,69 @@
|
|||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="font" >
|
||||||
|
<font>
|
||||||
|
<pointsize>10</pointsize>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>Blog Feed:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1" >
|
||||||
|
<spacer>
|
||||||
|
<property name="sizeIncrement" >
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="orientation" >
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" >
|
||||||
|
<size>
|
||||||
|
<width>360</width>
|
||||||
|
<height>16</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0" >
|
||||||
|
<widget class="QTextBrowser" name="blogText" >
|
||||||
|
<property name="sizePolicy" >
|
||||||
|
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="sizeIncrement" >
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="contextMenuPolicy" >
|
||||||
|
<enum>Qt::DefaultContextMenu</enum>
|
||||||
|
</property>
|
||||||
|
<property name="undoRedoEnabled" >
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="readOnly" >
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item rowspan="4" row="0" column="3" >
|
||||||
<layout class="QGridLayout" >
|
<layout class="QGridLayout" >
|
||||||
<property name="leftMargin" >
|
<property name="leftMargin" >
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
@ -680,173 +810,9 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="layoutWidget" >
|
|
||||||
<property name="geometry" >
|
|
||||||
<rect>
|
|
||||||
<x>1</x>
|
|
||||||
<y>4</y>
|
|
||||||
<width>451</width>
|
|
||||||
<height>221</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="sizeIncrement" >
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" >
|
|
||||||
<property name="topMargin" >
|
|
||||||
<number>2</number>
|
|
||||||
</property>
|
|
||||||
<property name="horizontalSpacing" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="verticalSpacing" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item row="0" column="0" >
|
|
||||||
<layout class="QGridLayout" >
|
|
||||||
<property name="leftMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="horizontalSpacing" >
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<property name="verticalSpacing" >
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<item row="0" column="0" >
|
|
||||||
<layout class="QGridLayout" >
|
|
||||||
<property name="leftMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="horizontalSpacing" >
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<property name="verticalSpacing" >
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<item row="0" column="0" >
|
|
||||||
<widget class="QLabel" name="label" >
|
|
||||||
<property name="sizeIncrement" >
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text" >
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="pixmap" >
|
|
||||||
<pixmap resource="images.qrc" >:/images/chat.png</pixmap>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1" >
|
|
||||||
<widget class="QLabel" name="label_12" >
|
|
||||||
<property name="sizePolicy" >
|
|
||||||
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="sizeIncrement" >
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="font" >
|
|
||||||
<font>
|
|
||||||
<pointsize>10</pointsize>
|
|
||||||
<weight>75</weight>
|
|
||||||
<bold>true</bold>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text" >
|
|
||||||
<string>Blog Feed:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1" >
|
|
||||||
<spacer>
|
|
||||||
<property name="sizeIncrement" >
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="orientation" >
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" >
|
|
||||||
<size>
|
|
||||||
<width>360</width>
|
|
||||||
<height>16</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" >
|
<item row="1" column="0" >
|
||||||
<widget class="QTextBrowser" name="blogText" >
|
|
||||||
<property name="sizePolicy" >
|
|
||||||
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="sizeIncrement" >
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="contextMenuPolicy" >
|
|
||||||
<enum>Qt::DefaultContextMenu</enum>
|
|
||||||
</property>
|
|
||||||
<property name="undoRedoEnabled" >
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="readOnly" >
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QPushButton" name="boldBtn" >
|
<widget class="QPushButton" name="boldBtn" >
|
||||||
<property name="geometry" >
|
|
||||||
<rect>
|
|
||||||
<x>358</x>
|
|
||||||
<y>233</y>
|
|
||||||
<width>24</width>
|
|
||||||
<height>24</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize" >
|
<property name="minimumSize" >
|
||||||
<size>
|
<size>
|
||||||
<width>24</width>
|
<width>24</width>
|
||||||
@ -878,15 +844,9 @@
|
|||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1" >
|
||||||
<widget class="QPushButton" name="underlineBtn" >
|
<widget class="QPushButton" name="underlineBtn" >
|
||||||
<property name="geometry" >
|
|
||||||
<rect>
|
|
||||||
<x>392</x>
|
|
||||||
<y>233</y>
|
|
||||||
<width>24</width>
|
|
||||||
<height>24</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize" >
|
<property name="minimumSize" >
|
||||||
<size>
|
<size>
|
||||||
<width>24</width>
|
<width>24</width>
|
||||||
@ -918,15 +878,9 @@
|
|||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2" >
|
||||||
<widget class="QPushButton" name="italicBtn" >
|
<widget class="QPushButton" name="italicBtn" >
|
||||||
<property name="geometry" >
|
|
||||||
<rect>
|
|
||||||
<x>426</x>
|
|
||||||
<y>233</y>
|
|
||||||
<width>24</width>
|
|
||||||
<height>24</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize" >
|
<property name="minimumSize" >
|
||||||
<size>
|
<size>
|
||||||
<width>24</width>
|
<width>24</width>
|
||||||
@ -958,15 +912,9 @@
|
|||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0" colspan="3" >
|
||||||
<widget class="QTextEdit" name="lineEdit" >
|
<widget class="QTextEdit" name="lineEdit" >
|
||||||
<property name="geometry" >
|
|
||||||
<rect>
|
|
||||||
<x>1</x>
|
|
||||||
<y>263</y>
|
|
||||||
<width>449</width>
|
|
||||||
<height>100</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="sizePolicy" >
|
<property name="sizePolicy" >
|
||||||
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
|
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
@ -992,21 +940,8 @@
|
|||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="layoutWidget" >
|
</item>
|
||||||
<property name="geometry" >
|
<item row="3" column="0" colspan="3" >
|
||||||
<rect>
|
|
||||||
<x>200</x>
|
|
||||||
<y>370</y>
|
|
||||||
<width>247</width>
|
|
||||||
<height>25</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="sizeIncrement" >
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<layout class="QHBoxLayout" >
|
<layout class="QHBoxLayout" >
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="refreshBtn" >
|
<widget class="QPushButton" name="refreshBtn" >
|
||||||
@ -1048,7 +983,8 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</item>
|
||||||
|
</layout>
|
||||||
<action name="actionSend" >
|
<action name="actionSend" >
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Send</string>
|
<string>Send</string>
|
||||||
|
148
retroshare-gui/src/gui/profile/ProfileEdit.cpp
Normal file
148
retroshare-gui/src/gui/profile/ProfileEdit.cpp
Normal file
@ -0,0 +1,148 @@
|
|||||||
|
/****************************************************************
|
||||||
|
* RetroShare is distributed under the following license:
|
||||||
|
*
|
||||||
|
* Copyright (C) 2008 Robert Fernie
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
|
* Boston, MA 02110-1301, USA.
|
||||||
|
****************************************************************/
|
||||||
|
|
||||||
|
#include "gui/profile/ProfileEdit.h"
|
||||||
|
|
||||||
|
#include "rsiface/rspeers.h"
|
||||||
|
#include "rsiface/rsQblog.h"
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
#include <QContextMenuEvent>
|
||||||
|
#include <QMenu>
|
||||||
|
#include <QFile>
|
||||||
|
#include <QFileDialog>
|
||||||
|
#include <QCursor>
|
||||||
|
#include <QPoint>
|
||||||
|
#include <QMouseEvent>
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QPixmap>
|
||||||
|
#include <QPrintDialog>
|
||||||
|
|
||||||
|
|
||||||
|
/** Constructor */
|
||||||
|
ProfileEdit::ProfileEdit(QWidget *parent)
|
||||||
|
: QDialog(parent)
|
||||||
|
{
|
||||||
|
/* Invoke the Qt Designer generated object setup routine */
|
||||||
|
ui.setupUi(this);
|
||||||
|
|
||||||
|
connect( ui.profileTreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( profileCustomPopupMenu( QPoint ) ) );
|
||||||
|
|
||||||
|
// connect up the buttons.
|
||||||
|
connect(ui.addButton, SIGNAL(clicked()), this, SLOT(profileEntryAdd()));
|
||||||
|
connect(ui.moveDownButton, SIGNAL(clicked()), this, SLOT(profileEntryMoveDown()));
|
||||||
|
connect(ui.moveUpButton, SIGNAL(clicked()), this, SLOT(profileEntryMoveUp()));
|
||||||
|
connect(ui.closeButton, SIGNAL(clicked()), this, SLOT(close()));
|
||||||
|
|
||||||
|
/* Hide platform specific features */
|
||||||
|
#ifdef Q_WS_WIN
|
||||||
|
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProfileEdit::profileCustomPopupMenu( QPoint point )
|
||||||
|
{
|
||||||
|
|
||||||
|
QMenu contextMnu( this );
|
||||||
|
QMouseEvent *mevent = new QMouseEvent( QEvent::MouseButtonPress, point, Qt::RightButton, Qt::RightButton, Qt::NoModifier );
|
||||||
|
|
||||||
|
QAction *removeAct = new QAction( tr( "Remove Profile Entry" ), this );
|
||||||
|
QAction *moveupAct = new QAction( tr( "Move Profile Entry Up" ), this );
|
||||||
|
QAction *movedownAct = new QAction( tr( "Move Profile Entry Down" ), this );
|
||||||
|
|
||||||
|
connect( removeAct , SIGNAL( triggered() ), this, SLOT( profileEntryRemove() ) );
|
||||||
|
connect( moveupAct , SIGNAL( triggered() ), this, SLOT( profileEntryMoveUp() ) );
|
||||||
|
connect( movedownAct , SIGNAL( triggered() ), this, SLOT( profileEntryMoveDown() ) );
|
||||||
|
|
||||||
|
contextMnu.clear();
|
||||||
|
contextMnu.addAction( removeAct );
|
||||||
|
contextMnu.addAction( moveupAct );
|
||||||
|
contextMnu.addAction( movedownAct );
|
||||||
|
contextMnu.exec( mevent->globalPos() );
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProfileEdit::clear()
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProfileEdit::update()
|
||||||
|
{
|
||||||
|
/* load it up! */
|
||||||
|
std::string pId = "OwnId";
|
||||||
|
|
||||||
|
if (!rsQblog)
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::list< std::pair<std::wstring, std::wstring> > profile;
|
||||||
|
std::list< std::pair<std::wstring, std::wstring> >::iterator pit;
|
||||||
|
|
||||||
|
rsQblog -> getPeerProfile(pId, profile);
|
||||||
|
|
||||||
|
QList<QTreeWidgetItem *> itemList;
|
||||||
|
for(pit = profile.begin(); pit != profile.end(); pit++)
|
||||||
|
{
|
||||||
|
QTreeWidgetItem *item = new QTreeWidgetItem();
|
||||||
|
item->setText(0, QString::fromStdWString(pit->first));
|
||||||
|
item->setText(1, QString::fromStdWString(pit->second));
|
||||||
|
|
||||||
|
itemList.push_back(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
ui.profileTreeWidget->clear();
|
||||||
|
ui.profileTreeWidget->insertTopLevelItems(0, itemList);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* For context Menus */
|
||||||
|
/* for Profile */
|
||||||
|
void ProfileEdit::profileEntryAdd()
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProfileEdit::profileEntryRemove()
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProfileEdit::profileEntryMoveUp()
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProfileEdit::profileEntryMoveDown()
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ProfileEdit::profileEntryCustomChanged() /* check box */
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
67
retroshare-gui/src/gui/profile/ProfileEdit.h
Normal file
67
retroshare-gui/src/gui/profile/ProfileEdit.h
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
/****************************************************************
|
||||||
|
* RetroShare is distributed under the following license:
|
||||||
|
*
|
||||||
|
* Copyright (C) 2008, Robert Fernie
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
|
* Boston, MA 02110-1301, USA.
|
||||||
|
****************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _PROFILE_EDIT_H
|
||||||
|
#define _PROFILE_EDIT_H
|
||||||
|
|
||||||
|
#include "ui_ProfileEdit.h"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
class ProfileEdit : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
/** Default Constructor */
|
||||||
|
|
||||||
|
ProfileEdit(QWidget *parent = 0);
|
||||||
|
/** Default Destructor */
|
||||||
|
|
||||||
|
void clear();
|
||||||
|
void update();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
|
||||||
|
/** context popup menus */
|
||||||
|
void profileCustomPopupMenu( QPoint point );
|
||||||
|
|
||||||
|
/* for Profile */
|
||||||
|
void profileEntryAdd();
|
||||||
|
void profileEntryRemove();
|
||||||
|
void profileEntryMoveUp();
|
||||||
|
void profileEntryMoveDown();
|
||||||
|
|
||||||
|
void profileEntryCustomChanged(); /* check box */
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
/** Qt Designer generated object */
|
||||||
|
Ui::ProfileEdit ui;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
217
retroshare-gui/src/gui/profile/ProfileEdit.ui
Normal file
217
retroshare-gui/src/gui/profile/ProfileEdit.ui
Normal file
@ -0,0 +1,217 @@
|
|||||||
|
<ui version="4.0" >
|
||||||
|
<class>ProfileEdit</class>
|
||||||
|
<widget class="QWidget" name="ProfileEdit" >
|
||||||
|
<property name="geometry" >
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>540</width>
|
||||||
|
<height>469</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle" >
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<property name="layoutDirection" >
|
||||||
|
<enum>Qt::LeftToRight</enum>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" >
|
||||||
|
<item row="0" column="0" >
|
||||||
|
<widget class="QSplitter" name="splitter" >
|
||||||
|
<property name="orientation" >
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="layoutWidget" >
|
||||||
|
<layout class="QVBoxLayout" >
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_6" >
|
||||||
|
<property name="font" >
|
||||||
|
<font>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>Profile</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QTreeWidget" name="profileTreeWidget" >
|
||||||
|
<property name="contextMenuPolicy" >
|
||||||
|
<enum>Qt::CustomContextMenu</enum>
|
||||||
|
</property>
|
||||||
|
<property name="rootIsDecorated" >
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<column>
|
||||||
|
<property name="text" >
|
||||||
|
<string>Category</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text" >
|
||||||
|
<string>Thoughts</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="" >
|
||||||
|
<layout class="QGridLayout" >
|
||||||
|
<item row="0" column="0" colspan="2" >
|
||||||
|
<widget class="QLabel" name="label_7" >
|
||||||
|
<property name="font" >
|
||||||
|
<font>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>Edit Profile Category</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0" colspan="2" >
|
||||||
|
<widget class="QComboBox" name="profileComboBox" >
|
||||||
|
<item>
|
||||||
|
<property name="text" >
|
||||||
|
<string>Birthday</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text" >
|
||||||
|
<string>School</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text" >
|
||||||
|
<string>University</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text" >
|
||||||
|
<string>Phone Number</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text" >
|
||||||
|
<string>Favourite Books</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text" >
|
||||||
|
<string>Favourite Music</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text" >
|
||||||
|
<string>Favourite Films</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0" >
|
||||||
|
<widget class="QCheckBox" name="customCheckBox" >
|
||||||
|
<property name="layoutDirection" >
|
||||||
|
<enum>Qt::RightToLeft</enum>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>or Custom Entry</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1" >
|
||||||
|
<widget class="QLineEdit" name="customLineEdit" />
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0" colspan="2" >
|
||||||
|
<widget class="QTextEdit" name="entryTextEdit" />
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0" >
|
||||||
|
<layout class="QHBoxLayout" >
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="addButton" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Add Entry</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon" >
|
||||||
|
<iconset resource="../images.qrc" >:/images/add_24x24.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer>
|
||||||
|
<property name="orientation" >
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" >
|
||||||
|
<size>
|
||||||
|
<width>71</width>
|
||||||
|
<height>28</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="moveDownButton" >
|
||||||
|
<property name="layoutDirection" >
|
||||||
|
<enum>Qt::RightToLeft</enum>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>Move</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon" >
|
||||||
|
<iconset resource="../images.qrc" >:/images/down.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="moveUpButton" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Move</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon" >
|
||||||
|
<iconset resource="../images.qrc" >:/images/up.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer>
|
||||||
|
<property name="orientation" >
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" >
|
||||||
|
<size>
|
||||||
|
<width>71</width>
|
||||||
|
<height>28</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="closeButton" >
|
||||||
|
<property name="layoutDirection" >
|
||||||
|
<enum>Qt::RightToLeft</enum>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>Close Editor</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon" >
|
||||||
|
<iconset resource="../images.qrc" >:/images/close_normal.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources>
|
||||||
|
<include location="../images.qrc" />
|
||||||
|
</resources>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
289
retroshare-gui/src/gui/profile/ProfileView.cpp
Normal file
289
retroshare-gui/src/gui/profile/ProfileView.cpp
Normal file
@ -0,0 +1,289 @@
|
|||||||
|
/****************************************************************
|
||||||
|
* RetroShare is distributed under the following license:
|
||||||
|
*
|
||||||
|
* Copyright (C) 2008 Robert Fernie
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
|
* Boston, MA 02110-1301, USA.
|
||||||
|
****************************************************************/
|
||||||
|
|
||||||
|
#include "gui/profile/ProfileView.h"
|
||||||
|
#include "gui/profile/ProfileEdit.h"
|
||||||
|
|
||||||
|
#include "rsiface/rspeers.h"
|
||||||
|
#include "rsiface/rsQblog.h"
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
#include <QContextMenuEvent>
|
||||||
|
#include <QMenu>
|
||||||
|
#include <QFile>
|
||||||
|
#include <QFileDialog>
|
||||||
|
#include <QCursor>
|
||||||
|
#include <QPoint>
|
||||||
|
#include <QMouseEvent>
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QPixmap>
|
||||||
|
#include <QPrintDialog>
|
||||||
|
|
||||||
|
|
||||||
|
/** Constructor */
|
||||||
|
ProfileView::ProfileView(QWidget *parent)
|
||||||
|
: QDialog(parent)
|
||||||
|
{
|
||||||
|
/* Invoke the Qt Designer generated object setup routine */
|
||||||
|
ui.setupUi(this);
|
||||||
|
|
||||||
|
connect( ui.photoLabel, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( imageCustomPopupMenu( QPoint ) ) );
|
||||||
|
connect( ui.profileTreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( profileCustomPopupMenu( QPoint ) ) );
|
||||||
|
connect( ui.fileTreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( fileCustomPopupMenu( QPoint ) ) );
|
||||||
|
//
|
||||||
|
|
||||||
|
// connect up the buttons.
|
||||||
|
connect(ui.closeButton, SIGNAL(clicked()), this, SLOT(closeView()));
|
||||||
|
|
||||||
|
/* Hide platform specific features */
|
||||||
|
#ifdef Q_WS_WIN
|
||||||
|
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/** context popup menus */
|
||||||
|
void ProfileView::imageCustomPopupMenu( QPoint point )
|
||||||
|
{
|
||||||
|
if (!mIsOwnId)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QMenu contextMnu( this );
|
||||||
|
QMouseEvent *mevent = new QMouseEvent( QEvent::MouseButtonPress, point, Qt::RightButton, Qt::RightButton, Qt::NoModifier );
|
||||||
|
|
||||||
|
QAction *clearImageAct = new QAction( tr( "Clear Photo" ), this );
|
||||||
|
QAction *changeImageAct = new QAction( tr( "Change Photo" ), this );
|
||||||
|
|
||||||
|
connect( clearImageAct , SIGNAL( triggered() ), this, SLOT( clearimage() ) );
|
||||||
|
connect( changeImageAct , SIGNAL( triggered() ), this, SLOT( selectimagefile() ) );
|
||||||
|
|
||||||
|
contextMnu.clear();
|
||||||
|
contextMnu.addAction( clearImageAct );
|
||||||
|
contextMnu.addAction( changeImageAct );
|
||||||
|
contextMnu.exec( mevent->globalPos() );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ProfileView::profileCustomPopupMenu( QPoint point )
|
||||||
|
{
|
||||||
|
if (!mIsOwnId)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QMenu contextMnu( this );
|
||||||
|
QMouseEvent *mevent = new QMouseEvent( QEvent::MouseButtonPress, point, Qt::RightButton, Qt::RightButton, Qt::NoModifier );
|
||||||
|
|
||||||
|
QAction *editAct = new QAction( tr( "Edit Profile" ), this );
|
||||||
|
|
||||||
|
connect( editAct , SIGNAL( triggered() ), this, SLOT( profileEdit() ) );
|
||||||
|
|
||||||
|
contextMnu.clear();
|
||||||
|
contextMnu.addAction( editAct );
|
||||||
|
contextMnu.exec( mevent->globalPos() );
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProfileView::fileCustomPopupMenu( QPoint point )
|
||||||
|
{
|
||||||
|
|
||||||
|
QMenu contextMnu( this );
|
||||||
|
QMouseEvent *mevent = new QMouseEvent( QEvent::MouseButtonPress, point, Qt::RightButton, Qt::RightButton, Qt::NoModifier );
|
||||||
|
|
||||||
|
QAction *downloadAct = NULL;
|
||||||
|
QAction *downloadAllAct = NULL;
|
||||||
|
QAction *removeAct = NULL;
|
||||||
|
QAction *clearAct = NULL;
|
||||||
|
|
||||||
|
contextMnu.clear();
|
||||||
|
|
||||||
|
if (mIsOwnId)
|
||||||
|
{
|
||||||
|
removeAct = new QAction( tr( "Remove Favourite" ), this );
|
||||||
|
clearAct = new QAction( tr( "Clear Favourites" ), this );
|
||||||
|
connect( removeAct , SIGNAL( triggered() ), this, SLOT( fileRemove() ) );
|
||||||
|
connect( clearAct , SIGNAL( triggered() ), this, SLOT( filesClear() ) );
|
||||||
|
|
||||||
|
contextMnu.addAction( clearAct );
|
||||||
|
contextMnu.addAction( removeAct );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
downloadAct = new QAction( tr( "Download File" ), this );
|
||||||
|
downloadAllAct = new QAction( tr( "Download All" ), this );
|
||||||
|
connect( downloadAct , SIGNAL( triggered() ), this, SLOT( fileDownload() ) );
|
||||||
|
connect( downloadAllAct , SIGNAL( triggered() ), this, SLOT( filesDownloadAll() ) );
|
||||||
|
|
||||||
|
contextMnu.addAction( downloadAct );
|
||||||
|
contextMnu.addAction( downloadAllAct );
|
||||||
|
}
|
||||||
|
|
||||||
|
contextMnu.exec( mevent->globalPos() );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ProfileView::setPeerId(std::string id)
|
||||||
|
{
|
||||||
|
pId = id;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ProfileView::expand()
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ProfileView::closeView()
|
||||||
|
{
|
||||||
|
close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ProfileView::clear()
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProfileView::update()
|
||||||
|
{
|
||||||
|
/* load it up! */
|
||||||
|
|
||||||
|
/* if id bad -> clear */
|
||||||
|
|
||||||
|
//if (ownId)
|
||||||
|
//{
|
||||||
|
// isOwnId = true;
|
||||||
|
//}
|
||||||
|
|
||||||
|
mIsOwnId = true; /* switche on context menues */
|
||||||
|
|
||||||
|
if (!rsQblog)
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t PostTs;
|
||||||
|
std::wstring BlogPost;
|
||||||
|
std::list< std::pair<std::wstring, std::wstring> > profile;
|
||||||
|
std::list< std::pair<std::wstring, std::wstring> >::iterator pit;
|
||||||
|
std::list<FileInfo> files;
|
||||||
|
std::list<FileInfo>::iterator fit;
|
||||||
|
|
||||||
|
rsQblog -> getPeerLatestBlog(pId, PostTs, BlogPost);
|
||||||
|
rsQblog -> getPeerProfile(pId, profile);
|
||||||
|
rsQblog -> getPeerFavourites(pId, files);
|
||||||
|
|
||||||
|
ui.idLineEdit->setText(QString::fromStdString(pId));
|
||||||
|
ui.nameLineEdit->setText(QString::fromStdString("username"));
|
||||||
|
{
|
||||||
|
std::ostringstream out;
|
||||||
|
out << PostTs;
|
||||||
|
ui.timeLineEdit->setText(QString::fromStdString(out.str()));
|
||||||
|
}
|
||||||
|
ui.postTextEdit->setHtml(QString::fromStdWString(BlogPost));
|
||||||
|
|
||||||
|
QList<QTreeWidgetItem *> itemList;
|
||||||
|
for(pit = profile.begin(); pit != profile.end(); pit++)
|
||||||
|
{
|
||||||
|
QTreeWidgetItem *item = new QTreeWidgetItem();
|
||||||
|
item->setText(0, QString::fromStdWString(pit->first));
|
||||||
|
item->setText(1, QString::fromStdWString(pit->second));
|
||||||
|
|
||||||
|
itemList.push_back(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
ui.profileTreeWidget->clear();
|
||||||
|
ui.profileTreeWidget->insertTopLevelItems(0, itemList);
|
||||||
|
|
||||||
|
QList<QTreeWidgetItem *> fileList;
|
||||||
|
for(fit = files.begin(); fit != files.end(); fit++)
|
||||||
|
{
|
||||||
|
QTreeWidgetItem *item = new QTreeWidgetItem();
|
||||||
|
item->setText(0, QString::fromStdString(fit->fname));
|
||||||
|
{
|
||||||
|
std::ostringstream out;
|
||||||
|
out << fit-> size;
|
||||||
|
item->setText(1, QString::fromStdString(out.str()));
|
||||||
|
}
|
||||||
|
item->setText(2, QString::fromStdString(fit->hash));
|
||||||
|
|
||||||
|
fileList.push_back(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
ui.fileTreeWidget->clear();
|
||||||
|
ui.fileTreeWidget->insertTopLevelItems(0, fileList);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* For context Menus */
|
||||||
|
/* Image Context Menu */
|
||||||
|
void ProfileView::selectimagefile()
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProfileView::clearimage()
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* for Profile */
|
||||||
|
void ProfileView::profileEdit()
|
||||||
|
{
|
||||||
|
static ProfileEdit *edit = new ProfileEdit(NULL);
|
||||||
|
edit->update();
|
||||||
|
edit->show();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* for Favourite Files */
|
||||||
|
void ProfileView::fileDownload()
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProfileView::filesDownloadAll()
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ProfileView::fileRemove()
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProfileView::filesClear()
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* add must be done from Shared Files */
|
||||||
|
|
||||||
|
|
86
retroshare-gui/src/gui/profile/ProfileView.h
Normal file
86
retroshare-gui/src/gui/profile/ProfileView.h
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
/****************************************************************
|
||||||
|
* RetroShare is distributed under the following license:
|
||||||
|
*
|
||||||
|
* Copyright (C) 2007, RetroShare Team
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
|
* Boston, MA 02110-1301, USA.
|
||||||
|
****************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _PROFILE_VIEW_H
|
||||||
|
#define _PROFILE_VIEW_H
|
||||||
|
|
||||||
|
#include "ui_ProfileView.h"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
class ProfileView : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
/** Default Constructor */
|
||||||
|
|
||||||
|
ProfileView(QWidget *parent = 0);
|
||||||
|
/** Default Destructor */
|
||||||
|
|
||||||
|
void setPeerId(std::string id);
|
||||||
|
|
||||||
|
void clear();
|
||||||
|
void update();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
|
||||||
|
/** context popup menus */
|
||||||
|
void imageCustomPopupMenu( QPoint point );
|
||||||
|
void profileCustomPopupMenu( QPoint point );
|
||||||
|
void fileCustomPopupMenu( QPoint point );
|
||||||
|
|
||||||
|
/* For context Menus */
|
||||||
|
/* Image Context Menu */
|
||||||
|
void selectimagefile();
|
||||||
|
void clearimage();
|
||||||
|
|
||||||
|
/* for Profile */
|
||||||
|
void profileEdit();
|
||||||
|
|
||||||
|
/* for Favourite Files */
|
||||||
|
void fileRemove();
|
||||||
|
void filesClear();
|
||||||
|
void fileDownload();
|
||||||
|
void filesDownloadAll();
|
||||||
|
/* add must be done from Shared Files */
|
||||||
|
|
||||||
|
|
||||||
|
/* expand / close */
|
||||||
|
void expand();
|
||||||
|
void closeView();
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string pId;
|
||||||
|
bool mIsOwnId;
|
||||||
|
|
||||||
|
|
||||||
|
/** Qt Designer generated object */
|
||||||
|
Ui::ProfileView ui;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
248
retroshare-gui/src/gui/profile/ProfileView.ui
Normal file
248
retroshare-gui/src/gui/profile/ProfileView.ui
Normal file
@ -0,0 +1,248 @@
|
|||||||
|
<ui version="4.0" >
|
||||||
|
<class>ProfileView</class>
|
||||||
|
<widget class="QWidget" name="ProfileView" >
|
||||||
|
<property name="geometry" >
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>590</width>
|
||||||
|
<height>574</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle" >
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<property name="layoutDirection" >
|
||||||
|
<enum>Qt::LeftToRight</enum>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" >
|
||||||
|
<item row="0" column="0" colspan="2" >
|
||||||
|
<widget class="QSplitter" name="splitter" >
|
||||||
|
<property name="orientation" >
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="" >
|
||||||
|
<layout class="QGridLayout" >
|
||||||
|
<item row="0" column="0" colspan="2" >
|
||||||
|
<layout class="QHBoxLayout" >
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_2" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Rs ID</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="idLineEdit" >
|
||||||
|
<property name="readOnly" >
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2" >
|
||||||
|
<layout class="QHBoxLayout" >
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_3" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Name</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="nameLineEdit" >
|
||||||
|
<property name="readOnly" >
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0" >
|
||||||
|
<layout class="QVBoxLayout" >
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="photoLabel" >
|
||||||
|
<property name="minimumSize" >
|
||||||
|
<size>
|
||||||
|
<width>128</width>
|
||||||
|
<height>128</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize" >
|
||||||
|
<size>
|
||||||
|
<width>128</width>
|
||||||
|
<height>128</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="contextMenuPolicy" >
|
||||||
|
<enum>Qt::CustomContextMenu</enum>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="pixmap" >
|
||||||
|
<pixmap resource="../images.qrc" >:/images/ddeny.png</pixmap>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer>
|
||||||
|
<property name="orientation" >
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" >
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1" colspan="2" >
|
||||||
|
<layout class="QVBoxLayout" >
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" >
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_4" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Last Post:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="timeLineEdit" >
|
||||||
|
<property name="readOnly" >
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QTextEdit" name="postTextEdit" >
|
||||||
|
<property name="maximumSize" >
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>128</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="layoutWidget" >
|
||||||
|
<layout class="QVBoxLayout" >
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_6" >
|
||||||
|
<property name="font" >
|
||||||
|
<font>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>Profile</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QTreeWidget" name="profileTreeWidget" >
|
||||||
|
<property name="contextMenuPolicy" >
|
||||||
|
<enum>Qt::CustomContextMenu</enum>
|
||||||
|
</property>
|
||||||
|
<property name="rootIsDecorated" >
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<column>
|
||||||
|
<property name="text" >
|
||||||
|
<string>Category</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text" >
|
||||||
|
<string>Thoughts</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="" >
|
||||||
|
<layout class="QVBoxLayout" >
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_5" >
|
||||||
|
<property name="font" >
|
||||||
|
<font>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>Favourite Files</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QTreeWidget" name="fileTreeWidget" >
|
||||||
|
<property name="contextMenuPolicy" >
|
||||||
|
<enum>Qt::CustomContextMenu</enum>
|
||||||
|
</property>
|
||||||
|
<column>
|
||||||
|
<property name="text" >
|
||||||
|
<string>Name</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text" >
|
||||||
|
<string>Size</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text" >
|
||||||
|
<string>Hash</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0" >
|
||||||
|
<spacer>
|
||||||
|
<property name="orientation" >
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" >
|
||||||
|
<size>
|
||||||
|
<width>241</width>
|
||||||
|
<height>28</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1" >
|
||||||
|
<widget class="QPushButton" name="closeButton" >
|
||||||
|
<property name="layoutDirection" >
|
||||||
|
<enum>Qt::RightToLeft</enum>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>Close Profile</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon" >
|
||||||
|
<iconset resource="../images.qrc" >:/images/close_normal.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources>
|
||||||
|
<include location="../images.qrc" />
|
||||||
|
</resources>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
Loading…
Reference in New Issue
Block a user