From db3f642a86bac18547168eef36158a9aeaee5a03 Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Thu, 14 Jan 2021 15:05:53 -0500 Subject: [PATCH] 2021-01-13 Fred Gleason * Renamed the 'RDCartDrag' class to 'RD3CartDrag'. * Renamed the 'RDEmptyCart' widget to 'RD3EmptyCart'. Signed-off-by: Fred Gleason --- ChangeLog | 3 ++ lib/Makefile.am | 6 +-- lib/lib.pro | 8 +-- lib/{rdcartdrag.cpp => rd3cartdrag.cpp} | 26 +++++----- lib/{rdcartdrag.h => rd3cartdrag.h} | 18 +++---- lib/{rdemptycart.cpp => rd3emptycart.cpp} | 16 +++--- lib/{rdemptycart.h => rd3emptycart.h} | 18 +++---- lib/rdlibrarymodel.cpp | 6 +++ lib/rdlibrarymodel.h | 1 + lib/rdpanel_button.cpp | 10 ++-- lib/rdslotbox.cpp | 8 +-- lib/rdslotbox.h | 2 +- rdairplay/lib_listview.cpp | 8 +-- rdairplay/loglinebox.cpp | 10 ++-- rdairplay/loglinebox.h | 4 +- rdairplay/logtableview.cpp | 10 ++-- rdairplay/rdairplay.cpp | 2 +- rdairplay/rdairplay.h | 6 +-- rdlibrary/Makefile.am | 4 +- rdlibrary/lib_listview.cpp | 8 +-- rdlibrary/libraryview.cpp | 61 +++++++++++++++++++++++ rdlibrary/libraryview.h | 37 ++++++++++++++ rdlibrary/rdlibrary.cpp | 6 +-- rdlibrary/rdlibrary.h | 5 +- rdlibrary/rdlibrary.pro | 2 + rdlogedit/logtableview.cpp | 10 ++-- rdlogmanager/edit_event.cpp | 4 +- rdlogmanager/edit_event.h | 4 +- rdlogmanager/import_listview.cpp | 6 +-- rdlogmanager/lib_listview.cpp | 8 +-- rdpanel/rdpanel.cpp | 4 +- rdpanel/rdpanel.h | 6 +-- 32 files changed, 219 insertions(+), 108 deletions(-) rename lib/{rdcartdrag.cpp => rd3cartdrag.cpp} (81%) rename lib/{rdcartdrag.h => rd3cartdrag.h} (81%) rename lib/{rdemptycart.cpp => rd3emptycart.cpp} (76%) rename lib/{rdemptycart.h => rd3emptycart.h} (78%) create mode 100644 rdlibrary/libraryview.cpp create mode 100644 rdlibrary/libraryview.h diff --git a/ChangeLog b/ChangeLog index 3e940ac9..c4ab15d0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20781,3 +20781,6 @@ 2021-01-13 Fred Gleason * Modified the 'Edit Log' dialog in rdlibrary(1) to use the model-based API. +2021-01-13 Fred Gleason + * Renamed the 'RDCartDrag' class to 'RD3CartDrag'. + * Renamed the 'RDEmptyCart' widget to 'RD3EmptyCart'. diff --git a/lib/Makefile.am b/lib/Makefile.am index 3b203f58..05248c90 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -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\ diff --git a/lib/lib.pro b/lib/lib.pro index b3413e29..4ddd6c2f 100644 --- a/lib/lib.pro +++ b/lib/lib.pro @@ -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 diff --git a/lib/rdcartdrag.cpp b/lib/rd3cartdrag.cpp similarity index 81% rename from lib/rdcartdrag.cpp rename to lib/rd3cartdrag.cpp index 43989f43..c027eb33 100644 --- a/lib/rdcartdrag.cpp +++ b/lib/rd3cartdrag.cpp @@ -1,8 +1,8 @@ -// rdcartdrag.cpp +// rd3cartdrag.cpp // // Stored value drag object for Rivendell carts. // -// (C) Copyright 2013-2018 Fred Gleason +// (C) Copyright 2013-2021 Fred Gleason // // 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 -#include -#include -#include -#include +#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"; diff --git a/lib/rdcartdrag.h b/lib/rd3cartdrag.h similarity index 81% rename from lib/rdcartdrag.h rename to lib/rd3cartdrag.h index e3af02af..0fcd9488 100644 --- a/lib/rdcartdrag.h +++ b/lib/rd3cartdrag.h @@ -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 #include @@ -29,13 +29,13 @@ #include #include -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 diff --git a/lib/rdemptycart.cpp b/lib/rd3emptycart.cpp similarity index 76% rename from lib/rdemptycart.cpp rename to lib/rd3emptycart.cpp index e82814ce..1e145224 100644 --- a/lib/rdemptycart.cpp +++ b/lib/rd3emptycart.cpp @@ -2,7 +2,7 @@ // // A drag source for an empty cart. // -// (C) Copyright 2013,2016 Fred Gleason +// (C) Copyright 2013-2021 Fred Gleason // // 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 +#include "rd3emptycart.h" // // Icons @@ -29,7 +29,7 @@ #include #include -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(); } diff --git a/lib/rdemptycart.h b/lib/rd3emptycart.h similarity index 78% rename from lib/rdemptycart.h rename to lib/rd3emptycart.h index 8ab3646c..fbbde317 100644 --- a/lib/rdemptycart.h +++ b/lib/rd3emptycart.h @@ -1,8 +1,8 @@ -// rdemptycart.h +// rd3emptycart.h // // A drag source for an empty cart. // -// (C) Copyright 2013,2016 Fred Gleason +// (C) Copyright 2013-2021 Fred Gleason // // 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 #include //Added by qt3to4: #include -#include +#include -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 diff --git a/lib/rdlibrarymodel.cpp b/lib/rdlibrarymodel.cpp index 144fb00b..fdeaf741 100644 --- a/lib/rdlibrarymodel.cpp +++ b/lib/rdlibrarymodel.cpp @@ -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 { diff --git a/lib/rdlibrarymodel.h b/lib/rdlibrarymodel.h index e7b97249..f77fb9a9 100644 --- a/lib/rdlibrarymodel.h +++ b/lib/rdlibrarymodel.h @@ -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; diff --git a/lib/rdpanel_button.cpp b/lib/rdpanel_button.cpp index 42f6e43b..a7edee6a 100644 --- a/lib/rdpanel_button.cpp +++ b/lib/rdpanel_button.cpp @@ -2,7 +2,7 @@ // // The SoundPanel Button for RDAirPlay. // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // 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 -#include +#include #include #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); } } diff --git a/lib/rdslotbox.cpp b/lib/rdslotbox.cpp index 27b92239..56f4e838 100644 --- a/lib/rdslotbox.cpp +++ b/lib/rdslotbox.cpp @@ -2,7 +2,7 @@ // // Cart slot label widget for RDCartSlot // -// (C) Copyright 2012-2020 Fred Gleason +// (C) Copyright 2012-2021 Fred Gleason // // 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); } } diff --git a/lib/rdslotbox.h b/lib/rdslotbox.h index da461faa..f0bdb46f 100644 --- a/lib/rdslotbox.h +++ b/lib/rdslotbox.h @@ -31,7 +31,7 @@ #include #include -#include +#include #include #include #include diff --git a/rdairplay/lib_listview.cpp b/rdairplay/lib_listview.cpp index 01e4ee2f..10a2762b 100644 --- a/rdairplay/lib_listview.cpp +++ b/rdairplay/lib_listview.cpp @@ -2,7 +2,7 @@ // // The Log ListView widget for RDAirPlay's Full Log widget. // -// (C) Copyright 2002-2018 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // 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 -#include +#include #include @@ -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(); diff --git a/rdairplay/loglinebox.cpp b/rdairplay/loglinebox.cpp index 819370ec..80fe47c2 100644 --- a/rdairplay/loglinebox.cpp +++ b/rdairplay/loglinebox.cpp @@ -2,7 +2,7 @@ // // On Air Playout Utility for Rivendell. // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // 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); } } diff --git a/rdairplay/loglinebox.h b/rdairplay/loglinebox.h index 7e091bc7..d37b8c20 100644 --- a/rdairplay/loglinebox.h +++ b/rdairplay/loglinebox.h @@ -2,7 +2,7 @@ // // On Air Playout Utility for Rivendell. // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // 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 #include -#include +#include #include #include diff --git a/rdairplay/logtableview.cpp b/rdairplay/logtableview.cpp index f593a729..10d61b5a 100644 --- a/rdairplay/logtableview.cpp +++ b/rdairplay/logtableview.cpp @@ -2,7 +2,7 @@ // // TableView widget for RDAirPlay // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // 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 +#include #include #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); } diff --git a/rdairplay/rdairplay.cpp b/rdairplay/rdairplay.cpp index aa0d5c57..ac4c6830 100644 --- a/rdairplay/rdairplay.cpp +++ b/rdairplay/rdairplay.cpp @@ -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(); diff --git a/rdairplay/rdairplay.h b/rdairplay/rdairplay.h index 7e99402b..5b846435 100644 --- a/rdairplay/rdairplay.h +++ b/rdairplay/rdairplay.h @@ -2,7 +2,7 @@ // // The On Air Playout Utility for Rivendell. // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // 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 -#include +#include #include #include #include @@ -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 air_channel_timers[2]; - RDEmptyCart *air_empty_cart; + RD3EmptyCart *air_empty_cart; }; diff --git a/rdlibrary/Makefile.am b/rdlibrary/Makefile.am index 5b935c2c..b8a88d0e 100644 --- a/rdlibrary/Makefile.am +++ b/rdlibrary/Makefile.am @@ -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\ diff --git a/rdlibrary/lib_listview.cpp b/rdlibrary/lib_listview.cpp index ed10bd99..76cd3e0f 100644 --- a/rdlibrary/lib_listview.cpp +++ b/rdlibrary/lib_listview.cpp @@ -2,7 +2,7 @@ // // A drag & drop QListView widget for Rivendell's RDLibrary // -// (C) Copyright 2002-2018 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // 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 +#include #include #include @@ -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); diff --git a/rdlibrary/libraryview.cpp b/rdlibrary/libraryview.cpp new file mode 100644 index 00000000..0703592a --- /dev/null +++ b/rdlibrary/libraryview.cpp @@ -0,0 +1,61 @@ +// libraryview.cpp +// +// QTreeView widget that supports cart dragging. +// +// (C) Copyright 2020 Fred Gleason +// +// 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 +#include +#include + +#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(); + 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); + +} diff --git a/rdlibrary/libraryview.h b/rdlibrary/libraryview.h new file mode 100644 index 00000000..503b4707 --- /dev/null +++ b/rdlibrary/libraryview.h @@ -0,0 +1,37 @@ +// libraryview.h +// +// QTreeView widget that supports cart dragging. +// +// (C) Copyright 2020 Fred Gleason +// +// 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 + +class LibraryView : public QTreeView +{ + Q_OBJECT + public: + LibraryView(QWidget *parent); + + protected: + void mousePressEvent(QMouseEvent *e); +}; + + +#endif // LIBRARYVIEW diff --git a/rdlibrary/rdlibrary.cpp b/rdlibrary/rdlibrary.cpp index ae8b52bb..17592e24 100644 --- a/rdlibrary/rdlibrary.cpp +++ b/rdlibrary/rdlibrary.cpp @@ -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); } diff --git a/rdlibrary/rdlibrary.h b/rdlibrary/rdlibrary.h index 215cc9e6..44e30377 100644 --- a/rdlibrary/rdlibrary.h +++ b/rdlibrary/rdlibrary.h @@ -24,7 +24,6 @@ #include #include #include -#include #include #include @@ -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; diff --git a/rdlibrary/rdlibrary.pro b/rdlibrary/rdlibrary.pro index d56a99d8..c0bf01e9 100644 --- a/rdlibrary/rdlibrary.pro +++ b/rdlibrary/rdlibrary.pro @@ -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 diff --git a/rdlogedit/logtableview.cpp b/rdlogedit/logtableview.cpp index 7295bfe6..02a2f156 100644 --- a/rdlogedit/logtableview.cpp +++ b/rdlogedit/logtableview.cpp @@ -2,7 +2,7 @@ // // TableView widget for RDLogEdit // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // 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 +#include #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); } diff --git a/rdlogmanager/edit_event.cpp b/rdlogmanager/edit_event.cpp index 9508e8c7..faa7b709 100644 --- a/rdlogmanager/edit_event.cpp +++ b/rdlogmanager/edit_event.cpp @@ -2,7 +2,7 @@ // // Edit a Rivendell Log Event // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // 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); // diff --git a/rdlogmanager/edit_event.h b/rdlogmanager/edit_event.h index 6c58836b..251b9897 100644 --- a/rdlogmanager/edit_event.h +++ b/rdlogmanager/edit_event.h @@ -33,7 +33,7 @@ #include #include -#include +#include #include #include @@ -166,7 +166,7 @@ class EditEvent : public RDDialog std::vector *event_new_events; RDSimplePlayer *event_player; QTextEdit *event_remarks_edit; - RDEmptyCart *event_empty_cart; + RD3EmptyCart *event_empty_cart; }; diff --git a/rdlogmanager/import_listview.cpp b/rdlogmanager/import_listview.cpp index e0cd8fb9..960713bc 100644 --- a/rdlogmanager/import_listview.cpp +++ b/rdlogmanager/import_listview.cpp @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include @@ -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; diff --git a/rdlogmanager/lib_listview.cpp b/rdlogmanager/lib_listview.cpp index 7a0af8a5..1568e305 100644 --- a/rdlogmanager/lib_listview.cpp +++ b/rdlogmanager/lib_listview.cpp @@ -2,7 +2,7 @@ // // The Library ListView widget for RDLogManager. // -// (C) Copyright 2002-2018 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // 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 +#include #include @@ -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); diff --git a/rdpanel/rdpanel.cpp b/rdpanel/rdpanel.cpp index 4f1c32bf..b75b9dae 100644 --- a/rdpanel/rdpanel.cpp +++ b/rdpanel/rdpanel.cpp @@ -2,7 +2,7 @@ // // A Dedicated Cart Wall Utility for Rivendell. // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // 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(); diff --git a/rdpanel/rdpanel.h b/rdpanel/rdpanel.h index 28db8070..73f5d303 100644 --- a/rdpanel/rdpanel.h +++ b/rdpanel/rdpanel.h @@ -2,7 +2,7 @@ // // A Dedicated Cart Wall Utility for Rivendell. // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // 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 +#include #include #include #include @@ -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; };