diff --git a/retroshare-gui/src/RetroShare.pro b/retroshare-gui/src/RetroShare.pro index 2c6c097a2..4ff8063db 100644 --- a/retroshare-gui/src/RetroShare.pro +++ b/retroshare-gui/src/RetroShare.pro @@ -334,6 +334,7 @@ HEADERS += rshare.h \ gui/feeds/SubFileItem.h \ gui/feeds/SubDestItem.h \ gui/feeds/AttachFileItem.h \ + gui/feeds/FeedSettings.h \ gui/connect/ConnectFriendWizard.h \ gui/groups/CreateGroup.h @@ -409,6 +410,7 @@ FORMS += gui/StartDialog.ui \ gui/feeds/SubFileItem.ui \ gui/feeds/SubDestItem.ui \ gui/feeds/AttachFileItem.ui \ + gui/feeds/FeedSettings.ui \ gui/im_history/ImHistoryBrowser.ui \ gui/groups/CreateGroup.ui \ gui/common/GroupTreeWidget.ui @@ -554,6 +556,7 @@ SOURCES += main.cpp \ gui/feeds/SubFileItem.cpp \ gui/feeds/SubDestItem.cpp \ gui/feeds/AttachFileItem.cpp \ + gui/feeds/FeedSettings.cpp \ gui/connect/ConnectFriendWizard.cpp \ gui/groups/CreateGroup.cpp diff --git a/retroshare-gui/src/gui/NewsFeed.cpp b/retroshare-gui/src/gui/NewsFeed.cpp index d9ad086d8..3c9ca4483 100644 --- a/retroshare-gui/src/gui/NewsFeed.cpp +++ b/retroshare-gui/src/gui/NewsFeed.cpp @@ -30,6 +30,7 @@ #include "feeds/ChanMsgItem.h" #include "feeds/ForumNewItem.h" #include "feeds/ForumMsgItem.h" +#include "feeds/FeedSettings.h" #ifdef BLOGS #include "feeds/BlogNewItem.h" @@ -65,6 +66,8 @@ NewsFeed::NewsFeed(QWidget *parent) setupUi(this); connect(removeAllButton, SIGNAL(clicked()), this, SLOT(removeAll())); + connect(feedOptionsButton, SIGNAL(clicked()), this, SLOT(feedoptions())); + QTimer *timer = new QTimer(this); timer->connect(timer, SIGNAL(timeout()), this, SLOT(updateFeed())); @@ -487,3 +490,9 @@ void NewsFeed::sendNewsFeedChanged() emit newsFeedChanged(count); } + +void NewsFeed::feedoptions() +{ + FeedSettings fs (this); + fs.exec (); +} diff --git a/retroshare-gui/src/gui/NewsFeed.h b/retroshare-gui/src/gui/NewsFeed.h index 9a60c9d50..83cbac0c0 100644 --- a/retroshare-gui/src/gui/NewsFeed.h +++ b/retroshare-gui/src/gui/NewsFeed.h @@ -50,6 +50,7 @@ signals: private slots: // void toggleChanMsgItems(bool on); + void feedoptions(); void updateFeed(); void removeAll(); diff --git a/retroshare-gui/src/gui/NewsFeed.ui b/retroshare-gui/src/gui/NewsFeed.ui index 80914a693..f9e11e766 100644 --- a/retroshare-gui/src/gui/NewsFeed.ui +++ b/retroshare-gui/src/gui/NewsFeed.ui @@ -70,7 +70,7 @@ p, li { white-space: pre-wrap; } - + QFrame::StyledPanel @@ -129,7 +129,7 @@ p, li { white-space: pre-wrap; } - + Remove All @@ -149,6 +149,13 @@ p, li { white-space: pre-wrap; } + + + + Edit Options + + + diff --git a/retroshare-gui/src/gui/feeds/FeedSettings.cpp b/retroshare-gui/src/gui/feeds/FeedSettings.cpp new file mode 100644 index 000000000..343eded71 --- /dev/null +++ b/retroshare-gui/src/gui/feeds/FeedSettings.cpp @@ -0,0 +1,124 @@ +/**************************************************************** + * RetroShare is distributed under the following license: + * + * Copyright (C) 2011 RetroShare Team + * + * 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 "FeedSettings.h" + +#include + +#include +#include "gui/settings/rsharesettings.h" + +/** Default constructor */ +FeedSettings::FeedSettings(QWidget *parent, Qt::WFlags flags) + : QDialog(parent, flags) +{ + /* Invoke Qt Designer generated QObject setup routine */ + ui.setupUi(this); + + connect(ui.applyButton, SIGNAL(clicked()), this, SLOT(applyDialog())); + connect(ui.cancelButton, SIGNAL(clicked()), this, SLOT(closeinfodlg())); + + ui.applyButton->setToolTip(tr("Apply and Close")); + + load(); + + /* Hide platform specific features */ +#ifdef Q_WS_WIN + +#endif + +} + +void FeedSettings::show() +{ + if(!this->isVisible()) { + QDialog::show(); + + } +} + +void FeedSettings::closeEvent (QCloseEvent * event) +{ + QWidget::closeEvent(event); +} + +/** Saves the changes on this page */ +bool FeedSettings::save() +{ + /* extract from rsNotify the flags */ + + uint newsflags = 0; + + if (ui.notify_Peers->isChecked()) + newsflags |= RS_FEED_TYPE_PEER; + if (ui.notify_Channels->isChecked()) + newsflags |= RS_FEED_TYPE_CHAN; + if (ui.notify_Forums->isChecked()) + newsflags |= RS_FEED_TYPE_FORUM; + if (ui.notify_Blogs->isChecked()) + newsflags |= RS_FEED_TYPE_BLOG; + if (ui.notify_Chat->isChecked()) + newsflags |= RS_FEED_TYPE_CHAT; + if (ui.notify_Messages->isChecked()) + newsflags |= RS_FEED_TYPE_MSG; + if (ui.notify_Chat->isChecked()) + newsflags |= RS_FEED_TYPE_CHAT; + + Settings->setNewsFeedFlags(newsflags); + + Settings->setAddFeedsAtEnd(ui.addFeedsAtEnd->isChecked()); + + load(); + return true; +} + +/** Loads the news feed settings */ +void FeedSettings::load() +{ + /* extract from rsNotify the flags */ + uint newsflags = Settings->getNewsFeedFlags(); + + ui.notify_Peers->setChecked(newsflags & RS_FEED_TYPE_PEER); + ui.notify_Channels->setChecked(newsflags & RS_FEED_TYPE_CHAN); + ui.notify_Forums->setChecked(newsflags & RS_FEED_TYPE_FORUM); + ui.notify_Blogs->setChecked(newsflags & RS_FEED_TYPE_BLOG); + ui.notify_Chat->setChecked(newsflags & RS_FEED_TYPE_CHAT); + ui.notify_Messages->setChecked(newsflags & RS_FEED_TYPE_MSG); + ui.notify_Chat->setChecked(newsflags & RS_FEED_TYPE_CHAT); + + ui.addFeedsAtEnd->setChecked(Settings->getAddFeedsAtEnd()); + +} + +void FeedSettings::closeinfodlg() +{ + close(); +} + +void FeedSettings::applyDialog() +{ + + /* reload now */ + save(); + + /* close the Dialog after the Changes applied */ + closeinfodlg(); + +} diff --git a/retroshare-gui/src/gui/feeds/FeedSettings.h b/retroshare-gui/src/gui/feeds/FeedSettings.h new file mode 100644 index 000000000..d7228fd96 --- /dev/null +++ b/retroshare-gui/src/gui/feeds/FeedSettings.h @@ -0,0 +1,68 @@ +/**************************************************************** + * RetroShare is distributed under the following license: + * + * Copyright (C) 2011 RetroShare Team + * + * 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 _FEEDSETTINGS_H +#define _FEEDSETTINGS_H + +#include + +#include "ui_FeedSettings.h" + +class FeedSettings : public QDialog +{ + Q_OBJECT + + public: + + /** Default constructor */ + FeedSettings(QWidget *parent = 0, Qt::WFlags flags = 0); + /** Default destructor */ + + /** Saves the changes */ + bool save(); + /** Loads the news feed settings */ + void load(); + +signals: + void configChanged() ; + +public slots: + /** Overloaded QWidget.show */ + void show(); + +protected: + void closeEvent (QCloseEvent * event); + +private slots: + + void closeinfodlg(); + void applyDialog(); + +private: + + + /** Qt Designer generated object */ + Ui::FeedSettings ui; + +}; + +#endif + diff --git a/retroshare-gui/src/gui/feeds/FeedSettings.ui b/retroshare-gui/src/gui/feeds/FeedSettings.ui new file mode 100644 index 000000000..425e5361e --- /dev/null +++ b/retroshare-gui/src/gui/feeds/FeedSettings.ui @@ -0,0 +1,148 @@ + + + FeedSettings + + + + 0 + 0 + 409 + 329 + + + + Edit your News Feed Settings + + + + :/images/rstray3.png:/images/rstray3.png + + + + + + News Feed + + + + 0 + + + 6 + + + + + Peers + + + + + + + Channels + + + + + + + Forums + + + + + + + Blogs + + + + + + + Messages + + + + + + + Chat + + + + + + + Qt::Horizontal + + + + + + + Add feeds at end + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + Qt::Horizontal + + + + 311 + 20 + + + + + + + + Cancel + + + + + + + OK + + + false + + + true + + + + + + + + + + + +