mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-23 14:39:34 -05:00
added unfinished section to compile unfinished examples and prototypes
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1858 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
d975d8bf1f
commit
ecac6008bc
@ -108,7 +108,6 @@ DEPENDPATH += . \
|
||||
gui\images \
|
||||
gui\Preferences \
|
||||
gui\common \
|
||||
gui\library \
|
||||
gui\toaster \
|
||||
gui\help\browser \
|
||||
gui\elastic
|
||||
@ -125,8 +124,6 @@ HEADERS += rshare.h \
|
||||
gui/DLListDelegate.h \
|
||||
gui/ULListDelegate.h \
|
||||
gui/StartDialog.h \
|
||||
gui/BlogDialog.h \
|
||||
gui/CalDialog.h \
|
||||
gui/NetworkDialog.h \
|
||||
gui/GenCertDialog.h \
|
||||
gui/TransfersDialog.h \
|
||||
@ -135,15 +132,9 @@ HEADERS += rshare.h \
|
||||
gui/mainpage.h \
|
||||
gui/mainpagestack.h \
|
||||
gui/MainWindow.h \
|
||||
gui/ApplicationWindow.h \
|
||||
gui/ExampleDialog.h \
|
||||
gui/GamesDialog.h \
|
||||
gui/PhotoDialog.h \
|
||||
gui/TurtleRouterDialog.h \
|
||||
gui/PhotoShow.h \
|
||||
gui/AddLinksDialog.h \
|
||||
gui/LinksDialog.h \
|
||||
gui/LibraryDialog.h \
|
||||
gui/ForumsDialog.h \
|
||||
gui/forums/CreateForum.h \
|
||||
gui/forums/CreateForumMsg.h \
|
||||
@ -157,7 +148,6 @@ HEADERS += rshare.h \
|
||||
gui/SearchDialog.h \
|
||||
gui/SharedFilesDialog.h \
|
||||
gui/ShareManager.h \
|
||||
gui/StatisticDialog.h \
|
||||
gui/SoundManager.h \
|
||||
gui/FileTransferInfoWidget.h \
|
||||
gui/RsAutoUpdatePage.h \
|
||||
@ -198,7 +188,6 @@ HEADERS += rshare.h \
|
||||
gui/chat/PopupChatDialog.h \
|
||||
gui/connect/ConnectDialog.h \
|
||||
gui/connect/ConfCertDialog.h \
|
||||
gui/library/FindWindow.h \
|
||||
gui/msgs/ChanMsgDialog.h \
|
||||
gui/msgs/ChanCreateDialog.h \
|
||||
gui/images/retroshare_win.rc.h \
|
||||
@ -243,9 +232,6 @@ HEADERS += rshare.h \
|
||||
gui/elastic/arrow.h \
|
||||
gui/elastic/node.h \
|
||||
gui/NewsFeed.h \
|
||||
gui/PeersFeed.h \
|
||||
gui/MsgFeed.h \
|
||||
gui/TransferFeed.h \
|
||||
gui/ChannelFeed.h \
|
||||
gui/GeneralMsgDialog.h \
|
||||
gui/ChanGroupDelegate.h \
|
||||
@ -264,23 +250,14 @@ HEADERS += rshare.h \
|
||||
gui/connect/ConnectFriendWizard.h
|
||||
|
||||
|
||||
FORMS += gui/BlogDialog.ui \
|
||||
gui/CalDialog.ui \
|
||||
gui/StartDialog.ui \
|
||||
FORMS += gui/StartDialog.ui \
|
||||
gui/GenCertDialog.ui \
|
||||
gui/AddLinksDialog.ui \
|
||||
gui/NetworkDialog.ui \
|
||||
gui/TransfersDialog.ui \
|
||||
gui/MainWindow.ui \
|
||||
gui/ApplicationWindow.ui \
|
||||
gui/ExampleDialog.ui \
|
||||
gui/TurtleRouterDialog.ui \
|
||||
gui/GamesDialog.ui \
|
||||
gui/PhotoDialog.ui \
|
||||
gui/PhotoShow.ui \
|
||||
gui/LinksDialog.ui \
|
||||
gui/LibraryDialog.ui \
|
||||
gui/ForumsDialog.ui \
|
||||
gui/forums/CreateForum.ui \
|
||||
gui/forums/CreateForumMsg.ui \
|
||||
gui/NetworkView.ui \
|
||||
@ -290,7 +267,6 @@ FORMS += gui/BlogDialog.ui \
|
||||
gui/SearchDialog.ui \
|
||||
gui/SharedFilesDialog.ui \
|
||||
gui/ShareManager.ui \
|
||||
gui/StatisticDialog.ui \
|
||||
gui/MessagesDialog.ui \
|
||||
gui/MessagesPopupDialog.ui \
|
||||
gui/help/browser/helpbrowser.ui \
|
||||
@ -322,9 +298,6 @@ FORMS += gui/BlogDialog.ui \
|
||||
gui/advsearch/AdvancedSearchDialog.ui \
|
||||
gui/advsearch/expressionwidget.ui \
|
||||
gui/NewsFeed.ui \
|
||||
gui/PeersFeed.ui \
|
||||
gui/MsgFeed.ui \
|
||||
gui/TransferFeed.ui \
|
||||
gui/ChannelFeed.ui \
|
||||
gui/GeneralMsgDialog.ui \
|
||||
gui/feeds/ForumNewItem.ui \
|
||||
@ -346,21 +319,13 @@ SOURCES += main.cpp \
|
||||
gui/ULListDelegate.cpp \
|
||||
gui/StartDialog.cpp \
|
||||
gui/GenCertDialog.cpp \
|
||||
gui/BlogDialog.cpp \
|
||||
gui/CalDialog.cpp \
|
||||
gui/NetworkDialog.cpp \
|
||||
gui/TransfersDialog.cpp \
|
||||
gui/graphframe.cpp \
|
||||
gui/mainpagestack.cpp \
|
||||
gui/TurtleRouterDialog.cpp \
|
||||
gui/MainWindow.cpp \
|
||||
gui/ApplicationWindow.cpp \
|
||||
gui/ExampleDialog.cpp \
|
||||
gui/GamesDialog.cpp \
|
||||
gui/PhotoDialog.cpp \
|
||||
gui/PhotoShow.cpp \
|
||||
gui/LinksDialog.cpp \
|
||||
gui/LibraryDialog.cpp \
|
||||
gui/ForumsDialog.cpp \
|
||||
gui/forums/CreateForum.cpp \
|
||||
gui/forums/CreateForumMsg.cpp \
|
||||
@ -376,7 +341,6 @@ SOURCES += main.cpp \
|
||||
gui/AddLinksDialog.cpp \
|
||||
gui/SharedFilesDialog.cpp \
|
||||
gui/ShareManager.cpp \
|
||||
gui/StatisticDialog.cpp \
|
||||
gui/SoundManager.cpp \
|
||||
gui/MessagesDialog.cpp \
|
||||
gui/FileTransferInfoWidget.cpp \
|
||||
@ -432,7 +396,6 @@ SOURCES += main.cpp \
|
||||
gui/common/vmessagebox.cpp \
|
||||
gui/common/rwindow.cpp \
|
||||
gui/common/html.cpp \
|
||||
gui/library/FindWindow.cpp \
|
||||
gui/statusbar/peerstatus.cpp \
|
||||
gui/statusbar/dhtstatus.cpp \
|
||||
gui/statusbar/natstatus.cpp \
|
||||
@ -450,9 +413,6 @@ SOURCES += main.cpp \
|
||||
gui/elastic/arrow.cpp \
|
||||
gui/elastic/node.cpp \
|
||||
gui/NewsFeed.cpp \
|
||||
gui/PeersFeed.cpp \
|
||||
gui/MsgFeed.cpp \
|
||||
gui/TransferFeed.cpp \
|
||||
gui/ChannelFeed.cpp \
|
||||
gui/GeneralMsgDialog.cpp \
|
||||
gui/ChanGroupDelegate.cpp \
|
||||
@ -551,6 +511,47 @@ newsettings {
|
||||
}
|
||||
|
||||
|
||||
|
||||
unfinished {
|
||||
|
||||
DEPENDPATH += gui/unfinished \
|
||||
|
||||
HEADERS += gui/unfinished/ApplicationWindow.h \
|
||||
gui/unfinished/BlogDialog.h \
|
||||
gui/unfinished/CalDialog.h \
|
||||
gui/unfinished/ExampleDialog.h \
|
||||
gui/unfinished/GamesDialog.h \
|
||||
gui/unfinished/MsgFeed.h \
|
||||
gui/unfinished/PeersFeed.h \
|
||||
gui/unfinished/PhotoDialog.h \
|
||||
gui/unfinished/PhotoShow.h \
|
||||
gui/unfinished/StatisticDialog.h \
|
||||
gui/unfinished/TransferFeed.h
|
||||
|
||||
FORMS += gui/unfinished/ApplicationWindow.ui \
|
||||
gui/unfinished/BlogDialog.ui \
|
||||
gui/unfinished/CalDialog.ui \
|
||||
gui/unfinished/ExampleDialog.ui \
|
||||
gui/unfinished/GamesDialog.ui \
|
||||
gui/unfinished/MsgFeed.ui \
|
||||
gui/unfinished/PeersFeed.ui \
|
||||
gui/unfinished/PhotoDialog.ui \
|
||||
gui/unfinished/PhotoShow.ui \
|
||||
gui/unfinished/StatisticDialog.ui \
|
||||
gui/unfinished/TransferFeed.ui
|
||||
|
||||
SOURCES += gui/unfinished/ApplicationWindow.cpp \
|
||||
gui/unfinished/BlogDialog.cpp \
|
||||
gui/unfinished/CalDialog.cpp \
|
||||
gui/unfinished/ExampleDialog.cpp \
|
||||
gui/unfinished/GamesDialog.cpp \
|
||||
gui/unfinished/MsgFeed.cpp \
|
||||
gui/unfinished/PeersFeed.cpp \
|
||||
gui/unfinished/PhotoDialog.cpp \
|
||||
gui/unfinished/PhotoShow.cpp \
|
||||
gui/unfinished/StatisticDialog.cpp \
|
||||
gui/unfinished/TransferFeed.cpp
|
||||
|
||||
DEFINES *= UNFINISHED
|
||||
}
|
||||
|
||||
|
||||
|
@ -27,16 +27,12 @@
|
||||
#include <QIcon>
|
||||
#include <QPixmap>
|
||||
|
||||
#include "NetworkView.h"
|
||||
#include "LinksDialog.h"
|
||||
#include "PhotoDialog.h"
|
||||
#include "ForumsDialog.h"
|
||||
#include "NewsFeed.h"
|
||||
#include "PeersFeed.h"
|
||||
#include "TransferFeed.h"
|
||||
#include "MsgFeed.h"
|
||||
#include "ChannelFeed.h"
|
||||
#include "ShareManager.h"
|
||||
#include "NetworkView.h"
|
||||
#include "LinksDialog.h"
|
||||
#include "ForumsDialog.h"
|
||||
#include "NewsFeed.h"
|
||||
|
||||
#include "rshare.h"
|
||||
#include "MainWindow.h"
|
||||
@ -126,8 +122,10 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
|
||||
|
||||
/*messengerWindow instance is created statically so that RsAutoUpdatePage can access it*/
|
||||
messengerWindow = MessengerWindow::getInstance();
|
||||
#ifdef UNFINISHED
|
||||
applicationWindow = new ApplicationWindow();
|
||||
applicationWindow->hide();
|
||||
#endif
|
||||
|
||||
/** Left Side ToolBar**/
|
||||
connect(ui.actionAdd_Friend, SIGNAL(triggered() ), this , SLOT( addFriend() ) );
|
||||
@ -218,8 +216,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
|
||||
ui.toolBar->addSeparator();
|
||||
connect(grp, SIGNAL(triggered(QAction *)), ui.stackPages, SLOT(showPage(QAction *)));
|
||||
|
||||
#ifdef RS_RELEASE_VERSION
|
||||
#else
|
||||
#ifdef UNFINISHED
|
||||
addAction(new QAction(QIcon(IMAGE_UNFINISHED), tr("Unfinished"), ui.toolBar), SLOT(showApplWindow()));
|
||||
#endif
|
||||
|
||||
@ -286,7 +283,9 @@ MainWindow::~MainWindow()
|
||||
delete natstatus;
|
||||
delete ratesstatus;
|
||||
delete _settings;
|
||||
#ifdef UNFINISHED
|
||||
delete applicationWindow;
|
||||
#endif
|
||||
}
|
||||
|
||||
/** Creates a tray icon with a context menu and adds it to the system
|
||||
@ -303,8 +302,7 @@ void MainWindow::createTrayIcon()
|
||||
menu->addAction(_messagesAct);
|
||||
menu->addAction(_bandwidthAct);
|
||||
|
||||
#ifdef RS_RELEASE_VERSION
|
||||
#else
|
||||
#ifdef UNFINISHED
|
||||
menu->addAction(_appAct);
|
||||
#endif
|
||||
menu->addAction(_settingsAct);
|
||||
@ -460,11 +458,12 @@ void MainWindow::showMessengerWindow()
|
||||
|
||||
|
||||
/** Shows Application window */
|
||||
#ifdef UNFINISHED
|
||||
void MainWindow::showApplWindow()
|
||||
{
|
||||
applicationWindow->show();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/** Create and bind actions to events. Setup for initial
|
||||
* tray menu configuration. */
|
||||
|
@ -27,15 +27,17 @@
|
||||
#include <QFileDialog>
|
||||
#include <QSystemTrayIcon>
|
||||
|
||||
#ifdef UNFINISHED
|
||||
#include "unfinished/ApplicationWindow.h"
|
||||
#endif
|
||||
|
||||
#include "NetworkDialog.h"
|
||||
#include "PeersDialog.h"
|
||||
#include "SearchDialog.h"
|
||||
#include "TransfersDialog.h"
|
||||
#include "MessagesDialog.h"
|
||||
#include "SharedFilesDialog.h"
|
||||
#include "StatisticDialog.h"
|
||||
#include "MessengerWindow.h"
|
||||
#include "ApplicationWindow.h"
|
||||
#include "PluginsPage.h"
|
||||
|
||||
#include "bwgraph/bwgraph.h"
|
||||
@ -89,7 +91,9 @@ public:
|
||||
MessagesDialog *messagesDialog;
|
||||
SharedFilesDialog *sharedfilesDialog;
|
||||
MessengerWindow *messengerWindow;
|
||||
#ifdef UNFINISHED
|
||||
ApplicationWindow *applicationWindow;
|
||||
#endif
|
||||
PluginsPage* pluginsPage ;
|
||||
|
||||
|
||||
@ -114,7 +118,10 @@ private slots:
|
||||
/** Toolbar fns. */
|
||||
void addFriend();
|
||||
void showMessengerWindow();
|
||||
#ifdef UNFINISHED
|
||||
void showApplWindow();
|
||||
#endif
|
||||
|
||||
void showabout();
|
||||
void openShareManager();
|
||||
void displaySystrayMsg(const QString&,const QString&) ;
|
||||
|
272
retroshare-gui/src/gui/unfinished/ApplicationWindow.cpp
Normal file
272
retroshare-gui/src/gui/unfinished/ApplicationWindow.cpp
Normal file
@ -0,0 +1,272 @@
|
||||
/****************************************************************
|
||||
* RetroShare is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2006, 2007 crypton
|
||||
*
|
||||
* 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 <QtGui>
|
||||
#include <QMessageBox>
|
||||
#include <QSystemTrayIcon>
|
||||
#include <QString>
|
||||
#include <QtDebug>
|
||||
#include <QIcon>
|
||||
#include <QPixmap>
|
||||
|
||||
#include <rshare.h>
|
||||
#include "ApplicationWindow.h"
|
||||
|
||||
#include "rsiface/rsiface.h"
|
||||
|
||||
#include "GamesDialog.h"
|
||||
#include "PhotoDialog.h"
|
||||
#include "BlogDialog.h"
|
||||
#include "CalDialog.h"
|
||||
#include "PeersFeed.h"
|
||||
#include "TransferFeed.h"
|
||||
#include "MsgFeed.h"
|
||||
#include "StatisticDialog.h"
|
||||
|
||||
|
||||
#define FONT QFont(tr("Arial"), 8)
|
||||
|
||||
/* Images for toolbar icons */
|
||||
#define IMAGE_NETWORK ":/images/network32.png"
|
||||
#define IMAGE_PEERS ":/images/groupchat.png"
|
||||
#define IMAGE_SEARCH ":/images/filefind.png"
|
||||
#define IMAGE_TRANSFERS ":/images/ktorrent.png"
|
||||
#define IMAGE_FILES ":/images/folder_green.png"
|
||||
#define IMAGE_FORUMS ":/images/konversation.png"
|
||||
#define IMAGE_CHANNELS ":/images/channels.png"
|
||||
#define IMAGE_PREFERENCES ":/images/settings16.png"
|
||||
#define IMAGE_CHAT ":/images/chats_24x24.png"
|
||||
#define IMAGE_RETROSHARE ":/images/RetroShare16.png"
|
||||
#define IMAGE_ABOUT ":/images/informations_24x24.png"
|
||||
#define IMAGE_STATISTIC ":/images/ksysguard32.png"
|
||||
#define IMAGE_GAMES ":/images/kgames.png"
|
||||
#define IMAGE_PHOTO ":/images/lphoto.png"
|
||||
#define IMAGE_BWGRAPH ":/images/ksysguard.png"
|
||||
#define IMAGE_RSM32 ":/images/rsmessenger32.png"
|
||||
#define IMAGE_RSM16 ":/images/rsmessenger16.png"
|
||||
#define IMAGE_CLOSE ":/images/close_normal.png"
|
||||
#define IMAGE_SMPLAYER ":/images/smplayer_icon32.png"
|
||||
#define IMAGE_CALENDAR ":/images/calendar.png"
|
||||
#define IMAGE_NEWSFEED ":/images/konqsidebar_news24.png"
|
||||
#define IMAGE_LINKS ":/images/ktorrent.png"
|
||||
#define IMAGE_MESSAGES ":/images/evolution.png"
|
||||
#define IMAGE_BLOGS ":/images/kblogger.png"
|
||||
#define IMAGE_LIBRARY ":/images/library.png"
|
||||
#define IMAGE_PLUGINS ":/images/extension_32.png"
|
||||
|
||||
|
||||
|
||||
/* Keys for UI Preferences */
|
||||
#define UI_PREF_PROMPT_ON_QUIT "UIOptions/ConfirmOnQuit"
|
||||
/* uncomment this for release version */
|
||||
#define RS_RELEASE_VERSION 1
|
||||
|
||||
/** Constructor */
|
||||
ApplicationWindow::ApplicationWindow(QWidget* parent, Qt::WFlags flags)
|
||||
: QMainWindow(parent, flags)
|
||||
{
|
||||
/* Invoke the Qt Designer generated QObject setup routine */
|
||||
ui.setupUi(this);
|
||||
|
||||
setWindowTitle(tr("RetroShare"));
|
||||
|
||||
RshareSettings config;
|
||||
config.loadWidgetInformation(this);
|
||||
|
||||
// Setting icons
|
||||
this->setWindowIcon(QIcon(QString::fromUtf8(":/images/rstray3.png")));
|
||||
loadStyleSheet("Default");
|
||||
|
||||
/* 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));
|
||||
|
||||
PeersFeed *peersFeed = NULL;
|
||||
ui.stackPages->add(peersFeed = new PeersFeed(ui.stackPages),
|
||||
createPageAction(QIcon(IMAGE_PEERS), tr("Peers"), grp));
|
||||
|
||||
TransferFeed *transferFeed = NULL;
|
||||
ui.stackPages->add(transferFeed = new TransferFeed(ui.stackPages),
|
||||
createPageAction(QIcon(IMAGE_LINKS), tr("Transfers"), grp));
|
||||
|
||||
MsgFeed *msgFeed = NULL;
|
||||
ui.stackPages->add(msgFeed = new MsgFeed(ui.stackPages),
|
||||
createPageAction(QIcon(IMAGE_MESSAGES), tr("Messages"), grp));
|
||||
|
||||
BlogDialog *blogDialog = NULL;
|
||||
ui.stackPages->add(blogDialog = new BlogDialog(ui.stackPages),
|
||||
createPageAction(QIcon(IMAGE_BLOGS), tr("Blog Feed"), grp));
|
||||
|
||||
|
||||
GamesDialog *gamesDialog = NULL;
|
||||
ui.stackPages->add(gamesDialog = new GamesDialog(ui.stackPages),
|
||||
createPageAction(QIcon(IMAGE_GAMES), tr("Games Launcher"), grp));
|
||||
|
||||
PhotoDialog *photoDialog = NULL;
|
||||
ui.stackPages->add(photoDialog = new PhotoDialog(ui.stackPages),
|
||||
createPageAction(QIcon(IMAGE_PHOTO), tr("Photo View"), grp));
|
||||
|
||||
|
||||
CalDialog *calDialog = NULL;
|
||||
ui.stackPages->add(calDialog = new CalDialog(ui.stackPages),
|
||||
createPageAction(QIcon(IMAGE_CALENDAR), tr("Shared Calendars"), grp));
|
||||
|
||||
|
||||
|
||||
/* Create the toolbar */
|
||||
ui.toolBar->addActions(grp->actions());
|
||||
ui.toolBar->addSeparator();
|
||||
connect(grp, SIGNAL(triggered(QAction *)), ui.stackPages, SLOT(showPage(QAction *)));
|
||||
|
||||
/* Create and bind the messenger button */
|
||||
//addAction(new QAction(QIcon(IMAGE_SMPLAYER), tr("SMPlayer"), ui.toolBar), SLOT(showsmplayer()));
|
||||
|
||||
}
|
||||
|
||||
/** Creates a new action associated with a config page. */
|
||||
QAction* ApplicationWindow::createPageAction(QIcon img, QString text, QActionGroup *group)
|
||||
{
|
||||
QAction *action = new QAction(img, text, group);
|
||||
action->setCheckable(true);
|
||||
action->setFont(FONT);
|
||||
return action;
|
||||
}
|
||||
|
||||
/** Adds the given action to the toolbar and hooks its triggered() signal to
|
||||
* the specified slot (if given). */
|
||||
void ApplicationWindow::addAction(QAction *action, const char *slot)
|
||||
{
|
||||
action->setFont(FONT);
|
||||
ui.toolBar->addAction(action);
|
||||
connect(action, SIGNAL(triggered()), this, slot);
|
||||
}
|
||||
|
||||
/** Overloads the default show so we can load settings */
|
||||
void ApplicationWindow::show()
|
||||
{
|
||||
|
||||
if (!this->isVisible()) {
|
||||
QMainWindow::show();
|
||||
} else {
|
||||
QMainWindow::activateWindow();
|
||||
setWindowState(windowState() & ~Qt::WindowMinimized | Qt::WindowActive);
|
||||
QMainWindow::raise();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Shows the config dialog with focus set to the given page. */
|
||||
void ApplicationWindow::show(Page page)
|
||||
{
|
||||
/* Show the dialog. */
|
||||
show();
|
||||
|
||||
/* Set the focus to the specified page. */
|
||||
ui.stackPages->setCurrentIndex((int)page);
|
||||
}
|
||||
|
||||
|
||||
/** Destructor. */
|
||||
ApplicationWindow::~ApplicationWindow()
|
||||
{
|
||||
// is this allocated anywhere ??
|
||||
// delete exampleDialog;
|
||||
}
|
||||
|
||||
/** Create and bind actions to events. Setup for initial
|
||||
* tray menu configuration. */
|
||||
void ApplicationWindow::createActions()
|
||||
{
|
||||
}
|
||||
|
||||
void ApplicationWindow::closeEvent(QCloseEvent *e)
|
||||
{
|
||||
RshareSettings config;
|
||||
config.saveWidgetInformation(this);
|
||||
|
||||
hide();
|
||||
e->ignore();
|
||||
}
|
||||
|
||||
|
||||
void ApplicationWindow::updateMenu()
|
||||
{
|
||||
toggleVisibilityAction->setText(isVisible() ? tr("Hide") : tr("Show"));
|
||||
}
|
||||
|
||||
void ApplicationWindow::toggleVisibility(QSystemTrayIcon::ActivationReason e)
|
||||
{
|
||||
if(e == QSystemTrayIcon::Trigger || e == QSystemTrayIcon::DoubleClick){
|
||||
if(isHidden()){
|
||||
show();
|
||||
if(isMinimized()){
|
||||
if(isMaximized()){
|
||||
showMaximized();
|
||||
}else{
|
||||
showNormal();
|
||||
}
|
||||
}
|
||||
raise();
|
||||
activateWindow();
|
||||
}else{
|
||||
hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ApplicationWindow::toggleVisibilitycontextmenu()
|
||||
{
|
||||
if (isVisible())
|
||||
hide();
|
||||
else
|
||||
show();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ApplicationWindow::loadStyleSheet(const QString &sheetName)
|
||||
{
|
||||
QFile file(":/qss/" + sheetName.toLower() + ".qss");
|
||||
file.open(QFile::ReadOnly);
|
||||
QString styleSheet = QLatin1String(file.readAll());
|
||||
|
||||
|
||||
qApp->setStyleSheet(styleSheet);
|
||||
|
||||
}
|
||||
|
||||
/** Shows smplayer */
|
||||
void ApplicationWindow::showsmplayer()
|
||||
{
|
||||
#if 0
|
||||
static SMPlayer * smplayer = 0;
|
||||
|
||||
if (smplayer == 0) {
|
||||
smplayer = new SMPlayer(QString::null, this);
|
||||
}
|
||||
|
||||
smplayer->gui()->show();
|
||||
#endif
|
||||
}
|
||||
|
115
retroshare-gui/src/gui/unfinished/ApplicationWindow.h
Normal file
115
retroshare-gui/src/gui/unfinished/ApplicationWindow.h
Normal file
@ -0,0 +1,115 @@
|
||||
/****************************************************************
|
||||
* RShare is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2006, crypton
|
||||
*
|
||||
* 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 _ApplicationWindow_H
|
||||
#define _ApplicationWindow_H
|
||||
|
||||
#include <QtGui>
|
||||
#include <QMainWindow>
|
||||
#include <QFileDialog>
|
||||
|
||||
#include "ExampleDialog.h"
|
||||
|
||||
|
||||
#include "ui_ApplicationWindow.h"
|
||||
|
||||
#include "gui/Preferences/rsharesettings.h"
|
||||
|
||||
class ApplicationWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** Main dialog pages. */
|
||||
enum Page {
|
||||
Graph = 0, /** Network Graph */
|
||||
Channels = 1, /** Channels page. */
|
||||
SharedDirectories = 2, /** Shared Directories page. */
|
||||
Search = 3, /** Search page. */
|
||||
Transfers = 4, /** Transfers page. */
|
||||
Chat = 5, /** Chat page. */
|
||||
Messages = 6, /** Messages page. */
|
||||
Statistics = 8 /** Statistic page. */
|
||||
|
||||
};
|
||||
|
||||
/** Default Constructor */
|
||||
ApplicationWindow(QWidget *parent = 0, Qt::WFlags flags = 0);
|
||||
|
||||
/** Destructor. */
|
||||
~ApplicationWindow();
|
||||
|
||||
/* A Bit of a Hack... but public variables for
|
||||
* the dialogs, so we can add them to the
|
||||
* Notify Class...
|
||||
*/
|
||||
|
||||
ExampleDialog *exampleDialog;
|
||||
//ChannelsDialog *channelsDialog;
|
||||
//GroupsDialog *groupsDialog;
|
||||
//StatisticDialog *statisticDialog;
|
||||
|
||||
public slots:
|
||||
/** Called when this dialog is to be displayed */
|
||||
void show();
|
||||
/** Shows the config dialog with focus set to the given page. */
|
||||
void show(Page page);
|
||||
|
||||
|
||||
private slots:
|
||||
|
||||
void updateMenu();
|
||||
|
||||
void toggleVisibility(QSystemTrayIcon::ActivationReason e);
|
||||
void toggleVisibilitycontextmenu();
|
||||
|
||||
void showsmplayer();
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *);
|
||||
|
||||
|
||||
private slots:
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
/** Create the actions on the tray menu or menubar */
|
||||
void createActions();
|
||||
|
||||
/** Creates a new action for a config page. */
|
||||
QAction* createPageAction(QIcon img, QString text, QActionGroup *group);
|
||||
/** Adds a new action to the toolbar. */
|
||||
void addAction(QAction *action, const char *slot = 0);
|
||||
|
||||
void loadStyleSheet(const QString &sheetName);
|
||||
|
||||
QSystemTrayIcon *trayIcon;
|
||||
QAction *toggleVisibilityAction;
|
||||
QMenu *menu;
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::ApplicationWindow ui;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
1076
retroshare-gui/src/gui/unfinished/ApplicationWindow.ui
Normal file
1076
retroshare-gui/src/gui/unfinished/ApplicationWindow.ui
Normal file
File diff suppressed because it is too large
Load Diff
210
retroshare-gui/src/gui/unfinished/BlogDialog.cpp
Normal file
210
retroshare-gui/src/gui/unfinished/BlogDialog.cpp
Normal file
@ -0,0 +1,210 @@
|
||||
/****************************************************************
|
||||
* 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 <QtGui>
|
||||
|
||||
#include "BlogDialog.h"
|
||||
|
||||
#include "gui/GeneralMsgDialog.h"
|
||||
|
||||
#include "rsiface/rsQblog.h"
|
||||
#include "rsiface/rspeers.h" //to retrieve peer/usrId info
|
||||
|
||||
#include "gui/feeds/BlogMsgItem.h"
|
||||
|
||||
|
||||
/** Constructor */
|
||||
BlogDialog::BlogDialog(QWidget *parent)
|
||||
: MainPage (parent)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
setupUi(this);
|
||||
|
||||
connect(postButton, SIGNAL(clicked()), this, SLOT(postBlog()));
|
||||
|
||||
/* mLayout -> to add widgets to */
|
||||
mLayout = new QVBoxLayout;
|
||||
//mLayout->setSpacing(0);
|
||||
//mLayout->setMargin(0);
|
||||
|
||||
QWidget *middleWidget = new QWidget();
|
||||
middleWidget->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum);
|
||||
middleWidget->setLayout(mLayout);
|
||||
|
||||
QScrollArea *scrollArea = new QScrollArea;
|
||||
//scrollArea->setBackgroundRole(QPalette::Dark);
|
||||
scrollArea->setWidget(middleWidget);
|
||||
scrollArea->setWidgetResizable(true);
|
||||
scrollArea->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
|
||||
|
||||
QVBoxLayout *layout2 = new QVBoxLayout;
|
||||
layout2->addWidget(scrollArea);
|
||||
layout2->setSpacing(0);
|
||||
layout2->setMargin(0);
|
||||
|
||||
frame->setLayout(layout2);
|
||||
|
||||
addDummyData();
|
||||
|
||||
updateBlogsStatic();
|
||||
|
||||
QTimer *timer = new QTimer(this);
|
||||
timer->connect(timer, SIGNAL(timeout()), this, SLOT(updateBlogs()));
|
||||
timer->start(15631);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void BlogDialog::updateBlogs(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void BlogDialog::updateBlogsStatic(void)
|
||||
{
|
||||
|
||||
#if 0
|
||||
rsQblog->getFilterSwitch();
|
||||
|
||||
std::map<std::string, std::string> UsrStatus;
|
||||
|
||||
if(!rsQblog->getStatus(UsrStatus))
|
||||
std::cerr << "failed to get usr status" << std::endl;
|
||||
|
||||
clear(); //create a clear screen
|
||||
|
||||
/* retrieve usr names and populate usr list bar */
|
||||
|
||||
std::list<std::string> usrList;
|
||||
QString TempVar; // to convert numerics to string note: tbd find way to avoid temporary
|
||||
|
||||
if (!rsPeers)
|
||||
{
|
||||
/* not ready yet! */
|
||||
return;
|
||||
}
|
||||
|
||||
if(!rsPeers->getFriendList(usrList))
|
||||
std::cerr << "failed to get friend list";
|
||||
|
||||
|
||||
usrList.push_back(rsPeers->getOwnId()); // add your id
|
||||
|
||||
/* populate the blog msgs screen */
|
||||
|
||||
std::map< std::string, std::multimap<long int, std::string> > blogs; // to store blogs
|
||||
|
||||
if(!rsQblog->getBlogs(blogs))
|
||||
std::cerr << "failed to get blogs" << std::endl;
|
||||
|
||||
/* print usr name and their blogs to screen */
|
||||
for(std::list<std::string>::iterator it = usrList.begin(); it !=usrList.end(); it++)
|
||||
{
|
||||
|
||||
|
||||
TempVar = rsPeers->getPeerName(*it).c_str(); // store usr name in temporary
|
||||
blogText->setTextColor(QColor(255, 0, 0, 255));
|
||||
blogText->setCurrentFont(mUsrFont); // make bold for username
|
||||
blogText->append("\n" + TempVar); // write usr name to screen
|
||||
std::cerr << "creating usr tree" << std::endl;
|
||||
|
||||
/*print blog time-posted/msgs to screen*/
|
||||
|
||||
std::multimap<long int, std::string>::reverse_iterator blogIt = blogs[*it].rbegin();
|
||||
|
||||
if(blogs[*it].empty())
|
||||
{
|
||||
std::cerr << "usr blog empty!" << std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
for( ; blogIt != blogs[*it].rend(); blogIt++)
|
||||
{
|
||||
std::cerr << "now printing blogs" << std::endl;
|
||||
time_t postedTime = blogIt->first;
|
||||
time(&postedTime); //convert to human readable time
|
||||
blogText->setTextColor(QColor(255, 0, 0, 255)); //
|
||||
blogText->setCurrentFont(mUsrFont); // make bold for posted date
|
||||
blogText->append("\nPosted: " + QString (ctime(&postedTime))); // print time of blog to screen
|
||||
blogText->setCurrentFont(mCurrentFont); // reset the font for blog messages
|
||||
blogText->setTextColor(QColor(0, 0, 0, 255)); // set back color to black
|
||||
blogText->append(blogIt->second.c_str()); // print blog msg to screen
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
void BlogDialog::addDummyData()
|
||||
{
|
||||
BlogMsgItem *bm1 = new BlogMsgItem(this, 0, "peerId", "msgId", true);
|
||||
BlogMsgItem *bm2 = new BlogMsgItem(this, 0, "peerId", "msgId", true);
|
||||
BlogMsgItem *bm3 = new BlogMsgItem(this, 0, "peerId", "msgId", true);
|
||||
BlogMsgItem *bm4 = new BlogMsgItem(this, 0, "peerId", "msgId", true);
|
||||
BlogMsgItem *bm5 = new BlogMsgItem(this, 0, "peerId", "msgId", true);
|
||||
|
||||
mLayout->addWidget(bm1);
|
||||
mLayout->addWidget(bm2);
|
||||
mLayout->addWidget(bm3);
|
||||
mLayout->addWidget(bm4);
|
||||
mLayout->addWidget(bm5);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* FeedHolder Functions (for FeedItem functionality) */
|
||||
void BlogDialog::deleteFeedItem(QWidget *item, uint32_t type)
|
||||
{
|
||||
std::cerr << "BlogDialog::deleteFeedItem()";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
|
||||
void BlogDialog::openChat(std::string peerId)
|
||||
{
|
||||
std::cerr << "BlogDialog::openChat()";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
void BlogDialog::postBlog()
|
||||
{
|
||||
|
||||
openMsg(FEEDHOLDER_MSG_BLOG, "", "");
|
||||
}
|
||||
|
||||
void BlogDialog::openMsg(uint32_t type, std::string grpId, std::string inReplyTo)
|
||||
{
|
||||
std::cerr << "BlogDialog::openMsg()";
|
||||
std::cerr << std::endl;
|
||||
GeneralMsgDialog *msgDialog = new GeneralMsgDialog(NULL);
|
||||
|
||||
|
||||
msgDialog->addDestination(type, grpId, inReplyTo);
|
||||
|
||||
msgDialog->show();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
63
retroshare-gui/src/gui/unfinished/BlogDialog.h
Normal file
63
retroshare-gui/src/gui/unfinished/BlogDialog.h
Normal file
@ -0,0 +1,63 @@
|
||||
/****************************************************************
|
||||
* RetroShare is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2008 Robert Fernie
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
|
||||
#ifndef _BLOG_DIALOG_H
|
||||
#define _BLOG_DIALOG_H
|
||||
|
||||
#include "gui/mainpage.h"
|
||||
#include "ui_BlogDialog.h"
|
||||
|
||||
#include "gui/feeds/FeedHolder.h"
|
||||
class BlogMsgItem;
|
||||
|
||||
|
||||
class BlogDialog : public MainPage, public FeedHolder, private Ui::BlogDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** Default Constructor */
|
||||
BlogDialog(QWidget *parent = 0);
|
||||
|
||||
/* FeedHolder Functions (for FeedItem functionality) */
|
||||
virtual void deleteFeedItem(QWidget *item, uint32_t type);
|
||||
virtual void openChat(std::string peerId);
|
||||
virtual void openMsg(uint32_t type, std::string grpId, std::string inReplyTo);
|
||||
|
||||
void updateBlogsStatic();
|
||||
|
||||
private slots:
|
||||
|
||||
void updateBlogs();
|
||||
void postBlog();
|
||||
|
||||
private:
|
||||
void addDummyData();
|
||||
|
||||
QLayout *mLayout;
|
||||
|
||||
std::map<std::string, BlogMsgItem *> mBlogMsgItems;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
219
retroshare-gui/src/gui/unfinished/BlogDialog.ui
Normal file
219
retroshare-gui/src/gui/unfinished/BlogDialog.ui
Normal file
@ -0,0 +1,219 @@
|
||||
<ui version="4.0" >
|
||||
<class>BlogDialog</class>
|
||||
<widget class="QWidget" name="BlogDialog" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>569</width>
|
||||
<height>294</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<property name="toolTip" >
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font" >
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap" >
|
||||
<pixmap resource="images.qrc" >:/images/kblogger.png</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2" >
|
||||
<property name="font" >
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Blogs</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="periodComboBox" >
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Last Month</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="images.qrc" >
|
||||
<normaloff>:/images/view_calendar_month.png</normaloff>:/images/view_calendar_month.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Last Week</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="images.qrc" >
|
||||
<normaloff>:/images/view_calendar_week.png</normaloff>:/images/view_calendar_week.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Last Day</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="images.qrc" >
|
||||
<normaloff>:/images/view_calendar_day.png</normaloff>:/images/view_calendar_day.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="usersComboBox" >
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>All Users</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="images.qrc" >
|
||||
<normaloff>:/images/user/identity16.png</normaloff>:/images/user/identity16.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Jimmy</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>John</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Jacki</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="postButton" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip" >
|
||||
<string>No Feeds</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Post Blog</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="images.qrc" >
|
||||
<normaloff>:/images/mail_send.png</normaloff>:/images/mail_send.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame" >
|
||||
<property name="frameShape" >
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="images.qrc" />
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
134
retroshare-gui/src/gui/unfinished/CalDialog.cpp
Normal file
134
retroshare-gui/src/gui/unfinished/CalDialog.cpp
Normal file
@ -0,0 +1,134 @@
|
||||
/****************************************************************
|
||||
* 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 <QDateTime>
|
||||
|
||||
#include <QDesktopServices>
|
||||
#include <QUrl>
|
||||
|
||||
//#include "rshare.h"
|
||||
#include "CalDialog.h"
|
||||
//#include "rsiface/rspeers.h"
|
||||
//#include "rsiface/rsrank.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <map>
|
||||
|
||||
#include <QContextMenuEvent>
|
||||
#include <QMenu>
|
||||
#include <QCursor>
|
||||
#include <QPoint>
|
||||
#include <QMouseEvent>
|
||||
#include <QPixmap>
|
||||
#include <QMessageBox>
|
||||
#include <QHeaderView>
|
||||
#include <QTimer>
|
||||
#include <QTableWidget>
|
||||
#include <QComboBox>
|
||||
|
||||
using namespace std;
|
||||
|
||||
/** Constructor */
|
||||
CalDialog::CalDialog(QWidget *parent)
|
||||
: MainPage(parent)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui.setupUi(this);
|
||||
|
||||
//declare local variables for GUI items
|
||||
name = ui.lne_name;
|
||||
location = ui.lne_location;
|
||||
status = ui.cbx_status;
|
||||
calendarList = ui.lst_calList;
|
||||
|
||||
//Set GUI Item Properties
|
||||
location->setEnabled(false);
|
||||
|
||||
//Create GUI Connections
|
||||
connect(ui.btn_add,SIGNAL(clicked()),this,SLOT(addItem()));
|
||||
connect(ui.btn_addFile,SIGNAL(clicked()),this,SLOT(addFile()));
|
||||
connect(ui.lst_calList,SIGNAL(itemPressed(QListWidgetItem*)),this,SLOT(setDetails(QListWidgetItem*)));
|
||||
connect(ui.btn_remove,SIGNAL(clicked()),this,SLOT(removeItem()));
|
||||
}
|
||||
|
||||
void CalDialog::addItem()
|
||||
{
|
||||
itemDetails = new CalItem();
|
||||
if(name->text() != QString(""))
|
||||
itemDetails->name = name->text();
|
||||
if(location->text() != QString(""))
|
||||
itemDetails->location = QString(location->text());
|
||||
itemDetails->status = status->currentIndex();
|
||||
|
||||
//Add Item to Calendar Item Map
|
||||
calItems.insert(itemDetails->name, *itemDetails);
|
||||
clearDetails(); //Clear Textbox Details (and itemDetails pointer)
|
||||
updateList(); //Update listWidget with new map data.
|
||||
}
|
||||
|
||||
void CalDialog::removeItem()
|
||||
{
|
||||
QListWidgetItem* item = calendarList->currentItem();
|
||||
calItems.remove(item->text());
|
||||
clearDetails();
|
||||
updateList();
|
||||
}
|
||||
|
||||
void CalDialog::updateList()
|
||||
{
|
||||
calendarList->clear(); //Clear existing items
|
||||
//Rebuild list from Map
|
||||
QMap<QString, CalItem>::iterator it;
|
||||
for(it = calItems.begin();it != calItems.end();++it)
|
||||
calendarList->addItem(it.key());
|
||||
}
|
||||
|
||||
void CalDialog::clearDetails()
|
||||
{
|
||||
name->setText("");
|
||||
location->setText("");
|
||||
status->setCurrentIndex(0);
|
||||
itemDetails = NULL;
|
||||
}
|
||||
|
||||
void CalDialog::addFile()
|
||||
{
|
||||
//Prompt for ICS calendar file
|
||||
QStringList file = QFileDialog::getOpenFileNames(this,
|
||||
"Select calendar to share",location->text(), "Calendars (*.ics)");
|
||||
|
||||
//Populate location LineEdit if file selected
|
||||
if(!file.empty())
|
||||
location->setText(*file.begin());
|
||||
}
|
||||
|
||||
void CalDialog::setDetails(QListWidgetItem* item)
|
||||
{
|
||||
clearDetails();
|
||||
QMap<QString, CalItem>::iterator it = calItems.find(item->text());
|
||||
CalItem temp = it.value();
|
||||
name->setText(temp.name);
|
||||
location->setText(temp.location);
|
||||
status->setCurrentIndex(temp.status);
|
||||
}
|
72
retroshare-gui/src/gui/unfinished/CalDialog.h
Normal file
72
retroshare-gui/src/gui/unfinished/CalDialog.h
Normal file
@ -0,0 +1,72 @@
|
||||
/****************************************************************
|
||||
* RetroShare GUI 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 _CALENDAR_DIALOG_H
|
||||
#define _CALENDAR_DIALOG_H
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QTableWidget>
|
||||
#include <QString>
|
||||
#include <QMap>
|
||||
|
||||
#include "gui/mainpage.h"
|
||||
#include "ui_CalDialog.h"
|
||||
|
||||
class CalItem
|
||||
{
|
||||
public:
|
||||
CalItem() {return;}
|
||||
QString name;
|
||||
QString location;
|
||||
int status;
|
||||
};
|
||||
|
||||
class CalDialog : public MainPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** Default Constructor */
|
||||
CalDialog(QWidget *parent = 0);
|
||||
|
||||
private slots:
|
||||
void addItem();
|
||||
void removeItem();
|
||||
void updateList();
|
||||
void clearDetails();
|
||||
void addFile();
|
||||
void setDetails(QListWidgetItem*);
|
||||
|
||||
private:
|
||||
//Should this be a vector for alphabetical sorting?
|
||||
QMap<QString, CalItem> calItems;
|
||||
CalItem *itemDetails;
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::CalDialog ui;
|
||||
|
||||
QLineEdit* name;
|
||||
QLineEdit* location;
|
||||
QComboBox* status;
|
||||
QListWidget* calendarList;
|
||||
};
|
||||
|
||||
#endif
|
285
retroshare-gui/src/gui/unfinished/CalDialog.ui
Normal file
285
retroshare-gui/src/gui/unfinished/CalDialog.ui
Normal file
@ -0,0 +1,285 @@
|
||||
<ui version="4.0" >
|
||||
<class>CalDialog</class>
|
||||
<widget class="QWidget" name="CalDialog" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>740</width>
|
||||
<height>540</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QTabWidget" name="tab_calendar" >
|
||||
<property name="tabShape" >
|
||||
<enum>QTabWidget::Rounded</enum>
|
||||
</property>
|
||||
<property name="currentIndex" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="elideMode" >
|
||||
<enum>Qt::ElideNone</enum>
|
||||
</property>
|
||||
<widget class="QWidget" name="localCal" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>734</width>
|
||||
<height>501</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="title" >
|
||||
<string>Local Calendars</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" >
|
||||
<item rowspan="3" row="0" column="0" >
|
||||
<layout class="QGridLayout" >
|
||||
<property name="sizeConstraint" >
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
</property>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="lbl_calList" >
|
||||
<property name="font" >
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Shared Calendar List</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QListWidget" name="lst_calList" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Expanding" hsizetype="Fixed" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>289</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QLabel" name="lbl_calDetail" >
|
||||
<property name="font" >
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Share Details</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<layout class="QGridLayout" >
|
||||
<property name="sizeConstraint" >
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
</property>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="lbl_name" >
|
||||
<property name="text" >
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QLineEdit" name="lne_name" />
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="lbl_location" >
|
||||
<property name="text" >
|
||||
<string>Location:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<layout class="QGridLayout" >
|
||||
<property name="sizeConstraint" >
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
</property>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLineEdit" name="lne_location" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QPushButton" name="btn_addFile" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Minimum" hsizetype="Minimum" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="baseSize" >
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QLabel" name="lbl_status" >
|
||||
<property name="text" >
|
||||
<string>Status:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" >
|
||||
<widget class="QComboBox" name="cbx_status" >
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Private</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Public</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" >
|
||||
<widget class="QLabel" name="lbl_allow" >
|
||||
<property name="text" >
|
||||
<string>Allow List:</string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" >
|
||||
<widget class="QListWidget" name="lst_allow" >
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string><Disabled></string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="1" >
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="sizeConstraint" >
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
</property>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_add" >
|
||||
<property name="text" >
|
||||
<string>Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_remove" >
|
||||
<property name="text" >
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="peerCal" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>26</x>
|
||||
<y>45</y>
|
||||
<width>760</width>
|
||||
<height>509</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="title" >
|
||||
<string>Peer Calendars</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="images.qrc" />
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
279
retroshare-gui/src/gui/unfinished/ExampleDialog.cpp
Normal file
279
retroshare-gui/src/gui/unfinished/ExampleDialog.cpp
Normal file
@ -0,0 +1,279 @@
|
||||
/****************************************************************
|
||||
* RetroShare is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2006,2007 crypton
|
||||
*
|
||||
* 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 "rshare.h"
|
||||
#include "ExampleDialog.h"
|
||||
#include "rsiface/rsiface.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
#include <QContextMenuEvent>
|
||||
#include <QMenu>
|
||||
#include <QCursor>
|
||||
#include <QPoint>
|
||||
#include <QMouseEvent>
|
||||
#include <QPixmap>
|
||||
#include <QMessageBox>
|
||||
#include <QHeaderView>
|
||||
|
||||
|
||||
/* Images for context menu icons */
|
||||
#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"
|
||||
#define IMAGE_OFFLINE ":/images/dhidden.png"
|
||||
|
||||
/** Constructor */
|
||||
ExampleDialog::ExampleDialog(QWidget *parent)
|
||||
: MainPage(parent)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui.setupUi(this);
|
||||
|
||||
connect( ui.peertreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( peertreeWidgetCostumPopupMenu( QPoint ) ) );
|
||||
|
||||
/* hide the Tree +/- */
|
||||
ui.peertreeWidget -> setRootIsDecorated( false );
|
||||
|
||||
/* 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 );
|
||||
|
||||
|
||||
/* Hide platform specific features */
|
||||
#ifdef Q_WS_WIN
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
void ExampleDialog::peertreeWidgetCostumPopupMenu( QPoint point )
|
||||
{
|
||||
|
||||
QMenu contextMnu( this );
|
||||
QMouseEvent *mevent = new QMouseEvent( QEvent::MouseButtonPress, point, Qt::RightButton, Qt::RightButton, Qt::NoModifier );
|
||||
|
||||
voteupAct = new QAction(QIcon(IMAGE_EXPIORTFRIEND), tr( "Vote Up" ), this );
|
||||
connect( voteupAct , SIGNAL( triggered() ), this, SLOT( voteup() ) );
|
||||
|
||||
votedownAct = new QAction(QIcon(IMAGE_REMOVEFRIEND), tr( "Vote Down" ), this );
|
||||
connect( votedownAct , SIGNAL( triggered() ), this, SLOT( votedown() ) );
|
||||
|
||||
contextMnu.clear();
|
||||
contextMnu.addAction(voteupAct);
|
||||
contextMnu.addSeparator();
|
||||
contextMnu.addAction(votedownAct);
|
||||
contextMnu.exec( mevent->globalPos() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* get the list of peers from the RsIface. */
|
||||
void ExampleDialog::insertExample()
|
||||
{
|
||||
|
||||
#if 0
|
||||
rsiface->lockData(); /* Lock Interface */
|
||||
|
||||
std::map<RsCertId,NeighbourInfo>::const_iterator it;
|
||||
const std::map<RsCertId,NeighbourInfo> &friends =
|
||||
rsiface->getFriendMap();
|
||||
|
||||
/* get a link to the table */
|
||||
QTreeWidget *peerWidget = ui.peertreeWidget;
|
||||
|
||||
/* remove old items ??? */
|
||||
peerWidget->clear();
|
||||
peerWidget->setColumnCount(12);
|
||||
|
||||
|
||||
|
||||
QList<QTreeWidgetItem *> items;
|
||||
for(it = friends.begin(); it != friends.end(); it++)
|
||||
{
|
||||
/* make a widget per friend */
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget*)0);
|
||||
|
||||
/* add all the labels */
|
||||
/* First 5 (1-5) Key Items */
|
||||
/* () Status Icon */
|
||||
item -> setText(0, "");
|
||||
|
||||
/* (0) Status */
|
||||
item -> setText(1, QString::fromStdString(
|
||||
it->second.statusString));
|
||||
|
||||
/* (1) Person */
|
||||
item -> setText(2, QString::fromStdString(it->second.name));
|
||||
|
||||
/* (2) Auto Connect */
|
||||
item -> setText(3, QString::fromStdString(
|
||||
it->second.connectString));
|
||||
|
||||
/* (3) Trust Level */
|
||||
item -> setText(4, QString::fromStdString(it->second.trustString));
|
||||
/* (4) Peer Address */
|
||||
item -> setText(5, QString::fromStdString(it->second.peerAddress));
|
||||
|
||||
/* less important ones */
|
||||
/* () Last Contact */
|
||||
item -> setText(6, QString::fromStdString(it->second.lastConnect));
|
||||
|
||||
/* () Org */
|
||||
item -> setText(7, QString::fromStdString(it->second.org));
|
||||
/* () Location */
|
||||
item -> setText(8, QString::fromStdString(it->second.loc));
|
||||
/* () Country */
|
||||
item -> setText(9, QString::fromStdString(it->second.country));
|
||||
|
||||
|
||||
/* Hidden ones: */
|
||||
/* () RsCertId */
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << it -> second.id;
|
||||
item -> setText(10, QString::fromStdString(out.str()));
|
||||
}
|
||||
|
||||
/* () AuthCode */
|
||||
item -> setText(11, QString::fromStdString(it->second.authCode));
|
||||
|
||||
/* change background */
|
||||
int i;
|
||||
if (it->second.statusString == "Online")
|
||||
{
|
||||
/* bright green */
|
||||
for(i = 1; i < 12; i++)
|
||||
{
|
||||
item -> setBackground(i,QBrush(Qt::green));
|
||||
item -> setIcon(0,(QIcon(IMAGE_ONLINE)));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (it->second.lastConnect != "Never")
|
||||
{
|
||||
for(i = 1; i < 12; i++)
|
||||
{
|
||||
item -> setBackground(i,QBrush(Qt::lightGray));
|
||||
item -> setIcon(0,(QIcon(IMAGE_OFFLINE)));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for(i = 1; i < 12; i++)
|
||||
{
|
||||
item -> setBackground(i,QBrush(Qt::gray));
|
||||
item -> setIcon(0,(QIcon(IMAGE_OFFLINE)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* add to the list */
|
||||
items.append(item);
|
||||
}
|
||||
|
||||
/* add the items in! */
|
||||
peerWidget->insertTopLevelItems(0, items);
|
||||
|
||||
rsiface->unlockData(); /* UnLock Interface */
|
||||
|
||||
peerWidget->update(); /* update display */
|
||||
#endif
|
||||
}
|
||||
|
||||
QTreeWidgetItem *ExampleDialog::getCurrentLine()
|
||||
{
|
||||
/* get the current, and extract the Id */
|
||||
|
||||
/* get a link to the table */
|
||||
QTreeWidget *peerWidget = ui.peertreeWidget;
|
||||
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;
|
||||
}
|
||||
|
||||
void ExampleDialog::voteup()
|
||||
{
|
||||
QTreeWidgetItem *c = getCurrentLine();
|
||||
std::cerr << "ExampleDialog::voteup()" << std::endl;
|
||||
}
|
||||
|
||||
void ExampleDialog::votedown()
|
||||
{
|
||||
QTreeWidgetItem *c = getCurrentLine();
|
||||
std::cerr << "ExampleDialog::votedown()" << std::endl;
|
||||
|
||||
/* need to get the input address / port */
|
||||
/*
|
||||
std::string addr;
|
||||
unsigned short port;
|
||||
rsServer->FriendSetAddress(getPeerRsCertId(c), addr, port);
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
72
retroshare-gui/src/gui/unfinished/ExampleDialog.h
Normal file
72
retroshare-gui/src/gui/unfinished/ExampleDialog.h
Normal file
@ -0,0 +1,72 @@
|
||||
/****************************************************************
|
||||
* RShare is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2006, crypton
|
||||
*
|
||||
* 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 _EXAMPLEDIALOG_H
|
||||
#define _EXAMPLEDIALOG_H
|
||||
|
||||
#include <QFileDialog>
|
||||
|
||||
//#include <config/rsharesettings.h>
|
||||
|
||||
#include "gui/mainpage.h"
|
||||
#include "ui_ExampleDialog.h"
|
||||
|
||||
|
||||
class ExampleDialog : public MainPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** Default Constructor */
|
||||
ExampleDialog(QWidget *parent = 0);
|
||||
/** Default Destructor */
|
||||
|
||||
void insertExample();
|
||||
|
||||
private slots:
|
||||
/** Create the context popup menu and it's submenus */
|
||||
void peertreeWidgetCostumPopupMenu( QPoint point );
|
||||
|
||||
void voteup();
|
||||
void votedown();
|
||||
|
||||
private:
|
||||
|
||||
/* Worker Functions */
|
||||
/* (1) Update Display */
|
||||
|
||||
/* (2) Utility Fns */
|
||||
QTreeWidgetItem *getCurrentLine();
|
||||
|
||||
/** Define the popup menus for the Context menu */
|
||||
QMenu* contextMnu;
|
||||
/** Defines the actions for the context menu */
|
||||
QAction* voteupAct;
|
||||
QAction* votedownAct;
|
||||
|
||||
QTreeWidget *exampletreeWidget;
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::ExampleDialog ui;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
643
retroshare-gui/src/gui/unfinished/ExampleDialog.ui
Normal file
643
retroshare-gui/src/gui/unfinished/ExampleDialog.ui
Normal file
@ -0,0 +1,643 @@
|
||||
<ui version="4.0" >
|
||||
<class>ExampleDialog</class>
|
||||
<widget class="QWidget" name="ExampleDialog" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>436</width>
|
||||
<height>261</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="palette" >
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="WindowText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Button" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>208</red>
|
||||
<green>208</green>
|
||||
<blue>208</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Light" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Midlight" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>247</red>
|
||||
<green>247</green>
|
||||
<blue>247</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Dark" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>104</red>
|
||||
<green>104</green>
|
||||
<blue>104</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Mid" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>139</red>
|
||||
<green>139</green>
|
||||
<blue>139</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Text" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="BrightText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ButtonText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Base" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>240</red>
|
||||
<green>240</green>
|
||||
<blue>240</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Shadow" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Highlight" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>128</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="HighlightedText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Link" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="LinkVisited" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>0</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="AlternateBase" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>231</red>
|
||||
<green>231</green>
|
||||
<blue>231</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="WindowText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Button" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>208</red>
|
||||
<green>208</green>
|
||||
<blue>208</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Light" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Midlight" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>247</red>
|
||||
<green>247</green>
|
||||
<blue>247</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Dark" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>104</red>
|
||||
<green>104</green>
|
||||
<blue>104</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Mid" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>139</red>
|
||||
<green>139</green>
|
||||
<blue>139</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Text" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="BrightText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ButtonText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Base" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>240</red>
|
||||
<green>240</green>
|
||||
<blue>240</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Shadow" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Highlight" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>192</red>
|
||||
<green>192</green>
|
||||
<blue>192</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="HighlightedText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Link" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="LinkVisited" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>0</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="AlternateBase" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>231</red>
|
||||
<green>231</green>
|
||||
<blue>231</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="WindowText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>104</red>
|
||||
<green>104</green>
|
||||
<blue>104</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Button" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>208</red>
|
||||
<green>208</green>
|
||||
<blue>208</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Light" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Midlight" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>247</red>
|
||||
<green>247</green>
|
||||
<blue>247</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Dark" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>104</red>
|
||||
<green>104</green>
|
||||
<blue>104</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Mid" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>139</red>
|
||||
<green>139</green>
|
||||
<blue>139</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Text" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>104</red>
|
||||
<green>104</green>
|
||||
<blue>104</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="BrightText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ButtonText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>104</red>
|
||||
<green>104</green>
|
||||
<blue>104</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Base" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>240</red>
|
||||
<green>240</green>
|
||||
<blue>240</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>240</red>
|
||||
<green>240</green>
|
||||
<blue>240</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Shadow" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Highlight" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>128</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="HighlightedText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Link" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="LinkVisited" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>0</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="AlternateBase" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>231</red>
|
||||
<green>231</green>
|
||||
<blue>231</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="font" >
|
||||
<font>
|
||||
<family>Arial</family>
|
||||
<pointsize>8</pointsize>
|
||||
<weight>50</weight>
|
||||
<italic>false</italic>
|
||||
<bold>false</bold>
|
||||
<underline>false</underline>
|
||||
<strikeout>false</strikeout>
|
||||
</font>
|
||||
</property>
|
||||
<property name="contextMenuPolicy" >
|
||||
<enum>Qt::NoContextMenu</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>1</number>
|
||||
</property>
|
||||
<item row="0" column="0" >
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="1" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap" >
|
||||
<pixmap resource="images.qrc" >:/images/peers_16x16.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QLabel" name="label_2" >
|
||||
<property name="text" >
|
||||
<string><html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal; text-decoration:none;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt; font-weight:600;">Friends</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2" >
|
||||
<widget class="QTreeWidget" name="peertreeWidget" >
|
||||
<property name="contextMenuPolicy" >
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="acceptDrops" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="iconSize" >
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="itemsExpandable" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sortingEnabled" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>#</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>Status</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>Person</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>Auto Connect</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>Trust Level</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>Peer Address</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>Last Contact</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>Organisation</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>Location</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>Country</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>Person Id</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>Auth Code</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="images.qrc" />
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
587
retroshare-gui/src/gui/unfinished/GamesDialog.cpp
Normal file
587
retroshare-gui/src/gui/unfinished/GamesDialog.cpp
Normal file
@ -0,0 +1,587 @@
|
||||
/****************************************************************
|
||||
* RetroShare is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2006,2007 crypton
|
||||
*
|
||||
* 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 "GamesDialog.h"
|
||||
#include "rsiface/rsiface.h"
|
||||
#include "rsiface/rsgame.h"
|
||||
#include "rsiface/rspeers.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
#include <QContextMenuEvent>
|
||||
#include <QMenu>
|
||||
#include <QCursor>
|
||||
#include <QPoint>
|
||||
#include <QMouseEvent>
|
||||
#include <QPixmap>
|
||||
#include <QMessageBox>
|
||||
#include <QHeaderView>
|
||||
|
||||
const uint32_t GAME_LIST_TYPE = 0;
|
||||
const uint32_t GAME_LIST_SERVER = 1;
|
||||
const uint32_t GAME_LIST_STATUS = 2;
|
||||
const uint32_t GAME_LIST_NAME = 3;
|
||||
const uint32_t GAME_LIST_ID = 4;
|
||||
|
||||
const uint32_t GAME_PEER_PLAYER = 0;
|
||||
const uint32_t GAME_PEER_INVITE = 1;
|
||||
const uint32_t GAME_PEER_INTEREST = 2;
|
||||
const uint32_t GAME_PEER_PLAY = 3;
|
||||
const uint32_t GAME_PEER_ID = 4;
|
||||
|
||||
|
||||
/* Images for context menu icons */
|
||||
#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"
|
||||
#define IMAGE_OFFLINE ":/images/dhidden.png"
|
||||
|
||||
/** Constructor */
|
||||
GamesDialog::GamesDialog(QWidget *parent)
|
||||
: MainPage(parent)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui.setupUi(this);
|
||||
|
||||
connect( ui.gameTreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( gameListPopupMenu( QPoint ) ) );
|
||||
connect( ui.peertreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( gamePeersPopupMenu( QPoint ) ) );
|
||||
|
||||
connect( ui.createButton, SIGNAL( pressed( void ) ), this, SLOT( createGame( void ) ) );
|
||||
connect( ui.deleteButton, SIGNAL( pressed( void ) ), this, SLOT( deleteGame( void ) ) );
|
||||
connect( ui.inviteButton, SIGNAL( pressed( void ) ), this, SLOT( inviteGame( void ) ) );
|
||||
connect( ui.playButton, SIGNAL( pressed( void ) ), this, SLOT( playGame ( void ) ) );
|
||||
|
||||
connect( ui.gameTreeWidget, SIGNAL( itemSelectionChanged( void ) ), this, SLOT( updateGameDetails( void ) ) );
|
||||
|
||||
/* hide the Tree +/- */
|
||||
ui.peertreeWidget -> setRootIsDecorated( false );
|
||||
|
||||
/* 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 );
|
||||
|
||||
|
||||
/* Hide platform specific features */
|
||||
#ifdef Q_WS_WIN
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void GamesDialog::updateGameList()
|
||||
{
|
||||
/* get the list of games from the server */
|
||||
std::list<RsGameInfo> gameList;
|
||||
std::list<RsGameInfo>::iterator it;
|
||||
|
||||
rsGameLauncher->getGameList(gameList);
|
||||
|
||||
/* get a link to the table */
|
||||
QTreeWidget *gameWidget = ui.gameTreeWidget;
|
||||
QTreeWidgetItem *oldSelect = getCurrentGame();
|
||||
QTreeWidgetItem *newSelect = NULL;
|
||||
std::string oldId;
|
||||
if (oldSelect)
|
||||
{
|
||||
oldId = (oldSelect->text(GAME_LIST_ID)).toStdString();
|
||||
}
|
||||
|
||||
|
||||
QList<QTreeWidgetItem *> items;
|
||||
for(it = gameList.begin(); it != gameList.end(); it++)
|
||||
{
|
||||
/* make a widget per game */
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget*)0);
|
||||
std::string serverName = rsPeers->getPeerName(it->serverId);
|
||||
item -> setText(GAME_LIST_TYPE, QString::fromStdString(it->gameType));
|
||||
item -> setText(GAME_LIST_SERVER, QString::fromStdString(serverName));
|
||||
item -> setText(GAME_LIST_NAME, QString::fromStdWString(it->gameName));
|
||||
item -> setText(GAME_LIST_STATUS, QString::fromStdString(it->status));
|
||||
item -> setText(GAME_LIST_ID, QString::fromStdString(it->gameId));
|
||||
|
||||
if ((oldSelect) && (oldId == it->gameId))
|
||||
{
|
||||
newSelect = item;
|
||||
}
|
||||
|
||||
/* add to the list */
|
||||
items.append(item);
|
||||
}
|
||||
|
||||
gameWidget->clear();
|
||||
gameWidget->setColumnCount(5);
|
||||
|
||||
/* add the items in! */
|
||||
gameWidget->insertTopLevelItems(0, items);
|
||||
if (newSelect)
|
||||
{
|
||||
gameWidget->setCurrentItem(newSelect);
|
||||
}
|
||||
gameWidget->update(); /* update display */
|
||||
|
||||
updateGameDetails();
|
||||
}
|
||||
|
||||
QTreeWidgetItem *GamesDialog::getCurrentGame()
|
||||
{
|
||||
return ui.gameTreeWidget->currentItem();
|
||||
}
|
||||
|
||||
QTreeWidgetItem *GamesDialog::getCurrentPeer()
|
||||
{
|
||||
return ui.peertreeWidget->currentItem();
|
||||
}
|
||||
|
||||
void GamesDialog::updateGameDetails()
|
||||
{
|
||||
/* get the list of games from the server */
|
||||
RsGameDetail detail;
|
||||
|
||||
/* get a link to the table */
|
||||
QTreeWidget *detailWidget = ui.peertreeWidget;
|
||||
QTreeWidgetItem *gameSelect = getCurrentGame();
|
||||
if (!gameSelect)
|
||||
{
|
||||
/* clear and finished */
|
||||
detailWidget->clear();
|
||||
//detailWidget->update();
|
||||
mCurrentGame = "";
|
||||
mCurrentGameStatus = "";
|
||||
return;
|
||||
}
|
||||
|
||||
std::string gameId = (gameSelect->text(GAME_LIST_ID)).toStdString();
|
||||
|
||||
rsGameLauncher->getGameDetail(gameId, detail);
|
||||
|
||||
QTreeWidgetItem *oldSelect = getCurrentPeer();
|
||||
QTreeWidgetItem *newSelect = NULL;
|
||||
std::string oldId;
|
||||
if (mCurrentGame != gameId)
|
||||
oldSelect = NULL; /* if we've changed game -> clear select */
|
||||
|
||||
if (oldSelect)
|
||||
{
|
||||
oldId = (oldSelect->text(GAME_PEER_ID)).toStdString();
|
||||
}
|
||||
|
||||
QList<QTreeWidgetItem *> items;
|
||||
/* layout depends on the game status */
|
||||
std::map<std::string, RsGamePeer>::iterator it;
|
||||
for(it = detail.gamers.begin(); it != detail.gamers.end(); it++)
|
||||
{
|
||||
bool showPeer = false;
|
||||
if ((detail.status == "Setup") ||
|
||||
(detail.status == "Invite"))
|
||||
{
|
||||
showPeer = true;
|
||||
}
|
||||
else if ((detail.status == "Confirm") ||
|
||||
(detail.status == "Ready"))
|
||||
{
|
||||
if ((it->second).invite == true)
|
||||
showPeer = true;
|
||||
}
|
||||
else if (detail.status == "Playing")
|
||||
{
|
||||
if ((it->second).play == true)
|
||||
showPeer = true;
|
||||
}
|
||||
|
||||
/* display */
|
||||
if (showPeer)
|
||||
{
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget*)0);
|
||||
std::string name = rsPeers->getPeerName(it->second.id);
|
||||
if (it->second.id == rsPeers->getOwnId())
|
||||
{
|
||||
name = "Yourself";
|
||||
}
|
||||
|
||||
item -> setText(GAME_PEER_PLAYER, QString::fromStdString(name));
|
||||
|
||||
if (it->second.invite)
|
||||
item -> setText(GAME_PEER_INVITE, "Yes");
|
||||
else
|
||||
item -> setText(GAME_PEER_INVITE, "No");
|
||||
|
||||
if (it->second.interested)
|
||||
item -> setText(GAME_PEER_INTEREST, "Yes");
|
||||
else
|
||||
item -> setText(GAME_PEER_INTEREST, "No");
|
||||
|
||||
if (it->second.play)
|
||||
item -> setText(GAME_PEER_PLAY, "Yes");
|
||||
else
|
||||
item -> setText(GAME_PEER_PLAY, "No");
|
||||
|
||||
/* add a checkItem here */
|
||||
//item -> setText(GAME_PEER_PLAY, "Maybe");
|
||||
item -> setText(GAME_PEER_ID, QString::fromStdString(it->second.id));
|
||||
|
||||
if ((oldSelect) && (oldId == it->first))
|
||||
{
|
||||
newSelect = item;
|
||||
}
|
||||
|
||||
/* add to the list */
|
||||
items.append(item);
|
||||
}
|
||||
}
|
||||
if (detail.status == "Setup")
|
||||
{
|
||||
std::list<std::string> friends;
|
||||
std::list<std::string>::iterator fit;
|
||||
|
||||
rsPeers->getOnlineList(friends);
|
||||
|
||||
for(fit = friends.begin(); fit != friends.end(); fit++)
|
||||
{
|
||||
if (detail.gamers.end() != detail.gamers.find(*fit))
|
||||
{
|
||||
/* already present */
|
||||
continue;
|
||||
}
|
||||
|
||||
std::string name = rsPeers->getPeerName(*fit);
|
||||
|
||||
/* make a widget per friend */
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget*)0);
|
||||
item -> setText(GAME_PEER_PLAYER, QString::fromStdString(name));
|
||||
item -> setText(GAME_PEER_INVITE, "No");
|
||||
item -> setText(GAME_PEER_INTEREST, "?");
|
||||
item -> setText(GAME_PEER_PLAY, "?");
|
||||
item -> setText(GAME_PEER_ID, QString::fromStdString(*fit));
|
||||
|
||||
if ((oldSelect) && (oldId == *fit))
|
||||
{
|
||||
newSelect = item;
|
||||
}
|
||||
|
||||
/* add to the list */
|
||||
items.append(item);
|
||||
}
|
||||
}
|
||||
|
||||
detailWidget->clear();
|
||||
detailWidget->setColumnCount(5);
|
||||
|
||||
/* add the items in! */
|
||||
detailWidget->insertTopLevelItems(0, items);
|
||||
if (newSelect)
|
||||
{
|
||||
detailWidget->setCurrentItem(newSelect);
|
||||
}
|
||||
detailWidget->update(); /* update display */
|
||||
|
||||
/* store the game Id */
|
||||
mCurrentGame = gameId;
|
||||
mCurrentGameStatus = detail.status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void GamesDialog::gameListPopupMenu( QPoint point )
|
||||
{
|
||||
|
||||
QMenu contextMnu( this );
|
||||
QMouseEvent *mevent = new QMouseEvent( QEvent::MouseButtonPress, point, Qt::RightButton, Qt::RightButton, Qt::NoModifier );
|
||||
|
||||
QAction *deleteAct = new QAction(QIcon(IMAGE_EXPIORTFRIEND), tr( "Cancel Game" ), this );
|
||||
connect( deleteAct , SIGNAL( triggered() ), this, SLOT( deleteGame() ) );
|
||||
|
||||
contextMnu.clear();
|
||||
contextMnu.addSeparator();
|
||||
contextMnu.addAction(deleteAct);
|
||||
contextMnu.addSeparator();
|
||||
contextMnu.exec( mevent->globalPos() );
|
||||
}
|
||||
|
||||
|
||||
void GamesDialog::gamePeersPopupMenu( QPoint point )
|
||||
{
|
||||
|
||||
QMenu contextMnu( this );
|
||||
QMouseEvent *mevent = new QMouseEvent( QEvent::MouseButtonPress, point, Qt::RightButton, Qt::RightButton, Qt::NoModifier );
|
||||
|
||||
if (mCurrentGame == "")
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (mCurrentGameStatus == "Setup")
|
||||
{
|
||||
/* invite */
|
||||
/* uninvite */
|
||||
|
||||
QAction *inviteAct = new QAction(QIcon(IMAGE_EXPIORTFRIEND), tr( "Add to Invite List" ), this );
|
||||
connect( inviteAct , SIGNAL( triggered() ), this, SLOT( invitePeer() ) );
|
||||
QAction *uninviteAct = new QAction(QIcon(IMAGE_EXPIORTFRIEND), tr( "Remove from Invite List" ), this );
|
||||
connect( uninviteAct , SIGNAL( triggered() ), this, SLOT( uninvitePeer() ) );
|
||||
|
||||
contextMnu.clear();
|
||||
contextMnu.addAction(inviteAct);
|
||||
contextMnu.addAction(uninviteAct);
|
||||
contextMnu.exec( mevent->globalPos() );
|
||||
}
|
||||
else if (mCurrentGameStatus == "Invite")
|
||||
{
|
||||
/* invite */
|
||||
/* uninvite */
|
||||
|
||||
QAction *inviteAct = new QAction(QIcon(IMAGE_EXPIORTFRIEND), tr( "Interested in Playing" ), this );
|
||||
connect( inviteAct , SIGNAL( triggered() ), this, SLOT( interested() ) );
|
||||
QAction *uninviteAct = new QAction(QIcon(IMAGE_EXPIORTFRIEND), tr( "Not Interested in Game" ), this );
|
||||
connect( uninviteAct , SIGNAL( triggered() ), this, SLOT( uninterested() ) );
|
||||
|
||||
contextMnu.clear();
|
||||
contextMnu.addAction(inviteAct);
|
||||
contextMnu.addAction(uninviteAct);
|
||||
contextMnu.exec( mevent->globalPos() );
|
||||
}
|
||||
else if (mCurrentGameStatus == "Invite")
|
||||
{
|
||||
/* invite */
|
||||
/* uninvite */
|
||||
|
||||
QAction *interestedAct = new QAction(QIcon(IMAGE_EXPIORTFRIEND), tr( "Interested in Playing" ), this );
|
||||
connect( interestedAct , SIGNAL( triggered() ), this, SLOT( interested() ) );
|
||||
QAction *uninterestedAct = new QAction(QIcon(IMAGE_EXPIORTFRIEND), tr( "Not Interested" ), this );
|
||||
connect( uninterestedAct , SIGNAL( triggered() ), this, SLOT( uninterested() ) );
|
||||
|
||||
contextMnu.clear();
|
||||
contextMnu.addAction(interestedAct);
|
||||
contextMnu.addAction(uninterestedAct);
|
||||
contextMnu.exec( mevent->globalPos() );
|
||||
}
|
||||
else if (mCurrentGameStatus == "Confirm")
|
||||
{
|
||||
/* invite */
|
||||
/* uninvite */
|
||||
|
||||
QAction *inviteAct = new QAction(QIcon(IMAGE_EXPIORTFRIEND), tr( "Confirm Peer in Game" ), this );
|
||||
connect( inviteAct , SIGNAL( triggered() ), this, SLOT( confirmPeer() ) );
|
||||
QAction *uninviteAct = new QAction(QIcon(IMAGE_EXPIORTFRIEND), tr( "Remove Peer from Game" ), this );
|
||||
connect( uninviteAct , SIGNAL( triggered() ), this, SLOT( unconfirmPeer() ) );
|
||||
|
||||
contextMnu.clear();
|
||||
contextMnu.addAction(inviteAct);
|
||||
contextMnu.addAction(uninviteAct);
|
||||
contextMnu.exec( mevent->globalPos() );
|
||||
}
|
||||
else if (mCurrentGameStatus == "Ready")
|
||||
{
|
||||
/* invite */
|
||||
/* uninvite */
|
||||
|
||||
QAction *interestedAct = new QAction(QIcon(IMAGE_EXPIORTFRIEND), tr( "Interested in Game" ), this );
|
||||
connect( interestedAct , SIGNAL( triggered() ), this, SLOT( interested() ) );
|
||||
QAction *uninterestedAct = new QAction(QIcon(IMAGE_EXPIORTFRIEND), tr( "Not Interested" ), this );
|
||||
connect( uninterestedAct , SIGNAL( triggered() ), this, SLOT( uninterested() ) );
|
||||
|
||||
contextMnu.clear();
|
||||
contextMnu.addAction(interestedAct);
|
||||
contextMnu.addAction(uninterestedAct);
|
||||
contextMnu.exec( mevent->globalPos() );
|
||||
}
|
||||
else /* PLAYING */
|
||||
{
|
||||
/* no menu for playing */
|
||||
QAction *quitAct = new QAction(QIcon(IMAGE_EXPIORTFRIEND), tr( "Quit Game" ), this );
|
||||
contextMnu.clear();
|
||||
contextMnu.addAction(quitAct);
|
||||
contextMnu.exec( mevent->globalPos() );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void GamesDialog::createGame()
|
||||
{
|
||||
/* extract the Game Type and number of players from GUI */
|
||||
std::wstring gameName = ui.gameNameEdit->text().toStdWString();
|
||||
uint32_t gameType = ui.gameComboBox->currentIndex();
|
||||
bool addAll = ui.checkInviteAll->isChecked();
|
||||
std::list<std::string> playerList;
|
||||
|
||||
std::string gameId = rsGameLauncher->createGame(gameType, gameName);
|
||||
|
||||
if (addAll)
|
||||
{
|
||||
std::list<std::string> friends;
|
||||
std::list<std::string>::iterator fit;
|
||||
|
||||
rsPeers->getOnlineList(friends);
|
||||
for(fit = friends.begin(); fit != friends.end(); fit++)
|
||||
{
|
||||
rsGameLauncher -> invitePeer(gameId, *fit);
|
||||
}
|
||||
}
|
||||
|
||||
/* call to the GameControl */
|
||||
std::string tmpName(gameName.begin(), gameName.end());
|
||||
std::cerr << "GamesDialog::createGame() Game: " << gameType << " name: " << tmpName;
|
||||
std::cerr << std::endl;
|
||||
|
||||
updateGameList();
|
||||
}
|
||||
|
||||
void GamesDialog::deleteGame()
|
||||
{
|
||||
QTreeWidgetItem *gameSelect = getCurrentGame();
|
||||
if (!gameSelect)
|
||||
return;
|
||||
|
||||
std::string gameId = (gameSelect->text(GAME_LIST_ID)).toStdString();
|
||||
rsGameLauncher->deleteGame(gameId);
|
||||
|
||||
updateGameList();
|
||||
}
|
||||
|
||||
|
||||
void GamesDialog::inviteGame()
|
||||
{
|
||||
QTreeWidgetItem *gameSelect = getCurrentGame();
|
||||
if (!gameSelect)
|
||||
return;
|
||||
|
||||
std::string gameId = (gameSelect->text(GAME_LIST_ID)).toStdString();
|
||||
rsGameLauncher->inviteGame(gameId);
|
||||
|
||||
updateGameList();
|
||||
}
|
||||
|
||||
|
||||
void GamesDialog::playGame()
|
||||
{
|
||||
QTreeWidgetItem *gameSelect = getCurrentGame();
|
||||
if (!gameSelect)
|
||||
return;
|
||||
|
||||
std::string gameId = (gameSelect->text(GAME_LIST_ID)).toStdString();
|
||||
rsGameLauncher->playGame(gameId);
|
||||
|
||||
updateGameList();
|
||||
}
|
||||
|
||||
void GamesDialog::invitePeer()
|
||||
{
|
||||
QTreeWidgetItem *peerSelect = getCurrentPeer();
|
||||
if (!peerSelect)
|
||||
return;
|
||||
|
||||
std::string peerId = (peerSelect->text(GAME_PEER_ID)).toStdString();
|
||||
rsGameLauncher->invitePeer(mCurrentGame, peerId);
|
||||
updateGameDetails();
|
||||
}
|
||||
|
||||
|
||||
void GamesDialog::uninvitePeer()
|
||||
{
|
||||
QTreeWidgetItem *peerSelect = getCurrentPeer();
|
||||
if (!peerSelect)
|
||||
return;
|
||||
|
||||
std::string peerId = (peerSelect->text(GAME_PEER_ID)).toStdString();
|
||||
rsGameLauncher->uninvitePeer(mCurrentGame, peerId);
|
||||
updateGameDetails();
|
||||
}
|
||||
|
||||
|
||||
void GamesDialog::confirmPeer()
|
||||
{
|
||||
QTreeWidgetItem *peerSelect = getCurrentPeer();
|
||||
if (!peerSelect)
|
||||
return;
|
||||
|
||||
std::string peerId = (peerSelect->text(GAME_PEER_ID)).toStdString();
|
||||
rsGameLauncher->confirmPeer(mCurrentGame, peerId);
|
||||
updateGameDetails();
|
||||
}
|
||||
|
||||
|
||||
void GamesDialog::unconfirmPeer()
|
||||
{
|
||||
QTreeWidgetItem *peerSelect = getCurrentPeer();
|
||||
if (!peerSelect)
|
||||
return;
|
||||
|
||||
std::string peerId = (peerSelect->text(GAME_PEER_ID)).toStdString();
|
||||
rsGameLauncher->unconfirmPeer(mCurrentGame, peerId);
|
||||
updateGameDetails();
|
||||
}
|
||||
|
||||
|
||||
void GamesDialog::interested()
|
||||
{
|
||||
QTreeWidgetItem *gameSelect = getCurrentGame();
|
||||
if (!gameSelect)
|
||||
return;
|
||||
|
||||
std::string gameId = (gameSelect->text(GAME_LIST_ID)).toStdString();
|
||||
rsGameLauncher->interestedPeer(gameId);
|
||||
updateGameDetails();
|
||||
}
|
||||
|
||||
|
||||
void GamesDialog::uninterested()
|
||||
{
|
||||
QTreeWidgetItem *gameSelect = getCurrentGame();
|
||||
if (!gameSelect)
|
||||
return;
|
||||
|
||||
std::string gameId = (gameSelect->text(GAME_LIST_ID)).toStdString();
|
||||
rsGameLauncher->uninterestedPeer(gameId);
|
||||
updateGameDetails();
|
||||
}
|
||||
|
||||
|
80
retroshare-gui/src/gui/unfinished/GamesDialog.h
Normal file
80
retroshare-gui/src/gui/unfinished/GamesDialog.h
Normal file
@ -0,0 +1,80 @@
|
||||
/****************************************************************
|
||||
* RetroShareGui is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2007-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 _GAMESDIALOG_H
|
||||
#define _GAMESDIALOG_H
|
||||
|
||||
#include "gui/mainpage.h"
|
||||
#include "ui_GamesDialog.h"
|
||||
|
||||
class GamesDialog : public MainPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** Default Constructor */
|
||||
GamesDialog(QWidget *parent = 0);
|
||||
/** Default Destructor */
|
||||
|
||||
void insertExample();
|
||||
|
||||
private slots:
|
||||
/** Create the context popup menu and it's submenus */
|
||||
void gameListPopupMenu( QPoint point );
|
||||
void gamePeersPopupMenu( QPoint point );
|
||||
|
||||
void createGame();
|
||||
void deleteGame();
|
||||
void inviteGame();
|
||||
void playGame();
|
||||
|
||||
void invitePeer();
|
||||
void uninvitePeer();
|
||||
void confirmPeer();
|
||||
void unconfirmPeer();
|
||||
|
||||
void interested();
|
||||
void uninterested();
|
||||
|
||||
void updateGameList();
|
||||
void updateGameDetails();
|
||||
/***
|
||||
*
|
||||
*/
|
||||
|
||||
private:
|
||||
|
||||
|
||||
/***** UTILS *******/
|
||||
QTreeWidgetItem *getCurrentGame();
|
||||
QTreeWidgetItem *getCurrentPeer();
|
||||
|
||||
/* Data */
|
||||
std::string mCurrentGame;
|
||||
std::string mCurrentGameStatus;
|
||||
private:
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::GamesDialog ui;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
333
retroshare-gui/src/gui/unfinished/GamesDialog.ui
Normal file
333
retroshare-gui/src/gui/unfinished/GamesDialog.ui
Normal file
@ -0,0 +1,333 @@
|
||||
<ui version="4.0" >
|
||||
<class>GamesDialog</class>
|
||||
<widget class="QWidget" name="GamesDialog" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>598</width>
|
||||
<height>526</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="verticalSpacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="label_3" >
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap" >
|
||||
<pixmap resource="images.qrc" >:/images/package_games1.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QLabel" name="label_2" >
|
||||
<property name="text" >
|
||||
<string><html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt; font-weight:600;">Games Launcher</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>431</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3" >
|
||||
<layout class="QGridLayout" >
|
||||
<item row="0" column="0" >
|
||||
<layout class="QVBoxLayout" >
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<item>
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="font" >
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Game:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="gameComboBox" >
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>GameType: 0. Want to Add your Game here?</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>GameType: 1. Get In Touch with the developers</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>GameType: 2.</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4" >
|
||||
<property name="font" >
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Title / Comment</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="gameNameEdit" />
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="createButton" >
|
||||
<property name="font" >
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Create New Game</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="images.qrc" >
|
||||
<normaloff>:/images/kbackgammon.png</normaloff>:/images/kbackgammon.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkInviteAll" >
|
||||
<property name="font" >
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Invite All Friends</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QSplitter" name="splitter" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<widget class="QTreeWidget" name="gameTreeWidget" >
|
||||
<property name="contextMenuPolicy" >
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>Game Type</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>Server</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>Status</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>Comment</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>GameID</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
<widget class="QTreeWidget" name="peertreeWidget" >
|
||||
<property name="contextMenuPolicy" >
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>Player</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>Invite</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>Interested</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>Accept</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<layout class="QHBoxLayout" >
|
||||
<item>
|
||||
<widget class="QPushButton" name="deleteButton" >
|
||||
<property name="font" >
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Delete</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="images.qrc" >
|
||||
<normaloff>:/images/reset.png</normaloff>:/images/reset.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="inviteButton" >
|
||||
<property name="font" >
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Invite</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="images.qrc" >
|
||||
<normaloff>:/images/dadd.png</normaloff>:/images/dadd.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="moveUpButton" >
|
||||
<property name="font" >
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Move Player</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="images.qrc" >
|
||||
<normaloff>:/images/up.png</normaloff>:/images/up.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="moveDownButton" >
|
||||
<property name="font" >
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Move Player</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="images.qrc" >
|
||||
<normaloff>:/images/down_24x24.png</normaloff>:/images/down_24x24.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="playButton" >
|
||||
<property name="font" >
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Play Game</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="images.qrc" >
|
||||
<normaloff>:/images/startall.png</normaloff>:/images/startall.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="images.qrc" />
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
250
retroshare-gui/src/gui/unfinished/LibraryDialog.cpp
Normal file
250
retroshare-gui/src/gui/unfinished/LibraryDialog.cpp
Normal file
@ -0,0 +1,250 @@
|
||||
/****************************************************************
|
||||
* RetroShare is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2008, defnax
|
||||
*
|
||||
* 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 "rshare.h"
|
||||
#include "LibraryDialog.h"
|
||||
|
||||
#include "rsiface/rsiface.h"
|
||||
#include "rsiface/rspeers.h"
|
||||
#include "rsiface/rsfiles.h"
|
||||
#include "ShareManager.h"
|
||||
|
||||
|
||||
#include "util/RsAction.h"
|
||||
#include "msgs/ChanMsgDialog.h"
|
||||
#include "FindWindow.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
#include <QtGui>
|
||||
#include <QContextMenuEvent>
|
||||
#include <QMenu>
|
||||
#include <QCursor>
|
||||
#include <QPoint>
|
||||
#include <QMouseEvent>
|
||||
#include <QPixmap>
|
||||
#include <QHeaderView>
|
||||
#include <QTimer>
|
||||
#include <QMovie>
|
||||
#include <QLabel>
|
||||
|
||||
/* Images for context menu icons */
|
||||
#define IMAGE_DOWNLOAD ":/images/download16.png"
|
||||
#define IMAGE_PLAY ":/images/start.png"
|
||||
#define IMAGE_HASH_BUSY ":/images/settings.png"
|
||||
#define IMAGE_HASH_DONE ":/images/friendsfolder24.png"
|
||||
#define IMAGE_MSG ":/images/message-mail.png"
|
||||
#define IMAGE_ATTACHMENT ":/images/attachment.png"
|
||||
#define IMAGE_FRIEND ":/images/peers_16x16.png"
|
||||
#define IMAGE_PROGRESS ":/images/browse-looking.gif"
|
||||
#define IMAGE_LIBRARY ":/images/library.png"
|
||||
|
||||
QString fileToFind;
|
||||
|
||||
|
||||
/** Constructor */
|
||||
LibraryDialog::LibraryDialog(QWidget *parent)
|
||||
: MainPage(parent)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui.setupUi(this);
|
||||
|
||||
|
||||
PopulateList();
|
||||
|
||||
connect(ui.organizerListView, SIGNAL(rightButtonClicked(QModelIndex,QPoint)), this, SLOT(ListLibrarymenu(QModelIndex,QPoint)));
|
||||
|
||||
connect(ui.shareFiles_btn,SIGNAL(clicked()),this, SLOT(CallShareFilesBtn_library()));
|
||||
connect(ui.tileView_btn_library,SIGNAL(clicked()),this, SLOT(CallTileViewBtn_library()));
|
||||
connect(ui.showDetails_btn_library,SIGNAL(clicked()),this, SLOT(CallShowDetailsBtn_library()));
|
||||
connect(ui.createAlbum_btn_library,SIGNAL(clicked()),this, SLOT(CallCreateAlbumBtn_library()));
|
||||
connect(ui.deleteAlbum_btn_library,SIGNAL(clicked()),this, SLOT(CallDeleteAlbumBtn_library()));
|
||||
connect(ui.find_btn_library,SIGNAL(clicked()),this, SLOT(CallFindBtn_library()));
|
||||
|
||||
/* Set header resize modes and initial section sizes */
|
||||
QHeaderView * organizerheader = ui.organizertreeView->header();
|
||||
|
||||
organizerheader->resizeSection ( 0, 250 );
|
||||
|
||||
|
||||
QTimer *timer = new QTimer(this);
|
||||
timer->connect(timer, SIGNAL(timeout()), this, SLOT(checkUpdate()));
|
||||
timer->start(1000);
|
||||
|
||||
/* Hide platform specific features */
|
||||
#ifdef Q_WS_WIN
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void LibraryDialog::PopulateList()
|
||||
{
|
||||
QDir DwnlFolder,ShrFolder,retroshareLib,treePath;
|
||||
|
||||
#if 0
|
||||
retroshareLib.mkdir("RetroShare Library");
|
||||
DwnlFolder.mkdir("RetroShare Library/Download");
|
||||
ShrFolder.mkdir("RetroShare Library/SharedFolder");
|
||||
LibShared=treePath.currentPath();
|
||||
LibShared.append("/RetroShare Library");
|
||||
#else
|
||||
LibShared=Rshare::dataDirectory();
|
||||
#endif
|
||||
|
||||
QDirModel * dmodel=new QDirModel;
|
||||
ui.organizertreeView->setModel(dmodel);
|
||||
ui.organizertreeView->setRootIndex(dmodel->index(LibShared));
|
||||
ui.organizerListView->setModel(dmodel);
|
||||
ui.organizerListView->setViewMode(QListView::ListMode);
|
||||
ui.organizerListView->setWordWrap (true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void LibraryDialog::ListLibrarymenu(QModelIndex index,QPoint pos)
|
||||
{
|
||||
ind=index;
|
||||
if(index.isValid())
|
||||
{
|
||||
bool indexselected=true;
|
||||
QMenu rmenu(this);
|
||||
rmenu.move(pos);
|
||||
if(indexselected)
|
||||
rmenu.addAction(QIcon(""),tr("Play"), this, SLOT(PlayFrmList()));
|
||||
if(indexselected)
|
||||
rmenu.addAction(QIcon(""),tr("Copy"), this, SLOT(copyFile()));
|
||||
if(indexselected)
|
||||
rmenu.addAction(QIcon(""),tr("Delete"), this, SLOT(DeleteFile()));
|
||||
if(indexselected)
|
||||
rmenu.addAction(QIcon(""),tr("Rename"), this, SLOT(RenameFile()));
|
||||
rmenu.exec();
|
||||
}
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
void LibraryDialog::PlayFrmList()
|
||||
{
|
||||
QDirModel *dmodel=new QDirModel;
|
||||
QModelIndex parentIndex = dmodel->index(LibShared+"/Download");
|
||||
QModelIndex index = dmodel->index(ind.row(), 0, parentIndex);
|
||||
QString text = dmodel->data(index, Qt::DisplayRole).toString();
|
||||
|
||||
filechose.clear();
|
||||
QDir dir;
|
||||
filechose.append(LibShared+"/Download/");
|
||||
filechose.append(text);
|
||||
if(filechose.contains("avi")|| filechose.contains("MP3")||filechose.contains("mp3")|| filechose.contains("wmv")||filechose.contains("wav")|| filechose.contains("dat")|| filechose.contains("mov")|| filechose.contains("mpeg")|| filechose.contains("mpg"))
|
||||
{
|
||||
player();
|
||||
}
|
||||
else
|
||||
QMessageBox::information(this,"Information", "Not Supported By the Player");
|
||||
}
|
||||
|
||||
void LibraryDialog::copyFile()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void LibraryDialog::DeleteFile()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void LibraryDialog::RenameFile()
|
||||
{
|
||||
ui.organizerListView->openPersistentEditor (ind);
|
||||
progtime=new QTimer(this);
|
||||
progtime->start(100000);
|
||||
connect(progtime, SIGNAL(timeout()), this, SLOT(StopRename()));
|
||||
|
||||
}
|
||||
|
||||
void LibraryDialog::StopRename()
|
||||
{
|
||||
ui.organizerListView->closePersistentEditor(ind);
|
||||
progtime->stop();
|
||||
}
|
||||
|
||||
|
||||
void LibraryDialog::CallShareFilesBtn_library()
|
||||
{
|
||||
ShareManager::showYourself();
|
||||
}
|
||||
|
||||
void LibraryDialog::CallTileViewBtn_library()
|
||||
{
|
||||
//QMessageBox::information(this, tr("RetroShare"),tr("Will be Introducing this .. soon- tilesView in Library"));
|
||||
}
|
||||
|
||||
void LibraryDialog::CallShowDetailsBtn_library()
|
||||
{
|
||||
//QMessageBox::information(this, tr("RetroShare"),tr("Will be Introducing this .. soon- showdetails in Library"));
|
||||
}
|
||||
|
||||
void LibraryDialog::CallCreateAlbumBtn_library()
|
||||
{
|
||||
//QMessageBox::information(this, tr("RetroShare"),tr("Will be Introducing this .. soon- Create Album in Library"));
|
||||
}
|
||||
|
||||
void LibraryDialog::CallDeleteAlbumBtn_library()
|
||||
{
|
||||
//QMessageBox::information(this, tr("RetroShare"),tr("Will be Introducing this .. soon- Delete Album in Library"));
|
||||
}
|
||||
|
||||
QString LibraryDialog::filePass()
|
||||
{
|
||||
fileToFind=ui.findEditmain->text();
|
||||
return fileToFind;
|
||||
}
|
||||
|
||||
void LibraryDialog::CallFindBtn_library()
|
||||
{
|
||||
filePass();
|
||||
FindWindow *files = new FindWindow(this);
|
||||
files->show();
|
||||
}
|
||||
|
||||
void LibraryDialog:: player()
|
||||
{
|
||||
QString avi;
|
||||
avi.append(filechose);
|
||||
QStringList argu;
|
||||
QString smlayer="./smplayer";
|
||||
argu<<avi;
|
||||
QProcess *retroshareplayer=new QProcess(this);
|
||||
retroshareplayer->start(smlayer,argu);
|
||||
|
||||
}
|
||||
|
||||
void LibraryDialog::browseFile()
|
||||
{
|
||||
QDir dir;
|
||||
QString pathseted =dir.currentPath();
|
||||
pathseted.append("/RetroShare Library/Download");
|
||||
filechose = QFileDialog::getOpenFileName(this, tr("Open File..."),
|
||||
pathseted, tr("Media-Files (*.avi *.mp3 *.wmv *.wav *.dat *.mov *.mpeg);;All Files (*)"));
|
||||
//movieEdit->setText(filechose);
|
||||
}
|
85
retroshare-gui/src/gui/unfinished/LibraryDialog.h
Normal file
85
retroshare-gui/src/gui/unfinished/LibraryDialog.h
Normal file
@ -0,0 +1,85 @@
|
||||
/****************************************************************
|
||||
* RetroShare is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2008, defnax
|
||||
*
|
||||
* 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 _SHAREDFILESDIALOG_H
|
||||
#define _SHAREDFILESDIALOG_H
|
||||
|
||||
#include <QFileDialog>
|
||||
|
||||
//#include <config/rsharesettings.h>
|
||||
|
||||
#include "gui/mainpage.h"
|
||||
#include "ui_LibraryDialog.h"
|
||||
|
||||
#include "rsiface/rstypes.h"
|
||||
#include "gui/RemoteDirModel.h"
|
||||
|
||||
class LibraryDialog : public MainPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** Default Constructor */
|
||||
LibraryDialog(QWidget *parent = 0);
|
||||
/** Default Destructor */
|
||||
|
||||
QString filePass();
|
||||
QString LibShared;
|
||||
QString filechose;
|
||||
QModelIndex ind;
|
||||
|
||||
private slots:
|
||||
|
||||
void PopulateList();
|
||||
|
||||
void CallShareFilesBtn_library();
|
||||
void CallTileViewBtn_library();
|
||||
void CallShowDetailsBtn_library();
|
||||
void CallCreateAlbumBtn_library();
|
||||
void CallDeleteAlbumBtn_library();
|
||||
void CallFindBtn_library();
|
||||
|
||||
void browseFile();
|
||||
void player();
|
||||
void ListLibrarymenu(QModelIndex,QPoint);
|
||||
void PlayFrmList();
|
||||
void copyFile();
|
||||
void DeleteFile();
|
||||
void RenameFile();
|
||||
void StopRename();
|
||||
|
||||
|
||||
signals:
|
||||
void rightButtonClicked(const QModelIndex , const QPoint);
|
||||
|
||||
|
||||
private:
|
||||
QTimer *progtime;
|
||||
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::LibraryDialog ui;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
793
retroshare-gui/src/gui/unfinished/LibraryDialog.ui
Normal file
793
retroshare-gui/src/gui/unfinished/LibraryDialog.ui
Normal file
@ -0,0 +1,793 @@
|
||||
<ui version="4.0" >
|
||||
<class>LibraryDialog</class>
|
||||
<widget class="QWidget" name="LibraryDialog" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>629</width>
|
||||
<height>463</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="palette" >
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="WindowText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Button" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>208</red>
|
||||
<green>208</green>
|
||||
<blue>208</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Light" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Midlight" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>247</red>
|
||||
<green>247</green>
|
||||
<blue>247</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Dark" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>104</red>
|
||||
<green>104</green>
|
||||
<blue>104</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Mid" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>139</red>
|
||||
<green>139</green>
|
||||
<blue>139</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Text" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="BrightText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ButtonText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Base" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>240</red>
|
||||
<green>240</green>
|
||||
<blue>240</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Shadow" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Highlight" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>128</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="HighlightedText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Link" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="LinkVisited" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>0</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="AlternateBase" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>231</red>
|
||||
<green>231</green>
|
||||
<blue>231</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="WindowText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Button" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>208</red>
|
||||
<green>208</green>
|
||||
<blue>208</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Light" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Midlight" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>247</red>
|
||||
<green>247</green>
|
||||
<blue>247</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Dark" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>104</red>
|
||||
<green>104</green>
|
||||
<blue>104</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Mid" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>139</red>
|
||||
<green>139</green>
|
||||
<blue>139</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Text" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="BrightText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ButtonText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Base" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>240</red>
|
||||
<green>240</green>
|
||||
<blue>240</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Shadow" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Highlight" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>192</red>
|
||||
<green>192</green>
|
||||
<blue>192</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="HighlightedText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Link" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="LinkVisited" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>0</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="AlternateBase" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>231</red>
|
||||
<green>231</green>
|
||||
<blue>231</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="WindowText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>104</red>
|
||||
<green>104</green>
|
||||
<blue>104</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Button" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>208</red>
|
||||
<green>208</green>
|
||||
<blue>208</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Light" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Midlight" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>247</red>
|
||||
<green>247</green>
|
||||
<blue>247</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Dark" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>104</red>
|
||||
<green>104</green>
|
||||
<blue>104</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Mid" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>139</red>
|
||||
<green>139</green>
|
||||
<blue>139</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Text" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>104</red>
|
||||
<green>104</green>
|
||||
<blue>104</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="BrightText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ButtonText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>104</red>
|
||||
<green>104</green>
|
||||
<blue>104</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Base" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>240</red>
|
||||
<green>240</green>
|
||||
<blue>240</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>240</red>
|
||||
<green>240</green>
|
||||
<blue>240</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Shadow" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Highlight" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>128</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="HighlightedText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Link" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="LinkVisited" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>0</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="AlternateBase" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>231</red>
|
||||
<green>231</green>
|
||||
<blue>231</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="contextMenuPolicy" >
|
||||
<enum>Qt::NoContextMenu</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<item row="0" column="0" >
|
||||
<widget class="QGroupBox" name="groupBox_5" >
|
||||
<property name="title" >
|
||||
<string>Library</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_5" >
|
||||
<item row="0" column="0" >
|
||||
<widget class="QSplitter" name="splitter" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<widget class="QTabWidget" name="tabWidget_2" >
|
||||
<property name="tabShape" >
|
||||
<enum>QTabWidget::Triangular</enum>
|
||||
</property>
|
||||
<property name="currentIndex" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_13" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>201</width>
|
||||
<height>385</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="title" >
|
||||
<string>Folder</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout" >
|
||||
<item row="0" column="0" >
|
||||
<widget class="QTreeView" name="fodlertreeView" />
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QComboBox" name="comboBox" >
|
||||
<property name="styleSheet" >
|
||||
<string notr="true" >border-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(0, 0, 0, 255), stop:1 rgba(255, 255, 255, 255));</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>All File Types</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="images.qrc" >
|
||||
<normaloff>:/images/FileTypeAny.png</normaloff>:/images/FileTypeAny.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Application</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="images.qrc" >
|
||||
<normaloff>:/images/FileTypeProgram.png</normaloff>:/images/FileTypeProgram.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Archive</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="images.qrc" >
|
||||
<normaloff>:/images/FileTypeArchive.png</normaloff>:/images/FileTypeArchive.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_14" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>201</width>
|
||||
<height>385</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="title" >
|
||||
<string>Organizer</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" >
|
||||
<item row="0" column="0" >
|
||||
<widget class="QTreeView" name="organizertreeView" >
|
||||
<property name="font" >
|
||||
<font>
|
||||
<family>Utopia</family>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QPushButton" name="shareFiles_btn" >
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>23</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet" >
|
||||
<string notr="true" >border-color: rgb(0, 0, 0);</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Share Files..</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="images.qrc" >
|
||||
<normaloff>:/images/add-share24.png</normaloff>:/images/add-share24.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize" >
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="flat" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="" >
|
||||
<layout class="QGridLayout" name="gridLayout_4" >
|
||||
<item row="0" column="0" >
|
||||
<layout class="QGridLayout" name="gridLayout_2" >
|
||||
<property name="verticalSpacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="label_3" >
|
||||
<property name="text" >
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src=":/images/folder_blueshared.png" /> Exploring My RetroShare Library</p></body></html></string>
|
||||
</property>
|
||||
<property name="pixmap" >
|
||||
<pixmap resource="images.qrc" >:/images/folder_blueshared.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QPushButton" name="tileView_btn_library" >
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Tile view</string>
|
||||
</property>
|
||||
<property name="flat" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" >
|
||||
<widget class="QPushButton" name="showDetails_btn_library" >
|
||||
<property name="text" >
|
||||
<string>Show Details</string>
|
||||
</property>
|
||||
<property name="flat" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3" >
|
||||
<widget class="QListView" name="organizerListView" >
|
||||
<property name="contextMenuPolicy" >
|
||||
<enum>Qt::DefaultContextMenu</enum>
|
||||
</property>
|
||||
<property name="movement" >
|
||||
<enum>QListView::Free</enum>
|
||||
</property>
|
||||
<property name="viewMode" >
|
||||
<enum>QListView::IconMode</enum>
|
||||
</property>
|
||||
<property name="selectionRectVisible" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<layout class="QGridLayout" name="gridLayout_3" >
|
||||
<item row="0" column="0" >
|
||||
<widget class="QPushButton" name="createAlbum_btn_library" >
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet" >
|
||||
<string notr="true" />
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Create Album</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="images.qrc" >
|
||||
<normaloff>:/images/directoryadd_24x24_shadow.png</normaloff>:/images/directoryadd_24x24_shadow.png</iconset>
|
||||
</property>
|
||||
<property name="flat" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QPushButton" name="deleteAlbum_btn_library" >
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet" >
|
||||
<string notr="true" />
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Delete Album</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="images.qrc" >
|
||||
<normaloff>:/images/directoryremove_24x24_shadow.png</normaloff>:/images/directoryremove_24x24_shadow.png</iconset>
|
||||
</property>
|
||||
<property name="flat" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" >
|
||||
<widget class="QLineEdit" name="findEditmain" />
|
||||
</item>
|
||||
<item row="0" column="3" >
|
||||
<widget class="QPushButton" name="find_btn_library" >
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet" >
|
||||
<string notr="true" >pushButton_41:hover{ color : white;}</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Find</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="images.qrc" >
|
||||
<normaloff>:/images/find.png</normaloff>:/images/find.png</iconset>
|
||||
</property>
|
||||
<property name="flat" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="images.qrc" />
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>organizertreeView</sender>
|
||||
<signal>doubleClicked(QModelIndex)</signal>
|
||||
<receiver>organizerListView</receiver>
|
||||
<slot>setRootIndex(QModelIndex)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>139</x>
|
||||
<y>230</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>439</x>
|
||||
<y>238</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
332
retroshare-gui/src/gui/unfinished/MsgFeed.cpp
Normal file
332
retroshare-gui/src/gui/unfinished/MsgFeed.cpp
Normal file
@ -0,0 +1,332 @@
|
||||
/****************************************************************
|
||||
* 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 <QtGui>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "MsgFeed.h"
|
||||
#include "gui/feeds/MsgItem.h"
|
||||
#include "gui/GeneralMsgDialog.h"
|
||||
|
||||
#include "rsiface/rsmsgs.h"
|
||||
#include "rsiface/rspeers.h"
|
||||
|
||||
/*****
|
||||
* #define MSG_DEBUG 1
|
||||
****/
|
||||
|
||||
/** Constructor */
|
||||
MsgFeed::MsgFeed(QWidget *parent)
|
||||
: MainPage (parent)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
setupUi(this);
|
||||
|
||||
connect(boxComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( updateBox() ) );
|
||||
connect(peerComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( updateMode() ) );
|
||||
connect(sortComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( updateSort() ) );
|
||||
connect(msgButton, SIGNAL( clicked( ) ), this, SLOT( newMsg() ) );
|
||||
|
||||
/* mLayout -> to add widgets to */
|
||||
mLayout = new QVBoxLayout;
|
||||
|
||||
QWidget *middleWidget = new QWidget();
|
||||
//middleWidget->setSizePolicy( QSizePolicy::Policy::Maximum, QSizePolicy::Policy::Minimum);
|
||||
middleWidget->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum);
|
||||
middleWidget->setLayout(mLayout);
|
||||
|
||||
|
||||
QScrollArea *scrollArea = new QScrollArea;
|
||||
//scrollArea->setBackgroundRole(QPalette::Dark);
|
||||
scrollArea->setWidget(middleWidget);
|
||||
scrollArea->setWidgetResizable(true);
|
||||
scrollArea->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
|
||||
|
||||
QVBoxLayout *layout2 = new QVBoxLayout;
|
||||
layout2->addWidget(scrollArea);
|
||||
layout2->setSpacing(0);
|
||||
layout2->setMargin(0);
|
||||
|
||||
frame->setLayout(layout2);
|
||||
|
||||
/* default Inbox + All */
|
||||
mMsgbox = RS_MSG_INBOX;
|
||||
mPeerId = "";
|
||||
|
||||
|
||||
QTimer *timer = new QTimer(this);
|
||||
timer->connect(timer, SIGNAL(timeout()), this, SLOT(updatePeerIds()));
|
||||
timer->start(10000);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* FeedHolder Functions (for FeedItem functionality) */
|
||||
void MsgFeed::deleteFeedItem(QWidget *item, uint32_t type)
|
||||
{
|
||||
#ifdef MSG_DEBUG
|
||||
std::cerr << "MsgFeed::deleteFeedItem()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
void MsgFeed::openChat(std::string peerId)
|
||||
{
|
||||
#ifdef MSG_DEBUG
|
||||
std::cerr << "MsgFeed::openChat()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
void MsgFeed::openMsg(uint32_t type, std::string grpId, std::string inReplyTo)
|
||||
{
|
||||
#ifdef MSG_DEBUG
|
||||
std::cerr << "MsgFeed::openMsg()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
GeneralMsgDialog *msgDialog = new GeneralMsgDialog(NULL);
|
||||
|
||||
|
||||
msgDialog->addDestination(type, grpId, inReplyTo);
|
||||
|
||||
msgDialog->show();
|
||||
|
||||
}
|
||||
|
||||
void MsgFeed::newMsg()
|
||||
{
|
||||
#ifdef MSG_DEBUG
|
||||
std::cerr << "MsgFeed::newMsg()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
GeneralMsgDialog *msgDialog = new GeneralMsgDialog(NULL);
|
||||
|
||||
msgDialog->setMsgType(FEEDHOLDER_MSG_MESSAGE);
|
||||
|
||||
msgDialog->show();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void MsgFeed::updateBox()
|
||||
{
|
||||
int idx = boxComboBox->currentIndex();
|
||||
switch(idx)
|
||||
{
|
||||
case 3:
|
||||
mMsgbox = RS_MSG_SENTBOX;
|
||||
break;
|
||||
case 2:
|
||||
mMsgbox = RS_MSG_DRAFTBOX;
|
||||
break;
|
||||
case 1:
|
||||
mMsgbox = RS_MSG_OUTBOX;
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
mMsgbox = RS_MSG_INBOX;
|
||||
break;
|
||||
}
|
||||
updateMsgs();
|
||||
}
|
||||
|
||||
void MsgFeed::updateMode()
|
||||
{
|
||||
/* NB #defines must match GUI design for correct selection */
|
||||
|
||||
if (peerComboBox->currentIndex() >= 0)
|
||||
{
|
||||
QVariant qv = peerComboBox->itemData(peerComboBox->currentIndex());
|
||||
mPeerId = qv.toString().toStdString();
|
||||
}
|
||||
updateMsgs();
|
||||
}
|
||||
|
||||
void MsgFeed::updateSort()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
void MsgFeed::updatePeerIds()
|
||||
{
|
||||
#ifdef MSG_DEBUG
|
||||
std::cerr << "MsgFeed::updatePeerIds()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
int selectIdx = 0; /* ALL */
|
||||
std::string peerId;
|
||||
|
||||
if (peerComboBox->currentIndex() >= 0)
|
||||
{
|
||||
QVariant qv = peerComboBox->itemData(peerComboBox->currentIndex());
|
||||
peerId = qv.toString().toStdString();
|
||||
}
|
||||
|
||||
peerComboBox->clear();
|
||||
peerComboBox->addItem("All Msgs", "");
|
||||
|
||||
/* add a list of friends */
|
||||
if (rsPeers)
|
||||
{
|
||||
std::list<std::string> friends;
|
||||
std::list<std::string>::iterator it;
|
||||
|
||||
rsPeers->getFriendList(friends);
|
||||
for(it = friends.begin(); it != friends.end(); it++)
|
||||
{
|
||||
QString id = QString::fromStdString(*it);
|
||||
QString name = QString::fromStdString(rsPeers->getPeerName(*it));
|
||||
peerComboBox->addItem(name, id);
|
||||
|
||||
if (peerId == *it)
|
||||
{
|
||||
selectIdx = peerComboBox->count() - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
peerComboBox->setCurrentIndex(selectIdx);
|
||||
|
||||
/* this will trigger updateMsgs?? */
|
||||
}
|
||||
|
||||
|
||||
|
||||
void MsgFeed::updateMsgs()
|
||||
{
|
||||
std::list<MsgInfoSummary> msgs;
|
||||
std::list<MsgInfoSummary>::iterator mit;
|
||||
|
||||
std::list<std::string> toAdd, toRemove;
|
||||
std::list<std::string>::iterator it;
|
||||
|
||||
std::map<std::string, uint32_t> newmsgs;
|
||||
std::map<std::string, uint32_t>::iterator nit;
|
||||
std::map<std::string, MsgItem *>::iterator iit;
|
||||
|
||||
if (!rsMsgs)
|
||||
{
|
||||
/* not ready yet! */
|
||||
return;
|
||||
}
|
||||
|
||||
rsMsgs->getMessageSummaries(msgs);
|
||||
|
||||
for(mit = msgs.begin(); mit != msgs.end(); )
|
||||
{
|
||||
/* filter on box type */
|
||||
if (mMsgbox != (mit->msgflags & RS_MSG_BOXMASK))
|
||||
{
|
||||
mit = msgs.erase(mit);
|
||||
}
|
||||
else
|
||||
{
|
||||
mit++;
|
||||
}
|
||||
}
|
||||
|
||||
if (mPeerId != "")
|
||||
{
|
||||
for(mit = msgs.begin(); mit != msgs.end(); )
|
||||
{
|
||||
/* filter on source */
|
||||
if (mPeerId != mit->srcId)
|
||||
{
|
||||
mit = msgs.erase(mit);
|
||||
}
|
||||
else
|
||||
{
|
||||
mit++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(mit = msgs.begin(); mit != msgs.end(); mit++)
|
||||
{
|
||||
newmsgs[mit->msgId] = 1;
|
||||
}
|
||||
|
||||
nit = newmsgs.begin();
|
||||
iit = mMsgs.begin();
|
||||
|
||||
while(nit != newmsgs.end())
|
||||
{
|
||||
if (iit == mMsgs.end())
|
||||
{
|
||||
toAdd.push_back(nit->first);
|
||||
nit++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (nit->first == iit->first)
|
||||
{
|
||||
/* same - good! */
|
||||
nit++;
|
||||
iit++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (nit->first < iit->first)
|
||||
{
|
||||
/* must add in new item */
|
||||
toAdd.push_back(nit->first);
|
||||
nit++;
|
||||
}
|
||||
else
|
||||
{
|
||||
toRemove.push_back(iit->first);
|
||||
iit++;
|
||||
}
|
||||
}
|
||||
|
||||
/* remove remaining items */
|
||||
while (iit != mMsgs.end())
|
||||
{
|
||||
toRemove.push_back(iit->first);
|
||||
iit++;
|
||||
}
|
||||
|
||||
/* remove first */
|
||||
for(it = toRemove.begin(); it != toRemove.end(); it++)
|
||||
{
|
||||
iit = mMsgs.find(*it);
|
||||
if (iit != mMsgs.end())
|
||||
{
|
||||
delete (iit->second);
|
||||
mMsgs.erase(iit);
|
||||
}
|
||||
}
|
||||
|
||||
/* add in new ones */
|
||||
for(it = toAdd.begin(); it != toAdd.end(); it++)
|
||||
{
|
||||
MsgItem *mi = new MsgItem(this, 0, *it, true);
|
||||
mMsgs[*it] = mi;
|
||||
mLayout->addWidget(mi);
|
||||
}
|
||||
}
|
||||
|
||||
|
72
retroshare-gui/src/gui/unfinished/MsgFeed.h
Normal file
72
retroshare-gui/src/gui/unfinished/MsgFeed.h
Normal file
@ -0,0 +1,72 @@
|
||||
/****************************************************************
|
||||
* RetroShare is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2008 Robert Fernie
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
|
||||
#ifndef _MSG_FEED_DIALOG_H
|
||||
#define _MSG_FEED_DIALOG_H
|
||||
|
||||
#include "gui/mainpage.h"
|
||||
#include "ui_MsgFeed.h"
|
||||
|
||||
#include "gui/feeds/FeedHolder.h"
|
||||
|
||||
class MsgItem;
|
||||
|
||||
class MsgFeed : public MainPage, public FeedHolder, private Ui::MsgFeed
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** Default Constructor */
|
||||
MsgFeed(QWidget *parent = 0);
|
||||
/** Default Destructor */
|
||||
|
||||
/* FeedHolder Functions (for FeedItem functionality) */
|
||||
virtual void deleteFeedItem(QWidget *item, uint32_t type);
|
||||
virtual void openChat(std::string peerId);
|
||||
virtual void openMsg(uint32_t type, std::string grpId, std::string inReplyTo);
|
||||
|
||||
private slots:
|
||||
|
||||
void newMsg();
|
||||
|
||||
void updateBox();
|
||||
void updateMode();
|
||||
void updateSort();
|
||||
|
||||
void updatePeerIds();
|
||||
void updateMsgs();
|
||||
|
||||
private:
|
||||
|
||||
QLayout *mLayout;
|
||||
|
||||
uint32_t mMsgbox;
|
||||
std::string mPeerId;
|
||||
uint32_t mSortMode;
|
||||
std::map<std::string, MsgItem *> mMsgs;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
276
retroshare-gui/src/gui/unfinished/MsgFeed.ui
Normal file
276
retroshare-gui/src/gui/unfinished/MsgFeed.ui
Normal file
@ -0,0 +1,276 @@
|
||||
<ui version="4.0" >
|
||||
<class>MsgFeed</class>
|
||||
<widget class="QWidget" name="MsgFeed" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>764</width>
|
||||
<height>435</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font" >
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Msgs In:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="boxComboBox" >
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Inbox</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Outbox</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Drafts</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Sent</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font" >
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string> From:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="peerComboBox" >
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>All</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font" >
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Sort By:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="sortComboBox" >
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Date</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Subject</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Received</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>81</width>
|
||||
<height>28</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="msgButton" >
|
||||
<property name="text" >
|
||||
<string>New Msg</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="images.qrc" >
|
||||
<normaloff>:/images/mail_send.png</normaloff>:/images/mail_send.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape" >
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="images.qrc" />
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
468
retroshare-gui/src/gui/unfinished/PeersFeed.cpp
Normal file
468
retroshare-gui/src/gui/unfinished/PeersFeed.cpp
Normal file
@ -0,0 +1,468 @@
|
||||
/****************************************************************
|
||||
* 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 <QtGui>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "PeersFeed.h"
|
||||
#include "gui/feeds/PeerItem.h"
|
||||
|
||||
#include "rsiface/rspeers.h"
|
||||
|
||||
#include "gui/GeneralMsgDialog.h"
|
||||
|
||||
const uint32_t PEERSFEED_MODE_FRIENDS = 0x0000;
|
||||
const uint32_t PEERSFEED_MODE_ONLINE = 0x0001;
|
||||
const uint32_t PEERSFEED_MODE_FOF = 0x0002;
|
||||
const uint32_t PEERSFEED_MODE_ALL = 0x0003;
|
||||
|
||||
|
||||
/*****
|
||||
* #define PEERS_DEBUG 1
|
||||
****/
|
||||
|
||||
/** Constructor */
|
||||
PeersFeed::PeersFeed(QWidget *parent)
|
||||
: MainPage (parent)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
setupUi(this);
|
||||
|
||||
connect( modeComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( updateMode() ) );
|
||||
|
||||
/* mLayout -> to add widgets to */
|
||||
mLayout = new QVBoxLayout;
|
||||
|
||||
QWidget *middleWidget = new QWidget();
|
||||
//middleWidget->setSizePolicy( QSizePolicy::Policy::Maximum, QSizePolicy::Policy::Minimum);
|
||||
middleWidget->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum);
|
||||
middleWidget->setLayout(mLayout);
|
||||
|
||||
|
||||
QScrollArea *scrollArea = new QScrollArea;
|
||||
//scrollArea->setBackgroundRole(QPalette::Dark);
|
||||
scrollArea->setWidget(middleWidget);
|
||||
scrollArea->setWidgetResizable(true);
|
||||
scrollArea->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
|
||||
|
||||
QVBoxLayout *layout2 = new QVBoxLayout;
|
||||
layout2->addWidget(scrollArea);
|
||||
layout2->setSpacing(0);
|
||||
layout2->setMargin(0);
|
||||
|
||||
frame->setLayout(layout2);
|
||||
|
||||
mMode = PEERSFEED_MODE_FRIENDS;
|
||||
|
||||
QTimer *timer = new QTimer(this);
|
||||
timer->connect(timer, SIGNAL(timeout()), this, SLOT(updatePeers()));
|
||||
timer->start(1000);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* FeedHolder Functions (for FeedItem functionality) */
|
||||
void PeersFeed::deleteFeedItem(QWidget *item, uint32_t type)
|
||||
{
|
||||
#ifdef PEERS_DEBUG
|
||||
std::cerr << "PeersFeed::deleteFeedItem()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
void PeersFeed::openChat(std::string peerId)
|
||||
{
|
||||
#ifdef PEERS_DEBUG
|
||||
std::cerr << "PeersFeed::openChat()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
void PeersFeed::openMsg(uint32_t type, std::string grpId, std::string inReplyTo)
|
||||
{
|
||||
#ifdef PEERS_DEBUG
|
||||
std::cerr << "PeersFeed::openMsg()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
GeneralMsgDialog *msgDialog = new GeneralMsgDialog(NULL);
|
||||
|
||||
|
||||
msgDialog->addDestination(type, grpId, inReplyTo);
|
||||
|
||||
msgDialog->show();
|
||||
|
||||
}
|
||||
|
||||
void PeersFeed::updateMode()
|
||||
{
|
||||
/* NB #defines must match GUI design for correct selection */
|
||||
|
||||
mMode = modeComboBox->currentIndex();
|
||||
updatePeers();
|
||||
}
|
||||
|
||||
/* get the list of peers from the RsIface. */
|
||||
void PeersFeed::updatePeers()
|
||||
{
|
||||
std::list<std::string> peers, toAdd, toRemove;
|
||||
std::list<std::string>::iterator it;
|
||||
|
||||
std::map<std::string, uint32_t> newpeers;
|
||||
std::map<std::string, uint32_t>::iterator nit;
|
||||
std::map<std::string, PeerItem *>::iterator pit;
|
||||
|
||||
if (!rsPeers)
|
||||
{
|
||||
/* not ready yet! */
|
||||
return;
|
||||
}
|
||||
|
||||
if (mMode == PEERSFEED_MODE_FRIENDS)
|
||||
{
|
||||
rsPeers->getFriendList(peers);
|
||||
}
|
||||
else if (mMode == PEERSFEED_MODE_ONLINE)
|
||||
{
|
||||
rsPeers->getOnlineList(peers);
|
||||
}
|
||||
else if (mMode == PEERSFEED_MODE_ALL)
|
||||
{
|
||||
rsPeers->getOthersList(peers);
|
||||
}
|
||||
else
|
||||
{
|
||||
rsPeers->getOthersList(peers);
|
||||
/* now remove friends */
|
||||
for(it = peers.begin(); it != peers.end(); )
|
||||
{
|
||||
if (rsPeers->isFriend(*it))
|
||||
{
|
||||
it = peers.erase(it);
|
||||
}
|
||||
else
|
||||
{
|
||||
it++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(it = peers.begin(); it != peers.end(); it++)
|
||||
{
|
||||
newpeers[*it] = 1;
|
||||
}
|
||||
|
||||
nit = newpeers.begin();
|
||||
pit = mPeers.begin();
|
||||
|
||||
while(nit != newpeers.end())
|
||||
{
|
||||
if (pit == mPeers.end())
|
||||
{
|
||||
toAdd.push_back(nit->first);
|
||||
nit++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (nit->first == pit->first)
|
||||
{
|
||||
/* same - good! */
|
||||
nit++;
|
||||
pit++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (nit->first < pit->first)
|
||||
{
|
||||
/* must add in new item */
|
||||
toAdd.push_back(nit->first);
|
||||
nit++;
|
||||
}
|
||||
else
|
||||
{
|
||||
toRemove.push_back(pit->first);
|
||||
pit++;
|
||||
}
|
||||
}
|
||||
|
||||
/* remove remaining items */
|
||||
while (pit != mPeers.end())
|
||||
{
|
||||
toRemove.push_back(pit->first);
|
||||
pit++;
|
||||
}
|
||||
|
||||
/* remove first */
|
||||
for(it = toRemove.begin(); it != toRemove.end(); it++)
|
||||
{
|
||||
pit = mPeers.find(*it);
|
||||
if (pit != mPeers.end())
|
||||
{
|
||||
delete (pit->second);
|
||||
mPeers.erase(pit);
|
||||
}
|
||||
}
|
||||
|
||||
/* add in new ones */
|
||||
for(it = toAdd.begin(); it != toAdd.end(); it++)
|
||||
{
|
||||
PeerItem *pi = new PeerItem(this, 0, *it, PEER_TYPE_STD, true);
|
||||
mPeers[*it] = pi;
|
||||
mLayout->addWidget(pi);
|
||||
}
|
||||
}
|
||||
|
||||
// PeerItem *pi = new PeerItem(this, NEWSFEED_PEERLIST, fi.mId1, PEER_TYPE_STD, false);
|
||||
// PeerItem *pi = new PeerItem(this, NEWSFEED_PEERLIST, fi.mId1, PEER_TYPE_HELLO, false);
|
||||
// PeerItem *pi = new PeerItem(this, NEWSFEED_PEERLIST, fi.mId1, PEER_TYPE_NEW_FOF, false);
|
||||
|
||||
#if 0
|
||||
|
||||
void PeersFeed::setChatDialog(ChatDialog *cd)
|
||||
{
|
||||
chatDialog = cd;
|
||||
}
|
||||
|
||||
|
||||
/** Open a QFileDialog to browse for export a file. */
|
||||
void PeersFeed::exportfriend()
|
||||
{
|
||||
QTreeWidgetItem *c = getCurrentPeer();
|
||||
std::cerr << "PeersFeed::exportfriend()" << std::endl;
|
||||
if (!c)
|
||||
{
|
||||
std::cerr << "PeersFeed::exportfriend() Noone Selected -- sorry" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
std::string id = getPeerRsCertId(c);
|
||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Save Certificate"), "",
|
||||
tr("Certificates (*.pqi)"));
|
||||
|
||||
std::string file = fileName.toStdString();
|
||||
if (file != "")
|
||||
{
|
||||
std::cerr << "PeersFeed::exportfriend() Saving to: " << file << std::endl;
|
||||
std::cerr << std::endl;
|
||||
if (rsPeers)
|
||||
{
|
||||
rsPeers->SaveCertificateToFile(id, file);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void PeersFeed::chatfriend()
|
||||
{
|
||||
QTreeWidgetItem *i = getCurrentPeer();
|
||||
|
||||
if (!i)
|
||||
return;
|
||||
|
||||
std::string name = (i -> text(2)).toStdString();
|
||||
std::string id = (i -> text(7)).toStdString();
|
||||
|
||||
RsPeerDetails detail;
|
||||
if (!rsPeers->getPeerDetails(id, detail))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (detail.state & RS_PEER_STATE_CONNECTED)
|
||||
{
|
||||
/* must reference ChatDialog */
|
||||
if (chatDialog)
|
||||
{
|
||||
chatDialog->getPrivateChat(id, name, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* info dialog */
|
||||
QMessageBox::StandardButton sb = QMessageBox::question ( NULL,
|
||||
"Friend Not Online",
|
||||
"Your Friend is offline \nDo you want to send them a Message instead",
|
||||
(QMessageBox::Yes | QMessageBox::No));
|
||||
if (sb == QMessageBox::Yes)
|
||||
{
|
||||
msgfriend();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void PeersFeed::msgfriend()
|
||||
{
|
||||
std::cerr << "SharedFilesDialog::msgfriend()" << std::endl;
|
||||
|
||||
QTreeWidgetItem *i = getCurrentPeer();
|
||||
|
||||
if (!i)
|
||||
return;
|
||||
|
||||
std::string status = (i -> text(1)).toStdString();
|
||||
std::string name = (i -> text(2)).toStdString();
|
||||
std::string id = (i -> text(7)).toStdString();
|
||||
|
||||
rsicontrol -> ClearInMsg();
|
||||
rsicontrol -> SetInMsg(id, true);
|
||||
|
||||
/* create a message */
|
||||
ChanMsgDialog *nMsgDialog = new ChanMsgDialog(true);
|
||||
|
||||
nMsgDialog->newMsg();
|
||||
nMsgDialog->show();
|
||||
}
|
||||
|
||||
|
||||
QTreeWidgetItem *PeersFeed::getCurrentPeer()
|
||||
{
|
||||
/* get the current, and extract the Id */
|
||||
|
||||
/* get a link to the table */
|
||||
QTreeWidget *peerWidget = ui.peertreeWidget;
|
||||
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;
|
||||
}
|
||||
|
||||
/* So from the Peers Dialog we can call the following control Functions:
|
||||
* (1) Remove Current. FriendRemove(id)
|
||||
* (2) Allow/DisAllow. FriendStatus(id, accept)
|
||||
* (2) Connect. FriendConnectAttempt(id, accept)
|
||||
* (3) Set Address. FriendSetAddress(id, str, port)
|
||||
* (4) Set Trust. FriendTrustSignature(id, bool)
|
||||
* (5) Configure (GUI Only) -> 3/4
|
||||
*
|
||||
* All of these rely on the finding of the current Id.
|
||||
*/
|
||||
|
||||
|
||||
void PeersFeed::removefriend()
|
||||
{
|
||||
QTreeWidgetItem *c = getCurrentPeer();
|
||||
std::cerr << "PeersFeed::removefriend()" << std::endl;
|
||||
if (!c)
|
||||
{
|
||||
std::cerr << "PeersFeed::removefriend() Noone Selected -- sorry" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if (rsPeers)
|
||||
{
|
||||
rsPeers->removeFriend(getPeerRsCertId(c));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PeersFeed::allowfriend()
|
||||
{
|
||||
QTreeWidgetItem *c = getCurrentPeer();
|
||||
std::cerr << "PeersFeed::allowfriend()" << std::endl;
|
||||
/*
|
||||
bool accept = true;
|
||||
rsServer->FriendStatus(getPeerRsCertId(c), accept);
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
void PeersFeed::connectfriend()
|
||||
{
|
||||
QTreeWidgetItem *c = getCurrentPeer();
|
||||
std::cerr << "PeersFeed::connectfriend()" << std::endl;
|
||||
if (!c)
|
||||
{
|
||||
std::cerr << "PeersFeed::connectfriend() Noone Selected -- sorry" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if (rsPeers)
|
||||
{
|
||||
rsPeers->connectAttempt(getPeerRsCertId(c));
|
||||
}
|
||||
}
|
||||
|
||||
void PeersFeed::setaddressfriend()
|
||||
{
|
||||
QTreeWidgetItem *c = getCurrentPeer();
|
||||
std::cerr << "PeersFeed::setaddressfriend()" << std::endl;
|
||||
|
||||
/* need to get the input address / port */
|
||||
/*
|
||||
std::string addr;
|
||||
unsigned short port;
|
||||
rsServer->FriendSetAddress(getPeerRsCertId(c), addr, port);
|
||||
*/
|
||||
}
|
||||
|
||||
void PeersFeed::trustfriend()
|
||||
{
|
||||
QTreeWidgetItem *c = getCurrentPeer();
|
||||
std::cerr << "PeersFeed::trustfriend()" << std::endl;
|
||||
/*
|
||||
bool trust = true;
|
||||
rsServer->FriendTrust(getPeerRsCertId(c), trust);
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* GUI stuff -> don't do anything directly with Control */
|
||||
void PeersFeed::configurefriend()
|
||||
{
|
||||
/* display Dialog */
|
||||
std::cerr << "PeersFeed::configurefriend()" << std::endl;
|
||||
QTreeWidgetItem *c = getCurrentPeer();
|
||||
|
||||
|
||||
static ConfCertDialog *confdialog = new ConfCertDialog();
|
||||
|
||||
|
||||
if (!c)
|
||||
return;
|
||||
|
||||
/* set the Id */
|
||||
std::string id = getPeerRsCertId(c);
|
||||
|
||||
confdialog -> loadId(id);
|
||||
confdialog -> show();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
65
retroshare-gui/src/gui/unfinished/PeersFeed.h
Normal file
65
retroshare-gui/src/gui/unfinished/PeersFeed.h
Normal file
@ -0,0 +1,65 @@
|
||||
/****************************************************************
|
||||
* RetroShare is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2008 Robert Fernie
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
|
||||
#ifndef _PEERS_FEED_DIALOG_H
|
||||
#define _PEERS_FEED_DIALOG_H
|
||||
|
||||
#include "gui/mainpage.h"
|
||||
#include "ui_PeersFeed.h"
|
||||
|
||||
#include "gui/feeds/FeedHolder.h"
|
||||
|
||||
class PeerItem;
|
||||
|
||||
class PeersFeed : public MainPage, public FeedHolder, private Ui::PeersFeed
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** Default Constructor */
|
||||
PeersFeed(QWidget *parent = 0);
|
||||
/** Default Destructor */
|
||||
|
||||
/* FeedHolder Functions (for FeedItem functionality) */
|
||||
virtual void deleteFeedItem(QWidget *item, uint32_t type);
|
||||
virtual void openChat(std::string peerId);
|
||||
virtual void openMsg(uint32_t type, std::string grpId, std::string inReplyTo);
|
||||
|
||||
private slots:
|
||||
|
||||
void updatePeers();
|
||||
void updateMode();
|
||||
|
||||
private:
|
||||
|
||||
QLayout *mLayout;
|
||||
|
||||
/* lists of feedItems */
|
||||
uint32_t mMode;
|
||||
std::map<std::string, PeerItem *> mPeers;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
135
retroshare-gui/src/gui/unfinished/PeersFeed.ui
Normal file
135
retroshare-gui/src/gui/unfinished/PeersFeed.ui
Normal file
@ -0,0 +1,135 @@
|
||||
<ui version="4.0" >
|
||||
<class>PeersFeed</class>
|
||||
<widget class="QWidget" name="PeersFeed" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>689</width>
|
||||
<height>386</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<item>
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font" >
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Show:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="modeComboBox" >
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Friends</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Online Friends</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Friends of Friends.</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>All Peers</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape" >
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="images.qrc" />
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
569
retroshare-gui/src/gui/unfinished/PhotoDialog.cpp
Normal file
569
retroshare-gui/src/gui/unfinished/PhotoDialog.cpp
Normal file
@ -0,0 +1,569 @@
|
||||
/****************************************************************
|
||||
* 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 "PhotoDialog.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>
|
||||
|
||||
|
||||
/* Images for context menu icons */
|
||||
#define IMAGE_REMOVEFRIEND ":/images/removefriend16.png"
|
||||
#define IMAGE_EXPIORTFRIEND ":/images/exportpeers_16x16.png"
|
||||
#define IMAGE_REMOVE ":/images/cancel.png"
|
||||
#define IMAGE_CHAT ":/images/chat.png"
|
||||
/* Images for Status icons */
|
||||
#define IMAGE_ONLINE ":/images/donline.png"
|
||||
#define IMAGE_OFFLINE ":/images/dhidden.png"
|
||||
#define IMAGE_PEER ":/images/user/identity16.png"
|
||||
#define IMAGE_PHOTOS ":/images/image16.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_NAME 1
|
||||
#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
|
||||
|
||||
/******
|
||||
* #define PHOTO_DEBUG 1
|
||||
*****/
|
||||
|
||||
|
||||
|
||||
/** Constructor */
|
||||
PhotoDialog::PhotoDialog(QWidget *parent)
|
||||
: MainPage(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( itemDoubleClicked ( QTreeWidgetItem * , int ) ), this, SLOT( showPhoto( QTreeWidgetItem *, int ) ) );
|
||||
connect( ui.addButton, SIGNAL( clicked( ) ), this, SLOT( addPhotos( ) ) );
|
||||
connect( ui.expandButton, SIGNAL(clicked()), this, SLOT(togglefileview()));
|
||||
|
||||
/* hide the Tree +/- */
|
||||
ui.photoTreeWidget -> setRootIsDecorated( false );
|
||||
|
||||
QSize iconSize(PHOTO_ICON_SIZE,PHOTO_ICON_SIZE);
|
||||
ui.photoTreeWidget->setIconSize(iconSize);
|
||||
|
||||
/* Set header resize modes and initial section sizes */
|
||||
QHeaderView * ptw_header = ui.peerTreeWidget->header () ;
|
||||
ptw_header->setResizeMode (0, QHeaderView::Interactive);
|
||||
|
||||
ptw_header->resizeSection ( 0, 175 );
|
||||
|
||||
|
||||
|
||||
/* 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 */
|
||||
#ifdef Q_WS_WIN
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void PhotoDialog::checkUpdate()
|
||||
{
|
||||
/* update */
|
||||
if (!rsPhoto)
|
||||
return;
|
||||
|
||||
if (rsPhoto->updated())
|
||||
{
|
||||
insertShowLists();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
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_REMOVE), tr( "Remove" ), this );
|
||||
connect( rm , SIGNAL( triggered() ), this, SLOT( removePhoto() ) );
|
||||
|
||||
contextMnu.clear();
|
||||
contextMnu.addAction(rm);
|
||||
contextMnu.addSeparator();
|
||||
contextMnu.exec( mevent->globalPos() );
|
||||
}
|
||||
|
||||
void PhotoDialog::togglefileview()
|
||||
{
|
||||
/* if msg header visible -> hide by changing splitter
|
||||
* three widgets...
|
||||
*/
|
||||
|
||||
QList<int> sizeList = ui.photoSplitter->sizes();
|
||||
QList<int>::iterator it;
|
||||
|
||||
int listSize = 0;
|
||||
int msgSize = 0;
|
||||
int i = 0;
|
||||
|
||||
for(it = sizeList.begin(); it != sizeList.end(); it++, i++)
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
listSize = (*it);
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
msgSize = (*it);
|
||||
}
|
||||
}
|
||||
|
||||
int totalSize = listSize + msgSize;
|
||||
|
||||
bool toShrink = true;
|
||||
if (msgSize < (int) totalSize / 10)
|
||||
{
|
||||
toShrink = false;
|
||||
}
|
||||
|
||||
QList<int> newSizeList;
|
||||
if (toShrink)
|
||||
{
|
||||
newSizeList.push_back(totalSize);
|
||||
newSizeList.push_back(0);
|
||||
ui.expandButton->setIcon(QIcon(QString(":/images/edit_add24.png")));
|
||||
ui.expandButton->setToolTip("Expand");
|
||||
}
|
||||
else
|
||||
{
|
||||
/* no change */
|
||||
int nlistSize = (totalSize / 2);
|
||||
int nMsgSize = (totalSize / 2);
|
||||
newSizeList.push_back(nlistSize);
|
||||
newSizeList.push_back(nMsgSize);
|
||||
ui.expandButton->setIcon(QIcon(QString(":/images/edit_remove24.png")));
|
||||
ui.expandButton->setToolTip("Hide");
|
||||
}
|
||||
|
||||
ui.photoSplitter->setSizes(newSizeList);
|
||||
}
|
||||
|
||||
void PhotoDialog::insertShowLists()
|
||||
{
|
||||
/* clear it all */
|
||||
ui.peerTreeWidget->clear();
|
||||
|
||||
/* iterate through peers */
|
||||
addShows(rsPeers->getOwnId());
|
||||
|
||||
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)
|
||||
{
|
||||
std::list<std::string> allPhotos;
|
||||
std::list<std::string> showIds;
|
||||
std::list<std::string>::iterator it;
|
||||
|
||||
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, "");
|
||||
peerItem->setIcon(0,(QIcon(IMAGE_PEER)));
|
||||
|
||||
ui.peerTreeWidget->insertTopLevelItem(0, peerItem);
|
||||
|
||||
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, "");
|
||||
allItem->setIcon(0,(QIcon(IMAGE_PHOTOS)));
|
||||
|
||||
peerItem->addChild(allItem);
|
||||
|
||||
rsPhoto->getPhotoList(id, allPhotos);
|
||||
rsPhoto->getShowList(id, showIds);
|
||||
|
||||
for(it = allPhotos.begin(); it != allPhotos.end(); it++)
|
||||
{
|
||||
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));
|
||||
photoItem->setIcon(0,(QIcon(IMAGE_PHOTOS)));
|
||||
|
||||
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++)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PhotoDialog::updatePhotoList()
|
||||
{
|
||||
#ifdef PHOTO_DEBUG
|
||||
std::cerr << "PhotoDialog::updatePhotoList()" << std::endl;
|
||||
#endif
|
||||
|
||||
/* get current item */
|
||||
QTreeWidgetItem *item = ui.peerTreeWidget->currentItem();
|
||||
|
||||
if (!item)
|
||||
{
|
||||
/* leave current list */
|
||||
#ifdef PHOTO_DEBUG
|
||||
std::cerr << "PhotoDialog::updatePhotoList() No Current item -> leave" << std::endl;
|
||||
#endif
|
||||
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 */
|
||||
#ifdef PHOTO_DEBUG
|
||||
std::cerr << "PhotoDialog::updatePhotoList() List still good!" << std::endl;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef PHOTO_DEBUG
|
||||
std::cerr << "PhotoDialog::updatePhotoList() pid: " << pid << " sid: " << sid << std::endl;
|
||||
#endif
|
||||
/* get the list of photos */
|
||||
|
||||
ui.photoTreeWidget->clear();
|
||||
QList<QTreeWidgetItem *> items;
|
||||
|
||||
if (sid != "")
|
||||
{
|
||||
#ifdef PHOTO_DEBUG
|
||||
std::cerr << "PhotoDialog::updatePhotoList() SID -> showing show" << std::endl;
|
||||
#endif
|
||||
/* load up show list */
|
||||
RsPhotoShowDetails detail;
|
||||
rsPhoto->getShowDetails(pid, sid, detail);
|
||||
|
||||
|
||||
std::list<RsPhotoShowInfo>::iterator sit;
|
||||
for(sit = detail.photos.begin(); sit != detail.photos.end(); sit++)
|
||||
{
|
||||
RsPhotoDetails photoDetail;
|
||||
|
||||
if (!rsPhoto->getPhotoDetails(pid, sit->photoId, photoDetail))
|
||||
{
|
||||
#ifdef PHOTO_DEBUG
|
||||
std::cerr << "PhotoDialog::updatePhotoList() getPhotoDetails: " << sit->photoId << " FAILED" << std::endl;
|
||||
#endif
|
||||
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));
|
||||
|
||||
items.append(photoItem);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef PHOTO_DEBUG
|
||||
std::cerr << "PhotoDialog::updatePhotoList() No SID -> show all" << std::endl;
|
||||
#endif
|
||||
|
||||
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))
|
||||
{
|
||||
#ifdef PHOTO_DEBUG
|
||||
std::cerr << "PhotoDialog::updatePhotoList() getPhotoDetails: " << *pit << " FAILED" << std::endl;
|
||||
#endif
|
||||
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));
|
||||
|
||||
|
||||
#ifdef PHOTO_DEBUG
|
||||
std::cerr << "PhotoDialog::updatePhotoList() added Item: " << *pit << std::endl;
|
||||
#endif
|
||||
items.append(photoItem);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* update ids? */
|
||||
mCurrentPID = pid;
|
||||
mCurrentSID = sid;
|
||||
|
||||
/* add the items in! */
|
||||
ui.photoTreeWidget->insertTopLevelItems(0, items);
|
||||
ui.photoTreeWidget->update();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* get the list of peers from the RsIface. */
|
||||
void PhotoDialog::insertExample()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
#ifdef PHOTO_DEBUG
|
||||
std::cerr << "Invalid Current Item" << std::endl;
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Display the columns of this item. */
|
||||
#ifdef PHOTO_DEBUG
|
||||
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();
|
||||
#endif
|
||||
return item;
|
||||
}
|
||||
|
||||
void PhotoDialog::removePhoto()
|
||||
{
|
||||
QTreeWidgetItem *c = getCurrentLine();
|
||||
#ifdef PHOTO_DEBUG
|
||||
std::cerr << "PhotoDialog::removePhoto()" << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void PhotoDialog::addPhotos()
|
||||
{
|
||||
/* 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);
|
||||
}
|
||||
}
|
||||
|
||||
void PhotoDialog::addPhoto(QString filename)
|
||||
{
|
||||
/* store in rsPhoto */
|
||||
std::string photoId = rsPhoto->addPhoto(filename.toStdString());
|
||||
|
||||
}
|
||||
|
||||
void PhotoDialog::showPhoto( QTreeWidgetItem *item, int column)
|
||||
{
|
||||
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
/* get the photoId */
|
||||
std::string pid = item->text(PHOTO_LIST_COL_PEERID).toStdString();
|
||||
std::string photoid = item->text(PHOTO_LIST_COL_PHOTOID).toStdString();
|
||||
|
||||
PhotoShow *newView = new PhotoShow();
|
||||
newView->show();
|
||||
|
||||
newView->setPeerId(pid);
|
||||
newView->setPhotoId(photoid);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
89
retroshare-gui/src/gui/unfinished/PhotoDialog.h
Normal file
89
retroshare-gui/src/gui/unfinished/PhotoDialog.h
Normal file
@ -0,0 +1,89 @@
|
||||
/****************************************************************
|
||||
* 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 _PHOTODIALOG_H
|
||||
#define _PHOTODIALOG_H
|
||||
|
||||
#include <QFileDialog>
|
||||
|
||||
#include "gui/mainpage.h"
|
||||
#include "ui_PhotoDialog.h"
|
||||
|
||||
#include <map>
|
||||
|
||||
|
||||
class PhotoDialog : public MainPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** Default Constructor */
|
||||
PhotoDialog(QWidget *parent = 0);
|
||||
/** Default Destructor */
|
||||
|
||||
void insertExample();
|
||||
void insertShowLists();
|
||||
|
||||
private slots:
|
||||
/** Create the context popup menu and it's submenus */
|
||||
void photoTreeWidgetCustomPopupMenu( QPoint point );
|
||||
void peerTreeWidgetCustomPopupMenu( QPoint point );
|
||||
|
||||
void updatePhotoList();
|
||||
|
||||
void removePhoto();
|
||||
void addPhotos();
|
||||
|
||||
void checkUpdate();
|
||||
|
||||
/* handle splitter */
|
||||
void togglefileview();
|
||||
|
||||
void showPhoto( QTreeWidgetItem *item, int column);
|
||||
|
||||
private:
|
||||
|
||||
void addShows(std::string peerid);
|
||||
|
||||
void addPhoto(QString filename);
|
||||
|
||||
/* Worker Functions */
|
||||
/* (1) Update Display */
|
||||
|
||||
/* (2) Utility Fns */
|
||||
QTreeWidgetItem *getCurrentLine();
|
||||
|
||||
std::map<QString, QPixmap *> photoMap;
|
||||
|
||||
std::string mCurrentPID;
|
||||
std::string mCurrentSID;
|
||||
|
||||
/** Define the popup menus for the Context menu */
|
||||
QMenu* contextMnu;
|
||||
|
||||
QTreeWidget *exampletreeWidget;
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::PhotoDialog ui;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
267
retroshare-gui/src/gui/unfinished/PhotoDialog.ui
Normal file
267
retroshare-gui/src/gui/unfinished/PhotoDialog.ui
Normal file
@ -0,0 +1,267 @@
|
||||
<ui version="4.0" >
|
||||
<class>PhotoDialog</class>
|
||||
<widget class="QWidget" name="PhotoDialog" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>561</width>
|
||||
<height>489</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="verticalSpacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="photoiconlabel" >
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap" >
|
||||
<pixmap resource="images.qrc" >:/images/image16.png</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QLabel" name="label_7" >
|
||||
<property name="text" >
|
||||
<string><html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt; font-weight:600;">Photo View</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>391</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3" >
|
||||
<widget class="QSplitter" name="photoSplitter" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<widget class="QWidget" name="layoutWidget" >
|
||||
<layout class="QVBoxLayout" >
|
||||
<item>
|
||||
<widget class="QSplitter" name="splitter" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<widget class="QTreeWidget" name="peerTreeWidget" >
|
||||
<property name="contextMenuPolicy" >
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>Peer</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>Slideshow</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>Photo</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
<widget class="QTreeWidget" name="photoTreeWidget" >
|
||||
<property name="contextMenuPolicy" >
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>Thumb Image</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>Image Name</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>Comment</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>Date</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>Location</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>Size</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>PeerId</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>PhotoId</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<item>
|
||||
<widget class="QPushButton" name="expandButton" >
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="images.qrc" >
|
||||
<normaloff>:/images/edit_remove24.png</normaloff>:/images/edit_remove24.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="addButton" >
|
||||
<property name="toolTip" >
|
||||
<string>Add Photo(s)</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Add Photo(s)</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="images.qrc" >
|
||||
<normaloff>:/images/add_image24.png</normaloff>:/images/add_image24.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="addShowButton" >
|
||||
<property name="text" >
|
||||
<string>Add Photo SlideShow</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="updateButton" >
|
||||
<property name="text" >
|
||||
<string>Update Details</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="images.qrc" >
|
||||
<normaloff>:/images/quick_restart24.png</normaloff>:/images/quick_restart24.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget" >
|
||||
<layout class="QGridLayout" >
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<string>Photo </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QLineEdit" name="photoNameEdit" />
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="label_3" >
|
||||
<property name="text" >
|
||||
<string>Date</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QLineEdit" name="photoDateEdit" />
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QLabel" name="label_4" >
|
||||
<property name="text" >
|
||||
<string>Location</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" >
|
||||
<widget class="QLineEdit" name="photoLocEdit" />
|
||||
</item>
|
||||
<item row="3" column="0" >
|
||||
<widget class="QLabel" name="label_5" >
|
||||
<property name="text" >
|
||||
<string>Description</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" >
|
||||
<widget class="QLineEdit" name="photoDescEdit" />
|
||||
</item>
|
||||
<item row="4" column="0" >
|
||||
<widget class="QLabel" name="label_2" >
|
||||
<property name="text" >
|
||||
<string>Comment</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1" >
|
||||
<widget class="QTextEdit" name="photoCommentEdit" />
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="images.qrc" />
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
161
retroshare-gui/src/gui/unfinished/PhotoShow.cpp
Normal file
161
retroshare-gui/src/gui/unfinished/PhotoShow.cpp
Normal file
@ -0,0 +1,161 @@
|
||||
/****************************************************************
|
||||
* 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 "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/unfinished/PhotoShow.h
Normal file
68
retroshare-gui/src/gui/unfinished/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 "gui/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
|
||||
|
246
retroshare-gui/src/gui/unfinished/PhotoShow.ui
Normal file
246
retroshare-gui/src/gui/unfinished/PhotoShow.ui
Normal file
@ -0,0 +1,246 @@
|
||||
<ui version="4.0" >
|
||||
<class>PhotoShow</class>
|
||||
<widget class="QWidget" name="PhotoShow" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>591</width>
|
||||
<height>421</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<item row="0" column="0" >
|
||||
<layout class="QVBoxLayout" >
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<item>
|
||||
<layout class="QVBoxLayout" >
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3" >
|
||||
<property name="text" >
|
||||
<string>Date:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2" >
|
||||
<property name="text" >
|
||||
<string>Location:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4" >
|
||||
<property name="text" >
|
||||
<string>Comment:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" >
|
||||
<item>
|
||||
<widget class="QLineEdit" name="dateLineEdit" />
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="locLineEdit" />
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="commentLineEdit" />
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5" >
|
||||
<property name="text" >
|
||||
<string>Display Size:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="sizeComboBox" >
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>320 x 320</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>640 x 640</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Full Size</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6" >
|
||||
<property name="text" >
|
||||
<string>Play Rate:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="speedComboBox" >
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>1 Sec</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>2 Sec</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>5 Sec</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>10 Sec</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>20 Sec</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>1 Min</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="editButton" >
|
||||
<property name="text" >
|
||||
<string>Edit Photo Details</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="saveButton" >
|
||||
<property name="text" >
|
||||
<string>Save Photo</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="photoLabel" >
|
||||
<property name="text" >
|
||||
<string>No Photo Selected</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="startButton" >
|
||||
<property name="text" >
|
||||
<string>Start</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="backButton" >
|
||||
<property name="text" >
|
||||
<string>Back</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="images.qrc" >
|
||||
<normaloff>:/images/back.png</normaloff>:/images/back.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="playButton" >
|
||||
<property name="text" >
|
||||
<string>Play </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pauseButton" >
|
||||
<property name="text" >
|
||||
<string>Pause</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="stepButton" >
|
||||
<property name="text" >
|
||||
<string>Forward</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="images.qrc" >
|
||||
<normaloff>:/images/forward.png</normaloff>:/images/forward.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="images.qrc" />
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
285
retroshare-gui/src/gui/unfinished/StatisticDialog.cpp
Normal file
285
retroshare-gui/src/gui/unfinished/StatisticDialog.cpp
Normal file
@ -0,0 +1,285 @@
|
||||
/****************************************************************
|
||||
* RShare is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2006, crypton
|
||||
*
|
||||
* 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 "rshare.h"
|
||||
#include "StatisticDialog.h"
|
||||
#include <control/bandwidthevent.h>
|
||||
#include "rsiface/rsiface.h"
|
||||
|
||||
#include <QTime>
|
||||
#include <QHeaderView>
|
||||
|
||||
/* Define the format used for displaying the date and time */
|
||||
#define DATETIME_FMT "yyyy MM dd hh:mm:ss"
|
||||
|
||||
QTime UpTime;
|
||||
int UpDays;
|
||||
bool dayChange;
|
||||
static int Timer=0;
|
||||
|
||||
/** Constructor */
|
||||
StatisticDialog::StatisticDialog(QWidget *parent)
|
||||
: MainPage(parent)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui.setupUi(this);
|
||||
|
||||
/* Create Bandwidth Graph related QObjects */
|
||||
_settings = new RshareSettings();
|
||||
|
||||
/* Bind events to actions */
|
||||
createActions();
|
||||
|
||||
UpDays=0;
|
||||
dayChange=false;
|
||||
UpTime.start();
|
||||
|
||||
/* Initialize Sent/Receive data counters */
|
||||
reset();
|
||||
|
||||
/* Hide Bandwidth Graph Settings frame */
|
||||
showSettingsFrame(false);
|
||||
|
||||
/* Set header resize modes and initial section sizes */
|
||||
QHeaderView * _stheader = ui.treeWidget-> header();
|
||||
_stheader->resizeSection ( 0, 210 );
|
||||
|
||||
QAbstractItemModel * model =ui.treeWidget->model();
|
||||
QModelIndex ind2;
|
||||
// set Times --> Session --> Since
|
||||
ind2=model->index(4,0).child(0,0).child(1,1);
|
||||
model->setData(ind2,QDateTime::currentDateTime()
|
||||
.toString(DATETIME_FMT));
|
||||
|
||||
/* Turn off opacity group on unsupported platforms */
|
||||
#if defined(Q_WS_WIN)
|
||||
if(!(QSysInfo::WV_2000 <= QSysInfo::WindowsVersion <= QSysInfo::WV_2003)) {
|
||||
ui.frmOpacity->setVisible(false);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(Q_WS_X11)
|
||||
ui.frmOpacity->setVisible(false);
|
||||
#endif
|
||||
|
||||
Timer=startTimer(REFRESH_RATE);
|
||||
|
||||
}
|
||||
|
||||
/** Default destructor */
|
||||
StatisticDialog::~StatisticDialog()
|
||||
{
|
||||
delete _settings;
|
||||
}
|
||||
|
||||
/**
|
||||
Custom event handler. Checks if the event is a bandwidth update event. If it
|
||||
is, it will add the data point to the history and updates the graph.*/
|
||||
|
||||
void
|
||||
StatisticDialog::customEvent(QEvent *event)
|
||||
{
|
||||
if (event->type() == CustomEventType::BandwidthEvent) {
|
||||
BandwidthEvent *bw = (BandwidthEvent *)event;
|
||||
updateGraph(bw->bytesRead(), bw->bytesWritten());
|
||||
}
|
||||
}
|
||||
|
||||
void StatisticDialog::timerEvent( QTimerEvent * )
|
||||
{
|
||||
QAbstractItemModel * model =ui.treeWidget->model();
|
||||
QModelIndex ind1;
|
||||
// set download --> session bytes
|
||||
//ind1=model->index(1,0).child(0,0).child(0,1);
|
||||
//model->setData(ind1,totalToString(TotBytesDownloaded/1024.0));
|
||||
// set upload --> session bytes
|
||||
//ind1=model->index(2,0).child(0,0).child(0,1);
|
||||
//model->setData(ind1,totalToString(TotBytesUploaded/1024.0));
|
||||
|
||||
// set Times --> Session --> Uptime
|
||||
ind1=model->index(4,0).child(0,0).child(0,1);
|
||||
if(! dayChange && (UpTime.elapsed()/1000 > 60*60*23)) dayChange=true;
|
||||
if( dayChange && (UpTime.elapsed() <10000)) {dayChange=false;UpDays++;}
|
||||
|
||||
QTime elapsed;
|
||||
elapsed= QTime(0,0,0).addMSecs(UpTime.elapsed());
|
||||
if( UpDays>0)
|
||||
model->setData(ind1,QString(tr("%1 days ")).arg(UpDays)+elapsed.toString("hh:mm:ss"));
|
||||
else
|
||||
model->setData(ind1,elapsed.toString("hh:mm:ss"));
|
||||
|
||||
/* set users/friends/network */
|
||||
float downKb = 0;
|
||||
float upKb = 0;
|
||||
rsicontrol -> ConfigGetDataRates(downKb, upKb);
|
||||
|
||||
updateGraph(downKb,upKb);
|
||||
//
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
Binds events to actions
|
||||
*/
|
||||
void
|
||||
StatisticDialog::createActions()
|
||||
{
|
||||
connect(ui.btnToggleSettings, SIGNAL(toggled(bool)),
|
||||
this, SLOT(showSettingsFrame(bool)));
|
||||
|
||||
connect(ui.btnReset, SIGNAL(clicked()),
|
||||
this, SLOT(reset()));
|
||||
|
||||
connect(ui.btnSaveSettings, SIGNAL(clicked()),
|
||||
this, SLOT(saveChanges()));
|
||||
|
||||
connect(ui.btnCancelSettings, SIGNAL(clicked()),
|
||||
this, SLOT(cancelChanges()));
|
||||
|
||||
connect(ui.sldrOpacity, SIGNAL(valueChanged(int)),
|
||||
this, SLOT(setOpacity(int)));
|
||||
}
|
||||
|
||||
/**
|
||||
Adds new data to the graph
|
||||
*/
|
||||
void
|
||||
StatisticDialog::updateGraph(quint64 bytesRead, quint64 bytesWritten)
|
||||
{
|
||||
/* Graph only cares about kilobytes */
|
||||
ui.frmGraph->addPoints(bytesRead, bytesWritten);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Loads the saved Bandwidth Graph settings
|
||||
*/
|
||||
void
|
||||
StatisticDialog::loadSettings()
|
||||
{
|
||||
/* Set window opacity slider widget */
|
||||
ui.sldrOpacity->setValue(_settings->getBWGraphOpacity());
|
||||
|
||||
|
||||
|
||||
/* Set the line filter checkboxes accordingly */
|
||||
uint filter = _settings->getBWGraphFilter();
|
||||
ui.chkReceiveRate->setChecked(filter & BWGRAPH_REC);
|
||||
ui.chkSendRate->setChecked(filter & BWGRAPH_SEND);
|
||||
|
||||
/* Set graph frame settings */
|
||||
ui.frmGraph->setShowCounters(ui.chkReceiveRate->isChecked(),
|
||||
ui.chkSendRate->isChecked());
|
||||
}
|
||||
|
||||
/**
|
||||
Resets the log start time
|
||||
*/
|
||||
void
|
||||
StatisticDialog::reset()
|
||||
{
|
||||
/* Set to current time */
|
||||
// ui.statusbar->showMessage(tr("Since:") + " " +
|
||||
// QDateTime::currentDateTime()
|
||||
// .toString(DATETIME_FMT));
|
||||
/* Reset the graph */
|
||||
ui.frmGraph->resetGraph();
|
||||
}
|
||||
|
||||
/**
|
||||
Saves the Bandwidth Graph settings and adjusts the graph if necessary
|
||||
*/
|
||||
void
|
||||
StatisticDialog::saveChanges()
|
||||
{
|
||||
/* Hide the settings frame and reset toggle button */
|
||||
showSettingsFrame(false);
|
||||
|
||||
/* Save the opacity */
|
||||
_settings->setBWGraphOpacity(ui.sldrOpacity->value());
|
||||
|
||||
|
||||
|
||||
/* Save the line filter values */
|
||||
_settings->setBWGraphFilter(BWGRAPH_REC, ui.chkReceiveRate->isChecked());
|
||||
_settings->setBWGraphFilter(BWGRAPH_SEND, ui.chkSendRate->isChecked());
|
||||
|
||||
/* Update the graph frame settings */
|
||||
ui.frmGraph->setShowCounters(ui.chkReceiveRate->isChecked(),
|
||||
ui.chkSendRate->isChecked());
|
||||
|
||||
/* A change in window flags causes the window to disappear, so make sure
|
||||
* it's still visible. */
|
||||
showNormal();
|
||||
}
|
||||
|
||||
/**
|
||||
Simply restores the previously saved settings
|
||||
*/
|
||||
void
|
||||
StatisticDialog::cancelChanges()
|
||||
{
|
||||
/* Hide the settings frame and reset toggle button */
|
||||
showSettingsFrame(false);
|
||||
|
||||
/* Reload the settings */
|
||||
loadSettings();
|
||||
}
|
||||
|
||||
/**
|
||||
Toggles the Settings pane on and off, changes toggle button text
|
||||
*/
|
||||
void
|
||||
StatisticDialog::showSettingsFrame(bool show)
|
||||
{
|
||||
if (show) {
|
||||
ui.frmSettings->setVisible(true);
|
||||
ui.btnToggleSettings->setChecked(true);
|
||||
ui.btnToggleSettings->setText(tr("Hide Settings"));
|
||||
} else {
|
||||
ui.frmSettings->setVisible(false);
|
||||
ui.btnToggleSettings->setChecked(false);
|
||||
ui.btnToggleSettings->setText(tr("Show Settings"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Sets the opacity of the Bandwidth Graph window
|
||||
*/
|
||||
void
|
||||
StatisticDialog::setOpacity(int value)
|
||||
{
|
||||
qreal newValue = value / 100.0;
|
||||
|
||||
/* Opacity only supported by Mac and Win32 */
|
||||
#if defined(Q_WS_MAC)
|
||||
this->setWindowOpacity(newValue);
|
||||
#elif defined(Q_WS_WIN)
|
||||
if(QSysInfo::WV_2000 <= QSysInfo::WindowsVersion <= QSysInfo::WV_2003) {
|
||||
this->setWindowOpacity(newValue);
|
||||
}
|
||||
#else
|
||||
Q_UNUSED(newValue);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
84
retroshare-gui/src/gui/unfinished/StatisticDialog.h
Normal file
84
retroshare-gui/src/gui/unfinished/StatisticDialog.h
Normal file
@ -0,0 +1,84 @@
|
||||
/****************************************************************
|
||||
* RShare is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2006, crypton
|
||||
*
|
||||
* 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 _STATISTICDIALOG_H
|
||||
#define _STATISTICDIALOG_H
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QDateTime>
|
||||
#include <QEvent>
|
||||
#include <QTimer>
|
||||
|
||||
|
||||
#include <gui/Preferences/rsharesettings.h>
|
||||
|
||||
#include "gui/mainpage.h"
|
||||
#include "ui_StatisticDialog.h"
|
||||
#include "gui/linetypes.h"
|
||||
|
||||
/** Redraw graph every 1000ms **/
|
||||
#define REFRESH_RATE 1000
|
||||
|
||||
class StatisticDialog : public MainPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** Default Constructor */
|
||||
StatisticDialog(QWidget *parent = 0);
|
||||
/** Default Destructor */
|
||||
~StatisticDialog();
|
||||
protected:
|
||||
/** Called to deliver a bandwidth update event from RetroShare. */
|
||||
void customEvent(QEvent *event);
|
||||
void timerEvent(QTimerEvent*);
|
||||
|
||||
|
||||
private slots:
|
||||
/** Adds new data to the graph */
|
||||
void updateGraph(quint64 bytesRead, quint64 bytesWritten);
|
||||
/** Called when settings button is toggled */
|
||||
void showSettingsFrame(bool show);
|
||||
/** Called when the settings button is toggled */
|
||||
void setOpacity(int value);
|
||||
/** Called when the user saves settings */
|
||||
void saveChanges();
|
||||
/** Called when the user cancels changes settings */
|
||||
void cancelChanges();
|
||||
/** Called when the reset button is pressed */
|
||||
void reset();
|
||||
|
||||
|
||||
private:
|
||||
/** Create and bind actions to events **/
|
||||
void createActions();
|
||||
/** Loads the saved Bandwidth Graph settings */
|
||||
void loadSettings();
|
||||
|
||||
/** A RetroShareSettings object that handles getting/saving settings */
|
||||
RshareSettings* _settings;
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::StatisticDialog ui;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
1292
retroshare-gui/src/gui/unfinished/StatisticDialog.ui
Normal file
1292
retroshare-gui/src/gui/unfinished/StatisticDialog.ui
Normal file
File diff suppressed because it is too large
Load Diff
336
retroshare-gui/src/gui/unfinished/TransferFeed.cpp
Normal file
336
retroshare-gui/src/gui/unfinished/TransferFeed.cpp
Normal file
@ -0,0 +1,336 @@
|
||||
/****************************************************************
|
||||
* 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 <QtGui>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "TransferFeed.h"
|
||||
#include "gui/feeds/SubFileItem.h"
|
||||
#include "gui/GeneralMsgDialog.h"
|
||||
|
||||
#include "rsiface/rsfiles.h"
|
||||
|
||||
|
||||
/*****
|
||||
* #define TRANSFER_DEBUG 1
|
||||
****/
|
||||
|
||||
/** Constructor */
|
||||
TransferFeed::TransferFeed(QWidget *parent)
|
||||
: MainPage (parent)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
setupUi(this);
|
||||
|
||||
connect( modeComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( updateMode() ) );
|
||||
|
||||
{
|
||||
/* mLayout -> to add widgets to */
|
||||
mDownloadsLayout = new QVBoxLayout;
|
||||
|
||||
QWidget *middleWidget = new QWidget();
|
||||
//middleWidget->setSizePolicy( QSizePolicy::Policy::Maximum, QSizePolicy::Policy::Minimum);
|
||||
middleWidget->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum);
|
||||
middleWidget->setLayout(mDownloadsLayout);
|
||||
|
||||
|
||||
QScrollArea *scrollArea = new QScrollArea;
|
||||
//scrollArea->setBackgroundRole(QPalette::Dark);
|
||||
scrollArea->setWidget(middleWidget);
|
||||
scrollArea->setWidgetResizable(true);
|
||||
scrollArea->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
|
||||
|
||||
QVBoxLayout *layout2 = new QVBoxLayout;
|
||||
layout2->addWidget(scrollArea);
|
||||
layout2->setSpacing(0);
|
||||
layout2->setMargin(0);
|
||||
|
||||
frameDown->setLayout(layout2);
|
||||
}
|
||||
|
||||
{
|
||||
/* mLayout -> to add widgets to */
|
||||
mUploadsLayout = new QVBoxLayout;
|
||||
|
||||
QWidget *middleWidget = new QWidget();
|
||||
//middleWidget->setSizePolicy( QSizePolicy::Policy::Maximum, QSizePolicy::Policy::Minimum);
|
||||
middleWidget->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum);
|
||||
middleWidget->setLayout(mUploadsLayout);
|
||||
|
||||
|
||||
QScrollArea *scrollArea = new QScrollArea;
|
||||
//scrollArea->setBackgroundRole(QPalette::Dark);
|
||||
scrollArea->setWidget(middleWidget);
|
||||
scrollArea->setWidgetResizable(true);
|
||||
scrollArea->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
|
||||
|
||||
QVBoxLayout *layout2 = new QVBoxLayout;
|
||||
layout2->addWidget(scrollArea);
|
||||
layout2->setSpacing(0);
|
||||
layout2->setMargin(0);
|
||||
|
||||
frameUp->setLayout(layout2);
|
||||
}
|
||||
|
||||
QTimer *timer = new QTimer(this);
|
||||
timer->connect(timer, SIGNAL(timeout()), this, SLOT(updateAll()));
|
||||
timer->start(1000);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* FeedHolder Functions (for FeedItem functionality) */
|
||||
void TransferFeed::deleteFeedItem(QWidget *item, uint32_t type)
|
||||
{
|
||||
#ifdef TRANSFER_DEBUG
|
||||
std::cerr << "TransferFeed::deleteFeedItem()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
void TransferFeed::openChat(std::string peerId)
|
||||
{
|
||||
#ifdef TRANSFER_DEBUG
|
||||
std::cerr << "TransferFeed::openChat()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
void TransferFeed::openMsg(uint32_t type, std::string grpId, std::string inReplyTo)
|
||||
{
|
||||
#ifdef TRANSFER_DEBUG
|
||||
std::cerr << "TransferFeed::openMsg()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
GeneralMsgDialog *msgDialog = new GeneralMsgDialog(NULL);
|
||||
|
||||
|
||||
msgDialog->addDestination(type, grpId, inReplyTo);
|
||||
|
||||
msgDialog->show();
|
||||
|
||||
}
|
||||
|
||||
void TransferFeed::updateMode()
|
||||
{
|
||||
updateAll();
|
||||
}
|
||||
|
||||
void TransferFeed::updateAll()
|
||||
{
|
||||
updateDownloads();
|
||||
updateUploads();
|
||||
}
|
||||
|
||||
void TransferFeed::updateDownloads()
|
||||
{
|
||||
std::list<std::string> hashes, toAdd, toRemove;
|
||||
std::list<std::string>::iterator it;
|
||||
|
||||
std::map<std::string, uint32_t> newhashes;
|
||||
std::map<std::string, uint32_t>::iterator nit;
|
||||
std::map<std::string, SubFileItem *>::iterator fit;
|
||||
|
||||
if (!rsFiles)
|
||||
{
|
||||
/* not ready yet! */
|
||||
return;
|
||||
}
|
||||
|
||||
rsFiles->FileDownloads(hashes);
|
||||
|
||||
for(it = hashes.begin(); it != hashes.end(); it++)
|
||||
{
|
||||
newhashes[*it] = 1;
|
||||
}
|
||||
|
||||
nit = newhashes.begin();
|
||||
fit = mDownloads.begin();
|
||||
|
||||
while(nit != newhashes.end())
|
||||
{
|
||||
if (fit == mDownloads.end())
|
||||
{
|
||||
toAdd.push_back(nit->first);
|
||||
nit++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (nit->first == fit->first)
|
||||
{
|
||||
/* same - good! */
|
||||
nit++;
|
||||
fit++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (nit->first < fit->first)
|
||||
{
|
||||
/* must add in new item */
|
||||
toAdd.push_back(nit->first);
|
||||
nit++;
|
||||
}
|
||||
else
|
||||
{
|
||||
toRemove.push_back(fit->first);
|
||||
fit++;
|
||||
}
|
||||
}
|
||||
|
||||
/* remove remaining items */
|
||||
while (fit != mDownloads.end())
|
||||
{
|
||||
toRemove.push_back(fit->first);
|
||||
fit++;
|
||||
}
|
||||
|
||||
/* remove first */
|
||||
for(it = toRemove.begin(); it != toRemove.end(); it++)
|
||||
{
|
||||
fit = mDownloads.find(*it);
|
||||
if (fit != mDownloads.end())
|
||||
{
|
||||
delete (fit->second);
|
||||
mDownloads.erase(fit);
|
||||
}
|
||||
}
|
||||
|
||||
/* add in new ones */
|
||||
for(it = toAdd.begin(); it != toAdd.end(); it++)
|
||||
{
|
||||
FileInfo fi;
|
||||
uint32_t hintflags = RS_FILE_HINTS_DOWNLOAD
|
||||
| RS_FILE_HINTS_SPEC_ONLY;
|
||||
|
||||
if (rsFiles->FileDetails(*it, hintflags, fi))
|
||||
{
|
||||
// XXX HACK _ TOFIX >>>> fi.source);
|
||||
|
||||
SubFileItem *sfi = new SubFileItem(*it, fi.fname,
|
||||
fi.size, SFI_STATE_DOWNLOAD, "");
|
||||
|
||||
// XXX HACK _ TOFIX >>>> fi.source);
|
||||
|
||||
mDownloads[*it] = sfi;
|
||||
mDownloadsLayout->addWidget(sfi);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TransferFeed::updateUploads()
|
||||
{
|
||||
std::list<std::string> hashes, toAdd, toRemove;
|
||||
std::list<std::string>::iterator it;
|
||||
|
||||
std::map<std::string, uint32_t> newhashes;
|
||||
std::map<std::string, uint32_t>::iterator nit;
|
||||
std::map<std::string, SubFileItem *>::iterator fit;
|
||||
|
||||
if (!rsFiles)
|
||||
{
|
||||
/* not ready yet! */
|
||||
return;
|
||||
}
|
||||
|
||||
rsFiles->FileUploads(hashes);
|
||||
|
||||
for(it = hashes.begin(); it != hashes.end(); it++)
|
||||
{
|
||||
newhashes[*it] = 1;
|
||||
}
|
||||
|
||||
nit = newhashes.begin();
|
||||
fit = mUploads.begin();
|
||||
|
||||
while(nit != newhashes.end())
|
||||
{
|
||||
if (fit == mUploads.end())
|
||||
{
|
||||
toAdd.push_back(nit->first);
|
||||
nit++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (nit->first == fit->first)
|
||||
{
|
||||
/* same - good! */
|
||||
nit++;
|
||||
fit++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (nit->first < fit->first)
|
||||
{
|
||||
/* must add in new item */
|
||||
toAdd.push_back(nit->first);
|
||||
nit++;
|
||||
}
|
||||
else
|
||||
{
|
||||
toRemove.push_back(fit->first);
|
||||
fit++;
|
||||
}
|
||||
}
|
||||
|
||||
/* remove remaining items */
|
||||
while (fit != mUploads.end())
|
||||
{
|
||||
toRemove.push_back(fit->first);
|
||||
fit++;
|
||||
}
|
||||
|
||||
/* remove first */
|
||||
for(it = toRemove.begin(); it != toRemove.end(); it++)
|
||||
{
|
||||
fit = mUploads.find(*it);
|
||||
if (fit != mUploads.end())
|
||||
{
|
||||
delete (fit->second);
|
||||
mUploads.erase(fit);
|
||||
}
|
||||
}
|
||||
|
||||
/* add in new ones */
|
||||
for(it = toAdd.begin(); it != toAdd.end(); it++)
|
||||
{
|
||||
FileInfo fi;
|
||||
uint32_t hintflags = RS_FILE_HINTS_UPLOAD
|
||||
| RS_FILE_HINTS_SPEC_ONLY;
|
||||
|
||||
if (rsFiles->FileDetails(*it, hintflags, fi))
|
||||
{
|
||||
// XXX HACK _ TOFIX >>>> fi.source);
|
||||
|
||||
SubFileItem *sfi = new SubFileItem(*it, fi.fname,
|
||||
fi.size, SFI_STATE_UPLOAD, "");
|
||||
|
||||
// XXX HACK _ TOFIX >>>> fi.source);
|
||||
|
||||
mUploads[*it] = sfi;
|
||||
mUploadsLayout->addWidget(sfi);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
69
retroshare-gui/src/gui/unfinished/TransferFeed.h
Normal file
69
retroshare-gui/src/gui/unfinished/TransferFeed.h
Normal file
@ -0,0 +1,69 @@
|
||||
/****************************************************************
|
||||
* RetroShare is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2008 Robert Fernie
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
|
||||
#ifndef _TRANSFER_FEED_DIALOG_H
|
||||
#define _TRANSFER_FEED_DIALOG_H
|
||||
|
||||
#include "gui/mainpage.h"
|
||||
#include "ui_TransferFeed.h"
|
||||
|
||||
#include "gui/feeds/FeedHolder.h"
|
||||
|
||||
class SubFileItem;
|
||||
|
||||
class TransferFeed : public MainPage, public FeedHolder, private Ui::TransferFeed
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** Default Constructor */
|
||||
TransferFeed(QWidget *parent = 0);
|
||||
/** Default Destructor */
|
||||
|
||||
/* FeedHolder Functions (for FeedItem functionality) */
|
||||
virtual void deleteFeedItem(QWidget *item, uint32_t type);
|
||||
virtual void openChat(std::string peerId);
|
||||
virtual void openMsg(uint32_t type, std::string grpId, std::string inReplyTo);
|
||||
|
||||
private slots:
|
||||
|
||||
void updateMode();
|
||||
void updateAll();
|
||||
void updateDownloads();
|
||||
void updateUploads();
|
||||
|
||||
private:
|
||||
|
||||
QLayout *mDownloadsLayout;
|
||||
QLayout *mUploadsLayout;
|
||||
|
||||
/* lists of feedItems */
|
||||
uint32_t mMode;
|
||||
std::map<std::string, SubFileItem *> mDownloads;
|
||||
std::map<std::string, SubFileItem *> mUploads;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
139
retroshare-gui/src/gui/unfinished/TransferFeed.ui
Normal file
139
retroshare-gui/src/gui/unfinished/TransferFeed.ui
Normal file
@ -0,0 +1,139 @@
|
||||
<ui version="4.0" >
|
||||
<class>TransferFeed</class>
|
||||
<widget class="QWidget" name="TransferFeed" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>689</width>
|
||||
<height>386</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<item>
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font" >
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Sort:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="modeComboBox" >
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>None</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSplitter" name="splitter" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<widget class="QFrame" name="frameDown" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape" >
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QFrame" name="frameUp" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape" >
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="images.qrc" />
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
Loading…
Reference in New Issue
Block a user