mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-11-29 08:40:12 +01:00
2022-10-20 Fred Gleason <fredg@paravelsystems.com>
* Modified the 'List Grids' dialog in rdlogmanager(1) to show all services, with a 'Has Grid' column. Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
@@ -23535,3 +23535,6 @@
|
||||
* Incremented the database version to 364.
|
||||
2022-10-19 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Added files from 'docs/examples/' to the RPM package.
|
||||
2022-10-20 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Modified the 'List Grids' dialog in rdlogmanager(1) to show
|
||||
all services, with a 'Has Grid' column.
|
||||
|
||||
@@ -49,31 +49,34 @@ RDServiceListModel::RDServiceListModel(bool incl_none,bool exclude_bypass,
|
||||
unsigned center=Qt::AlignCenter;
|
||||
unsigned right=Qt::AlignRight|Qt::AlignVCenter;
|
||||
|
||||
d_headers.push_back(tr("Name"));
|
||||
d_headers.push_back(tr("Name")); // 00
|
||||
d_alignments.push_back(left);
|
||||
|
||||
d_headers.push_back(tr("Description"));
|
||||
d_headers.push_back(tr("Description")); // 01
|
||||
d_alignments.push_back(left);
|
||||
|
||||
d_headers.push_back(tr("Pgm Code"));
|
||||
d_headers.push_back(tr("Pgm Code")); // 02
|
||||
d_alignments.push_back(left);
|
||||
|
||||
d_headers.push_back(tr("Track Group"));
|
||||
d_headers.push_back(tr("Track Group")); // 03
|
||||
d_alignments.push_back(left);
|
||||
|
||||
d_headers.push_back(tr("Log Shelf Life"));
|
||||
d_headers.push_back(tr("Log Shelf Life")); // 04
|
||||
d_alignments.push_back(right);
|
||||
|
||||
d_headers.push_back(tr("ELR Shelf Life"));
|
||||
d_headers.push_back(tr("ELR Shelf Life")); // 05
|
||||
d_alignments.push_back(right);
|
||||
|
||||
d_headers.push_back(tr("Auto Refresh"));
|
||||
d_headers.push_back(tr("Auto Refresh")); // 06
|
||||
d_alignments.push_back(center);
|
||||
|
||||
d_headers.push_back(tr("Chain Log"));
|
||||
d_headers.push_back(tr("Chain Log")); // 07
|
||||
d_alignments.push_back(center);
|
||||
|
||||
d_headers.push_back(tr("Import Markers"));
|
||||
d_headers.push_back(tr("Import Markers")); // 08
|
||||
d_alignments.push_back(center);
|
||||
|
||||
d_headers.push_back(tr("Has Grid")); // 09
|
||||
d_alignments.push_back(center);
|
||||
|
||||
updateModel();
|
||||
@@ -170,6 +173,15 @@ QVariant RDServiceListModel::data(const QModelIndex &index,int role) const
|
||||
}
|
||||
|
||||
|
||||
bool RDServiceListModel::hasGrid(const QModelIndex &index) const
|
||||
{
|
||||
if(index.isValid()) {
|
||||
return d_has_grids.at(index.row());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
QString RDServiceListModel::serviceName(const QModelIndex &row) const
|
||||
{
|
||||
return d_texts.at(row.row()).at(0).toString();
|
||||
@@ -196,6 +208,7 @@ QModelIndex RDServiceListModel::addService(const QString &svcname)
|
||||
list[0]=svcname;
|
||||
d_texts.insert(offset,list);
|
||||
d_icons.insert(offset,list);
|
||||
d_has_grids.insert(offset,"N");
|
||||
updateRowLine(offset);
|
||||
endInsertRows();
|
||||
|
||||
@@ -209,6 +222,7 @@ void RDServiceListModel::removeService(const QModelIndex &row)
|
||||
|
||||
d_texts.removeAt(row.row());
|
||||
d_icons.removeAt(row.row());
|
||||
d_has_grids.removeAt(row.row());
|
||||
|
||||
endRemoveRows();
|
||||
}
|
||||
@@ -266,6 +280,7 @@ void RDServiceListModel::updateModel()
|
||||
beginResetModel();
|
||||
d_texts.clear();
|
||||
d_icons.clear();
|
||||
d_has_grids.clear();
|
||||
if(d_include_none) {
|
||||
d_texts.push_back(texts);
|
||||
d_icons.push_back(texts);
|
||||
@@ -275,11 +290,13 @@ void RDServiceListModel::updateModel()
|
||||
d_texts.back().push_back(QVariant());
|
||||
d_icons.back().push_back(QVariant());
|
||||
}
|
||||
d_has_grids.push_back("N");
|
||||
}
|
||||
q=new RDSqlQuery(sql);
|
||||
while(q->next()) {
|
||||
d_texts.push_back(texts);
|
||||
d_icons.push_back(texts);
|
||||
d_has_grids.push_back("N");
|
||||
updateRow(d_texts.size()-1,q);
|
||||
}
|
||||
delete q;
|
||||
@@ -347,8 +364,18 @@ void RDServiceListModel::updateRow(int row,RDSqlQuery *q)
|
||||
texts.push_back(q->value(8));
|
||||
icons.push_back(QVariant());
|
||||
|
||||
// Has Grid
|
||||
if(q->value(9).toString()=="Y") {
|
||||
texts.push_back("N");
|
||||
}
|
||||
else {
|
||||
texts.push_back("Y");
|
||||
}
|
||||
icons.push_back(QVariant());
|
||||
|
||||
d_texts[row]=texts;
|
||||
d_icons[row]=icons;
|
||||
d_has_grids[row]=q->value(9).toString()!="Y";
|
||||
}
|
||||
|
||||
|
||||
@@ -363,7 +390,8 @@ QString RDServiceListModel::sqlFields() const
|
||||
"`SERVICES`.`ELR_SHELFLIFE`,"+ // 05
|
||||
"`SERVICES`.`AUTO_REFRESH`,"+ // 06
|
||||
"`SERVICES`.`CHAIN_LOG`,"+ // 07
|
||||
"`SERVICES`.`INCLUDE_IMPORT_MARKERS` "+ // 08
|
||||
"`SERVICES`.`INCLUDE_IMPORT_MARKERS`,"+ // 08
|
||||
"`BYPASS_MODE` "+ // 09
|
||||
"from `SERVICES` ";
|
||||
|
||||
return sql;
|
||||
|
||||
@@ -52,6 +52,7 @@ class RDServiceListModel : public QAbstractTableModel
|
||||
QVariant headerData(int section,Qt::Orientation orient,
|
||||
int role=Qt::DisplayRole) const;
|
||||
QVariant data(const QModelIndex &index,int role=Qt::DisplayRole) const;
|
||||
bool hasGrid(const QModelIndex &index) const;
|
||||
QString serviceName(const QModelIndex &row) const;
|
||||
QModelIndex addService(const QString &name);
|
||||
void removeService(const QModelIndex &row);
|
||||
@@ -75,6 +76,7 @@ class RDServiceListModel : public QAbstractTableModel
|
||||
QList<QVariant> d_alignments;
|
||||
QList<QList<QVariant> > d_texts;
|
||||
QList<QList<QVariant> > d_icons;
|
||||
QList<bool> d_has_grids;
|
||||
QMap<QString,QVariant> d_group_color_map;
|
||||
};
|
||||
|
||||
|
||||
@@ -39,13 +39,19 @@ ListGrids::ListGrids(QWidget *parent)
|
||||
edit_grids_view=new RDTableView(this);
|
||||
edit_grids_view->
|
||||
setGeometry(10,10,sizeHint().width()-20,sizeHint().height()-80);
|
||||
edit_grids_model=new RDServiceListModel(false,true,this);
|
||||
edit_grids_model=new RDServiceListModel(false,false,this);
|
||||
edit_grids_model->setFont(font());
|
||||
edit_grids_model->setPalette(palette());
|
||||
edit_grids_view->setModel(edit_grids_model);
|
||||
for(int i=2;i<edit_grids_model->columnCount();i++) {
|
||||
for(int i=2;i<(edit_grids_model->columnCount()-1);i++) {
|
||||
edit_grids_view->hideColumn(i);
|
||||
}
|
||||
connect(edit_grids_view->selectionModel(),
|
||||
SIGNAL(selectionChanged(const QItemSelection &,
|
||||
const QItemSelection &)),
|
||||
this,
|
||||
SLOT(selectionChangedData(const QItemSelection &,
|
||||
const QItemSelection &)));
|
||||
connect(edit_grids_view,SIGNAL(doubleClicked(const QModelIndex &)),
|
||||
this,SLOT(doubleClickedData(const QModelIndex &)));
|
||||
connect(edit_grids_model,SIGNAL(modelReset()),
|
||||
@@ -55,21 +61,23 @@ ListGrids::ListGrids(QWidget *parent)
|
||||
//
|
||||
// Edit Button
|
||||
//
|
||||
QPushButton *button=new QPushButton(this);
|
||||
button->setGeometry(10,sizeHint().height()-60,80,50);
|
||||
button->setFont(buttonFont());
|
||||
button->setText(tr("Edit"));
|
||||
connect(button,SIGNAL(clicked()),this,SLOT(editData()));
|
||||
edit_edit_button=new QPushButton(this);
|
||||
edit_edit_button->setGeometry(10,sizeHint().height()-60,80,50);
|
||||
edit_edit_button->setFont(buttonFont());
|
||||
edit_edit_button->setText(tr("Edit"));
|
||||
edit_edit_button->setDisabled(true);
|
||||
connect(edit_edit_button,SIGNAL(clicked()),this,SLOT(editData()));
|
||||
|
||||
//
|
||||
// Close Button
|
||||
//
|
||||
button=new QPushButton(this);
|
||||
button->setGeometry(sizeHint().width()-90,sizeHint().height()-60,80,50);
|
||||
button->setDefault(true);
|
||||
button->setFont(buttonFont());
|
||||
button->setText(tr("Close"));
|
||||
connect(button,SIGNAL(clicked()),this,SLOT(closeData()));
|
||||
edit_close_button=new QPushButton(this);
|
||||
edit_close_button->
|
||||
setGeometry(sizeHint().width()-90,sizeHint().height()-60,80,50);
|
||||
edit_close_button->setDefault(true);
|
||||
edit_close_button->setFont(buttonFont());
|
||||
edit_close_button->setText(tr("Close"));
|
||||
connect(edit_close_button,SIGNAL(clicked()),this,SLOT(closeData()));
|
||||
}
|
||||
|
||||
|
||||
@@ -89,7 +97,7 @@ void ListGrids::editData()
|
||||
{
|
||||
QModelIndexList rows=edit_grids_view->selectionModel()->selectedRows();
|
||||
|
||||
if(rows.size()!=1) {
|
||||
if((rows.size()!=1)||(!edit_grids_model->hasGrid(rows.at(0)))) {
|
||||
return;
|
||||
}
|
||||
EditGrid *d=new EditGrid(edit_grids_model->serviceName(rows.first()),this);
|
||||
@@ -98,6 +106,19 @@ void ListGrids::editData()
|
||||
}
|
||||
|
||||
|
||||
void ListGrids::selectionChangedData(const QItemSelection &selected,
|
||||
const QItemSelection &previous)
|
||||
{
|
||||
QModelIndexList rows=edit_grids_view->selectionModel()->selectedRows();
|
||||
|
||||
if(rows.size()!=1) {
|
||||
edit_edit_button->setDisabled(true);
|
||||
return;
|
||||
}
|
||||
edit_edit_button->setEnabled(edit_grids_model->hasGrid(rows.at(0)));
|
||||
}
|
||||
|
||||
|
||||
void ListGrids::doubleClickedData(const QModelIndex &index)
|
||||
{
|
||||
editData();
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// List Rivendell Log Grids
|
||||
//
|
||||
// (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
|
||||
@@ -21,6 +21,8 @@
|
||||
#ifndef LIST_GRIDS_H
|
||||
#define LIST_GRIDS_H
|
||||
|
||||
#include <QPushButton>
|
||||
|
||||
#include <rddialog.h>
|
||||
#include <rdservicelistmodel.h>
|
||||
#include <rdtableview.h>
|
||||
@@ -35,12 +37,16 @@ class ListGrids : public RDDialog
|
||||
|
||||
private slots:
|
||||
void editData();
|
||||
void selectionChangedData(const QItemSelection &selected,
|
||||
const QItemSelection &previous);
|
||||
void doubleClickedData(const QModelIndex &index);
|
||||
void closeData();
|
||||
|
||||
private:
|
||||
RDTableView *edit_grids_view;
|
||||
RDServiceListModel *edit_grids_model;
|
||||
QPushButton *edit_edit_button;
|
||||
QPushButton *edit_close_button;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user