mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-11-26 15:20:29 +01: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:
@@ -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;
|
||||
}
|
||||
49
lib/rdcartdrag.h
Normal file
49
lib/rdcartdrag.h
Normal file
@@ -0,0 +1,49 @@
|
||||
// rdcartdrag.h
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
#ifndef RDCARTDRAG_H
|
||||
#define RDCARTDRAG_H
|
||||
|
||||
#include <QColor>
|
||||
#include <QMap>
|
||||
#include <QMimeData>
|
||||
#include <QPixmap>
|
||||
|
||||
#include <rdcart.h>
|
||||
#include <rdlog_line.h>
|
||||
|
||||
class RDCartDrag : public QMimeData
|
||||
{
|
||||
public:
|
||||
RDCartDrag(unsigned cartnum,const QString &title,const QColor &color);
|
||||
QStringList formats() const;
|
||||
bool hasFormat(const QString &mimetype) const;
|
||||
|
||||
protected:
|
||||
QVariant retrieveData(const QString &mimetype,QVariant::Type type) const;
|
||||
|
||||
private:
|
||||
void SetData(unsigned cartnum,const QColor &color,const QString &title);
|
||||
QStringList d_formats;
|
||||
QMap<QString,QVariant> d_data;
|
||||
};
|
||||
|
||||
|
||||
#endif // RDCARTDRAG_H
|
||||
Reference in New Issue
Block a user