mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-07-18 09:37:41 +02:00
2018-07-06 Fred Gleason <fredg@paravelsystems.com>
* Added an 'EVENT_LINES' table to the database. * Incremented the database version to 290. * Removed the 'RDEvent::preimportTableName()' method. * Removed the 'RDEvent::postimportTableName()' method.
This commit is contained in:
parent
db70aa4550
commit
08f8b87af4
@ -17087,3 +17087,8 @@
|
||||
* Added an 'ELR_LINES' table to the database.
|
||||
* Incremented the database version to 289.
|
||||
* Removed the 'RDSvc::serviceTableName()' method.
|
||||
2018-07-06 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Added an 'EVENT_LINES' table to the database.
|
||||
* Incremented the database version to 290.
|
||||
* Removed the 'RDEvent::preimportTableName()' method.
|
||||
* Removed the 'RDEvent::postimportTableName()' method.
|
||||
|
@ -41,6 +41,7 @@ EXTRA_DIST = audio_cards.txt\
|
||||
encoder_channels.txt\
|
||||
encoder_samplerates.txt\
|
||||
encoders.txt\
|
||||
event_lines.txt\
|
||||
extended_panel_names.txt\
|
||||
feed_perms.txt\
|
||||
gpio_events.txt\
|
||||
|
16
docs/tables/event_lines.txt
Normal file
16
docs/tables/event_lines.txt
Normal file
@ -0,0 +1,16 @@
|
||||
Event Lines Table Layout for Rivendell
|
||||
|
||||
The EVENT_LINES table holds the per-line data for rdlogmanager(1) pre- and
|
||||
post-import events.
|
||||
|
||||
FIELD NAME TYPE REMARKS
|
||||
------------------------------------------------------------------------
|
||||
ID int(11) signed Primary key, auto-increment
|
||||
EVENT_NAME char(64) From EVENT.NAME
|
||||
TYPE int(11) signed 0=PreImport, 1=PostImport
|
||||
COUNT int(11) signed Order of records
|
||||
EVENT_TYPE int(11) signed 0=Cart, 1=Marker, 2=OpenBracket,
|
||||
3=CloseBracket, 4=Link
|
||||
CART_NUMBER int(10) unsigned From CART.NUMBER
|
||||
TRANS_TYPE int(11) signed 0 = Play, 1 = Stop, 2 = Segue
|
||||
MARKER_COMMENT char(255)
|
@ -129,6 +129,7 @@ dist_librd_la_SOURCES = dbversion.h\
|
||||
rdevent.cpp rdevent.h\
|
||||
rdevent_line.cpp rdevent_line.h\
|
||||
rdevent_player.cpp rdevent_player.h\
|
||||
rdeventimportlist.cpp rdeventimportlist.h\
|
||||
rdexception_dialog.cpp rdexception_dialog.h\
|
||||
rdexport_settings_dialog.cpp rdexport_settings_dialog.h\
|
||||
rdfeed.cpp rdfeed.h\
|
||||
|
@ -24,7 +24,7 @@
|
||||
/*
|
||||
* Current Database Version
|
||||
*/
|
||||
#define RD_VERSION_DATABASE 289
|
||||
#define RD_VERSION_DATABASE 290
|
||||
|
||||
|
||||
#endif // DBVERSION_H
|
||||
|
@ -70,6 +70,7 @@ SOURCES += rdencoderlist.cpp
|
||||
SOURCES += rdescape_string.cpp
|
||||
SOURCES += rdevent.cpp
|
||||
SOURCES += rdevent_line.cpp
|
||||
SOURCES += rdeventimportlist.cpp
|
||||
SOURCES += rdexception_dialog.cpp
|
||||
SOURCES += rdget_ath.cpp
|
||||
SOURCES += rdgetpasswd.cpp
|
||||
@ -215,6 +216,7 @@ HEADERS += rdencoderlist.h
|
||||
HEADERS += rdescape_string.h
|
||||
HEADERS += rdevent.h
|
||||
HEADERS += rdevent_line.h
|
||||
HEADERS += rdeventimportlist.h
|
||||
HEADERS += rdexception_dialog.h
|
||||
HEADERS += rdget_ath.h
|
||||
HEADERS += rdgetpasswd.h
|
||||
|
@ -285,22 +285,6 @@ void RDEvent::setRemarks(const QString &str) const
|
||||
}
|
||||
|
||||
|
||||
QString RDEvent::preimportTableName(const QString event_name)
|
||||
{
|
||||
QString ret=event_name;
|
||||
ret.replace(" ","_");
|
||||
return ret+"_PRE";
|
||||
}
|
||||
|
||||
|
||||
QString RDEvent::postimportTableName(const QString event_name)
|
||||
{
|
||||
QString ret=event_name;
|
||||
ret.replace(" ","_");
|
||||
return ret+"_POST";
|
||||
}
|
||||
|
||||
|
||||
int RDEvent::GetIntValue(const QString &field) const
|
||||
{
|
||||
QString sql;
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// Abstract a Rivendell Log Manager Event
|
||||
//
|
||||
// (C) Copyright 2002-2004,2016 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2002-2004,2016-2018 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
|
||||
@ -75,8 +75,6 @@ class RDEvent
|
||||
void setHaveCode2(QString str);
|
||||
unsigned titleSep();
|
||||
void setTitleSep(unsigned titlesep);
|
||||
static QString preimportTableName(const QString event_name);
|
||||
static QString postimportTableName(const QString event_name);
|
||||
|
||||
private:
|
||||
int GetIntValue(const QString &field) const;
|
||||
|
@ -20,18 +20,19 @@
|
||||
|
||||
#include <qtextstream.h>
|
||||
|
||||
#include <rdconf.h>
|
||||
#include <rdcart.h>
|
||||
#include <rdevent.h>
|
||||
#include <rdevent_line.h>
|
||||
#include <schedcartlist.h>
|
||||
#include <rddb.h>
|
||||
#include <rdescape_string.h>
|
||||
#include "rdconf.h"
|
||||
#include "rdcart.h"
|
||||
#include "rddb.h"
|
||||
#include "rdescape_string.h"
|
||||
#include "rdevent.h"
|
||||
#include "rdevent_line.h"
|
||||
#include "rdeventimportlist.h"
|
||||
#include "schedcartlist.h"
|
||||
|
||||
RDEventLine::RDEventLine()
|
||||
{
|
||||
event_preimport_log=new RDLogEvent();
|
||||
event_postimport_log=new RDLogEvent();
|
||||
event_preimport_list=new RDEventImportList();
|
||||
event_postimport_list=new RDEventImportList();
|
||||
clear();
|
||||
}
|
||||
|
||||
@ -45,8 +46,10 @@ QString RDEventLine::name() const
|
||||
void RDEventLine::setName(const QString &name)
|
||||
{
|
||||
event_name=name;
|
||||
event_preimport_log->setLogName(RDEvent::preimportTableName(event_name));
|
||||
event_postimport_log->setLogName(RDEvent::postimportTableName(event_name));
|
||||
event_preimport_list->setEventName(event_name);
|
||||
event_preimport_list->setType(RDEventImportList::PreImport);
|
||||
event_postimport_list->setEventName(event_name);
|
||||
event_postimport_list->setType(RDEventImportList::PostImport);
|
||||
}
|
||||
|
||||
|
||||
@ -264,19 +267,6 @@ void RDEventLine::setTitleSep(unsigned titlesep)
|
||||
}
|
||||
|
||||
|
||||
|
||||
RDLogEvent *RDEventLine::preimportCarts()
|
||||
{
|
||||
return event_preimport_log;
|
||||
}
|
||||
|
||||
|
||||
RDLogEvent *RDEventLine::postimportCarts()
|
||||
{
|
||||
return event_postimport_log;
|
||||
}
|
||||
|
||||
|
||||
QTime RDEventLine::startTime() const
|
||||
{
|
||||
return event_start_time;
|
||||
@ -317,8 +307,8 @@ void RDEventLine::clear()
|
||||
event_first_transtype=RDLogLine::Segue;
|
||||
event_default_transtype=RDLogLine::Segue;
|
||||
event_color=QColor();
|
||||
event_preimport_log->clear();
|
||||
event_postimport_log->clear();
|
||||
event_preimport_list->clear();
|
||||
event_postimport_list->clear();
|
||||
event_start_time=QTime();
|
||||
event_length=0;
|
||||
event_autofill_slop=-1;
|
||||
@ -387,8 +377,8 @@ bool RDEventLine::load()
|
||||
event_have_code2=q->value(18).toString();
|
||||
|
||||
delete q;
|
||||
event_preimport_log->load();
|
||||
event_postimport_log->load();
|
||||
event_preimport_list->load();
|
||||
event_postimport_list->load();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -448,8 +438,8 @@ bool RDEventLine::save(RDConfig *config)
|
||||
return false;
|
||||
}
|
||||
delete q;
|
||||
event_preimport_log->save(config);
|
||||
event_postimport_log->save(config);
|
||||
event_preimport_list->save();
|
||||
event_postimport_list->save();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -464,8 +454,6 @@ bool RDEventLine::generateLog(QString logname,const QString &svcname,
|
||||
QTime time=event_start_time;
|
||||
QTime fill_start_time;
|
||||
int count=0;
|
||||
// logname.replace(" ","_");
|
||||
RDLogLine *logline;
|
||||
QString import_table;
|
||||
int postimport_length=0;
|
||||
RDLogLine::TransType trans_type=event_first_transtype;
|
||||
@ -514,39 +502,32 @@ bool RDEventLine::generateLog(QString logname,const QString &svcname,
|
||||
//
|
||||
// Pre-Import Carts
|
||||
//
|
||||
for(int i=0;i<event_preimport_log->size();i++) {
|
||||
if((logline=event_preimport_log->logLine(i))!=NULL) {
|
||||
sql=QString("insert into LOG_LINES set ")+
|
||||
"LOG_NAME=\""+RDEscapeString(logname)+"\","+
|
||||
QString().sprintf("LINE_ID=%d,",count)+
|
||||
QString().sprintf("COUNT=%d,",count)+
|
||||
QString().sprintf("TYPE=%d,",logline->type())+
|
||||
QString().sprintf("SOURCE=%d,",RDLogLine::Template)+
|
||||
QString().sprintf("START_TIME=%d,",QTime().msecsTo(time))+
|
||||
QString().sprintf("GRACE_TIME=%d,",grace_time)+
|
||||
QString().sprintf("CART_NUMBER=%u,",logline->cartNumber())+
|
||||
QString().sprintf("TIME_TYPE=%d,",time_type)+
|
||||
"POST_POINT=\""+RDYesNo(post_point)+"\","+
|
||||
QString().sprintf("TRANS_TYPE=%d,",logline->transType())+
|
||||
"COMMENT=\""+RDEscapeString(logline->markerComment())+"\","+
|
||||
QString().sprintf("EVENT_LENGTH=%d",event_length);
|
||||
q=new RDSqlQuery(sql);
|
||||
delete q;
|
||||
count++;
|
||||
time=time.addMSecs(GetLength(logline->cartNumber()));
|
||||
trans_type=event_default_transtype;
|
||||
time_type=RDLogLine::Relative;
|
||||
post_point=false;
|
||||
grace_time=-1;
|
||||
}
|
||||
}
|
||||
postimport_length=0;
|
||||
for(int i=0;i<event_preimport_list->size();i++) {
|
||||
RDEventImportItem *i_item=event_preimport_list->item(i);
|
||||
sql=QString("insert into LOG_LINES set ")+
|
||||
"LOG_NAME=\""+RDEscapeString(logname)+"\","+
|
||||
QString().sprintf("LINE_ID=%d,",count)+
|
||||
QString().sprintf("COUNT=%d,",count)+
|
||||
QString().sprintf("TYPE=%d,",i_item->eventType())+
|
||||
QString().sprintf("SOURCE=%d,",RDLogLine::Template)+
|
||||
QString().sprintf("START_TIME=%d,",QTime().msecsTo(time))+
|
||||
QString().sprintf("GRACE_TIME=%d,",grace_time)+
|
||||
QString().sprintf("CART_NUMBER=%u,",i_item->cartNumber())+
|
||||
QString().sprintf("TIME_TYPE=%d,",time_type)+
|
||||
"POST_POINT=\""+RDYesNo(post_point)+"\","+
|
||||
QString().sprintf("TRANS_TYPE=%d,",i_item->transType())+
|
||||
"COMMENT=\""+RDEscapeString(i_item->markerComment())+"\","+
|
||||
QString().sprintf("EVENT_LENGTH=%d",event_length);
|
||||
RDSqlQuery::apply(sql);
|
||||
count++;
|
||||
time=time.addMSecs(GetLength(q->value(2).toUInt()));
|
||||
trans_type=event_default_transtype;
|
||||
time_type=RDLogLine::Relative;
|
||||
post_point=false;
|
||||
grace_time=-1;
|
||||
|
||||
//
|
||||
// Calculate Post Import Length
|
||||
//
|
||||
for(int i=0;i<event_postimport_log->size();i++) {
|
||||
postimport_length+=
|
||||
GetLength(event_postimport_log->logLine(i)->cartNumber());
|
||||
postimport_length+=GetLength(q->value(2).toUInt());
|
||||
}
|
||||
|
||||
//
|
||||
@ -861,31 +842,29 @@ bool RDEventLine::generateLog(QString logname,const QString &svcname,
|
||||
//
|
||||
// Post-Import Carts
|
||||
//
|
||||
for(int i=0;i<event_postimport_log->size();i++) {
|
||||
if((logline=event_postimport_log->logLine(i))!=NULL) {
|
||||
sql=QString("insert into LOG_LINES set ")+
|
||||
"LOG_NAME=\""+RDEscapeString(logname)+"\","+
|
||||
QString().sprintf("LINE_ID=%d,",count)+
|
||||
QString().sprintf("COUNT=%d,",count)+
|
||||
QString().sprintf("TYPE=%d,",logline->type())+
|
||||
QString().sprintf("SOURCE=%d,",RDLogLine::Template)+
|
||||
QString().sprintf("START_TIME=%d,",QTime().msecsTo(time))+
|
||||
QString().sprintf("GRACE_TIME=%d,",grace_time)+
|
||||
QString().sprintf("CART_NUMBER=%u,",logline->cartNumber())+
|
||||
QString().sprintf("TIME_TYPE=%d,",time_type)+
|
||||
"POST_POINT=\""+RDYesNo(post_point)+"\","+
|
||||
QString().sprintf("TRANS_TYPE=%d,",logline->transType())+
|
||||
"COMMENT=\""+RDEscapeString(logline->markerComment())+"\","+
|
||||
QString().sprintf("EVENT_LENGTH=%d",event_length);
|
||||
q=new RDSqlQuery(sql);
|
||||
delete q;
|
||||
count++;
|
||||
time=time.addMSecs(GetLength(logline->cartNumber()));
|
||||
time_type=RDLogLine::Relative;
|
||||
trans_type=event_default_transtype;
|
||||
post_point=false;
|
||||
grace_time=-1;
|
||||
}
|
||||
for(int i=0;i<event_postimport_list->size();i++) {
|
||||
RDEventImportItem *i_item=event_postimport_list->item(i);
|
||||
sql=QString("insert into LOG_LINES set ")+
|
||||
"LOG_NAME=\""+RDEscapeString(logname)+"\","+
|
||||
QString().sprintf("LINE_ID=%d,",count)+
|
||||
QString().sprintf("COUNT=%d,",count)+
|
||||
QString().sprintf("TYPE=%d,",i_item->eventType())+
|
||||
QString().sprintf("SOURCE=%d,",RDLogLine::Template)+
|
||||
QString().sprintf("START_TIME=%d,",QTime().msecsTo(time))+
|
||||
QString().sprintf("GRACE_TIME=%d,",grace_time)+
|
||||
QString().sprintf("CART_NUMBER=%u,",i_item->cartNumber())+
|
||||
QString().sprintf("TIME_TYPE=%d,",time_type)+
|
||||
"POST_POINT=\""+RDYesNo(post_point)+"\","+
|
||||
QString().sprintf("TRANS_TYPE=%d,",i_item->transType())+
|
||||
"COMMENT=\""+RDEscapeString(i_item->markerComment())+"\","+
|
||||
QString().sprintf("EVENT_LENGTH=%d",event_length);
|
||||
RDSqlQuery::apply(sql);
|
||||
count++;
|
||||
time=time.addMSecs(GetLength(q->value(2).toUInt()));
|
||||
time_type=RDLogLine::Relative;
|
||||
trans_type=event_default_transtype;
|
||||
post_point=false;
|
||||
grace_time=-1;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <qdatetime.h>
|
||||
|
||||
#include <rdlog_event.h>
|
||||
#include <rdeventimportlist.h>
|
||||
#include <rdlog_line.h>
|
||||
|
||||
class RDEventLine
|
||||
@ -71,8 +72,6 @@ class RDEventLine
|
||||
void setHaveCode2(QString str);
|
||||
unsigned titleSep() const;
|
||||
void setTitleSep(unsigned titlesep);
|
||||
RDLogEvent *preimportCarts();
|
||||
RDLogEvent *postimportCarts();
|
||||
QTime startTime() const;
|
||||
void setStartTime(const QTime &time);
|
||||
int length() const;
|
||||
@ -103,8 +102,8 @@ class RDEventLine
|
||||
RDLogLine::TransType event_first_transtype;
|
||||
RDLogLine::TransType event_default_transtype;
|
||||
QColor event_color;
|
||||
RDLogEvent *event_preimport_log;
|
||||
RDLogEvent *event_postimport_log;
|
||||
RDEventImportList *event_preimport_list;
|
||||
RDEventImportList *event_postimport_list;
|
||||
QTime event_start_time;
|
||||
int event_length;
|
||||
int event_autofill_slop;
|
||||
|
206
lib/rdeventimportlist.cpp
Normal file
206
lib/rdeventimportlist.cpp
Normal file
@ -0,0 +1,206 @@
|
||||
// rdeventimportlist.cpp
|
||||
//
|
||||
// Abstract an rdlogmanager(1) Import List
|
||||
//
|
||||
// (C) Copyright 2018 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 "rddb.h"
|
||||
#include "rdescape_string.h"
|
||||
#include "rdeventimportlist.h"
|
||||
|
||||
RDEventImportItem::RDEventImportItem()
|
||||
{
|
||||
event_type=RDLogLine::UnknownType;
|
||||
event_cart_number=0;
|
||||
event_trans_type=RDLogLine::Play;
|
||||
event_marker_comment="";
|
||||
}
|
||||
|
||||
|
||||
RDLogLine::Type RDEventImportItem::eventType() const
|
||||
{
|
||||
return event_type;
|
||||
}
|
||||
|
||||
|
||||
void RDEventImportItem::setEventType(RDLogLine::Type type)
|
||||
{
|
||||
event_type=type;
|
||||
}
|
||||
|
||||
|
||||
unsigned RDEventImportItem::cartNumber() const
|
||||
{
|
||||
return event_cart_number;
|
||||
}
|
||||
|
||||
|
||||
void RDEventImportItem::setCartNumber(unsigned cartnum)
|
||||
{
|
||||
event_cart_number=cartnum;
|
||||
}
|
||||
|
||||
|
||||
RDLogLine::TransType RDEventImportItem::transType() const
|
||||
{
|
||||
return event_trans_type;
|
||||
}
|
||||
|
||||
|
||||
void RDEventImportItem::setTransType(RDLogLine::TransType type)
|
||||
{
|
||||
event_trans_type=type;
|
||||
}
|
||||
|
||||
|
||||
QString RDEventImportItem::markerComment() const
|
||||
{
|
||||
return event_marker_comment;
|
||||
}
|
||||
|
||||
|
||||
void RDEventImportItem::setMarkerComment(const QString &str)
|
||||
{
|
||||
event_marker_comment=str;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
RDEventImportList::RDEventImportList()
|
||||
{
|
||||
list_event_name="";
|
||||
list_type=RDEventImportList::PreImport;
|
||||
}
|
||||
|
||||
|
||||
QString RDEventImportList::eventName() const
|
||||
{
|
||||
return list_event_name;
|
||||
}
|
||||
|
||||
|
||||
void RDEventImportList::setEventName(const QString &str)
|
||||
{
|
||||
list_event_name=str;
|
||||
}
|
||||
|
||||
|
||||
RDEventImportList::ImportType RDEventImportList::type() const
|
||||
{
|
||||
return list_type;
|
||||
}
|
||||
|
||||
|
||||
void RDEventImportList::setType(RDEventImportList::ImportType type)
|
||||
{
|
||||
list_type=type;
|
||||
}
|
||||
|
||||
|
||||
int RDEventImportList::size()
|
||||
{
|
||||
return list_items.size();
|
||||
}
|
||||
|
||||
|
||||
RDEventImportItem *RDEventImportList::item(int n) const
|
||||
{
|
||||
return list_items.at(n);
|
||||
}
|
||||
|
||||
|
||||
void RDEventImportList::takeItem(int before_line,RDEventImportItem *item)
|
||||
{
|
||||
list_items.insert(list_items.begin()+before_line,item);
|
||||
}
|
||||
|
||||
|
||||
void RDEventImportList::removeItem(int n)
|
||||
{
|
||||
delete list_items.at(n);
|
||||
list_items.erase(list_items.begin()+n);
|
||||
}
|
||||
|
||||
|
||||
void RDEventImportList::moveItem(int from_line,int to_line)
|
||||
{
|
||||
RDEventImportItem *item=list_items.at(from_line);
|
||||
list_items.erase(list_items.begin()+from_line);
|
||||
if(to_line>=(int)list_items.size()) {
|
||||
list_items.push_back(item);
|
||||
}
|
||||
else {
|
||||
list_items.insert(list_items.begin()+to_line,item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void RDEventImportList::load()
|
||||
{
|
||||
list_items.clear();
|
||||
QString sql=QString("select ")+
|
||||
"EVENT_TYPE,"+ // 00
|
||||
"CART_NUMBER,"+ // 01
|
||||
"TRANS_TYPE,"+ // 02
|
||||
"MARKER_COMMENT "+ // 03
|
||||
"from EVENT_LINES where "+
|
||||
"EVENT_NAME=\""+RDEscapeString(list_event_name)+"\" && "+
|
||||
QString().sprintf("TYPE=%d ",list_type)+
|
||||
"order by COUNT";
|
||||
RDSqlQuery *q=new RDSqlQuery(sql);
|
||||
while(q->next()) {
|
||||
list_items.push_back(new RDEventImportItem());
|
||||
list_items.back()->setEventType((RDLogLine::Type)q->value(0).toInt());
|
||||
list_items.back()->setCartNumber(q->value(1).toUInt());
|
||||
list_items.back()->setTransType((RDLogLine::TransType)q->value(2).toInt());
|
||||
list_items.back()->setMarkerComment(q->value(3).toString());
|
||||
}
|
||||
delete q;
|
||||
}
|
||||
|
||||
|
||||
void RDEventImportList::save() const
|
||||
{
|
||||
QString sql=QString("delete from EVENT_LINES where ")+
|
||||
"EVENT_NAME=\""+RDEscapeString(list_event_name)+"\" && "+
|
||||
QString().sprintf("TYPE=%d",list_type);
|
||||
RDSqlQuery::apply(sql);
|
||||
for(unsigned i=0;i<list_items.size();i++) {
|
||||
RDEventImportItem *item=list_items.at(i);
|
||||
sql=QString("insert into EVENT_LINES set ")+
|
||||
"EVENT_NAME=\""+RDEscapeString(list_event_name)+"\","+
|
||||
QString().sprintf("TYPE=%d,",list_type)+
|
||||
QString().sprintf("COUNT=%u,",i)+
|
||||
QString().sprintf("EVENT_TYPE=%d,",item->eventType())+
|
||||
QString().sprintf("CART_NUMBER=%u,",item->cartNumber())+
|
||||
QString().sprintf("TRANS_TYPE=%d,",item->transType())+
|
||||
"MARKER_COMMENT=\""+RDEscapeString(item->markerComment())+"\"";
|
||||
RDSqlQuery::apply(sql);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void RDEventImportList::clear()
|
||||
{
|
||||
list_event_name="";
|
||||
list_type=RDEventImportList::PreImport;
|
||||
for(unsigned i=0;i<list_items.size();i++) {
|
||||
delete list_items.at(i);
|
||||
}
|
||||
list_items.clear();
|
||||
}
|
75
lib/rdeventimportlist.h
Normal file
75
lib/rdeventimportlist.h
Normal file
@ -0,0 +1,75 @@
|
||||
// rdeventimportlist.h
|
||||
//
|
||||
// Abstract an rdlogmanager(1) Import List
|
||||
//
|
||||
// (C) Copyright 2018 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 RDEVENTIMPORTLIST_H
|
||||
#define RDEVENTIMPORTLIST_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <rdlog_line.h>
|
||||
|
||||
class RDEventImportItem
|
||||
{
|
||||
public:
|
||||
RDEventImportItem();
|
||||
RDLogLine::Type eventType() const;
|
||||
void setEventType(RDLogLine::Type type);
|
||||
unsigned cartNumber() const;
|
||||
void setCartNumber(unsigned cartnum);
|
||||
RDLogLine::TransType transType() const;
|
||||
void setTransType(RDLogLine::TransType type);
|
||||
QString markerComment() const;
|
||||
void setMarkerComment(const QString &str);
|
||||
|
||||
private:
|
||||
RDLogLine::Type event_type;
|
||||
unsigned event_cart_number;
|
||||
RDLogLine::TransType event_trans_type;
|
||||
QString event_marker_comment;
|
||||
};
|
||||
|
||||
|
||||
class RDEventImportList
|
||||
{
|
||||
public:
|
||||
enum ImportType {PreImport=0,PostImport=1};
|
||||
RDEventImportList();
|
||||
QString eventName() const;
|
||||
void setEventName(const QString &str);
|
||||
ImportType type() const;
|
||||
void setType(ImportType type);
|
||||
int size();
|
||||
RDEventImportItem *item(int n) const;
|
||||
void takeItem(int before_line,RDEventImportItem *item);
|
||||
void removeItem(int n);
|
||||
void moveItem(int from_line,int to_line);
|
||||
void load();
|
||||
void save() const;
|
||||
void clear();
|
||||
|
||||
private:
|
||||
QString list_event_name;
|
||||
ImportType list_type;
|
||||
std::vector<RDEventImportItem *> list_items;
|
||||
};
|
||||
|
||||
|
||||
#endif // RDEVENTIMPORTLIST_H
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include <rdconf.h>
|
||||
#include <rddb.h>
|
||||
#include <rdescape_string.h>
|
||||
#include <rdeventimportlist.h>
|
||||
|
||||
#include "add_event.h"
|
||||
#include "edit_event.h"
|
||||
@ -391,9 +392,7 @@ EditEvent::EditEvent(QString eventname,bool new_event,
|
||||
sizeHint().width()-CENTER_LINE-75,125);
|
||||
event_preimport_list->setAllColumnsShowFocus(true);
|
||||
event_preimport_list->setItemMargin(5);
|
||||
event_preimport_list->logEvent()->
|
||||
setLogName(QString().sprintf("%s_PRE",(const char *)event_name).
|
||||
replace(' ',"_"));
|
||||
event_preimport_list->load(event_name,RDEventImportList::PreImport);
|
||||
event_preimport_list->setSortColumn(-1);
|
||||
connect(event_preimport_list,SIGNAL(sizeChanged(int)),
|
||||
this,SLOT(preimportChangedData(int)));
|
||||
@ -628,9 +627,7 @@ EditEvent::EditEvent(QString eventname,bool new_event,
|
||||
event_postimport_list->setItemMargin(5);
|
||||
event_postimport_list->setSortColumn(-1);
|
||||
event_postimport_list->setAllowStop(false);
|
||||
event_postimport_list->logEvent()->
|
||||
setLogName(QString().sprintf("%s_POST",(const char *)event_name).
|
||||
replace(' ',"_"));
|
||||
event_postimport_list->load(event_name,RDEventImportList::PostImport);
|
||||
event_postimport_list->addColumn("");
|
||||
event_postimport_list->addColumn(tr("CART"));
|
||||
event_postimport_list->addColumn(tr("GROUP"));
|
||||
@ -798,9 +795,9 @@ EditEvent::EditEvent(QString eventname,bool new_event,
|
||||
delete q;
|
||||
|
||||
if(!new_event) {
|
||||
event_preimport_list->logEvent()->load();
|
||||
event_preimport_list->load(event_name,RDEventImportList::PreImport);
|
||||
event_preimport_list->refreshList();
|
||||
event_postimport_list->logEvent()->load();
|
||||
event_postimport_list->load(event_name,RDEventImportList::PostImport);
|
||||
event_postimport_list->refreshList();
|
||||
}
|
||||
|
||||
@ -1092,7 +1089,7 @@ void EditEvent::preimportUpData()
|
||||
event_preimport_list->ensureItemVisible(item);
|
||||
return;
|
||||
}
|
||||
event_preimport_list->logEvent()->move(line,line-1);
|
||||
event_preimport_list->move(line,line-1);
|
||||
event_preimport_list->validateTransitions();
|
||||
event_preimport_list->refreshList(line-1);
|
||||
}
|
||||
@ -1110,9 +1107,10 @@ void EditEvent::preimportDownData()
|
||||
event_preimport_list->ensureItemVisible(item);
|
||||
return;
|
||||
}
|
||||
event_preimport_list->logEvent()->move(line,line+1);
|
||||
event_preimport_list->move(line,line+1);
|
||||
event_preimport_list->validateTransitions();
|
||||
event_preimport_list->refreshList(line+1);
|
||||
event_preimport_list->ensureItemVisible(item);
|
||||
}
|
||||
|
||||
|
||||
@ -1128,7 +1126,7 @@ void EditEvent::postimportUpData()
|
||||
event_postimport_list->ensureItemVisible(item);
|
||||
return;
|
||||
}
|
||||
event_postimport_list->logEvent()->move(line,line-1);
|
||||
event_postimport_list->move(line,line-1);
|
||||
event_postimport_list->validateTransitions();
|
||||
event_postimport_list->refreshList(line-1);
|
||||
}
|
||||
@ -1146,7 +1144,7 @@ void EditEvent::postimportDownData()
|
||||
event_postimport_list->ensureItemVisible(item);
|
||||
return;
|
||||
}
|
||||
event_postimport_list->logEvent()->move(line,line+1);
|
||||
event_postimport_list->move(line,line+1);
|
||||
event_postimport_list->validateTransitions();
|
||||
event_postimport_list->refreshList(line+1);
|
||||
}
|
||||
@ -1388,7 +1386,6 @@ void EditEvent::SetPostTransition()
|
||||
void EditEvent::Save()
|
||||
{
|
||||
QString properties;
|
||||
QString listname;
|
||||
|
||||
event_event->setRemarks(event_remarks_edit->text());
|
||||
if(event_position_box->isChecked()) {
|
||||
@ -1402,31 +1399,18 @@ void EditEvent::Save()
|
||||
event_event->setPostPoint(event_post_box->isChecked());
|
||||
event_event->setFirstTransType((RDLogLine::TransType)
|
||||
event_transtype_box->currentItem());
|
||||
switch((RDLogLine::TransType)event_transtype_box->currentItem()) {
|
||||
case RDLogLine::Play:
|
||||
break;
|
||||
|
||||
case RDLogLine::Segue:
|
||||
break;
|
||||
|
||||
case RDLogLine::Stop:
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch(event_grace_group->selectedId()) {
|
||||
case 0:
|
||||
event_event->setGraceTime(0);
|
||||
break;
|
||||
case 0:
|
||||
event_event->setGraceTime(0);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
event_event->setGraceTime(-1);
|
||||
break;
|
||||
case 1:
|
||||
event_event->setGraceTime(-1);
|
||||
break;
|
||||
|
||||
default:
|
||||
event_event->setGraceTime(QTime().msecsTo(event_grace_edit->time()));
|
||||
break;
|
||||
default:
|
||||
event_event->setGraceTime(QTime().msecsTo(event_grace_edit->time()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -1445,20 +1429,6 @@ void EditEvent::Save()
|
||||
event_event->setAutofillSlop(-1);
|
||||
}
|
||||
event_event->setUseTimescale(event_timescale_box->isChecked());
|
||||
|
||||
switch((RDEventLine::ImportSource)event_source_group->selectedId()) {
|
||||
case RDEventLine::Traffic:
|
||||
break;
|
||||
|
||||
case RDEventLine::Music:
|
||||
break;
|
||||
|
||||
case RDEventLine::Scheduler:
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
event_event->
|
||||
setImportSource((RDEventLine::ImportSource)event_source_group->selectedId());
|
||||
event_event->setStartSlop(QTime().msecsTo(event_startslop_edit->time()));
|
||||
@ -1467,19 +1437,6 @@ void EditEvent::Save()
|
||||
event_event->
|
||||
setFirstTransType((RDLogLine::TransType)event_firsttrans_box->
|
||||
currentItem());
|
||||
switch((RDLogLine::TransType)event_firsttrans_box->currentItem()) {
|
||||
case RDLogLine::Play:
|
||||
break;
|
||||
|
||||
case RDLogLine::Segue:
|
||||
break;
|
||||
|
||||
case RDLogLine::Stop:
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
event_event->
|
||||
setDefaultTransType((RDLogLine::TransType)event_defaulttrans_box->
|
||||
@ -1502,14 +1459,12 @@ void EditEvent::Save()
|
||||
event_event->setHaveCode(event_have_code2_box->currentText());
|
||||
event_event->setHaveCode2(QString(""));
|
||||
}
|
||||
listname=event_name;
|
||||
listname.replace(" ","_");
|
||||
event_preimport_list->logEvent()->
|
||||
setLogName(QString().sprintf("%s_PRE",(const char *)listname));
|
||||
event_preimport_list->logEvent()->save(rda->config(),false);
|
||||
event_postimport_list->logEvent()->
|
||||
setLogName(QString().sprintf("%s_POST",(const char *)listname));
|
||||
event_postimport_list->logEvent()->save(rda->config(),false);
|
||||
|
||||
event_preimport_list->setEventName(event_name);
|
||||
event_preimport_list->save();
|
||||
event_postimport_list->setEventName(event_name);
|
||||
event_postimport_list->save();
|
||||
|
||||
event_saved=true;
|
||||
}
|
||||
|
||||
@ -1550,38 +1505,38 @@ QString EditEvent::GetProperties()
|
||||
}
|
||||
}
|
||||
switch(trans_type) {
|
||||
case RDLogLine::Play:
|
||||
properties+=tr("PLAY");
|
||||
break;
|
||||
case RDLogLine::Play:
|
||||
properties+=tr("PLAY");
|
||||
break;
|
||||
|
||||
case RDLogLine::Segue:
|
||||
properties+=tr("SEGUE");
|
||||
break;
|
||||
case RDLogLine::Segue:
|
||||
properties+=tr("SEGUE");
|
||||
break;
|
||||
|
||||
case RDLogLine::Stop:
|
||||
properties+=tr("STOP");
|
||||
break;
|
||||
case RDLogLine::Stop:
|
||||
properties+=tr("STOP");
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if(event_timetype_box->isChecked()) {
|
||||
switch(event_grace_group->selectedId()) {
|
||||
case 0:
|
||||
properties+=tr(", Timed(Start)");
|
||||
break;
|
||||
case 0:
|
||||
properties+=tr(", Timed(Start)");
|
||||
break;
|
||||
|
||||
case 1:
|
||||
properties+=tr(", Timed(MakeNext)");
|
||||
break;
|
||||
case 1:
|
||||
properties+=tr(", Timed(MakeNext)");
|
||||
break;
|
||||
|
||||
default:
|
||||
str=QString(tr("Timed(Wait"));
|
||||
properties+=
|
||||
QString().sprintf(", %s %s)",(const char *)str,(const char *)
|
||||
event_grace_edit->time().toString("mm:ss"));
|
||||
break;
|
||||
default:
|
||||
str=QString(tr("Timed(Wait"));
|
||||
properties+=
|
||||
QString().sprintf(", %s %s)",(const char *)str,(const char *)
|
||||
event_grace_edit->time().toString("mm:ss"));
|
||||
break;
|
||||
}
|
||||
if(event_post_box->isChecked()) {
|
||||
properties+=tr(", Post");
|
||||
@ -1594,21 +1549,20 @@ QString EditEvent::GetProperties()
|
||||
properties+=tr(", Scale");
|
||||
}
|
||||
switch((RDEventLine::ImportSource)event_source_group->selectedId()) {
|
||||
case RDEventLine::Traffic:
|
||||
properties+=tr(", Traffic");
|
||||
break;
|
||||
case RDEventLine::Traffic:
|
||||
properties+=tr(", Traffic");
|
||||
break;
|
||||
|
||||
case RDEventLine::Music:
|
||||
properties+=tr(", Music");
|
||||
break;
|
||||
case RDEventLine::Music:
|
||||
properties+=tr(", Music");
|
||||
break;
|
||||
|
||||
case RDEventLine::Scheduler:
|
||||
properties+=tr(", Scheduler");
|
||||
break;
|
||||
case RDEventLine::Scheduler:
|
||||
properties+=tr(", Scheduler");
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if(event_nestevent_box->currentItem()>0) {
|
||||
properties+=tr(", Inline Traffic");
|
||||
@ -1655,6 +1609,7 @@ void EditEvent::AbandonEvent(QString name)
|
||||
q=new RDSqlQuery(sql);
|
||||
delete q;
|
||||
|
||||
rda->dropTable(RDEvent::preimportTableName(name));
|
||||
rda->dropTable(RDEvent::postimportTableName(name));
|
||||
sql=QString("delete from EVENT_LINES where ")+
|
||||
"EVENT_NAME=\""+RDEscapeString(name)+"\"";
|
||||
RDSqlQuery::apply(sql);
|
||||
}
|
||||
|
@ -36,16 +36,15 @@
|
||||
#include <qbuttongroup.h>
|
||||
#include <qtextedit.h>
|
||||
|
||||
#include <rdtransportbutton.h>
|
||||
|
||||
#include <rduser.h>
|
||||
#include <rdemptycart.h>
|
||||
#include <rdevent.h>
|
||||
#include <rdevent_line.h>
|
||||
#include <rdsimpleplayer.h>
|
||||
#include <rdtransportbutton.h>
|
||||
#include <rduser.h>
|
||||
|
||||
#include <lib_listview.h>
|
||||
#include <import_listview.h>
|
||||
#include "import_listview.h"
|
||||
#include "lib_listview.h"
|
||||
|
||||
//
|
||||
// Layout
|
||||
|
@ -43,6 +43,11 @@ ImportListView::ImportListView(QWidget *parent)
|
||||
{
|
||||
import_parent=parent;
|
||||
|
||||
//
|
||||
// Import List
|
||||
//
|
||||
import_list=new RDEventImportList();
|
||||
|
||||
//
|
||||
// Create Icons
|
||||
//
|
||||
@ -79,7 +84,6 @@ ImportListView::ImportListView(QWidget *parent)
|
||||
import_force_trans=RDLogLine::NoTrans;
|
||||
import_allow_stop=true;
|
||||
import_allow_first_trans=true;
|
||||
import_log=new RDLogEvent();
|
||||
|
||||
setAcceptDrops(true);
|
||||
}
|
||||
@ -104,9 +108,31 @@ void ImportListView::setAllowFirstTrans(bool state)
|
||||
}
|
||||
|
||||
|
||||
RDLogEvent *ImportListView::logEvent()
|
||||
void ImportListView::move(int from_line,int to_line)
|
||||
{
|
||||
return import_log;
|
||||
import_list->moveItem(from_line,to_line);
|
||||
}
|
||||
|
||||
|
||||
void ImportListView::setEventName(const QString &str)
|
||||
{
|
||||
import_list->setEventName(str);
|
||||
}
|
||||
|
||||
|
||||
bool ImportListView::load(const QString &event_name,
|
||||
RDEventImportList::ImportType type)
|
||||
{
|
||||
import_list->setEventName(event_name);
|
||||
import_list->setType(type);
|
||||
import_list->load();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void ImportListView::save()
|
||||
{
|
||||
import_list->save();
|
||||
}
|
||||
|
||||
|
||||
@ -115,65 +141,76 @@ void ImportListView::refreshList(int line)
|
||||
QListViewItem *item;
|
||||
QListViewItem *select_item=NULL;
|
||||
QString sql;
|
||||
RDLogLine *logline;
|
||||
RDEventImportItem *i_item;
|
||||
int total_len=0;
|
||||
RDCart *cart=NULL;
|
||||
|
||||
clear();
|
||||
for(int i=import_log->size()-1;i>=0;i--) {
|
||||
for(int i=import_list->size()-1;i>=0;i--) {
|
||||
item=new QListViewItem(this);
|
||||
if((logline=import_log->logLine(i))!=NULL) {
|
||||
switch(logline->type()) {
|
||||
case RDLogLine::Cart:
|
||||
item->setPixmap(0,*import_playout_map);
|
||||
item->setText(1,QString().sprintf("%06u",logline->cartNumber()));
|
||||
item->setText(2,logline->groupName());
|
||||
item->setText(4,logline->title());
|
||||
break;
|
||||
|
||||
case RDLogLine::Macro:
|
||||
item->setPixmap(0,*import_macro_map);
|
||||
item->setText(1,QString().sprintf("%06u",logline->cartNumber()));
|
||||
item->setText(2,logline->groupName());
|
||||
item->setText(4,logline->title());
|
||||
break;
|
||||
|
||||
case RDLogLine::Marker:
|
||||
item->setPixmap(0,*import_notemarker_map);
|
||||
item->setText(2,tr("Marker"));
|
||||
item->setText(4,tr("[Log Note]"));
|
||||
break;
|
||||
|
||||
case RDLogLine::Track:
|
||||
item->setPixmap(0,*import_mic16_map);
|
||||
item->setText(2,tr("Track"));
|
||||
item->setText(4,tr("[Voice Track]"));
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
if((i_item=import_list->item(i))!=NULL) {
|
||||
if((i_item->eventType()==RDLogLine::Cart)||
|
||||
(i_item->eventType()==RDLogLine::Macro)) {
|
||||
cart=new RDCart(i_item->cartNumber());
|
||||
}
|
||||
item->setText(3,RDGetTimeLength(logline->forcedLength(),false,false));
|
||||
total_len+=logline->forcedLength();
|
||||
switch(logline->transType()) {
|
||||
case RDLogLine::Play:
|
||||
item->setText(5,tr("PLAY"));
|
||||
break;
|
||||
switch(i_item->eventType()) {
|
||||
case RDLogLine::Cart:
|
||||
item->setPixmap(0,*import_playout_map);
|
||||
item->setText(1,QString().sprintf("%06u",i_item->cartNumber()));
|
||||
item->setText(2,cart->groupName());
|
||||
item->setText(3,RDGetTimeLength(cart->forcedLength(),false,false));
|
||||
item->setText(4,cart->title());
|
||||
total_len+=cart->forcedLength();
|
||||
break;
|
||||
|
||||
case RDLogLine::Macro:
|
||||
item->setPixmap(0,*import_macro_map);
|
||||
item->setText(1,QString().sprintf("%06u",i_item->cartNumber()));
|
||||
item->setText(2,cart->groupName());
|
||||
item->setText(3,RDGetTimeLength(cart->forcedLength(),false,false));
|
||||
item->setText(4,cart->title());
|
||||
total_len+=cart->forcedLength();
|
||||
break;
|
||||
|
||||
case RDLogLine::Segue:
|
||||
item->setText(5,tr("SEGUE"));
|
||||
break;
|
||||
case RDLogLine::Marker:
|
||||
item->setPixmap(0,*import_notemarker_map);
|
||||
item->setText(2,tr("Marker"));
|
||||
item->setText(4,tr("[Log Note]"));
|
||||
break;
|
||||
|
||||
case RDLogLine::Stop:
|
||||
item->setText(5,tr("STOP"));
|
||||
break;
|
||||
case RDLogLine::Track:
|
||||
item->setPixmap(0,*import_mic16_map);
|
||||
item->setText(2,tr("Track"));
|
||||
item->setText(4,tr("[Voice Track]"));
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch(i_item->transType()) {
|
||||
case RDLogLine::Play:
|
||||
item->setText(5,tr("PLAY"));
|
||||
break;
|
||||
|
||||
case RDLogLine::Segue:
|
||||
item->setText(5,tr("SEGUE"));
|
||||
break;
|
||||
|
||||
case RDLogLine::Stop:
|
||||
item->setText(5,tr("STOP"));
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
item->setText(6,QString().sprintf("%d",i));
|
||||
if(i==line) {
|
||||
select_item=item;
|
||||
}
|
||||
if(cart!=NULL) {
|
||||
delete cart;
|
||||
cart=NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(select_item!=NULL) {
|
||||
@ -186,20 +223,20 @@ void ImportListView::refreshList(int line)
|
||||
|
||||
void ImportListView::validateTransitions()
|
||||
{
|
||||
if(logEvent()->size()>0) {
|
||||
if(import_list->size()>0) {
|
||||
if(import_force_trans!=RDLogLine::NoTrans) {
|
||||
logEvent()->logLine(0)->setTransType(import_force_trans);
|
||||
import_list->item(0)->setTransType(import_force_trans);
|
||||
}
|
||||
else {
|
||||
if((logEvent()->logLine(0)->transType()==RDLogLine::Stop)&&
|
||||
if((import_list->item(0)->transType()==RDLogLine::Stop)&&
|
||||
(!import_allow_stop)) {
|
||||
logEvent()->logLine(0)->setTransType(RDLogLine::Segue);
|
||||
import_list->item(0)->setTransType(RDLogLine::Segue);
|
||||
}
|
||||
}
|
||||
}
|
||||
for(int i=1;i<logEvent()->size();i++) {
|
||||
if(logEvent()->logLine(i)->transType()==RDLogLine::Stop) {
|
||||
logEvent()->logLine(1)->setTransType(RDLogLine::Segue);
|
||||
for(int i=1;i<import_list->size();i++) {
|
||||
if(import_list->item(i)->transType()==RDLogLine::Stop) {
|
||||
import_list->item(1)->setTransType(RDLogLine::Segue);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -228,13 +265,13 @@ void ImportListView::aboutToShowData()
|
||||
import_menu->setItemEnabled(8,false);
|
||||
return;
|
||||
}
|
||||
if(import_menu_logline->type()==RDLogLine::Marker) {
|
||||
if(import_menu_i_item->eventType()==RDLogLine::Marker) {
|
||||
import_menu->setItemEnabled(1,true);
|
||||
}
|
||||
else {
|
||||
import_menu->setItemEnabled(1,false);
|
||||
}
|
||||
if(import_menu_logline->type()==RDLogLine::Track) {
|
||||
if(import_menu_i_item->eventType()==RDLogLine::Track) {
|
||||
import_menu->setItemEnabled(3,true);
|
||||
}
|
||||
else {
|
||||
@ -268,21 +305,21 @@ void ImportListView::aboutToShowData()
|
||||
import_menu->setItemEnabled(6,false);
|
||||
}
|
||||
}
|
||||
switch(import_menu_logline->transType()) {
|
||||
case RDLogLine::Play:
|
||||
import_menu->setItemChecked(4,true);
|
||||
break;
|
||||
switch(import_menu_i_item->transType()) {
|
||||
case RDLogLine::Play:
|
||||
import_menu->setItemChecked(4,true);
|
||||
break;
|
||||
|
||||
case RDLogLine::Segue:
|
||||
import_menu->setItemChecked(5,true);
|
||||
break;
|
||||
case RDLogLine::Segue:
|
||||
import_menu->setItemChecked(5,true);
|
||||
break;
|
||||
|
||||
case RDLogLine::Stop:
|
||||
import_menu->setItemChecked(6,true);
|
||||
break;
|
||||
case RDLogLine::Stop:
|
||||
import_menu->setItemChecked(6,true);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
import_menu->setItemEnabled(8,true);
|
||||
}
|
||||
@ -300,11 +337,11 @@ void ImportListView::insertNoteMenuData()
|
||||
if(import_menu_item==NULL) {
|
||||
import_menu_line=0;
|
||||
}
|
||||
import_log->insert(import_menu_line,1);
|
||||
import_log->logLine(import_menu_line)->setType(RDLogLine::Marker);
|
||||
import_log->logLine(import_menu_line)->setMarkerComment(note);
|
||||
import_log->logLine(import_menu_line)->setTitle(tr("[Log Note]"));
|
||||
import_log->logLine(import_menu_line)->setTransType(RDLogLine::Segue);
|
||||
RDEventImportItem *i_item=new RDEventImportItem();
|
||||
i_item->setEventType(RDLogLine::Marker);
|
||||
i_item->setMarkerComment(note);
|
||||
i_item->setTransType(RDLogLine::Segue);
|
||||
import_list->takeItem(1,i_item);
|
||||
validateTransitions();
|
||||
refreshList(import_menu_line);
|
||||
emit sizeChanged(childCount());
|
||||
@ -313,13 +350,13 @@ void ImportListView::insertNoteMenuData()
|
||||
|
||||
void ImportListView::editNoteMenuData()
|
||||
{
|
||||
QString text=import_log->logLine(import_menu_line)->markerComment();
|
||||
QString text=import_list->item(import_menu_line)->markerComment();
|
||||
EditNote *edit_dialog=new EditNote(&text,this);
|
||||
if(edit_dialog->exec()<0) {
|
||||
delete edit_dialog;
|
||||
return;
|
||||
}
|
||||
import_log->logLine(import_menu_line)->setMarkerComment(text);
|
||||
import_list->item(import_menu_line)->setMarkerComment(text);
|
||||
}
|
||||
|
||||
|
||||
@ -335,11 +372,11 @@ void ImportListView::insertTrackMenuData()
|
||||
if(import_menu_item==NULL) {
|
||||
import_menu_line=0;
|
||||
}
|
||||
import_log->insert(import_menu_line,1);
|
||||
import_log->logLine(import_menu_line)->setType(RDLogLine::Track);
|
||||
import_log->logLine(import_menu_line)->setMarkerComment(note);
|
||||
import_log->logLine(import_menu_line)->setTitle(tr("[Voice Track]"));
|
||||
import_log->logLine(import_menu_line)->setTransType(RDLogLine::Segue);
|
||||
RDEventImportItem *i_item=new RDEventImportItem();
|
||||
i_item->setEventType(RDLogLine::Track);
|
||||
i_item->setMarkerComment(note);
|
||||
i_item->setTransType(RDLogLine::Segue);
|
||||
import_list->takeItem(import_menu_line,i_item);
|
||||
validateTransitions();
|
||||
refreshList(import_menu_line);
|
||||
emit sizeChanged(childCount());
|
||||
@ -348,40 +385,40 @@ void ImportListView::insertTrackMenuData()
|
||||
|
||||
void ImportListView::editTrackMenuData()
|
||||
{
|
||||
QString text=import_log->logLine(import_menu_line)->markerComment();
|
||||
QString text=import_list->item(import_menu_line)->markerComment();
|
||||
EditTrack *edit_dialog=new EditTrack(&text,this);
|
||||
if(edit_dialog->exec()<0) {
|
||||
delete edit_dialog;
|
||||
return;
|
||||
}
|
||||
import_log->logLine(import_menu_line)->setMarkerComment(text);
|
||||
import_list->item(import_menu_line)->setMarkerComment(text);
|
||||
}
|
||||
|
||||
|
||||
void ImportListView::playMenuData()
|
||||
{
|
||||
import_menu_logline->setTransType(RDLogLine::Play);
|
||||
import_menu_i_item->setTransType(RDLogLine::Play);
|
||||
import_menu_item->setText(5,tr("PLAY"));
|
||||
}
|
||||
|
||||
|
||||
void ImportListView::segueMenuData()
|
||||
{
|
||||
import_menu_logline->setTransType(RDLogLine::Segue);
|
||||
import_menu_i_item->setTransType(RDLogLine::Segue);
|
||||
import_menu_item->setText(5,tr("SEGUE"));
|
||||
}
|
||||
|
||||
|
||||
void ImportListView::stopMenuData()
|
||||
{
|
||||
import_menu_logline->setTransType(RDLogLine::Stop);
|
||||
import_menu_i_item->setTransType(RDLogLine::Stop);
|
||||
import_menu_item->setText(5,tr("STOP"));
|
||||
}
|
||||
|
||||
|
||||
void ImportListView::deleteMenuData()
|
||||
{
|
||||
import_log->remove(import_menu_item->text(6).toInt(),1);
|
||||
import_list->removeItem(import_menu_item->text(6).toInt());
|
||||
validateTransitions();
|
||||
refreshList();
|
||||
emit sizeChanged(childCount());
|
||||
@ -393,11 +430,11 @@ void ImportListView::contentsMousePressEvent(QMouseEvent *e)
|
||||
QListView::contentsMousePressEvent(e);
|
||||
import_menu_item=selectedItem();
|
||||
if(import_menu_item==NULL) {
|
||||
import_menu_logline=NULL;
|
||||
import_menu_i_item=NULL;
|
||||
}
|
||||
else {
|
||||
if((import_menu_logline=import_log->
|
||||
logLine(import_menu_line=import_menu_item->text(6).toInt()))==NULL) {
|
||||
if((import_menu_i_item=import_list->
|
||||
item(import_menu_line=import_menu_item->text(6).toInt()))==NULL) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -427,8 +464,8 @@ void ImportListView::contentsMouseDoubleClickEvent(QMouseEvent *e)
|
||||
if(import_menu_item==NULL) {
|
||||
return;
|
||||
}
|
||||
if(import_log->
|
||||
logLine(import_menu_item->text(6).toInt())->type()==RDLogLine::Marker) {
|
||||
if(import_list->
|
||||
item(import_menu_item->text(6).toInt())->eventType()==RDLogLine::Marker) {
|
||||
editNoteMenuData();
|
||||
}
|
||||
}
|
||||
@ -462,7 +499,7 @@ void ImportListView::dropEvent(QDropEvent *e)
|
||||
if((item=itemAt(pos))==NULL) {
|
||||
return;
|
||||
}
|
||||
import_log->remove(item->text(6).toInt(),1);
|
||||
import_list->removeItem(item->text(6).toInt());
|
||||
}
|
||||
else {
|
||||
if((item=itemAt(pos))==NULL) {
|
||||
@ -471,10 +508,18 @@ void ImportListView::dropEvent(QDropEvent *e)
|
||||
else {
|
||||
line=item->text(6).toInt();
|
||||
}
|
||||
import_log->insert(line,1);
|
||||
import_log->logLine(line)->
|
||||
loadCart(cartnum,RDLogLine::Segue,0,false);
|
||||
import_log->logLine(line)->setTransType(RDLogLine::Segue);
|
||||
RDEventImportItem *i_item=new RDEventImportItem();
|
||||
RDCart *cart=new RDCart(cartnum);
|
||||
i_item->setCartNumber(cartnum);
|
||||
if(cart->type()==RDCart::Audio) {
|
||||
i_item->setEventType(RDLogLine::Cart);
|
||||
}
|
||||
else {
|
||||
i_item->setEventType(RDLogLine::Macro);
|
||||
}
|
||||
i_item->setTransType(RDLogLine::Segue);
|
||||
import_list->takeItem(line,i_item);
|
||||
delete cart;
|
||||
}
|
||||
}
|
||||
validateTransitions();
|
||||
|
@ -25,7 +25,8 @@
|
||||
#include <qpixmap.h>
|
||||
#include <qpopupmenu.h>
|
||||
|
||||
#include <rdlog_event.h>
|
||||
#include <rdeventimportlist.h>
|
||||
//#include <rdlog_event.h>
|
||||
|
||||
class ImportListView : public QListView
|
||||
{
|
||||
@ -36,7 +37,10 @@ class ImportListView : public QListView
|
||||
void setForceTrans(RDLogLine::TransType trans);
|
||||
void setAllowStop(bool state);
|
||||
void setAllowFirstTrans(bool state);
|
||||
RDLogEvent *logEvent();
|
||||
void move(int from_line,int to_line);
|
||||
void setEventName(const QString &str);
|
||||
bool load(const QString &event_name,RDEventImportList::ImportType type);
|
||||
void save();
|
||||
void refreshList(int line=-1);
|
||||
void validateTransitions();
|
||||
|
||||
@ -63,14 +67,14 @@ class ImportListView : public QListView
|
||||
void dropEvent(QDropEvent *e);
|
||||
|
||||
private:
|
||||
RDLogEvent *import_log;
|
||||
RDEventImportList *import_list;
|
||||
QPixmap *import_playout_map;
|
||||
QPixmap *import_macro_map;
|
||||
QPixmap *import_notemarker_map;
|
||||
QPixmap *import_mic16_map;
|
||||
QPopupMenu *import_menu;
|
||||
int import_menu_line;
|
||||
RDLogLine *import_menu_logline;
|
||||
RDEventImportItem *import_menu_i_item;
|
||||
QListViewItem *import_menu_item;
|
||||
RDLogLine::TransType import_force_trans;
|
||||
bool import_allow_stop;
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <rdapplication.h>
|
||||
#include <rdcreate_log.h>
|
||||
#include <rddb.h>
|
||||
#include <rdescape_string.h>
|
||||
#include <rdevent.h>
|
||||
|
||||
#include "add_event.h"
|
||||
@ -355,22 +356,12 @@ void ListEvents::renameData()
|
||||
delete q;
|
||||
|
||||
//
|
||||
// Rename Meta Tables
|
||||
// Rename Event Data
|
||||
//
|
||||
QString old_name_esc=item->text(0);
|
||||
old_name_esc.replace(" ","_");
|
||||
QString new_name_esc=new_name;
|
||||
new_name_esc.replace(" ","_");
|
||||
sql=QString().sprintf("alter table %s_PRE rename to %s_PRE",
|
||||
(const char *)old_name_esc,
|
||||
(const char *)new_name_esc);
|
||||
q=new RDSqlQuery(sql);
|
||||
delete q;
|
||||
sql=QString().sprintf("alter table %s_POST rename to %s_POST",
|
||||
(const char *)old_name_esc,
|
||||
(const char *)new_name_esc);
|
||||
q=new RDSqlQuery(sql);
|
||||
delete q;
|
||||
sql=QString("update EVENT_LINES set ")+
|
||||
"EVENT_NAME=\""+RDEscapeString(new_name)+"\" where "+
|
||||
"EVENT_NAME=\""+RDEscapeString(item->text(0))+"\"";
|
||||
RDSqlQuery::apply(sql);
|
||||
|
||||
//
|
||||
// Rename Service Permissions
|
||||
@ -596,10 +587,10 @@ void ListEvents::DeleteEvent(QString event_name)
|
||||
//
|
||||
sql=QString().sprintf("delete from EVENTS where NAME=\"%s\"",
|
||||
(const char *)event_name);
|
||||
q=new RDSqlQuery(sql);
|
||||
delete q;
|
||||
rda->dropTable(base_name+"_PRE");
|
||||
rda->dropTable(base_name+"_POST");
|
||||
RDSqlQuery::apply(sql);
|
||||
sql=QString("delete from EVENT_LINES where ")+
|
||||
"EVENT_NAME=\""+RDEscapeString(event_name)+"\"";
|
||||
RDSqlQuery::apply(sql);
|
||||
}
|
||||
|
||||
|
||||
|
@ -38,6 +38,175 @@ bool MainObject::RevertSchema(int cur_schema,int set_schema,QString *err_msg) co
|
||||
//
|
||||
|
||||
|
||||
//
|
||||
// Revert 290
|
||||
//
|
||||
if((cur_schema==290)&&(set_schema<cur_schema)) {
|
||||
sql=QString("select NAME from EVENTS");
|
||||
q=new RDSqlQuery(sql,false);
|
||||
while(q->next()) {
|
||||
//
|
||||
// PreImport Events
|
||||
//
|
||||
QString tablename=q->value(0).toString()+"_PRE";
|
||||
tablename.replace(" ","_");
|
||||
sql=QString("create table if not exists `")+tablename+"` ("+
|
||||
"ID int not null primary key,"+
|
||||
"COUNT int not null,"+
|
||||
"TYPE int default 0,"+
|
||||
"SOURCE int not null,"+
|
||||
"START_TIME int,"+
|
||||
"GRACE_TIME int default 0,"+
|
||||
"CART_NUMBER int UNSIGNED not null default 0,"+
|
||||
"TIME_TYPE int not null,"+
|
||||
"POST_POINT enum('N','Y') default 'N',"+
|
||||
"TRANS_TYPE int not null,"+
|
||||
"START_POINT int not null default -1,"+
|
||||
"END_POINT int not null default -1,"+
|
||||
"FADEUP_POINT int default -1,"+
|
||||
QString().sprintf("FADEUP_GAIN int default %d,",RD_FADE_DEPTH)+
|
||||
"FADEDOWN_POINT int default -1,"+
|
||||
QString().sprintf("FADEDOWN_GAIN int default %d,",RD_FADE_DEPTH)+
|
||||
"SEGUE_START_POINT int not null default -1,"+
|
||||
"SEGUE_END_POINT int not null default -1,"+
|
||||
QString().sprintf("SEGUE_GAIN int default %d,",RD_FADE_DEPTH)+
|
||||
"DUCK_UP_GAIN int default 0,"+
|
||||
"DUCK_DOWN_GAIN int default 0,"+
|
||||
"COMMENT CHAR(255),"+
|
||||
"LABEL CHAR(64),"+
|
||||
"ORIGIN_USER char(255),"+
|
||||
"ORIGIN_DATETIME datetime,"+
|
||||
"EVENT_LENGTH int default -1,"+
|
||||
"LINK_EVENT_NAME char(64),"+
|
||||
"LINK_START_TIME int,"+
|
||||
"LINK_LENGTH int default 0,"+
|
||||
"LINK_START_SLOP int default 0,"+
|
||||
"LINK_END_SLOP int default 0,"+
|
||||
"LINK_ID int default -1,"+
|
||||
"LINK_EMBEDDED enum('N','Y') default 'N',"+
|
||||
"EXT_START_TIME time,"+
|
||||
"EXT_LENGTH int,"+
|
||||
"EXT_CART_NAME char(32),"+
|
||||
"EXT_DATA char(32),"+
|
||||
"EXT_EVENT_ID char(32),"+
|
||||
"EXT_ANNC_TYPE char(8),"+
|
||||
"index COUNT_IDX (COUNT),"+
|
||||
"index CART_NUMBER_IDX (CART_NUMBER),"+
|
||||
"index LABEL_IDX (LABEL))"+
|
||||
db_table_create_postfix;
|
||||
if(!RDSqlQuery::apply(sql,err_msg)) {
|
||||
return false;
|
||||
}
|
||||
sql=QString("select ")+
|
||||
"COUNT,"+ // 00
|
||||
"EVENT_TYPE,"+ // 01
|
||||
"CART_NUMBER,"+ // 02
|
||||
"TRANS_TYPE,"+ // 03
|
||||
"MARKER_COMMENT "+ // 04
|
||||
"from EVENT_LINES where "+
|
||||
"EVENT_NAME=\""+RDEscapeString(q->value(0).toString())+"\" && "+
|
||||
"TYPE=0";
|
||||
q1=new RDSqlQuery(sql,false);
|
||||
while(q1->next()) {
|
||||
sql=QString("insert into `")+tablename+"` set "+
|
||||
QString().sprintf("ID=%d,",1+q1->value(0).toInt())+
|
||||
QString().sprintf("COUNT=%d,",q1->value(0).toInt())+
|
||||
QString().sprintf("TYPE=%d,",q1->value(1).toInt())+
|
||||
QString().sprintf("CART_NUMBER=%u,",q1->value(2).toUInt())+
|
||||
QString().sprintf("TRANS_TYPE=%d,",q1->value(3).toInt())+
|
||||
"COMMENT=\""+RDEscapeString(q1->value(4).toString())+"\"";
|
||||
if(!RDSqlQuery::apply(sql,err_msg)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
delete q1;
|
||||
|
||||
//
|
||||
// PostImport Events
|
||||
//
|
||||
tablename=q->value(0).toString()+"_POST";
|
||||
tablename.replace(" ","_");
|
||||
sql=QString("create table if not exists `")+tablename+"` ("+
|
||||
"ID int not null primary key,"+
|
||||
"COUNT int not null,"+
|
||||
"TYPE int default 0,"+
|
||||
"SOURCE int not null,"+
|
||||
"START_TIME int,"+
|
||||
"GRACE_TIME int default 0,"+
|
||||
"CART_NUMBER int UNSIGNED not null default 0,"+
|
||||
"TIME_TYPE int not null,"+
|
||||
"POST_POINT enum('N','Y') default 'N',"+
|
||||
"TRANS_TYPE int not null,"+
|
||||
"START_POINT int not null default -1,"+
|
||||
"END_POINT int not null default -1,"+
|
||||
"FADEUP_POINT int default -1,"+
|
||||
QString().sprintf("FADEUP_GAIN int default %d,",RD_FADE_DEPTH)+
|
||||
"FADEDOWN_POINT int default -1,"+
|
||||
QString().sprintf("FADEDOWN_GAIN int default %d,",RD_FADE_DEPTH)+
|
||||
"SEGUE_START_POINT int not null default -1,"+
|
||||
"SEGUE_END_POINT int not null default -1,"+
|
||||
QString().sprintf("SEGUE_GAIN int default %d,",RD_FADE_DEPTH)+
|
||||
"DUCK_UP_GAIN int default 0,"+
|
||||
"DUCK_DOWN_GAIN int default 0,"+
|
||||
"COMMENT CHAR(255),"+
|
||||
"LABEL CHAR(64),"+
|
||||
"ORIGIN_USER char(255),"+
|
||||
"ORIGIN_DATETIME datetime,"+
|
||||
"EVENT_LENGTH int default -1,"+
|
||||
"LINK_EVENT_NAME char(64),"+
|
||||
"LINK_START_TIME int,"+
|
||||
"LINK_LENGTH int default 0,"+
|
||||
"LINK_START_SLOP int default 0,"+
|
||||
"LINK_END_SLOP int default 0,"+
|
||||
"LINK_ID int default -1,"+
|
||||
"LINK_EMBEDDED enum('N','Y') default 'N',"+
|
||||
"EXT_START_TIME time,"+
|
||||
"EXT_LENGTH int,"+
|
||||
"EXT_CART_NAME char(32),"+
|
||||
"EXT_DATA char(32),"+
|
||||
"EXT_EVENT_ID char(32),"+
|
||||
"EXT_ANNC_TYPE char(8),"+
|
||||
"index COUNT_IDX (COUNT),"+
|
||||
"index CART_NUMBER_IDX (CART_NUMBER),"+
|
||||
"index LABEL_IDX (LABEL))"+
|
||||
db_table_create_postfix;
|
||||
if(!RDSqlQuery::apply(sql,err_msg)) {
|
||||
return false;
|
||||
}
|
||||
sql=QString("select ")+
|
||||
"COUNT,"+ // 00
|
||||
"EVENT_TYPE,"+ // 01
|
||||
"CART_NUMBER,"+ // 02
|
||||
"TRANS_TYPE,"+ // 03
|
||||
"MARKER_COMMENT "+ // 04
|
||||
"from EVENT_LINES where "+
|
||||
"EVENT_NAME=\""+RDEscapeString(q->value(0).toString())+"\" && "+
|
||||
"TYPE=1";
|
||||
q1=new RDSqlQuery(sql,false);
|
||||
while(q1->next()) {
|
||||
sql=QString("insert into `")+tablename+"` set "+
|
||||
QString().sprintf("ID=%d,",1+q1->value(0).toInt())+
|
||||
QString().sprintf("COUNT=%d,",q1->value(0).toInt())+
|
||||
QString().sprintf("TYPE=%d,",q1->value(1).toInt())+
|
||||
QString().sprintf("CART_NUMBER=%u,",q1->value(2).toUInt())+
|
||||
QString().sprintf("TRANS_TYPE=%d,",q1->value(3).toInt())+
|
||||
"COMMENT=\""+RDEscapeString(q1->value(4).toString())+"\"";
|
||||
if(!RDSqlQuery::apply(sql,err_msg)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
delete q1;
|
||||
}
|
||||
delete q;
|
||||
sql=QString("drop table EVENT_LINES");
|
||||
if(!RDSqlQuery::apply(sql,err_msg)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
cur_schema--;
|
||||
}
|
||||
|
||||
//
|
||||
// Revert 289
|
||||
//
|
||||
|
@ -132,7 +132,7 @@ void MainObject::InitializeSchemaMap() {
|
||||
global_version_map["2.17"]=268;
|
||||
global_version_map["2.18"]=272;
|
||||
global_version_map["2.19"]=275;
|
||||
global_version_map["2.20"]=289;
|
||||
global_version_map["2.20"]=290;
|
||||
}
|
||||
|
||||
|
||||
|
@ -7440,7 +7440,7 @@ bool MainObject::UpdateSchema(int cur_schema,int set_schema,QString *err_msg) co
|
||||
"LABEL=\""+RDEscapeString(q1->value(12).toString())+"\","+
|
||||
"CONDUCTOR=\""+RDEscapeString(q1->value(13).toString())+"\","+
|
||||
"USAGE_CODE=\""+RDEscapeString(q1->value(14).toString())+"\","+
|
||||
"DESCRIPTIONS=\""+RDEscapeString(q1->value(15).toString())+"\","+
|
||||
"DESCRIPTION=\""+RDEscapeString(q1->value(15).toString())+"\","+
|
||||
"OUTCUE=\""+RDEscapeString(q1->value(16).toString())+"\","+
|
||||
"ISRC=\""+RDEscapeString(q1->value(17).toString())+"\","+
|
||||
"ISCI=\""+RDEscapeString(q1->value(18).toString())+"\","+
|
||||
@ -7476,6 +7476,97 @@ bool MainObject::UpdateSchema(int cur_schema,int set_schema,QString *err_msg) co
|
||||
cur_schema++;
|
||||
}
|
||||
|
||||
if((cur_schema<290)&&(set_schema>cur_schema)) {
|
||||
sql=QString("create table if not exists EVENT_LINES (")+
|
||||
"ID int unsigned auto_increment primary key,"+
|
||||
"EVENT_NAME char(64) not null,"+
|
||||
"TYPE int not null,"+
|
||||
"COUNT int not null,"+
|
||||
"EVENT_TYPE int not null,"+
|
||||
"CART_NUMBER int unsigned,"+
|
||||
"TRANS_TYPE int not null,"+
|
||||
"MARKER_COMMENT char(255),"+
|
||||
"unique index EVENT_NAME_TYPE_COUNT_IDX (EVENT_NAME,TYPE,COUNT))";
|
||||
if(!RDSqlQuery::apply(sql,err_msg)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
sql=QString("select NAME from EVENTS");
|
||||
q=new RDSqlQuery(sql,false);
|
||||
while(q->next()) {
|
||||
//
|
||||
// PreImport Events
|
||||
//
|
||||
QString tablename=q->value(0).toString()+"_PRE";
|
||||
tablename.replace(" ","_");
|
||||
sql=QString("select ")+
|
||||
"COUNT,"+ // 00
|
||||
"TYPE,"+ // 01
|
||||
"CART_NUMBER,"+ // 02
|
||||
"TRANS_TYPE,"+ // 03
|
||||
"COMMENT "+ // 05
|
||||
"from `"+tablename+"`"+
|
||||
"order by COUNT";
|
||||
q1=new RDSqlQuery(sql,false);
|
||||
while(q1->next()) {
|
||||
sql=QString("insert into EVENT_LINES set ")+
|
||||
"EVENT_NAME=\""+RDEscapeString(q->value(0).toString())+"\","+
|
||||
"TYPE=0,"+
|
||||
QString().sprintf("COUNT=%d,",q1->value(0).toInt())+
|
||||
QString().sprintf("EVENT_TYPE=%d,",q1->value(1).toInt())+
|
||||
QString().sprintf("CART_NUMBER=%u,",q1->value(2).toUInt())+
|
||||
QString().sprintf("TRANS_TYPE=%d,",q1->value(3).toInt())+
|
||||
"MARKER_COMMENT=\""+RDEscapeString(q1->value(4).toString())+"\"";
|
||||
if(!RDSqlQuery::apply(sql,err_msg)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
delete q1;
|
||||
sql="drop table `"+tablename+"`";
|
||||
if(!RDSqlQuery::apply(sql,err_msg)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// PostImport Events
|
||||
//
|
||||
tablename=q->value(0).toString()+"_POST";
|
||||
tablename.replace(" ","_");
|
||||
sql=QString("select ")+
|
||||
"COUNT,"+ // 00
|
||||
"TYPE,"+ // 01
|
||||
"CART_NUMBER,"+ // 02
|
||||
"TRANS_TYPE,"+ // 03
|
||||
"COMMENT "+ // 05
|
||||
"from `"+tablename+"`"+
|
||||
"order by COUNT";
|
||||
q1=new RDSqlQuery(sql,false);
|
||||
while(q1->next()) {
|
||||
sql=QString("insert into EVENT_LINES set ")+
|
||||
"EVENT_NAME=\""+RDEscapeString(q->value(0).toString())+"\","+
|
||||
"TYPE=1,"+
|
||||
QString().sprintf("COUNT=%d,",q1->value(0).toInt())+
|
||||
QString().sprintf("EVENT_TYPE=%d,",q1->value(1).toInt())+
|
||||
QString().sprintf("CART_NUMBER=%u,",q1->value(2).toUInt())+
|
||||
QString().sprintf("TRANS_TYPE=%d,",q1->value(3).toInt())+
|
||||
"MARKER_COMMENT=\""+RDEscapeString(q1->value(4).toString())+"\"";
|
||||
if(!RDSqlQuery::apply(sql,err_msg)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
delete q1;
|
||||
sql="drop table `"+tablename+"`";
|
||||
if(!RDSqlQuery::apply(sql,err_msg)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
delete q;
|
||||
|
||||
|
||||
cur_schema++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Maintainer's Note:
|
||||
|
Loading…
x
Reference in New Issue
Block a user