diff --git a/retroshare-gui/src/gui/ApplicationWindow.cpp b/retroshare-gui/src/gui/ApplicationWindow.cpp deleted file mode 100644 index 703ffd38d..000000000 --- a/retroshare-gui/src/gui/ApplicationWindow.cpp +++ /dev/null @@ -1,288 +0,0 @@ -/**************************************************************** - * 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 -#include -#include -#include -#include -#include -#include - -#include -#include "ApplicationWindow.h" - -//#include "Settings/gsettingswin.h" - -#include "rsiface/rsiface.h" - -//#include "gui/connect/InviteDialog.h" -//#include "gui/connect/AddFriendDialog.h" - -#include "LinksDialog.h" -#include "GamesDialog.h" -#include "NetworkView.h" -#include "PhotoDialog.h" -#include "ForumsDialog.h" -#include "BlogDialog.h" -#include "CalDialog.h" -#include "PeersFeed.h" -#include "TransferFeed.h" -#include "MsgFeed.h" -#include "ChannelFeed.h" -#include "LibraryDialog.h" -#include "StatisticDialog.h" - - -/* for smplayer */ -//#include "smplayer.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)); - - LibraryDialog *libraryDialog = NULL; - ui.stackPages->add(libraryDialog = new LibraryDialog(ui.stackPages), - createPageAction(QIcon(IMAGE_LIBRARY), tr("Library"), 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 -} - diff --git a/retroshare-gui/src/gui/ApplicationWindow.h b/retroshare-gui/src/gui/ApplicationWindow.h deleted file mode 100644 index e9c46ed6c..000000000 --- a/retroshare-gui/src/gui/ApplicationWindow.h +++ /dev/null @@ -1,115 +0,0 @@ -/**************************************************************** - * 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 -#include -#include - -#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 - diff --git a/retroshare-gui/src/gui/ApplicationWindow.ui b/retroshare-gui/src/gui/ApplicationWindow.ui deleted file mode 100644 index fb8be2949..000000000 --- a/retroshare-gui/src/gui/ApplicationWindow.ui +++ /dev/null @@ -1,1076 +0,0 @@ - - ApplicationWindow - - - - 0 - 0 - 679 - 542 - - - - - - - - - 0 - 0 - 0 - - - - - - - 208 - 208 - 208 - - - - - - - 255 - 255 - 255 - - - - - - - 247 - 247 - 247 - - - - - - - 120 - 120 - 120 - - - - - - - 139 - 139 - 139 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 240 - 240 - 240 - - - - - - - 0 - 0 - 0 - - - - - - - 10 - 36 - 106 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 255 - 0 - 255 - - - - - - - 247 - 247 - 247 - - - - - - - - - 0 - 0 - 0 - - - - - - - 208 - 208 - 208 - - - - - - - 255 - 255 - 255 - - - - - - - 247 - 247 - 247 - - - - - - - 120 - 120 - 120 - - - - - - - 139 - 139 - 139 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 240 - 240 - 240 - - - - - - - 0 - 0 - 0 - - - - - - - 212 - 208 - 200 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 255 - - - - - - - 255 - 0 - 255 - - - - - - - 247 - 247 - 247 - - - - - - - - - 120 - 120 - 120 - - - - - - - 208 - 208 - 208 - - - - - - - 255 - 255 - 255 - - - - - - - 247 - 247 - 247 - - - - - - - 120 - 120 - 120 - - - - - - - 139 - 139 - 139 - - - - - - - 120 - 120 - 120 - - - - - - - 255 - 255 - 255 - - - - - - - 120 - 120 - 120 - - - - - - - 240 - 240 - 240 - - - - - - - 240 - 240 - 240 - - - - - - - 0 - 0 - 0 - - - - - - - 10 - 36 - 106 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 255 - 0 - 255 - - - - - - - 247 - 247 - 247 - - - - - - - - Qt::CustomContextMenu - - - RetroShare - - - - 24 - 24 - - - - Qt::ToolButtonTextUnderIcon - - - - - 0 - 12 - 679 - 509 - - - - - 6 - - - 0 - - - 6 - - - 0 - - - 0 - - - - - - 120 - 0 - - - - - 120 - 0 - - - - - - - - - 0 - 0 - 0 - - - - - - - 208 - 208 - 208 - - - - - - - 255 - 255 - 255 - - - - - - - 247 - 247 - 247 - - - - - - - 120 - 120 - 120 - - - - - - - 160 - 160 - 160 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 240 - 240 - 240 - - - - - - - 0 - 0 - 0 - - - - - - - 10 - 36 - 106 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 255 - 0 - 255 - - - - - - - 247 - 247 - 247 - - - - - - - - - 0 - 0 - 0 - - - - - - - 208 - 208 - 208 - - - - - - - 255 - 255 - 255 - - - - - - - 247 - 247 - 247 - - - - - - - 120 - 120 - 120 - - - - - - - 160 - 160 - 160 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 240 - 240 - 240 - - - - - - - 0 - 0 - 0 - - - - - - - 212 - 208 - 200 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 255 - - - - - - - 255 - 0 - 255 - - - - - - - 247 - 247 - 247 - - - - - - - - - 120 - 120 - 120 - - - - - - - 208 - 208 - 208 - - - - - - - 255 - 255 - 255 - - - - - - - 247 - 247 - 247 - - - - - - - 120 - 120 - 120 - - - - - - - 160 - 160 - 160 - - - - - - - 120 - 120 - 120 - - - - - - - 255 - 255 - 255 - - - - - - - 120 - 120 - 120 - - - - - - - 240 - 240 - 240 - - - - - - - 240 - 240 - 240 - - - - - - - 0 - 0 - 0 - - - - - - - 10 - 36 - 106 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 255 - 0 - 255 - - - - - - - 247 - 247 - 247 - - - - - - - - - 50 - false - - - - Qt::NoContextMenu - - - - - - - - - 0 - 521 - 679 - 21 - - - - - - - 0 - 0 - 679 - 12 - - - - Qt::NoContextMenu - - - true - - - Qt::TopToolBarArea - - - Qt::Horizontal - - - - 24 - 24 - - - - Qt::ToolButtonTextUnderIcon - - - TopToolBarArea - - - false - - - - - - MainPageStack - QWidget -
gui/mainpagestack.h
-
-
- - - - -
diff --git a/retroshare-gui/src/gui/BlogDialog.cpp b/retroshare-gui/src/gui/BlogDialog.cpp deleted file mode 100644 index 41a66ebac..000000000 --- a/retroshare-gui/src/gui/BlogDialog.cpp +++ /dev/null @@ -1,210 +0,0 @@ -/**************************************************************** - * 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 - -#include "BlogDialog.h" - -#include "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 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 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 > 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::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::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; -} - - - diff --git a/retroshare-gui/src/gui/BlogDialog.h b/retroshare-gui/src/gui/BlogDialog.h deleted file mode 100644 index 61a5b2bae..000000000 --- a/retroshare-gui/src/gui/BlogDialog.h +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************** - * 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 "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 mBlogMsgItems; -}; - - - -#endif - diff --git a/retroshare-gui/src/gui/BlogDialog.ui b/retroshare-gui/src/gui/BlogDialog.ui deleted file mode 100644 index df1c1447b..000000000 --- a/retroshare-gui/src/gui/BlogDialog.ui +++ /dev/null @@ -1,219 +0,0 @@ - - BlogDialog - - - - 0 - 0 - 569 - 294 - - - - Form - - - - - - - 0 - - - 0 - - - - - 6 - - - 0 - - - 6 - - - 0 - - - - - - 16 - 16 - - - - - 75 - true - - - - - - - :/images/kblogger.png - - - true - - - - - - - - 75 - true - - - - Blogs - - - - - - - Qt::Horizontal - - - QSizePolicy::Preferred - - - - 20 - 20 - - - - - - - - - Last Month - - - - :/images/view_calendar_month.png:/images/view_calendar_month.png - - - - - Last Week - - - - :/images/view_calendar_week.png:/images/view_calendar_week.png - - - - - Last Day - - - - :/images/view_calendar_day.png:/images/view_calendar_day.png - - - - - - - - Qt::Horizontal - - - QSizePolicy::Preferred - - - - 20 - 20 - - - - - - - - - All Users - - - - :/images/user/identity16.png:/images/user/identity16.png - - - - - Jimmy - - - - - John - - - - - Jacki - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - No Feeds - - - Post Blog - - - - :/images/mail_send.png:/images/mail_send.png - - - - - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - - - - - diff --git a/retroshare-gui/src/gui/CalDialog.cpp b/retroshare-gui/src/gui/CalDialog.cpp deleted file mode 100644 index 38a8d484a..000000000 --- a/retroshare-gui/src/gui/CalDialog.cpp +++ /dev/null @@ -1,136 +0,0 @@ -/**************************************************************** - * 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 -#include -#include - -#include -#include - -#include "common/vmessagebox.h" - -//#include "rshare.h" -#include "CalDialog.h" -//#include "rsiface/rspeers.h" -//#include "rsiface/rsrank.h" - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -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::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::iterator it = calItems.find(item->text()); - CalItem temp = it.value(); - name->setText(temp.name); - location->setText(temp.location); - status->setCurrentIndex(temp.status); -} diff --git a/retroshare-gui/src/gui/CalDialog.h b/retroshare-gui/src/gui/CalDialog.h deleted file mode 100644 index 8a958852a..000000000 --- a/retroshare-gui/src/gui/CalDialog.h +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************** - * 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 -#include -#include -#include - -#include "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 calItems; - CalItem *itemDetails; - -/** Qt Designer generated object */ - Ui::CalDialog ui; - - QLineEdit* name; - QLineEdit* location; - QComboBox* status; - QListWidget* calendarList; -}; - -#endif diff --git a/retroshare-gui/src/gui/CalDialog.ui b/retroshare-gui/src/gui/CalDialog.ui deleted file mode 100644 index 8615caa12..000000000 --- a/retroshare-gui/src/gui/CalDialog.ui +++ /dev/null @@ -1,285 +0,0 @@ - - CalDialog - - - - 0 - 0 - 740 - 540 - - - - Form - - - - 0 - - - 6 - - - 0 - - - 6 - - - 0 - - - - - QTabWidget::Rounded - - - 0 - - - Qt::ElideNone - - - - - 0 - 0 - 734 - 501 - - - - Local Calendars - - - - - - QLayout::SetMaximumSize - - - - - - 75 - true - - - - Shared Calendar List - - - - - - - - 0 - 0 - - - - - 289 - 0 - - - - - - - - - - - 75 - true - - - - Share Details - - - - - - - QLayout::SetMaximumSize - - - - - Name: - - - - - - - - - - Location: - - - - - - - QLayout::SetMaximumSize - - - - - - 0 - 0 - - - - - - - - - 0 - 0 - - - - - 30 - 0 - - - - - 0 - 16777215 - - - - - 0 - 0 - - - - ... - - - - - - - - - Status: - - - - - - - - 100 - 0 - - - - - 0 - 16777215 - - - - - Private - - - - - Public - - - - - - - - Allow List: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - - - <Disabled> - - - - - - - - - - QLayout::SetMaximumSize - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Add - - - - - - - Remove - - - - - - - - - - - 26 - 45 - 760 - 509 - - - - Peer Calendars - - - - - - - - - - - diff --git a/retroshare-gui/src/gui/ExampleDialog.cpp b/retroshare-gui/src/gui/ExampleDialog.cpp deleted file mode 100644 index ea59375c2..000000000 --- a/retroshare-gui/src/gui/ExampleDialog.cpp +++ /dev/null @@ -1,280 +0,0 @@ -/**************************************************************** - * 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 -#include -#include "common/vmessagebox.h" - -#include "rshare.h" -#include "ExampleDialog.h" -#include "rsiface/rsiface.h" - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - - -/* 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::const_iterator it; - const std::map &friends = - rsiface->getFriendMap(); - - /* get a link to the table */ - QTreeWidget *peerWidget = ui.peertreeWidget; - - /* remove old items ??? */ - peerWidget->clear(); - peerWidget->setColumnCount(12); - - - - QList 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); - */ -} - - - diff --git a/retroshare-gui/src/gui/ExampleDialog.h b/retroshare-gui/src/gui/ExampleDialog.h deleted file mode 100644 index 9dbbc4004..000000000 --- a/retroshare-gui/src/gui/ExampleDialog.h +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************** - * 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 - -//#include - -#include "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 - diff --git a/retroshare-gui/src/gui/ExampleDialog.ui b/retroshare-gui/src/gui/ExampleDialog.ui deleted file mode 100644 index 541050e46..000000000 --- a/retroshare-gui/src/gui/ExampleDialog.ui +++ /dev/null @@ -1,643 +0,0 @@ - - ExampleDialog - - - - 0 - 0 - 436 - 261 - - - - - - - - - 0 - 0 - 0 - - - - - - - 208 - 208 - 208 - - - - - - - 255 - 255 - 255 - - - - - - - 247 - 247 - 247 - - - - - - - 104 - 104 - 104 - - - - - - - 139 - 139 - 139 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 240 - 240 - 240 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 128 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 255 - 0 - 255 - - - - - - - 231 - 231 - 231 - - - - - - - - - 0 - 0 - 0 - - - - - - - 208 - 208 - 208 - - - - - - - 255 - 255 - 255 - - - - - - - 247 - 247 - 247 - - - - - - - 104 - 104 - 104 - - - - - - - 139 - 139 - 139 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 240 - 240 - 240 - - - - - - - 0 - 0 - 0 - - - - - - - 192 - 192 - 192 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 255 - - - - - - - 255 - 0 - 255 - - - - - - - 231 - 231 - 231 - - - - - - - - - 104 - 104 - 104 - - - - - - - 208 - 208 - 208 - - - - - - - 255 - 255 - 255 - - - - - - - 247 - 247 - 247 - - - - - - - 104 - 104 - 104 - - - - - - - 139 - 139 - 139 - - - - - - - 104 - 104 - 104 - - - - - - - 255 - 255 - 255 - - - - - - - 104 - 104 - 104 - - - - - - - 240 - 240 - 240 - - - - - - - 240 - 240 - 240 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 128 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 255 - 0 - 255 - - - - - - - 231 - 231 - 231 - - - - - - - - - Arial - 8 - 50 - false - false - false - false - - - - Qt::NoContextMenu - - - - 1 - - - 1 - - - - - 0 - - - 0 - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - 0 - - - 6 - - - - - - - - :/images/peers_16x16.png - - - - - - - <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> - - - - - - - - - Qt::CustomContextMenu - - - false - - - - 16 - 16 - - - - true - - - true - - - - # - - - - - Status - - - - - Person - - - - - Auto Connect - - - - - Trust Level - - - - - Peer Address - - - - - Last Contact - - - - - Organisation - - - - - Location - - - - - Country - - - - - Person Id - - - - - Auth Code - - - - - - - - - - - - - diff --git a/retroshare-gui/src/gui/GamesDialog.cpp b/retroshare-gui/src/gui/GamesDialog.cpp deleted file mode 100644 index 4d30078d4..000000000 --- a/retroshare-gui/src/gui/GamesDialog.cpp +++ /dev/null @@ -1,587 +0,0 @@ -/**************************************************************** - * 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 -#include - -#include "GamesDialog.h" -#include "rsiface/rsiface.h" -#include "rsiface/rsgame.h" -#include "rsiface/rspeers.h" - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -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 gameList; - std::list::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 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 items; - /* layout depends on the game status */ - std::map::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 friends; - std::list::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 playerList; - - std::string gameId = rsGameLauncher->createGame(gameType, gameName); - - if (addAll) - { - std::list friends; - std::list::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(); -} - - diff --git a/retroshare-gui/src/gui/GamesDialog.h b/retroshare-gui/src/gui/GamesDialog.h deleted file mode 100644 index a232f98ed..000000000 --- a/retroshare-gui/src/gui/GamesDialog.h +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************** - * 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 "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 - diff --git a/retroshare-gui/src/gui/GamesDialog.ui b/retroshare-gui/src/gui/GamesDialog.ui deleted file mode 100644 index bafce827b..000000000 --- a/retroshare-gui/src/gui/GamesDialog.ui +++ /dev/null @@ -1,333 +0,0 @@ - - GamesDialog - - - - 0 - 0 - 598 - 526 - - - - Form - - - - 0 - - - 6 - - - 0 - - - 0 - - - - - - - - :/images/package_games1.png - - - - - - - <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> - - - - - - - Qt::Horizontal - - - - 431 - 20 - - - - - - - - - - - - - - - 10 - - - - Game: - - - - - - - - GameType: 0. Want to Add your Game here? - - - - - GameType: 1. Get In Touch with the developers - - - - - GameType: 2. - - - - - - - - - - - - - 10 - - - - Title / Comment - - - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 10 - - - - Create New Game - - - - :/images/kbackgammon.png:/images/kbackgammon.png - - - - - - - - 10 - - - - Invite All Friends - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - Qt::Vertical - - - - Qt::CustomContextMenu - - - - Game Type - - - - - Server - - - - - Status - - - - - Comment - - - - - GameID - - - - - - Qt::CustomContextMenu - - - - Player - - - - - Invite - - - - - Interested - - - - - Accept - - - - - - - - - - - - 10 - - - - Delete - - - - :/images/reset.png:/images/reset.png - - - - - - - - 10 - - - - Invite - - - - :/images/dadd.png:/images/dadd.png - - - - - - - - 10 - - - - Move Player - - - - :/images/up.png:/images/up.png - - - - - - - - 10 - - - - Move Player - - - - :/images/down_24x24.png:/images/down_24x24.png - - - - - - - - 10 - - - - Play Game - - - - :/images/startall.png:/images/startall.png - - - - - - - - - - - - - - diff --git a/retroshare-gui/src/gui/LibraryDialog.cpp b/retroshare-gui/src/gui/LibraryDialog.cpp deleted file mode 100644 index a1ef89458..000000000 --- a/retroshare-gui/src/gui/LibraryDialog.cpp +++ /dev/null @@ -1,250 +0,0 @@ -/**************************************************************** - * 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 "library/FindWindow.h" - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* 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<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); - } diff --git a/retroshare-gui/src/gui/LibraryDialog.h b/retroshare-gui/src/gui/LibraryDialog.h deleted file mode 100644 index c1d81b6b8..000000000 --- a/retroshare-gui/src/gui/LibraryDialog.h +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************** - * 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 - -//#include - -#include "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 - diff --git a/retroshare-gui/src/gui/LibraryDialog.ui b/retroshare-gui/src/gui/LibraryDialog.ui deleted file mode 100644 index 9c7529224..000000000 --- a/retroshare-gui/src/gui/LibraryDialog.ui +++ /dev/null @@ -1,793 +0,0 @@ - - LibraryDialog - - - - 0 - 0 - 629 - 463 - - - - - 0 - 0 - - - - - - - - - 0 - 0 - 0 - - - - - - - 208 - 208 - 208 - - - - - - - 255 - 255 - 255 - - - - - - - 247 - 247 - 247 - - - - - - - 104 - 104 - 104 - - - - - - - 139 - 139 - 139 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 240 - 240 - 240 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 128 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 255 - 0 - 255 - - - - - - - 231 - 231 - 231 - - - - - - - - - 0 - 0 - 0 - - - - - - - 208 - 208 - 208 - - - - - - - 255 - 255 - 255 - - - - - - - 247 - 247 - 247 - - - - - - - 104 - 104 - 104 - - - - - - - 139 - 139 - 139 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 240 - 240 - 240 - - - - - - - 0 - 0 - 0 - - - - - - - 192 - 192 - 192 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 255 - - - - - - - 255 - 0 - 255 - - - - - - - 231 - 231 - 231 - - - - - - - - - 104 - 104 - 104 - - - - - - - 208 - 208 - 208 - - - - - - - 255 - 255 - 255 - - - - - - - 247 - 247 - 247 - - - - - - - 104 - 104 - 104 - - - - - - - 139 - 139 - 139 - - - - - - - 104 - 104 - 104 - - - - - - - 255 - 255 - 255 - - - - - - - 104 - 104 - 104 - - - - - - - 240 - 240 - 240 - - - - - - - 240 - 240 - 240 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 128 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 255 - 0 - 255 - - - - - - - 231 - 231 - 231 - - - - - - - - Qt::NoContextMenu - - - - - - Library - - - - - - - 0 - 0 - - - - Qt::Horizontal - - - - QTabWidget::Triangular - - - 0 - - - - - 0 - 0 - 201 - 385 - - - - Folder - - - - - - - - - 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)); - - - - All File Types - - - - :/images/FileTypeAny.png:/images/FileTypeAny.png - - - - - Application - - - - :/images/FileTypeProgram.png:/images/FileTypeProgram.png - - - - - Archive - - - - :/images/FileTypeArchive.png:/images/FileTypeArchive.png - - - - - - - - - - 0 - 0 - 201 - 385 - - - - Organizer - - - - - - - Utopia - 8 - - - - - - - - - 16777215 - 23 - - - - border-color: rgb(0, 0, 0); - - - Share Files.. - - - - :/images/add-share24.png:/images/add-share24.png - - - - 24 - 24 - - - - true - - - - - - - - - - - - 0 - - - - - <!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> - - - :/images/folder_blueshared.png - - - - - - - - 16777215 - 24 - - - - Tile view - - - true - - - - - - - Show Details - - - true - - - - - - - Qt::DefaultContextMenu - - - QListView::Free - - - QListView::IconMode - - - false - - - - - - - - - - - - 16777215 - 24 - - - - - - - Create Album - - - - :/images/directoryadd_24x24_shadow.png:/images/directoryadd_24x24_shadow.png - - - true - - - - - - - - 16777215 - 24 - - - - - - - Delete Album - - - - :/images/directoryremove_24x24_shadow.png:/images/directoryremove_24x24_shadow.png - - - true - - - - - - - - - - - 16777215 - 24 - - - - pushButton_41:hover{ color : white;} - - - Find - - - - :/images/find.png:/images/find.png - - - true - - - - - - - - - - - - - - - - - - - - organizertreeView - doubleClicked(QModelIndex) - organizerListView - setRootIndex(QModelIndex) - - - 139 - 230 - - - 439 - 238 - - - - - diff --git a/retroshare-gui/src/gui/MsgFeed.cpp b/retroshare-gui/src/gui/MsgFeed.cpp deleted file mode 100644 index c88aadbf9..000000000 --- a/retroshare-gui/src/gui/MsgFeed.cpp +++ /dev/null @@ -1,332 +0,0 @@ -/**************************************************************** - * 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 - -#include - -#include "MsgFeed.h" -#include "feeds/MsgItem.h" -#include "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 friends; - std::list::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 msgs; - std::list::iterator mit; - - std::list toAdd, toRemove; - std::list::iterator it; - - std::map newmsgs; - std::map::iterator nit; - std::map::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); - } -} - - diff --git a/retroshare-gui/src/gui/MsgFeed.h b/retroshare-gui/src/gui/MsgFeed.h deleted file mode 100644 index 39b42cd2e..000000000 --- a/retroshare-gui/src/gui/MsgFeed.h +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************** - * 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 "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 mMsgs; - -}; - - - -#endif - - diff --git a/retroshare-gui/src/gui/MsgFeed.ui b/retroshare-gui/src/gui/MsgFeed.ui deleted file mode 100644 index 07b1fa8c4..000000000 --- a/retroshare-gui/src/gui/MsgFeed.ui +++ /dev/null @@ -1,276 +0,0 @@ - - MsgFeed - - - - 0 - 0 - 764 - 435 - - - - Form - - - - 0 - - - 0 - - - 6 - - - 0 - - - 6 - - - - - 6 - - - - - - 0 - 0 - - - - - 75 - true - - - - Msgs In: - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 10 - 20 - - - - - - - - - Inbox - - - - - Outbox - - - - - Drafts - - - - - Sent - - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 20 - 20 - - - - - - - - - 0 - 0 - - - - - 75 - true - - - - From: - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 10 - 20 - - - - - - - - - 100 - 0 - - - - - All - - - - - - - - Qt::Horizontal - - - - 20 - 20 - - - - - - - - - 0 - 0 - - - - - 75 - true - - - - Sort By: - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 10 - 20 - - - - - - - - - Date - - - - - Subject - - - - - Received - - - - - - - - Qt::Horizontal - - - - 81 - 28 - - - - - - - - New Msg - - - - :/images/mail_send.png:/images/mail_send.png - - - - - - - - - - 0 - 0 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - - - - - diff --git a/retroshare-gui/src/gui/PeersFeed.cpp b/retroshare-gui/src/gui/PeersFeed.cpp deleted file mode 100644 index b325dd3a9..000000000 --- a/retroshare-gui/src/gui/PeersFeed.cpp +++ /dev/null @@ -1,468 +0,0 @@ -/**************************************************************** - * 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 - -#include - -#include "PeersFeed.h" -#include "feeds/PeerItem.h" - -#include "rsiface/rspeers.h" - -#include "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 peers, toAdd, toRemove; - std::list::iterator it; - - std::map newpeers; - std::map::iterator nit; - std::map::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 - diff --git a/retroshare-gui/src/gui/PeersFeed.h b/retroshare-gui/src/gui/PeersFeed.h deleted file mode 100644 index 1a44d99c6..000000000 --- a/retroshare-gui/src/gui/PeersFeed.h +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************** - * 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 "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 mPeers; - -}; - - - -#endif - - diff --git a/retroshare-gui/src/gui/PeersFeed.ui b/retroshare-gui/src/gui/PeersFeed.ui deleted file mode 100644 index ecd48054a..000000000 --- a/retroshare-gui/src/gui/PeersFeed.ui +++ /dev/null @@ -1,135 +0,0 @@ - - PeersFeed - - - - 0 - 0 - 689 - 386 - - - - Form - - - - 0 - - - 0 - - - 6 - - - 0 - - - 6 - - - - - - - - 0 - 0 - - - - - 75 - true - - - - Show: - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 40 - 20 - - - - - - - - - 100 - 0 - - - - - Friends - - - - - Online Friends - - - - - Friends of Friends. - - - - - All Peers - - - - - - - - Qt::Horizontal - - - - 50 - 20 - - - - - - - - - - - 0 - 0 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - - - - - diff --git a/retroshare-gui/src/gui/PhotoDialog.cpp b/retroshare-gui/src/gui/PhotoDialog.cpp deleted file mode 100644 index eccadbbdc..000000000 --- a/retroshare-gui/src/gui/PhotoDialog.cpp +++ /dev/null @@ -1,570 +0,0 @@ -/**************************************************************** - * 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 -#include -#include "common/vmessagebox.h" - -#include "PhotoDialog.h" -#include "PhotoShow.h" -#include "rsiface/rspeers.h" -#include "rsiface/rsphoto.h" - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -/* 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 sizeList = ui.photoSplitter->sizes(); - QList::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 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 ids; - std::list::iterator it; - rsPeers->getFriendList(ids); - - for(it = ids.begin(); it != ids.end(); it++) - { - addShows(*it); - } -} - -void PhotoDialog::addShows(std::string id) -{ - std::list allPhotos; - std::list showIds; - std::list::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::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 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::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 photoIds; - std::list::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; -} - - - - - diff --git a/retroshare-gui/src/gui/PhotoDialog.h b/retroshare-gui/src/gui/PhotoDialog.h deleted file mode 100644 index 75dbf2851..000000000 --- a/retroshare-gui/src/gui/PhotoDialog.h +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************** - * 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 - -#include "mainpage.h" -#include "ui_PhotoDialog.h" - -#include - - -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 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 - diff --git a/retroshare-gui/src/gui/PhotoDialog.ui b/retroshare-gui/src/gui/PhotoDialog.ui deleted file mode 100644 index 3db1f7efc..000000000 --- a/retroshare-gui/src/gui/PhotoDialog.ui +++ /dev/null @@ -1,267 +0,0 @@ - - PhotoDialog - - - - 0 - 0 - 561 - 489 - - - - Form - - - - 0 - - - 6 - - - 0 - - - 0 - - - - - - - - :/images/image16.png - - - true - - - - - - - <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> - - - - - - - Qt::Horizontal - - - - 391 - 20 - - - - - - - - Qt::Vertical - - - - - - - Qt::Horizontal - - - - Qt::CustomContextMenu - - - - Peer - - - - - Slideshow - - - - - Photo - - - - - - Qt::CustomContextMenu - - - - Thumb Image - - - - - Image Name - - - - - Comment - - - - - Date - - - - - Location - - - - - Size - - - - - PeerId - - - - - PhotoId - - - - - - - - - - - - - - - :/images/edit_remove24.png:/images/edit_remove24.png - - - - - - - Add Photo(s) - - - Add Photo(s) - - - - :/images/add_image24.png:/images/add_image24.png - - - - - - - Add Photo SlideShow - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Update Details - - - - :/images/quick_restart24.png:/images/quick_restart24.png - - - - - - - - - - - - - Photo - - - - - - - - - - Date - - - - - - - - - - Location - - - - - - - - - - Description - - - - - - - - - - Comment - - - - - - - - - - - - - - - - - diff --git a/retroshare-gui/src/gui/PhotoShow.cpp b/retroshare-gui/src/gui/PhotoShow.cpp deleted file mode 100644 index 3f9ff7dc2..000000000 --- a/retroshare-gui/src/gui/PhotoShow.cpp +++ /dev/null @@ -1,162 +0,0 @@ -/**************************************************************** - * 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 -#include -#include "common/vmessagebox.h" - -#include "PhotoShow.h" -#include "rsiface/rspeers.h" -#include "rsiface/rsphoto.h" - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -/** 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; -} - - - diff --git a/retroshare-gui/src/gui/PhotoShow.h b/retroshare-gui/src/gui/PhotoShow.h deleted file mode 100644 index 708b01f4c..000000000 --- a/retroshare-gui/src/gui/PhotoShow.h +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************** - * 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 - -#include "mainpage.h" -#include "ui_PhotoShow.h" - -#include - - -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 - diff --git a/retroshare-gui/src/gui/PhotoShow.ui b/retroshare-gui/src/gui/PhotoShow.ui deleted file mode 100644 index d0d49507d..000000000 --- a/retroshare-gui/src/gui/PhotoShow.ui +++ /dev/null @@ -1,246 +0,0 @@ - - PhotoShow - - - - 0 - 0 - 591 - 421 - - - - Form - - - - - - - - - - - - Date: - - - - - - - Location: - - - - - - - Comment: - - - - - - - - - - - - - - - - - - - - - - - - - - Display Size: - - - - - - - - 320 x 320 - - - - - 640 x 640 - - - - - Full Size - - - - - - - - Play Rate: - - - - - - - - 1 Sec - - - - - 2 Sec - - - - - 5 Sec - - - - - 10 Sec - - - - - 20 Sec - - - - - 1 Min - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Edit Photo Details - - - - - - - Save Photo - - - - - - - - - No Photo Selected - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Start - - - - - - - Back - - - - :/images/back.png:/images/back.png - - - - - - - Play - - - - - - - Pause - - - - - - - Forward - - - - :/images/forward.png:/images/forward.png - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - - - diff --git a/retroshare-gui/src/gui/StatisticDialog.cpp b/retroshare-gui/src/gui/StatisticDialog.cpp deleted file mode 100644 index e796aec7f..000000000 --- a/retroshare-gui/src/gui/StatisticDialog.cpp +++ /dev/null @@ -1,285 +0,0 @@ -/**************************************************************** - * 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 -#include "rsiface/rsiface.h" - -#include -#include - -/* 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 -} - - - diff --git a/retroshare-gui/src/gui/StatisticDialog.h b/retroshare-gui/src/gui/StatisticDialog.h deleted file mode 100644 index 5219eb535..000000000 --- a/retroshare-gui/src/gui/StatisticDialog.h +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************** - * 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 -#include -#include -#include - - -#include - -#include "mainpage.h" -#include "ui_StatisticDialog.h" -#include "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 - diff --git a/retroshare-gui/src/gui/StatisticDialog.ui b/retroshare-gui/src/gui/StatisticDialog.ui deleted file mode 100644 index 26f11ca42..000000000 --- a/retroshare-gui/src/gui/StatisticDialog.ui +++ /dev/null @@ -1,1292 +0,0 @@ - - StatisticDialog - - - - 0 - 0 - 701 - 449 - - - - - - - - - 0 - 0 - 0 - - - - - - - 208 - 208 - 208 - - - - - - - 255 - 255 - 255 - - - - - - - 247 - 247 - 247 - - - - - - - 104 - 104 - 104 - - - - - - - 139 - 139 - 139 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 240 - 240 - 240 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 128 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 255 - 0 - 255 - - - - - - - 231 - 231 - 231 - - - - - - - - - 0 - 0 - 0 - - - - - - - 208 - 208 - 208 - - - - - - - 255 - 255 - 255 - - - - - - - 247 - 247 - 247 - - - - - - - 104 - 104 - 104 - - - - - - - 139 - 139 - 139 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 240 - 240 - 240 - - - - - - - 0 - 0 - 0 - - - - - - - 192 - 192 - 192 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 255 - - - - - - - 255 - 0 - 255 - - - - - - - 231 - 231 - 231 - - - - - - - - - 104 - 104 - 104 - - - - - - - 208 - 208 - 208 - - - - - - - 255 - 255 - 255 - - - - - - - 247 - 247 - 247 - - - - - - - 104 - 104 - 104 - - - - - - - 139 - 139 - 139 - - - - - - - 104 - 104 - 104 - - - - - - - 255 - 255 - 255 - - - - - - - 104 - 104 - 104 - - - - - - - 240 - 240 - 240 - - - - - - - 240 - 240 - 240 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 128 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 255 - 0 - 255 - - - - - - - 231 - 231 - 231 - - - - - - - - - Arial - 8 - 50 - false - false - false - false - - - - Qt::NoContextMenu - - - - 6 - - - 9 - - - - - Qt::Horizontal - - - - - 0 - 0 - - - - - 0 - 0 - - - - - Statistics - - - - - Now - - - - - Transfer - - - - :/images/transferupdown.png:/images/transferupdown.png - - - - - - - Session UL:DL Ratio: - - - - - - - - Cumulative UL:DL Ratio - - - - - - - - - Download - - - - :/images/download.png:/images/download.png - - - - - - - Session: - - - - :/images/StatisticsDetail.png:/images/StatisticsDetail.png - - - - - - - Downloaded: - - - - - - - - Count of Downloads: - - - - - - - - - Overall - - - - :/images/StatsCumulative.png:/images/StatsCumulative.png - - - - - - - Downloaded: - - - - - - - - Count of Downloads: - - - - - - - - - - Upload - - - - :/images/up.png:/images/up.png - - - - - - - Session - - - - :/images/StatisticsDetail.png:/images/StatisticsDetail.png - - - - - - - Uploaded: - - - - - - - - Count of Uploads: - - - - - - - - - Overall - - - - :/images/StatsCumulative.png:/images/StatsCumulative.png - - - - - - - Uploaded - - - - - - - - Count of Uploads: - - - - - - - - - - Connections: - - - - :/images/connect_friend.png:/images/connect_friend.png - - - - - - - Session - - - - :/images/StatisticsDetail.png:/images/StatisticsDetail.png - - - - - - - Connections: - - - - - - - - Peers: - - - - - - - - - Overall - - - - :/images/StatsCumulative.png:/images/StatsCumulative.png - - - - - - - Connections: - - - - - - - - Peers: - - - - - - - - - - Time Statistics - - - - :/images/kalarm.png:/images/kalarm.png - - - - - - - Session - - - - :/images/StatisticsDetail.png:/images/StatisticsDetail.png - - - - - - - Uptime - - - - - - - - Since: - - - - - - - - - Cumulative - - - - :/images/StatsCumulative.png:/images/StatsCumulative.png - - - - - - - Uptime - - - - - - - - - - Records - - - - :/images/records.png:/images/records.png - - - - - - - Uploadspeed: - - - - - - - - Downloadspeed: - - - - - - - - Connections: - - - - - - - - Peers: - - - - - - - - Uptime: - - - - - - - - - - - 1 - 0 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 6 - - - 9 - - - - - - 120 - 80 - - - - - Arial - 10 - 50 - false - false - false - false - - - - Qt::NoContextMenu - - - - - - - 6 - - - 0 - - - - - Show Settings - - - true - - - - - - - Qt::Horizontal - - - - 21 - 20 - - - - - - - - Reset - - - - - - - - - - 0 - 0 - - - - - 355 - 82 - - - - - 355 - 82 - - - - Qt::NoContextMenu - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 6 - - - 9 - - - - - 6 - - - 3 - - - - - - Arial - 10 - 50 - false - false - false - false - - - - Qt::NoContextMenu - - - - - - Qt::RightToLeft - - - Receive Rate - - - false - - - - - - - - Arial - 10 - 50 - false - false - false - false - - - - Qt::NoContextMenu - - - - - - Qt::RightToLeft - - - Send Rate - - - false - - - - - - - - Arial - 10 - 50 - false - false - false - false - - - - Qt::NoContextMenu - - - Qt::RightToLeft - - - Always On Top - - - - - - - Qt::Vertical - - - - 20 - 21 - - - - - - - - - - Qt::NoContextMenu - - - QFrame::NoFrame - - - QFrame::Plain - - - - 3 - - - 0 - - - - - 0 - - - 0 - - - - - - 25 - 0 - - - - - Arial - 10 - 50 - false - false - false - false - - - - Qt::NoContextMenu - - - Qt::RightToLeft - - - 100 - - - - - - - - Arial - 10 - 50 - false - false - false - false - - - - Qt::NoContextMenu - - - % Opaque - - - - - - - - - Qt::NoContextMenu - - - Changes the transparency of the Bandwidth Graph - - - 30 - - - 100 - - - 100 - - - 100 - - - false - - - Qt::Horizontal - - - false - - - QSlider::TicksBelow - - - 10 - - - - - - - Qt::Vertical - - - - 20 - 20 - - - - - - - - - - - Qt::Horizontal - - - - 21 - 20 - - - - - - - - 1 - - - 0 - - - - - Save - - - - - - - Cancel - - - - - - - - - - - - - - - - - GraphFrame - QWidget -
gui/graphframe.h
- 1 -
-
- - - - -
diff --git a/retroshare-gui/src/gui/TransferFeed.cpp b/retroshare-gui/src/gui/TransferFeed.cpp deleted file mode 100644 index 525b3e414..000000000 --- a/retroshare-gui/src/gui/TransferFeed.cpp +++ /dev/null @@ -1,336 +0,0 @@ -/**************************************************************** - * 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 - -#include - -#include "TransferFeed.h" -#include "feeds/SubFileItem.h" -#include "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 hashes, toAdd, toRemove; - std::list::iterator it; - - std::map newhashes; - std::map::iterator nit; - std::map::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 hashes, toAdd, toRemove; - std::list::iterator it; - - std::map newhashes; - std::map::iterator nit; - std::map::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); - } - } -} - - - diff --git a/retroshare-gui/src/gui/TransferFeed.h b/retroshare-gui/src/gui/TransferFeed.h deleted file mode 100644 index 4c6f6ed66..000000000 --- a/retroshare-gui/src/gui/TransferFeed.h +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************** - * 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 "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 mDownloads; - std::map mUploads; - -}; - - - -#endif - - diff --git a/retroshare-gui/src/gui/TransferFeed.ui b/retroshare-gui/src/gui/TransferFeed.ui deleted file mode 100644 index 76ab24961..000000000 --- a/retroshare-gui/src/gui/TransferFeed.ui +++ /dev/null @@ -1,139 +0,0 @@ - - TransferFeed - - - - 0 - 0 - 689 - 386 - - - - Form - - - - 0 - - - 0 - - - 6 - - - 0 - - - 6 - - - - - - - - 0 - 0 - - - - - 75 - true - - - - Sort: - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 40 - 20 - - - - - - - - - 100 - 0 - - - - - None - - - - - - - - Qt::Horizontal - - - - 50 - 20 - - - - - - - - - - Qt::Vertical - - - - - 0 - 0 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - 0 - 0 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - - - - - - diff --git a/retroshare-gui/src/gui/library/FindWindow.cpp b/retroshare-gui/src/gui/library/FindWindow.cpp deleted file mode 100644 index 6a12e0e6e..000000000 --- a/retroshare-gui/src/gui/library/FindWindow.cpp +++ /dev/null @@ -1,201 +0,0 @@ -/**************************************************************** - * 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 -//#include "ui_findwindow.h" -#include "FindWindow.h" -#include "gui/LibraryDialog.h" - -extern QString fileToFind; - - FindWindow::FindWindow(QWidget *parent) - : QDialog(parent) - { - browseButton = createButton(tr("&Browse..."), SLOT(browse())); - findButton = createButton(tr("&Find"), SLOT(find())); - - fileComboBox = createComboBox(fileToFind); - textComboBox = createComboBox(); - directoryComboBox = createComboBox(); - - fileLabel = new QLabel(tr("Named:")); - textLabel = new QLabel(tr("Containing text:")); - directoryLabel = new QLabel(tr("In directory:")); - filesFoundLabel = new QLabel; - - createFilesTable(); - - QHBoxLayout *buttonsLayout = new QHBoxLayout; - buttonsLayout->addStretch(); - buttonsLayout->addWidget(findButton); - - QGridLayout *mainLayout = new QGridLayout; - mainLayout->addWidget(fileLabel, 0, 0); - mainLayout->addWidget(fileComboBox, 0, 1, 1, 2); - mainLayout->addWidget(textLabel, 1, 0); - mainLayout->addWidget(textComboBox, 1, 1, 1, 2); - mainLayout->addWidget(directoryLabel, 2, 0); - mainLayout->addWidget(directoryComboBox, 2, 1); - mainLayout->addWidget(browseButton, 2, 2); - mainLayout->addWidget(filesTable, 3, 0, 1, 3); - mainLayout->addWidget(filesFoundLabel, 4, 0); - mainLayout->addLayout(buttonsLayout, 5, 0, 1, 3); - setLayout(mainLayout); - - setWindowTitle(tr("Find Files")); - resize(700, 300); - } - - void FindWindow::browse() - { - QString directory = QFileDialog::getExistingDirectory(this, - tr("Find Files"), QDir::currentPath()); - if (!directory.isEmpty()) { - directoryComboBox->addItem(directory); - directoryComboBox->setCurrentIndex(directoryComboBox->currentIndex() + 1); - } - } - - void FindWindow::find() - { - filesTable->setRowCount(0); - - QString fileName = fileComboBox->currentText(); - QString text = textComboBox->currentText(); - QString path = directoryComboBox->currentText(); - - - QDir directory = QDir(path); - QStringList files,folders; - - if (fileName.isEmpty()) - fileName = "*"; - files = directory.entryList(QStringList(fileName), - QDir::Files |QDir::NoSymLinks); - folders=directory.entryList(QStringList(fileName), - QDir::Dirs | QDir::NoSymLinks); - //QMessageBox::information(this,"path",path); - - files = findFiles(directory, files, text); - if(text.isEmpty()){ - showFolders(directory, folders); - showFiles(directory, files); - } - else if(!text.isEmpty()){ - showFiles(directory, files); - } - QLocale d; - if (files.isEmpty()) - { - if(d.toString(folders.size())!=0){ - for(int i=folders.size();i>0;i--) - directory.cd(folders[i]); - //QMessageBox::information(this,"dir",directory.dirName()); - } - } - } -QStringList FindWindow::findFiles( QDir &directory, QStringList &files, - QString &text) - { - QStringList foundFiles; - - for (int i = 0; i < files.size(); ++i) { - QFile file(directory.absoluteFilePath(files[i])); - - if (file.open(QIODevice::ReadOnly)) { - QString line; - QTextStream in(&file); - while (!in.atEnd()) { - line = in.readLine(); - if (line.contains(text)) { - foundFiles << files[i]; - break; - } - } - } - } - return foundFiles; - } - - void FindWindow::showFiles(const QDir &directory, const QStringList &files) - { - for (int i = 0; i < files.size(); ++i) { - QFile file(directory.absoluteFilePath(files[i])); - qint64 size = QFileInfo(file).size(); - - QTableWidgetItem *fileNameItem = new QTableWidgetItem(files[i]); - fileNameItem->setFlags(Qt::ItemIsEnabled); - QTableWidgetItem *sizeItem = new QTableWidgetItem(tr("%1 KB") - .arg(int((size + 1023) / 1024))); - sizeItem->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter); - sizeItem->setFlags(Qt::ItemIsEnabled); - - int row = filesTable->rowCount(); - filesTable->insertRow(row); - filesTable->setItem(row, 0, fileNameItem); - filesTable->setItem(row, 1, sizeItem); - } - filesFoundLabel->setText(tr("%1 file(s) found").arg(files.size())); - } - -void FindWindow::showFolders(const QDir &directory, const QStringList &folders) - { - for (int i = 0; i < folders.size(); ++i) { - QDir folder(directory.absoluteFilePath(folders[i])); - - QTableWidgetItem *fileNameItem = new QTableWidgetItem(folders[i]); - fileNameItem->setFlags(Qt::ItemIsEnabled); - - - int row = filesTable->rowCount(); - filesTable->insertRow(row); - filesTable->setItem(row, 0, fileNameItem); - - } - return ; - } - - QPushButton *FindWindow::createButton(const QString &text, const char *member) - { - QPushButton *button = new QPushButton(text); - connect(button, SIGNAL(clicked()), this, member); - return button; - } - - QComboBox *FindWindow::createComboBox(const QString &text) - { - QComboBox *comboBox = new QComboBox; - comboBox->setEditable(true); - comboBox->addItem(text); - comboBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); - return comboBox; - } - - void FindWindow::createFilesTable() - { - filesTable = new QTableWidget(0, 2); - QStringList labels; - labels << tr("File Name") << tr("Size"); - filesTable->setHorizontalHeaderLabels(labels); - filesTable->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch); - filesTable->verticalHeader()->hide(); - filesTable->setShowGrid(false); - } diff --git a/retroshare-gui/src/gui/library/FindWindow.h b/retroshare-gui/src/gui/library/FindWindow.h deleted file mode 100644 index d691b6c88..000000000 --- a/retroshare-gui/src/gui/library/FindWindow.h +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************** - * 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 FINDWINDOW_H - #define FINDWINDOW_H - - #include - - class QComboBox; - class QDir; - class QLabel; - class QPushButton; - class QTableWidget; - - class FindWindow : public QDialog - { - Q_OBJECT - - public: - FindWindow(QWidget *parent = 0); - - private slots: - void browse(); - void find(); - - private: - QStringList findFiles( QDir &directory, QStringList &files, - QString &text); - void showFiles(const QDir &directory, const QStringList &files); - void showFolders(const QDir &directory, const QStringList &folders); - QPushButton *createButton(const QString &text, const char *member); - QComboBox *createComboBox(const QString &text = QString()); - void createFilesTable(); - - QComboBox *fileComboBox; - QComboBox *textComboBox; - QComboBox *directoryComboBox; - QLabel *fileLabel; - QLabel *textLabel; - QLabel *directoryLabel; - QLabel *filesFoundLabel; - QPushButton *browseButton; - QPushButton *findButton; - QTableWidget *filesTable; - }; -#endif