mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-08-02 17:09:28 +02:00
2021-01-14 Fred Gleason <fredg@paravelsystems.com>
* Reenabled cart dragging in rdlibrary(1). Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
parent
db3f642a86
commit
4ebb261ebf
@ -20784,3 +20784,5 @@
|
||||
2021-01-13 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Renamed the 'RDCartDrag' class to 'RD3CartDrag'.
|
||||
* Renamed the 'RDEmptyCart' widget to 'RD3EmptyCart'.
|
||||
2021-01-14 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Reenabled cart dragging in rdlibrary(1).
|
||||
|
@ -58,6 +58,7 @@ dist_librd_la_SOURCES = dbversion.h\
|
||||
export_spincount.cpp\
|
||||
export_technical.cpp\
|
||||
export_textlog.cpp\
|
||||
rd3cartdrag.cpp rd3cartdrag.h\
|
||||
rdadd_cart.cpp rdadd_cart.h\
|
||||
rdadd_log.cpp rdadd_log.h\
|
||||
rdairplay_conf.cpp rdairplay_conf.h\
|
||||
@ -79,7 +80,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\
|
||||
rd3cartdrag.cpp rd3cartdrag.h\
|
||||
rdcartdrag.cpp rdcartdrag.h\
|
||||
rdcartfilter.cpp rdcartfilter.h\
|
||||
rdcartslot.cpp rdcartslot.h\
|
||||
rdcastsearch.cpp rdcastsearch.h\
|
||||
|
@ -38,6 +38,7 @@ SOURCES += export_soundex.cpp
|
||||
SOURCES += export_technical.cpp
|
||||
SOURCES += export_textlog.cpp
|
||||
SOURCES += html_gpl2.cpp
|
||||
SOURCES += rd3cartdrag.cpp
|
||||
SOURCES += rdadd_log.cpp
|
||||
SOURCES += rdadd_cart.cpp
|
||||
SOURCES += rdairplay_conf.cpp
|
||||
@ -54,7 +55,7 @@ SOURCES += rdcardselector.cpp
|
||||
SOURCES += rdcart.cpp
|
||||
SOURCES += rdcart_dialog.cpp
|
||||
SOURCES += rdcart_search_text.cpp
|
||||
SOURCES += rd3cartdrag.cpp
|
||||
SOURCES += rdcartdrag.cpp
|
||||
SOURCES += rdcartfilter.cpp
|
||||
SOURCES += rdcatch_connect.cpp
|
||||
SOURCES += rdcddblookup.cpp
|
||||
@ -185,6 +186,7 @@ SOURCES += schedruleslist.cpp
|
||||
HEADERS += schedcartlist.h
|
||||
HEADERS += schedruleslist.h
|
||||
HEADERS += rd.h
|
||||
HEADERS += rd3cartdrag.h
|
||||
HEADERS += rdadd_cart.h
|
||||
HEADERS += rdadd_log.h
|
||||
HEADERS += rdairplay_conf.h
|
||||
@ -201,7 +203,7 @@ HEADERS += rdcardselector.h
|
||||
HEADERS += rdcart.h
|
||||
HEADERS += rdcart_dialog.h
|
||||
HEADERS += rdcart_search_text.h
|
||||
HEADERS += rd3cartdrag.h
|
||||
HEADERS += rdcartdrag.h
|
||||
HEADERS += rdcartfilter.h
|
||||
HEADERS += rdcatch_connect.h
|
||||
HEADERS += rdcddblookup.h
|
||||
|
66
lib/rdcartdrag.cpp
Normal file
66
lib/rdcartdrag.cpp
Normal file
@ -0,0 +1,66 @@
|
||||
// rdcartdrag.cpp
|
||||
//
|
||||
// Stored value drag object for Rivendell carts.
|
||||
//
|
||||
// (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
|
||||
// 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 <QPixmap>
|
||||
|
||||
#include "rd.h"
|
||||
#include "rdcartdrag.h"
|
||||
|
||||
RDCartDrag::RDCartDrag(unsigned cartnum,const QString &title,
|
||||
const QColor &color)
|
||||
: QMimeData()
|
||||
{
|
||||
SetData(cartnum,color,title);
|
||||
d_formats.push_back(RDMIMETYPE_CART);
|
||||
}
|
||||
|
||||
|
||||
QStringList RDCartDrag::formats() const
|
||||
{
|
||||
return d_formats;
|
||||
}
|
||||
|
||||
|
||||
bool RDCartDrag::hasFormat(const QString &mimetype) const
|
||||
{
|
||||
return d_formats.contains(mimetype);
|
||||
}
|
||||
|
||||
|
||||
QVariant RDCartDrag::retrieveData(const QString &mimetype,QVariant::Type type)
|
||||
const
|
||||
{
|
||||
return d_data.value(mimetype,QVariant());
|
||||
}
|
||||
|
||||
|
||||
void RDCartDrag::SetData(unsigned cartnum,const QColor &color,
|
||||
const QString &title)
|
||||
{
|
||||
QString str="[Rivendell-Cart]\n";
|
||||
str+="Number="+QString().sprintf("%06u",cartnum)+"\n";
|
||||
if(color.isValid()) {
|
||||
str+="Color="+color.name()+"\n";
|
||||
}
|
||||
if(!title.isEmpty()) {
|
||||
str+="ButtonText="+title+"\n";
|
||||
}
|
||||
d_data[RDMIMETYPE_CART]=str;
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
// lib_listview.h
|
||||
// rdcartdrag.h
|
||||
//
|
||||
// A drag & drop QListView widget for Rivendell's RDLibrary
|
||||
// Stored value drag object for Rivendell carts.
|
||||
//
|
||||
// (C) Copyright 2002-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
|
||||
@ -18,34 +18,32 @@
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
|
||||
#ifndef LIB_LISTVIEW_H
|
||||
#define LIB_LISTVIEW_H
|
||||
#ifndef RDCARTDRAG_H
|
||||
#define RDCARTDRAG_H
|
||||
|
||||
#include <rdlistview.h>
|
||||
#include <QColor>
|
||||
#include <QMap>
|
||||
#include <QMimeData>
|
||||
#include <QPixmap>
|
||||
|
||||
#include "notebubble.h"
|
||||
#include <rdcart.h>
|
||||
#include <rdlog_line.h>
|
||||
|
||||
class LibListView : public RDListView
|
||||
class RDCartDrag : public QMimeData
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
LibListView(QWidget *parent);
|
||||
bool noteBubblesEnabled() const;
|
||||
|
||||
public slots:
|
||||
void enableNoteBubbles(bool state);
|
||||
RDCartDrag(unsigned cartnum,const QString &title,const QColor &color);
|
||||
QStringList formats() const;
|
||||
bool hasFormat(const QString &mimetype) const;
|
||||
|
||||
protected:
|
||||
void leaveEvent(QEvent *e);
|
||||
void contentsMousePressEvent(QMouseEvent *e);
|
||||
void contentsMouseMoveEvent(QMouseEvent *e);
|
||||
void contentsMouseReleaseEvent(QMouseEvent *e);
|
||||
QVariant retrieveData(const QString &mimetype,QVariant::Type type) const;
|
||||
|
||||
private:
|
||||
NoteBubble *list_note_bubble;
|
||||
bool list_note_bubbles_enabled;
|
||||
int list_move_count;
|
||||
void SetData(unsigned cartnum,const QColor &color,const QString &title);
|
||||
QStringList d_formats;
|
||||
QMap<QString,QVariant> d_data;
|
||||
};
|
||||
|
||||
|
||||
#endif // LIB_LISTVIEW_H
|
||||
#endif // RDCARTDRAG_H
|
@ -52,7 +52,6 @@ dist_rdlibrary_SOURCES = audio_cart.cpp audio_cart.h\
|
||||
edit_notes.cpp edit_notes.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\
|
||||
@ -69,7 +68,6 @@ nodist_rdlibrary_SOURCES = moc_audio_cart.cpp\
|
||||
moc_edit_macro.cpp\
|
||||
moc_edit_notes.cpp\
|
||||
moc_edit_schedulercodes.cpp\
|
||||
moc_lib_listview.cpp\
|
||||
moc_libraryview.cpp\
|
||||
moc_list_reports.cpp\
|
||||
moc_macro_cart.cpp\
|
||||
|
@ -1,119 +0,0 @@
|
||||
// lib_listview.cpp
|
||||
//
|
||||
// A drag & drop QListView widget for Rivendell's RDLibrary
|
||||
//
|
||||
// (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
|
||||
// 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 <rd3cartdrag.h>
|
||||
#include <rdlibrary.h>
|
||||
#include <rdlistviewitem.h>
|
||||
|
||||
#include "globals.h"
|
||||
#include "lib_listview.h"
|
||||
|
||||
LibListView::LibListView(QWidget *parent)
|
||||
: RDListView(parent)
|
||||
{
|
||||
list_move_count=-1;
|
||||
list_note_bubbles_enabled=false;
|
||||
|
||||
list_note_bubble=new NoteBubble(this);
|
||||
list_note_bubble->hide();
|
||||
}
|
||||
|
||||
|
||||
bool LibListView::noteBubblesEnabled() const
|
||||
{
|
||||
return list_note_bubbles_enabled;
|
||||
}
|
||||
|
||||
|
||||
void LibListView::enableNoteBubbles(bool state)
|
||||
{
|
||||
list_note_bubbles_enabled=state;
|
||||
}
|
||||
|
||||
|
||||
void LibListView::leaveEvent(QEvent *e)
|
||||
{
|
||||
list_note_bubble->hide();
|
||||
}
|
||||
|
||||
|
||||
void LibListView::contentsMousePressEvent(QMouseEvent *e)
|
||||
{
|
||||
list_move_count=3;
|
||||
Q3ListView::contentsMousePressEvent(e);
|
||||
}
|
||||
|
||||
|
||||
void LibListView::contentsMouseMoveEvent(QMouseEvent *e)
|
||||
{
|
||||
RDListViewItem *item=NULL;
|
||||
|
||||
Q3ListView::contentsMouseMoveEvent(e);
|
||||
|
||||
//
|
||||
// Note Bubbles
|
||||
//
|
||||
if(list_note_bubbles_enabled) {
|
||||
if((item=(RDListViewItem *)itemAt(contentsToViewport(e->pos())))!=NULL) {
|
||||
unsigned cartnum=item->text(1).left(6).toUInt();
|
||||
if(cartnum!=list_note_bubble->cartNumber()) {
|
||||
list_note_bubble->setCartNumber(cartnum);
|
||||
QRect box(contentsToViewport(e->pos()).x(),
|
||||
itemRect(item).y()+itemRect(item).height(),
|
||||
list_note_bubble->sizeHint().width(),
|
||||
list_note_bubble->sizeHint().height());
|
||||
if((box.x()+box.width())>width()) {
|
||||
box.moveLeft(width()-box.width()-20);
|
||||
}
|
||||
if((box.y()+box.height())>height()) {
|
||||
box.moveTop(height()-box.height()-20);
|
||||
}
|
||||
list_note_bubble->setGeometry(box);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Drag-n-Drop
|
||||
//
|
||||
list_move_count--;
|
||||
if(list_move_count==0) {
|
||||
item=(RDListViewItem *)selectedItem();
|
||||
|
||||
if(item==NULL) {
|
||||
return;
|
||||
}
|
||||
if(item->text(MainWidget::OwnedBy).isEmpty()&&!item->parent()) { // Voice tracks and cuts cannot be dragged
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void LibListView::contentsMouseReleaseEvent(QMouseEvent *e)
|
||||
{
|
||||
list_move_count=-1;
|
||||
Q3ListView::contentsMouseReleaseEvent(e);
|
||||
}
|
@ -22,7 +22,8 @@
|
||||
#include <QMimeData>
|
||||
#include <QMouseEvent>
|
||||
|
||||
#include "rdlibrarymodel.h"
|
||||
#include <rdcartdrag.h>
|
||||
#include <rdlibrarymodel.h>
|
||||
|
||||
#include "libraryview.h"
|
||||
|
||||
@ -34,28 +35,20 @@ LibraryView::LibraryView(QWidget *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);
|
||||
|
||||
if(dragEnabled()&&(e->button()==Qt::LeftButton)) {
|
||||
RDLibraryModel *mod=(RDLibraryModel *)model();
|
||||
QModelIndex index=indexAt(e->pos());
|
||||
QDrag *drag=new QDrag(this);
|
||||
RDCartDrag *cd=
|
||||
new RDCartDrag(mod->cartNumber(index),
|
||||
mod->data(mod->index(index.row(),4)).toString(),
|
||||
mod->data(mod->index(index.row(),0),Qt::TextColorRole).
|
||||
value<QColor>());
|
||||
drag->setMimeData(cd);
|
||||
drag->setPixmap(mod->data(mod->index(index.row(),0),Qt::DecorationRole).
|
||||
value<QPixmap>());
|
||||
drag->exec();
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include <rdwidget.h>
|
||||
|
||||
#include "disk_gauge.h"
|
||||
#include "lib_listview.h"
|
||||
#include "libraryview.h"
|
||||
|
||||
#define RDLIBRARY_GEOMETRY_FILE ".rdlibrary"
|
||||
|
@ -29,7 +29,6 @@ x11 {
|
||||
SOURCES += edit_notes.cpp
|
||||
SOURCES += edit_schedulercodes.cpp
|
||||
SOURCES += filter.cpp
|
||||
SOURCES += lib_listview.cpp
|
||||
SOURCES += libraryview.cpp
|
||||
SOURCES += list_reports.cpp
|
||||
SOURCES += macro_cart.cpp
|
||||
@ -48,7 +47,6 @@ x11 {
|
||||
HEADERS += edit_notes.h
|
||||
HEADERS += edit_schedulercodes.h
|
||||
HEADERS += filter.h
|
||||
HEADERS += lib_listview.h
|
||||
HEADERS += libraryview.h
|
||||
HEADERS += list_reports.h
|
||||
HEADERS += macro_cart.h
|
||||
|
Loading…
x
Reference in New Issue
Block a user