2008-01-21 04:26:12 -05:00
|
|
|
/****************************************************************
|
|
|
|
* 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.
|
2008-03-04 16:31:11 -05:00
|
|
|
****************************************************************/
|
2008-01-21 04:26:12 -05:00
|
|
|
|
2008-03-04 16:31:11 -05:00
|
|
|
#include <QFile>
|
2008-01-21 04:26:12 -05:00
|
|
|
#include <QFileInfo>
|
2008-03-04 16:31:11 -05:00
|
|
|
#include "common/vmessagebox.h"
|
|
|
|
|
|
|
|
#include "PhotoDialog.h"
|
|
|
|
#include "rsiface/rspeers.h"
|
|
|
|
#include "rsiface/rsphoto.h"
|
2008-01-21 04:26:12 -05:00
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include <sstream>
|
|
|
|
|
|
|
|
#include <QContextMenuEvent>
|
|
|
|
#include <QMenu>
|
|
|
|
#include <QCursor>
|
|
|
|
#include <QPoint>
|
|
|
|
#include <QMouseEvent>
|
|
|
|
#include <QPixmap>
|
|
|
|
#include <QMessageBox>
|
|
|
|
#include <QHeaderView>
|
|
|
|
|
|
|
|
|
2008-03-04 16:31:11 -05:00
|
|
|
/* Images for context menu icons */
|
2008-01-21 04:26:12 -05:00
|
|
|
#define IMAGE_REMOVEFRIEND ":/images/removefriend16.png"
|
|
|
|
#define IMAGE_EXPIORTFRIEND ":/images/exportpeers_16x16.png"
|
|
|
|
#define IMAGE_CHAT ":/images/chat.png"
|
|
|
|
/* Images for Status icons */
|
|
|
|
#define IMAGE_ONLINE ":/images/donline.png"
|
2008-03-04 16:31:11 -05:00
|
|
|
#define IMAGE_OFFLINE ":/images/dhidden.png"
|
|
|
|
|
|
|
|
#define PHOTO_ICON_SIZE 90
|
|
|
|
|
|
|
|
|
|
|
|
#define PHOTO_PEER_COL_NAME 0
|
|
|
|
#define PHOTO_PEER_COL_SHOW 1
|
|
|
|
#define PHOTO_PEER_COL_PHOTO 2
|
|
|
|
#define PHOTO_PEER_COL_PID 3
|
|
|
|
#define PHOTO_PEER_COL_SID 4
|
|
|
|
#define PHOTO_PEER_COL_PHOTOID 5
|
|
|
|
|
|
|
|
|
|
|
|
#define PHOTO_LIST_COL_PHOTO 0
|
|
|
|
#define PHOTO_LIST_COL_COMMENT 1
|
|
|
|
#define PHOTO_LIST_COL_PHOTOID 2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** Constructor */
|
|
|
|
PhotoDialog::PhotoDialog(QWidget *parent)
|
2008-01-21 04:26:12 -05:00
|
|
|
: MainPage(parent)
|
2008-03-04 16:31:11 -05:00
|
|
|
{
|
|
|
|
/* 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.addPhotoButton, SIGNAL( clicked( ) ), this, SLOT( addPhotos( ) ) );
|
|
|
|
|
|
|
|
|
2008-01-21 04:26:12 -05:00
|
|
|
|
|
|
|
/* hide the Tree +/- */
|
|
|
|
ui.photoTreeWidget -> setRootIsDecorated( false );
|
2008-03-04 16:31:11 -05:00
|
|
|
|
|
|
|
QSize iconSize(PHOTO_ICON_SIZE,PHOTO_ICON_SIZE);
|
|
|
|
ui.photoTreeWidget->setIconSize(iconSize);
|
2008-01-21 04:26:12 -05:00
|
|
|
|
|
|
|
/* Set header resize modes and initial section sizes */
|
|
|
|
// QHeaderView * _header = ui.peertreeWidget->header () ;
|
|
|
|
// _header->setResizeMode (0, QHeaderView::Custom);
|
|
|
|
// _header->setResizeMode (1, QHeaderView::Interactive);
|
|
|
|
// _header->setResizeMode (2, QHeaderView::Interactive);
|
|
|
|
// _header->setResizeMode (3, QHeaderView::Interactive);
|
|
|
|
// _header->setResizeMode (4, QHeaderView::Interactive);
|
|
|
|
// _header->setResizeMode (5, QHeaderView::Interactive);
|
|
|
|
// _header->setResizeMode (6, QHeaderView::Interactive);
|
|
|
|
// _header->setResizeMode (7, QHeaderView::Interactive);
|
|
|
|
// _header->setResizeMode (8, QHeaderView::Interactive);
|
|
|
|
// _header->setResizeMode (9, QHeaderView::Interactive);
|
|
|
|
// _header->setResizeMode (10, QHeaderView::Interactive);
|
|
|
|
// _header->setResizeMode (11, QHeaderView::Interactive);
|
|
|
|
//
|
|
|
|
// _header->resizeSection ( 0, 25 );
|
|
|
|
// _header->resizeSection ( 1, 100 );
|
|
|
|
// _header->resizeSection ( 2, 100 );
|
|
|
|
// _header->resizeSection ( 3, 100 );
|
|
|
|
// _header->resizeSection ( 4, 100 );
|
|
|
|
// _header->resizeSection ( 5, 200 );
|
|
|
|
// _header->resizeSection ( 6, 100 );
|
|
|
|
// _header->resizeSection ( 7, 100 );
|
|
|
|
// _header->resizeSection ( 8, 100 );
|
|
|
|
// _header->resizeSection ( 9, 100 );
|
|
|
|
// _header->resizeSection ( 10, 100 );
|
2008-03-04 16:31:11 -05:00
|
|
|
|
|
|
|
|
|
|
|
/* Hide platform specific features */
|
|
|
|
#ifdef Q_WS_WIN
|
|
|
|
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void PhotoDialog::peerTreeWidgetCustomPopupMenu( QPoint point )
|
|
|
|
{
|
|
|
|
|
|
|
|
QMenu contextMnu( this );
|
|
|
|
QMouseEvent *mevent = new QMouseEvent( QEvent::MouseButtonPress, point, Qt::RightButton, Qt::RightButton, Qt::NoModifier );
|
|
|
|
|
|
|
|
QAction *ins = new QAction(QIcon(IMAGE_EXPIORTFRIEND), tr( "Insert Show Lists" ), this );
|
|
|
|
connect( ins , SIGNAL( triggered() ), this, SLOT( insertShowLists() ) );
|
|
|
|
|
|
|
|
contextMnu.clear();
|
|
|
|
contextMnu.addAction(ins);
|
|
|
|
contextMnu.exec( mevent->globalPos() );
|
|
|
|
}
|
|
|
|
|
|
|
|
void PhotoDialog::photoTreeWidgetCustomPopupMenu( 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);
|
2008-01-21 04:26:12 -05:00
|
|
|
contextMnu.addSeparator();
|
2008-03-04 16:31:11 -05:00
|
|
|
contextMnu.exec( mevent->globalPos() );
|
2008-01-21 04:26:12 -05:00
|
|
|
}
|
|
|
|
|
2008-03-04 16:31:11 -05:00
|
|
|
void PhotoDialog::insertShowLists()
|
|
|
|
{
|
|
|
|
/* clear it all */
|
|
|
|
ui.peerTreeWidget->clear();
|
2008-01-21 04:26:12 -05:00
|
|
|
|
2008-03-04 16:31:11 -05:00
|
|
|
/* iterate through peers */
|
|
|
|
addShows(rsPeers->getOwnId());
|
2008-01-21 04:26:12 -05:00
|
|
|
|
2008-03-04 16:31:11 -05:00
|
|
|
std::list<std::string> ids;
|
|
|
|
std::list<std::string>::iterator it;
|
|
|
|
rsPeers->getFriendList(ids);
|
|
|
|
|
|
|
|
for(it = ids.begin(); it != ids.end(); it++)
|
|
|
|
{
|
|
|
|
addShows(*it);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void PhotoDialog::addShows(std::string id)
|
2008-01-21 04:26:12 -05:00
|
|
|
{
|
2008-03-04 16:31:11 -05:00
|
|
|
std::list<std::string> allPhotos;
|
|
|
|
std::list<std::string> showIds;
|
|
|
|
std::list<std::string>::iterator it;
|
2008-01-25 03:49:40 -05:00
|
|
|
|
2008-03-04 16:31:11 -05:00
|
|
|
QTreeWidgetItem *peerItem = new QTreeWidgetItem((QTreeWidget*)0);
|
|
|
|
peerItem->setText(PHOTO_PEER_COL_NAME, QString::fromStdString(rsPeers->getPeerName(id)));
|
|
|
|
peerItem->setText(PHOTO_PEER_COL_PID, QString::fromStdString(id));
|
|
|
|
peerItem->setText(PHOTO_PEER_COL_SID, "");
|
|
|
|
peerItem->setText(PHOTO_PEER_COL_PHOTOID, "");
|
2008-01-21 04:26:12 -05:00
|
|
|
|
2008-03-04 16:31:11 -05:00
|
|
|
ui.peerTreeWidget->insertTopLevelItem(0, peerItem);
|
2008-01-21 04:26:12 -05:00
|
|
|
|
2008-03-04 16:31:11 -05:00
|
|
|
QTreeWidgetItem *allItem = new QTreeWidgetItem((QTreeWidget*)0);
|
|
|
|
allItem->setText(PHOTO_PEER_COL_SHOW, "All Photos");
|
|
|
|
allItem->setText(PHOTO_PEER_COL_PID, QString::fromStdString(id));
|
|
|
|
allItem->setText(PHOTO_PEER_COL_SID, "");
|
|
|
|
allItem->setText(PHOTO_PEER_COL_PHOTOID, "");
|
2008-01-21 04:26:12 -05:00
|
|
|
|
2008-03-04 16:31:11 -05:00
|
|
|
peerItem->addChild(allItem);
|
2008-01-21 04:26:12 -05:00
|
|
|
|
2008-03-04 16:31:11 -05:00
|
|
|
rsPhoto->getPhotoList(id, allPhotos);
|
|
|
|
rsPhoto->getShowList(id, showIds);
|
|
|
|
|
|
|
|
for(it = allPhotos.begin(); it != allPhotos.end(); it++)
|
2008-01-21 04:26:12 -05:00
|
|
|
{
|
2008-03-04 16:31:11 -05:00
|
|
|
QTreeWidgetItem *photoItem = new QTreeWidgetItem((QTreeWidget*)0);
|
|
|
|
photoItem->setText(PHOTO_PEER_COL_PHOTO, QString::fromStdString(*it));
|
|
|
|
|
|
|
|
photoItem->setText(PHOTO_PEER_COL_PID, QString::fromStdString(id));
|
|
|
|
photoItem->setText(PHOTO_PEER_COL_SID, "");
|
|
|
|
photoItem->setText(PHOTO_PEER_COL_PHOTOID, QString::fromStdString(*it));
|
|
|
|
|
|
|
|
allItem->addChild(photoItem);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for(it = showIds.begin(); it != showIds.end(); it++)
|
|
|
|
{
|
|
|
|
/* get details */
|
|
|
|
RsPhotoShowDetails detail;
|
|
|
|
rsPhoto->getShowDetails(id, *it, detail);
|
|
|
|
|
|
|
|
QTreeWidgetItem *showItem = new QTreeWidgetItem((QTreeWidget*)0);
|
|
|
|
showItem->setText(PHOTO_PEER_COL_SHOW, QString::fromStdString(*it));
|
|
|
|
|
|
|
|
showItem->setText(PHOTO_PEER_COL_PID, QString::fromStdString(id));
|
|
|
|
showItem->setText(PHOTO_PEER_COL_SID, QString::fromStdString(*it));
|
|
|
|
showItem->setText(PHOTO_PEER_COL_PHOTOID, "");
|
|
|
|
|
|
|
|
peerItem->addChild(showItem);
|
|
|
|
|
|
|
|
std::list<RsPhotoShowInfo>::iterator sit;
|
|
|
|
for(sit = detail.photos.begin(); sit != detail.photos.end(); sit++)
|
2008-01-21 04:26:12 -05:00
|
|
|
{
|
2008-03-04 16:31:11 -05:00
|
|
|
QTreeWidgetItem *photoItem = new QTreeWidgetItem((QTreeWidget*)0);
|
|
|
|
photoItem->setText(PHOTO_PEER_COL_PHOTO, QString::fromStdString(sit->photoId));
|
|
|
|
|
|
|
|
photoItem->setText(PHOTO_PEER_COL_PID, QString::fromStdString(id));
|
|
|
|
photoItem->setText(PHOTO_PEER_COL_SID, QString::fromStdString(*it));
|
|
|
|
photoItem->setText(PHOTO_PEER_COL_PHOTOID, QString::fromStdString(sit->photoId));
|
|
|
|
|
|
|
|
showItem->addChild(photoItem);
|
2008-01-21 04:26:12 -05:00
|
|
|
}
|
2008-03-04 16:31:11 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void PhotoDialog::updatePhotoList()
|
|
|
|
{
|
|
|
|
/* get current item */
|
|
|
|
QTreeWidgetItem *item = ui.peerTreeWidget->currentItem();
|
|
|
|
|
|
|
|
if (!item)
|
|
|
|
{
|
|
|
|
/* leave current list */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* check if it has changed */
|
|
|
|
std::string pid = item->text(PHOTO_PEER_COL_PID).toStdString();
|
|
|
|
std::string sid = item->text(PHOTO_PEER_COL_SID).toStdString();
|
|
|
|
|
|
|
|
if ((mCurrentPID == pid) && (mCurrentSID == sid))
|
|
|
|
{
|
|
|
|
/* still good */
|
|
|
|
return;
|
|
|
|
}
|
2008-01-21 04:26:12 -05:00
|
|
|
|
2008-03-04 16:31:11 -05:00
|
|
|
/* get the list of photos */
|
|
|
|
|
|
|
|
ui.photoTreeWidget->clear();
|
|
|
|
QList<QTreeWidgetItem *> items;
|
|
|
|
|
|
|
|
if (sid != "")
|
|
|
|
{
|
|
|
|
/* load up show list */
|
|
|
|
RsPhotoShowDetails detail;
|
|
|
|
rsPhoto->getShowDetails(pid, sid, detail);
|
2008-01-21 04:26:12 -05:00
|
|
|
|
2008-03-04 16:31:11 -05:00
|
|
|
|
|
|
|
std::list<RsPhotoShowInfo>::iterator sit;
|
|
|
|
for(sit = detail.photos.begin(); sit != detail.photos.end(); sit++)
|
2008-01-21 04:26:12 -05:00
|
|
|
{
|
2008-03-04 16:31:11 -05:00
|
|
|
RsPhotoDetails photoDetail;
|
|
|
|
|
|
|
|
if (!rsPhoto->getPhotoDetails(pid, sit->photoId, photoDetail))
|
2008-01-21 04:26:12 -05:00
|
|
|
{
|
2008-03-04 16:31:11 -05:00
|
|
|
continue;
|
2008-01-21 04:26:12 -05:00
|
|
|
}
|
2008-03-04 16:31:11 -05:00
|
|
|
|
|
|
|
QTreeWidgetItem *photoItem = new QTreeWidgetItem((QTreeWidget*)0);
|
|
|
|
if (photoDetail.isAvailable)
|
2008-01-21 04:26:12 -05:00
|
|
|
{
|
2008-03-04 16:31:11 -05:00
|
|
|
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);
|
2008-01-21 04:26:12 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-03-04 16:31:11 -05:00
|
|
|
photoItem->setText(PHOTO_LIST_COL_PHOTO, "Photo Not Available");
|
2008-01-21 04:26:12 -05:00
|
|
|
}
|
|
|
|
|
2008-03-04 16:31:11 -05:00
|
|
|
photoItem->setText(PHOTO_LIST_COL_COMMENT,
|
|
|
|
QString::fromStdWString(photoDetail.comment));
|
|
|
|
photoItem->setText(PHOTO_LIST_COL_PHOTOID,
|
|
|
|
QString::fromStdString(photoDetail.hash));
|
|
|
|
|
|
|
|
items.append(photoItem);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-01-21 04:26:12 -05:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/* add the items in! */
|
2008-03-04 16:31:11 -05:00
|
|
|
ui.photoTreeWidget->insertTopLevelItems(0, items);
|
|
|
|
ui.photoTreeWidget->update();
|
|
|
|
}
|
2008-01-21 04:26:12 -05:00
|
|
|
|
|
|
|
|
2008-03-04 16:31:11 -05:00
|
|
|
|
|
|
|
/* get the list of peers from the RsIface. */
|
|
|
|
void PhotoDialog::insertExample()
|
|
|
|
{
|
|
|
|
|
2008-01-21 04:26:12 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
QTreeWidgetItem *PhotoDialog::getCurrentLine()
|
|
|
|
{
|
|
|
|
/* get the current, and extract the Id */
|
|
|
|
|
|
|
|
/* get a link to the table */
|
|
|
|
QTreeWidget *peerWidget = ui.photoTreeWidget;
|
|
|
|
QTreeWidgetItem *item = peerWidget -> currentItem();
|
|
|
|
if (!item)
|
|
|
|
{
|
|
|
|
std::cerr << "Invalid Current Item" << std::endl;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Display the columns of this item. */
|
|
|
|
std::ostringstream out;
|
|
|
|
out << "CurrentPeerItem: " << std::endl;
|
|
|
|
|
|
|
|
for(int i = 1; i < 6; i++)
|
|
|
|
{
|
|
|
|
QString txt = item -> text(i);
|
|
|
|
out << "\t" << i << ":" << txt.toStdString() << std::endl;
|
|
|
|
}
|
|
|
|
std::cerr << out.str();
|
|
|
|
return item;
|
|
|
|
}
|
|
|
|
|
2008-03-04 16:31:11 -05:00
|
|
|
void PhotoDialog::removePhoto()
|
2008-01-21 04:26:12 -05:00
|
|
|
{
|
|
|
|
QTreeWidgetItem *c = getCurrentLine();
|
2008-03-04 16:31:11 -05:00
|
|
|
std::cerr << "PhotoDialog::removePhoto()" << std::endl;
|
2008-01-21 04:26:12 -05:00
|
|
|
}
|
|
|
|
|
2008-03-04 16:31:11 -05:00
|
|
|
|
|
|
|
void PhotoDialog::addPhotos()
|
2008-01-21 04:26:12 -05:00
|
|
|
{
|
2008-03-04 16:31:11 -05:00
|
|
|
/* get file dialog */
|
|
|
|
QStringList files = QFileDialog::getOpenFileNames(this,
|
|
|
|
"Select one or more Photos to add",
|
|
|
|
"/home", "Images (*.png *.xpm *.jpg *.gif)");
|
|
|
|
/* add photo to list */
|
|
|
|
QStringList::iterator it;
|
|
|
|
for(it = files.begin(); it != files.end(); it++)
|
|
|
|
{
|
|
|
|
addPhoto(*it);
|
|
|
|
}
|
2008-01-21 04:26:12 -05:00
|
|
|
}
|
|
|
|
|
2008-03-04 16:31:11 -05:00
|
|
|
void PhotoDialog::addPhoto(QString filename)
|
|
|
|
{
|
|
|
|
/* load pixmap */
|
|
|
|
|
|
|
|
/* 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()
|
|
|
|
{
|
|
|
|
/* load pixmap */
|
|
|
|
|
|
|
|
QTreeWidgetItem *item = ui.photoTreeWidget->currentItem();
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
QSize diaSize = ui.photoTreeWidget->size();
|
|
|
|
int width = diaSize.width();
|
|
|
|
ui.photoPixLabel->setPixmap((it->second)->scaledToWidth(width));
|
|
|
|
ui.photoNameLabel->setText(filename);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-01-21 04:26:12 -05:00
|
|
|
|
|
|
|
|