mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-11-26 23:30:20 +01:00
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:
@@ -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\
|
||||
|
||||
@@ -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
61
rdlibrary/libraryview.cpp
Normal 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
37
rdlibrary/libraryview.h
Normal 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
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user