mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 06:06:10 -04:00
FeedReader plugin:
- added new classes for XML/HTML parse and modify - added basic error handling - added new GUI for a preview and a tree to show the structure of the page (will be continued) git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5412 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
acaefada65
commit
f51af0d4de
24 changed files with 1959 additions and 509 deletions
|
@ -25,6 +25,9 @@
|
|||
|
||||
#include "AddFeedDialog.h"
|
||||
#include "ui_AddFeedDialog.h"
|
||||
#include "PreviewFeedDialog.h"
|
||||
#include "FeedReaderStringDefs.h"
|
||||
|
||||
#include "retroshare/rsforums.h"
|
||||
|
||||
bool sortForumInfo(const ForumInfo& info1, const ForumInfo& info2)
|
||||
|
@ -32,8 +35,8 @@ 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)
|
||||
AddFeedDialog::AddFeedDialog(RsFeedReader *feedReader, FeedReaderNotify *notify, QWidget *parent)
|
||||
: QDialog(parent), mFeedReader(feedReader), mNotify(notify), ui(new Ui::AddFeedDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
|
@ -45,6 +48,7 @@ AddFeedDialog::AddFeedDialog(RsFeedReader *feedReader, QWidget *parent)
|
|||
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->previewButton, SIGNAL(clicked()), this, SLOT(preview()));
|
||||
|
||||
/* currently only for loacl feeds */
|
||||
connect(ui->saveCompletePageCheckBox, SIGNAL(toggled(bool)), this, SLOT(denyForumToggled()));
|
||||
|
@ -149,6 +153,9 @@ void AddFeedDialog::validate()
|
|||
if (ui->nameLineEdit->text().isEmpty() && !ui->useInfoFromFeedCheckBox->isChecked()) {
|
||||
ok = false;
|
||||
}
|
||||
|
||||
ui->previewButton->setEnabled(ok);
|
||||
|
||||
if (!ui->typeLocalRadio->isChecked() && !ui->typeForumRadio->isChecked()) {
|
||||
ok = false;
|
||||
}
|
||||
|
@ -156,38 +163,6 @@ void AddFeedDialog::validate()
|
|||
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;
|
||||
|
@ -264,16 +239,8 @@ bool AddFeedDialog::fillFeed(const std::string &feedId)
|
|||
return true;
|
||||
}
|
||||
|
||||
void AddFeedDialog::createFeed()
|
||||
void AddFeedDialog::getFeedInfo(FeedInfo &feedInfo)
|
||||
{
|
||||
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();
|
||||
|
@ -307,19 +274,41 @@ void AddFeedDialog::createFeed()
|
|||
|
||||
feedInfo.flag.standardStorageTime = ui->useStandardStorageTimeCheckBox->isChecked();
|
||||
feedInfo.storageTime = ui->storageTimeSpinBox->value() * 60 *60 * 24;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
getFeedInfo(feedInfo);
|
||||
|
||||
if (mFeedId.empty()) {
|
||||
/* add new feed */
|
||||
RsFeedAddResult result = mFeedReader->addFeed(feedInfo, mFeedId);
|
||||
if (showError(this, result, tr("Create feed"), tr("Cannot create feed."))) {
|
||||
if (FeedReaderStringDefs::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."))) {
|
||||
if (FeedReaderStringDefs::showError(this, result, tr("Edit feed"), tr("Cannot change feed."))) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
close();
|
||||
}
|
||||
|
||||
void AddFeedDialog::preview()
|
||||
{
|
||||
FeedInfo feedInfo;
|
||||
getFeedInfo(feedInfo);
|
||||
|
||||
PreviewFeedDialog dialog(mFeedReader, mNotify, feedInfo, this);
|
||||
dialog.exec();
|
||||
}
|
||||
|
|
|
@ -30,17 +30,16 @@ class AddFeedDialog;
|
|||
}
|
||||
|
||||
class RsFeedReader;
|
||||
class FeedReaderNotify;
|
||||
|
||||
class AddFeedDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AddFeedDialog(RsFeedReader *feedReader, QWidget *parent);
|
||||
AddFeedDialog(RsFeedReader *feedReader, FeedReaderNotify *notify, 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);
|
||||
|
||||
|
@ -53,9 +52,13 @@ private slots:
|
|||
void denyForumToggled();
|
||||
void validate();
|
||||
void createFeed();
|
||||
void preview();
|
||||
|
||||
private:
|
||||
void getFeedInfo(FeedInfo &feedInfo);
|
||||
|
||||
RsFeedReader *mFeedReader;
|
||||
FeedReaderNotify *mNotify;
|
||||
std::string mFeedId;
|
||||
std::string mParentId;
|
||||
|
||||
|
|
|
@ -278,6 +278,13 @@ p, li { white-space: pre-wrap; }
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="previewButton">
|
||||
<property name="text">
|
||||
<string>Preview</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
|
|
|
@ -33,9 +33,11 @@
|
|||
#include "ui_FeedReaderDialog.h"
|
||||
#include "FeedReaderNotify.h"
|
||||
#include "AddFeedDialog.h"
|
||||
#include "FeedReaderStringDefs.h"
|
||||
#include "gui/common/RSTreeWidgetItem.h"
|
||||
#include "util/HandleRichText.h"
|
||||
#include "gui/settings/rsharesettings.h"
|
||||
|
||||
#include "interface/rsFeedReader.h"
|
||||
#include "retroshare/rsiface.h"
|
||||
|
||||
|
@ -513,7 +515,6 @@ void FeedReaderDialog::calculateFeedItems()
|
|||
|
||||
void FeedReaderDialog::updateFeedItem(QTreeWidgetItem *item, FeedInfo &info)
|
||||
{
|
||||
QString workState;
|
||||
|
||||
QIcon icon;
|
||||
if (info.flag.folder) {
|
||||
|
@ -532,26 +533,9 @@ void FeedReaderDialog::updateFeedItem(QTreeWidgetItem *item, FeedInfo &info)
|
|||
|
||||
item->setData(COLUMN_FEED_DATA, ROLE_FEED_ICON, icon);
|
||||
|
||||
switch (info.workstate) {
|
||||
case FeedInfo::WAITING:
|
||||
break;
|
||||
case FeedInfo::WAITING_TO_DOWNLOAD:
|
||||
workState = tr("waiting for download");
|
||||
break;
|
||||
case FeedInfo::DOWNLOADING:
|
||||
workState = tr("downloading");
|
||||
break;
|
||||
case FeedInfo::WAITING_TO_PROCESS:
|
||||
workState = tr("waiting for process");
|
||||
break;
|
||||
case FeedInfo::PROCESSING:
|
||||
workState = tr("processing");
|
||||
break;
|
||||
}
|
||||
|
||||
QString name = QString::fromUtf8(info.name.c_str());
|
||||
item->setData(COLUMN_FEED_DATA, ROLE_FEED_NAME, name.isEmpty() ? tr("No name") : name);
|
||||
item->setData(COLUMN_FEED_DATA, ROLE_FEED_WORKSTATE, workState);
|
||||
item->setData(COLUMN_FEED_DATA, ROLE_FEED_WORKSTATE, FeedReaderStringDefs::workState(info.workstate));
|
||||
|
||||
uint32_t unreadCount;
|
||||
mFeedReader->getMessageCount(info.feedId, NULL, NULL, &unreadCount);
|
||||
|
@ -562,8 +546,8 @@ void FeedReaderDialog::updateFeedItem(QTreeWidgetItem *item, FeedInfo &info)
|
|||
item->setData(COLUMN_FEED_DATA, ROLE_FEED_ID, QString::fromStdString(info.feedId));
|
||||
item->setData(COLUMN_FEED_DATA, ROLE_FEED_FOLDER, info.flag.folder);
|
||||
item->setData(COLUMN_FEED_DATA, ROLE_FEED_DEACTIVATED, info.flag.deactivated);
|
||||
item->setData(COLUMN_FEED_DATA, ROLE_FEED_ERROR, info.error);
|
||||
item->setToolTip(COLUMN_FEED_NAME, info.error ? QString::fromUtf8(info.errorString.c_str()) : "");
|
||||
item->setData(COLUMN_FEED_DATA, ROLE_FEED_ERROR, (bool) (info.errorState != RS_FEED_ERRORSTATE_OK));
|
||||
item->setToolTip(COLUMN_FEED_NAME, (info.errorState != RS_FEED_ERRORSTATE_OK) ? FeedReaderStringDefs::errorString(info) : "");
|
||||
}
|
||||
|
||||
void FeedReaderDialog::updateMsgs(const std::string &feedId)
|
||||
|
@ -689,6 +673,10 @@ void FeedReaderDialog::feedChanged(const QString &feedId, int type)
|
|||
if (!mFeedReader->getFeedInfo(feedId.toStdString(), feedInfo)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (feedInfo.flag.preview) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (type == NOTIFY_TYPE_MOD || type == NOTIFY_TYPE_DEL) {
|
||||
|
@ -950,13 +938,13 @@ void FeedReaderDialog::newFolder()
|
|||
if (dialog.exec() == QDialog::Accepted && !dialog.textValue().isEmpty()) {
|
||||
std::string feedId;
|
||||
RsFeedAddResult result = mFeedReader->addFolder(currentFeedId(), dialog.textValue().toUtf8().constData(), feedId);
|
||||
AddFeedDialog::showError(this, result, tr("Create folder"), tr("Cannot create folder."));
|
||||
FeedReaderStringDefs::showError(this, result, tr("Create folder"), tr("Cannot create folder."));
|
||||
}
|
||||
}
|
||||
|
||||
void FeedReaderDialog::newFeed()
|
||||
{
|
||||
AddFeedDialog dialog(mFeedReader, this);
|
||||
AddFeedDialog dialog(mFeedReader, mNotify, this);
|
||||
dialog.setParent(currentFeedId());
|
||||
dialog.exec();
|
||||
}
|
||||
|
@ -1003,10 +991,10 @@ void FeedReaderDialog::editFeed()
|
|||
|
||||
if (dialog.exec() == QDialog::Accepted && !dialog.textValue().isEmpty()) {
|
||||
RsFeedAddResult result = mFeedReader->setFolder(feedId, dialog.textValue().toUtf8().constData());
|
||||
AddFeedDialog::showError(this, result, tr("Create folder"), tr("Cannot create folder."));
|
||||
FeedReaderStringDefs::showError(this, result, tr("Create folder"), tr("Cannot create folder."));
|
||||
}
|
||||
} else {
|
||||
AddFeedDialog dialog(mFeedReader, this);
|
||||
AddFeedDialog dialog(mFeedReader, mNotify, this);
|
||||
if (!dialog.fillFeed(feedId)) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -47,9 +47,9 @@ protected:
|
|||
bool eventFilter(QObject *obj, QEvent *ev);
|
||||
|
||||
private slots:
|
||||
void feedTreeCustomPopupMenu(QPoint point);
|
||||
void msgTreeCustomPopupMenu(QPoint point);
|
||||
void feedItemChanged(QTreeWidgetItem *item);
|
||||
void feedTreeCustomPopupMenu(QPoint point);
|
||||
void msgTreeCustomPopupMenu(QPoint point);
|
||||
void feedItemChanged(QTreeWidgetItem *item);
|
||||
void msgItemChanged();
|
||||
void msgItemClicked(QTreeWidgetItem *item, int column);
|
||||
void filterColumnChanged();
|
||||
|
|
130
plugins/FeedReader/gui/FeedReaderStringDefs.cpp
Normal file
130
plugins/FeedReader/gui/FeedReaderStringDefs.cpp
Normal file
|
@ -0,0 +1,130 @@
|
|||
/****************************************************************
|
||||
* 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 <QApplication>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "FeedReaderStringDefs.h"
|
||||
|
||||
bool FeedReaderStringDefs::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 = QApplication::translate("FeedReaderStringDefs", "Feed not found.");
|
||||
break;
|
||||
case RS_FEED_ADD_RESULT_PARENT_NOT_FOUND:
|
||||
error = QApplication::translate("FeedReaderStringDefs", "Parent not found.");
|
||||
break;
|
||||
case RS_FEED_ADD_RESULT_PARENT_IS_NO_FOLDER:
|
||||
error = QApplication::translate("FeedReaderStringDefs", "Parent is no folder.");
|
||||
break;
|
||||
case RS_FEED_ADD_RESULT_FEED_IS_FOLDER:
|
||||
error = QApplication::translate("FeedReaderStringDefs", "Feed is a folder.");
|
||||
break;
|
||||
case RS_FEED_ADD_RESULT_FEED_IS_NO_FOLDER:
|
||||
error = QApplication::translate("FeedReaderStringDefs", "Feed is no folder.");
|
||||
break;
|
||||
default:
|
||||
error = QApplication::translate("FeedReaderStringDefs", "Unknown error occured.");
|
||||
}
|
||||
|
||||
QMessageBox::critical(parent, title, text + "\n" + error);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QString FeedReaderStringDefs::workState(FeedInfo::WorkState state)
|
||||
{
|
||||
switch (state) {
|
||||
case FeedInfo::WAITING:
|
||||
return "";
|
||||
case FeedInfo::WAITING_TO_DOWNLOAD:
|
||||
return QApplication::translate("FeedReaderStringDefs", "Waiting for download");
|
||||
case FeedInfo::DOWNLOADING:
|
||||
return QApplication::translate("FeedReaderStringDefs", "Downloading");
|
||||
case FeedInfo::WAITING_TO_PROCESS:
|
||||
return QApplication::translate("FeedReaderStringDefs", "Waiting for process");
|
||||
case FeedInfo::PROCESSING:
|
||||
return QApplication::translate("FeedReaderStringDefs", "Processing");
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
QString FeedReaderStringDefs::errorString(const FeedInfo &feedInfo)
|
||||
{
|
||||
QString errorState;
|
||||
switch (feedInfo.errorState) {
|
||||
case RS_FEED_ERRORSTATE_OK:
|
||||
break;
|
||||
|
||||
/* download */
|
||||
case RS_FEED_ERRORSTATE_DOWNLOAD_INTERNAL_ERROR:
|
||||
errorState = QApplication::translate("FeedReaderStringDefs", "Internal download error");
|
||||
break;
|
||||
case RS_FEED_ERRORSTATE_DOWNLOAD_ERROR:
|
||||
errorState = QApplication::translate("FeedReaderStringDefs", "Download error");
|
||||
break;
|
||||
case RS_FEED_ERRORSTATE_DOWNLOAD_UNKNOWN_CONTENT_TYPE:
|
||||
errorState = QApplication::translate("FeedReaderStringDefs", "Unknown content type");
|
||||
break;
|
||||
case RS_FEED_ERRORSTATE_DOWNLOAD_NOT_FOUND:
|
||||
errorState = QApplication::translate("FeedReaderStringDefs", "Download not found");
|
||||
break;
|
||||
case RS_FEED_ERRORSTATE_DOWNLOAD_UNKOWN_RESPONSE_CODE:
|
||||
errorState = QApplication::translate("FeedReaderStringDefs", "Unknown response code");
|
||||
break;
|
||||
|
||||
/* process */
|
||||
case RS_FEED_ERRORSTATE_PROCESS_INTERNAL_ERROR:
|
||||
errorState = QApplication::translate("FeedReaderStringDefs", "Internal process error");
|
||||
break;
|
||||
case RS_FEED_ERRORSTATE_PROCESS_UNKNOWN_FORMAT:
|
||||
errorState = QApplication::translate("FeedReaderStringDefs", "Unknown XML format");
|
||||
break;
|
||||
case RS_FEED_ERRORSTATE_PROCESS_FORUM_CREATE:
|
||||
errorState = QApplication::translate("FeedReaderStringDefs", "Can't create forum");
|
||||
break;
|
||||
case RS_FEED_ERRORSTATE_PROCESS_FORUM_NOT_FOUND:
|
||||
errorState = QApplication::translate("FeedReaderStringDefs", "Forum not found");
|
||||
break;
|
||||
case RS_FEED_ERRORSTATE_PROCESS_FORUM_NO_ADMIN:
|
||||
errorState = QApplication::translate("FeedReaderStringDefs", "You are not admin of the forum");
|
||||
break;
|
||||
case RS_FEED_ERRORSTATE_PROCESS_FORUM_NOT_ANONYMOUS:
|
||||
errorState = QApplication::translate("FeedReaderStringDefs", "The forum is no anonymous forum");
|
||||
break;
|
||||
|
||||
default:
|
||||
errorState = QApplication::translate("FeedReaderStringDefs", "Unknown error");
|
||||
}
|
||||
|
||||
if (!feedInfo.errorString.empty()) {
|
||||
errorState += QString(" (%1)").arg(QString::fromUtf8(feedInfo.errorString.c_str()));
|
||||
}
|
||||
|
||||
return errorState;
|
||||
}
|
39
plugins/FeedReader/gui/FeedReaderStringDefs.h
Normal file
39
plugins/FeedReader/gui/FeedReaderStringDefs.h
Normal file
|
@ -0,0 +1,39 @@
|
|||
/****************************************************************
|
||||
* 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 FEEDREADER_STRINGDEFS_H
|
||||
#define FEEDREADER_STRINGDEFS_H
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include "interface/rsFeedReader.h"
|
||||
|
||||
class QWidget;
|
||||
|
||||
class FeedReaderStringDefs
|
||||
{
|
||||
public:
|
||||
static bool showError(QWidget *parent, RsFeedAddResult result, const QString &title, const QString &text);
|
||||
static QString workState(FeedInfo::WorkState state);
|
||||
static QString errorString(const FeedInfo &feedInfo);
|
||||
};
|
||||
|
||||
#endif
|
427
plugins/FeedReader/gui/PreviewFeedDialog.cpp
Normal file
427
plugins/FeedReader/gui/PreviewFeedDialog.cpp
Normal file
|
@ -0,0 +1,427 @@
|
|||
/****************************************************************
|
||||
* 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 <QPainter>
|
||||
|
||||
#include "PreviewFeedDialog.h"
|
||||
#include "ui_PreviewFeedDialog.h"
|
||||
#include "FeedReaderNotify.h"
|
||||
#include "FeedReaderStringDefs.h"
|
||||
#include "util/HandleRichText.h"
|
||||
|
||||
#include "interface/rsFeedReader.h"
|
||||
#include "retroshare/rsiface.h"
|
||||
#include "util/HTMLWrapper.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
// not yet functional
|
||||
//PreviewItemDelegate::PreviewItemDelegate(QTreeWidget *parent) : QItemDelegate(parent)
|
||||
//{
|
||||
// connect(parent->header(), SIGNAL(sectionResized(int,int,int)), SLOT(sectionResized(int,int,int)));
|
||||
//}
|
||||
|
||||
//void PreviewItemDelegate::sectionResized(int logicalIndex, int /*oldSize*/, int /*newSize*/)
|
||||
//{
|
||||
// QHeaderView *header = dynamic_cast<QHeaderView*>(sender());
|
||||
// if (header) {
|
||||
// QTreeWidget *treeWidget = dynamic_cast<QTreeWidget*>(header->parent());
|
||||
// if (treeWidget) {
|
||||
// QModelIndex index = treeWidget->model()->index(0, logicalIndex, QModelIndex());
|
||||
// emit sizeHintChanged(index);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
//void PreviewItemDelegate::drawDisplay(QPainter *painter, const QStyleOptionViewItem &option, const QRect &rect, const QString &text) const
|
||||
//{
|
||||
// QPen pen(painter->pen());
|
||||
// QFont font(painter->font());
|
||||
// QPalette::ColorGroup colorgroup(option.state & QStyle::State_Enabled ? QPalette::Normal : QPalette::Disabled);
|
||||
|
||||
// QTextOption textOption;
|
||||
// textOption.setWrapMode(QTextOption::WrapAnywhere);
|
||||
// textOption.setAlignment(option.displayAlignment);
|
||||
|
||||
// QRect textRect = rect.adjusted(5, 0, -5, 0); // remove width padding
|
||||
// textRect.setTop(qMin(rect.top(), option.rect.top()));
|
||||
// textRect.setHeight(qMax(rect.height(), option.rect.height()));
|
||||
|
||||
// if (option.state & QStyle::State_Selected) {
|
||||
// painter->fillRect(rect, option.palette.brush(colorgroup, QPalette::Highlight));
|
||||
// painter->setPen(option.palette.color(colorgroup, QPalette::HighlightedText));
|
||||
// } else {
|
||||
// painter->setPen(option.palette.color(colorgroup, QPalette::Text));
|
||||
// }
|
||||
|
||||
// if (option.state & QStyle::State_Editing) {
|
||||
// painter->save();
|
||||
// painter->setPen(option.palette.color(colorgroup, QPalette::Text));
|
||||
// painter->drawRect(rect.adjusted( 0, 0, -1, -1));
|
||||
// painter->restore();
|
||||
// }
|
||||
|
||||
// painter->setFont(option.font);
|
||||
// painter->drawText(textRect, text, textOption);
|
||||
|
||||
// // reset painter
|
||||
// painter->setFont(font);
|
||||
// painter->setPen(pen);
|
||||
//}
|
||||
|
||||
//void PreviewItemDelegate::drawFocus(QPainter *painter, const QStyleOptionViewItem &option, const QRect &rect) const
|
||||
//{
|
||||
// if (option.state & QStyle::State_HasFocus) {
|
||||
// QRect textRect(rect);
|
||||
// textRect.setTop(qMin(rect.top(), option.rect.top()));
|
||||
// textRect.setHeight(qMax(rect.height(), option.rect.height()));
|
||||
|
||||
// QStyleOptionFocusRect optionFocusRect;
|
||||
// optionFocusRect.QStyleOption::operator=(option);
|
||||
// optionFocusRect.rect = textRect;
|
||||
// optionFocusRect.state |= QStyle::State_KeyboardFocusChange;
|
||||
// QPalette::ColorGroup colorgroup = (option.state & QStyle::State_Enabled) ? QPalette::Normal : QPalette::Disabled;
|
||||
// optionFocusRect.backgroundColor = option.palette.color(colorgroup, (option.state & QStyle::State_Selected) ? QPalette::Highlight : QPalette::Background);
|
||||
// QApplication::style()->drawPrimitive(QStyle::PE_FrameFocusRect, &optionFocusRect, painter);
|
||||
// }
|
||||
//}
|
||||
|
||||
//QSize PreviewItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
//{
|
||||
//// static bool inSizeHint = false;
|
||||
|
||||
//// if (inSizeHint) {
|
||||
//// return QSize();
|
||||
//// }
|
||||
//// inSizeHint = true;
|
||||
|
||||
// //d->viewport->width()
|
||||
// QSize size = QItemDelegate::sizeHint(option, index);
|
||||
// size.setHeight(50);
|
||||
|
||||
//// QTreeWidget *treeWidget = dynamic_cast<QTreeWidget*>(parent());
|
||||
//// if (treeWidget) {
|
||||
//// size.setWidth(treeWidget->header()->sectionSize(index.column()));
|
||||
|
||||
//// QString text = index.data(Qt::DisplayRole).toString();
|
||||
//// QRect displayRect = textRectangle(NULL, QRect(0, 0, size.width(), size.height()), option.font, text);
|
||||
//// QRect displayRect = treeWidget->visualRect(index);
|
||||
//// int width = treeWidget->columnWidth(index.column());
|
||||
//// int height = option.fontMetrics.boundingRect(QRect(0, 0, size.width(), 0), Qt::TextWrapAnywhere | Qt::TextLongestVariant, text).height();
|
||||
|
||||
//// if (height > size.height()) {
|
||||
//// size.setHeight(height);
|
||||
//// }
|
||||
//// }
|
||||
|
||||
//// inSizeHint = false;
|
||||
|
||||
// return size;
|
||||
//}
|
||||
|
||||
PreviewFeedDialog::PreviewFeedDialog(RsFeedReader *feedReader, FeedReaderNotify *notify, const FeedInfo &feedInfo, QWidget *parent) :
|
||||
QDialog(parent), mFeedReader(feedReader), mNotify(notify), ui(new Ui::PreviewFeedDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->feedNameLabel->clear();
|
||||
ui->feedInfoLabel->clear();
|
||||
|
||||
/* connect signals */
|
||||
connect(ui->previousPushButton, SIGNAL(clicked()), this, SLOT(previousMsg()));
|
||||
connect(ui->nextPushButton, SIGNAL(clicked()), this, SLOT(nextMsg()));
|
||||
connect(ui->documentButton, SIGNAL(toggled(bool)), this, SLOT(showDocumentFrame(bool)));
|
||||
|
||||
connect(mNotify, SIGNAL(notifyFeedChanged(QString,int)), this, SLOT(feedChanged(QString,int)));
|
||||
connect(mNotify, SIGNAL(notifyMsgChanged(QString,QString,int)), this, SLOT(msgChanged(QString,QString,int)));
|
||||
|
||||
// ui->documentTreeWidget->setItemDelegate(new PreviewItemDelegate(ui->documentTreeWidget));
|
||||
showDocumentFrame(false);
|
||||
|
||||
if (!mFeedReader->addPreviewFeed(feedInfo, mFeedId)) {
|
||||
setInfo(tr("Cannot create preview"));
|
||||
}
|
||||
|
||||
updateMsgCount();
|
||||
}
|
||||
|
||||
PreviewFeedDialog::~PreviewFeedDialog()
|
||||
{
|
||||
disconnect(mNotify);
|
||||
disconnect(mNotify);
|
||||
|
||||
if (!mFeedId.empty()) {
|
||||
mFeedReader->removeFeed(mFeedId);
|
||||
}
|
||||
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void PreviewFeedDialog::feedChanged(const QString &feedId, int type)
|
||||
{
|
||||
if (feedId.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (feedId.toStdString() != mFeedId) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (type == NOTIFY_TYPE_DEL) {
|
||||
/* feed deleted */
|
||||
mFeedId.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
if (type == NOTIFY_TYPE_ADD || type == NOTIFY_TYPE_MOD) {
|
||||
FeedInfo feedInfo;
|
||||
if (!mFeedReader->getFeedInfo(mFeedId, feedInfo)) {
|
||||
return;
|
||||
}
|
||||
fillFeedInfo(feedInfo);
|
||||
}
|
||||
}
|
||||
|
||||
void PreviewFeedDialog::msgChanged(const QString &feedId, const QString &msgId, int type)
|
||||
{
|
||||
if (feedId.isEmpty() || msgId.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (feedId.toStdString() != mFeedId) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case NOTIFY_TYPE_ADD:
|
||||
if (mMsgId.empty()) {
|
||||
mMsgId = msgId.toStdString();
|
||||
updateMsg();
|
||||
}
|
||||
break;
|
||||
case NOTIFY_TYPE_MOD:
|
||||
if (mMsgId == msgId.toStdString()) {
|
||||
updateMsg();
|
||||
}
|
||||
break;
|
||||
case NOTIFY_TYPE_DEL:
|
||||
if (mMsgId == msgId.toStdString()) {
|
||||
std::list<std::string>::iterator it = std::find(mMsgIds.begin(), mMsgIds.end(), mMsgId);
|
||||
if (it != mMsgIds.end()) {
|
||||
++it;
|
||||
if (it != mMsgIds.end()) {
|
||||
mMsgId = *it;
|
||||
} else {
|
||||
--it;
|
||||
if (it != mMsgIds.begin()) {
|
||||
--it;
|
||||
mMsgId = *it;
|
||||
} else {
|
||||
mMsgId.clear();
|
||||
}
|
||||
}
|
||||
updateMsg();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/* calculate message count */
|
||||
mMsgIds.clear();
|
||||
mFeedReader->getFeedMsgIdList(mFeedId, mMsgIds);
|
||||
|
||||
updateMsgCount();
|
||||
}
|
||||
|
||||
void PreviewFeedDialog::showDocumentFrame(bool show)
|
||||
{
|
||||
ui->documentFrame->setVisible(show);
|
||||
ui->documentButton->setChecked(show);
|
||||
|
||||
if (show) {
|
||||
ui->documentButton->setToolTip(tr("Hide tree"));
|
||||
ui->documentButton->setIcon(QIcon(":images/hide_toolbox_frame.png"));
|
||||
|
||||
fillDocumentTree();
|
||||
} else {
|
||||
ui->documentButton->setToolTip(tr("Show tree"));
|
||||
ui->documentButton->setIcon(QIcon(":images/show_toolbox_frame.png"));
|
||||
}
|
||||
}
|
||||
|
||||
int PreviewFeedDialog::getMsgPos()
|
||||
{
|
||||
int pos = -1;
|
||||
std::list<std::string>::iterator it;
|
||||
for (it = mMsgIds.begin(); it != mMsgIds.end(); ++it) {
|
||||
++pos;
|
||||
if (*it == mMsgId) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return pos;
|
||||
}
|
||||
|
||||
void PreviewFeedDialog::setInfo(const QString &info)
|
||||
{
|
||||
ui->feedInfoLabel->setText(info);
|
||||
|
||||
ui->infoLabel->setVisible(!info.isEmpty());
|
||||
ui->feedInfoLabel->setVisible(!info.isEmpty());
|
||||
}
|
||||
|
||||
void PreviewFeedDialog::fillFeedInfo(const FeedInfo &feedInfo)
|
||||
{
|
||||
QString name = feedInfo.name.empty() ? tr("No name") : QString::fromUtf8(feedInfo.name.c_str());
|
||||
|
||||
QString workState = FeedReaderStringDefs::workState(feedInfo.workstate);
|
||||
if (!workState.isEmpty()) {
|
||||
name += QString(" (%1)").arg(workState);
|
||||
}
|
||||
ui->feedNameLabel->setText(name);
|
||||
|
||||
setInfo(FeedReaderStringDefs::errorString(feedInfo));
|
||||
}
|
||||
|
||||
void PreviewFeedDialog::previousMsg()
|
||||
{
|
||||
std::list<std::string>::iterator it = std::find(mMsgIds.begin(), mMsgIds.end(), mMsgId);
|
||||
if (it != mMsgIds.end()) {
|
||||
if (it != mMsgIds.begin()) {
|
||||
--it;
|
||||
mMsgId = *it;
|
||||
updateMsg();
|
||||
updateMsgCount();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PreviewFeedDialog::nextMsg()
|
||||
{
|
||||
std::list<std::string>::iterator it = std::find(mMsgIds.begin(), mMsgIds.end(), mMsgId);
|
||||
if (it != mMsgIds.end()) {
|
||||
++it;
|
||||
if (it != mMsgIds.end()) {
|
||||
mMsgId = *it;
|
||||
updateMsg();
|
||||
updateMsgCount();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PreviewFeedDialog::updateMsgCount()
|
||||
{
|
||||
int pos = getMsgPos();
|
||||
ui->messageCountLabel->setText(QString("%1/%2").arg(pos + 1).arg(mMsgIds.size()));
|
||||
|
||||
ui->previousPushButton->setEnabled(pos > 0);
|
||||
ui->nextPushButton->setEnabled(pos + 1 < (int) mMsgIds.size());
|
||||
}
|
||||
|
||||
void PreviewFeedDialog::updateMsg()
|
||||
{
|
||||
FeedMsgInfo msgInfo;
|
||||
if (mMsgId.empty() || !mFeedReader->getMsgInfo(mFeedId, mMsgId, msgInfo)) {
|
||||
ui->msgTitle->clear();
|
||||
ui->msgText->clear();
|
||||
mDescription.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
mDescription = msgInfo.description;
|
||||
QString msgTxt = RsHtml().formatText(ui->msgText->document(), QString::fromUtf8(mDescription.c_str()), RSHTML_FORMATTEXT_EMBED_LINKS);
|
||||
|
||||
ui->msgText->setHtml(msgTxt);
|
||||
ui->msgTitle->setText(QString::fromUtf8(msgInfo.title.c_str()));
|
||||
|
||||
ui->documentTreeWidget->clear();
|
||||
fillDocumentTree();
|
||||
}
|
||||
|
||||
static void examineChildElements(QTreeWidget *treeWidget, HTMLWrapper &html, xmlNodePtr node, QTreeWidgetItem *parentItem)
|
||||
{
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem;
|
||||
QString text;
|
||||
if (node->type == XML_ELEMENT_NODE) {
|
||||
text = QString("<%1 ").arg(QString::fromUtf8(html.nodeName(node).c_str()));
|
||||
|
||||
for (xmlAttrPtr attr = node->properties; attr; attr = attr->next) {
|
||||
QString value = QString::fromUtf8(html.getAttr(node, attr).c_str());
|
||||
if (value.length() > 100) {
|
||||
value = value.left(100) + "...";
|
||||
}
|
||||
text += QString("%1=\"%2\" ").arg(QString::fromUtf8(html.attrName(attr).c_str()), value);
|
||||
}
|
||||
text = text.trimmed() + ">";
|
||||
} else {
|
||||
std::string content;
|
||||
if (html.getContent(node, content)) {
|
||||
text = QString::fromUtf8(content.c_str());
|
||||
} else {
|
||||
text = QApplication::translate("PreviewFeedDialog", "Error getting content");
|
||||
}
|
||||
}
|
||||
item->setText(0, text);
|
||||
parentItem->addChild(item);
|
||||
|
||||
// QLabel *label = new QLabel(text);
|
||||
// label->setTextFormat(Qt::PlainText);
|
||||
// label->setWordWrap(true);
|
||||
// treeWidget->setItemWidget(item, 0, label);
|
||||
|
||||
item->setExpanded(true);
|
||||
|
||||
for (xmlNodePtr child = node->children; child; child = child->next) {
|
||||
examineChildElements(treeWidget, html, child, item);
|
||||
}
|
||||
}
|
||||
|
||||
void PreviewFeedDialog::fillDocumentTree()
|
||||
{
|
||||
if (!ui->documentTreeWidget->isVisible()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ui->documentTreeWidget->topLevelItemCount() > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mDescription.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
HTMLWrapper html;
|
||||
if (!html.readHTML(mDescription.c_str(), "")) {
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem;
|
||||
item->setText(0, tr("Error parsing document"));
|
||||
ui->documentTreeWidget->addTopLevelItem(item);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
xmlNodePtr root = html.getRootElement();
|
||||
if (!root) {
|
||||
return;
|
||||
}
|
||||
|
||||
examineChildElements(ui->documentTreeWidget, html, root, ui->documentTreeWidget->invisibleRootItem());
|
||||
}
|
89
plugins/FeedReader/gui/PreviewFeedDialog.h
Normal file
89
plugins/FeedReader/gui/PreviewFeedDialog.h
Normal file
|
@ -0,0 +1,89 @@
|
|||
/****************************************************************
|
||||
* 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 PREVIEWFEEDDIALOG_H
|
||||
#define PREVIEWFEEDDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QItemDelegate>
|
||||
|
||||
namespace Ui {
|
||||
class PreviewFeedDialog;
|
||||
}
|
||||
|
||||
class QTreeWidget;
|
||||
class RsFeedReader;
|
||||
class FeedReaderNotify;
|
||||
class FeedInfo;
|
||||
|
||||
// not yet functional
|
||||
//class PreviewItemDelegate : public QItemDelegate
|
||||
//{
|
||||
// Q_OBJECT
|
||||
|
||||
//public:
|
||||
// PreviewItemDelegate(QTreeWidget *parent);
|
||||
|
||||
//private slots:
|
||||
// void sectionResized(int logicalIndex, int oldSize, int newSize);
|
||||
|
||||
//protected:
|
||||
// virtual void drawDisplay(QPainter *painter, const QStyleOptionViewItem &option, const QRect &rect, const QString &text) const;
|
||||
// virtual void drawFocus(QPainter *painter, const QStyleOptionViewItem &option, const QRect &rect) const;
|
||||
// virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||
//};
|
||||
|
||||
class PreviewFeedDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PreviewFeedDialog(RsFeedReader *feedReader, FeedReaderNotify *notify, const FeedInfo &feedInfo, QWidget *parent = 0);
|
||||
~PreviewFeedDialog();
|
||||
|
||||
private slots:
|
||||
void previousMsg();
|
||||
void nextMsg();
|
||||
void showDocumentFrame(bool show);
|
||||
|
||||
/* FeedReaderNotify */
|
||||
void feedChanged(const QString &feedId, int type);
|
||||
void msgChanged(const QString &feedId, const QString &msgId, int type);
|
||||
|
||||
private:
|
||||
int getMsgPos();
|
||||
void setInfo(const QString &info);
|
||||
void fillFeedInfo(const FeedInfo &feedInfo);
|
||||
void updateMsgCount();
|
||||
void updateMsg();
|
||||
void fillDocumentTree();
|
||||
|
||||
RsFeedReader *mFeedReader;
|
||||
FeedReaderNotify *mNotify;
|
||||
std::string mFeedId;
|
||||
std::string mMsgId;
|
||||
std::list<std::string> mMsgIds;
|
||||
std::string mDescription;
|
||||
|
||||
Ui::PreviewFeedDialog *ui;
|
||||
};
|
||||
|
||||
#endif // PREVIEWFEEDDIALOG_H
|
314
plugins/FeedReader/gui/PreviewFeedDialog.ui
Normal file
314
plugins/FeedReader/gui/PreviewFeedDialog.ui
Normal file
|
@ -0,0 +1,314 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PreviewFeedDialog</class>
|
||||
<widget class="QDialog" name="PreviewFeedDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>500</width>
|
||||
<height>350</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Preview</string>
|
||||
</property>
|
||||
<property name="sizeGripEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="textLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="nameLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="feedNameLabel">
|
||||
<property name="text">
|
||||
<string>Feed name</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="infoLabel">
|
||||
<property name="text">
|
||||
<string>Information:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="feedInfoLabel">
|
||||
<property name="text">
|
||||
<string>Information</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="navigateLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_1">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="previousPushButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Previous</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="messageCountLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0/0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="nextPushButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Next</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="titleLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="titleLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Titel:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="msgTitle">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<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>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="msgLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="leftSidelLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="documentButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>14</width>
|
||||
<height>31</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>14</width>
|
||||
<height>31</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>31</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="spacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>12</width>
|
||||
<height>329</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="documentFrame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTreeWidget" name="documentTreeWidget">
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="headerVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string notr="true">1</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextBrowser" name="msgText"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="previewLayout">
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>PreviewFeedDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>258</x>
|
||||
<y>339</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>PreviewFeedDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>326</x>
|
||||
<y>339</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
Loading…
Add table
Add a link
Reference in a new issue