mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-12-01 22:30:13 +01:00
2021-02-09 Fred Gleason <fredg@paravelsystems.com>
* Refactored the 'Log Grids' dialog in rdlogmanager(1) to use the model based API. Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
@@ -21090,3 +21090,6 @@
|
|||||||
* Added a 'RDClockModel' model.
|
* Added a 'RDClockModel' model.
|
||||||
* Refactored the 'Edit Clock' dialog in rdlogmanager(1) to use
|
* Refactored the 'Edit Clock' dialog in rdlogmanager(1) to use
|
||||||
the model base API.
|
the model base API.
|
||||||
|
2021-02-09 Fred Gleason <fredg@paravelsystems.com>
|
||||||
|
* Refactored the 'Log Grids' dialog in rdlogmanager(1) to use
|
||||||
|
the model based API.
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
//
|
//
|
||||||
// List Rivendell Log Grids
|
// List Rivendell Log Grids
|
||||||
//
|
//
|
||||||
// (C) Copyright 2002-2019 Fred Gleason <fredg@paravelsystems.com>
|
// (C) Copyright 2002-2021 Fred Gleason <fredg@paravelsystems.com>
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// 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
|
// it under the terms of the GNU General Public License version 2 as
|
||||||
@@ -36,16 +36,21 @@ ListGrids::ListGrids(QWidget *parent)
|
|||||||
//
|
//
|
||||||
// Grids List
|
// Grids List
|
||||||
//
|
//
|
||||||
edit_grids_list=new Q3ListView(this);
|
edit_grids_view=new RDTableView(this);
|
||||||
edit_grids_list->setGeometry(10,10,
|
edit_grids_view->
|
||||||
sizeHint().width()-20,sizeHint().height()-80);
|
setGeometry(10,10,sizeHint().width()-20,sizeHint().height()-80);
|
||||||
edit_grids_list->setAllColumnsShowFocus(true);
|
edit_grids_model=new RDServiceListModel(false,this);
|
||||||
edit_grids_list->setItemMargin(5);
|
edit_grids_model->setFont(font());
|
||||||
edit_grids_list->addColumn(tr("Name"));
|
edit_grids_model->setPalette(palette());
|
||||||
edit_grids_list->addColumn(tr("Description"));
|
edit_grids_view->setModel(edit_grids_model);
|
||||||
connect(edit_grids_list,
|
for(int i=2;i<edit_grids_model->columnCount();i++) {
|
||||||
SIGNAL(doubleClicked(Q3ListViewItem *,const QPoint &,int)),
|
edit_grids_view->hideColumn(i);
|
||||||
this,SLOT(doubleClickedData(Q3ListViewItem *,const QPoint &,int)));
|
}
|
||||||
|
connect(edit_grids_view,SIGNAL(doubleClicked(const QModelIndex &)),
|
||||||
|
this,SLOT(doubleClickedData(const QModelIndex &)));
|
||||||
|
connect(edit_grids_model,SIGNAL(modelReset()),
|
||||||
|
edit_grids_view,SLOT(resizeColumnsToContents()));
|
||||||
|
edit_grids_view->resizeColumnsToContents();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Edit Button
|
// Edit Button
|
||||||
@@ -65,8 +70,6 @@ ListGrids::ListGrids(QWidget *parent)
|
|||||||
button->setFont(buttonFont());
|
button->setFont(buttonFont());
|
||||||
button->setText(tr("C&lose"));
|
button->setText(tr("C&lose"));
|
||||||
connect(button,SIGNAL(clicked()),this,SLOT(closeData()));
|
connect(button,SIGNAL(clicked()),this,SLOT(closeData()));
|
||||||
|
|
||||||
RefreshList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -84,17 +87,18 @@ QSizePolicy ListGrids::sizePolicy() const
|
|||||||
|
|
||||||
void ListGrids::editData()
|
void ListGrids::editData()
|
||||||
{
|
{
|
||||||
Q3ListViewItem *item=edit_grids_list->selectedItem();
|
QModelIndexList rows=edit_grids_view->selectionModel()->selectedRows();
|
||||||
if(item==NULL) {
|
|
||||||
|
if(rows.size()!=1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
EditGrid *grid_dialog=new EditGrid(item->text(0),this);
|
EditGrid *d=new EditGrid(edit_grids_model->serviceName(rows.first()),this);
|
||||||
grid_dialog->exec();
|
d->exec();
|
||||||
delete grid_dialog;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ListGrids::doubleClickedData(Q3ListViewItem *item,const QPoint &,int)
|
void ListGrids::doubleClickedData(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
editData();
|
editData();
|
||||||
}
|
}
|
||||||
@@ -102,25 +106,5 @@ void ListGrids::doubleClickedData(Q3ListViewItem *item,const QPoint &,int)
|
|||||||
|
|
||||||
void ListGrids::closeData()
|
void ListGrids::closeData()
|
||||||
{
|
{
|
||||||
done(0);
|
done(true);
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ListGrids::RefreshList()
|
|
||||||
{
|
|
||||||
Q3ListViewItem *prev_item=edit_grids_list->selectedItem();
|
|
||||||
QString sql="select NAME,DESCRIPTION from SERVICES";
|
|
||||||
|
|
||||||
edit_grids_list->clear();
|
|
||||||
RDSqlQuery *q=new RDSqlQuery(sql);
|
|
||||||
Q3ListViewItem *item=NULL;
|
|
||||||
while(q->next()) {
|
|
||||||
item=new Q3ListViewItem(edit_grids_list);
|
|
||||||
item->setText(0,q->value(0).toString());
|
|
||||||
item->setText(1,q->value(1).toString());
|
|
||||||
}
|
|
||||||
delete q;
|
|
||||||
if(prev_item!=NULL) {
|
|
||||||
edit_grids_list->setSelected(item,true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
//
|
//
|
||||||
// List Rivendell Log Grids
|
// List Rivendell Log Grids
|
||||||
//
|
//
|
||||||
// (C) Copyright 2002-2019 Fred Gleason <fredg@paravelsystems.com>
|
// (C) Copyright 2002-2021 Fred Gleason <fredg@paravelsystems.com>
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// 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
|
// it under the terms of the GNU General Public License version 2 as
|
||||||
@@ -21,9 +21,9 @@
|
|||||||
#ifndef LIST_GRIDS_H
|
#ifndef LIST_GRIDS_H
|
||||||
#define LIST_GRIDS_H
|
#define LIST_GRIDS_H
|
||||||
|
|
||||||
#include <q3listview.h>
|
|
||||||
|
|
||||||
#include <rddialog.h>
|
#include <rddialog.h>
|
||||||
|
#include <rdservicelistmodel.h>
|
||||||
|
#include <rdtableview.h>
|
||||||
|
|
||||||
class ListGrids : public RDDialog
|
class ListGrids : public RDDialog
|
||||||
{
|
{
|
||||||
@@ -35,14 +35,13 @@ class ListGrids : public RDDialog
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void editData();
|
void editData();
|
||||||
void doubleClickedData(Q3ListViewItem *,const QPoint &,int);
|
void doubleClickedData(const QModelIndex &index);
|
||||||
void closeData();
|
void closeData();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void RefreshList();
|
RDTableView *edit_grids_view;
|
||||||
Q3ListView *edit_grids_list;
|
RDServiceListModel *edit_grids_model;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif // LIST_GRIDS_H
|
||||||
|
|
||||||
|
|||||||
@@ -1417,11 +1417,11 @@ delete</source>
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Name</source>
|
<source>Name</source>
|
||||||
<translation>Název</translation>
|
<translation type="obsolete">Název</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Description</source>
|
<source>Description</source>
|
||||||
<translation>Popis</translation>
|
<translation type="obsolete">Popis</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>&Edit</source>
|
<source>&Edit</source>
|
||||||
|
|||||||
@@ -1417,11 +1417,11 @@ delete</source>
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Name</source>
|
<source>Name</source>
|
||||||
<translation>Name</translation>
|
<translation type="obsolete">Name</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Description</source>
|
<source>Description</source>
|
||||||
<translation>Beschreibung</translation>
|
<translation type="obsolete">Beschreibung</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>&Edit</source>
|
<source>&Edit</source>
|
||||||
|
|||||||
@@ -1421,11 +1421,11 @@ eliminar</translation>
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Name</source>
|
<source>Name</source>
|
||||||
<translation>Nombre</translation>
|
<translation type="obsolete">Nombre</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Description</source>
|
<source>Description</source>
|
||||||
<translation>Descripción</translation>
|
<translation type="obsolete">Descripción</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>&Edit</source>
|
<source>&Edit</source>
|
||||||
|
|||||||
@@ -1054,14 +1054,6 @@ Do you want to save?</source>
|
|||||||
<source>Log Grids</source>
|
<source>Log Grids</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Name</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>Description</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>&Edit</source>
|
<source>&Edit</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
|
|||||||
@@ -1416,11 +1416,11 @@ sletta</translation>
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Name</source>
|
<source>Name</source>
|
||||||
<translation>Namn</translation>
|
<translation type="obsolete">Namn</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Description</source>
|
<source>Description</source>
|
||||||
<translation>Skildring</translation>
|
<translation type="obsolete">Skildring</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>&Edit</source>
|
<source>&Edit</source>
|
||||||
|
|||||||
@@ -1416,11 +1416,11 @@ sletta</translation>
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Name</source>
|
<source>Name</source>
|
||||||
<translation>Namn</translation>
|
<translation type="obsolete">Namn</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Description</source>
|
<source>Description</source>
|
||||||
<translation>Skildring</translation>
|
<translation type="obsolete">Skildring</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>&Edit</source>
|
<source>&Edit</source>
|
||||||
|
|||||||
@@ -1421,11 +1421,11 @@ deletar</translation>
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Name</source>
|
<source>Name</source>
|
||||||
<translation>Nome</translation>
|
<translation type="obsolete">Nome</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Description</source>
|
<source>Description</source>
|
||||||
<translation>Descrição</translation>
|
<translation type="obsolete">Descrição</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>&Edit</source>
|
<source>&Edit</source>
|
||||||
|
|||||||
Reference in New Issue
Block a user