mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-11-26 15:20:29 +01:00
2021-02-09 Fred Gleason <fredg@paravelsystems.com>
* Added a 'RDLogLine::transTypeFromString()' method. * Refactored the cart stack lists in the 'Edit Event' dialog in rdlogmanger(1) to use the model based API. Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
@@ -18,10 +18,12 @@
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
|
||||
#include <QMimeSource>
|
||||
#include <QPixmap>
|
||||
|
||||
#include "rd.h"
|
||||
#include "rdcartdrag.h"
|
||||
#include "rdprofile.h"
|
||||
|
||||
RDCartDrag::RDCartDrag(unsigned cartnum,const QString &title,
|
||||
const QColor &color)
|
||||
@@ -44,6 +46,42 @@ bool RDCartDrag::hasFormat(const QString &mimetype) const
|
||||
}
|
||||
|
||||
|
||||
bool RDCartDrag::canDecode(QMimeSource *e)
|
||||
{
|
||||
return e->provides(RDMIMETYPE_CART);
|
||||
}
|
||||
|
||||
|
||||
bool RDCartDrag::decode(QMimeSource *e,unsigned *cartnum,QColor *color,
|
||||
QString *title)
|
||||
{
|
||||
RDProfile *p=new RDProfile();
|
||||
p->setSourceString(QString::fromUtf8(e->encodedData(RDMIMETYPE_CART)));
|
||||
*cartnum=p->intValue("Rivendell-Cart","Number");
|
||||
if(color!=NULL) {
|
||||
color->setNamedColor(p->stringValue("Rivendell-Cart","Color"));
|
||||
}
|
||||
if(title!=NULL) {
|
||||
*title=p->stringValue("Rivendell-Cart","ButtonText");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool RDCartDrag::decode(QMimeSource *e,RDLogLine *ll,
|
||||
RDLogLine::TransType next_trans,int log_mach,
|
||||
bool timescale,RDLogLine::TransType trans)
|
||||
{
|
||||
unsigned cartnum;
|
||||
|
||||
RDCartDrag::decode(e,&cartnum);
|
||||
ll->loadCart(cartnum,next_trans,log_mach,timescale,trans);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
QVariant RDCartDrag::retrieveData(const QString &mimetype,QVariant::Type type)
|
||||
const
|
||||
{
|
||||
|
||||
@@ -35,6 +35,13 @@ class RDCartDrag : public QMimeData
|
||||
RDCartDrag(unsigned cartnum,const QString &title,const QColor &color);
|
||||
QStringList formats() const;
|
||||
bool hasFormat(const QString &mimetype) const;
|
||||
static bool canDecode(QMimeSource *e);
|
||||
static bool decode(QMimeSource *e,unsigned *cartnum,QColor *color=NULL,
|
||||
QString *title=NULL);
|
||||
static bool decode(QMimeSource *e,RDLogLine *ll,
|
||||
RDLogLine::TransType next_trans=RDLogLine::Segue,
|
||||
int log_mach=0,bool timescale=false,
|
||||
RDLogLine::TransType trans=RDLogLine::NoTrans);
|
||||
|
||||
protected:
|
||||
QVariant retrieveData(const QString &mimetype,QVariant::Type type) const;
|
||||
|
||||
@@ -2542,6 +2542,22 @@ QString RDLogLine::transText(RDLogLine::TransType trans)
|
||||
}
|
||||
|
||||
|
||||
RDLogLine::TransType RDLogLine::transTypeFromString(const QString &str)
|
||||
{
|
||||
if(str.toUpper().trimmed()==QObject::tr("PLAY")) {
|
||||
return RDLogLine::Play;
|
||||
}
|
||||
if(str.toUpper().trimmed()==QObject::tr("SEGUE")) {
|
||||
return RDLogLine::Segue;
|
||||
}
|
||||
if(str.toUpper().trimmed()==QObject::tr("STOP")) {
|
||||
return RDLogLine::Stop;
|
||||
}
|
||||
|
||||
return RDLogLine::NoTrans;
|
||||
}
|
||||
|
||||
|
||||
QString RDLogLine::typeText(RDLogLine::Type type)
|
||||
{
|
||||
switch(type) {
|
||||
|
||||
@@ -275,6 +275,7 @@ class RDLogLine
|
||||
int cutnum=-1);
|
||||
static QString startSourceText(RDLogLine::StartSource src);
|
||||
static QString transText(RDLogLine::TransType trans);
|
||||
static TransType transTypeFromString(const QString &str);
|
||||
static QString typeText(RDLogLine::Type type);
|
||||
static QString timeTypeText(RDLogLine::TimeType type);
|
||||
static QString sourceText(RDLogLine::Source src);
|
||||
|
||||
Reference in New Issue
Block a user