mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-05 23:55:35 -04:00
- Removed not used function RsDirUtil::createBackup.
- Moved ProfileView and ProfileEdit to the folder unfinished. - Removed "location:" before the ssl name in FriendsDialog and MessengerWindow. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4567 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
39708cdd0b
commit
d25730eabb
12 changed files with 25 additions and 17 deletions
128
retroshare-gui/src/gui/unfinished/profile/ProfileEdit.cpp
Normal file
128
retroshare-gui/src/gui/unfinished/profile/ProfileEdit.cpp
Normal file
|
@ -0,0 +1,128 @@
|
|||
/****************************************************************
|
||||
* 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 <retroshare/rspeers.h>
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include <QMenu>
|
||||
|
||||
|
||||
/** 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 );
|
||||
|
||||
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.addAction( removeAct );
|
||||
contextMnu.addAction( moveupAct );
|
||||
contextMnu.addAction( movedownAct );
|
||||
|
||||
contextMnu.exec(QCursor::pos());
|
||||
}
|
||||
|
||||
void ProfileEdit::clear()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void ProfileEdit::update()
|
||||
{
|
||||
/* load it up! */
|
||||
std::string pId = "OwnId";
|
||||
|
||||
std::list< std::pair<std::wstring, std::wstring> > profile;
|
||||
std::list< std::pair<std::wstring, std::wstring> >::iterator pit;
|
||||
|
||||
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/unfinished/profile/ProfileEdit.h
Normal file
67
retroshare-gui/src/gui/unfinished/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
|
||||
|
221
retroshare-gui/src/gui/unfinished/profile/ProfileEdit.ui
Normal file
221
retroshare-gui/src/gui/unfinished/profile/ProfileEdit.ui
Normal file
|
@ -0,0 +1,221 @@
|
|||
<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>Profile Edit</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">
|
||||
<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">
|
||||
<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" >
|
||||
<normaloff>:/images/add_24x24.png</normaloff>:/images/add_24x24.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<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" >
|
||||
<normaloff>:/images/down.png</normaloff>:/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" >
|
||||
<normaloff>:/images/up.png</normaloff>:/images/up.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<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" >
|
||||
<normaloff>:/images/close_normal.png</normaloff>:/images/close_normal.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../images.qrc" />
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
311
retroshare-gui/src/gui/unfinished/profile/ProfileView.cpp
Normal file
311
retroshare-gui/src/gui/unfinished/profile/ProfileView.cpp
Normal file
|
@ -0,0 +1,311 @@
|
|||
/****************************************************************
|
||||
* 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 <retroshare/rspeers.h>
|
||||
#include <retroshare/rsmsgs.h>
|
||||
|
||||
#include <sstream>
|
||||
|
||||
//#include <QContextMenuEvent>
|
||||
#include <QMenu>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
|
||||
|
||||
/** 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()));
|
||||
connect(ui.profileditButton, SIGNAL(clicked()), this, SLOT(profileEdit()));
|
||||
|
||||
loadAvatar();
|
||||
|
||||
/* Hide platform specific features */
|
||||
#ifdef Q_WS_WIN
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/** context popup menus */
|
||||
void ProfileView::imageCustomPopupMenu( QPoint /*point*/ )
|
||||
{
|
||||
if (!mIsOwnId)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QMenu contextMnu( this );
|
||||
|
||||
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.addAction( clearImageAct );
|
||||
contextMnu.addAction( changeImageAct );
|
||||
|
||||
contextMnu.exec(QCursor::pos());
|
||||
}
|
||||
|
||||
|
||||
void ProfileView::profileCustomPopupMenu( QPoint /*point*/ )
|
||||
{
|
||||
if (!mIsOwnId)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QMenu contextMnu( this );
|
||||
|
||||
QAction *editAct = new QAction( tr( "Edit Profile" ), this );
|
||||
connect( editAct , SIGNAL( triggered() ), this, SLOT( profileEdit() ) );
|
||||
|
||||
contextMnu.addAction( editAct );
|
||||
|
||||
contextMnu.exec(QCursor::pos());
|
||||
}
|
||||
|
||||
void ProfileView::fileCustomPopupMenu( QPoint /*point*/ )
|
||||
{
|
||||
QMenu contextMnu( this );
|
||||
|
||||
QAction *downloadAct = NULL;
|
||||
QAction *downloadAllAct = NULL;
|
||||
QAction *removeAct = NULL;
|
||||
QAction *clearAct = NULL;
|
||||
|
||||
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(QCursor::pos());
|
||||
}
|
||||
|
||||
|
||||
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 */
|
||||
|
||||
|
||||
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;
|
||||
|
||||
RsPeerDetails detail;
|
||||
if (!rsPeers->getPeerDetails(pId, detail))
|
||||
{
|
||||
QMessageBox::information(this,
|
||||
tr("RetroShare"),
|
||||
tr("Error : cannot get peer details."));
|
||||
}
|
||||
|
||||
|
||||
ui.idLineEdit->setText(QString::fromStdString(pId));
|
||||
ui.nameLineEdit->setText(QString::fromUtf8(detail.name.c_str()));
|
||||
{
|
||||
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()
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(this, "Load File",
|
||||
QDir::homePath(),
|
||||
"Pictures (*.png *.xpm *.jpg)");
|
||||
if(!fileName.isEmpty())
|
||||
{
|
||||
picture = QPixmap(fileName).scaled(108,108, Qt::IgnoreAspectRatio,Qt::SmoothTransformation);
|
||||
ui.photoLabel->setPixmap(picture);
|
||||
}
|
||||
}
|
||||
|
||||
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 */
|
||||
|
||||
void ProfileView::loadAvatar()
|
||||
{
|
||||
|
||||
unsigned char *data = NULL;
|
||||
int size = 0 ;
|
||||
|
||||
rsMsgs->getAvatarData(pId,data,size);
|
||||
|
||||
|
||||
if(size != 0)
|
||||
{
|
||||
// set the image
|
||||
QPixmap pix ;
|
||||
pix.loadFromData(data,size,"PNG") ;
|
||||
ui.photoLabel->setPixmap(pix);
|
||||
delete[] data ;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.photoLabel->setPixmap(QPixmap(":/images/user/personal64.png"));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
90
retroshare-gui/src/gui/unfinished/profile/ProfileView.h
Normal file
90
retroshare-gui/src/gui/unfinished/profile/ProfileView.h
Normal file
|
@ -0,0 +1,90 @@
|
|||
/****************************************************************
|
||||
* 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();
|
||||
void loadAvatar();
|
||||
|
||||
|
||||
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;
|
||||
|
||||
QPixmap picture;
|
||||
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::ProfileView ui;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
301
retroshare-gui/src/gui/unfinished/profile/ProfileView.ui
Normal file
301
retroshare-gui/src/gui/unfinished/profile/ProfileView.ui
Normal file
|
@ -0,0 +1,301 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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>464</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Profile View</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0" rowspan="3">
|
||||
<widget class="QLabel" name="photoLabel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>100</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>100</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QLabel#photoLabel{
|
||||
border-image: url(:/images/avatar_background.png);
|
||||
}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../images.qrc">:/images/user/personal64.png</pixmap>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<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="1">
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Peer ID</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="idLineEdit">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>408</width>
|
||||
<height>28</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0" 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>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="horizontalSpacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:600; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16pt; vertical-align:sub;">Profile</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>368</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QToolButton" name="profileditButton">
|
||||
<property name="toolTip">
|
||||
<string>Edit Profile</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/user/kuser24.png</normaloff>:/images/user/kuser24.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3">
|
||||
<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>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<layout class="QVBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<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>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>241</width>
|
||||
<height>28</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="4" 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">
|
||||
<normaloff>:/images/close_normal.png</normaloff>:/images/close_normal.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../images.qrc"/>
|
||||
<include location="../images.qrc"/>
|
||||
<include location="../images.qrc"/>
|
||||
<include location="../images.qrc"/>
|
||||
<include location="../images.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
Loading…
Add table
Add a link
Reference in a new issue