2021-02-15 Fred Gleason <fredg@paravelsystems.com>

* Removed the 'Q3ListBox' dependency from 'RDListSelector'.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2021-02-15 17:57:33 -05:00
parent 6388987323
commit edbb464dee
17 changed files with 105 additions and 219 deletions

View File

@ -21153,3 +21153,5 @@
* Refactored the 'Select Group' dialog to use the model based API.
2021-02-15 Fred Gleason <fredg@paravelsystems.com>
* Removed the 'Q3RangeControl' dependency from 'RDSlider'.
2021-02-15 Fred Gleason <fredg@paravelsystems.com>
* Removed the 'Q3ListBox' dependency from 'RDListSelector'.

View File

@ -2,7 +2,7 @@
//
// A List Selector Widget.
//
// (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 Library General Public License
@ -34,7 +34,8 @@ RDListSelector::RDListSelector(QWidget *parent)
list_source_label->setFont(labelFont());
list_source_label->setText(tr("Available Services"));
list_source_label->setAlignment(Qt::AlignCenter);
list_source_box=new Q3ListBox(this);
list_source_list=new QListWidget(this);
list_source_list->setSortingEnabled(true);
list_add_button=new QPushButton(this);
list_add_button->setText(tr("Add >>"));
@ -49,19 +50,20 @@ RDListSelector::RDListSelector(QWidget *parent)
list_dest_label->setFont(labelFont());
list_dest_label->setText(tr("Active Services"));
list_dest_label->setAlignment(Qt::AlignCenter);
list_dest_box=new Q3ListBox(this);
list_dest_list=new QListWidget(this);
list_dest_list->setSortingEnabled(true);
}
uint RDListSelector::sourceCount() const
{
return list_source_box->count();
return list_source_list->count();
}
uint RDListSelector::destCount() const
{
return list_dest_box->count();
return list_dest_list->count();
}
@ -79,157 +81,155 @@ void RDListSelector::destSetLabel(QString label)
void RDListSelector::sourceInsertItem(const QString &text,int index)
{
list_source_box->insertItem(text,index);
list_source_box->sort();
list_source_list->insertItem(index,text);
list_source_list->sortItems();
CheckButtons();
}
void RDListSelector::destInsertItem(const QString &text,int index)
{
list_dest_box->insertItem(text,index);
list_dest_box->sort();
list_dest_list->insertItem(index,text);
list_dest_list->sortItems();
CheckButtons();
}
void RDListSelector::sourceRemoveItem(int index)
{
list_source_box->removeItem(index);
list_source_list->removeItemWidget(list_source_list->item(index));
CheckButtons();
}
void RDListSelector::destRemoveItem(int index)
{
list_dest_box->removeItem(index);
list_dest_list->removeItemWidget(list_source_list->item(index));
CheckButtons();
}
QString RDListSelector::sourceText(int index) const
{
return list_source_box->text(index);
return list_source_list->item(index)->text();
}
QString RDListSelector::destText(int index) const
{
return list_dest_box->text(index);
return list_dest_list->item(index)->text();
}
void RDListSelector::sourceChangeItem(const QString &text,int index)
{
list_source_box->changeItem(text,index);
list_source_box->sort();
list_source_list->item(index)->setText(text);
list_source_list->sortItems();
}
void RDListSelector::destChangeItem(const QString &text,int index)
{
list_dest_box->changeItem(text,index);
list_dest_box->sort();
}
int RDListSelector::sourceNumItemsVisible() const
{
return list_source_box->numItemsVisible();
}
int RDListSelector::destNumItemsVisible() const
{
return list_dest_box->numItemsVisible();
list_dest_list->item(index)->setText(text);
list_dest_list->sortItems();
}
int RDListSelector::sourceCurrentItem() const
{
return list_source_box->currentItem();
return list_source_list->currentRow();
}
int RDListSelector::destCurrentItem() const
{
return list_dest_box->currentItem();
return list_dest_list->currentRow();
}
QString RDListSelector::sourceCurrentText() const
{
return list_source_box->currentText();
return list_source_list->currentItem()->text();
}
QString RDListSelector::destCurrentText() const
{
return list_dest_box->currentText();
return list_dest_list->currentItem()->text();
}
void RDListSelector::sourceSetCurrentItem(int item)
{
list_source_box->setCurrentItem(item);
list_source_list->setCurrentRow(item);
}
void RDListSelector::destSetCurrentItem(int item)
{
list_dest_box->setCurrentItem(item);
list_dest_list->setCurrentRow(item);
}
Q3ListBoxItem *RDListSelector::sourceFindItem(const QString &text,
Q3ListBox::ComparisonFlags compare) const
QListWidgetItem *RDListSelector::sourceFindItem(const QString &text,
Qt::MatchFlags flag)
{
return list_source_box->findItem(text,compare);
QList<QListWidgetItem *> items=list_source_list->findItems(text,flag);
if(items.size()==0) {
return NULL;
}
return items.first();
}
Q3ListBoxItem *RDListSelector::destFindItem(const QString &text,
Q3ListBox::ComparisonFlags compare) const
QListWidgetItem *RDListSelector::destFindItem(const QString &text,
Qt::MatchFlags flag)
{
return list_dest_box->findItem(text,compare);
QList<QListWidgetItem *> items=list_dest_list->findItems(text,flag);
if(items.size()==0) {
return NULL;
}
return items.first();
}
void RDListSelector::clear()
{
list_source_box->clear();
list_dest_box->clear();
list_source_list->clear();
list_dest_list->clear();
}
void RDListSelector::addData()
{
if(list_source_box->currentItem()>=0) {
list_dest_box->
insertItem(list_source_box->currentText());
list_source_box->removeItem(list_source_box->currentItem());
list_dest_box->sort();
if(list_source_box->count()==0) {
QList<QListWidgetItem *> items;
if(list_source_list->currentRow()>=0) {
list_dest_list->
insertItem(list_dest_list->count(),new QListWidgetItem(list_source_list->currentItem()->text()));
delete list_source_list->takeItem(list_source_list->currentRow());
list_dest_list->sortItems();
if(list_source_list->count()==0) {
list_add_button->setDisabled(true);
}
list_remove_button->setEnabled(true);
list_source_box->setCurrentItem(-1);
list_source_list->setCurrentRow(-1);
}
}
void RDListSelector::removeData()
{
if(list_dest_box->currentItem()>=0) {
list_source_box->
insertItem(list_dest_box->currentText());
list_dest_box->removeItem(list_dest_box->currentItem());
list_source_box->sort();
if(list_dest_box->count()==0) {
if(list_dest_list->currentRow()>=0) {
list_source_list->
insertItem(list_source_list->count(),new QListWidgetItem(list_dest_list->currentItem()->text()));
delete list_dest_list->takeItem(list_dest_list->currentRow());
list_source_list->sortItems();
if(list_dest_list->count()==0) {
list_remove_button->setDisabled(true);
}
list_add_button->setEnabled(true);
list_dest_box->setCurrentItem(-1);
list_dest_list->setCurrentRow(-1);
}
}
@ -240,25 +240,25 @@ void RDListSelector::resizeEvent(QResizeEvent *e)
int h=size().height();
list_source_label->setGeometry(0,0,w/3,12);
list_source_box->setGeometry(0,12,w/3,h-12);
list_source_list->setGeometry(0,12,w/3,h-12);
list_add_button->setGeometry(w/3+20,20,w/3-40,25);
list_remove_button->setGeometry(w/3+20,2*h/3-3,w/3-40,25);
list_dest_label->setGeometry(2*w/3,0,w/3,12);
list_dest_box->setGeometry(2*w/3,12,w/3,h-12);
list_dest_list->setGeometry(2*w/3,12,w/3,h-12);
}
void RDListSelector::CheckButtons()
{
if(list_source_box->count()==0) {
if(list_source_list->count()==0) {
list_add_button->setDisabled(true);
}
else {
list_add_button->setEnabled(true);
}
if(list_dest_box->count()==0) {
if(list_dest_list->count()==0) {
list_remove_button->setDisabled(true);
}
else {

View File

@ -2,7 +2,7 @@
//
// An listselector widget with word wrap.
//
// (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 Library General Public License
@ -21,11 +21,8 @@
#ifndef RDLISTSELECTOR_H
#define RDLISTSELECTOR_H
#include <q3listbox.h>
#include <qlabel.h>
#include <qcolor.h>
#include <qpushbutton.h>
#include <QPushButton>
#include <QListWidget>
#include <rdwidget.h>
@ -46,18 +43,16 @@ class RDListSelector : public RDWidget
QString destText(int index) const;
void sourceChangeItem(const QString &text,int index);
void destChangeItem(const QString &text,int index);
int sourceNumItemsVisible() const;
int destNumItemsVisible() const;
int sourceCurrentItem() const;
int destCurrentItem() const;
QString sourceCurrentText() const;
QString destCurrentText() const;
void sourceSetCurrentItem(int item);
void destSetCurrentItem(int item);
Q3ListBoxItem *sourceFindItem(const QString &text,
Q3ListBox::ComparisonFlags compare=Q3ListBox::ExactMatch) const;
Q3ListBoxItem *destFindItem(const QString &text,
Q3ListBox::ComparisonFlags compare=Q3ListBox::ExactMatch) const;
QListWidgetItem *sourceFindItem(const QString &text,
Qt::MatchFlags flags=Qt::MatchExactly);
QListWidgetItem *destFindItem(const QString &text,
Qt::MatchFlags flags=Qt::MatchExactly);
void clear();
private slots:
@ -69,9 +64,9 @@ class RDListSelector : public RDWidget
private:
void CheckButtons();
Q3ListBox *list_source_box;
QListWidget *list_source_list;
QLabel *list_source_label;
Q3ListBox *list_dest_box;
QListWidget *list_dest_list;
QLabel *list_dest_label;
QPushButton *list_add_button;
QPushButton *list_remove_button;

View File

@ -2,7 +2,7 @@
//
// Service Picker dialog
//
// (C) Copyright 2012,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2012-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

View File

@ -2,7 +2,7 @@
//
// Add 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
@ -18,17 +18,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#include <qdialog.h>
#include <qstring.h>
#include <qpushbutton.h>
#include <q3listbox.h>
#include <q3textedit.h>
#include <qlabel.h>
#include <qpainter.h>
#include <qevent.h>
#include <qmessagebox.h>
#include <qcheckbox.h>
#include <q3buttongroup.h>
#include <QMessageBox>
#include <rddb.h>
#include <rdescape_string.h>

View File

@ -2,7 +2,7 @@
//
// Add a Rivendell Report
//
// (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
@ -18,16 +18,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#include <qstring.h>
#include <qpushbutton.h>
#include <q3listbox.h>
#include <q3textedit.h>
#include <qlabel.h>
#include <qpainter.h>
#include <qevent.h>
#include <qmessagebox.h>
#include <qcheckbox.h>
#include <q3buttongroup.h>
#include <QMessageBox>
#include <rd.h>
#include <rddb.h>

View File

@ -2,7 +2,7 @@
//
// Add a Rivendell Workstation
//
// (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
@ -18,16 +18,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#include <qstring.h>
#include <qpushbutton.h>
#include <q3listbox.h>
#include <q3textedit.h>
#include <qlabel.h>
#include <qpainter.h>
#include <qevent.h>
#include <qmessagebox.h>
#include <qcheckbox.h>
#include <q3buttongroup.h>
#include <QMessageBox>
#include <rddb.h>
#include <rdairplay_conf.h>

View File

@ -2,7 +2,7 @@
//
// Add a Rivendell Workstation
//
// (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,12 +21,7 @@
#ifndef ADD_STATION_H
#define ADD_STATION_H
#include <q3listbox.h>
#include <q3textedit.h>
#include <qpixmap.h>
#include <qcombobox.h>
#include <qsqldatabase.h>
#include <qlineedit.h>
#include <QComboBox>
#include <rddialog.h>
#include <rdstation.h>

View File

@ -2,7 +2,7 @@
//
// Add a Rivendell Service
//
// (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
@ -18,16 +18,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#include <qstring.h>
#include <qpushbutton.h>
#include <q3listbox.h>
#include <q3textedit.h>
#include <qlabel.h>
#include <qpainter.h>
#include <qevent.h>
#include <qmessagebox.h>
#include <qcheckbox.h>
#include <q3buttongroup.h>
#include <QMessageBox>
#include <rdapplication.h>
#include <rddb.h>

View File

@ -2,7 +2,7 @@
//
// Add a Rivendell Service
//
// (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,12 +21,7 @@
#ifndef ADD_SVC_H
#define ADD_SVC_H
#include <q3listbox.h>
#include <q3textedit.h>
#include <qpixmap.h>
#include <qcombobox.h>
#include <qsqldatabase.h>
#include <qlineedit.h>
#include <QComboBox>
#include <rddialog.h>
#include <rdsvc.h>

View File

@ -2,7 +2,7 @@
//
// Add a Rivendell User
//
// (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
@ -18,18 +18,8 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#include <math.h>
#include <QMessageBox>
#include <qstring.h>
#include <qpushbutton.h>
#include <q3listbox.h>
#include <q3textedit.h>
#include <qlabel.h>
#include <qpainter.h>
#include <qevent.h>
#include <qmessagebox.h>
#include <qcheckbox.h>
#include <q3buttongroup.h>
#include <rddb.h>
#include <edit_user.h>

View File

@ -2,7 +2,7 @@
//
// Add a Rivendell User
//
// (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,12 +21,7 @@
#ifndef ADD_USER_H
#define ADD_USER_H
#include <q3listbox.h>
#include <q3textedit.h>
#include <qpixmap.h>
#include <qcheckbox.h>
#include <qsqldatabase.h>
#include <qlineedit.h>
#include <QLineEdit>
#include <rddialog.h>
#include <rduser.h>

View File

@ -2,7 +2,7 @@
//
// Edit a Rivendell Dropbox Configuration
//
// (C) Copyright 2002-2020 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
@ -18,21 +18,8 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#include <math.h>
#include <q3buttongroup.h>
#include <q3listbox.h>
#include <q3textedit.h>
#include <qcheckbox.h>
#include <qcolordialog.h>
#include <qevent.h>
#include <qfiledialog.h>
#include <qmessagebox.h>
#include <qpainter.h>
#include <qpushbutton.h>
#include <qstring.h>
#include <qvalidator.h>
#include <QFileDialog>
#include <QMessageBox>
#include <rdapplication.h>
#include <rdcart_dialog.h>

View File

@ -2,7 +2,7 @@
//
// Edit a Rivendell Dropbox Configuration
//
// (C) Copyright 2002-2020 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,18 +21,9 @@
#ifndef EDIT_DROPBOX_H
#define EDIT_DROPBOX_H
#include <q3listbox.h>
#include <q3textedit.h>
#include <qpixmap.h>
#include <qspinbox.h>
#include <qcheckbox.h>
#include <qsqldatabase.h>
#include <qlineedit.h>
#include <qcombobox.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qlabel.h>
#include <qstringlist.h>
#include <QCheckBox>
#include <QComboBox>
#include <QSpinBox>
#include <rddialog.h>
#include <rddropbox.h>

View File

@ -2,7 +2,7 @@
//
// Edit Rivendell RSS Feed Permissions
//
// (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
@ -18,17 +18,6 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#include <qstring.h>
#include <qpushbutton.h>
#include <q3listbox.h>
#include <q3textedit.h>
#include <qlabel.h>
#include <qpainter.h>
#include <qevent.h>
#include <qmessagebox.h>
#include <qcheckbox.h>
#include <q3buttongroup.h>
#include <rddb.h>
#include <rdescape_string.h>
#include <rdpasswd.h>
@ -99,7 +88,7 @@ EditFeedPerms::EditFeedPerms(RDUser *user,QWidget *parent)
sql=QString().sprintf("select KEY_NAME from FEEDS");
q=new RDSqlQuery(sql);
while(q->next()) {
if(feed_host_sel->destFindItem(q->value(0).toString(),Q3ListBox::ExactMatch)==0) {
if(feed_host_sel->destFindItem(q->value(0).toString())==0) {
feed_host_sel->sourceInsertItem(q->value(0).toString());
}
}

View File

@ -2,7 +2,7 @@
//
// Edit 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
@ -18,18 +18,8 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#include <math.h>
#include <qstring.h>
#include <qpushbutton.h>
#include <q3listbox.h>
#include <q3textedit.h>
#include <qpainter.h>
#include <qevent.h>
#include <qmessagebox.h>
#include <qcheckbox.h>
#include <q3buttongroup.h>
#include <qcolordialog.h>
#include <QColorDialog>
#include <QMessageBox>
#include <rddb.h>
#include <rdescape_string.h>

View File

@ -2,7 +2,7 @@
//
// Edit 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,15 +21,9 @@
#ifndef EDIT_GROUP_H
#define EDIT_GROUP_H
#include <q3listbox.h>
#include <q3textedit.h>
#include <qpixmap.h>
#include <qspinbox.h>
#include <qcheckbox.h>
#include <qlineedit.h>
#include <qcombobox.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <QCheckBox>
#include <QComboBox>
#include <QSpinBox>
#include <rddialog.h>
#include <rdgroup.h>