mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 07:29:33 -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/rspeers.h" //to retrieve peer/usrId info
|
||||
|
||||
#include "profile/ProfileView.h"
|
||||
|
||||
/** Constructor */
|
||||
BlogDialog::BlogDialog(QWidget *parent)
|
||||
: MainPage (parent)
|
||||
@ -39,6 +41,8 @@ BlogDialog::BlogDialog(QWidget *parent)
|
||||
connect(italicBtn, SIGNAL(clicked()), this, SLOT(setFont()));
|
||||
connect(refreshBtn, SIGNAL(clicked()), this, SLOT(update()));
|
||||
|
||||
connect(userList, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( peerCustomPopupMenu( QPoint ) ) );
|
||||
|
||||
/* Current Font */
|
||||
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()
|
||||
{
|
||||
QString blogMsg = lineEdit->toPlainText();
|
||||
|
@ -35,7 +35,7 @@ public:
|
||||
/** Default Destructor */
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::BlogDialog ui;
|
||||
//Ui::BlogDialog ui;
|
||||
|
||||
public slots:
|
||||
void sendBlog();
|
||||
@ -44,9 +44,17 @@ public slots:
|
||||
/// populates blog service with current information from core
|
||||
void update();
|
||||
|
||||
void showprofile(std::string id);
|
||||
|
||||
private slots:
|
||||
/*nothing here yet */
|
||||
|
||||
/** context popup menus */
|
||||
void peerCustomPopupMenu( QPoint point );
|
||||
|
||||
/* peer ContextMenu Actions */
|
||||
void showuserprofile();
|
||||
void showoneblog();
|
||||
void showallblogs();
|
||||
|
||||
private:
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
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