mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-12-11 14:56:09 -05:00
Added api for news feeds to the plugin interface.
Added news feeds to the FeedReader plugin. Recompile needed. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6066 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
f12473f7f7
commit
a60422069c
21 changed files with 1080 additions and 99 deletions
|
|
@ -19,15 +19,16 @@
|
|||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
|
||||
|
||||
#include <rshare.h>
|
||||
#include "NotifyPage.h"
|
||||
|
||||
#include <retroshare/rsnotify.h>
|
||||
#include <retroshare/rsplugin.h>
|
||||
#include "rsharesettings.h"
|
||||
|
||||
#include "gui/MainWindow.h"
|
||||
#include "gui/common/UserNotify.h"
|
||||
#include "gui/common/FeedNotify.h"
|
||||
#include "gui/notifyqt.h"
|
||||
#include "gui/NewsFeed.h"
|
||||
|
||||
|
|
@ -41,11 +42,34 @@ NotifyPage::NotifyPage(QWidget * parent, Qt::WFlags flags)
|
|||
connect(ui.notifyButton, SIGNAL(clicked()), this, SLOT(testNotify()));
|
||||
connect(ui.toasterButton, SIGNAL(clicked()), this, SLOT(testToaster()));
|
||||
|
||||
/* add user notify */
|
||||
QFont font = ui.notify_Peers->font(); // use font from existing checkbox
|
||||
|
||||
/* add feed notify */
|
||||
int row = 0;
|
||||
int pluginCount = rsPlugins->nbPlugins();
|
||||
for (int i = 0; i < pluginCount; ++i) {
|
||||
RsPlugin *rsPlugin = rsPlugins->plugin(i);
|
||||
if (rsPlugin) {
|
||||
FeedNotify *feedNotify = rsPlugin->qt_feedNotify();
|
||||
if (feedNotify) {
|
||||
QString name;
|
||||
if (!feedNotify->hasSetting(name)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
QCheckBox *enabledCheckBox = new QCheckBox(name, this);
|
||||
enabledCheckBox->setFont(font);
|
||||
ui.feedLayout->addWidget(enabledCheckBox, row++);
|
||||
|
||||
mFeedNotifySettingList.push_back(FeedNotifySetting(feedNotify, enabledCheckBox));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* add user notify */
|
||||
const QList<UserNotify*> &userNotifyList = MainWindow::getInstance()->getUserNotifyList();
|
||||
QList<UserNotify*>::const_iterator it;
|
||||
int row = 0;
|
||||
row = 0;
|
||||
for (it = userNotifyList.begin(); it != userNotifyList.end(); ++it) {
|
||||
UserNotify *userNotify = *it;
|
||||
|
||||
|
|
@ -135,6 +159,12 @@ NotifyPage::save(QString &/*errmsg*/)
|
|||
if (ui.message_ConnectAttempt->isChecked())
|
||||
messageflags |= RS_MESSAGE_CONNECT_ATTEMPT;
|
||||
|
||||
/* save feed notify */
|
||||
QList<FeedNotifySetting>::iterator feedNotifyIt;
|
||||
for (feedNotifyIt = mFeedNotifySettingList.begin(); feedNotifyIt != mFeedNotifySettingList.end(); ++feedNotifyIt) {
|
||||
feedNotifyIt->mFeedNotify->setNotifyEnabled(feedNotifyIt->mEnabledCheckBox->isChecked());
|
||||
}
|
||||
|
||||
/* save user notify */
|
||||
QList<UserNotifySetting>::iterator notifyIt;
|
||||
for (notifyIt = mUserNotifySettingList.begin(); notifyIt != mUserNotifySettingList.end(); ++notifyIt) {
|
||||
|
|
@ -218,12 +248,18 @@ void NotifyPage::load()
|
|||
ui.spinBoxToasterXMargin->setValue(margin.x());
|
||||
ui.spinBoxToasterYMargin->setValue(margin.y());
|
||||
|
||||
/* load feed notify */
|
||||
QList<FeedNotifySetting>::iterator feedNotifyIt;
|
||||
for (feedNotifyIt = mFeedNotifySettingList.begin(); feedNotifyIt != mFeedNotifySettingList.end(); ++feedNotifyIt) {
|
||||
feedNotifyIt->mEnabledCheckBox->setChecked(feedNotifyIt->mFeedNotify->notifyEnabled());
|
||||
}
|
||||
|
||||
/* load user notify */
|
||||
QList<UserNotifySetting>::iterator notifyIt;
|
||||
for (notifyIt = mUserNotifySettingList.begin(); notifyIt != mUserNotifySettingList.end(); ++notifyIt) {
|
||||
notifyIt->mEnabledCheckBox->setChecked(notifyIt->mUserNotify->notifyEnabled());
|
||||
notifyIt->mCombinedCheckBox->setChecked(notifyIt->mUserNotify->notifyCombined());
|
||||
notifyIt->mBlinkCheckBox->setChecked(notifyIt->mUserNotify->notifyBlink());
|
||||
QList<UserNotifySetting>::iterator userNotifyIt;
|
||||
for (userNotifyIt = mUserNotifySettingList.begin(); userNotifyIt != mUserNotifySettingList.end(); ++userNotifyIt) {
|
||||
userNotifyIt->mEnabledCheckBox->setChecked(userNotifyIt->mUserNotify->notifyEnabled());
|
||||
userNotifyIt->mCombinedCheckBox->setChecked(userNotifyIt->mUserNotify->notifyCombined());
|
||||
userNotifyIt->mBlinkCheckBox->setChecked(userNotifyIt->mUserNotify->notifyBlink());
|
||||
}
|
||||
|
||||
notifyToggled();
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
#include "ui_NotifyPage.h"
|
||||
|
||||
class UserNotify;
|
||||
class FeedNotify;
|
||||
|
||||
class UserNotifySetting
|
||||
{
|
||||
|
|
@ -40,6 +41,17 @@ public:
|
|||
: mUserNotify(userNotify), mEnabledCheckBox(enabledCheckBox), mCombinedCheckBox(combinedCheckBox), mBlinkCheckBox(blinkCheckBox) {}
|
||||
};
|
||||
|
||||
class FeedNotifySetting
|
||||
{
|
||||
public:
|
||||
FeedNotify *mFeedNotify;
|
||||
QCheckBox *mEnabledCheckBox;
|
||||
|
||||
public:
|
||||
FeedNotifySetting(FeedNotify *feedNotify, QCheckBox *enabledCheckBox)
|
||||
: mFeedNotify(feedNotify), mEnabledCheckBox(enabledCheckBox) {}
|
||||
};
|
||||
|
||||
class NotifyPage : public ConfigPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
@ -67,6 +79,7 @@ private:
|
|||
uint getNewsFlags();
|
||||
uint getNotifyFlags();
|
||||
|
||||
QList<FeedNotifySetting> mFeedNotifySettingList;
|
||||
QList<UserNotifySetting> mUserNotifySettingList;
|
||||
|
||||
/** Qt Designer generated object */
|
||||
|
|
|
|||
|
|
@ -22,7 +22,16 @@
|
|||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
|
|
@ -76,6 +85,9 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="feedLayout"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue