mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-04-20 07:15:52 -04:00
added newsfeed settings
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4102 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
cfcb6ac5c4
commit
be7359e804
@ -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
|
||||
|
||||
|
@ -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 ();
|
||||
}
|
||||
|
@ -50,6 +50,7 @@ signals:
|
||||
|
||||
private slots:
|
||||
// void toggleChanMsgItems(bool on);
|
||||
void feedoptions();
|
||||
|
||||
void updateFeed();
|
||||
void removeAll();
|
||||
|
@ -70,7 +70,7 @@ p, li { white-space: pre-wrap; }
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="4">
|
||||
<item row="1" column="0" colspan="5">
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
@ -129,7 +129,7 @@ p, li { white-space: pre-wrap; }
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<item row="0" column="3">
|
||||
<widget class="QPushButton" name="removeAllButton">
|
||||
<property name="text">
|
||||
<string>Remove All</string>
|
||||
@ -149,6 +149,13 @@ p, li { white-space: pre-wrap; }
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="feedOptionsButton">
|
||||
<property name="text">
|
||||
<string>Edit Options</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
|
124
retroshare-gui/src/gui/feeds/FeedSettings.cpp
Normal file
124
retroshare-gui/src/gui/feeds/FeedSettings.cpp
Normal file
@ -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 <rshare.h>
|
||||
|
||||
#include <retroshare/rsnotify.h>
|
||||
#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();
|
||||
|
||||
}
|
68
retroshare-gui/src/gui/feeds/FeedSettings.h
Normal file
68
retroshare-gui/src/gui/feeds/FeedSettings.h
Normal file
@ -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 <QDialog>
|
||||
|
||||
#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
|
||||
|
148
retroshare-gui/src/gui/feeds/FeedSettings.ui
Normal file
148
retroshare-gui/src/gui/feeds/FeedSettings.ui
Normal file
@ -0,0 +1,148 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>FeedSettings</class>
|
||||
<widget class="QDialog" name="FeedSettings">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>409</width>
|
||||
<height>329</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Edit your News Feed Settings</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="notify_ForumNewMsg">
|
||||
<property name="title">
|
||||
<string>News Feed</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="_3">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="notify_Peers">
|
||||
<property name="text">
|
||||
<string>Peers</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="notify_Channels">
|
||||
<property name="text">
|
||||
<string>Channels</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="notify_Forums">
|
||||
<property name="text">
|
||||
<string>Forums</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="notify_Blogs">
|
||||
<property name="text">
|
||||
<string>Blogs</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="notify_Messages">
|
||||
<property name="text">
|
||||
<string>Messages</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="notify_Chat">
|
||||
<property name="text">
|
||||
<string>Chat</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="addFeedsAtEnd">
|
||||
<property name="text">
|
||||
<string>Add feeds at end</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<layout class="QGridLayout" name="_2">
|
||||
<item row="0" column="0">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>311</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="cancelButton">
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="applyButton">
|
||||
<property name="text">
|
||||
<string>OK</string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="default">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../images.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
Loading…
x
Reference in New Issue
Block a user