mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-18 04:14:28 -05:00
Update notifications for Links Cloud and Photo Show.
Improvements to the Photo system. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@382 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
fb229c96da
commit
5410a20756
@ -61,6 +61,7 @@ HEADERS += rshare.h \
|
|||||||
gui/ExampleDialog.h \
|
gui/ExampleDialog.h \
|
||||||
gui/GamesDialog.h \
|
gui/GamesDialog.h \
|
||||||
gui/PhotoDialog.h \
|
gui/PhotoDialog.h \
|
||||||
|
gui/PhotoShow.h \
|
||||||
gui/LinksDialog.h \
|
gui/LinksDialog.h \
|
||||||
gui/NetworkView.h \
|
gui/NetworkView.h \
|
||||||
gui/MessengerWindow.h \
|
gui/MessengerWindow.h \
|
||||||
@ -150,6 +151,7 @@ FORMS += gui/ChatDialog.ui \
|
|||||||
gui/ExampleDialog.ui \
|
gui/ExampleDialog.ui \
|
||||||
gui/GamesDialog.ui \
|
gui/GamesDialog.ui \
|
||||||
gui/PhotoDialog.ui \
|
gui/PhotoDialog.ui \
|
||||||
|
gui/PhotoShow.ui \
|
||||||
gui/LinksDialog.ui \
|
gui/LinksDialog.ui \
|
||||||
gui/NetworkView.ui \
|
gui/NetworkView.ui \
|
||||||
gui/MessengerWindow.ui \
|
gui/MessengerWindow.ui \
|
||||||
@ -213,6 +215,7 @@ SOURCES += main.cpp \
|
|||||||
gui/ExampleDialog.cpp \
|
gui/ExampleDialog.cpp \
|
||||||
gui/GamesDialog.cpp \
|
gui/GamesDialog.cpp \
|
||||||
gui/PhotoDialog.cpp \
|
gui/PhotoDialog.cpp \
|
||||||
|
gui/PhotoShow.cpp \
|
||||||
gui/LinksDialog.cpp \
|
gui/LinksDialog.cpp \
|
||||||
gui/NetworkView.cpp \
|
gui/NetworkView.cpp \
|
||||||
gui/MessengerWindow.cpp \
|
gui/MessengerWindow.cpp \
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
/* Images for context menu icons */
|
/* Images for context menu icons */
|
||||||
#define IMAGE_REMOVEFRIEND ":/images/removefriend16.png"
|
#define IMAGE_REMOVEFRIEND ":/images/removefriend16.png"
|
||||||
@ -100,10 +100,34 @@ LinksDialog::LinksDialog(QWidget *parent)
|
|||||||
_header->resizeSection ( 1, 50 );
|
_header->resizeSection ( 1, 50 );
|
||||||
_header->resizeSection ( 2, 150 );
|
_header->resizeSection ( 2, 150 );
|
||||||
|
|
||||||
|
|
||||||
|
/* Set a GUI update timer - much cleaner than
|
||||||
|
* doing everything through the notify agent
|
||||||
|
*/
|
||||||
|
|
||||||
|
QTimer *timer = new QTimer(this);
|
||||||
|
timer->connect(timer, SIGNAL(timeout()), this, SLOT(checkUpdate()));
|
||||||
|
timer->start(1000);
|
||||||
|
|
||||||
/* Hide platform specific features */
|
/* Hide platform specific features */
|
||||||
#ifdef Q_WS_WIN
|
#ifdef Q_WS_WIN
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void LinksDialog::checkUpdate()
|
||||||
|
{
|
||||||
|
/* update */
|
||||||
|
if (!rsRanks)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (rsRanks->updated())
|
||||||
|
{
|
||||||
|
updateLinks();
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LinksDialog::linkTreeWidgetCostumPopupMenu( QPoint point )
|
void LinksDialog::linkTreeWidgetCostumPopupMenu( QPoint point )
|
||||||
|
@ -58,6 +58,8 @@ void toggleWindows( void );
|
|||||||
void openLink ( QTreeWidgetItem * item, int column );
|
void openLink ( QTreeWidgetItem * item, int column );
|
||||||
void changedItem(QTreeWidgetItem *curr, QTreeWidgetItem *prev);
|
void changedItem(QTreeWidgetItem *curr, QTreeWidgetItem *prev);
|
||||||
|
|
||||||
|
void checkUpdate();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void updateComments(std::string rid, std::string pid);
|
void updateComments(std::string rid, std::string pid);
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include "common/vmessagebox.h"
|
#include "common/vmessagebox.h"
|
||||||
|
|
||||||
#include "PhotoDialog.h"
|
#include "PhotoDialog.h"
|
||||||
|
#include "PhotoShow.h"
|
||||||
#include "rsiface/rspeers.h"
|
#include "rsiface/rspeers.h"
|
||||||
#include "rsiface/rsphoto.h"
|
#include "rsiface/rsphoto.h"
|
||||||
|
|
||||||
@ -38,6 +39,7 @@
|
|||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
|
|
||||||
/* Images for context menu icons */
|
/* Images for context menu icons */
|
||||||
@ -58,11 +60,14 @@
|
|||||||
#define PHOTO_PEER_COL_SID 4
|
#define PHOTO_PEER_COL_SID 4
|
||||||
#define PHOTO_PEER_COL_PHOTOID 5
|
#define PHOTO_PEER_COL_PHOTOID 5
|
||||||
|
|
||||||
|
|
||||||
#define PHOTO_LIST_COL_PHOTO 0
|
#define PHOTO_LIST_COL_PHOTO 0
|
||||||
#define PHOTO_LIST_COL_COMMENT 1
|
#define PHOTO_LIST_COL_NAME 1
|
||||||
#define PHOTO_LIST_COL_PHOTOID 2
|
#define PHOTO_LIST_COL_COMMENT 2
|
||||||
|
#define PHOTO_LIST_COL_DATE 3
|
||||||
|
#define PHOTO_LIST_COL_LOCATION 4
|
||||||
|
#define PHOTO_LIST_COL_SIZE 5
|
||||||
|
#define PHOTO_LIST_COL_PEERID 6
|
||||||
|
#define PHOTO_LIST_COL_PHOTOID 7
|
||||||
|
|
||||||
|
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
@ -77,10 +82,8 @@ PhotoDialog::PhotoDialog(QWidget *parent)
|
|||||||
|
|
||||||
connect( ui.peerTreeWidget, SIGNAL( currentItemChanged ( QTreeWidgetItem * , QTreeWidgetItem * ) ), this, SLOT( updatePhotoList( ) ) );
|
connect( ui.peerTreeWidget, SIGNAL( currentItemChanged ( QTreeWidgetItem * , QTreeWidgetItem * ) ), this, SLOT( updatePhotoList( ) ) );
|
||||||
|
|
||||||
//connect( ui.photoTreeWidget, SIGNAL( currentItemChanged ( QTreeWidgetItem * , QTreeWidgetItem * ) ), this, SLOT( displayPhoto( ) ) );
|
connect( ui.photoTreeWidget, SIGNAL( itemDoubleClicked ( QTreeWidgetItem * , int ) ), this, SLOT( showPhoto( QTreeWidgetItem *, int ) ) );
|
||||||
//connect( ui.addPhotoButton, SIGNAL( clicked( ) ), this, SLOT( addPhotos( ) ) );
|
connect( ui.addButton, SIGNAL( clicked( ) ), this, SLOT( addPhotos( ) ) );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* hide the Tree +/- */
|
/* hide the Tree +/- */
|
||||||
ui.photoTreeWidget -> setRootIsDecorated( false );
|
ui.photoTreeWidget -> setRootIsDecorated( false );
|
||||||
@ -116,12 +119,36 @@ PhotoDialog::PhotoDialog(QWidget *parent)
|
|||||||
// _header->resizeSection ( 10, 100 );
|
// _header->resizeSection ( 10, 100 );
|
||||||
|
|
||||||
|
|
||||||
|
/* Set a GUI update timer - much cleaner than
|
||||||
|
* doing everything through the notify agent
|
||||||
|
*/
|
||||||
|
|
||||||
|
QTimer *timer = new QTimer(this);
|
||||||
|
timer->connect(timer, SIGNAL(timeout()), this, SLOT(checkUpdate()));
|
||||||
|
timer->start(1000);
|
||||||
|
|
||||||
/* Hide platform specific features */
|
/* Hide platform specific features */
|
||||||
#ifdef Q_WS_WIN
|
#ifdef Q_WS_WIN
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PhotoDialog::checkUpdate()
|
||||||
|
{
|
||||||
|
/* update */
|
||||||
|
if (!rsPhoto)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (rsPhoto->updated())
|
||||||
|
{
|
||||||
|
insertShowLists();
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void PhotoDialog::peerTreeWidgetCustomPopupMenu( QPoint point )
|
void PhotoDialog::peerTreeWidgetCustomPopupMenu( QPoint point )
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -240,12 +267,15 @@ void PhotoDialog::addShows(std::string id)
|
|||||||
|
|
||||||
void PhotoDialog::updatePhotoList()
|
void PhotoDialog::updatePhotoList()
|
||||||
{
|
{
|
||||||
|
std::cerr << "PhotoDialog::updatePhotoList()" << std::endl;
|
||||||
|
|
||||||
/* get current item */
|
/* get current item */
|
||||||
QTreeWidgetItem *item = ui.peerTreeWidget->currentItem();
|
QTreeWidgetItem *item = ui.peerTreeWidget->currentItem();
|
||||||
|
|
||||||
if (!item)
|
if (!item)
|
||||||
{
|
{
|
||||||
/* leave current list */
|
/* leave current list */
|
||||||
|
std::cerr << "PhotoDialog::updatePhotoList() No Current item -> leave" << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -256,9 +286,11 @@ void PhotoDialog::updatePhotoList()
|
|||||||
if ((mCurrentPID == pid) && (mCurrentSID == sid))
|
if ((mCurrentPID == pid) && (mCurrentSID == sid))
|
||||||
{
|
{
|
||||||
/* still good */
|
/* still good */
|
||||||
|
std::cerr << "PhotoDialog::updatePhotoList() List still good!" << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::cerr << "PhotoDialog::updatePhotoList() pid: " << pid << " sid: " << sid << std::endl;
|
||||||
/* get the list of photos */
|
/* get the list of photos */
|
||||||
|
|
||||||
ui.photoTreeWidget->clear();
|
ui.photoTreeWidget->clear();
|
||||||
@ -266,6 +298,7 @@ void PhotoDialog::updatePhotoList()
|
|||||||
|
|
||||||
if (sid != "")
|
if (sid != "")
|
||||||
{
|
{
|
||||||
|
std::cerr << "PhotoDialog::updatePhotoList() SID -> showing show" << std::endl;
|
||||||
/* load up show list */
|
/* load up show list */
|
||||||
RsPhotoShowDetails detail;
|
RsPhotoShowDetails detail;
|
||||||
rsPhoto->getShowDetails(pid, sid, detail);
|
rsPhoto->getShowDetails(pid, sid, detail);
|
||||||
@ -278,6 +311,7 @@ void PhotoDialog::updatePhotoList()
|
|||||||
|
|
||||||
if (!rsPhoto->getPhotoDetails(pid, sit->photoId, photoDetail))
|
if (!rsPhoto->getPhotoDetails(pid, sit->photoId, photoDetail))
|
||||||
{
|
{
|
||||||
|
std::cerr << "PhotoDialog::updatePhotoList() getPhotoDetails: " << sit->photoId << " FAILED" << std::endl;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -296,8 +330,18 @@ void PhotoDialog::updatePhotoList()
|
|||||||
photoItem->setText(PHOTO_LIST_COL_PHOTO, "Photo Not Available");
|
photoItem->setText(PHOTO_LIST_COL_PHOTO, "Photo Not Available");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
photoItem->setText(PHOTO_LIST_COL_NAME,
|
||||||
|
QString::fromStdString(photoDetail.name));
|
||||||
photoItem->setText(PHOTO_LIST_COL_COMMENT,
|
photoItem->setText(PHOTO_LIST_COL_COMMENT,
|
||||||
QString::fromStdWString(photoDetail.comment));
|
QString::fromStdWString(photoDetail.comment));
|
||||||
|
photoItem->setText(PHOTO_LIST_COL_DATE,
|
||||||
|
QString::fromStdString(photoDetail.date));
|
||||||
|
photoItem->setText(PHOTO_LIST_COL_LOCATION,
|
||||||
|
QString::fromStdString(photoDetail.location));
|
||||||
|
photoItem->setText(PHOTO_LIST_COL_SIZE,
|
||||||
|
QString::number(photoDetail.size));
|
||||||
|
photoItem->setText(PHOTO_LIST_COL_PEERID,
|
||||||
|
QString::fromStdString(photoDetail.id));
|
||||||
photoItem->setText(PHOTO_LIST_COL_PHOTOID,
|
photoItem->setText(PHOTO_LIST_COL_PHOTOID,
|
||||||
QString::fromStdString(photoDetail.hash));
|
QString::fromStdString(photoDetail.hash));
|
||||||
|
|
||||||
@ -306,9 +350,62 @@ void PhotoDialog::updatePhotoList()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
std::cerr << "PhotoDialog::updatePhotoList() No SID -> show all" << std::endl;
|
||||||
|
|
||||||
|
std::list<std::string> photoIds;
|
||||||
|
std::list<std::string>::iterator pit;
|
||||||
|
rsPhoto->getPhotoList(pid, photoIds);
|
||||||
|
for(pit = photoIds.begin(); pit != photoIds.end(); pit++)
|
||||||
|
{
|
||||||
|
RsPhotoDetails photoDetail;
|
||||||
|
|
||||||
|
if (!rsPhoto->getPhotoDetails(pid, *pit, photoDetail))
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoDialog::updatePhotoList() getPhotoDetails: " << *pit << " FAILED" << std::endl;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
QTreeWidgetItem *photoItem = new QTreeWidgetItem((QTreeWidget*)0);
|
||||||
|
if (photoDetail.isAvailable)
|
||||||
|
{
|
||||||
|
QPixmap qpp(QString::fromStdString(photoDetail.path));
|
||||||
|
photoItem->setIcon(PHOTO_LIST_COL_PHOTO,
|
||||||
|
QIcon(qpp.scaledToHeight(PHOTO_ICON_SIZE)));
|
||||||
|
|
||||||
|
QSize iconSize(PHOTO_ICON_SIZE + 10,PHOTO_ICON_SIZE + 10);
|
||||||
|
photoItem->setSizeHint(PHOTO_LIST_COL_PHOTO, iconSize);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
photoItem->setText(PHOTO_LIST_COL_PHOTO, "Photo Not Available");
|
||||||
|
}
|
||||||
|
|
||||||
|
photoItem->setText(PHOTO_LIST_COL_NAME,
|
||||||
|
QString::fromStdString(photoDetail.name));
|
||||||
|
photoItem->setText(PHOTO_LIST_COL_COMMENT,
|
||||||
|
QString::fromStdWString(photoDetail.comment));
|
||||||
|
photoItem->setText(PHOTO_LIST_COL_DATE,
|
||||||
|
QString::fromStdString(photoDetail.date));
|
||||||
|
photoItem->setText(PHOTO_LIST_COL_LOCATION,
|
||||||
|
QString::fromStdString(photoDetail.location));
|
||||||
|
photoItem->setText(PHOTO_LIST_COL_SIZE,
|
||||||
|
QString::number(photoDetail.size));
|
||||||
|
photoItem->setText(PHOTO_LIST_COL_PEERID,
|
||||||
|
QString::fromStdString(photoDetail.id));
|
||||||
|
photoItem->setText(PHOTO_LIST_COL_PHOTOID,
|
||||||
|
QString::fromStdString(photoDetail.hash));
|
||||||
|
|
||||||
|
|
||||||
|
std::cerr << "PhotoDialog::updatePhotoList() added Item: " << *pit << std::endl;
|
||||||
|
items.append(photoItem);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* update ids? */
|
||||||
|
mCurrentPID = pid;
|
||||||
|
mCurrentSID = sid;
|
||||||
|
|
||||||
/* add the items in! */
|
/* add the items in! */
|
||||||
ui.photoTreeWidget->insertTopLevelItems(0, items);
|
ui.photoTreeWidget->insertTopLevelItems(0, items);
|
||||||
ui.photoTreeWidget->update();
|
ui.photoTreeWidget->update();
|
||||||
@ -371,69 +468,26 @@ void PhotoDialog::addPhotos()
|
|||||||
|
|
||||||
void PhotoDialog::addPhoto(QString filename)
|
void PhotoDialog::addPhoto(QString filename)
|
||||||
{
|
{
|
||||||
/* load pixmap */
|
/* store in rsPhoto */
|
||||||
|
std::string photoId = rsPhoto->addPhoto(filename.toStdString());
|
||||||
|
|
||||||
/* add QTreeWidgetItem */
|
|
||||||
QPixmap *qpp = new QPixmap(filename);
|
|
||||||
|
|
||||||
/* store in map */
|
|
||||||
photoMap[filename] = qpp;
|
|
||||||
|
|
||||||
/* add treeitem */
|
|
||||||
QTreeWidgetItem *item = new QTreeWidgetItem(NULL);
|
|
||||||
|
|
||||||
/* */
|
|
||||||
item->setText(0, "Yourself");
|
|
||||||
item->setText(2, filename);
|
|
||||||
|
|
||||||
item->setIcon(1, QIcon(qpp->scaledToHeight(PHOTO_ICON_SIZE)));
|
|
||||||
QSize iconSize(PHOTO_ICON_SIZE + 10,PHOTO_ICON_SIZE + 10);
|
|
||||||
item->setSizeHint(1, iconSize);
|
|
||||||
|
|
||||||
|
|
||||||
//item->setIcon(1, QIcon(*qpp));
|
|
||||||
|
|
||||||
ui.photoTreeWidget->insertTopLevelItem (0, item);
|
|
||||||
|
|
||||||
showPhoto(filename);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhotoDialog::updatePhoto()
|
void PhotoDialog::showPhoto( QTreeWidgetItem *item, int column)
|
||||||
{
|
{
|
||||||
/* load pixmap */
|
|
||||||
|
|
||||||
QTreeWidgetItem *item = ui.photoTreeWidget->currentItem();
|
|
||||||
if (!item)
|
if (!item)
|
||||||
{
|
|
||||||
showPhoto("");
|
|
||||||
}
|
|
||||||
|
|
||||||
showPhoto(item->text(2));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void PhotoDialog::showPhoto(QString filename)
|
|
||||||
{
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* find in map */
|
|
||||||
std::map<QString, QPixmap *>::iterator it;
|
|
||||||
it = photoMap.find(filename);
|
|
||||||
if (it == photoMap.end())
|
|
||||||
{
|
|
||||||
ui.photoPixLabel->clear();
|
|
||||||
ui.photoPixLabel->setText("No Photo Selected");
|
|
||||||
ui.photoNameLabel->setText("No Photo File Selected");
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
QSize diaSize = ui.photoTreeWidget->size();
|
/* get the photoId */
|
||||||
int width = diaSize.width();
|
std::string pid = item->text(PHOTO_LIST_COL_PEERID).toStdString();
|
||||||
ui.photoPixLabel->setPixmap((it->second)->scaledToWidth(width));
|
std::string photoid = item->text(PHOTO_LIST_COL_PHOTOID).toStdString();
|
||||||
ui.photoNameLabel->setText(filename);
|
|
||||||
|
|
||||||
#endif
|
PhotoShow *newView = new PhotoShow();
|
||||||
|
newView->show();
|
||||||
|
|
||||||
|
newView->setPeerId(pid);
|
||||||
|
newView->setPhotoId(photoid);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -49,17 +49,18 @@ private slots:
|
|||||||
|
|
||||||
void updatePhotoList();
|
void updatePhotoList();
|
||||||
|
|
||||||
|
|
||||||
void removePhoto();
|
void removePhoto();
|
||||||
void updatePhoto();
|
|
||||||
void addPhotos();
|
void addPhotos();
|
||||||
|
|
||||||
|
void checkUpdate();
|
||||||
|
|
||||||
|
void showPhoto( QTreeWidgetItem *item, int column);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void addShows(std::string peerid);
|
void addShows(std::string peerid);
|
||||||
|
|
||||||
void addPhoto(QString filename);
|
void addPhoto(QString filename);
|
||||||
void showPhoto(QString filename);
|
|
||||||
|
|
||||||
/* Worker Functions */
|
/* Worker Functions */
|
||||||
/* (1) Update Display */
|
/* (1) Update Display */
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
<property name="orientation" >
|
<property name="orientation" >
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="" >
|
<widget class="QWidget" name="layoutWidget" >
|
||||||
<layout class="QVBoxLayout" >
|
<layout class="QVBoxLayout" >
|
||||||
<item>
|
<item>
|
||||||
<widget class="QSplitter" name="splitter" >
|
<widget class="QSplitter" name="splitter" >
|
||||||
@ -49,11 +49,6 @@
|
|||||||
<property name="contextMenuPolicy" >
|
<property name="contextMenuPolicy" >
|
||||||
<enum>Qt::CustomContextMenu</enum>
|
<enum>Qt::CustomContextMenu</enum>
|
||||||
</property>
|
</property>
|
||||||
<column>
|
|
||||||
<property name="text" >
|
|
||||||
<string>Friend / Set</string>
|
|
||||||
</property>
|
|
||||||
</column>
|
|
||||||
<column>
|
<column>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Thumb Image</string>
|
<string>Thumb Image</string>
|
||||||
@ -64,6 +59,11 @@
|
|||||||
<string>Image Name</string>
|
<string>Image Name</string>
|
||||||
</property>
|
</property>
|
||||||
</column>
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text" >
|
||||||
|
<string>Comment</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
<column>
|
<column>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Date</string>
|
<string>Date</string>
|
||||||
@ -76,7 +76,17 @@
|
|||||||
</column>
|
</column>
|
||||||
<column>
|
<column>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Comment</string>
|
<string>Size</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text" >
|
||||||
|
<string>PeerId</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text" >
|
||||||
|
<string>PhotoId</string>
|
||||||
</property>
|
</property>
|
||||||
</column>
|
</column>
|
||||||
</widget>
|
</widget>
|
||||||
@ -132,7 +142,7 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="" >
|
<widget class="QWidget" name="layoutWidget" >
|
||||||
<layout class="QGridLayout" >
|
<layout class="QGridLayout" >
|
||||||
<item row="0" column="0" >
|
<item row="0" column="0" >
|
||||||
<widget class="QLabel" name="label" >
|
<widget class="QLabel" name="label" >
|
||||||
|
162
retroshare-gui/src/gui/PhotoShow.cpp
Normal file
162
retroshare-gui/src/gui/PhotoShow.cpp
Normal file
@ -0,0 +1,162 @@
|
|||||||
|
/****************************************************************
|
||||||
|
* 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 <QFile>
|
||||||
|
#include <QFileInfo>
|
||||||
|
#include "common/vmessagebox.h"
|
||||||
|
|
||||||
|
#include "PhotoShow.h"
|
||||||
|
#include "rsiface/rspeers.h"
|
||||||
|
#include "rsiface/rsphoto.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
#include <QContextMenuEvent>
|
||||||
|
#include <QMenu>
|
||||||
|
#include <QCursor>
|
||||||
|
#include <QPoint>
|
||||||
|
#include <QMouseEvent>
|
||||||
|
#include <QPixmap>
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QHeaderView>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
|
|
||||||
|
/** Constructor */
|
||||||
|
PhotoShow::PhotoShow(QWidget *parent)
|
||||||
|
: QWidget(parent)
|
||||||
|
{
|
||||||
|
/* Invoke the Qt Designer generated object setup routine */
|
||||||
|
ui.setupUi(this);
|
||||||
|
|
||||||
|
// connect( ui.peerTreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( peerTreeWidgetCustomPopupMenu( QPoint ) ) );
|
||||||
|
// connect( ui.photoTreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( photoTreeWidgetCustomPopupMenu( QPoint ) ) );
|
||||||
|
|
||||||
|
// connect( ui.peerTreeWidget, SIGNAL( currentItemChanged ( QTreeWidgetItem * , QTreeWidgetItem * ) ), this, SLOT( updatePhotoList( ) ) );
|
||||||
|
|
||||||
|
//connect( ui.photoTreeWidget, SIGNAL( currentItemChanged ( QTreeWidgetItem * , QTreeWidgetItem * ) ), this, SLOT( displayPhoto( ) ) );
|
||||||
|
//connect( ui.addButton, SIGNAL( clicked( ) ), this, SLOT( addPhotos( ) ) );
|
||||||
|
|
||||||
|
|
||||||
|
/* Hide platform specific features */
|
||||||
|
#ifdef Q_WS_WIN
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void PhotoShow::photoCustomPopupMenu( QPoint point )
|
||||||
|
{
|
||||||
|
|
||||||
|
// QMenu contextMnu( this );
|
||||||
|
// QMouseEvent *mevent = new QMouseEvent( QEvent::MouseButtonPress, point, Qt::RightButton, Qt::RightButton, Qt::NoModifier );
|
||||||
|
//
|
||||||
|
// QAction *rm = new QAction(QIcon(IMAGE_EXPIORTFRIEND), tr( "Remove" ), this );
|
||||||
|
// connect( rm , SIGNAL( triggered() ), this, SLOT( removePhoto() ) );
|
||||||
|
//
|
||||||
|
// contextMnu.clear();
|
||||||
|
// contextMnu.addAction(rm);
|
||||||
|
// contextMnu.addSeparator();
|
||||||
|
// contextMnu.exec( mevent->globalPos() );
|
||||||
|
}
|
||||||
|
|
||||||
|
void PhotoShow::updatePhotoShow()
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoShow::updatePhotoShow()" << std::endl;
|
||||||
|
|
||||||
|
if (mDoShow)
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoShow::updatePhotoShow() (Show) pid: " << mPeerId << " sid: " << mShowId << std::endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoShow::updatePhotoShow() (Image) pid: " << mPeerId << " photoId: " << mPhotoId << std::endl;
|
||||||
|
updatePhoto(mPeerId, mPhotoId);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void PhotoShow::updatePhoto(std::string pid, std::string photoId)
|
||||||
|
{
|
||||||
|
RsPhotoDetails photoDetail;
|
||||||
|
std::cerr << "PhotoShow::updatePhoto() pid: ";
|
||||||
|
std::cerr << pid << " photoId: " << photoId;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
if (!rsPhoto->getPhotoDetails(pid, photoId, photoDetail))
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoShow::updatePhotoShow() BAD Photo Id";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ui.photoLabel->clear();
|
||||||
|
|
||||||
|
if (photoDetail.isAvailable)
|
||||||
|
{
|
||||||
|
QPixmap qpp(QString::fromStdString(photoDetail.path));
|
||||||
|
QSize diaSize = ui.photoLabel->size();
|
||||||
|
int width = diaSize.width();
|
||||||
|
ui.photoLabel->setPixmap(qpp.scaledToWidth(width));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui.photoLabel->setText("Photo Not Available");
|
||||||
|
}
|
||||||
|
|
||||||
|
ui.commentLineEdit->setText(QString::fromStdWString(photoDetail.comment));
|
||||||
|
ui.dateLineEdit->setText(QString::fromStdString(photoDetail.date));
|
||||||
|
ui.locLineEdit->setText(QString::fromStdString(photoDetail.location));
|
||||||
|
|
||||||
|
//ui.nameLineEdit->setText(QString::fromStdString(photoDetail.name));
|
||||||
|
//ui.sizeLineEdit->setText(QString::number(photoDetail.size));
|
||||||
|
//ui.peeridLineEdit->setText(QString::fromStdString(photoDetail.id));
|
||||||
|
//ui.photoidLineEdit->setText(QString::fromStdString(photoDetail.hash));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void PhotoShow::setPeerId(std::string id)
|
||||||
|
{
|
||||||
|
mPeerId = id;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PhotoShow::setPhotoId(std::string id)
|
||||||
|
{
|
||||||
|
mPhotoId = id;
|
||||||
|
mDoShow = false;
|
||||||
|
|
||||||
|
updatePhotoShow();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PhotoShow::setPhotoShow(std::string id)
|
||||||
|
{
|
||||||
|
mShowId = id;
|
||||||
|
mDoShow = true;
|
||||||
|
|
||||||
|
updatePhotoShow();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
68
retroshare-gui/src/gui/PhotoShow.h
Normal file
68
retroshare-gui/src/gui/PhotoShow.h
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
/****************************************************************
|
||||||
|
* RShare 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 _PHOTOSHOW_H
|
||||||
|
#define _PHOTOSHOW_H
|
||||||
|
|
||||||
|
#include <QFileDialog>
|
||||||
|
|
||||||
|
#include "mainpage.h"
|
||||||
|
#include "ui_PhotoShow.h"
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
|
||||||
|
|
||||||
|
class PhotoShow : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
/** Default Constructor */
|
||||||
|
PhotoShow(QWidget *parent = 0);
|
||||||
|
/** Default Destructor */
|
||||||
|
|
||||||
|
void setPeerId(std::string id);
|
||||||
|
void setPhotoId(std::string id);
|
||||||
|
void setPhotoShow(std::string id);
|
||||||
|
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
/** Create the context popup menu and it's submenus */
|
||||||
|
void photoCustomPopupMenu( QPoint point );
|
||||||
|
|
||||||
|
void updatePhotoShow();
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
void updatePhoto(std::string pid, std::string photoId);
|
||||||
|
|
||||||
|
bool mDoShow;
|
||||||
|
std::string mPeerId;
|
||||||
|
std::string mShowId;
|
||||||
|
std::string mPhotoId;
|
||||||
|
|
||||||
|
/** Qt Designer generated object */
|
||||||
|
Ui::PhotoShow ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -45,13 +45,13 @@
|
|||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" >
|
<layout class="QVBoxLayout" >
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="lineEdit_2" />
|
<widget class="QLineEdit" name="dateLineEdit" />
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="lineEdit" />
|
<widget class="QLineEdit" name="locLineEdit" />
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="lineEdit_3" />
|
<widget class="QLineEdit" name="commentLineEdit" />
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
@ -67,7 +67,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="comboBox_2" >
|
<widget class="QComboBox" name="sizeComboBox" >
|
||||||
<item>
|
<item>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>320 x 320</string>
|
<string>320 x 320</string>
|
||||||
@ -93,7 +93,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="comboBox" >
|
<widget class="QComboBox" name="speedComboBox" >
|
||||||
<item>
|
<item>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>1 Sec</string>
|
<string>1 Sec</string>
|
||||||
@ -140,14 +140,14 @@
|
|||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pushButton_4" >
|
<widget class="QPushButton" name="editButton" >
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Edit Photo Details</string>
|
<string>Edit Photo Details</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pushButton_3" >
|
<widget class="QPushButton" name="saveButton" >
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Save Photo</string>
|
<string>Save Photo</string>
|
||||||
</property>
|
</property>
|
||||||
@ -156,7 +156,7 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label" >
|
<widget class="QLabel" name="photoLabel" >
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>No Photo Selected</string>
|
<string>No Photo Selected</string>
|
||||||
</property>
|
</property>
|
||||||
@ -178,35 +178,35 @@
|
|||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pushButton_5" >
|
<widget class="QPushButton" name="startButton" >
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Start</string>
|
<string>Start</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pushButton_6" >
|
<widget class="QPushButton" name="backButton" >
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Back</string>
|
<string>Back</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pushButton" >
|
<widget class="QPushButton" name="playButton" >
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Play </string>
|
<string>Play </string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pushButton_2" >
|
<widget class="QPushButton" name="pauseButton" >
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Pause</string>
|
<string>Pause</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pushButton_7" >
|
<widget class="QPushButton" name="stepButton" >
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Forward</string>
|
<string>Forward</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#include "rsiface/notifyqt.h"
|
#include "rsiface/notifyqt.h"
|
||||||
#include "rsiface/rsnotify.h"
|
#include "rsiface/rsnotify.h"
|
||||||
#include "rsiface/rspeers.h"
|
#include "rsiface/rspeers.h"
|
||||||
|
#include "rsiface/rsphoto.h"
|
||||||
|
|
||||||
#include "gui/NetworkDialog.h"
|
#include "gui/NetworkDialog.h"
|
||||||
#include "gui/PeersDialog.h"
|
#include "gui/PeersDialog.h"
|
||||||
|
@ -73,10 +73,12 @@ class RsPhotoDetails
|
|||||||
std::string srcid;
|
std::string srcid;
|
||||||
|
|
||||||
std::string hash;
|
std::string hash;
|
||||||
|
uint64_t size;
|
||||||
|
|
||||||
std::string name;
|
std::string name;
|
||||||
std::wstring location;
|
|
||||||
std::wstring comment;
|
std::wstring comment;
|
||||||
|
|
||||||
|
std::string location;
|
||||||
std::string date;
|
std::string date;
|
||||||
|
|
||||||
uint32_t format;
|
uint32_t format;
|
||||||
@ -95,9 +97,12 @@ class RsPhoto
|
|||||||
RsPhoto() { return; }
|
RsPhoto() { return; }
|
||||||
virtual ~RsPhoto() { return; }
|
virtual ~RsPhoto() { return; }
|
||||||
|
|
||||||
|
/* changed? */
|
||||||
|
virtual bool updated() = 0;
|
||||||
|
|
||||||
/* access data */
|
/* access data */
|
||||||
virtual bool getPhotoList(std::string id, std::list<std::string> hashs) = 0;
|
virtual bool getPhotoList(std::string id, std::list<std::string> &hashs) = 0;
|
||||||
virtual bool getShowList(std::string id, std::list<std::string> showIds) = 0;
|
virtual bool getShowList(std::string id, std::list<std::string> &showIds) = 0;
|
||||||
virtual bool getShowDetails(std::string id, std::string showId, RsPhotoShowDetails &detail) = 0;
|
virtual bool getShowDetails(std::string id, std::string showId, RsPhotoShowDetails &detail) = 0;
|
||||||
virtual bool getPhotoDetails(std::string id, std::string photoId, RsPhotoDetails &detail) = 0;
|
virtual bool getPhotoDetails(std::string id, std::string photoId, RsPhotoDetails &detail) = 0;
|
||||||
|
|
||||||
|
@ -69,6 +69,9 @@ class RsRanks
|
|||||||
RsRanks() { return; }
|
RsRanks() { return; }
|
||||||
virtual ~RsRanks() { return; }
|
virtual ~RsRanks() { return; }
|
||||||
|
|
||||||
|
/* needs update? */
|
||||||
|
virtual bool updated() = 0;
|
||||||
|
|
||||||
/* Set Sort Methods */
|
/* Set Sort Methods */
|
||||||
virtual bool setSortPeriod(uint32_t period) = 0;
|
virtual bool setSortPeriod(uint32_t period) = 0;
|
||||||
virtual bool setSortMethod(uint32_t type) = 0;
|
virtual bool setSortMethod(uint32_t type) = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user