mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-10-15 15:11:14 +02: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:
@@ -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