mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-11-25 23:00:21 +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.
|
||||
* Refactored the 'Edit Clock' dialog in rdlogmanager(1) to use
|
||||
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
|
||||
//
|
||||
// (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
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
@@ -36,16 +36,21 @@ ListGrids::ListGrids(QWidget *parent)
|
||||
//
|
||||
// Grids List
|
||||
//
|
||||
edit_grids_list=new Q3ListView(this);
|
||||
edit_grids_list->setGeometry(10,10,
|
||||
sizeHint().width()-20,sizeHint().height()-80);
|
||||
edit_grids_list->setAllColumnsShowFocus(true);
|
||||
edit_grids_list->setItemMargin(5);
|
||||
edit_grids_list->addColumn(tr("Name"));
|
||||
edit_grids_list->addColumn(tr("Description"));
|
||||
connect(edit_grids_list,
|
||||
SIGNAL(doubleClicked(Q3ListViewItem *,const QPoint &,int)),
|
||||
this,SLOT(doubleClickedData(Q3ListViewItem *,const QPoint &,int)));
|
||||
edit_grids_view=new RDTableView(this);
|
||||
edit_grids_view->
|
||||
setGeometry(10,10,sizeHint().width()-20,sizeHint().height()-80);
|
||||
edit_grids_model=new RDServiceListModel(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++) {
|
||||
edit_grids_view->hideColumn(i);
|
||||
}
|
||||
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
|
||||
@@ -65,8 +70,6 @@ ListGrids::ListGrids(QWidget *parent)
|
||||
button->setFont(buttonFont());
|
||||
button->setText(tr("C&lose"));
|
||||
connect(button,SIGNAL(clicked()),this,SLOT(closeData()));
|
||||
|
||||
RefreshList();
|
||||
}
|
||||
|
||||
|
||||
@@ -84,17 +87,18 @@ QSizePolicy ListGrids::sizePolicy() const
|
||||
|
||||
void ListGrids::editData()
|
||||
{
|
||||
Q3ListViewItem *item=edit_grids_list->selectedItem();
|
||||
if(item==NULL) {
|
||||
QModelIndexList rows=edit_grids_view->selectionModel()->selectedRows();
|
||||
|
||||
if(rows.size()!=1) {
|
||||
return;
|
||||
}
|
||||
EditGrid *grid_dialog=new EditGrid(item->text(0),this);
|
||||
grid_dialog->exec();
|
||||
delete grid_dialog;
|
||||
EditGrid *d=new EditGrid(edit_grids_model->serviceName(rows.first()),this);
|
||||
d->exec();
|
||||
delete d;
|
||||
}
|
||||
|
||||
|
||||
void ListGrids::doubleClickedData(Q3ListViewItem *item,const QPoint &,int)
|
||||
void ListGrids::doubleClickedData(const QModelIndex &index)
|
||||
{
|
||||
editData();
|
||||
}
|
||||
@@ -102,25 +106,5 @@ void ListGrids::doubleClickedData(Q3ListViewItem *item,const QPoint &,int)
|
||||
|
||||
void ListGrids::closeData()
|
||||
{
|
||||
done(0);
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
done(true);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// 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
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
@@ -21,9 +21,9 @@
|
||||
#ifndef LIST_GRIDS_H
|
||||
#define LIST_GRIDS_H
|
||||
|
||||
#include <q3listview.h>
|
||||
|
||||
#include <rddialog.h>
|
||||
#include <rdservicelistmodel.h>
|
||||
#include <rdtableview.h>
|
||||
|
||||
class ListGrids : public RDDialog
|
||||
{
|
||||
@@ -35,14 +35,13 @@ class ListGrids : public RDDialog
|
||||
|
||||
private slots:
|
||||
void editData();
|
||||
void doubleClickedData(Q3ListViewItem *,const QPoint &,int);
|
||||
void doubleClickedData(const QModelIndex &index);
|
||||
void closeData();
|
||||
|
||||
private:
|
||||
void RefreshList();
|
||||
Q3ListView *edit_grids_list;
|
||||
RDTableView *edit_grids_view;
|
||||
RDServiceListModel *edit_grids_model;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#endif // LIST_GRIDS_H
|
||||
|
||||
@@ -1417,11 +1417,11 @@ delete</source>
|
||||
</message>
|
||||
<message>
|
||||
<source>Name</source>
|
||||
<translation>Název</translation>
|
||||
<translation type="obsolete">Název</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Description</source>
|
||||
<translation>Popis</translation>
|
||||
<translation type="obsolete">Popis</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Edit</source>
|
||||
|
||||
@@ -1417,11 +1417,11 @@ delete</source>
|
||||
</message>
|
||||
<message>
|
||||
<source>Name</source>
|
||||
<translation>Name</translation>
|
||||
<translation type="obsolete">Name</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Description</source>
|
||||
<translation>Beschreibung</translation>
|
||||
<translation type="obsolete">Beschreibung</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Edit</source>
|
||||
|
||||
@@ -1421,11 +1421,11 @@ eliminar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Name</source>
|
||||
<translation>Nombre</translation>
|
||||
<translation type="obsolete">Nombre</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Description</source>
|
||||
<translation>Descripción</translation>
|
||||
<translation type="obsolete">Descripción</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Edit</source>
|
||||
|
||||
@@ -1054,14 +1054,6 @@ Do you want to save?</source>
|
||||
<source>Log Grids</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Name</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Description</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Edit</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
||||
@@ -1416,11 +1416,11 @@ sletta</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Name</source>
|
||||
<translation>Namn</translation>
|
||||
<translation type="obsolete">Namn</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Description</source>
|
||||
<translation>Skildring</translation>
|
||||
<translation type="obsolete">Skildring</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Edit</source>
|
||||
|
||||
@@ -1416,11 +1416,11 @@ sletta</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Name</source>
|
||||
<translation>Namn</translation>
|
||||
<translation type="obsolete">Namn</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Description</source>
|
||||
<translation>Skildring</translation>
|
||||
<translation type="obsolete">Skildring</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Edit</source>
|
||||
|
||||
@@ -1421,11 +1421,11 @@ deletar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Name</source>
|
||||
<translation>Nome</translation>
|
||||
<translation type="obsolete">Nome</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Description</source>
|
||||
<translation>Descrição</translation>
|
||||
<translation type="obsolete">Descrição</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Edit</source>
|
||||
|
||||
Reference in New Issue
Block a user