From 1eb82bd6760d7973f9ae22e66d96bbb0b7a532ea Mon Sep 17 00:00:00 2001 From: drbob Date: Mon, 13 Feb 2012 18:43:15 +0000 Subject: [PATCH] * Added two new Services to RS GUI. - The Wire, this is not at all functional yet - just a gui shell. - Identity, Basics of the GUI complete. talks via rsIdentity to the backend. * Fixed the Photo Drag and Drop under Linux. * Resurrected the Application Window - for Unfinished Service. * Moved Photos, Wire, Identity & Wiki to the Unfinished Window. * Added "Experimental Services" option in Settings -> though this is not yet saved / used. * changed #ifdef UNFINISHED -> #ifdef UNFINISHED_FD for bits in FriendList, which didn't compile. * removed old Unfinished Applications from Window. git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-new_cache_system@4933 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/RetroShare.pro | 66 +- retroshare-gui/src/gui/Identity/IdDialog.cpp | 631 ++++++++++++++++++ retroshare-gui/src/gui/Identity/IdDialog.h | 91 +++ retroshare-gui/src/gui/Identity/IdDialog.ui | 365 ++++++++++ .../src/gui/Identity/IdEditDialog.cpp | 227 +++++++ .../src/gui/Identity/IdEditDialog.h | 56 ++ .../src/gui/Identity/IdEditDialog.ui | 173 +++++ retroshare-gui/src/gui/MainWindow.cpp | 9 +- .../src/gui/PhotoShare/PhotoDrop.cpp | 22 +- .../src/gui/TheWire/PulseAddDialog.cpp | 210 ++++++ .../src/gui/TheWire/PulseAddDialog.h | 58 ++ .../src/gui/TheWire/PulseAddDialog.ui | 288 ++++++++ retroshare-gui/src/gui/TheWire/PulseItem.cpp | 255 +++++++ retroshare-gui/src/gui/TheWire/PulseItem.h | 86 +++ retroshare-gui/src/gui/TheWire/PulseItem.ui | 214 ++++++ retroshare-gui/src/gui/TheWire/WireDialog.cpp | 460 +++++++++++++ retroshare-gui/src/gui/TheWire/WireDialog.h | 91 +++ retroshare-gui/src/gui/TheWire/WireDialog.ui | 321 +++++++++ retroshare-gui/src/gui/common/FriendList.cpp | 4 +- retroshare-gui/src/gui/common/FriendList.h | 2 +- .../src/gui/settings/GeneralPage.ui | 16 +- .../src/gui/unfinished/ApplicationWindow.cpp | 54 +- 22 files changed, 3653 insertions(+), 46 deletions(-) create mode 100644 retroshare-gui/src/gui/Identity/IdDialog.cpp create mode 100644 retroshare-gui/src/gui/Identity/IdDialog.h create mode 100644 retroshare-gui/src/gui/Identity/IdDialog.ui create mode 100644 retroshare-gui/src/gui/Identity/IdEditDialog.cpp create mode 100644 retroshare-gui/src/gui/Identity/IdEditDialog.h create mode 100644 retroshare-gui/src/gui/Identity/IdEditDialog.ui create mode 100644 retroshare-gui/src/gui/TheWire/PulseAddDialog.cpp create mode 100644 retroshare-gui/src/gui/TheWire/PulseAddDialog.h create mode 100644 retroshare-gui/src/gui/TheWire/PulseAddDialog.ui create mode 100644 retroshare-gui/src/gui/TheWire/PulseItem.cpp create mode 100644 retroshare-gui/src/gui/TheWire/PulseItem.h create mode 100644 retroshare-gui/src/gui/TheWire/PulseItem.ui create mode 100644 retroshare-gui/src/gui/TheWire/WireDialog.cpp create mode 100644 retroshare-gui/src/gui/TheWire/WireDialog.h create mode 100644 retroshare-gui/src/gui/TheWire/WireDialog.ui diff --git a/retroshare-gui/src/RetroShare.pro b/retroshare-gui/src/RetroShare.pro index a4ce2c722..96d7eeb37 100644 --- a/retroshare-gui/src/RetroShare.pro +++ b/retroshare-gui/src/RetroShare.pro @@ -1,5 +1,8 @@ CONFIG += qt gui uic qrc resources uitools idle bitdht CONFIG += photoshare wikipoos +CONFIG += thewire +CONFIG += identities +CONFIG += unfinished QT += network xml script @@ -731,31 +734,34 @@ HEADERS += gui/unfinished/ApplicationWindow.h \ gui/unfinished/CalDialog.h \ gui/unfinished/ExampleDialog.h \ gui/unfinished/GamesDialog.h \ - gui/unfinished/PhotoDialog.h \ - gui/unfinished/PhotoShow.h \ - gui/unfinished/StatisticDialog.h \ - gui/unfinished/profile/ProfileView.h \ - gui/unfinished/profile/ProfileEdit.h + +# gui/unfinished/profile/ProfileView.h \ +# gui/unfinished/profile/ProfileEdit.h +# gui/unfinished/StatisticDialog.h \ +# gui/unfinished/PhotoDialog.h \ +# gui/unfinished/PhotoShow.h \ FORMS += gui/unfinished/ApplicationWindow.ui \ gui/unfinished/CalDialog.ui \ gui/unfinished/ExampleDialog.ui \ gui/unfinished/GamesDialog.ui \ - gui/unfinished/PhotoDialog.ui \ - gui/unfinished/PhotoShow.ui \ - gui/unfinished/StatisticDialog.ui \ - gui/unfinished/profile/ProfileView.ui \ - gui/unfinished/profile/ProfileEdit.ui + +# gui/unfinished/profile/ProfileView.ui \ +# gui/unfinished/profile/ProfileEdit.ui +# gui/unfinished/StatisticDialog.ui \ +# gui/unfinished/PhotoDialog.ui \ +# gui/unfinished/PhotoShow.ui \ SOURCES += gui/unfinished/ApplicationWindow.cpp \ gui/unfinished/CalDialog.cpp \ gui/unfinished/ExampleDialog.cpp \ gui/unfinished/GamesDialog.cpp \ - gui/unfinished/PhotoDialog.cpp \ - gui/unfinished/PhotoShow.cpp \ - gui/unfinished/StatisticDialog.cpp \ - gui/unfinished/profile/ProfileView.cpp \ - gui/unfinished/profile/ProfileEdit.cpp + +# gui/unfinished/profile/ProfileView.cpp \ +# gui/unfinished/profile/ProfileEdit.cpp +# gui/unfinished/StatisticDialog.cpp \ +# gui/unfinished/PhotoDialog.cpp \ +# gui/unfinished/PhotoShow.cpp \ DEFINES *= UNFINISHED } @@ -887,3 +893,33 @@ wikipoos { } + +thewire { + + HEADERS += gui/TheWire/PulseItem.h \ + gui/TheWire/WireDialog.h \ + gui/TheWire/PulseAddDialog.h \ + + FORMS += gui/TheWire/PulseItem.ui \ + gui/TheWire/WireDialog.ui \ + gui/TheWire/PulseAddDialog.ui \ + + SOURCES += gui/TheWire/PulseItem.cpp \ + gui/TheWire/WireDialog.cpp \ + gui/TheWire/PulseAddDialog.cpp \ + +} + +identities { + + HEADERS += gui/Identity/IdDialog.h \ + gui/Identity/IdEditDialog.h \ + + FORMS += gui/Identity/IdDialog.ui \ + gui/Identity/IdEditDialog.ui \ + + SOURCES += gui/Identity/IdDialog.cpp \ + gui/Identity/IdEditDialog.cpp \ + +} + diff --git a/retroshare-gui/src/gui/Identity/IdDialog.cpp b/retroshare-gui/src/gui/Identity/IdDialog.cpp new file mode 100644 index 000000000..33e77bc57 --- /dev/null +++ b/retroshare-gui/src/gui/Identity/IdDialog.cpp @@ -0,0 +1,631 @@ +/* + * Retroshare Identity. + * + * Copyright 2012-2012 by Robert Fernie. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License Version 2.1 as published by the Free Software Foundation. + * + * This library 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA. + * + * Please report all bugs and problems to "retroshare@lunamutt.com". + * + */ + +#include "IdDialog.h" + +#include +#include + +#include +#include + +#include + +/****** + * #define ID_DEBUG 1 + *****/ + + +/**************************************************************** + */ + + +#define RSID_COL_NICKNAME 0 +#define RSID_COL_KEYID 1 +#define RSID_COL_IDTYPE 2 + + + +/** Constructor */ +IdDialog::IdDialog(QWidget *parent) +: MainPage(parent) +{ + ui.setupUi(this); + + mEditDialog = NULL; + //mPulseSelected = NULL; + + ui.radioButton_ListAll->setChecked(true); + connect( ui.pushButton_NewId, SIGNAL(clicked()), this, SLOT(OpenOrShowAddDialog())); + connect( ui.pushButton_EditId, SIGNAL(clicked()), this, SLOT(OpenOrShowEditDialog())); + connect( ui.treeWidget_IdList, SIGNAL(itemSelectionChanged()), this, SLOT(updateSelection())); + + connect( ui.radioButton_ListYourself, SIGNAL(toggled( bool ) ), this, SLOT(ListTypeToggled( bool ) ) ); + connect( ui.radioButton_ListFriends, SIGNAL(toggled( bool ) ), this, SLOT(ListTypeToggled( bool ) ) ); + connect( ui.radioButton_ListOthers, SIGNAL(toggled( bool ) ), this, SLOT(ListTypeToggled( bool ) ) ); + connect( ui.radioButton_ListPseudo, SIGNAL(toggled( bool ) ), this, SLOT(ListTypeToggled( bool ) ) ); + connect( ui.radioButton_ListAll, SIGNAL(toggled( bool ) ), this, SLOT(ListTypeToggled( bool ) ) ); + + QTimer *timer = new QTimer(this); + timer->connect(timer, SIGNAL(timeout()), this, SLOT(checkUpdate())); + timer->start(1000); + + rsIdentity->generateDummyData(); + +} + +void IdDialog::ListTypeToggled(bool checked) +{ + if (checked) + { + insertIdList(); + } +} + + + +void IdDialog::updateSelection() +{ + /* */ + QTreeWidgetItem *item = ui.treeWidget_IdList->currentItem(); + + if (!item) + { + /* blank it all - and fix buttons */ + ui.lineEdit_Nickname->setText(""); + ui.lineEdit_KeyId->setText(""); + ui.lineEdit_GpgHash->setText(""); + ui.lineEdit_GpgId->setText(""); + ui.lineEdit_GpgName->setText(""); + ui.lineEdit_GpgEmail->setText(""); + + ui.pushButton_Reputation->setEnabled(false); + ui.pushButton_Delete->setEnabled(false); + ui.pushButton_EditId->setEnabled(false); + ui.pushButton_NewId->setEnabled(true); + } + else + { + /* get details from libretroshare */ + RsIdData data; + if (!rsIdentity->getIdentity(item->text(RSID_COL_KEYID).toStdString(), data)) + { + ui.lineEdit_KeyId->setText("ERROR GETTING KEY!"); + return; + } + + /* get GPG Details from rsPeers */ + std::string gpgid = rsPeers->getGPGOwnId(); + RsPeerDetails details; + rsPeers->getPeerDetails(gpgid, details); + + ui.lineEdit_Nickname->setText(QString::fromStdString(data.mNickname)); + ui.lineEdit_KeyId->setText(QString::fromStdString(data.mKeyId)); + ui.lineEdit_GpgHash->setText(QString::fromStdString(data.mGpgIdHash)); + ui.lineEdit_GpgId->setText(QString::fromStdString(data.mGpgId)); + ui.lineEdit_GpgName->setText(QString::fromStdString(data.mGpgName)); + ui.lineEdit_GpgEmail->setText(QString::fromStdString(data.mGpgEmail)); + + if (data.mIdType & RSID_RELATION_YOURSELF) + { + ui.radioButton_IdYourself->setChecked(true); + } + else if (data.mIdType & RSID_TYPE_PSEUDONYM) + { + ui.radioButton_IdPseudo->setChecked(true); + } + else if (data.mIdType & RSID_RELATION_FRIEND) + { + ui.radioButton_IdFriend->setChecked(true); + } + else if (data.mIdType & RSID_RELATION_FOF) + { + ui.radioButton_IdFOF->setChecked(true); + } + else + { + ui.radioButton_IdOther->setChecked(true); + } + + ui.pushButton_NewId->setEnabled(true); + if (data.mIdType & RSID_RELATION_YOURSELF) + { + ui.pushButton_Reputation->setEnabled(false); + ui.pushButton_Delete->setEnabled(true); + ui.pushButton_EditId->setEnabled(true); + } + else + { + ui.pushButton_Reputation->setEnabled(true); + ui.pushButton_Delete->setEnabled(false); + ui.pushButton_EditId->setEnabled(false); + } + } +} + +#if 0 + +void IdDialog::notifySelection(PulseItem *item, int ptype) +{ + std::cerr << "IdDialog::notifySelection() from : " << ptype << " " << item; + std::cerr << std::endl; + + notifyPulseSelection(item); + + switch(ptype) + { + default: + case PHOTO_ITEM_TYPE_ALBUM: + notifyAlbumSelection(item); + break; + case PHOTO_ITEM_TYPE_PHOTO: + notifyPhotoSelection(item); + break; + } +} + +void IdDialog::notifyPulseSelection(PulseItem *item) +{ + std::cerr << "IdDialog::notifyPulseSelection() from : " << item; + std::cerr << std::endl; + + if (mPulseSelected) + { + std::cerr << "IdDialog::notifyPulseSelection() unselecting old one : " << mPulseSelected; + std::cerr << std::endl; + + mPulseSelected->setSelected(false); + } + + mPulseSelected = item; +} + +#endif + +void IdDialog::checkUpdate() +{ + /* update */ + if (!rsIdentity) + return; + + if (rsIdentity->updated()) + { + insertIdList(); + } + return; +} + + +/*************** New Photo Dialog ***************/ + +void IdDialog::OpenOrShowAddDialog() +{ + if (!mEditDialog) + { + mEditDialog = new IdEditDialog(NULL); + } + bool pseudo = false; + mEditDialog->setupNewId(pseudo); + + mEditDialog->show(); + +} + + +void IdDialog::OpenOrShowEditDialog() +{ + if (!mEditDialog) + { + mEditDialog = new IdEditDialog(NULL); + } + + + /* */ + QTreeWidgetItem *item = ui.treeWidget_IdList->currentItem(); + + if (!item) + { + std::cerr << "IdDialog::OpenOrShowEditDialog() Invalid item"; + std::cerr << std::endl; + return; + } + + std::string keyId = item->text(RSID_COL_KEYID).toStdString(); + mEditDialog->setupExistingId(keyId); + + mEditDialog->show(); +} + + +bool IdDialog::matchesAlbumFilter(const RsPhotoAlbum &album) +{ + + return true; +} + +double IdDialog::AlbumScore(const RsPhotoAlbum &album) +{ + return 1; +} + + +bool IdDialog::matchesPhotoFilter(const RsPhotoPhoto &photo) +{ + + return true; +} + +double IdDialog::PhotoScore(const RsPhotoPhoto &photo) +{ + return 1; +} + + +bool IdDialog::FilterNSortAlbums(const std::list &albumIds, std::list &filteredAlbumIds, int count) +{ +#if 0 + std::multimap sortedAlbums; + std::multimap::iterator sit; + std::list::const_iterator it; + + for(it = albumIds.begin(); it != albumIds.end(); it++) + { + RsPhotoAlbum album; + rsPhoto->getAlbum(*it, album); + + if (matchesAlbumFilter(album)) + { + double score = AlbumScore(album); + + sortedAlbums.insert(std::make_pair(score, *it)); + } + } + + int i; + for (sit = sortedAlbums.begin(), i = 0; (sit != sortedAlbums.end()) && (i < count); sit++, i++) + { + filteredAlbumIds.push_back(sit->second); + } +#endif + return true; +} + + +bool IdDialog::FilterNSortPhotos(const std::list &photoIds, std::list &filteredPhotoIds, int count) +{ +#if 0 + std::multimap sortedPhotos; + std::multimap::iterator sit; + std::list::const_iterator it; + + int i = 0; + for(it = photoIds.begin(); it != photoIds.end(); it++, i++) + { + RsPhotoPhoto photo; + rsPhoto->getPhoto(*it, photo); + + if (matchesPhotoFilter(photo)) + { + double score = i; //PhotoScore(album); + sortedPhotos.insert(std::make_pair(score, *it)); + } + } + + for (sit = sortedPhotos.begin(), i = 0; (sit != sortedPhotos.end()) && (i < count); sit++, i++) + { + filteredPhotoIds.push_back(sit->second); + } +#endif + return true; +} + + + +void IdDialog::insertIdList() +{ + QTreeWidget *tree = ui.treeWidget_IdList; + + tree->clear(); + + std::list ids; + std::list::iterator it; + + bool acceptAll = ui.radioButton_ListAll->isChecked(); + bool acceptPseudo = ui.radioButton_ListPseudo->isChecked(); + bool acceptYourself = ui.radioButton_ListYourself->isChecked(); + bool acceptFriends = ui.radioButton_ListFriends->isChecked(); + bool acceptOthers = ui.radioButton_ListOthers->isChecked(); + + rsIdentity->getIdentityList(ids); + + for(it = ids.begin(); it != ids.end(); it++) + { + RsIdData data; + if (!rsIdentity->getIdentity(*it, data)) + { + continue; + } + + /* do filtering */ + bool ok = false; + if (acceptAll) + { + ok = true; + } + else if (data.mIdType & RSID_TYPE_PSEUDONYM) + { + if (acceptPseudo) + { + ok = true; + } + + if ((data.mIdType & RSID_RELATION_YOURSELF) && (acceptYourself)) + { + ok = true; + } + } + else + { + if (data.mIdType & RSID_RELATION_YOURSELF) + { + if (acceptYourself) + { + ok = true; + } + } + else if (data.mIdType & (RSID_RELATION_FRIEND | RSID_RELATION_FOF)) + { + if (acceptFriends) + { + ok = true; + } + } + else + { + if (acceptOthers) + { + ok = true; + } + } + } + + if (!ok) + { + continue; + } + + + QTreeWidgetItem *item = new QTreeWidgetItem(NULL); + item->setText(RSID_COL_NICKNAME, QString::fromStdString(data.mNickname)); + item->setText(RSID_COL_KEYID, QString::fromStdString(data.mKeyId)); + item->setText(RSID_COL_IDTYPE, QString::fromStdString(rsIdTypeToString(data.mIdType))); + + tree->addTopLevelItem(item); + } + + // fix up buttons. + updateSelection(); +} + + + + + +void IdDialog::insertPhotosForSelectedAlbum() +{ +#if 0 + std::cerr << "IdDialog::insertPhotosForSelectedAlbum()"; + std::cerr << std::endl; + + clearPhotos(); + + std::list albumIds; + if (mAlbumSelected) + { + albumIds.push_back(mAlbumSelected->mDetails.mAlbumId); + + std::cerr << "IdDialog::insertPhotosForSelectedAlbum() AlbumId: " << mAlbumSelected->mDetails.mAlbumId; + std::cerr << std::endl; + } + + insertPhotosForAlbum(albumIds); +#endif +} + + +void IdDialog::addAlbum(const std::string &id) +{ +#if 0 + RsPhotoAlbum album; + rsPhoto->getAlbum(id, album); + + + RsPhotoThumbnail thumbnail; + rsPhoto->getAlbumThumbnail(id, thumbnail); + + std::cerr << " IdDialog::addAlbum() AlbumId: " << album.mAlbumId << std::endl; + + PulseItem *item = new PulseItem(this, album, thumbnail); + QLayout *alayout = ui.scrollAreaWidgetContents->layout(); + alayout->addWidget(item); +#endif +} + +void IdDialog::clearAlbums() +{ +#if 0 + std::cerr << "IdDialog::clearAlbums()" << std::endl; + + std::list photoItems; + std::list::iterator pit; + + QLayout *alayout = ui.scrollAreaWidgetContents->layout(); + int count = alayout->count(); + for(int i = 0; i < count; i++) + { + QLayoutItem *litem = alayout->itemAt(i); + if (!litem) + { + std::cerr << "IdDialog::clearAlbums() missing litem"; + std::cerr << std::endl; + continue; + } + + PulseItem *item = dynamic_cast(litem->widget()); + if (item) + { + std::cerr << "IdDialog::clearAlbums() item: " << item; + std::cerr << std::endl; + + photoItems.push_back(item); + } + else + { + std::cerr << "IdDialog::clearAlbums() Found Child, which is not a PulseItem???"; + std::cerr << std::endl; + } + } + + for(pit = photoItems.begin(); pit != photoItems.end(); pit++) + { + PulseItem *item = *pit; + alayout->removeWidget(item); + delete item; + } + mAlbumSelected = NULL; +#endif +} + +void IdDialog::clearPhotos() +{ +#if 0 + std::cerr << "IdDialog::clearPhotos()" << std::endl; + + std::list photoItems; + std::list::iterator pit; + + QLayout *alayout = ui.scrollAreaWidgetContents_2->layout(); + int count = alayout->count(); + for(int i = 0; i < count; i++) + { + QLayoutItem *litem = alayout->itemAt(i); + if (!litem) + { + std::cerr << "IdDialog::clearPhotos() missing litem"; + std::cerr << std::endl; + continue; + } + + PulseItem *item = dynamic_cast(litem->widget()); + if (item) + { + std::cerr << "IdDialog::clearPhotos() item: " << item; + std::cerr << std::endl; + + photoItems.push_back(item); + } + else + { + std::cerr << "IdDialog::clearPhotos() Found Child, which is not a PulseItem???"; + std::cerr << std::endl; + } + } + + for(pit = photoItems.begin(); pit != photoItems.end(); pit++) + { + PulseItem *item = *pit; + alayout->removeWidget(item); + delete item; + } + + mPhotoSelected = NULL; +#endif + +} + + +void IdDialog::insertPhotosForAlbum(const std::list &albumIds) +{ +#if 0 + /* clear it all */ + clearPhotos(); + //ui.photoLayout->clear(); + + /* create a list of albums */ + + std::list ids; + std::list photoIds; + std::list filteredPhotoIds; + std::list::const_iterator it; + + for(it = albumIds.begin(); it != albumIds.end(); it++) + { + rsPhoto->getPhotoList(*it, photoIds); + } + + /* Filter Albums */ /* Sort Albums */ +#define MAX_PHOTOS 50 + + int count = MAX_PHOTOS; + + FilterNSortPhotos(photoIds, filteredPhotoIds, MAX_PHOTOS); + + for(it = filteredPhotoIds.begin(); it != filteredPhotoIds.end(); it++) + { + addPhoto(*it); + } +#endif +} + + +void IdDialog::addPhoto(const std::string &id) +{ +#if 0 + RsPhotoPhoto photo; + rsPhoto->getPhoto(id,photo); + + RsPhotoThumbnail thumbnail; + rsPhoto->getPhotoThumbnail(id, thumbnail); + + std::cerr << "IdDialog::addPhoto() AlbumId: " << photo.mAlbumId; + std::cerr << " PhotoId: " << photo.mId; + std::cerr << std::endl; + + PulseItem *item = new PulseItem(this, photo, thumbnail); + QLayout *alayout = ui.scrollAreaWidgetContents_2->layout(); + alayout->addWidget(item); +#endif +} + + +#if 0 +void IdDialog::deletePulseItem(PulseItem *item, uint32_t type) +{ + + + return; +} + +#endif + + diff --git a/retroshare-gui/src/gui/Identity/IdDialog.h b/retroshare-gui/src/gui/Identity/IdDialog.h new file mode 100644 index 000000000..7f40272ae --- /dev/null +++ b/retroshare-gui/src/gui/Identity/IdDialog.h @@ -0,0 +1,91 @@ +/* + * Retroshare Identity. + * + * Copyright 2012-2012 by Robert Fernie. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License Version 2.1 as published by the Free Software Foundation. + * + * This library 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA. + * + * Please report all bugs and problems to "retroshare@lunamutt.com". + * + */ + +#ifndef MRK_IDENTITY_DIALOG_H +#define MRK_IDENTITY_DIALOG_H + +#include "gui/mainpage.h" +#include "ui_IdDialog.h" + +#include + +#include + +#include "gui/Identity/IdEditDialog.h" +//#include "gui/TheWire/PulseAddDialog.h" + +class IdDialog : public MainPage +{ + Q_OBJECT + +public: + IdDialog(QWidget *parent = 0); + +private slots: + + + void ListTypeToggled(bool checked); + void checkUpdate(); + void OpenOrShowAddDialog(); + void OpenOrShowEditDialog(); + + void updateSelection(); + +private: + + void insertIdList(); + + /* TODO: These functions must be filled in for proper filtering to work + * and tied to the GUI input + */ + + bool matchesAlbumFilter(const RsPhotoAlbum &album); + double AlbumScore(const RsPhotoAlbum &album); + bool matchesPhotoFilter(const RsPhotoPhoto &photo); + double PhotoScore(const RsPhotoPhoto &photo); + + /* Grunt work of setting up the GUI */ + + bool FilterNSortAlbums(const std::list &albumIds, std::list &filteredAlbumIds, int count); + bool FilterNSortPhotos(const std::list &photoIds, std::list &filteredPhotoIds, int count); + void insertAlbums(); + void insertPhotosForAlbum(const std::list &albumIds); + void insertPhotosForSelectedAlbum(); + + void addAlbum(const std::string &id); + void addPhoto(const std::string &id); + + void clearAlbums(); + void clearPhotos(); + + IdEditDialog *mEditDialog; + + //PulseItem *mPulseSelected; + + /* UI - from Designer */ + Ui::IdDialog ui; + +}; + +#endif + diff --git a/retroshare-gui/src/gui/Identity/IdDialog.ui b/retroshare-gui/src/gui/Identity/IdDialog.ui new file mode 100644 index 000000000..ecc942f00 --- /dev/null +++ b/retroshare-gui/src/gui/Identity/IdDialog.ui @@ -0,0 +1,365 @@ + + + IdDialog + + + + 0 + 0 + 744 + 647 + + + + + + + + + + + + Showing: + + + + + + Yourself + + + + + + + Friends / Friends of Friends + + + + + + + Others + + + + + + + Qt::Horizontal + + + + + + + Pseudonyms + + + + + + + Qt::Horizontal + + + + + + + All + + + + + + + + + + filter + + + + + + + + + + + Nickname + + + + + KeyId + + + + + Type + + + + + + + + + + + + Delete ID + + + + + + + Edit Reputation + + + + + + + Edit ID + + + + + + + New ID + + + + + + + + + Identity Type + + + + + + Nickname + + + + + + + true + + + true + + + + + + + + + false + + + Yourself + + + true + + + + + + + false + + + Friend + + + true + + + + + + + false + + + Friend of Friend + + + true + + + + + + + false + + + Other + + + true + + + + + + + Qt::Horizontal + + + + + + + false + + + Pseudonym + + + true + + + + + + + + + Key ID + + + + + + + true + + + true + + + + + + + GPG Name + + + + + + + true + + + true + + + + + + + GPG Email + + + + + + + true + + + true + + + + + + + true + + + true + + + + + + + true + + + true + + + + + + + GPG Id + + + + + + + GPG Hash + + + + + + + + + + Reputation + + + + + + Your Rating + + + + + + + + + + Overall Rating + + + + + + + + + + + + + + + + + + + diff --git a/retroshare-gui/src/gui/Identity/IdEditDialog.cpp b/retroshare-gui/src/gui/Identity/IdEditDialog.cpp new file mode 100644 index 000000000..955d8764c --- /dev/null +++ b/retroshare-gui/src/gui/Identity/IdEditDialog.cpp @@ -0,0 +1,227 @@ +/* + * Retroshare Identity + * + * Copyright 2012-2012 by Robert Fernie. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License Version 2.1 as published by the Free Software Foundation. + * + * This library 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA. + * + * Please report all bugs and problems to "retroshare@lunamutt.com". + * + */ + +#include "gui/Identity/IdEditDialog.h" + +#include +#include + +#include + +/** Constructor */ +IdEditDialog::IdEditDialog(QWidget *parent) +: QWidget(parent) +{ + ui.setupUi(this); + + connect(ui.radioButton_GpgId, SIGNAL( toggled( bool ) ), this, SLOT( IdTypeToggled( bool ) ) ); + connect(ui.radioButton_Pseudo, SIGNAL( toggled( bool ) ), this, SLOT( IdTypeToggled( bool ) ) ); + connect(ui.pushButton_Update, SIGNAL( clicked( void ) ), this, SLOT( updateId( void ) ) ); + connect(ui.pushButton_Cancel, SIGNAL( clicked( void ) ), this, SLOT( cancelId( void ) ) ); + +} + +void IdEditDialog::setupNewId(bool pseudo) +{ + ui.checkBox_NewId->setChecked(true); + ui.checkBox_NewId->setEnabled(false); + ui.lineEdit_KeyId->setText("To Be Generated"); + ui.lineEdit_Nickname->setText(""); + ui.radioButton_GpgId->setEnabled(true); + ui.radioButton_Pseudo->setEnabled(true); + + if (pseudo) + { + ui.radioButton_Pseudo->setChecked(true); + } + else + { + ui.radioButton_GpgId->setChecked(true); + } + + // force - incase it wasn't triggered. + IdTypeToggled(true); + return; +} + +void IdEditDialog::IdTypeToggled(bool checked) +{ + if (checked) + { + bool pseudo = ui.radioButton_Pseudo->isChecked(); + updateIdType(pseudo); + } +} + +void IdEditDialog::updateIdType(bool pseudo) +{ + if (pseudo) + { + ui.lineEdit_GpgHash->setText("N/A"); + ui.lineEdit_GpgId->setText("N/A"); + ui.lineEdit_GpgName->setText("N/A"); + ui.lineEdit_GpgEmail->setText("N/A"); + } + else + { + /* get GPG Details from rsPeers */ + std::string gpgid = rsPeers->getGPGOwnId(); + RsPeerDetails details; + rsPeers->getPeerDetails(gpgid, details); + + ui.lineEdit_GpgId->setText(QString::fromStdString(gpgid)); + ui.lineEdit_GpgHash->setText("To Be Generated"); + ui.lineEdit_GpgName->setText(QString::fromStdString(details.name)); + ui.lineEdit_GpgEmail->setText(QString::fromStdString(details.email)); + } + return; +} + + +void IdEditDialog::setupExistingId(std::string keyId) +{ + ui.checkBox_NewId->setChecked(false); + ui.checkBox_NewId->setEnabled(false); + ui.radioButton_GpgId->setEnabled(false); + ui.radioButton_Pseudo->setEnabled(false); + + RsIdData data; + if (!rsIdentity->getIdentity(keyId, data)) + { + ui.lineEdit_KeyId->setText("ERROR KEYID INVALID"); + ui.lineEdit_Nickname->setText(""); + + ui.lineEdit_GpgHash->setText("N/A"); + ui.lineEdit_GpgId->setText("N/A"); + ui.lineEdit_GpgName->setText("N/A"); + ui.lineEdit_GpgEmail->setText("N/A"); + return; + } + bool pseudo = (data.mIdType & RSID_TYPE_PSEUDONYM); + + if (pseudo) + { + ui.radioButton_Pseudo->setChecked(true); + } + else + { + ui.radioButton_GpgId->setChecked(true); + } + + // DOES THIS TRIGGER ALREADY??? + // force - incase it wasn't triggered. + IdTypeToggled(true); + + ui.lineEdit_Nickname->setText(QString::fromStdString(data.mNickname)); + ui.lineEdit_KeyId->setText(QString::fromStdString(data.mKeyId)); + + if (pseudo) + { + ui.lineEdit_GpgHash->setText("N/A"); + ui.lineEdit_GpgId->setText("N/A"); + ui.lineEdit_GpgName->setText("N/A"); + ui.lineEdit_GpgEmail->setText("N/A"); + } + else + { + ui.lineEdit_GpgHash->setText(QString::fromStdString(data.mGpgIdHash)); + + if (data.mGpgIdKnown) + { + ui.lineEdit_GpgId->setText(QString::fromStdString(data.mGpgId)); + ui.lineEdit_GpgName->setText(QString::fromStdString(data.mGpgName)); + ui.lineEdit_GpgEmail->setText(QString::fromStdString(data.mGpgEmail)); + } + else + { + ui.lineEdit_GpgId->setText("EXIST Unknown"); + ui.lineEdit_GpgName->setText("Unknown"); + ui.lineEdit_GpgEmail->setText("Unknown"); + } + } + + return; +} + +void IdEditDialog::updateId() +{ + RsIdData rid; + // Must set, Nickname, KeyId(if existing), mIdType, GpgId. + + rid.mNickname = ui.lineEdit_Nickname->text().toStdString(); + + if (rid.mNickname.size() < 2) + { + std::cerr << "IdEditDialog::updateId() Nickname too short"; + std::cerr << std::endl; + return; + } + + rid.mIdType = RSID_RELATION_YOURSELF; + if (ui.checkBox_NewId->isChecked()) + { + rid.mKeyId = ""; + } + else + { + rid.mKeyId = ui.lineEdit_KeyId->text().toStdString(); + } + + if (ui.radioButton_GpgId->isChecked()) + { + rid.mIdType |= RSID_TYPE_REALID; + + rid.mGpgId = ui.lineEdit_GpgId->text().toStdString(); + rid.mGpgIdHash = ui.lineEdit_GpgHash->text().toStdString(); + rid.mGpgName = ui.lineEdit_GpgName->text().toStdString(); + rid.mGpgEmail = ui.lineEdit_GpgEmail->text().toStdString(); + } + else + { + rid.mIdType |= RSID_TYPE_PSEUDONYM; + + rid.mGpgId = ""; + rid.mGpgIdHash = ""; + rid.mGpgName = ""; + rid.mGpgEmail = ""; + } + + rsIdentity->updateIdentity(rid); + + hide(); + return; +} + +void IdEditDialog::cancelId() +{ + hide(); + return; +} + +void IdEditDialog::clearDialog() +{ + return; +} + + + diff --git a/retroshare-gui/src/gui/Identity/IdEditDialog.h b/retroshare-gui/src/gui/Identity/IdEditDialog.h new file mode 100644 index 000000000..92fbeb0af --- /dev/null +++ b/retroshare-gui/src/gui/Identity/IdEditDialog.h @@ -0,0 +1,56 @@ +/* + * Retroshare Identity. + * + * Copyright 2012-2012 by Robert Fernie. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License Version 2.1 as published by the Free Software Foundation. + * + * This library 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA. + * + * Please report all bugs and problems to "retroshare@lunamutt.com". + * + */ + +#ifndef MRK_ID_EDIT_DIALOG_H +#define MRK_ID_EDIT_DIALOG_H + +#include "ui_IdEditDialog.h" + +class IdEditDialog : public QWidget +{ + Q_OBJECT + +public: + IdEditDialog(QWidget *parent = 0); + + void setupNewId(bool pseudo); + void setupExistingId(std::string keyId); + +private slots: + + void IdTypeToggled(bool checked); + void updateId(); + void cancelId(); + +private: + void updateIdType(bool pseudo); + void clearDialog(); + +protected: + + Ui::IdEditDialog ui; + +}; + +#endif + diff --git a/retroshare-gui/src/gui/Identity/IdEditDialog.ui b/retroshare-gui/src/gui/Identity/IdEditDialog.ui new file mode 100644 index 000000000..467eb7d34 --- /dev/null +++ b/retroshare-gui/src/gui/Identity/IdEditDialog.ui @@ -0,0 +1,173 @@ + + + IdEditDialog + + + + 0 + 0 + 557 + 229 + + + + + + + + + + + + Nickname + + + + + + + + + + Key ID + + + + + + + + + + GPG Name + + + + + + + + + + GPG Email + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + GPG Hash + + + + + + + + + + GPG Id + + + + + + + + + + + New Identity + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Gpg Assocated ID + + + + + + + Pseudonym + + + + + + + + + + + + + Cancel + + + + + + + Qt::Horizontal + + + + 288 + 20 + + + + + + + + Create/Update ID + + + + + + + + + + + + diff --git a/retroshare-gui/src/gui/MainWindow.cpp b/retroshare-gui/src/gui/MainWindow.cpp index 2925539f4..c42acc966 100644 --- a/retroshare-gui/src/gui/MainWindow.cpp +++ b/retroshare-gui/src/gui/MainWindow.cpp @@ -58,8 +58,8 @@ #include "RetroShareLink.h" // New Cache Classes - -#include "gui/PhotoShare/PhotoDialog.h" -#include "gui/WikiPoos/WikiDialog.h" +//#include "gui/PhotoShare/PhotoDialog.h" +//#include "gui/WikiPoos/WikiDialog.h" #ifdef UNFINISHED #include "unfinished/ApplicationWindow.h" @@ -320,6 +320,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags) } #endif +#if 0 // New Cache Classes - MainPage *photoPage = NULL; ui.stackPages->add(photoPage = new PhotoDialog(ui.stackPages), @@ -329,6 +330,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags) MainPage *wikiPage = NULL; ui.stackPages->add(wikiPage = new WikiDialog(ui.stackPages), createPageAction(QIcon(IMG_HELP), tr("WikiPoos"), grp)); +#endif @@ -1164,6 +1166,9 @@ void MainWindow::showDhtWindow() #ifdef UNFINISHED void MainWindow::showApplWindow() { + std::cerr << "MainWindow::showApplWindow()"; + std::cerr << std::endl; + applicationWindow->show(); } #endif diff --git a/retroshare-gui/src/gui/PhotoShare/PhotoDrop.cpp b/retroshare-gui/src/gui/PhotoShare/PhotoDrop.cpp index 01ecf0c49..7ffcfcf27 100644 --- a/retroshare-gui/src/gui/PhotoShare/PhotoDrop.cpp +++ b/retroshare-gui/src/gui/PhotoShare/PhotoDrop.cpp @@ -561,13 +561,27 @@ void PhotoDrop::dragEnterEvent(QDragEnterEvent *event) std::cerr << "PhotoDrop::dragEnterEvent()"; std::cerr << std::endl; - //if (event->mimeData()->hasFormat("image/x-photo-item")) + +#if 0 + const QStringList& formats = event->mimeData()->formats(); + std::cerr << "dragEnterEvent() Formats" << std::endl; + QStringList::const_iterator it; + for (it = formats.begin(); it != formats.end(); ++it) { + std::cerr << "Format: " << (*it).toStdString(); + std::cerr << std::endl; + } +#endif + if (event->mimeData()->hasUrls()) { + std::cerr << "PhotoDrop::dragEnterEvent() Accepting"; + std::cerr << std::endl; event->accept(); } else { + std::cerr << "PhotoDrop::dragEnterEvent() Ignoring"; + std::cerr << std::endl; event->ignore(); } } @@ -589,8 +603,8 @@ void PhotoDrop::dragMoveEvent(QDragMoveEvent *event) std::cerr << "PhotoDrop::dragMoveEvent()"; std::cerr << std::endl; - //event->accept(); - event->ignore(); + event->accept(); + //event->ignore(); } void PhotoDrop::dropEvent(QDropEvent *event) @@ -621,6 +635,8 @@ void PhotoDrop::dropEvent(QDropEvent *event) } else { + std::cerr << "PhotoDrop::dropEvent Ignoring"; + std::cerr << std::endl; event->ignore(); } diff --git a/retroshare-gui/src/gui/TheWire/PulseAddDialog.cpp b/retroshare-gui/src/gui/TheWire/PulseAddDialog.cpp new file mode 100644 index 000000000..f9be0fa38 --- /dev/null +++ b/retroshare-gui/src/gui/TheWire/PulseAddDialog.cpp @@ -0,0 +1,210 @@ +/* + * Retroshare Photo Plugin. + * + * Copyright 2012-2012 by Robert Fernie. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License Version 2.1 as published by the Free Software Foundation. + * + * This library 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA. + * + * Please report all bugs and problems to "retroshare@lunamutt.com". + * + */ + +#include "gui/TheWire/PulseAddDialog.h" + +#include "gui/PhotoShare/PhotoDetailsDialog.h" +#include "gui/PhotoShare/PhotoDrop.h" + +#include + +/** Constructor */ +PulseAddDialog::PulseAddDialog(QWidget *parent) +: QWidget(parent) +{ + ui.setupUi(this); + + connect(ui.pushButton_Post, SIGNAL( clicked( void ) ), this, SLOT( postPulse( void ) ) ); + connect(ui.pushButton_AddURL, SIGNAL( clicked( void ) ), this, SLOT( addURL( void ) ) ); + connect(ui.pushButton_AddTo, SIGNAL( clicked( void ) ), this, SLOT( addTo( void ) ) ); + connect(ui.pushButton_Cancel, SIGNAL( clicked( void ) ), this, SLOT( cancelPulse( void ) ) ); +#if 0 + connect(ui.scrollAreaWidgetContents, SIGNAL( buttonStatus( uint32_t ) ), this, SLOT( updateMoveButtons( uint32_t ) ) ); + connect(ui.pushButton_ShiftRight, SIGNAL( clicked( void ) ), ui.scrollAreaWidgetContents, SLOT( moveRight( void ) ) ); + connect(ui.pushButton_EditPhotoDetails, SIGNAL( clicked( void ) ), this, SLOT( showPhotoDetails( void ) ) ); + + connect(ui.pushButton_Publish, SIGNAL( clicked( void ) ), this, SLOT( publishAlbum( void ) ) ); +#endif + + mPhotoDetails = NULL; + +} + + +void PulseAddDialog::addURL() +{ + std::cerr << "PulseAddDialog::addURL()"; + std::cerr << std::endl; + + return; +} + + +void PulseAddDialog::addTo() +{ + std::cerr << "PulseAddDialog::addTo()"; + std::cerr << std::endl; + + return; +} + + +void PulseAddDialog::cancelPulse() +{ + std::cerr << "PulseAddDialog::cancelPulse()"; + std::cerr << std::endl; + + clearDialog(); + hide(); + + return; +} + + + +void PulseAddDialog::updateMoveButtons(uint32_t status) +{ + std::cerr << "PulseAddDialog::updateMoveButtons(" << status << ")"; + std::cerr << std::endl; + +#if 0 + switch(status) + { + case PHOTO_SHIFT_NO_BUTTONS: + ui.pushButton_ShiftLeft->setEnabled(false); + ui.pushButton_ShiftRight->setEnabled(false); + break; + case PHOTO_SHIFT_LEFT_ONLY: + ui.pushButton_ShiftLeft->setEnabled(true); + ui.pushButton_ShiftRight->setEnabled(false); + break; + case PHOTO_SHIFT_RIGHT_ONLY: + ui.pushButton_ShiftLeft->setEnabled(false); + ui.pushButton_ShiftRight->setEnabled(true); + break; + case PHOTO_SHIFT_BOTH: + ui.pushButton_ShiftLeft->setEnabled(true); + ui.pushButton_ShiftRight->setEnabled(true); + break; + } +#endif +} + + +void PulseAddDialog::showPhotoDetails() +{ + +#if 0 + std::cerr << "PulseAddDialog::showPhotoDetails()"; + std::cerr << std::endl; + + if (!mPhotoDetails) + { + mPhotoDetails = new PhotoDetailsDialog(NULL); + } + + PhotoItem *item = ui.scrollAreaWidgetContents->getSelectedPhotoItem(); + + mPhotoDetails->setPhotoItem(item); + mPhotoDetails->show(); +#endif +} + + + + +void PulseAddDialog::postPulse() +{ + std::cerr << "PulseAddDialog::postPulse()"; + std::cerr << std::endl; + +#if 0 + /* we need to iterate through each photoItem, and extract the details */ + + + RsPhotoAlbum album; + RsPhotoThumbnail albumThumb; + + album.mShareOptions.mShareType = 0; + album.mShareOptions.mShareGroupId = "unknown"; + album.mShareOptions.mPublishKey = "unknown"; + album.mShareOptions.mCommentMode = 0; + album.mShareOptions.mResizeMode = 0; + + album.mTitle = ui.lineEdit_Title->text().toStdString(); + album.mCategory = "Unknown"; + album.mCaption = ui.lineEdit_Caption->text().toStdString(); + album.mWhere = ui.lineEdit_Where->text().toStdString(); + album.mWhen = ui.lineEdit_When->text().toStdString(); + + if (rsPhoto->submitAlbumDetails(album, albumThumb)) + { + /* now have path and album id */ + int photoCount = ui.scrollAreaWidgetContents->getPhotoCount(); + + for(int i = 0; i < photoCount; i++) + { + RsPhotoPhoto photo; + RsPhotoThumbnail thumbnail; + PhotoItem *item = ui.scrollAreaWidgetContents->getPhotoIdx(i); + photo = item->mDetails; + item->getPhotoThumbnail(thumbnail); + + photo.mAlbumId = album.mAlbumId; + photo.mOrder = i; + + /* scale photo if needed */ + if (album.mShareOptions.mResizeMode) + { + /* */ + + } + /* save image to album path */ + photo.path = "unknown"; + + rsPhoto->submitPhoto(photo, thumbnail); + } + } + +#endif + clearDialog(); + + hide(); +} + + +void PulseAddDialog::clearDialog() +{ + + ui.textEdit_Pulse->setPlainText(""); +#if 0 + ui.lineEdit_Title->setText(QString("title")); + ui.lineEdit_Caption->setText(QString("Caption")); + ui.lineEdit_Where->setText(QString("Where")); + ui.lineEdit_When->setText(QString("When")); + + ui.scrollAreaWidgetContents->clearPhotos(); +#endif +} + + diff --git a/retroshare-gui/src/gui/TheWire/PulseAddDialog.h b/retroshare-gui/src/gui/TheWire/PulseAddDialog.h new file mode 100644 index 000000000..2e9a803b6 --- /dev/null +++ b/retroshare-gui/src/gui/TheWire/PulseAddDialog.h @@ -0,0 +1,58 @@ +/* + * Retroshare Photo Plugin. + * + * Copyright 2012-2012 by Robert Fernie. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License Version 2.1 as published by the Free Software Foundation. + * + * This library 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA. + * + * Please report all bugs and problems to "retroshare@lunamutt.com". + * + */ + +#ifndef MRK_PULSE_ADD_DIALOG_H +#define MRK_PULSE_ADD_DIALOG_H + +#include "ui_PulseAddDialog.h" + +#include + +class PhotoDetailsDialog; + +class PulseAddDialog : public QWidget +{ + Q_OBJECT + +public: + PulseAddDialog(QWidget *parent = 0); + +private slots: + void showPhotoDetails(); + void updateMoveButtons(uint32_t status); + + void addURL(); + void addTo(); + void postPulse(); + void cancelPulse(); + void clearDialog(); + +protected: + + PhotoDetailsDialog *mPhotoDetails; + Ui::PulseAddDialog ui; + +}; + +#endif + diff --git a/retroshare-gui/src/gui/TheWire/PulseAddDialog.ui b/retroshare-gui/src/gui/TheWire/PulseAddDialog.ui new file mode 100644 index 000000000..08110c603 --- /dev/null +++ b/retroshare-gui/src/gui/TheWire/PulseAddDialog.ui @@ -0,0 +1,288 @@ + + + PulseAddDialog + + + + 0 + 0 + 720 + 586 + + + + + + + + + + Qt::Vertical + + + + + 160 + 16777215 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 0 + + + 0 + + + + + + 0 + 0 + + + + true + + + + + 0 + 0 + 156 + 184 + + + + + + + + 12 + 75 + true + + + + Post From: + + + + + + + Account 1 + + + + + + + Account 2 + + + + + + + Account 3 + + + + + + + Qt::Vertical + + + + 20 + 0 + + + + + + + + + + + + + true + + + + + 0 + 0 + 158 + 372 + + + + + + + Add to Pulse + + + + + + + filter + + + + + + + true + + + + + 0 + 0 + 138 + 286 + + + + + + + Account 1 + + + + + + + Account 2 + + + + + + + Account 3 + + + + + + + Qt::Vertical + + + + 20 + 70 + + + + + + + + + + + + + + + + + + + + URL Adder + + + + + + Qt::Horizontal + + + + 331 + 24 + + + + + + + + Add to Pulse + + + + + + + Display As + + + + + + + + + + URL + + + + + + + + + + + + + Cancel + + + + + + + Qt::Horizontal + + + + 298 + 24 + + + + + + + + Post Pulse to Wire + + + + + + + + + + diff --git a/retroshare-gui/src/gui/TheWire/PulseItem.cpp b/retroshare-gui/src/gui/TheWire/PulseItem.cpp new file mode 100644 index 000000000..04b05507b --- /dev/null +++ b/retroshare-gui/src/gui/TheWire/PulseItem.cpp @@ -0,0 +1,255 @@ +/* + * Retroshare Photo Plugin. + * + * Copyright 2012-2012 by Robert Fernie. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License Version 2.1 as published by the Free Software Foundation. + * + * This library 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA. + * + * Please report all bugs and problems to "retroshare@lunamutt.com". + * + */ + + +#include +#include +#include +#include + +#include "PulseItem.h" + +#include + +#include +#include + +/**** + * #define DEBUG_ITEM 1 + ****/ + +/** Constructor */ +PulseItem::PulseItem(PulseHolder *parent, const RsPhotoAlbum &album, const RsPhotoThumbnail &thumbnail) +:QWidget(NULL), mParent(parent), mType(PHOTO_ITEM_TYPE_ALBUM) +{ + setupUi(this); + + setAttribute ( Qt::WA_DeleteOnClose, true ); + + mDetails = *( (RsPhotoPhoto *) &(album)); + updateAlbumText(album); + updateImage(thumbnail); + + setSelected(false); +} + + +PulseItem::PulseItem(PulseHolder *parent, const RsPhotoPhoto &photo, const RsPhotoThumbnail &thumbnail) +:QWidget(NULL), mParent(parent), mType(PHOTO_ITEM_TYPE_PHOTO) +{ + setupUi(this); + + setAttribute ( Qt::WA_DeleteOnClose, true ); + + mDetails = *( (RsPhotoPhoto *) &(photo)); + + updatePhotoText(photo); + updateImage(thumbnail); + + setSelected(false); +} + + +PulseItem::PulseItem(PulseHolder *parent, std::string path) // for new photos. +:QWidget(NULL), mParent(parent), mType(PHOTO_ITEM_TYPE_NEW) +{ + setupUi(this); + + setAttribute ( Qt::WA_DeleteOnClose, true ); + +#if 0 + QString dummyString("dummytext"); + titleLabel->setText(QString("NEW PHOTO")); + + fromBoldLabel->setText(QString("From:")); + fromLabel->setText(QString("Ourselves")); + + statusBoldLabel->setText(QString("Status:")); + statusLabel->setText(QString("new photo")); + + dateBoldLabel->setText(QString("Date:")); + dateLabel->setText(QString("now")); + + int width = 120; + int height = 120; + + //QPixmap qtn = QPixmap(QString::fromStdString(path)).scaled(width, height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); + QPixmap qtn = QPixmap(QString::fromStdString(path)).scaled(width, height, Qt::KeepAspectRatio, Qt::SmoothTransformation); + imgLabel->setPixmap(qtn); + setSelected(false); +#endif +} + +void PulseItem::updateAlbumText(const RsPhotoAlbum &album) +{ +#if 0 + QString dummyString("dummytext"); + titleLabel->setText(QString("TITLE")); + + fromBoldLabel->setText(QString("From:")); + fromLabel->setText(QString("Unknown")); + + statusBoldLabel->setText(QString("Status:")); + statusLabel->setText(QString("new photo")); + + dateBoldLabel->setText(QString("Date:")); + dateLabel->setText(QString("now")); + + //QDateTime qtime; + //qtime.setTime_t(msg.ts); + //QString timestamp = qtime.toString("dd.MMMM yyyy hh:mm"); + //timestamplabel->setText(timestamp); + + dateBoldLabel->setText(dummyString); + dateLabel->setText(dummyString); +#endif +} + +void PulseItem::updatePhotoText(const RsPhotoPhoto &photo) +{ +#if 0 + QString dummyString("dummytext"); + titleLabel->setText(QString("TITLE")); + + fromBoldLabel->setText(QString("From:")); + fromLabel->setText(QString("Unknown")); + + statusBoldLabel->setText(QString("Status:")); + statusLabel->setText(QString("new photo")); + + dateBoldLabel->setText(QString("Date:")); + dateLabel->setText(QString("now")); +#endif +} + + +void PulseItem::updateImage(const RsPhotoThumbnail &thumbnail) +{ +#if 0 + if (thumbnail.data != NULL) + { + QPixmap qtn; + qtn.loadFromData(thumbnail.data, thumbnail.size, thumbnail.type.c_str()); + imgLabel->setPixmap(qtn); + } +#endif +} + +bool PulseItem::getPhotoThumbnail(RsPhotoThumbnail &nail) +{ +#if 0 + const QPixmap *tmppix = imgLabel->pixmap(); + + QByteArray ba; + QBuffer buffer(&ba); + + if(!tmppix->isNull()) + { + // send chan image + + buffer.open(QIODevice::WriteOnly); + tmppix->save(&buffer, "PNG"); // writes image into ba in PNG format + + RsPhotoThumbnail tmpnail; + tmpnail.data = (uint8_t *) ba.data(); + tmpnail.size = ba.size(); + + nail.copyFrom(tmpnail); + + return true; + } + + nail.data = NULL; + nail.size = 0; +#endif + return false; +} + + +void PulseItem::removeItem() +{ +#if 0 +#ifdef DEBUG_ITEM + std::cerr << "PulseItem::removeItem()"; + std::cerr << std::endl; +#endif + hide(); + if (mParent) + { + mParent->deletePulseItem(this, mType); + } +#endif +} + + +void PulseItem::setSelected(bool on) +{ +#if 0 + mSelected = on; + if (mSelected) + { + mParent->notifySelection(this, mType); + frame->setStyleSheet("QFrame#frame{border: 2px solid #55CC55;\nbackground: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #55EE55, stop: 1 #CCCCCC);\nborder-radius: 10px}"); + } + else + { + frame->setStyleSheet("QFrame#frame{border: 2px solid #CCCCCC;\nbackground: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #EEEEEE, stop: 1 #CCCCCC);\nborder-radius: 10px}"); + } + update(); +#endif +} + +bool PulseItem::isSelected() +{ + return mSelected; +} + + +void PulseItem::mousePressEvent(QMouseEvent *event) +{ + /* We can be very cunning here? + * grab out position. + * flag ourselves as selected. + * then pass the mousePressEvent up for handling by the parent + */ + + QPoint pos = event->pos(); + + std::cerr << "PulseItem::mousePressEvent(" << pos.x() << ", " << pos.y() << ")"; + std::cerr << std::endl; + + setSelected(true); + + QWidget::mousePressEvent(event); +} + + +const QPixmap *PulseItem::getPixmap() +{ +#if 0 + return imgLabel->pixmap(); +#endif + return NULL; +} + + diff --git a/retroshare-gui/src/gui/TheWire/PulseItem.h b/retroshare-gui/src/gui/TheWire/PulseItem.h new file mode 100644 index 000000000..2afce794b --- /dev/null +++ b/retroshare-gui/src/gui/TheWire/PulseItem.h @@ -0,0 +1,86 @@ +/* + * Retroshare Photo Plugin. + * + * Copyright 2012-2012 by Robert Fernie. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License Version 2.1 as published by the Free Software Foundation. + * + * This library 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA. + * + * Please report all bugs and problems to "retroshare@lunamutt.com". + * + */ + +#ifndef MRK_PULSE_ITEM_H +#define MRK_PULSE_ITEM_H + +#include "ui_PulseItem.h" + +#include + +class PulseItem; + +class PulseHolder +{ + public: +virtual void deletePulseItem(PulseItem *, uint32_t ptype) = 0; +virtual void notifySelection(PulseItem *item, int ptype) = 0; +}; + + +#define PHOTO_ITEM_TYPE_ALBUM 0x0001 +#define PHOTO_ITEM_TYPE_PHOTO 0x0002 +#define PHOTO_ITEM_TYPE_NEW 0x0003 + +class PulseItem : public QWidget, private Ui::PulseItem +{ + Q_OBJECT + +public: + PulseItem(PulseHolder *parent, const RsPhotoAlbum &album, const RsPhotoThumbnail &thumbnail); + PulseItem(PulseHolder *parent, const RsPhotoPhoto &photo, const RsPhotoThumbnail &thumbnail); + PulseItem(PulseHolder *parent, std::string url); // for new photos. + + bool getPhotoThumbnail(RsPhotoThumbnail &nail); + + void removeItem(); + + void setSelected(bool on); + bool isSelected(); + + const QPixmap *getPixmap(); + + // details are public - so that can be easily edited. + RsPhotoPhoto mDetails; + +//private slots: + + +protected: + void mousePressEvent(QMouseEvent *event); + +private: + void updateAlbumText(const RsPhotoAlbum &album); + void updatePhotoText(const RsPhotoPhoto &photo); + void updateImage(const RsPhotoThumbnail &thumbnail); + + PulseHolder *mParent; + uint32_t mType; + + + bool mSelected; +}; + + +#endif + diff --git a/retroshare-gui/src/gui/TheWire/PulseItem.ui b/retroshare-gui/src/gui/TheWire/PulseItem.ui new file mode 100644 index 000000000..6a0286af8 --- /dev/null +++ b/retroshare-gui/src/gui/TheWire/PulseItem.ui @@ -0,0 +1,214 @@ + + + PulseItem + + + + 0 + 0 + 615 + 232 + + + + + 9 + + + + + + + + + + + 0 + 0 + + + + QFrame#frame{border: 2px solid #CCCCCC; +background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #EEEEEE, stop: 1 #CCCCCC); +border-radius: 10px} + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + 75 + 75 + + + + + 75 + 75 + + + + QLabel#label{border: 2px solid black; +background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #EEEEEE, stop: 1 #CCCCCC); +border-radius: 10px} + + + + + + :/images/konversation.png + + + Qt::AlignCenter + + + + + + + + + + 0 + 0 + + + + + 9 + 75 + true + + + + From + + + + + + + + 0 + 0 + + + + + 9 + + + + Signed by + + + true + + + + + + + + + + + + 0 + 0 + + + + + 9 + 75 + true + + + + Date + + + + + + + + 0 + 0 + + + + + 9 + + + + You eyes only + + + true + + + + + + + + + + + + Qt::Vertical + + + + 48 + 75 + + + + + + + + + + ... + + + + + + + ... + + + + + + + ... + + + + + + + + + + + + + + + diff --git a/retroshare-gui/src/gui/TheWire/WireDialog.cpp b/retroshare-gui/src/gui/TheWire/WireDialog.cpp new file mode 100644 index 000000000..da2e1b054 --- /dev/null +++ b/retroshare-gui/src/gui/TheWire/WireDialog.cpp @@ -0,0 +1,460 @@ +/* + * Retroshare Photo Plugin. + * + * Copyright 2012-2012 by Robert Fernie. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License Version 2.1 as published by the Free Software Foundation. + * + * This library 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA. + * + * Please report all bugs and problems to "retroshare@lunamutt.com". + * + */ + +#include "WireDialog.h" + +#include +#include + +#include +#include + +#include + +/****** + * #define PHOTO_DEBUG 1 + *****/ + + +/**************************************************************** + * New Photo Display Widget. + * + * This has two 'lists'. + * Top list shows Albums. + * Lower list is photos from the selected Album. + * + * Notes: + * Each Item will be an AlbumItem, which contains a thumbnail & random details. + * We will limit Items to < 100. With a 'Filter to see more message. + * + * Thumbnails will come from Service. + * Option to Share albums / pictures onward (if permissions allow). + * Option to Download the albums to a specified directory. (is this required if sharing an album?) + * + * Will introduce a FullScreen SlideShow later... first get basics happening. + */ + + + + +/** Constructor */ +WireDialog::WireDialog(QWidget *parent) +: MainPage(parent) +{ + ui.setupUi(this); + + mAddDialog = NULL; + mPulseSelected = NULL; + + connect( ui.pushButton_Post, SIGNAL(clicked()), this, SLOT(OpenOrShowPulseAddDialog())); + //connect( ui.pushButton_Accounts, SIGNAL(clicked()), this, SLOT(OpenOrShowAccountDialog())); + + QTimer *timer = new QTimer(this); + timer->connect(timer, SIGNAL(timeout()), this, SLOT(checkUpdate())); + timer->start(1000); + + +} + + +void WireDialog::notifySelection(PulseItem *item, int ptype) +{ + std::cerr << "WireDialog::notifySelection() from : " << ptype << " " << item; + std::cerr << std::endl; + + notifyPulseSelection(item); + +#if 0 + switch(ptype) + { + default: + case PHOTO_ITEM_TYPE_ALBUM: + notifyAlbumSelection(item); + break; + case PHOTO_ITEM_TYPE_PHOTO: + notifyPhotoSelection(item); + break; + } +#endif +} + +void WireDialog::notifyPulseSelection(PulseItem *item) +{ + std::cerr << "WireDialog::notifyPulseSelection() from : " << item; + std::cerr << std::endl; + + if (mPulseSelected) + { + std::cerr << "WireDialog::notifyPulseSelection() unselecting old one : " << mPulseSelected; + std::cerr << std::endl; + + mPulseSelected->setSelected(false); + } + + mPulseSelected = item; +} + + +void WireDialog::checkUpdate() +{ +#if 0 + /* update */ + if (!rsWire) + return; + + if (rsWire->updated()) + { + insertAlbums(); + } +#endif + return; +} + + +/*************** New Photo Dialog ***************/ + +void WireDialog::OpenOrShowPulseAddDialog() +{ + if (mAddDialog) + { + mAddDialog->show(); + } + else + { + mAddDialog = new PulseAddDialog(NULL); + mAddDialog->show(); + } +} + + +bool WireDialog::matchesAlbumFilter(const RsPhotoAlbum &album) +{ + + return true; +} + +double WireDialog::AlbumScore(const RsPhotoAlbum &album) +{ + return 1; +} + + +bool WireDialog::matchesPhotoFilter(const RsPhotoPhoto &photo) +{ + + return true; +} + +double WireDialog::PhotoScore(const RsPhotoPhoto &photo) +{ + return 1; +} + + +bool WireDialog::FilterNSortAlbums(const std::list &albumIds, std::list &filteredAlbumIds, int count) +{ +#if 0 + std::multimap sortedAlbums; + std::multimap::iterator sit; + std::list::const_iterator it; + + for(it = albumIds.begin(); it != albumIds.end(); it++) + { + RsPhotoAlbum album; + rsPhoto->getAlbum(*it, album); + + if (matchesAlbumFilter(album)) + { + double score = AlbumScore(album); + + sortedAlbums.insert(std::make_pair(score, *it)); + } + } + + int i; + for (sit = sortedAlbums.begin(), i = 0; (sit != sortedAlbums.end()) && (i < count); sit++, i++) + { + filteredAlbumIds.push_back(sit->second); + } +#endif + return true; +} + + +bool WireDialog::FilterNSortPhotos(const std::list &photoIds, std::list &filteredPhotoIds, int count) +{ +#if 0 + std::multimap sortedPhotos; + std::multimap::iterator sit; + std::list::const_iterator it; + + int i = 0; + for(it = photoIds.begin(); it != photoIds.end(); it++, i++) + { + RsPhotoPhoto photo; + rsPhoto->getPhoto(*it, photo); + + if (matchesPhotoFilter(photo)) + { + double score = i; //PhotoScore(album); + sortedPhotos.insert(std::make_pair(score, *it)); + } + } + + for (sit = sortedPhotos.begin(), i = 0; (sit != sortedPhotos.end()) && (i < count); sit++, i++) + { + filteredPhotoIds.push_back(sit->second); + } +#endif + return true; +} + + + +void WireDialog::insertAlbums() +{ +#if 0 + /* clear it all */ + clearAlbums(); + //ui.albumLayout->clear(); + + /* create a list of albums */ + + + std::list albumIds; + std::list filteredAlbumIds; + std::list::iterator it; + + rsPhoto->getAlbumList(albumIds); + + /* Filter Albums */ /* Sort Albums */ +#define MAX_ALBUMS 50 + + int count = MAX_ALBUMS; + FilterNSortAlbums(albumIds, filteredAlbumIds, count); + + for(it = filteredAlbumIds.begin(); it != filteredAlbumIds.end(); it++) + { + addAlbum(*it); + } + + insertPhotosForAlbum(filteredAlbumIds); +#endif +} + +void WireDialog::insertPhotosForSelectedAlbum() +{ +#if 0 + std::cerr << "WireDialog::insertPhotosForSelectedAlbum()"; + std::cerr << std::endl; + + clearPhotos(); + + std::list albumIds; + if (mAlbumSelected) + { + albumIds.push_back(mAlbumSelected->mDetails.mAlbumId); + + std::cerr << "WireDialog::insertPhotosForSelectedAlbum() AlbumId: " << mAlbumSelected->mDetails.mAlbumId; + std::cerr << std::endl; + } + + insertPhotosForAlbum(albumIds); +#endif +} + + +void WireDialog::addAlbum(const std::string &id) +{ +#if 0 + RsPhotoAlbum album; + rsPhoto->getAlbum(id, album); + + + RsPhotoThumbnail thumbnail; + rsPhoto->getAlbumThumbnail(id, thumbnail); + + std::cerr << " WireDialog::addAlbum() AlbumId: " << album.mAlbumId << std::endl; + + PulseItem *item = new PulseItem(this, album, thumbnail); + QLayout *alayout = ui.scrollAreaWidgetContents->layout(); + alayout->addWidget(item); +#endif +} + +void WireDialog::clearAlbums() +{ +#if 0 + std::cerr << "WireDialog::clearAlbums()" << std::endl; + + std::list photoItems; + std::list::iterator pit; + + QLayout *alayout = ui.scrollAreaWidgetContents->layout(); + int count = alayout->count(); + for(int i = 0; i < count; i++) + { + QLayoutItem *litem = alayout->itemAt(i); + if (!litem) + { + std::cerr << "WireDialog::clearAlbums() missing litem"; + std::cerr << std::endl; + continue; + } + + PulseItem *item = dynamic_cast(litem->widget()); + if (item) + { + std::cerr << "WireDialog::clearAlbums() item: " << item; + std::cerr << std::endl; + + photoItems.push_back(item); + } + else + { + std::cerr << "WireDialog::clearAlbums() Found Child, which is not a PulseItem???"; + std::cerr << std::endl; + } + } + + for(pit = photoItems.begin(); pit != photoItems.end(); pit++) + { + PulseItem *item = *pit; + alayout->removeWidget(item); + delete item; + } + mAlbumSelected = NULL; +#endif +} + +void WireDialog::clearPhotos() +{ +#if 0 + std::cerr << "WireDialog::clearPhotos()" << std::endl; + + std::list photoItems; + std::list::iterator pit; + + QLayout *alayout = ui.scrollAreaWidgetContents_2->layout(); + int count = alayout->count(); + for(int i = 0; i < count; i++) + { + QLayoutItem *litem = alayout->itemAt(i); + if (!litem) + { + std::cerr << "WireDialog::clearPhotos() missing litem"; + std::cerr << std::endl; + continue; + } + + PulseItem *item = dynamic_cast(litem->widget()); + if (item) + { + std::cerr << "WireDialog::clearPhotos() item: " << item; + std::cerr << std::endl; + + photoItems.push_back(item); + } + else + { + std::cerr << "WireDialog::clearPhotos() Found Child, which is not a PulseItem???"; + std::cerr << std::endl; + } + } + + for(pit = photoItems.begin(); pit != photoItems.end(); pit++) + { + PulseItem *item = *pit; + alayout->removeWidget(item); + delete item; + } + + mPhotoSelected = NULL; +#endif + +} + + +void WireDialog::insertPhotosForAlbum(const std::list &albumIds) +{ +#if 0 + /* clear it all */ + clearPhotos(); + //ui.photoLayout->clear(); + + /* create a list of albums */ + + std::list ids; + std::list photoIds; + std::list filteredPhotoIds; + std::list::const_iterator it; + + for(it = albumIds.begin(); it != albumIds.end(); it++) + { + rsPhoto->getPhotoList(*it, photoIds); + } + + /* Filter Albums */ /* Sort Albums */ +#define MAX_PHOTOS 50 + + int count = MAX_PHOTOS; + + FilterNSortPhotos(photoIds, filteredPhotoIds, MAX_PHOTOS); + + for(it = filteredPhotoIds.begin(); it != filteredPhotoIds.end(); it++) + { + addPhoto(*it); + } +#endif +} + + +void WireDialog::addPhoto(const std::string &id) +{ +#if 0 + RsPhotoPhoto photo; + rsPhoto->getPhoto(id,photo); + + RsPhotoThumbnail thumbnail; + rsPhoto->getPhotoThumbnail(id, thumbnail); + + std::cerr << "WireDialog::addPhoto() AlbumId: " << photo.mAlbumId; + std::cerr << " PhotoId: " << photo.mId; + std::cerr << std::endl; + + PulseItem *item = new PulseItem(this, photo, thumbnail); + QLayout *alayout = ui.scrollAreaWidgetContents_2->layout(); + alayout->addWidget(item); +#endif +} + + +void WireDialog::deletePulseItem(PulseItem *item, uint32_t type) +{ + + + return; +} + + + diff --git a/retroshare-gui/src/gui/TheWire/WireDialog.h b/retroshare-gui/src/gui/TheWire/WireDialog.h new file mode 100644 index 000000000..faf7f7b1f --- /dev/null +++ b/retroshare-gui/src/gui/TheWire/WireDialog.h @@ -0,0 +1,91 @@ +/* + * Retroshare Photo Plugin. + * + * Copyright 2012-2012 by Robert Fernie. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License Version 2.1 as published by the Free Software Foundation. + * + * This library 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA. + * + * Please report all bugs and problems to "retroshare@lunamutt.com". + * + */ + +#ifndef MRK_WIRE_DIALOG_H +#define MRK_WIRE_DIALOG_H + +#include "gui/mainpage.h" +#include "ui_WireDialog.h" + +#include + +#include + +#include "gui/TheWire/PulseItem.h" +#include "gui/TheWire/PulseAddDialog.h" + +class WireDialog : public MainPage, public PulseHolder +{ + Q_OBJECT + +public: + WireDialog(QWidget *parent = 0); + +virtual void deletePulseItem(PulseItem *, uint32_t type); +virtual void notifySelection(PulseItem *item, int ptype); + + void notifyPulseSelection(PulseItem *item); + +private slots: + + void checkUpdate(); + void OpenOrShowPulseAddDialog(); + +private: + + + + /* TODO: These functions must be filled in for proper filtering to work + * and tied to the GUI input + */ + + bool matchesAlbumFilter(const RsPhotoAlbum &album); + double AlbumScore(const RsPhotoAlbum &album); + bool matchesPhotoFilter(const RsPhotoPhoto &photo); + double PhotoScore(const RsPhotoPhoto &photo); + + /* Grunt work of setting up the GUI */ + + bool FilterNSortAlbums(const std::list &albumIds, std::list &filteredAlbumIds, int count); + bool FilterNSortPhotos(const std::list &photoIds, std::list &filteredPhotoIds, int count); + void insertAlbums(); + void insertPhotosForAlbum(const std::list &albumIds); + void insertPhotosForSelectedAlbum(); + + void addAlbum(const std::string &id); + void addPhoto(const std::string &id); + + void clearAlbums(); + void clearPhotos(); + + PulseAddDialog *mAddDialog; + + PulseItem *mPulseSelected; + + /* UI - from Designer */ + Ui::WireDialog ui; + +}; + +#endif + diff --git a/retroshare-gui/src/gui/TheWire/WireDialog.ui b/retroshare-gui/src/gui/TheWire/WireDialog.ui new file mode 100644 index 000000000..6cfa8774a --- /dev/null +++ b/retroshare-gui/src/gui/TheWire/WireDialog.ui @@ -0,0 +1,321 @@ + + + WireDialog + + + + 0 + 0 + 726 + 557 + + + + + + + + + + + + TimeRange + + + + + + + + All + + + + + Last Month + + + + + Last Week + + + + + Today + + + + + New + + + + + + + + + from + + + + + until + + + + + + + + + + + Search/Filter + + + + + + + + + + Network Wide + + + + + + + + + Manage Accounts + + + + + + + + 160 + 16777215 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 0 + + + 0 + + + + + true + + + + + 0 + 0 + 156 + 469 + + + + + + + Showing: + + + + 0 + + + + + Yourself + + + + + + + Friends + + + + + + + Following + + + + + + + All + + + + + + + Qt::Horizontal + + + + + + + Custom + + + + + + + + + + Account 1 + + + + + + + Account 2 + + + + + + + Account 3 + + + + + + + CheckBox + + + + + + + CheckBox + + + + + + + CheckBox + + + + + + + CheckBox + + + + + + + CheckBox + + + + + + + Qt::Vertical + + + + 20 + 116 + + + + + + + + + + + + + + + true + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + + + 0 + 0 + 540 + 465 + + + + QWidget#scrollAreaWidgetContents{border: none;} + + + + 0 + + + 0 + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + Post Pulse to Wire + + + + + + + + + + diff --git a/retroshare-gui/src/gui/common/FriendList.cpp b/retroshare-gui/src/gui/common/FriendList.cpp index 028e24108..d9a47dcf5 100644 --- a/retroshare-gui/src/gui/common/FriendList.cpp +++ b/retroshare-gui/src/gui/common/FriendList.cpp @@ -40,7 +40,7 @@ #include "gui/notifyqt.h" #include "gui/RetroShareLink.h" #include "gui/RsAutoUpdatePage.h" -#ifdef UNFINISHED +#ifdef UNFINISHED_FD #include "gui/unfinished/profile/ProfileView.h" #endif #include "RSTreeWidgetItem.h" @@ -1310,7 +1310,7 @@ QTreeWidgetItem *FriendList::getCurrentPeer() const return item; } -#ifdef UNFINISHED +#ifdef UNFINISHED_FD /* GUI stuff -> don't do anything directly with Control */ void FriendsDialog::viewprofile() { diff --git a/retroshare-gui/src/gui/common/FriendList.h b/retroshare-gui/src/gui/common/FriendList.h index 459751214..83a70a7af 100644 --- a/retroshare-gui/src/gui/common/FriendList.h +++ b/retroshare-gui/src/gui/common/FriendList.h @@ -112,7 +112,7 @@ private slots: void msgfriend(); void recommendfriend(); void removefriend(); -#ifdef UNFINISHED +#ifdef UNFINISHED_FD void viewprofile(); #endif diff --git a/retroshare-gui/src/gui/settings/GeneralPage.ui b/retroshare-gui/src/gui/settings/GeneralPage.ui index c3d65a3b5..4a87f7823 100755 --- a/retroshare-gui/src/gui/settings/GeneralPage.ui +++ b/retroshare-gui/src/gui/settings/GeneralPage.ui @@ -6,7 +6,7 @@ 0 0 - 397 + 411 400 @@ -561,17 +561,21 @@ For Advanced Users - - - 2 - - + + Enable Advanced Mode (Restart Required) + + + + Enable Experimental Features (Restart Required) + + + diff --git a/retroshare-gui/src/gui/unfinished/ApplicationWindow.cpp b/retroshare-gui/src/gui/unfinished/ApplicationWindow.cpp index 81354db4a..a9fb6dadf 100644 --- a/retroshare-gui/src/gui/unfinished/ApplicationWindow.cpp +++ b/retroshare-gui/src/gui/unfinished/ApplicationWindow.cpp @@ -32,10 +32,15 @@ #include -#include "GamesDialog.h" -#include "PhotoDialog.h" -#include "CalDialog.h" -#include "StatisticDialog.h" +#include "gui/PhotoShare/PhotoDialog.h" +#include "gui/WikiPoos/WikiDialog.h" +#include "gui/TheWire/WireDialog.h" +#include "gui/Identity/IdDialog.h" + +//#include "GamesDialog.h" +//#include "CalDialog.h" +//#include "PhotoDialog.h" +//#include "StatisticDialog.h" #define FONT QFont("Arial", 9) @@ -61,7 +66,7 @@ ApplicationWindow::ApplicationWindow(QWidget* parent, Qt::WFlags flags) setWindowTitle(tr("RetroShare")); - Settings->loadWidgetInformation(this); + //Settings->loadWidgetInformation(this); // Setting icons this->setWindowIcon(QIcon(QString::fromUtf8(":/images/rstray3.png"))); @@ -70,23 +75,38 @@ ApplicationWindow::ApplicationWindow(QWidget* parent, Qt::WFlags flags) /* Create the config pages and actions */ QActionGroup *grp = new QActionGroup(this); - StatisticDialog *statisticDialog = NULL; - ui.stackPages->add(statisticDialog = new StatisticDialog(ui.stackPages), - createPageAction(QIcon(IMAGE_STATISTIC), tr("Statistics"), grp)); + //StatisticDialog *statisticDialog = NULL; + //ui.stackPages->add(statisticDialog = new StatisticDialog(ui.stackPages), + // createPageAction(QIcon(IMAGE_STATISTIC), tr("Statistics"), grp)); + + //PhotoDialog *photoDialog = NULL; + //ui.stackPages->add(photoDialog = new PhotoDialog(ui.stackPages), + // createPageAction(QIcon(IMAGE_PHOTO), tr("Photo View"), grp)); + + //GamesDialog *gamesDialog = NULL; + //ui.stackPages->add(gamesDialog = new GamesDialog(ui.stackPages), + // createPageAction(QIcon(IMAGE_GAMES), tr("Games Launcher"), grp)); + + //CalDialog *calDialog = NULL; + //ui.stackPages->add(calDialog = new CalDialog(ui.stackPages), + // createPageAction(QIcon(IMAGE_CALENDAR), tr("Shared Calendars"), grp)); + + + IdDialog *idDialog = NULL; + ui.stackPages->add(idDialog = new IdDialog(ui.stackPages), + createPageAction(QIcon(IMAGE_LIBRARY), tr("Identities"), grp)); PhotoDialog *photoDialog = NULL; ui.stackPages->add(photoDialog = new PhotoDialog(ui.stackPages), createPageAction(QIcon(IMAGE_PHOTO), tr("Photo View"), grp)); - GamesDialog *gamesDialog = NULL; - ui.stackPages->add(gamesDialog = new GamesDialog(ui.stackPages), - createPageAction(QIcon(IMAGE_GAMES), tr("Games Launcher"), grp)); - - CalDialog *calDialog = NULL; - ui.stackPages->add(calDialog = new CalDialog(ui.stackPages), - createPageAction(QIcon(IMAGE_CALENDAR), tr("Shared Calendars"), grp)); - + WikiDialog *wikiDialog = NULL; + ui.stackPages->add(wikiDialog = new WikiDialog(ui.stackPages), + createPageAction(QIcon(IMAGE_LIBRARY), tr("Wiki Pages"), grp)); + WireDialog *wireDialog = NULL; + ui.stackPages->add(wireDialog = new WireDialog(ui.stackPages), + createPageAction(QIcon(IMAGE_BWGRAPH), tr("The Wire"), grp)); /* Create the toolbar */ ui.toolBar->addActions(grp->actions()); @@ -154,7 +174,7 @@ void ApplicationWindow::createActions() void ApplicationWindow::closeEvent(QCloseEvent *e) { - Settings->saveWidgetInformation(this); + //Settings->saveWidgetInformation(this); hide(); e->ignore();