2021-01-13 Fred Gleason <fredg@paravelsystems.com>

* Renamed the 'RDCartDrag' class to 'RD3CartDrag'.
	* Renamed the 'RDEmptyCart' widget to 'RD3EmptyCart'.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2021-01-14 15:05:53 -05:00
parent 7bbe5a759e
commit db3f642a86
32 changed files with 219 additions and 108 deletions

View File

@ -20781,3 +20781,6 @@
2021-01-13 Fred Gleason <fredg@paravelsystems.com>
* Modified the 'Edit Log' dialog in rdlibrary(1) to use the
model-based API.
2021-01-13 Fred Gleason <fredg@paravelsystems.com>
* Renamed the 'RDCartDrag' class to 'RD3CartDrag'.
* Renamed the 'RDEmptyCart' widget to 'RD3EmptyCart'.

View File

@ -79,7 +79,7 @@ dist_librd_la_SOURCES = dbversion.h\
rdcart.cpp rdcart.h\
rdcart_dialog.cpp rdcart_dialog.h\
rdcart_search_text.cpp rdcart_search_text.h\
rdcartdrag.cpp rdcartdrag.h\
rd3cartdrag.cpp rd3cartdrag.h\
rdcartfilter.cpp rdcartfilter.h\
rdcartslot.cpp rdcartslot.h\
rdcastsearch.cpp rdcastsearch.h\
@ -122,7 +122,7 @@ dist_librd_la_SOURCES = dbversion.h\
rddummylookup.cpp rddummylookup.h\
rdedit_audio.cpp rdedit_audio.h\
rdedit_panel_name.cpp rdedit_panel_name.h\
rdemptycart.cpp rdemptycart.h\
rd3emptycart.cpp rd3emptycart.h\
rdescape_string.cpp rdescape_string.h\
rdevent.cpp rdevent.h\
rdevent_line.cpp rdevent_line.h\
@ -294,7 +294,7 @@ nodist_librd_la_SOURCES = moc_rdadd_cart.cpp\
moc_rddummylookup.cpp\
moc_rdedit_audio.cpp\
moc_rdedit_panel_name.cpp\
moc_rdemptycart.cpp\
moc_rd3emptycart.cpp\
moc_rdevent_player.cpp\
moc_rdexport_settings_dialog.cpp\
moc_rdfeed.cpp\

View File

@ -54,7 +54,7 @@ SOURCES += rdcardselector.cpp
SOURCES += rdcart.cpp
SOURCES += rdcart_dialog.cpp
SOURCES += rdcart_search_text.cpp
SOURCES += rdcartdrag.cpp
SOURCES += rd3cartdrag.cpp
SOURCES += rdcartfilter.cpp
SOURCES += rdcatch_connect.cpp
SOURCES += rdcddblookup.cpp
@ -90,7 +90,7 @@ SOURCES += rddropbox.cpp
SOURCES += rddummylookup.cpp
SOURCES += rdedit_audio.cpp
SOURCES += rdedit_panel_name.cpp
SOURCES += rdemptycart.cpp
SOURCES += rd3emptycart.cpp
SOURCES += rdescape_string.cpp
SOURCES += rdevent.cpp
SOURCES += rdevent_line.cpp
@ -201,7 +201,7 @@ HEADERS += rdcardselector.h
HEADERS += rdcart.h
HEADERS += rdcart_dialog.h
HEADERS += rdcart_search_text.h
HEADERS += rdcartdrag.h
HEADERS += rd3cartdrag.h
HEADERS += rdcartfilter.h
HEADERS += rdcatch_connect.h
HEADERS += rdcddblookup.h
@ -237,7 +237,7 @@ HEADERS += rddropbox.h
HEADERS += rddummylookup.h
HEADERS += rdedit_audio.h
HEADERS += rdedit_panel_name.h
HEADERS += rdemptycart.h
HEADERS += rd3emptycart.h
HEADERS += rdescape_string.h
HEADERS += rdevent.h
HEADERS += rdevent_line.h

View File

@ -1,8 +1,8 @@
// rdcartdrag.cpp
// rd3cartdrag.cpp
//
// Stored value drag object for Rivendell carts.
//
// (C) Copyright 2013-2018 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2013-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,10 +22,10 @@
#include <qstringlist.h>
#include <rd.h>
#include <rdcart.h>
#include <rdcartdrag.h>
#include <rdprofile.h>
#include "rd.h"
#include "rd3cartdrag.h"
#include "rdcart.h"
#include "rdprofile.h"
//
// Icons
@ -34,7 +34,7 @@
#include "../icons/rml5.xpm"
#include "../icons/trashcan-16x16.xpm"
RDCartDrag::RDCartDrag(unsigned cartnum,const QPixmap *icon,const QColor &color,
RD3CartDrag::RD3CartDrag(unsigned cartnum,const QPixmap *icon,const QColor &color,
QWidget *src)
: Q3StoredDrag(RDMIMETYPE_CART,src)
{
@ -61,7 +61,7 @@ RDCartDrag::RDCartDrag(unsigned cartnum,const QPixmap *icon,const QColor &color,
}
RDCartDrag::RDCartDrag(unsigned cartnum,const QString &title,
RD3CartDrag::RD3CartDrag(unsigned cartnum,const QString &title,
const QColor &color,QWidget *src)
: Q3StoredDrag(RDMIMETYPE_CART,src)
{
@ -88,13 +88,13 @@ RDCartDrag::RDCartDrag(unsigned cartnum,const QString &title,
}
bool RDCartDrag::canDecode(QMimeSource *e)
bool RD3CartDrag::canDecode(QMimeSource *e)
{
return e->provides(RDMIMETYPE_CART);
}
bool RDCartDrag::decode(QMimeSource *e,unsigned *cartnum,QColor *color,
bool RD3CartDrag::decode(QMimeSource *e,unsigned *cartnum,QColor *color,
QString *title)
{
RDProfile *p=new RDProfile();
@ -111,20 +111,20 @@ bool RDCartDrag::decode(QMimeSource *e,unsigned *cartnum,QColor *color,
}
bool RDCartDrag::decode(QMimeSource *e,RDLogLine *ll,
bool RD3CartDrag::decode(QMimeSource *e,RDLogLine *ll,
RDLogLine::TransType next_trans,int log_mach,
bool timescale,RDLogLine::TransType trans)
{
unsigned cartnum;
RDCartDrag::decode(e,&cartnum);
RD3CartDrag::decode(e,&cartnum);
ll->loadCart(cartnum,next_trans,log_mach,timescale,trans);
return true;
}
void RDCartDrag::SetData(unsigned cartnum,const QColor &color,const QString &title)
void RD3CartDrag::SetData(unsigned cartnum,const QColor &color,const QString &title)
{
QString str="[Rivendell-Cart]\n";
str+="Number="+QString().sprintf("%06u",cartnum)+"\n";

View File

@ -1,4 +1,4 @@
// rdcartdrag.h
// rd3cartdrag.h
//
// Stored value drag object for Rivendell carts.
//
@ -18,8 +18,8 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#ifndef RDCARTDRAG_H
#define RDCARTDRAG_H
#ifndef RD3CARTDRAG_H
#define RD3CARTDRAG_H
#include <qcolor.h>
#include <qpixmap.h>
@ -29,13 +29,13 @@
#include <rdcart.h>
#include <rdlog_line.h>
class RDCartDrag : public Q3StoredDrag
class RD3CartDrag : public Q3StoredDrag
{
public:
RDCartDrag(unsigned cartnum,const QPixmap *icon,const QColor &color,
QWidget *src=0);
RDCartDrag(unsigned cartnum,const QString &title,const QColor &color,
QWidget *src=0);
RD3CartDrag(unsigned cartnum,const QPixmap *icon,const QColor &color,
QWidget *src=0);
RD3CartDrag(unsigned cartnum,const QString &title,const QColor &color,
QWidget *src=0);
static bool canDecode(QMimeSource *e);
static bool decode(QMimeSource *e,unsigned *cartnum,QColor *color=NULL,
QString *title=NULL);
@ -49,4 +49,4 @@ class RDCartDrag : public Q3StoredDrag
};
#endif // RDCARTDRAG_H
#endif // RD3CARTDRAG_H

View File

@ -2,7 +2,7 @@
//
// A drag source for an empty cart.
//
// (C) Copyright 2013,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2013-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
@ -18,7 +18,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#include <rdemptycart.h>
#include "rd3emptycart.h"
//
// Icons
@ -29,7 +29,7 @@
#include <QLabel>
#include <QMouseEvent>
RDEmptyCart::RDEmptyCart(QWidget *parent)
RD3EmptyCart::RD3EmptyCart(QWidget *parent)
: QWidget(parent)
{
empty_label=new QLabel(this);
@ -38,27 +38,27 @@ RDEmptyCart::RDEmptyCart(QWidget *parent)
}
RDEmptyCart::~RDEmptyCart()
RD3EmptyCart::~RD3EmptyCart()
{
delete empty_label;
}
QSize RDEmptyCart::sizeHint() const
QSize RD3EmptyCart::sizeHint() const
{
return QSize(32,32);
}
QSizePolicy RDEmptyCart::sizePolicy() const
QSizePolicy RD3EmptyCart::sizePolicy() const
{
return QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
}
void RDEmptyCart::mousePressEvent(QMouseEvent *e)
void RD3EmptyCart::mousePressEvent(QMouseEvent *e)
{
QWidget::mousePressEvent(e);
RDCartDrag *d=new RDCartDrag(0,"",Qt::lightGray,this);
RD3CartDrag *d=new RD3CartDrag(0,"",Qt::lightGray,this);
d->dragCopy();
}

View File

@ -1,8 +1,8 @@
// rdemptycart.h
// rd3emptycart.h
//
// A drag source for an empty cart.
//
// (C) Copyright 2013,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2013-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
@ -18,22 +18,22 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#ifndef RDEMPTYCART_H
#define RDEMPTYCART_H
#ifndef RD3EMPTYCART_H
#define RD3EMPTYCART_H
#include <qlabel.h>
#include <qwidget.h>
//Added by qt3to4:
#include <QMouseEvent>
#include <rdcartdrag.h>
#include <rd3cartdrag.h>
class RDEmptyCart : public QWidget
class RD3EmptyCart : public QWidget
{
Q_OBJECT
public:
RDEmptyCart(QWidget *parent=0);
~RDEmptyCart();
RD3EmptyCart(QWidget *parent=0);
~RD3EmptyCart();
QSize sizeHint() const;
QSizePolicy sizePolicy() const;
@ -45,4 +45,4 @@ class RDEmptyCart : public QWidget
};
#endif // RDEMPTYCART_H
#endif // RD3EMPTYCART_H

View File

@ -188,6 +188,12 @@ bool RDLibraryModel::hasChildren(const QModelIndex &parent) const
}
Qt::ItemFlags RDLibraryModel::flags(const QModelIndex &index) const
{
return Qt::ItemIsSelectable|Qt::ItemIsDragEnabled|Qt::ItemIsEnabled;
}
QVariant RDLibraryModel::headerData(int section,Qt::Orientation orient,
int role) const
{

View File

@ -48,6 +48,7 @@ class RDLibraryModel : public QAbstractItemModel
int columnCount(const QModelIndex &parent=QModelIndex()) const;
int rowCount(const QModelIndex &parent=QModelIndex()) const;
bool hasChildren(const QModelIndex &parent=QModelIndex()) const;
Qt::ItemFlags flags(const QModelIndex &index) const;
QVariant headerData(int section,Qt::Orientation orient,
int role=Qt::DisplayRole) const;
QVariant data(const QModelIndex &index,int role=Qt::DisplayRole) const;

View File

@ -2,7 +2,7 @@
//
// The SoundPanel Button for RDAirPlay.
//
// (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,7 +21,7 @@
#include <qpainter.h>
#include <rdcartdrag.h>
#include <rd3cartdrag.h>
#include <rdconf.h>
#include "rdpanel_button.h"
@ -367,7 +367,7 @@ void RDPanelButton::mouseMoveEvent(QMouseEvent *e)
if(button_move_count==0) {
QPushButton::mouseReleaseEvent(e);
if(button_allow_drags) {
RDCartDrag *d=new RDCartDrag(button_cart,button_text,button_color,this);
RD3CartDrag *d=new RD3CartDrag(button_cart,button_text,button_color,this);
d->dragCopy();
}
}
@ -383,7 +383,7 @@ void RDPanelButton::mouseReleaseEvent(QMouseEvent *e)
void RDPanelButton::dragEnterEvent(QDragEnterEvent *e)
{
e->accept(RDCartDrag::canDecode(e)&&button_allow_drags&&
e->accept(RD3CartDrag::canDecode(e)&&button_allow_drags&&
((button_play_deck==NULL)||(button_play_deck->state()==RDPlayDeck::Stopped)));
}
@ -394,7 +394,7 @@ void RDPanelButton::dropEvent(QDropEvent *e)
QColor color;
QString title;
if(RDCartDrag::decode(e,&cartnum,&color,&title)) {
if(RD3CartDrag::decode(e,&cartnum,&color,&title)) {
emit cartDropped(button_row,button_col,cartnum,color,title);
}
}

View File

@ -2,7 +2,7 @@
//
// Cart slot label widget for RDCartSlot
//
// (C) Copyright 2012-2020 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
@ -497,7 +497,7 @@ void RDSlotBox::mousePressEvent(QMouseEvent *e)
if((line_logline!=NULL)&&(line_mode==RDSlotOptions::CartDeckMode)&&
line_allow_drags) {
RDCartDrag *d=new RDCartDrag(line_logline->cartNumber(),
RD3CartDrag *d=new RD3CartDrag(line_logline->cartNumber(),
line_icon_label->pixmap(),
line_group_label->palette().
color(QColorGroup::Foreground),this);
@ -526,7 +526,7 @@ void RDSlotBox::paintEvent(QPaintEvent *e)
void RDSlotBox::dragEnterEvent(QDragEnterEvent *e)
{
e->accept(RDCartDrag::canDecode(e)&&
e->accept(RD3CartDrag::canDecode(e)&&
(line_mode==RDSlotOptions::CartDeckMode)&&
(line_deck->state()==RDPlayDeck::Stopped));
}
@ -536,7 +536,7 @@ void RDSlotBox::dropEvent(QDropEvent *e)
{
unsigned cartnum;
if(RDCartDrag::decode(e,&cartnum)) {
if(RD3CartDrag::decode(e,&cartnum)) {
emit cartDropped(cartnum);
}
}

View File

@ -31,7 +31,7 @@
#include <qtimer.h>
#include <rdairplay_conf.h>
#include <rdcartdrag.h>
#include <rd3cartdrag.h>
#include <rdlog_line.h>
#include <rdplaymeter.h>
#include <rdplay_deck.h>

View File

@ -2,7 +2,7 @@
//
// The Log ListView widget for RDAirPlay's Full Log widget.
//
// (C) Copyright 2002-2018 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 <q3header.h>
#include <rdcartdrag.h>
#include <rd3cartdrag.h>
#include <lib_listview.h>
@ -35,7 +35,7 @@ LibListView::LibListView(QWidget *parent)
void LibListView::dragEnterEvent(QDragEnterEvent *e)
{
e->accept(RDCartDrag::canDecode(e));
e->accept(RD3CartDrag::canDecode(e));
}
@ -45,7 +45,7 @@ void LibListView::dropEvent(QDropEvent *e)
int line=-1;
QPoint pos(e->pos().x(),e->pos().y()-header()->sectionRect(0).height());
if(RDCartDrag::decode(e,&ll)) {
if(RD3CartDrag::decode(e,&ll)) {
RDListViewItem *item=(RDListViewItem *)itemAt(pos);
if(item!=NULL) {
line=item->text(15).toInt();

View File

@ -2,7 +2,7 @@
//
// On Air Playout Utility for Rivendell.
//
// (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
@ -793,8 +793,8 @@ void LogLineBox::mouseMoveEvent(QMouseEvent *e)
line_move_count--;
if(line_move_count==0) {
if(line_allow_drags&&(line_logline!=NULL)) {
RDCartDrag *d=
new RDCartDrag(line_logline->cartNumber(),line_icon_label->pixmap(),
RD3CartDrag *d=
new RD3CartDrag(line_logline->cartNumber(),line_icon_label->pixmap(),
line_group_label->palette().
color(QColorGroup::Foreground),this);
d->dragCopy();
@ -834,7 +834,7 @@ void LogLineBox::paintEvent(QPaintEvent *e)
void LogLineBox::dragEnterEvent(QDragEnterEvent *e)
{
e->accept(RDCartDrag::canDecode(e)&&
e->accept(RD3CartDrag::canDecode(e)&&
((line_status==RDLogLine::Scheduled)||
(line_status==RDLogLine::Paused)));
}
@ -844,7 +844,7 @@ void LogLineBox::dropEvent(QDropEvent *e)
{
RDLogLine ll;
if(RDCartDrag::decode(e,&ll)) {
if(RD3CartDrag::decode(e,&ll)) {
emit cartDropped(log_line,&ll);
}
}

View File

@ -2,7 +2,7 @@
//
// On Air Playout Utility for Rivendell.
//
// (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
@ -26,7 +26,7 @@
#include <qprogressbar.h>
#include <rdairplay_conf.h>
#include <rdcartdrag.h>
#include <rd3cartdrag.h>
#include <rdlog_line.h>
#include <rdwidget.h>

View File

@ -2,7 +2,7 @@
//
// TableView widget for RDAirPlay
//
// (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
@ -19,7 +19,7 @@
//
//
#include <rdcartdrag.h>
#include <rd3cartdrag.h>
#include <rdlogplay.h>
#include "logtableview.h"
@ -33,13 +33,13 @@ LogTableView::LogTableView(QWidget *parent)
void LogTableView::dragEnterEvent(QDragEnterEvent *e)
{
e->accept(RDCartDrag::canDecode(e));
e->accept(RD3CartDrag::canDecode(e));
}
void LogTableView::dragMoveEvent(QDragMoveEvent *e)
{
e->accept(RDCartDrag::canDecode(e));
e->accept(RD3CartDrag::canDecode(e));
}
@ -49,7 +49,7 @@ void LogTableView::dropEvent(QDropEvent *e)
int line=-1;
int y_pos=e->pos().y();
if(RDCartDrag::decode(e,&ll)) {
if(RD3CartDrag::decode(e,&ll)) {
line=rowAt(y_pos);
emit cartDropped(line,&ll);
}

View File

@ -661,7 +661,7 @@ MainWidget::MainWidget(RDConfig *config,QWidget *parent)
//
// Empty Cart
//
air_empty_cart=new RDEmptyCart(this);
air_empty_cart=new RD3EmptyCart(this);
air_empty_cart->setGeometry(520,sizeHint().height()-51,32,32);
if(!rda->station()->enableDragdrop()) {
air_empty_cart->hide();

View File

@ -2,7 +2,7 @@
//
// The On Air Playout Utility for Rivendell.
//
// (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
@ -23,7 +23,7 @@
#include <qsplashscreen.h>
#include <rdemptycart.h>
#include <rd3emptycart.h>
#include <rdhotkeylist.h>
#include <rdhotkeys.h>
#include <rdinstancelock.h>
@ -191,7 +191,7 @@ class MainWidget : public RDWidget
int air_stop_gpo_lines[RDAirPlayConf::LastChannel];
RDAirPlayConf::GpioType air_channel_gpio_types[RDAirPlayConf::LastChannel];
std::map<unsigned,QTimer *> air_channel_timers[2];
RDEmptyCart *air_empty_cart;
RD3EmptyCart *air_empty_cart;
};

View File

@ -53,6 +53,7 @@ dist_rdlibrary_SOURCES = audio_cart.cpp audio_cart.h\
edit_schedulercodes.cpp edit_schedulercodes.h\
globals.h\
lib_listview.cpp lib_listview.h\
libraryview.cpp libraryview.h\
list_reports.cpp list_reports.h\
macro_cart.cpp macro_cart.h\
notebubble.cpp notebubble.h\
@ -67,8 +68,9 @@ nodist_rdlibrary_SOURCES = moc_audio_cart.cpp\
moc_edit_cart.cpp\
moc_edit_macro.cpp\
moc_edit_notes.cpp\
moc_edit_schedulercodes.cpp \
moc_edit_schedulercodes.cpp\
moc_lib_listview.cpp\
moc_libraryview.cpp\
moc_list_reports.cpp\
moc_macro_cart.cpp\
moc_notebubble.cpp\

View File

@ -2,7 +2,7 @@
//
// A drag & drop QListView widget for Rivendell's RDLibrary
//
// (C) Copyright 2002-2018 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
@ -19,7 +19,7 @@
//
//
#include <rdcartdrag.h>
#include <rd3cartdrag.h>
#include <rdlibrary.h>
#include <rdlistviewitem.h>
@ -102,8 +102,8 @@ void LibListView::contentsMouseMoveEvent(QMouseEvent *e)
return;
}
if(item->text(MainWidget::OwnedBy).isEmpty()&&!item->parent()) { // Voice tracks and cuts cannot be dragged
RDCartDrag *d=
new RDCartDrag(item->text(MainWidget::Cart).left(6).toUInt(),item->text(MainWidget::Title),
RD3CartDrag *d=
new RD3CartDrag(item->text(MainWidget::Cart).left(6).toUInt(),item->text(MainWidget::Title),
item->textColor(MainWidget::Group), this);
d->dragCopy();
emit clicked(item);

61
rdlibrary/libraryview.cpp Normal file
View File

@ -0,0 +1,61 @@
// libraryview.cpp
//
// QTreeView widget that supports cart dragging.
//
// (C) Copyright 2020 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
// published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#include <QDrag>
#include <QMimeData>
#include <QMouseEvent>
#include "rdlibrarymodel.h"
#include "libraryview.h"
LibraryView::LibraryView(QWidget *parent)
: QTreeView(parent)
{
}
void LibraryView::mousePressEvent(QMouseEvent *e)
{
if(e->button()==Qt::LeftButton) {
QDrag *drag=new QDrag(this);
QMimeData *mime=new QMimeData();
RDLibraryModel *mod=(RDLibraryModel *)model();
QModelIndex index=indexAt(e->pos());
QString str="[Rivendell-Cart]\n";
str+="Number="+QString().sprintf("%06u",mod->cartNumber(index))+"\n";
QColor color=mod->data(mod->index(index.row(),1),Qt::TextColorRole).value<QColor>();
if(color.isValid()) {
str+="Color="+color.name()+"\n";
}
QString title=mod->data(mod->index(index.row(),4),Qt::DisplayRole).toString();
if(!title.isEmpty()) {
str+="ButtonText="+title+"\n";
}
printf("DRAG: %s\n",str.toUtf8().constData());
mime->setText(str);
}
QTreeView::mousePressEvent(e);
}

37
rdlibrary/libraryview.h Normal file
View File

@ -0,0 +1,37 @@
// libraryview.h
//
// QTreeView widget that supports cart dragging.
//
// (C) Copyright 2020 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
// published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#ifndef LIBRARYVIEW_H
#define LIBRARYVIEW_H
#include <QTreeView>
class LibraryView : public QTreeView
{
Q_OBJECT
public:
LibraryView(QWidget *parent);
protected:
void mousePressEvent(QMouseEvent *e);
};
#endif // LIBRARYVIEW

View File

@ -166,10 +166,9 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent)
//
// Cart List
//
lib_cart_view=new QTreeView(this);
lib_cart_view=new LibraryView(this);
lib_cart_view->setGeometry(100,0,430,sizeHint().height());
lib_cart_view->setSelectionBehavior(QAbstractItemView::SelectRows);
// lib_cart_view->setShowGrid(false);
lib_cart_view->setSortingEnabled(false);
lib_cart_view->setWordWrap(false);
lib_cart_model=new RDLibraryModel(this);
@ -688,13 +687,14 @@ void MainWidget::dragsChangedData(bool state)
if(state) {
QModelIndexList rows=lib_cart_view->selectionModel()->selectedRows();
if(rows.size()>1) {
//lib_cart_view->selectRow(rows.first().row());
SelectRow(rows.first());
}
lib_cart_view->setSelectionMode(QAbstractItemView::SingleSelection);
}
else {
lib_cart_view->setSelectionMode(QAbstractItemView::ExtendedSelection);
}
lib_cart_view->setDragEnabled(state);
}

View File

@ -24,7 +24,6 @@
#include <QCheckBox>
#include <QComboBox>
#include <QProgressDialog>
#include <QTreeView>
#include <rdcartfilter.h>
#include <rdlibrarymodel.h>
@ -33,6 +32,7 @@
#include "disk_gauge.h"
#include "lib_listview.h"
#include "libraryview.h"
#define RDLIBRARY_GEOMETRY_FILE ".rdlibrary"
#define RDLIBRARY_STEP_SIZE 5000
@ -98,8 +98,7 @@ class MainWidget : public RDWidget
void SendNotification(RDNotification::Action action,unsigned cartnum);
void SetPlayer(RDCart::Type type);
RDCartFilter *lib_cart_filter;
// LibListView *lib_cart_list;
QTreeView *lib_cart_view;
LibraryView *lib_cart_view;
RDLibraryModel *lib_cart_model;
QString lib_filter_text;
QString lib_search_text;

View File

@ -30,6 +30,7 @@ x11 {
SOURCES += edit_schedulercodes.cpp
SOURCES += filter.cpp
SOURCES += lib_listview.cpp
SOURCES += libraryview.cpp
SOURCES += list_reports.cpp
SOURCES += macro_cart.cpp
SOURCES += rdlibrary.cpp
@ -48,6 +49,7 @@ x11 {
HEADERS += edit_schedulercodes.h
HEADERS += filter.h
HEADERS += lib_listview.h
HEADERS += libraryview.h
HEADERS += list_reports.h
HEADERS += macro_cart.h
HEADERS += rdlibrary.h

View File

@ -2,7 +2,7 @@
//
// TableView widget for RDLogEdit
//
// (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
@ -19,7 +19,7 @@
//
//
#include <rdcartdrag.h>
#include <rd3cartdrag.h>
#include "logtableview.h"
#include "logmodel.h"
@ -52,13 +52,13 @@ LogTableView::LogTableView(QWidget *parent)
void LogTableView::dragEnterEvent(QDragEnterEvent *e)
{
e->accept(RDCartDrag::canDecode(e));
e->accept(RD3CartDrag::canDecode(e));
}
void LogTableView::dragMoveEvent(QDragMoveEvent *e)
{
e->accept(RDCartDrag::canDecode(e));
e->accept(RD3CartDrag::canDecode(e));
}
@ -68,7 +68,7 @@ void LogTableView::dropEvent(QDropEvent *e)
int line=-1;
int y_pos=e->pos().y();
if(RDCartDrag::decode(e,&ll)) {
if(RD3CartDrag::decode(e,&ll)) {
line=rowAt(y_pos);
emit cartDropped(line,&ll);
}

View File

@ -2,7 +2,7 @@
//
// Edit a Rivendell Log Event
//
// (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
@ -157,7 +157,7 @@ EditEvent::EditEvent(QString eventname,bool new_event,
//
// Empty Cart Source
//
event_empty_cart=new RDEmptyCart(this);
event_empty_cart=new RD3EmptyCart(this);
event_empty_cart->setGeometry(CENTER_LINE-227,sizeHint().height()-202,32,32);
//

View File

@ -33,7 +33,7 @@
#include <qtextedit.h>
#include <rddialog.h>
#include <rdemptycart.h>
#include <rd3emptycart.h>
#include <rdevent.h>
#include <rdsimpleplayer.h>
@ -166,7 +166,7 @@ class EditEvent : public RDDialog
std::vector<QString> *event_new_events;
RDSimplePlayer *event_player;
QTextEdit *event_remarks_edit;
RDEmptyCart *event_empty_cart;
RD3EmptyCart *event_empty_cart;
};

View File

@ -24,7 +24,7 @@
#include <rdcart.h>
#include <rdconf.h>
#include <rdcartdrag.h>
#include <rd3cartdrag.h>
#include <edit_note.h>
#include <edit_track.h>
@ -482,7 +482,7 @@ void ImportListView::contentsMouseDoubleClickEvent(QMouseEvent *e)
void ImportListView::dragEnterEvent(QDragEnterEvent *e)
{
e->accept(RDCartDrag::canDecode(e));
e->accept(RD3CartDrag::canDecode(e));
}
@ -493,7 +493,7 @@ void ImportListView::dropEvent(QDropEvent *e)
int line=0;
QPoint pos(e->pos().x(),e->pos().y()-header()->sectionRect(0).height());
if(RDCartDrag::decode(e,&cartnum)) {
if(RD3CartDrag::decode(e,&cartnum)) {
if(cartnum==0) {
if(((item=itemAt(pos))==NULL)||(item->text(6).isEmpty())) {
return;

View File

@ -2,7 +2,7 @@
//
// The Library ListView widget for RDLogManager.
//
// (C) Copyright 2002-2018 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
@ -19,7 +19,7 @@
//
//
#include <rdcartdrag.h>
#include <rd3cartdrag.h>
#include <lib_listview.h>
@ -36,8 +36,8 @@ void LibListView::contentsMousePressEvent(QMouseEvent *e)
if(item==NULL) {
return;
}
RDCartDrag *d=new RDCartDrag(item->text(1).toUInt(),item->pixmap(0),
Qt::lightGray,this);
RD3CartDrag *d=new RD3CartDrag(item->text(1).toUInt(),item->pixmap(0),
Qt::lightGray,this);
d->dragCopy();
emit clicked(item);

View File

@ -2,7 +2,7 @@
//
// A Dedicated Cart Wall Utility for Rivendell.
//
// (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
@ -266,7 +266,7 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent)
//
// Empty Cart
//
panel_empty_cart=new RDEmptyCart(this);
panel_empty_cart=new RD3EmptyCart(this);
panel_empty_cart->setGeometry(373,sizeHint().height()-52,32,32);
if(!rda->station()->enableDragdrop()) {
panel_empty_cart->hide();

View File

@ -2,7 +2,7 @@
//
// A Dedicated Cart Wall Utility for Rivendell.
//
// (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,7 +21,7 @@
#ifndef RDPANEL_H
#define RDPANEL_H
#include <rdemptycart.h>
#include <rd3emptycart.h>
#include <rdsound_panel.h>
#include <rdstereometer.h>
#include <rdwidget.h>
@ -67,7 +67,7 @@ class MainWidget : public RDWidget
QString panel_filter;
QString panel_group;
QString panel_schedcode;
RDEmptyCart *panel_empty_cart;
RD3EmptyCart *panel_empty_cart;
};