mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-05-19 14:43:30 +02:00
2021-02-15 Fred Gleason <fredg@paravelsystems.com>
* Refactored the 'Select Group' dialog to use the model based API. Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
parent
a236f636a5
commit
a12ac4401b
@ -21149,3 +21149,5 @@
|
||||
* Removed the 'Q3RangeControl' dependency from 'RDEditAudio'.
|
||||
2021-02-15 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Removed the 'Q3PointArray' dependency from 'RDEditAudio'.
|
||||
2021-02-15 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Refactored the 'Select Group' dialog to use the model based API.
|
||||
|
@ -3100,11 +3100,11 @@ Bitte Kofiguration prüfen und erneut versuchen.</translation>
|
||||
</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>&OK</source>
|
||||
|
@ -3085,11 +3085,11 @@ Bitte Kofiguration prüfen und erneut versuchen.</translation>
|
||||
</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>&OK</source>
|
||||
|
@ -3080,11 +3080,11 @@ Do you still want to proceed?</source>
|
||||
</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>&OK</source>
|
||||
|
@ -2602,14 +2602,6 @@ Do you want to overwrite it?</source>
|
||||
<source>Select Group</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>&OK</source>
|
||||
<translation type="unfinished">&OK</translation>
|
||||
|
@ -3045,13 +3045,9 @@ Sjekk eksportoppsettet ditt og prøv att.</translation>
|
||||
<source>Select Group</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>NAME</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>DESCRIPTION</source>
|
||||
<translation type="unfinished">SKILDRING</translation>
|
||||
<translation type="obsolete">SKILDRING</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&OK</source>
|
||||
|
@ -3045,13 +3045,9 @@ Sjekk eksportoppsettet ditt og prøv att.</translation>
|
||||
<source>Select Group</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>NAME</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>DESCRIPTION</source>
|
||||
<translation type="unfinished">SKILDRING</translation>
|
||||
<translation type="obsolete">SKILDRING</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&OK</source>
|
||||
|
@ -3073,11 +3073,11 @@ Por Favor, cheque suas configurações e tenbte outra vez.</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>&OK</source>
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// A widget to select a Rivendell Group.
|
||||
//
|
||||
// (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
|
||||
@ -22,7 +22,7 @@
|
||||
#include "rdescape_string.h"
|
||||
#include "rdlist_groups.h"
|
||||
|
||||
RDListGroups::RDListGroups(QString *groupname,const QString &username,
|
||||
RDListGroups::RDListGroups(QString *groupname,const QString &caption,
|
||||
QWidget *parent)
|
||||
: RDDialog(parent)
|
||||
{
|
||||
@ -34,25 +34,26 @@ RDListGroups::RDListGroups(QString *groupname,const QString &username,
|
||||
|
||||
group_name=groupname;
|
||||
|
||||
setWindowTitle(tr("Select Group"));
|
||||
setWindowTitle(caption+" - "+tr("Select Group"));
|
||||
|
||||
//
|
||||
// Cart List
|
||||
//
|
||||
group_group_list=new Q3ListView(this,"group_group_list");
|
||||
group_group_list->setSelectionMode(Q3ListView::Single);
|
||||
group_group_list->setGeometry(10,10,
|
||||
group_group_view=new RDTableView(this);
|
||||
group_group_view->setGeometry(10,10,
|
||||
sizeHint().width()-20,sizeHint().height()-80);
|
||||
group_group_list->setAllColumnsShowFocus(true);
|
||||
group_group_list->setItemMargin(5);
|
||||
connect(group_group_list,
|
||||
SIGNAL(doubleClicked(Q3ListViewItem *,const QPoint &,int)),
|
||||
this,
|
||||
SLOT(doubleClickedData(Q3ListViewItem *,const QPoint &,int)));
|
||||
group_group_list->addColumn(tr("NAME"));
|
||||
group_group_list->setColumnAlignment(0,Qt::AlignHCenter);
|
||||
group_group_list->addColumn(tr("DESCRIPTION"));
|
||||
group_group_list->setColumnAlignment(1,Qt::AlignLeft);
|
||||
group_group_model=new RDGroupListModel(false,false,this);
|
||||
group_group_model->setFont(font());
|
||||
group_group_model->setPalette(palette());
|
||||
group_group_view->setModel(group_group_model);
|
||||
for(int i=2;i<group_group_model->columnCount();i++) {
|
||||
group_group_view->hideColumn(i);
|
||||
}
|
||||
connect(group_group_model,SIGNAL(modelReset()),
|
||||
group_group_view,SLOT(resizeColumnsToContents()));
|
||||
connect(group_group_view,SIGNAL(doubleClicked(const QModelIndex &)),
|
||||
this,SLOT(doubleClickedData(const QModelIndex &)));
|
||||
group_group_model->changeUser();
|
||||
|
||||
//
|
||||
// OK Button
|
||||
@ -70,11 +71,6 @@ RDListGroups::RDListGroups(QString *groupname,const QString &username,
|
||||
button->setGeometry(sizeHint().width()-90,sizeHint().height()-60,80,50);
|
||||
button->setFont(buttonFont());
|
||||
connect(button,SIGNAL(clicked()),this,SLOT(cancelData()));
|
||||
|
||||
//
|
||||
// Populate Data
|
||||
//
|
||||
BuildGroupList(username);
|
||||
}
|
||||
|
||||
|
||||
@ -90,8 +86,7 @@ QSizePolicy RDListGroups::sizePolicy() const
|
||||
}
|
||||
|
||||
|
||||
void RDListGroups::doubleClickedData(Q3ListViewItem *item,const QPoint &pt,
|
||||
int col)
|
||||
void RDListGroups::doubleClickedData(const QModelIndex &index)
|
||||
{
|
||||
okData();
|
||||
}
|
||||
@ -99,18 +94,20 @@ void RDListGroups::doubleClickedData(Q3ListViewItem *item,const QPoint &pt,
|
||||
|
||||
void RDListGroups::okData()
|
||||
{
|
||||
Q3ListViewItem *item=group_group_list->selectedItem();
|
||||
if(item==NULL) {
|
||||
QModelIndexList rows=group_group_view->selectionModel()->selectedRows();
|
||||
|
||||
if(rows.size()!=1) {
|
||||
return;
|
||||
}
|
||||
*group_name=item->text(0);
|
||||
done(0);
|
||||
*group_name=group_group_model->groupName(rows.first());
|
||||
|
||||
done(true);
|
||||
}
|
||||
|
||||
|
||||
void RDListGroups::cancelData()
|
||||
{
|
||||
done(-1);
|
||||
done(false);
|
||||
}
|
||||
|
||||
|
||||
@ -118,34 +115,3 @@ void RDListGroups::closeEvent(QCloseEvent *e)
|
||||
{
|
||||
cancelData();
|
||||
}
|
||||
|
||||
|
||||
void RDListGroups::BuildGroupList(const QString &username)
|
||||
{
|
||||
QString sql;
|
||||
RDSqlQuery *q;
|
||||
Q3ListViewItem *item=NULL;
|
||||
Q3ListViewItem *cur_item=NULL;
|
||||
|
||||
group_group_list->clear();
|
||||
sql=QString("select ")+
|
||||
"USER_PERMS.GROUP_NAME,"+ // 00
|
||||
"GROUPS.DESCRIPTION "+ // 01
|
||||
"from USER_PERMS left join GROUPS "+
|
||||
"on USER_PERMS.GROUP_NAME=GROUPS.NAME where "+
|
||||
"USER_NAME=\""+RDEscapeString(username)+"\"";
|
||||
q=new RDSqlQuery(sql);
|
||||
while(q->next()) {
|
||||
item=new Q3ListViewItem(group_group_list);
|
||||
item->setText(0,q->value(0).toString());
|
||||
item->setText(1,q->value(1).toString());
|
||||
if(q->value(0).toString()==*group_name) {
|
||||
cur_item=item;
|
||||
}
|
||||
}
|
||||
delete q;
|
||||
if(cur_item!=NULL) {
|
||||
group_group_list->setSelected(cur_item,true);
|
||||
group_group_list->ensureItemVisible(item);
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// A widget to select a Rivendell Group.
|
||||
//
|
||||
// (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,22 +21,22 @@
|
||||
#ifndef RDLIST_GROUPS_H
|
||||
#define RDLIST_GROUPS_H
|
||||
|
||||
#include <q3listview.h>
|
||||
|
||||
#include <qpushbutton.h>
|
||||
#include <QPushButton>
|
||||
|
||||
#include <rddialog.h>
|
||||
#include <rdgrouplistmodel.h>
|
||||
#include <rdtableview.h>
|
||||
|
||||
class RDListGroups : public RDDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
RDListGroups(QString *groupname,const QString &username,QWidget *parent=0);
|
||||
RDListGroups(QString *groupname,const QString &caption,QWidget *parent=0);
|
||||
QSize sizeHint() const;
|
||||
QSizePolicy sizePolicy() const;
|
||||
|
||||
private slots:
|
||||
void doubleClickedData(Q3ListViewItem *item,const QPoint &pt,int col);
|
||||
void doubleClickedData(const QModelIndex &index);
|
||||
void okData();
|
||||
void cancelData();
|
||||
|
||||
@ -46,7 +46,8 @@ class RDListGroups : public RDDialog
|
||||
private:
|
||||
void BuildGroupList(const QString &username);
|
||||
QString *group_name;
|
||||
Q3ListView *group_group_list;
|
||||
RDTableView *group_group_view;
|
||||
RDGroupListModel *group_group_model;
|
||||
};
|
||||
|
||||
|
||||
|
@ -568,9 +568,8 @@ void DiskRipper::setMultiButtonData()
|
||||
//
|
||||
// Get Destination Group
|
||||
//
|
||||
RDListGroups *list_groups=new RDListGroups(rip_group_text,rda->user()->name(),
|
||||
this);
|
||||
if(list_groups->exec()<0) {
|
||||
RDListGroups *list_groups=new RDListGroups(rip_group_text,"RDLibrary",this);
|
||||
if(!list_groups->exec()) {
|
||||
delete list_groups;
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user