2021-06-22 Fred Gleason <fredg@paravelsystems.com>

* Broke out voicetracker functionality from rdlogedit(1) into
	'RDTrackerEditDialog', 'RDTrackerModel', 'RDTrackerTableView'
	and 'RDTrackerWidget' classes.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason
2021-06-22 14:47:01 -04:00
parent 19bd4279a6
commit b98b33cfe2
18 changed files with 5047 additions and 4149 deletions

View File

@@ -177,6 +177,7 @@ dist_librd_la_SOURCES = dbversion.h\
rdlog.cpp rdlog.h\
rdlog_line.cpp rdlog_line.h\
rdlogedit_conf.cpp rdlogedit_conf.h\
rdlogeventdialog.cpp rdlogeventdialog.h\
rdlogfilter.cpp rdlogfilter.h\
rdlogimportmodel.cpp rdlogimportmodel.h\
rdloglock.cpp rdloglock.h\
@@ -262,6 +263,10 @@ dist_librd_la_SOURCES = dbversion.h\
rdtimeedit.cpp rdtimeedit.h\
rdtimeengine.cpp rdtimeengine.h\
rdtimeevent.cpp rdtimeevent.h\
rdtrackereditdialog.cpp rdtrackereditdialog.h\
rdtrackermodel.cpp rdtrackermodel.h\
rdtrackertableview.cpp rdtrackertableview.h\
rdtrackerwidget.cpp rdtrackerwidget.h\
rdtransportbutton.cpp rdtransportbutton.h\
rdtransfer.cpp rdtransfer.h\
rdtreeview.cpp rdtreeview.h\
@@ -357,6 +362,7 @@ nodist_librd_la_SOURCES = moc_rdadd_cart.cpp\
moc_rdlistselector.cpp\
moc_rdlistsvcs.cpp\
moc_rdlivewire.cpp\
moc_rdlogeventdialog.cpp\
moc_rdlogfilter.cpp\
moc_rdlogimportmodel.cpp\
moc_rdloglock.cpp\
@@ -409,6 +415,10 @@ nodist_librd_la_SOURCES = moc_rdadd_cart.cpp\
moc_rdtableview.cpp\
moc_rdtimeedit.cpp\
moc_rdtimeengine.cpp\
moc_rdtrackereditdialog.cpp\
moc_rdtrackermodel.cpp\
moc_rdtrackertableview.cpp\
moc_rdtrackerwidget.cpp\
moc_rdtransfer.cpp\
moc_rdtransportbutton.cpp\
moc_rdtreeview.cpp\

View File

@@ -131,6 +131,7 @@ SOURCES += rdlistselector.cpp
SOURCES += rdlog.cpp
SOURCES += rdlog_line.cpp
SOURCES += rdlogedit_conf.cpp
SOURCES += rdlogeventdialog.cpp
SOURCES += rdlogfilter.cpp
SOURCES += rdlogimportmodel.cpp
SOURCES += rdloglock.cpp
@@ -196,6 +197,10 @@ SOURCES += rdtextfile.cpp
SOURCES += rdtextvalidator.cpp
SOURCES += rdtimeedit.cpp
SOURCES += rdtimeengine.cpp
SOURCES += rdtrackereditdialog.cpp
SOURCES += rdtrackermodel.cpp
SOURCES += rdtrackertableview.cpp
SOURCES += rdtrackerwidget.cpp
SOURCES += rdtransportbutton.cpp
SOURCES += rdtreeview.cpp
SOURCES += rdtty.cpp
@@ -311,6 +316,7 @@ HEADERS += rdlistselector.h
HEADERS += rdlog.h
HEADERS += rdlog_line.h
HEADERS += rdlogedit_conf.h
HEADERS += rdlogeventdialog.h
HEADERS += rdlogfilter.h
HEADERS += rdlogimportmodel.h
HEADERS += rdloglock.h
@@ -378,6 +384,10 @@ HEADERS += rdtextvalidator.h
HEADERS += rdtimeedit.h
HEADERS += rdtimeedit.h
HEADERS += rdtimeengine.h
HEADERS += rdtrackereditdialog.h
HEADERS += rdtrackermodel.h
HEADERS += rdtrackertableview.h
HEADERS += rdtrackerwidget.h
HEADERS += rdtransportbutton.h
HEADERS += rdtreeview.h
HEADERS += rdtty.h

265
lib/rdlogeventdialog.cpp Normal file
View File

@@ -0,0 +1,265 @@
// rdlogeventdialog.cpp
//
// Base class for rdlogedit(1) event editor dialogs
//
// (C) Copyright 2002-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 "rdapplication.h"
#include "rddb.h"
#include "rdescape_string.h"
#include "rdlist_logs.h"
#include "rdlogeventdialog.h"
//#include "globals.h"
RDLogEventDialog::RDLogEventDialog(RDLogLine *line,QWidget *parent)
: RDDialog(parent)
{
edit_logline=line;
//
// Time Type
//
edit_timetype_box=new QCheckBox(this);
edit_timetype_label=new QLabel(tr("Start at:"),this);
edit_timetype_label->setGeometry(30,21,85,17);
edit_timetype_label->setFont(labelFont());
edit_timetype_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);
//
// Start Time
//
edit_time_edit=new RDTimeEdit(this);
edit_time_edit->setDisplay(RDTimeEdit::Hours|RDTimeEdit::Minutes|
RDTimeEdit::Seconds|RDTimeEdit::Tenths);
connect(edit_time_edit,SIGNAL(valueChanged(const QTime &)),
this,SLOT(timeChangedData(const QTime &)));
//
// Grace Time
//
edit_grace_group=
new QGroupBox(tr("Action If Previous Event Still Playing"),this);
edit_grace_group->setFont(labelFont());
edit_grace_bgroup=new QButtonGroup(this);
edit_grace_bgroup->setExclusive(true);
QRadioButton *radio_button=
new QRadioButton(tr("Start Immediately"),edit_grace_group);
radio_button->setFont(subLabelFont());
edit_grace_bgroup->addButton(radio_button,0);
radio_button=new QRadioButton(tr("Make Next"),edit_grace_group);
radio_button->setFont(subLabelFont());
edit_grace_bgroup->addButton(radio_button,1);
radio_button=new QRadioButton(tr("Wait up to"),edit_grace_group);
radio_button->setFont(subLabelFont());
edit_grace_bgroup->addButton(radio_button,2);
edit_grace_timeedit=new QTimeEdit(this);
edit_grace_timeedit->setDisplayFormat("mm:ss");
connect(edit_timetype_box,SIGNAL(toggled(bool)),
this,SLOT(timeToggledData(bool)));
connect(edit_grace_bgroup,SIGNAL(buttonClicked(int)),
this,SLOT(graceClickedData(int)));
//
// Transition Type
//
edit_transtype_box=new QComboBox(this);
edit_transtype_box->insertItem(0,tr("Play"));
edit_transtype_box->insertItem(1,tr("Segue"));
edit_transtype_box->insertItem(2,tr("Stop"));
edit_time_label=new QLabel(tr("Transition Type:"),this);
edit_time_label->setGeometry(10,68,370,26);
edit_time_label->setFont(labelFont());
edit_time_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
//
// Ok Button
//
edit_ok_button=new QPushButton(this);
edit_ok_button->setDefault(true);
edit_ok_button->setFont(buttonFont());
edit_ok_button->setText(tr("OK"));
connect(edit_ok_button,SIGNAL(clicked()),this,SLOT(okData()));
//
// Cancel Button
//
edit_cancel_button=new QPushButton(this);
edit_cancel_button->setFont(buttonFont());
edit_cancel_button->setText(tr("Cancel"));
connect(edit_cancel_button,SIGNAL(clicked()),this,SLOT(cancelData()));
//
// Populate Data
//
edit_time_edit->setTime(edit_logline->startTime(RDLogLine::Logged));
if(edit_logline->timeType()==RDLogLine::Hard) {
edit_timetype_box->setChecked(true);
timeToggledData(true);
}
else {
timeToggledData(false);
}
timeChangedData(edit_time_edit->time());
switch(edit_logline->graceTime()) {
case -1:
edit_grace_bgroup->button(1)->setChecked(true);
graceClickedData(1);
break;
case 0:
edit_grace_bgroup->button(0)->setChecked(true);
graceClickedData(0);
break;
default:
edit_grace_bgroup->button(2)->setChecked(true);
edit_grace_timeedit->setTime(QTime(0,0,0).addMSecs(edit_logline->graceTime()));
graceClickedData(2);
break;
}
edit_transtype_box->setCurrentIndex(edit_logline->transType());
}
void RDLogEventDialog::timeChangedData(const QTime &time)
{
if(edit_timetype_box->isChecked()) {
edit_time_label->
setText(tr("Transition If Previous Cart Ends Before")+" "+
edit_time_edit->time().toString("hh:mm:ss.zzz").left(10)+":");
}
}
void RDLogEventDialog::timeToggledData(bool state)
{
edit_time_edit->setEnabled(state);
edit_grace_group->setEnabled(state);
edit_grace_bgroup->button(0)->setEnabled(state);
edit_grace_bgroup->button(1)->setEnabled(state);
edit_grace_bgroup->button(2)->setEnabled(state);
if(state) {
graceClickedData(edit_grace_bgroup->checkedId());
edit_time_label->
setText(tr("Transition If Previous Cart Ends Before")+" "+
edit_time_edit->time().toString("hh:mm:ss.zzz").left(10)+":");
}
else {
edit_grace_timeedit->setDisabled(true);
edit_time_label->setText(tr("Transition Type")+":");
}
}
void RDLogEventDialog::graceClickedData(int id)
{
switch(id) {
case 0:
edit_grace_timeedit->setDisabled(true);
break;
case 1:
edit_grace_timeedit->setDisabled(true);
break;
case 2:
edit_grace_timeedit->setEnabled(true);
break;
}
}
void RDLogEventDialog::selectTimeData(int id)
{
if(id==RDLogLine::Relative) {
edit_time_edit->setDisabled(true);
edit_time_label->setDisabled(true);
edit_grace_timeedit->setDisabled(true);
}
else {
edit_time_edit->setEnabled(true);
edit_time_label->setEnabled(true);
}
}
void RDLogEventDialog::okData()
{
if(saveData()) {
if(edit_timetype_box->isChecked()) {
edit_logline->setTimeType(RDLogLine::Hard);
edit_logline->setStartTime(RDLogLine::Logged,edit_time_edit->time());
switch(edit_grace_bgroup->checkedId()) {
case 0:
edit_logline->setGraceTime(0);
break;
case 1:
edit_logline->setGraceTime(-1);
break;
case 2:
edit_logline->setGraceTime(QTime(0,0,0).msecsTo(edit_grace_timeedit->time()));
break;
}
}
else {
edit_logline->setTimeType(RDLogLine::Relative);
edit_logline->setStartTime(RDLogLine::Logged,QTime());
edit_logline->setGraceTime(0);
}
edit_logline->
setTransType((RDLogLine::TransType)edit_transtype_box->currentIndex());
done(edit_logline->id());
}
}
void RDLogEventDialog::cancelData()
{
done(-1);
}
RDLogLine *RDLogEventDialog::logLine()
{
return edit_logline;
}
void RDLogEventDialog::resizeEvent(QResizeEvent *e)
{
edit_timetype_box->setGeometry(10,22,15,15);
edit_time_edit->setGeometry(85,19,85,20);
edit_grace_group->setGeometry(175,11,435,50);
edit_grace_bgroup->button(0)->setGeometry(10,21,145,20);
edit_grace_bgroup->button(1)->setGeometry(155,21,105,20);
edit_grace_bgroup->button(2)->setGeometry(265,21,95,20);
edit_grace_timeedit->setGeometry(543,31,60,20);
edit_transtype_box->setGeometry(385,68,110,26);
edit_ok_button->setGeometry(size().width()-180,size().height()-60,80,50);
edit_cancel_button->setGeometry(size().width()-90,size().height()-60,80,50);
}
void RDLogEventDialog::closeEvent(QCloseEvent *e)
{
cancelData();
}

72
lib/rdlogeventdialog.h Normal file
View File

@@ -0,0 +1,72 @@
// rdlogeventdialog.h
//
// Base class for rdlogedit(1) event editor dialogs
//
// (C) Copyright 2002-2019 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 RDLOGEVENTDIALOG_H
#define RDLOGEVENTDIALOG_H
#include <qbuttongroup.h>
#include <qcombobox.h>
#include <qcheckbox.h>
#include <qdatetimeedit.h>
#include <qgroupbox.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <rddialog.h>
#include <rdlog_line.h>
#include <rdtimeedit.h>
class RDLogEventDialog : public RDDialog
{
Q_OBJECT
protected:
RDLogEventDialog(RDLogLine *,QWidget *parent=0);
private slots:
void timeChangedData(const QTime &);
void timeToggledData(bool state);
void graceClickedData(int id);
void selectTimeData(int);
void okData();
void cancelData();
protected:
RDLogLine *logLine();
virtual bool saveData()=0;
void resizeEvent(QResizeEvent *e);
void closeEvent(QCloseEvent *e);
private:
RDLogLine *edit_logline;
RDTimeEdit *edit_time_edit;
QLabel *edit_time_label;
QCheckBox *edit_timetype_box;
QLabel *edit_timetype_label;
QCheckBox *edit_time_box;
QComboBox *edit_transtype_box;
QButtonGroup *edit_grace_bgroup;
QGroupBox *edit_grace_group;
QTimeEdit *edit_grace_timeedit;
QPushButton *edit_ok_button;
QPushButton *edit_cancel_button;
};
#endif // RDLOGEVENTDIALOG_H

View File

@@ -0,0 +1,68 @@
// rdtrackereditdialog.cpp
//
// Edit a Rivendell Voice Track Log Entry
//
// (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 "rdtrackereditdialog.h"
RDTrackerEditDialog::RDTrackerEditDialog(RDLogLine *line,QWidget *parent)
: RDLogEventDialog(line,parent)
{
setWindowTitle("RDLogEdit - "+tr("Edit Voice Track Marker"));
//
// Fix the Window Size
//
setMinimumSize(sizeHint());
setMaximumSize(sizeHint());
//
// Comment
//
edit_comment_edit=new QLineEdit(this);
edit_comment_edit->setGeometry(10,116,sizeHint().width()-20,18);
edit_comment_edit->setMaxLength(255);
QLabel *label=new QLabel(tr("Comment"),this);
label->setFont(labelFont());
label->setGeometry(12,100,70,14);
//
// Populate Data
//
edit_comment_edit->setText(logLine()->markerComment());
}
QSize RDTrackerEditDialog::sizeHint() const
{
return QSize(625,230);
}
QSizePolicy RDTrackerEditDialog::sizePolicy() const
{
return QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
}
bool RDTrackerEditDialog::saveData()
{
logLine()->setMarkerComment(edit_comment_edit->text());
return true;
}

46
lib/rdtrackereditdialog.h Normal file
View File

@@ -0,0 +1,46 @@
// rdtrackereditdialog.h
//
// Edit a Rivendell Voice Track Log Entry
//
// (C) Copyright 2002-2019 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 RDTRACKEREDITDIALOG_H
#define RDTRACKEREDITDIALOG_H
#include <qlineedit.h>
#include "rdlogeventdialog.h"
class RDTrackerEditDialog : public RDLogEventDialog
{
Q_OBJECT
public:
RDTrackerEditDialog(RDLogLine *,QWidget *parent=0);
QSize sizeHint() const;
QSizePolicy sizePolicy() const;
protected:
bool saveData();
private:
QCheckBox *edit_overlap_box;
QLabel *edit_overlap_label;
QLineEdit *edit_comment_edit;
};
#endif // RDTRACKEREDITDIALOG_H

110
lib/rdtrackermodel.cpp Normal file
View File

@@ -0,0 +1,110 @@
// logmodel.cpp
//
// Data model for RDTrackerWidget
//
// (C) Copyright 2020-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 "rdtrackermodel.h"
RDTrackerModel::RDTrackerModel(QObject *parent)
: RDLogModel(parent)
{
d_group_list=new RDGroupList();
}
RDTrackerModel::~RDTrackerModel()
{
delete d_group_list;
}
QString RDTrackerModel::serviceName() const
{
return d_group_list->serviceName();
}
bool RDTrackerModel::groupIsValid(const QString &grpname) const
{
return d_group_list->groupIsValid(grpname);
}
bool RDTrackerModel::allGroupsValid() const
{
RDLogLine *ll;
for(int i=0;i<lineCount();i++) {
if((ll=logLine(i))!=NULL) {
if((ll->type()==RDLogLine::Cart)||(ll->type()==RDLogLine::Macro)) {
if(!d_group_list->groupIsValid(ll->groupName())) {
return false;
}
}
}
}
return true;
}
void RDTrackerModel::setServiceName(const QString &str)
{
if(d_group_list->serviceName()!=str) {
d_group_list->setServiceName(str);
emitAllDataChanged();
}
}
QColor RDTrackerModel::rowBackgroundColor(int row,RDLogLine *ll) const
{
QDateTime now=QDateTime(QDate::currentDate(),QTime::currentTime());
switch(ll->type()) {
case RDLogLine::Cart:
switch(ll->validity(now)) {
case RDCart::AlwaysValid:
if(d_group_list->groupIsValid(ll->groupName())||
ll->groupName().isEmpty()) {
return RDLogModel::rowBackgroundColor(row,ll);
}
return RD_CART_INVALID_SERVICE_COLOR;
case RDCart::ConditionallyValid:
return RD_CART_CONDITIONAL_COLOR;
case RDCart::FutureValid:
return RD_CART_FUTURE_COLOR;
case RDCart::EvergreenValid:
return RD_CART_EVERGREEN_COLOR;
case RDCart::NeverValid:
return RD_CART_ERROR_COLOR;
}
break;
default:
if(d_group_list->groupIsValid(ll->groupName())||ll->groupName().isEmpty()) {
return RDLogModel::rowBackgroundColor(row,ll);
}
return RD_CART_INVALID_SERVICE_COLOR;
}
return RDLogModel::rowBackgroundColor(row,ll);
}

48
lib/rdtrackermodel.h Normal file
View File

@@ -0,0 +1,48 @@
// rdtrackermodel.h
//
// Data model for Rivendell logs RDTrackerWidget
//
// (C) Copyright 2020-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 RDTRACKERMODEL_H
#define RDTRACKERMODEL_H
#include <rdgroup_list.h>
#include <rdlogmodel.h>
class RDTrackerModel : public RDLogModel
{
Q_OBJECT
public:
RDTrackerModel(QObject *parent=0);
~RDTrackerModel();
QString serviceName() const;
bool groupIsValid(const QString &grpname) const;
bool allGroupsValid() const;
public slots:
void setServiceName(const QString &str);
protected:
QColor rowBackgroundColor(int row,RDLogLine *ll) const;
private:
RDGroupList *d_group_list;
};
#endif // RDTRACKERMODEL_H

123
lib/rdtrackertableview.cpp Normal file
View File

@@ -0,0 +1,123 @@
// rdtrackertableview.cpp
//
// TableView widget for RDLogEdit
//
// (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 <rdcartdrag.h>
#include "rdtrackertableview.h"
#include "rdtrackermodel.h"
RDTrackerTableView::RDTrackerTableView(QWidget *parent)
: RDTableView(parent)
{
d_mouse_row=-1;
setAcceptDrops(true);
//
// Mouse menu
//
d_mouse_menu=new QMenu(this);
d_play_action=d_mouse_menu->
addAction(tr("PLAY Transition"),this,SLOT(setPlayData()));
d_play_action->setCheckable(true);
d_segue_action=d_mouse_menu->
addAction(tr("SEGUE Transition"),this,SLOT(setSegueData()));
d_segue_action->setCheckable(true);
d_stop_action=d_mouse_menu->
addAction(tr("STOP Transition"),this,SLOT(setStopData()));
d_stop_action->setCheckable(true);
connect(d_mouse_menu,SIGNAL(aboutToShow()),
this,SLOT(aboutToShowMenuData()));
}
void RDTrackerTableView::dragEnterEvent(QDragEnterEvent *e)
{
if(RDCartDrag::canDecode(e->mimeData())) {
e->accept();
}
}
void RDTrackerTableView::dragMoveEvent(QDragMoveEvent *e)
{
if(RDCartDrag::canDecode(e->mimeData())) {
e->accept();
}
}
void RDTrackerTableView::dropEvent(QDropEvent *e)
{
RDLogLine ll;
int line=-1;
int y_pos=e->pos().y();
if(RDCartDrag::decode(e->mimeData(),&ll)) {
line=rowAt(y_pos);
emit cartDropped(line,&ll);
}
}
void RDTrackerTableView::mousePressEvent(QMouseEvent *e)
{
if(e->button()==Qt::RightButton) {
d_mouse_row=indexAt(e->pos()).row();
if((d_mouse_row>=0)&&(d_mouse_row<(model()->rowCount()-1))) {
d_mouse_menu->popup(e->globalPos());
}
else {
d_mouse_row=-1;
}
}
QTableView::mousePressEvent(e);
}
void RDTrackerTableView::aboutToShowMenuData()
{
RDLogLine *ll=((RDTrackerModel *)model())->logLine(d_mouse_row);
if(ll!=NULL) {
d_play_action->setChecked(ll->transType()==RDLogLine::Play);
d_segue_action->setChecked(ll->transType()==RDLogLine::Segue);
d_stop_action->setChecked(ll->transType()==RDLogLine::Stop);
}
}
void RDTrackerTableView::setPlayData()
{
((RDTrackerModel *)model())->setTransition(d_mouse_row,RDLogLine::Play);
}
void RDTrackerTableView::setSegueData()
{
((RDTrackerModel *)model())->setTransition(d_mouse_row,RDLogLine::Segue);
}
void RDTrackerTableView::setStopData()
{
((RDTrackerModel *)model())->setTransition(d_mouse_row,RDLogLine::Stop);
}

61
lib/rdtrackertableview.h Normal file
View File

@@ -0,0 +1,61 @@
// rdtrackertableview.h
//
// The Log TableView widget for RDTrackerWidget
//
// (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.
//
#ifndef RDTRACKERTABLEVIEW_H
#define RDTRACKERTABLEVIEW_H
#include <QDropEvent>
#include <QDragEnterEvent>
#include <QMenu>
#include <rdlog_line.h>
#include <rdtableview.h>
class RDTrackerTableView : public RDTableView
{
Q_OBJECT
public:
RDTrackerTableView(QWidget *parent);
signals:
void cartDropped(int line,RDLogLine *ll);
protected:
void dragEnterEvent(QDragEnterEvent *e);
void dragMoveEvent(QDragMoveEvent *e);
void dropEvent(QDropEvent *e);
void mousePressEvent(QMouseEvent *e);
private slots:
void aboutToShowMenuData();
void setPlayData();
void setSegueData();
void setStopData();
private:
int d_mouse_row;
QMenu *d_mouse_menu;
QAction *d_play_action;
QAction *d_segue_action;
QAction *d_stop_action;
};
#endif // RDTRACKERTABLEVIEW_H

3902
lib/rdtrackerwidget.cpp Normal file

File diff suppressed because it is too large Load Diff

277
lib/rdtrackerwidget.h Normal file
View File

@@ -0,0 +1,277 @@
// rdtrackerwidget.h
//
// Rivendell Voice Tracker
//
// (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.
//
#ifndef RDTRACKERWIDGET_H
#define RDTRACKERWIDGET_H
#include <rdevent_player.h>
#include <rdgroup.h>
#include <rdlog.h>
#include <rdloglock.h>
#include <rdmarkerdialog.h>
#include <rdplay_deck.h>
#include <rdsvc.h>
#include <rdstereometer.h>
#include <rdtransportbutton.h>
#include <rdwavepainter.h>
#include <rdwidget.h>
#include <rdtrackermodel.h>
#include <rdtrackertableview.h>
//
// Widget Settings
//
#define TRACKER_TEXT_COLOR Qt::red
#define TRACKER_RUBBERBAND_COLOR QColor("#008000")
#define TRACKER_RECORD_COLOR Qt::green
#define TRACKER_RECORD_BUTTON_COLOR Qt::red
#define TRACKER_START_BUTTON_COLOR Qt::green
#define TRACKER_ABORT_BUTTON_COLOR Qt::red
#define TRACKER_DONE_BUTTON_COLOR Qt::blue
#define TRACKER_START_WIDTH 19633
#define TRACKER_MSECS_PER_PIXEL 29
#define TRACKER_MB_PER_PIXEL 42
#define TRACKER_GAIN_MARGIN 4
#define TRACKER_MAX_GAIN 0
#define TRACKER_MIN_GAIN -3000
#define TRACKER_X_ORIGIN 2
#define TRACKER_X_WIDTH size().width()-89
#define TRACKER_Y_ORIGIN 2
#define TRACKER_Y_HEIGHT 79
#define TRACKER_SCROLL_SCALE 2
#define TRACKER_SCROLL_SCALE 2
#define TRACKER_FORCED_SEGUE 1000
#define TRACKER_MAX_LINENO 2147483647
class RDTrackerWidget : public RDWidget
{
Q_OBJECT
public:
RDTrackerWidget(QString *import_path,QWidget *parent=0);
~RDTrackerWidget();
QSize sizeHint() const;
QSizePolicy sizePolicy() const;
public slots:
bool load(const QString &logname);
void unload();
private slots:
void updateMenuData();
void hideMenuData();
void playData();
void stopData();
void track1Data();
void recordData();
void track2Data();
void finishedData();
void postData();
void resetData();
void insertData();
void insertData(int line,RDLogLine *logline,bool warn);
void deleteData();
void deleteData(int line,bool warn);
void previousData();
void nextData();
void editAudioData();
void undoChangesData();
void setStartPointData();
void setEndPointData();
void setHookPointData();
void stateChangedData(int id,RDPlayDeck::State state);
void positionData(int id,int msecs);
void segueStartData(int id);
void selectionChangedData(const QItemSelection &selected,
const QItemSelection &deselected);
void meterData();
void recordLoadedData(int card,int stream);
void recordingData(int card,int stream);
void recordStoppedData(int card,int stream);
void recordUnloadedData(int cart,int stream,unsigned msecs);
protected:
void resizeEvent(QResizeEvent *e);
void paintEvent(QPaintEvent *e);
void mousePressEvent(QMouseEvent *e);
void mouseReleaseEvent(QMouseEvent *e);
void mouseMoveEvent(QMouseEvent *e);
void keyPressEvent(QKeyEvent *e);
void keyReleaseEvent(QKeyEvent *e);
void wheelEvent(QWheelEvent *e);
private:
enum DeckState {DeckIdle=0,DeckTrack1=1,DeckTrack2=2,DeckTrack3=3};
enum Target {FadeupGain=0,FadeupPoint=1,FadedownGain=2,FadedownPoint=3,
TrackFadeupGain=4,TrackFadeupPoint=5,
TrackFadedownGain=6,TrackFadedownPoint=7,TargetSize=8};
void LoadTrack(int line);
void SaveTrack(int line);
bool ImportTrack(int line);
void RenderTransition(int line);
void LoadBlockLength(int line);
void RefreshLine(int line);
void StartNext(int finishing_id,int next_id=-1);
QString GetCutName(int line,RDCut **cut);
int GetClick(QMouseEvent *e,QPoint *p);
void DragTrack(int trackno,int xdiff);
void DragTarget(int trackno,const QPoint &pt);
void DrawTrackMap(int trackno);
void DrawCursor(RDWavePainter *wp,int height,int xpos,const QColor &color,
int arrow_offset,bool left_arrow);
void DrawRubberBand(RDWavePainter *wp,int trackno);
void DrawTarget(RDWavePainter *wp,RDTrackerWidget::Target target,
int trackno,int xpos,int ypos);
bool TransportActive();
bool PlayoutActive();
void UpdateControls();
void UpdateRemaining();
bool TrackAvailable();
void LogLine(const QString &line);
bool InitTrack();
void FinishTrack();
double GetCurrentTime();
bool IsTrack(int line,bool *offset);
bool CanInsertTrack();
bool CanDeleteTrack();
void CheckChanges();
void PushSegues();
void PopSegues();
int SingleSelectionLine(bool incl_end_handle=false);
void SendNotification(RDNotification::Action action,const QString &log_name);
void SendNotification(RDNotification::Action action,unsigned cartnum);
bool d_segue_loaded;
unsigned d_play_start_macro;
unsigned d_play_end_macro;
unsigned d_record_start_macro;
unsigned d_record_end_macro;
RDWavePainter *d_wpg[3];
int d_menu_clicked_point;
RDGroup *d_group;
int d_track_line;
RDLogLine *d_loglines[3];
RDLogLine *d_saved_loglines[3];
RDCart *d_track_cart;
RDCut *d_track_cuts[3];
QString *d_import_path;
RDSettings *d_settings;
QPalette d_time_remaining_palette[2];
QPixmap *d_wave_map[3];
QString d_wave_name[3];
int d_scroll_pos[3];
int d_wave_origin[3];
int d_segue_start_point[3];
int d_segue_start_offset[3];
DeckState d_deck_state;
RDPlayDeck *d_deck[3];
int d_wave_width;
int d_input_card;
int d_input_port;
int d_output_card;
int d_output_port;
int d_tail_preroll;
int d_threshold_level;
RDCae::AudioCoding d_coding;
unsigned d_format;
unsigned d_samprate;
unsigned d_bitrate;
unsigned d_chans;
bool d_sliding;
bool d_scrolling;
int d_scroll_threshold;
QPoint *d_previous_point;
int d_current_track;
int d_rightclick_track;
int d_rightclick_pos;
bool d_shift_pressed;
RDStereoMeter *d_meter;
QTimer *d_meter_timer;
RDTransportButton *d_play_button;
RDTransportButton *d_stop_button;
QPushButton *d_track1_button;
QPushButton *d_record_button;
QPushButton *d_track2_button;
QPushButton *d_finished_button;
QPushButton *d_post_button;
QPushButton *d_reset_button;
QPushButton *d_previous_button;
QPushButton *d_next_button;
QPushButton *d_insert_button;
QPushButton *d_delete_button;
// QPushButton *d_close_button;
RDEventPlayer *d_event_player;
unsigned d_tracks;
int d_time_remaining;
int d_time_remaining_start;
int d_time_counter;
bool d_block_valid;
QTime d_start_time;
QLabel *d_length_label;
QLabel *d_tracks_remaining_label;
QLabel *d_time_remaining_label;
int d_track_lines[3];
bool d_redraw[3];
unsigned d_redraw_count;
QCursor *d_current_cursor;
QCursor *d_arrow_cursor;
QCursor *d_hand_cursor;
QCursor *d_cross_cursor;
bool d_loaded;
bool d_offset;
bool d_recording;
bool d_changed;
double d_record_start_time;
int d_recording_pos;
bool d_aborting;
bool d_record_ran;
RDLogLine *d_dummy0_logline;
RDLogLine *d_dummy2_logline;
int d_preroll;
bool d_size_altered;
QPalette d_start_palette;
QPalette d_record_palette;
QPalette d_done_palette;
QPalette d_abort_palette;
QRect *d_track_rect;
QRect *d_target_rect[RDTrackerWidget::TargetSize];
int d_target_track[RDTrackerWidget::TargetSize];
RDTrackerWidget::Target d_current_target;
RDLogLock *d_log_lock;
RDTrackerTableView *d_log_view;
RDTrackerModel *d_log_model;
RDLog *d_log;
RDSvc *d_svc;
QMenu *d_mouse_menu;
QAction *d_edit_cue_action;
QAction *d_undo_segue_action;
QAction *d_set_start_action;
QAction *d_set_end_action;
QAction *d_set_hook_action;
RDMarkerDialog *d_marker_dialog;
int d_cursor_xpos;
QLabel *d_tracks_remaining_label_label;
QLabel *d_time_remaining_label_label;
QLabel *d_time_label;
};
#endif // RDTRACKERWIDGET_H