Added the first version of the FeedReader plugin.
Added a new method to RsPlugInInterfaces to stop the plugins at shutdown of RetroShare. git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5372 b45a01b8-16f6-495d-af2f-9b41ad6348cc
299
plugins/FeedReader/gui/AddFeedDialog.cpp
Normal file
|
@ -0,0 +1,299 @@
|
|||
/****************************************************************
|
||||
* RetroShare GUI is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2012 by Thunder
|
||||
*
|
||||
* 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 <QMessageBox>
|
||||
#include <QDateTime>
|
||||
#include <QPushButton>
|
||||
|
||||
#include "AddFeedDialog.h"
|
||||
#include "ui_AddFeedDialog.h"
|
||||
#include "retroshare/rsforums.h"
|
||||
|
||||
bool sortForumInfo(const ForumInfo& info1, const ForumInfo& info2)
|
||||
{
|
||||
return QString::fromStdWString(info1.forumName).compare(QString::fromStdWString(info2.forumName), Qt::CaseInsensitive);
|
||||
}
|
||||
|
||||
AddFeedDialog::AddFeedDialog(RsFeedReader *feedReader, QWidget *parent)
|
||||
: QDialog(parent), mFeedReader(feedReader), ui(new Ui::AddFeedDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
connect(ui->buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), this, SLOT(createFeed()));
|
||||
connect(ui->buttonBox->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), this, SLOT(reject()));
|
||||
|
||||
connect(ui->useAuthenticationCheckBox, SIGNAL(toggled(bool)), this, SLOT(authenticationToggled()));
|
||||
connect(ui->useStandardStorageTimeCheckBox, SIGNAL(toggled(bool)), this, SLOT(useStandardStorageTimeToggled()));
|
||||
connect(ui->useStandardUpdateInterval, SIGNAL(toggled(bool)), this, SLOT(useStandardUpdateIntervalToggled()));
|
||||
connect(ui->useStandardProxyCheckBox, SIGNAL(toggled(bool)), this, SLOT(useStandardProxyToggled()));
|
||||
connect(ui->typeForumRadio, SIGNAL(toggled(bool)), this, SLOT(typeForumToggled()));
|
||||
|
||||
connect(ui->urlLineEdit, SIGNAL(textChanged(QString)), this, SLOT(validate()));
|
||||
connect(ui->nameLineEdit, SIGNAL(textChanged(QString)), this, SLOT(validate()));
|
||||
connect(ui->useInfoFromFeedCheckBox, SIGNAL(toggled(bool)), this, SLOT(validate()));
|
||||
|
||||
ui->activatedCheckBox->setChecked(true);
|
||||
ui->typeLocalRadio->setChecked(true);
|
||||
ui->forumComboBox->setEnabled(false);
|
||||
ui->useInfoFromFeedCheckBox->setChecked(true);
|
||||
ui->updateForumInfoCheckBox->setEnabled(false);
|
||||
ui->updateForumInfoCheckBox->setChecked(true);
|
||||
ui->forumNameLabel->hide();
|
||||
ui->useAuthenticationCheckBox->setChecked(false);
|
||||
ui->useStandardStorageTimeCheckBox->setChecked(true);
|
||||
ui->useStandardUpdateInterval->setChecked(true);
|
||||
ui->useStandardProxyCheckBox->setChecked(true);
|
||||
|
||||
/* not yet supported */
|
||||
ui->authenticationGroupBox->setEnabled(false);
|
||||
|
||||
/* fill own forums */
|
||||
std::list<ForumInfo> forumList;
|
||||
if (rsForums->getForumList(forumList)) {
|
||||
forumList.sort(sortForumInfo);
|
||||
for (std::list<ForumInfo>::iterator it = forumList.begin(); it != forumList.end(); ++it) {
|
||||
ForumInfo &forumInfo = *it;
|
||||
/* show only own anonymous forums */
|
||||
if ((forumInfo.subscribeFlags & RS_DISTRIB_ADMIN) && (forumInfo.forumFlags & RS_DISTRIB_AUTHEN_ANON)) {
|
||||
ui->forumComboBox->addItem(QString::fromStdWString(forumInfo.forumName), QString::fromStdString(forumInfo.forumId));
|
||||
}
|
||||
}
|
||||
}
|
||||
/* insert item to create a new forum */
|
||||
ui->forumComboBox->insertItem(0, tr("Create a new anonymous public forum"), "");
|
||||
ui->forumComboBox->setCurrentIndex(0);
|
||||
|
||||
validate();
|
||||
|
||||
ui->urlLineEdit->setFocus();
|
||||
}
|
||||
|
||||
AddFeedDialog::~AddFeedDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void AddFeedDialog::authenticationToggled()
|
||||
{
|
||||
bool checked = ui->useAuthenticationCheckBox->isChecked();
|
||||
ui->userLineEdit->setEnabled(checked);
|
||||
ui->passwordLineEdit->setEnabled(checked);
|
||||
}
|
||||
|
||||
void AddFeedDialog::useStandardStorageTimeToggled()
|
||||
{
|
||||
bool checked = ui->useStandardStorageTimeCheckBox->isChecked();
|
||||
ui->storageTimeSpinBox->setEnabled(!checked);
|
||||
}
|
||||
|
||||
void AddFeedDialog::useStandardUpdateIntervalToggled()
|
||||
{
|
||||
bool checked = ui->useStandardUpdateInterval->isChecked();
|
||||
ui->updateIntervalSpinBox->setEnabled(!checked);
|
||||
}
|
||||
|
||||
void AddFeedDialog::useStandardProxyToggled()
|
||||
{
|
||||
bool checked = ui->useStandardProxyCheckBox->isChecked();
|
||||
ui->proxyAddressLineEdit->setEnabled(!checked);
|
||||
ui->proxyPortSpinBox->setEnabled(!checked);
|
||||
}
|
||||
|
||||
void AddFeedDialog::typeForumToggled()
|
||||
{
|
||||
bool checked = ui->typeForumRadio->isChecked();
|
||||
ui->forumComboBox->setEnabled(checked);
|
||||
ui->updateForumInfoCheckBox->setEnabled(checked);
|
||||
}
|
||||
|
||||
void AddFeedDialog::validate()
|
||||
{
|
||||
bool ok = true;
|
||||
|
||||
if (ui->urlLineEdit->text().isEmpty()) {
|
||||
ok = false;
|
||||
}
|
||||
if (ui->nameLineEdit->text().isEmpty() && !ui->useInfoFromFeedCheckBox->isChecked()) {
|
||||
ok = false;
|
||||
}
|
||||
|
||||
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(ok);
|
||||
}
|
||||
|
||||
bool AddFeedDialog::showError(QWidget *parent, RsFeedAddResult result, const QString &title, const QString &text)
|
||||
{
|
||||
QString error;
|
||||
|
||||
switch (result) {
|
||||
case RS_FEED_ADD_RESULT_SUCCESS:
|
||||
/* no error */
|
||||
return false;
|
||||
case RS_FEED_ADD_RESULT_FEED_NOT_FOUND:
|
||||
error = tr("Feed not found.");
|
||||
break;
|
||||
case RS_FEED_ADD_RESULT_PARENT_NOT_FOUND:
|
||||
error = tr("Parent not found.");
|
||||
break;
|
||||
case RS_FEED_ADD_RESULT_PARENT_IS_NO_FOLDER:
|
||||
error = tr("Parent is no folder.");
|
||||
break;
|
||||
case RS_FEED_ADD_RESULT_FEED_IS_FOLDER:
|
||||
error = tr("Feed is a folder.");
|
||||
break;
|
||||
case RS_FEED_ADD_RESULT_FEED_IS_NO_FOLDER:
|
||||
error = tr("Feed is no folder.");
|
||||
break;
|
||||
default:
|
||||
error = tr("Unknown error occured.");
|
||||
}
|
||||
|
||||
QMessageBox::critical(parent, title, text + "\n" + error);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void AddFeedDialog::setParent(const std::string &parentId)
|
||||
{
|
||||
mParentId = parentId;
|
||||
}
|
||||
|
||||
bool AddFeedDialog::fillFeed(const std::string &feedId)
|
||||
{
|
||||
mFeedId = feedId;
|
||||
|
||||
if (!mFeedId.empty()) {
|
||||
FeedInfo feedInfo;
|
||||
if (!mFeedReader->getFeedInfo(mFeedId, feedInfo)) {
|
||||
mFeedId.clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
setWindowTitle(tr("Edit feed"));
|
||||
ui->typeGroupBox->setEnabled(false);
|
||||
|
||||
mParentId = feedInfo.parentId;
|
||||
|
||||
ui->nameLineEdit->setText(QString::fromUtf8(feedInfo.name.c_str()));
|
||||
ui->urlLineEdit->setText(QString::fromUtf8(feedInfo.url.c_str()));
|
||||
ui->useInfoFromFeedCheckBox->setChecked(feedInfo.flag.infoFromFeed);
|
||||
ui->updateForumInfoCheckBox->setChecked(feedInfo.flag.updateForumInfo);
|
||||
ui->activatedCheckBox->setChecked(!feedInfo.flag.deactivated);
|
||||
|
||||
ui->descriptionPlainTextEdit->setPlainText(QString::fromUtf8(feedInfo.description.c_str()));
|
||||
|
||||
ui->typeGroupBox->setEnabled(false);
|
||||
ui->forumComboBox->hide();
|
||||
ui->forumNameLabel->clear();
|
||||
ui->forumNameLabel->show();
|
||||
|
||||
if (feedInfo.flag.forum) {
|
||||
ui->typeForumRadio->setChecked(true);
|
||||
|
||||
if (feedInfo.forumId.empty()) {
|
||||
ui->forumNameLabel->setText(tr("Not yet created"));
|
||||
} else {
|
||||
ForumInfo forumInfo;
|
||||
if (rsForums->getForumInfo(feedInfo.forumId, forumInfo)) {
|
||||
ui->forumNameLabel->setText(QString::fromStdWString(forumInfo.forumName));
|
||||
} else {
|
||||
ui->forumNameLabel->setText(tr("Unknown forum"));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ui->typeLocalRadio->setChecked(true);
|
||||
}
|
||||
|
||||
ui->useAuthenticationCheckBox->setChecked(feedInfo.flag.authentication);
|
||||
ui->userLineEdit->setText(QString::fromUtf8(feedInfo.user.c_str()));
|
||||
ui->passwordLineEdit->setText(QString::fromUtf8(feedInfo.password.c_str()));
|
||||
|
||||
ui->useStandardProxyCheckBox->setChecked(feedInfo.flag.standardProxy);
|
||||
ui->proxyAddressLineEdit->setText(QString::fromUtf8(feedInfo.proxyAddress.c_str()));
|
||||
ui->proxyPortSpinBox->setValue(feedInfo.proxyPort);
|
||||
|
||||
ui->useStandardUpdateInterval->setChecked(feedInfo.flag.standardUpdateInterval);
|
||||
ui->updateIntervalSpinBox->setValue(feedInfo.updateInterval / 60);
|
||||
QDateTime dateTime;
|
||||
dateTime.setTime_t(feedInfo.lastUpdate);
|
||||
ui->lastUpdate->setText(dateTime.toString());
|
||||
|
||||
ui->useStandardStorageTimeCheckBox->setChecked(feedInfo.flag.standardStorageTime);
|
||||
ui->storageTimeSpinBox->setValue(feedInfo.storageTime / (60 * 60 *24));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void AddFeedDialog::createFeed()
|
||||
{
|
||||
FeedInfo feedInfo;
|
||||
if (!mFeedId.empty()) {
|
||||
if (!mFeedReader->getFeedInfo(mFeedId, feedInfo)) {
|
||||
QMessageBox::critical(this, tr("Edit feed"), tr("Can't edit feed. Feed does not exist."));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
feedInfo.parentId = mParentId;
|
||||
|
||||
feedInfo.name = ui->nameLineEdit->text().toUtf8().constData();
|
||||
feedInfo.url = ui->urlLineEdit->text().toUtf8().constData();
|
||||
feedInfo.flag.infoFromFeed = ui->useInfoFromFeedCheckBox->isChecked();
|
||||
feedInfo.flag.updateForumInfo = ui->updateForumInfoCheckBox->isChecked() && ui->updateForumInfoCheckBox->isEnabled();
|
||||
feedInfo.flag.deactivated = !ui->activatedCheckBox->isChecked();
|
||||
|
||||
feedInfo.description = ui->descriptionPlainTextEdit->toPlainText().toUtf8().constData();
|
||||
|
||||
feedInfo.flag.forum = ui->typeForumRadio->isChecked();
|
||||
if (mFeedId.empty()) {
|
||||
/* set forum (only when create a new feed) */
|
||||
feedInfo.forumId = ui->forumComboBox->itemData(ui->forumComboBox->currentIndex()).toString().toStdString();
|
||||
}
|
||||
|
||||
feedInfo.flag.authentication = ui->useAuthenticationCheckBox->isChecked();
|
||||
feedInfo.user = ui->userLineEdit->text().toUtf8().constData();
|
||||
feedInfo.password = ui->passwordLineEdit->text().toUtf8().constData();
|
||||
|
||||
feedInfo.flag.standardProxy = ui->useStandardProxyCheckBox->isChecked();
|
||||
feedInfo.proxyAddress = ui->proxyAddressLineEdit->text().toUtf8().constData();
|
||||
feedInfo.proxyPort = ui->proxyPortSpinBox->value();
|
||||
|
||||
feedInfo.flag.standardUpdateInterval = ui->useStandardUpdateInterval->isChecked();
|
||||
feedInfo.updateInterval = ui->updateIntervalSpinBox->value() * 60;
|
||||
|
||||
feedInfo.flag.standardStorageTime = ui->useStandardStorageTimeCheckBox->isChecked();
|
||||
feedInfo.storageTime = ui->storageTimeSpinBox->value() * 60 *60 * 24;
|
||||
|
||||
if (mFeedId.empty()) {
|
||||
/* add new feed */
|
||||
RsFeedAddResult result = mFeedReader->addFeed(feedInfo, mFeedId);
|
||||
if (showError(this, result, tr("Create feed"), tr("Cannot create feed."))) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
RsFeedAddResult result = mFeedReader->setFeed(mFeedId, feedInfo);
|
||||
if (showError(this, result, tr("Edit feed"), tr("Cannot change feed."))) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
close();
|
||||
}
|
64
plugins/FeedReader/gui/AddFeedDialog.h
Normal file
|
@ -0,0 +1,64 @@
|
|||
/****************************************************************
|
||||
* RetroShare GUI is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2012 by Thunder
|
||||
*
|
||||
* 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 ADDFEEDDIALOG_H
|
||||
#define ADDFEEDDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "interface/rsFeedReader.h"
|
||||
|
||||
namespace Ui {
|
||||
class AddFeedDialog;
|
||||
}
|
||||
|
||||
class RsFeedReader;
|
||||
|
||||
class AddFeedDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AddFeedDialog(RsFeedReader *feedReader, QWidget *parent);
|
||||
~AddFeedDialog();
|
||||
|
||||
static bool showError(QWidget *parent, RsFeedAddResult result, const QString &title, const QString &text);
|
||||
|
||||
void setParent(const std::string &parentId);
|
||||
bool fillFeed(const std::string &feedId);
|
||||
|
||||
private slots:
|
||||
void authenticationToggled();
|
||||
void useStandardStorageTimeToggled();
|
||||
void useStandardUpdateIntervalToggled();
|
||||
void useStandardProxyToggled();
|
||||
void typeForumToggled();
|
||||
void validate();
|
||||
void createFeed();
|
||||
|
||||
private:
|
||||
RsFeedReader *mFeedReader;
|
||||
std::string mFeedId;
|
||||
std::string mParentId;
|
||||
|
||||
Ui::AddFeedDialog *ui;
|
||||
};
|
||||
|
||||
#endif // ADDFEEDDIALOG_H
|
442
plugins/FeedReader/gui/AddFeedDialog.ui
Normal file
|
@ -0,0 +1,442 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>AddFeedDialog</class>
|
||||
<widget class="QDialog" name="AddFeedDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>715</width>
|
||||
<height>559</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Create new feed</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../../../retroshare-gui/src/gui/images.qrc">
|
||||
<normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QFrame" name="headerFrame">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>64</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QFrame#headerFrame{background-image: url(:/images/connect/connectFriendBanner.png);}</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="margin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="headerIcon">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>48</width>
|
||||
<height>48</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="FeedReader_images.qrc">:/images/FeedReader.png</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="headerLabel">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">color: rgb(255, 255, 255);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'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-family:'Arial'; font-size:24pt; font-weight:600; color:#ffffff;">Feed Details</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_7">
|
||||
<item row="7" column="0">
|
||||
<widget class="QGroupBox" name="authenticationGroupBox">
|
||||
<property name="title">
|
||||
<string>Authentication (not yet supported)</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="useAuthenticationCheckBox">
|
||||
<property name="text">
|
||||
<string>Feed needs authentication</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="userLabel">
|
||||
<property name="text">
|
||||
<string>User</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="passwordLabel">
|
||||
<property name="text">
|
||||
<string>Password</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="userLineEdit"/>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="passwordLineEdit">
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QGroupBox" name="updateInteralGroupBox">
|
||||
<property name="title">
|
||||
<string>Update interval</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="useStandardUpdateInterval">
|
||||
<property name="text">
|
||||
<string>Use standard update interval</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="updateIntervalLabel">
|
||||
<property name="text">
|
||||
<string>Interval in minutes (0 = manual)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="updateIntervalSpinBox">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="lastUpdateLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="lastUpdateLabel">
|
||||
<property name="text">
|
||||
<string>Last update</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lastUpdate">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Never</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QGroupBox" name="storageTimeGroupBox">
|
||||
<property name="title">
|
||||
<string>Storage time</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="useStandardStorageTimeCheckBox">
|
||||
<property name="text">
|
||||
<string>Use standard storage time</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="storageTimeLabel">
|
||||
<property name="text">
|
||||
<string>Days (0 = off)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="storageTimeSpinBox">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>999999999</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QGroupBox" name="proxyGroupBox">
|
||||
<property name="title">
|
||||
<string>Proxy</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_6">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="useStandardProxyCheckBox">
|
||||
<property name="text">
|
||||
<string>Use standard proxy</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="serverLabel">
|
||||
<property name="text">
|
||||
<string>Server</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="proxyAddressLineEdit"/>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="portLabel">
|
||||
<property name="text">
|
||||
<string>:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QSpinBox" name="proxyPortSpinBox">
|
||||
<property name="maximum">
|
||||
<number>65535</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QGroupBox" name="typeGroupBox">
|
||||
<property name="title">
|
||||
<string>Type</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<property name="margin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="typeLocalRadio">
|
||||
<property name="text">
|
||||
<string>Local Feed</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="typeForumRadio">
|
||||
<property name="text">
|
||||
<string>Forum</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="forumComboBox"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="forumNameLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Forum name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</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="3" column="1">
|
||||
<widget class="QGroupBox" name="flagGroupBox">
|
||||
<property name="title">
|
||||
<string>Misc</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="activatedCheckBox">
|
||||
<property name="text">
|
||||
<string>Activated</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="useInfoFromFeedCheckBox">
|
||||
<property name="text">
|
||||
<string>Use name and description from feed</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="updateForumInfoCheckBox">
|
||||
<property name="text">
|
||||
<string>Update forum information</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<layout class="QVBoxLayout" name="descriptionLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="descriptionLabel">
|
||||
<property name="text">
|
||||
<string>Description:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="descriptionPlainTextEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<layout class="QGridLayout" name="nameLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="urlLabel">
|
||||
<property name="text">
|
||||
<string>RSS-Feed-URL:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="urlLineEdit"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="nameLabel">
|
||||
<property name="text">
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="nameLineEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>urlLineEdit</tabstop>
|
||||
<tabstop>nameLineEdit</tabstop>
|
||||
<tabstop>descriptionPlainTextEdit</tabstop>
|
||||
<tabstop>typeLocalRadio</tabstop>
|
||||
<tabstop>typeForumRadio</tabstop>
|
||||
<tabstop>forumComboBox</tabstop>
|
||||
<tabstop>activatedCheckBox</tabstop>
|
||||
<tabstop>useInfoFromFeedCheckBox</tabstop>
|
||||
<tabstop>updateForumInfoCheckBox</tabstop>
|
||||
<tabstop>useAuthenticationCheckBox</tabstop>
|
||||
<tabstop>userLineEdit</tabstop>
|
||||
<tabstop>passwordLineEdit</tabstop>
|
||||
<tabstop>useStandardStorageTimeCheckBox</tabstop>
|
||||
<tabstop>storageTimeSpinBox</tabstop>
|
||||
<tabstop>useStandardUpdateInterval</tabstop>
|
||||
<tabstop>updateIntervalSpinBox</tabstop>
|
||||
<tabstop>useStandardProxyCheckBox</tabstop>
|
||||
<tabstop>proxyAddressLineEdit</tabstop>
|
||||
<tabstop>proxyPortSpinBox</tabstop>
|
||||
<tabstop>buttonBox</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="FeedReader_images.qrc"/>
|
||||
<include location="../../../retroshare-gui/src/gui/images.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
80
plugins/FeedReader/gui/FeedReaderConfig.cpp
Normal file
|
@ -0,0 +1,80 @@
|
|||
/****************************************************************
|
||||
* RetroShare GUI is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2012 by Thunder
|
||||
*
|
||||
* 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 "FeedReaderConfig.h"
|
||||
#include "ui_FeedReaderConfig.h"
|
||||
#include "gui/settings/rsharesettings.h"
|
||||
#include "interface/rsFeedReader.h"
|
||||
|
||||
/** Constructor */
|
||||
FeedReaderConfig::FeedReaderConfig(QWidget *parent, Qt::WFlags flags)
|
||||
: ConfigPage(parent, flags), ui(new Ui::FeedReaderConfig)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui->setupUi(this);
|
||||
|
||||
connect(ui->useProxyCheckBox, SIGNAL(toggled(bool)), this, SLOT(useProxyToggled()));
|
||||
|
||||
ui->proxyAddressLineEdit->setEnabled(false);
|
||||
ui->proxyPortSpinBox->setEnabled(false);
|
||||
|
||||
loaded = false;
|
||||
}
|
||||
|
||||
/** Destructor */
|
||||
FeedReaderConfig::~FeedReaderConfig()
|
||||
{
|
||||
delete(ui);
|
||||
}
|
||||
|
||||
/** Loads the settings for this page */
|
||||
void FeedReaderConfig::load()
|
||||
{
|
||||
ui->updateIntervalSpinBox->setValue(rsFeedReader->getStandardUpdateInterval() / 60);
|
||||
ui->storageTimeSpinBox->setValue(rsFeedReader->getStandardStorageTime() / (60 * 60 *24));
|
||||
ui->setMsgToReadOnActivate->setChecked(Settings->valueFromGroup("FeedReaderDialog", "SetMsgToReadOnActivate", true).toBool());
|
||||
|
||||
std::string proxyAddress;
|
||||
uint16_t proxyPort;
|
||||
ui->useProxyCheckBox->setChecked(rsFeedReader->getStandardProxy(proxyAddress, proxyPort));
|
||||
ui->proxyAddressLineEdit->setText(QString::fromUtf8(proxyAddress.c_str()));
|
||||
ui->proxyPortSpinBox->setValue(proxyPort);
|
||||
|
||||
loaded = true;
|
||||
}
|
||||
|
||||
bool FeedReaderConfig::save(QString &/*errmsg*/)
|
||||
{
|
||||
rsFeedReader->setStandardUpdateInterval(ui->updateIntervalSpinBox->value() * 60);
|
||||
rsFeedReader->setStandardStorageTime(ui->storageTimeSpinBox->value() * 60 *60 * 24);
|
||||
rsFeedReader->setStandardProxy(ui->useProxyCheckBox->isChecked(), ui->proxyAddressLineEdit->text().toUtf8().constData(), ui->proxyPortSpinBox->value());
|
||||
Settings->setValueToGroup("FeedReaderDialog", "SetMsgToReadOnActivate", ui->setMsgToReadOnActivate->isChecked());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void FeedReaderConfig::useProxyToggled()
|
||||
{
|
||||
bool enabled = ui->useProxyCheckBox->isChecked();
|
||||
|
||||
ui->proxyAddressLineEdit->setEnabled(enabled);
|
||||
ui->proxyPortSpinBox->setEnabled(enabled);
|
||||
}
|
57
plugins/FeedReader/gui/FeedReaderConfig.h
Normal file
|
@ -0,0 +1,57 @@
|
|||
/****************************************************************
|
||||
* RetroShare GUI is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2012 by Thunder
|
||||
*
|
||||
* 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 _FEEDREADERCONFIG_H
|
||||
#define _FEEDREADERCONFIG_H
|
||||
|
||||
#include "retroshare-gui/configpage.h"
|
||||
|
||||
namespace Ui {
|
||||
class FeedReaderConfig;
|
||||
}
|
||||
|
||||
class FeedReaderConfig : public ConfigPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** Default Constructor */
|
||||
FeedReaderConfig(QWidget *parent = 0, Qt::WFlags flags = 0);
|
||||
/** Default Destructor */
|
||||
virtual ~FeedReaderConfig();
|
||||
|
||||
/** Saves the changes on this page */
|
||||
virtual bool save(QString &errmsg);
|
||||
/** Loads the settings for this page */
|
||||
virtual void load();
|
||||
|
||||
virtual QPixmap iconPixmap() const { return QPixmap(":/images/FeedReader.png") ; }
|
||||
virtual QString pageName() const { return tr("FeedReader") ; }
|
||||
|
||||
private slots:
|
||||
void useProxyToggled();
|
||||
|
||||
private:
|
||||
Ui::FeedReaderConfig *ui;
|
||||
bool loaded;
|
||||
};
|
||||
|
||||
#endif
|
148
plugins/FeedReader/gui/FeedReaderConfig.ui
Normal file
|
@ -0,0 +1,148 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>FeedReaderConfig</class>
|
||||
<widget class="QWidget" name="FeedReaderConfig">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>508</width>
|
||||
<height>378</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="updateGroupBox">
|
||||
<property name="title">
|
||||
<string>Update</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="updateIntervalLabel">
|
||||
<property name="text">
|
||||
<string>Interval in minutes (0 = manual)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="updateIntervalSpinBox">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>999999999</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="storageTimeGroupBox">
|
||||
<property name="title">
|
||||
<string>Storage time</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="storageTimeLabel">
|
||||
<property name="text">
|
||||
<string>Days (0 = off)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="storageTimeSpinBox">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>999999999</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="proxyGroupBox">
|
||||
<property name="title">
|
||||
<string>Proxy</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="4">
|
||||
<widget class="QCheckBox" name="useProxyCheckBox">
|
||||
<property name="text">
|
||||
<string>Use proxy</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="serverLabel">
|
||||
<property name="text">
|
||||
<string>Server</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="proxyAddressLineEdit"/>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QSpinBox" name="proxyPortSpinBox">
|
||||
<property name="maximum">
|
||||
<number>65535</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="potLabel">
|
||||
<property name="text">
|
||||
<string>:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="miscGroupBox">
|
||||
<property name="title">
|
||||
<string>Misc</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="setMsgToReadOnActivate">
|
||||
<property name="text">
|
||||
<string>Set message to read on activate</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>301</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
1088
plugins/FeedReader/gui/FeedReaderDialog.cpp
Normal file
105
plugins/FeedReader/gui/FeedReaderDialog.h
Normal file
|
@ -0,0 +1,105 @@
|
|||
/****************************************************************
|
||||
* RetroShare GUI is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2012 by Thunder
|
||||
*
|
||||
* 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 _FEEDREADERDIALOG_H
|
||||
#define _FEEDREADERDIALOG_H
|
||||
|
||||
#include <retroshare-gui/mainpage.h>
|
||||
#include "interface/rsFeedReader.h"
|
||||
|
||||
namespace Ui {
|
||||
class FeedReaderDialog;
|
||||
}
|
||||
|
||||
class QTreeWidgetItem;
|
||||
class RsFeedReader;
|
||||
class RSTreeWidgetItemCompareRole;
|
||||
class FeedReaderNotify;
|
||||
|
||||
class FeedReaderDialog : public MainPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FeedReaderDialog(RsFeedReader *feedReader, QWidget *parent = 0);
|
||||
~FeedReaderDialog();
|
||||
|
||||
protected:
|
||||
virtual void showEvent(QShowEvent *e);
|
||||
bool eventFilter(QObject *obj, QEvent *ev);
|
||||
|
||||
private slots:
|
||||
void feedTreeCustomPopupMenu(QPoint point);
|
||||
void msgTreeCustomPopupMenu(QPoint point);
|
||||
void feedItemChanged(QTreeWidgetItem *item);
|
||||
void msgItemChanged();
|
||||
void msgItemClicked(QTreeWidgetItem *item, int column);
|
||||
void filterColumnChanged();
|
||||
void filterItems(const QString &text);
|
||||
void toggleMsgText();
|
||||
void newFolder();
|
||||
void newFeed();
|
||||
void removeFeed();
|
||||
void editFeed();
|
||||
void activateFeed();
|
||||
void processFeed();
|
||||
void markAsReadMsg();
|
||||
void markAsUnreadMsg();
|
||||
void markAllAsReadMsg();
|
||||
void copyLinkMsg();
|
||||
void removeMsg();
|
||||
|
||||
/* FeedReaderNotify */
|
||||
void feedChanged(const QString &feedId, int type);
|
||||
void msgChanged(const QString &feedId, const QString &msgId, int type);
|
||||
|
||||
private:
|
||||
std::string currentFeedId();
|
||||
std::string currentMsgId();
|
||||
void processSettings(bool load);
|
||||
void updateFeeds(const std::string &parentId, QTreeWidgetItem *parentItem);
|
||||
void updateFeedItem(QTreeWidgetItem *item, FeedInfo &info);
|
||||
void updateMsgs(const std::string &feedId);
|
||||
void calculateMsgIconsAndFonts(QTreeWidgetItem *item);
|
||||
void updateMsgItem(QTreeWidgetItem *item, FeedMsgInfo &info);
|
||||
void setMsgAsReadUnread(QList<QTreeWidgetItem*> &rows, bool read);
|
||||
void filterItem(QTreeWidgetItem *item, const QString &text, int filterColumn);
|
||||
void filterItem(QTreeWidgetItem *item);
|
||||
void toggleMsgText_internal();
|
||||
|
||||
void calculateFeedItems();
|
||||
void calculateFeedItem(QTreeWidgetItem *item, uint32_t &unreadCount, bool &loading);
|
||||
|
||||
bool mProcessSettings;
|
||||
QTreeWidgetItem *mRootItem;
|
||||
RSTreeWidgetItemCompareRole *mFeedCompareRole;
|
||||
RSTreeWidgetItemCompareRole *mMsgCompareRole;
|
||||
|
||||
// gui interface
|
||||
RsFeedReader *mFeedReader;
|
||||
FeedReaderNotify *mNotify;
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::FeedReaderDialog *ui;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
373
plugins/FeedReader/gui/FeedReaderDialog.ui
Normal file
|
@ -0,0 +1,373 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>FeedReaderDialog</class>
|
||||
<widget class="QWidget" name="FeedReaderDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>738</width>
|
||||
<height>583</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QSplitter" name="splitter">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<widget class="QFrame" name="feedFrame">
|
||||
<property name="baseSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>300</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QFrame#frame{border: none;}</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QFrame" name="feedsHeaderFrame">
|
||||
<property name="styleSheet">
|
||||
<string notr="true"> QFrame#feedsHeaderFrame{
|
||||
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
|
||||
stop:0 #FEFEFE, stop:1 #E8E8E8);
|
||||
|
||||
border: 1px solid #CCCCCC;}
|
||||
|
||||
</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<property name="margin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="feedsIcon">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="FeedReader_images.qrc">:/images/Feed.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="feedsLabel">
|
||||
<property name="text">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'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-family:'Arial'; font-size:10pt; font-weight:600;">Feeds</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QTreeWidget" name="feedTreeWidget">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="rootIsDecorated">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="headerHidden">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QSplitter" name="msgSplitter">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<layout class="QGridLayout" name="msgFrame">
|
||||
<item row="1" column="0">
|
||||
<widget class="QFrame" name="filterFrame">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"> QFrame#frame_2{
|
||||
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
|
||||
stop:0 #FEFEFE, stop:1 #E8E8E8);
|
||||
|
||||
border: 1px solid #CCCCCC;}</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="_7">
|
||||
<property name="margin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="filterLabel">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../../../retroshare-gui/src/gui/images.qrc">:/images/find-16.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="LineEditClear" name="filterLineEdit">
|
||||
<property name="toolTip">
|
||||
<string>Search forums</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="filterColumnComboBox">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>MS Shell Dlg 2</family>
|
||||
</font>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Title</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Date</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Author</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QTreeWidget" name="msgTreeWidget">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::ExtendedSelection</enum>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="allColumnsShowFocus">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Title</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../retroshare-gui/src/gui/images.qrc">
|
||||
<normaloff>:/images/message-state-header.png</normaloff>:/images/message-state-header.png</iconset>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Date</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Author</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<layout class="QGridLayout" name="navFrame">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="msgLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Message:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="msgTitle">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QLabel#msgTitle{
|
||||
border: 2px solid #CCCCCC;
|
||||
border-radius: 6px;
|
||||
background: white;}</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="expandButton">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../retroshare-gui/src/gui/images.qrc">
|
||||
<normaloff>:/images/edit_remove24.png</normaloff>:/images/edit_remove24.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="LinkTextBrowser" name="msgText">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>10</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>LineEditClear</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>gui/common/LineEditClear.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>LinkTextBrowser</class>
|
||||
<extends>QTextBrowser</extends>
|
||||
<header>gui/common/LinkTextBrowser.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="FeedReader_images.qrc"/>
|
||||
<include location="../../../retroshare-gui/src/gui/images.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
36
plugins/FeedReader/gui/FeedReaderNotify.cpp
Normal file
|
@ -0,0 +1,36 @@
|
|||
/****************************************************************
|
||||
* RetroShare GUI is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2012 by Thunder
|
||||
*
|
||||
* 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 "FeedReaderNotify.h"
|
||||
|
||||
FeedReaderNotify::FeedReaderNotify() : QObject()
|
||||
{
|
||||
}
|
||||
|
||||
void FeedReaderNotify::feedChanged(const std::string &feedId, int type)
|
||||
{
|
||||
emit notifyFeedChanged(QString::fromStdString(feedId), type);
|
||||
}
|
||||
|
||||
void FeedReaderNotify::msgChanged(const std::string &feedId, const std::string &msgId, int type)
|
||||
{
|
||||
emit notifyMsgChanged(QString::fromStdString(feedId), QString::fromStdString(msgId), type);
|
||||
}
|
45
plugins/FeedReader/gui/FeedReaderNotify.h
Normal file
|
@ -0,0 +1,45 @@
|
|||
/****************************************************************
|
||||
* RetroShare GUI is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2012 by Thunder
|
||||
*
|
||||
* 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 _FEEDREADERNOTIFY_H
|
||||
#define _FEEDREADERNOTIFY_H
|
||||
|
||||
#include <QObject>
|
||||
#include "interface/rsFeedReader.h"
|
||||
|
||||
class FeedReaderNotify : public QObject, public RsFeedReaderNotify
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FeedReaderNotify();
|
||||
|
||||
/* RsFeedReaderNotify */
|
||||
virtual void feedChanged(const std::string &feedId, int type);
|
||||
virtual void msgChanged(const std::string &feedId, const std::string &msgId, int type);
|
||||
|
||||
signals:
|
||||
void notifyFeedChanged(const QString &feedId, int type);
|
||||
void notifyMsgChanged(const QString &feedId, const QString &msgId, int type);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
13
plugins/FeedReader/gui/FeedReader_images.qrc
Normal file
|
@ -0,0 +1,13 @@
|
|||
<RCC>
|
||||
<qresource prefix="/" >
|
||||
<file>images/FeedReader.png</file>
|
||||
<file>images/Root.png</file>
|
||||
<file>images/Folder.png</file>
|
||||
<file>images/Feed.png</file>
|
||||
<file>images/FeedProcessOverlay.png</file>
|
||||
<file>images/FeedErrorOverlay.png</file>
|
||||
<file>images/FolderAdd.png</file>
|
||||
<file>images/FeedAdd.png</file>
|
||||
<file>images/Update.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
BIN
plugins/FeedReader/gui/images/Feed.png
Normal file
After Width: | Height: | Size: 641 B |
BIN
plugins/FeedReader/gui/images/FeedAdd.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
plugins/FeedReader/gui/images/FeedErrorOverlay.png
Normal file
After Width: | Height: | Size: 193 B |
BIN
plugins/FeedReader/gui/images/FeedProcessOverlay.png
Normal file
After Width: | Height: | Size: 848 B |
BIN
plugins/FeedReader/gui/images/FeedReader.png
Normal file
After Width: | Height: | Size: 9.7 KiB |
BIN
plugins/FeedReader/gui/images/Folder.png
Normal file
After Width: | Height: | Size: 446 B |
BIN
plugins/FeedReader/gui/images/FolderAdd.png
Normal file
After Width: | Height: | Size: 446 B |
BIN
plugins/FeedReader/gui/images/Root.png
Normal file
After Width: | Height: | Size: 968 B |
BIN
plugins/FeedReader/gui/images/Update.png
Normal file
After Width: | Height: | Size: 1.5 KiB |