mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-10-16 23:51:20 +02:00
2022-09-06 Fred Gleason <fredg@paravelsystems.com>
* Added an Online Feed Report to rdcastmanager(1). Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// A PodCast Management Utility for Rivendell.
|
||||
//
|
||||
// (C) Copyright 2002-2021 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2002-2022 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <rdconf.h>
|
||||
#include <rdescape_string.h>
|
||||
#include <rdpodcast.h>
|
||||
#include <rdtextfile.h>
|
||||
|
||||
#include "edit_cast.h"
|
||||
#include "globals.h"
|
||||
@@ -125,6 +126,15 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent)
|
||||
cast_copy_button->setDisabled(true);
|
||||
connect(cast_copy_button,SIGNAL(clicked()),this,SLOT(copyData()));
|
||||
|
||||
//
|
||||
// Report Button
|
||||
//
|
||||
cast_report_button=new QPushButton(this);
|
||||
cast_report_button->setFont(buttonFont());
|
||||
cast_report_button->setText(tr("Online Feed\nReport"));
|
||||
cast_report_button->setDisabled(true);
|
||||
connect(cast_report_button,SIGNAL(clicked()),this,SLOT(reportData()));
|
||||
|
||||
//
|
||||
// Close Button
|
||||
//
|
||||
@@ -179,6 +189,7 @@ void MainWidget::selectionChangedData(const QItemSelection &before,
|
||||
|
||||
cast_open_button->setEnabled(rows.size()==1);
|
||||
cast_copy_button->setEnabled(rows.size()==1);
|
||||
cast_report_button->setEnabled(rows.size()==1);
|
||||
if(cast_feed_model->isFeed(rows.first())) {
|
||||
cast_open_button->setText(tr("View\nFeed"));
|
||||
}
|
||||
@@ -225,6 +236,31 @@ void MainWidget::copyData()
|
||||
}
|
||||
|
||||
|
||||
void MainWidget::reportData()
|
||||
{
|
||||
QModelIndexList rows=cast_feed_view->selectionModel()->selectedRows();
|
||||
|
||||
if(rows.size()!=1) {
|
||||
return;
|
||||
}
|
||||
QString err_msg;
|
||||
QString url=cast_feed_model->
|
||||
data(cast_feed_model->index(rows.at(0).row(),6)).toString();
|
||||
cast_temp_directories.push_back(new RDTempDirectory("rdcastmanager-report"));
|
||||
if(!cast_temp_directories.last()->create(&err_msg)) {
|
||||
QMessageBox::warning(this,"RDCastManager - "+tr("Error"),
|
||||
tr("Unable to create temporary directory.")+"\n"+
|
||||
"["+err_msg+"]");
|
||||
return;
|
||||
}
|
||||
QString tmpfile=cast_temp_directories.last()->path()+"/report.html";
|
||||
QString cmd="curl -f -s "+url+" | xsltproc --encoding utf-8 /usr/share/rivendell/rdcastmanager-report.xsl - > "+tmpfile;
|
||||
printf("CMD: %s\n",cmd.toUtf8().constData());
|
||||
system(cmd.toUtf8());
|
||||
RDWebBrowser("file://"+tmpfile);
|
||||
}
|
||||
|
||||
|
||||
void MainWidget::feedDoubleClickedData(const QModelIndex &index)
|
||||
{
|
||||
openData();
|
||||
@@ -233,28 +269,32 @@ void MainWidget::feedDoubleClickedData(const QModelIndex &index)
|
||||
|
||||
void MainWidget::quitMainWidget()
|
||||
{
|
||||
for(int i=0;i<cast_temp_directories.size();i++) {
|
||||
delete cast_temp_directories.at(i);
|
||||
}
|
||||
saveSettings();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
void MainWidget::closeEvent(QCloseEvent *e)
|
||||
{
|
||||
quitMainWidget();
|
||||
}
|
||||
|
||||
|
||||
void MainWidget::resizeEvent(QResizeEvent *e)
|
||||
{
|
||||
if(cast_resize) {
|
||||
cast_feed_view->setGeometry(10,10,size().width()-20,size().height()-70);
|
||||
cast_open_button->setGeometry(10,size().height()-55,80,50);
|
||||
cast_copy_button->setGeometry(120,size().height()-55,100,50);
|
||||
cast_copy_button->setGeometry(110,size().height()-55,100,50);
|
||||
cast_report_button->setGeometry(230,size().height()-55,100,50);
|
||||
cast_close_button->setGeometry(size().width()-90,size().height()-55,80,50);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWidget::closeEvent(QCloseEvent *e)
|
||||
{
|
||||
quitMainWidget();
|
||||
}
|
||||
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
QApplication::setStyle(RD_GUI_STYLE);
|
||||
|
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// A RSS Feed Management Utility for Rivendell.
|
||||
//
|
||||
// (C) Copyright 2002-2021 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2002-2022 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
@@ -22,12 +22,14 @@
|
||||
#define RDCASTMANAGER_H
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QList>
|
||||
|
||||
#include <rdconfig.h>
|
||||
#include <rdfeedlistmodel.h>
|
||||
#include <rdlog_line.h>
|
||||
#include <rdmainwindow.h>
|
||||
#include <rdtreeview.h>
|
||||
#include <rdtempdirectory.h>
|
||||
#include <rdwidget.h>
|
||||
|
||||
#define RDCASTMANAGER_USAGE "\n"
|
||||
@@ -43,6 +45,7 @@ class MainWidget : public RDMainWindow
|
||||
private slots:
|
||||
void openData();
|
||||
void copyData();
|
||||
void reportData();
|
||||
void userChangedData();
|
||||
void modelResetData();
|
||||
void selectionChangedData(const QItemSelection &before,
|
||||
@@ -59,8 +62,10 @@ class MainWidget : public RDMainWindow
|
||||
RDFeedListModel *cast_feed_model;
|
||||
QPushButton *cast_open_button;
|
||||
QPushButton *cast_copy_button;
|
||||
QPushButton *cast_report_button;
|
||||
QPushButton *cast_close_button;
|
||||
bool cast_resize;
|
||||
QList<RDTempDirectory *> cast_temp_directories;
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user