2021-03-12 Fred Gleason <fredg@paravelsystems.com>

* Added a 'RDMarkerReadout' class.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2021-03-14 14:36:30 -04:00
parent e5631a1b5f
commit a7f3f4e22d
18 changed files with 1479 additions and 37 deletions

View File

@ -21267,3 +21267,5 @@
2021-03-12 Fred Gleason <fredg@paravelsystems.com>
* Added a 'RDMarkerView' class.
* Added a 'RDMarkerDialog' class.
2021-03-12 Fred Gleason <fredg@paravelsystems.com>
* Added a 'RDMarkerReadout' class.

View File

@ -191,6 +191,7 @@ dist_librd_la_SOURCES = dbversion.h\
rdmarker_button.cpp rdmarker_button.h\
rdmarker_edit.cpp rdmarker_edit.h\
rdmarkerdialog.cpp rdmarkerdialog.h\
rdmarkerreadout.cpp rdmarkerreadout.h\
rdmarkerview.cpp rdmarkerview.h\
rdmatrix.cpp rdmatrix.h\
rdmatrixlistmodel.cpp rdmatrixlistmodel.h\
@ -371,6 +372,7 @@ nodist_librd_la_SOURCES = moc_rdadd_cart.cpp\
moc_rdmarker_bar.cpp\
moc_rdmarker_edit.cpp\
moc_rdmarkerdialog.cpp\
moc_rdmarkerreadout.cpp\
moc_rdmarkerview.cpp\
moc_rdmatrixlistmodel.cpp\
moc_rdmblookup.cpp\

View File

@ -144,6 +144,7 @@ SOURCES += rdmacrocartmodel.cpp
SOURCES += rdmarker_button.cpp
SOURCES += rdmarker_edit.cpp
SOURCES += rdmarkerdialog.cpp
SOURCES += rdmarkerreadout.cpp
SOURCES += rdmarkerview.cpp
SOURCES += rdmatrix.cpp
SOURCES += rdmatrixlistmodel.cpp
@ -324,6 +325,7 @@ HEADERS += rdmacrocartmodel.h
HEADERS += rdmarker_button.h
HEADERS += rdmarker_edit.h
HEADERS += rdmarkerdialog.h
HEADERS += rdmarkerreadout.h
HEADERS += rdmarkerview.h
HEADERS += rdmatrix.h
HEADERS += rdmatrixlistmodel.h

View File

@ -929,6 +929,58 @@
<source>Energy export failed</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Length</source>
<translation type="unfinished">Délka</translation>
</message>
<message>
<source>Talk</source>
<translation type="unfinished">Hovor</translation>
</message>
<message>
<source>Hook</source>
<translation type="unfinished">Chytlavá melodie</translation>
</message>
<message>
<source>Fade Up</source>
<translation type="unfinished">Zesílit</translation>
</message>
<message>
<source>Fade Down</source>
<translation type="unfinished">Zeslabit</translation>
</message>
<message>
<source>Cut Start</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cut End</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Talk Start</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Talk End</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Segue Start</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Segue End</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Hook Start</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Hook End</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RDAddCart</name>
@ -3524,6 +3576,26 @@ Out</translation>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Position</source>
<translation type="unfinished">Poloha</translation>
</message>
<message>
<source>Length</source>
<translation type="unfinished">Délka</translation>
</message>
<message>
<source>Unsaved Changes</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>There are unsaved changes!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Do you want to save them?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RDMarkerView</name>
@ -3531,6 +3603,14 @@ Out</translation>
<source>No such cart/cut!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Fade Up</source>
<translation type="obsolete">Zesílit</translation>
</message>
<message>
<source>Fade Down</source>
<translation type="obsolete">Zeslabit</translation>
</message>
</context>
<context>
<name>RDMatrixListModel</name>

View File

@ -925,6 +925,58 @@
<source>Energy export failed</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Length</source>
<translation type="unfinished">Länge</translation>
</message>
<message>
<source>Talk</source>
<translation type="unfinished">Mod</translation>
</message>
<message>
<source>Hook</source>
<translation type="unfinished">Hook</translation>
</message>
<message>
<source>Fade Up</source>
<translation type="unfinished">Einfaden</translation>
</message>
<message>
<source>Fade Down</source>
<translation type="unfinished">Ausfaden</translation>
</message>
<message>
<source>Cut Start</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cut End</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Talk Start</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Talk End</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Segue Start</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Segue End</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Hook Start</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Hook End</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RDAddCart</name>
@ -3513,6 +3565,26 @@ Out</translation>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Position</source>
<translation type="unfinished">Position</translation>
</message>
<message>
<source>Length</source>
<translation type="unfinished">Länge</translation>
</message>
<message>
<source>Unsaved Changes</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>There are unsaved changes!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Do you want to save them?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RDMarkerView</name>
@ -3520,6 +3592,14 @@ Out</translation>
<source>No such cart/cut!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Fade Up</source>
<translation type="obsolete">Einfaden</translation>
</message>
<message>
<source>Fade Down</source>
<translation type="obsolete">Ausfaden</translation>
</message>
</context>
<context>
<name>RDMatrixListModel</name>

View File

@ -925,6 +925,58 @@
<source>Energy export failed</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Length</source>
<translation type="unfinished">Longitud</translation>
</message>
<message>
<source>Talk</source>
<translation type="unfinished">Hablar</translation>
</message>
<message>
<source>Hook</source>
<translation type="unfinished">Hook</translation>
</message>
<message>
<source>Fade Up</source>
<translation type="unfinished">Fade de entrada</translation>
</message>
<message>
<source>Fade Down</source>
<translation type="unfinished">Fade de salida</translation>
</message>
<message>
<source>Cut Start</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cut End</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Talk Start</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Talk End</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Segue Start</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Segue End</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Hook Start</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Hook End</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RDAddCart</name>
@ -3500,6 +3552,26 @@ Todo</translation>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Position</source>
<translation type="unfinished">Posición</translation>
</message>
<message>
<source>Length</source>
<translation type="unfinished">Longitud</translation>
</message>
<message>
<source>Unsaved Changes</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>There are unsaved changes!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Do you want to save them?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RDMarkerView</name>
@ -3507,6 +3579,14 @@ Todo</translation>
<source>No such cart/cut!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Fade Up</source>
<translation type="obsolete">Fade de entrada</translation>
</message>
<message>
<source>Fade Down</source>
<translation type="obsolete">Fade de salida</translation>
</message>
</context>
<context>
<name>RDMatrixListModel</name>

View File

@ -895,6 +895,58 @@
<source>Energy export failed</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Length</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Talk</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Hook</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Fade Up</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Fade Down</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cut Start</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cut End</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Talk Start</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Talk End</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Segue Start</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Segue End</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Hook Start</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Hook End</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RDAddCart</name>
@ -2918,6 +2970,26 @@ Out</source>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Position</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Length</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unsaved Changes</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>There are unsaved changes!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Do you want to save them?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RDMarkerView</name>

View File

@ -925,6 +925,58 @@
<source>Energy export failed</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Length</source>
<translation type="unfinished">Lengd</translation>
</message>
<message>
<source>Talk</source>
<translation type="unfinished">Tale</translation>
</message>
<message>
<source>Hook</source>
<translation type="unfinished">Knagg</translation>
</message>
<message>
<source>Fade Up</source>
<translation type="unfinished">Ton inn</translation>
</message>
<message>
<source>Fade Down</source>
<translation type="unfinished">Ton ut</translation>
</message>
<message>
<source>Cut Start</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cut End</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Talk Start</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Talk End</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Segue Start</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Segue End</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Hook Start</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Hook End</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RDAddCart</name>
@ -3463,6 +3515,26 @@ ut</translation>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Position</source>
<translation type="unfinished">Posisjon</translation>
</message>
<message>
<source>Length</source>
<translation type="unfinished">Lengd</translation>
</message>
<message>
<source>Unsaved Changes</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>There are unsaved changes!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Do you want to save them?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RDMarkerView</name>
@ -3470,6 +3542,14 @@ ut</translation>
<source>No such cart/cut!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Fade Up</source>
<translation type="obsolete">Ton inn</translation>
</message>
<message>
<source>Fade Down</source>
<translation type="obsolete">Ton ut</translation>
</message>
</context>
<context>
<name>RDMatrixListModel</name>

View File

@ -925,6 +925,58 @@
<source>Energy export failed</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Length</source>
<translation type="unfinished">Lengd</translation>
</message>
<message>
<source>Talk</source>
<translation type="unfinished">Tale</translation>
</message>
<message>
<source>Hook</source>
<translation type="unfinished">Knagg</translation>
</message>
<message>
<source>Fade Up</source>
<translation type="unfinished">Ton inn</translation>
</message>
<message>
<source>Fade Down</source>
<translation type="unfinished">Ton ut</translation>
</message>
<message>
<source>Cut Start</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cut End</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Talk Start</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Talk End</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Segue Start</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Segue End</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Hook Start</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Hook End</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RDAddCart</name>
@ -3463,6 +3515,26 @@ ut</translation>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Position</source>
<translation type="unfinished">Posisjon</translation>
</message>
<message>
<source>Length</source>
<translation type="unfinished">Lengd</translation>
</message>
<message>
<source>Unsaved Changes</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>There are unsaved changes!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Do you want to save them?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RDMarkerView</name>
@ -3470,6 +3542,14 @@ ut</translation>
<source>No such cart/cut!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Fade Up</source>
<translation type="obsolete">Ton inn</translation>
</message>
<message>
<source>Fade Down</source>
<translation type="obsolete">Ton ut</translation>
</message>
</context>
<context>
<name>RDMatrixListModel</name>

View File

@ -925,6 +925,59 @@
<source>Energy export failed</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Length</source>
<translation type="unfinished">Duração</translation>
</message>
<message>
<source>Talk</source>
<translation type="unfinished">Fim Locutor</translation>
</message>
<message>
<source>Hook</source>
<translation type="unfinished">Trecho
</translation>
</message>
<message>
<source>Fade Up</source>
<translation type="unfinished">Fade Up</translation>
</message>
<message>
<source>Fade Down</source>
<translation type="unfinished">Fade Down</translation>
</message>
<message>
<source>Cut Start</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cut End</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Talk Start</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Talk End</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Segue Start</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Segue End</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Hook Start</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Hook End</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RDAddCart</name>
@ -3502,6 +3555,26 @@ Mínimo</translation>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Position</source>
<translation type="unfinished">Posição</translation>
</message>
<message>
<source>Length</source>
<translation type="unfinished">Duração</translation>
</message>
<message>
<source>Unsaved Changes</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>There are unsaved changes!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Do you want to save them?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RDMarkerView</name>
@ -3509,6 +3582,14 @@ Mínimo</translation>
<source>No such cart/cut!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Fade Up</source>
<translation type="obsolete">Fade Up</translation>
</message>
<message>
<source>Fade Down</source>
<translation type="obsolete">Fade Down</translation>
</message>
</context>
<context>
<name>RDMatrixListModel</name>

View File

@ -20,9 +20,12 @@
#include <QMessageBox>
#include "rdaudioinfo.h"
#include "rdmarkerdialog.h"
#include "rdmixer.h"
RDMarkerDialog::RDMarkerDialog(const QString &caption,QWidget *parent)
RDMarkerDialog::RDMarkerDialog(const QString &caption,int card,int port,
QWidget *parent)
: RDDialog(parent)
{
d_caption=caption;
@ -32,6 +35,9 @@ RDMarkerDialog::RDMarkerDialog(const QString &caption,QWidget *parent)
d_marker_view=new RDMarkerView(sizeHint().width()-104,374,this);
/**************************************************************************
* Waveform Section
**************************************************************************/
//
// Amplitude
//
@ -66,6 +72,121 @@ RDMarkerDialog::RDMarkerDialog(const QString &caption,QWidget *parent)
connect(d_time_fullout_button,SIGNAL(clicked()),
d_marker_view,SLOT(setMaximumShrinkFactor()));
/**************************************************************************
* Transport Section
**************************************************************************/
//
// Time Counters
//
d_overall_label=new QLabel(tr("Position"),this);
d_overall_label->setFont(subLabelFont());
d_overall_label->setAlignment(Qt::AlignHCenter);
d_overall_label->
setPalette(QPalette(palette().color(QPalette::Background),
QColor(RDMARKERDIALOG_HIGHLIGHT_COLOR)));
d_overall_edit=new QLineEdit(this);
d_overall_edit->setAcceptDrops(false);
d_overall_edit->setReadOnly(true);
d_region_edit_label=new QLabel("Region",this);
d_region_edit_label->setFont(subLabelFont());
d_region_edit_label->setAlignment(Qt::AlignHCenter);
d_region_edit_label->
setPalette(QPalette(palette().color(QPalette::Background),QColor(RDMARKERDIALOG_HIGHLIGHT_COLOR)));
d_region_edit=new QLineEdit(this);
d_region_edit->setAcceptDrops(false);
d_region_edit->setReadOnly(true);
d_size_label=new QLabel(tr("Length"),this);
d_size_label->setFont(subLabelFont());
d_size_label->setAlignment(Qt::AlignHCenter);
d_size_label->
setPalette(QPalette(palette().color(QPalette::Background),QColor(RDMARKERDIALOG_HIGHLIGHT_COLOR)));
d_size_edit=new QLineEdit(this);
d_size_edit->setAcceptDrops(false);
d_size_edit->setReadOnly(true);
//
// Transport Buttons
//
d_play_cursor_button=
new RDTransportButton(RDTransportButton::PlayBetween,this);
d_play_cursor_button->setFocusPolicy(Qt::NoFocus);
// d_play_cursor_button->setEnabled((d_card>=0)&&(d_port>=0));
// connect(d_play_cursor_button,SIGNAL(clicked()),
// this,SLOT(playCursorData()));
d_play_start_button=
new RDTransportButton(RDTransportButton::Play,this);
d_play_start_button->setFocusPolicy(Qt::NoFocus);
// d_play_start_button->setEnabled((d_card>=0)&&(d_port>=0));
// connect(d_play_start_button,SIGNAL(clicked()),
// this,SLOT(playStartData()));
d_pause_button=new RDTransportButton(RDTransportButton::Pause,this);
d_pause_button->setFocusPolicy(Qt::NoFocus);
d_pause_button->setOnColor(QColor(Qt::red));
// d_pause_button->setEnabled((d_card>=0)&&(d_port>=0));
// connect(d_pause_button,SIGNAL(clicked()),this,SLOT(pauseData()));
d_stop_button=new RDTransportButton(RDTransportButton::Stop,this);
d_stop_button->setFocusPolicy(Qt::NoFocus);
d_stop_button->on();
d_stop_button->setOnColor(QColor(Qt::red));
// d_stop_button->setEnabled((d_card>=0)&&(d_port>=0));
// connect(d_stop_button,SIGNAL(clicked()),this,SLOT(stopData()));
d_loop_button=new RDTransportButton(RDTransportButton::Loop,this);
d_loop_button->off();
// d_loop_button->setEnabled((d_card>=0)&&(d_port>=0));
// connect(d_loop_button,SIGNAL(clicked()),this,SLOT(loopData()));
//
// The Audio Meter
//
d_meter=new RDStereoMeter(this);
d_meter->setSegmentSize(5);
d_meter->setMode(RDSegMeter::Peak);
// d_meter_timer=new QTimer(this);
// connect(d_meter_timer,SIGNAL(timeout()),this,SLOT(meterData()));
//
// Marker Readouts
//
d_cut_readout=new RDMarkerReadout(RDMarkerHandle::CutStart,this);
connect(d_marker_view,
SIGNAL(pointerValueChanged(RDMarkerHandle::PointerRole,int)),
d_cut_readout,SLOT(setValue(RDMarkerHandle::PointerRole,int)));
d_cut_readout->setEnabled(true);
d_talk_readout=new RDMarkerReadout(RDMarkerHandle::TalkStart,this);
connect(d_marker_view,
SIGNAL(pointerValueChanged(RDMarkerHandle::PointerRole,int)),
d_talk_readout,SLOT(setValue(RDMarkerHandle::PointerRole,int)));
d_segue_readout=new RDMarkerReadout(RDMarkerHandle::SegueStart,this);
connect(d_marker_view,
SIGNAL(pointerValueChanged(RDMarkerHandle::PointerRole,int)),
d_segue_readout,SLOT(setValue(RDMarkerHandle::PointerRole,int)));
d_hook_readout=new RDMarkerReadout(RDMarkerHandle::HookStart,this);
connect(d_marker_view,
SIGNAL(pointerValueChanged(RDMarkerHandle::PointerRole,int)),
d_hook_readout,SLOT(setValue(RDMarkerHandle::PointerRole,int)));
d_fadeup_readout=new RDMarkerReadout(RDMarkerHandle::FadeUp,this);
connect(d_marker_view,
SIGNAL(pointerValueChanged(RDMarkerHandle::PointerRole,int)),
d_fadeup_readout,SLOT(setValue(RDMarkerHandle::PointerRole,int)));
d_fadedown_readout=new RDMarkerReadout(RDMarkerHandle::FadeDown,this);
connect(d_marker_view,
SIGNAL(pointerValueChanged(RDMarkerHandle::PointerRole,int)),
d_fadedown_readout,SLOT(setValue(RDMarkerHandle::PointerRole,int)));
/**************************************************************************
* Navigation Section
**************************************************************************/
//
// OK Button
//
@ -101,11 +222,20 @@ int RDMarkerDialog::exec(unsigned cartnum,int cutnum)
d_cut_number=cutnum;
setWindowTitle(d_caption+" - "+tr("Edit Audio"));
if(!d_marker_view->setCut(&err_msg,cartnum,cutnum)) {
QMessageBox::critical(this,d_caption+" - "+tr("Error"),err_msg);
return false;
}
for(int i=0;i<RDMarkerHandle::LastRole;i++) {
RDMarkerHandle::PointerRole role=(RDMarkerHandle::PointerRole)i;
d_cut_readout->setValue(role,d_marker_view->pointerValue(role));
d_talk_readout->setValue(role,d_marker_view->pointerValue(role));
d_segue_readout->setValue(role,d_marker_view->pointerValue(role));
d_hook_readout->setValue(role,d_marker_view->pointerValue(role));
d_fadeup_readout->setValue(role,d_marker_view->pointerValue(role));
d_fadedown_readout->setValue(role,d_marker_view->pointerValue(role));
}
return QDialog::exec();
}
@ -145,13 +275,31 @@ void RDMarkerDialog::timeOutData()
void RDMarkerDialog::okData()
{
d_marker_view->save();
done(true);
}
void RDMarkerDialog::cancelData()
{
done(false);
if(d_marker_view->hasUnsavedChanges()) {
switch(QMessageBox::question(this,d_caption+" - "+tr("Unsaved Changes"),
tr("There are unsaved changes!")+"\n"+
tr("Do you want to save them?"),
QMessageBox::Cancel,QMessageBox::No,
QMessageBox::Yes)) {
case QMessageBox::Yes:
okData();
break;
case QMessageBox::No:
done(false);
break;
default:
break;
}
}
}
@ -166,6 +314,9 @@ void RDMarkerDialog::resizeEvent(QResizeEvent *e)
int w=size().width();
int h=size().height();
//
// Waveform Section
//
d_marker_view->setGeometry(2,2,w-104,d_marker_view->sizeHint().height());
d_amplitude_box->setGeometry(w-100,2,90,130);
@ -178,7 +329,75 @@ void RDMarkerDialog::resizeEvent(QResizeEvent *e)
d_time_out_button->setGeometry(5,124,80,50);
d_time_fullout_button->setGeometry(5,174,80,50);
d_meter->setGeometry(380,398,
d_meter->sizeHint().width(),d_meter->sizeHint().height());
//
// Readout Section
//
d_cut_readout->setGeometry(10,30+RDMARKERDIALOG_WAVEFORM_HEIGHT+94,
d_cut_readout->sizeHint().width(),
d_cut_readout->sizeHint().height());
d_talk_readout->setGeometry(10+1*(d_talk_readout->sizeHint().width()-2),
30+RDMARKERDIALOG_WAVEFORM_HEIGHT+94,
d_talk_readout->sizeHint().width(),
d_talk_readout->sizeHint().height());
d_segue_readout->setGeometry(10+2*(d_segue_readout->sizeHint().width()-2),
30+RDMARKERDIALOG_WAVEFORM_HEIGHT+94,
d_segue_readout->sizeHint().width(),
d_segue_readout->sizeHint().height());
d_hook_readout->setGeometry(10+3*(d_hook_readout->sizeHint().width()-2),
30+RDMARKERDIALOG_WAVEFORM_HEIGHT+94,
d_hook_readout->sizeHint().width(),
d_hook_readout->sizeHint().height());
d_fadeup_readout->setGeometry(10,
30+RDMARKERDIALOG_WAVEFORM_HEIGHT+90+
d_hook_readout->sizeHint().height(),
2*d_fadeup_readout->sizeHint().width()-2,
d_fadeup_readout->sizeHint().height());
d_fadedown_readout->setGeometry(6+2*d_fadedown_readout->sizeHint().width(),
30+RDMARKERDIALOG_WAVEFORM_HEIGHT+90+
d_hook_readout->sizeHint().height(),
2*d_fadedown_readout->sizeHint().width()-2,
d_fadedown_readout->sizeHint().height());
//
// Transport Section
//
d_overall_label->setGeometry(60,385,70,20);
d_overall_edit->setGeometry(60,400,70,21);
d_region_edit_label->setGeometry(158,385,70,20);
d_region_edit->setGeometry(158,400,70,21);
d_size_label->setGeometry(256,385,70,20);
d_size_edit->setGeometry(256,400,70,21);
d_play_cursor_button->setGeometry(20,425,65,45);
d_play_start_button->setGeometry(90,425,65,45);
d_pause_button->setGeometry(160,425,65,45);
d_stop_button->setGeometry(230,425,65,45);
d_loop_button->setGeometry(300,425,65,45);
d_ok_button->setGeometry(w-180,h-60,80,50);
d_cancel_button->setGeometry(w-90,h-60,80,50);
}
void RDMarkerDialog::paintEvent(QPaintEvent *e)
{
QPainter *p=new QPainter(this);
//
// Transport Control Area
//
p->setPen(QColor(palette().shadow().color()));
p->fillRect(11,30+RDMARKERDIALOG_WAVEFORM_HEIGHT,RDMARKERDIALOG_WAVEFORM_WIDTH,92,
QColor(RDMARKERDIALOG_HIGHLIGHT_COLOR));
p->drawRect(11,30+RDMARKERDIALOG_WAVEFORM_HEIGHT,RDMARKERDIALOG_WAVEFORM_WIDTH,92);
delete p;
}

View File

@ -23,39 +23,44 @@
#include <QGroupBox>
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <QTimer>
#include <rddialog.h>
#include <rdmarkerreadout.h>
#include <rdmarkerview.h>
#include <rdstereometer.h>
#include <rdtransportbutton.h>
//
// Widget Settings
//
/*
#define EDITAUDIO_WIDGET_WIDTH 834
#define EDITAUDIO_WIDGET_HEIGHT 680
#define EDITAUDIO_WAVEFORM_WIDTH 717
#define EDITAUDIO_WAVEFORM_HEIGHT 352
#define EDITAUDIO_PAN_SIZE 300
#define EDITAUDIO_TAIL_PREROLL 1500
#define EDITAUDIO_DEFAULT_GAIN -12
#define EDITAUDIO_BUTTON_FLASH_PERIOD 200
#define EDITAUDIO_START_GAP 10
//#define RDMARKERDIALOG_WIDGET_WIDTH 834
//#define RDMARKERDIALOG_WIDGET_HEIGHT 680
#define RDMARKERDIALOG_WAVEFORM_WIDTH 717
#define RDMARKERDIALOG_WAVEFORM_HEIGHT 352
//#define RDMARKERDIALOG_PAN_SIZE 300
//#define RDMARKERDIALOG_TAIL_PREROLL 1500
//#define RDMARKERDIALOG_DEFAULT_GAIN -12
//#define RDMARKERDIALOG_BUTTON_FLASH_PERIOD 200
//#define RDMARKERDIALOG_START_GAP 10
//
// Widget Colors
//
#define EDITAUDIO_PLAY_COLOR Qt::white
#define EDITAUDIO_REMOVE_FLASH_COLOR Qt::blue
#define EDITAUDIO_WAVEFORM_COLOR Qt::black
#define EDITAUDIO_HIGHLIGHT_COLOR palette().mid().color()
*/
//#define RDMARKERDIALOG_PLAY_COLOR Qt::white
//#define RDMARKERDIALOG_REMOVE_FLASH_COLOR Qt::blue
//#define RDMARKERDIALOG_WAVEFORM_COLOR Qt::black
#define RDMARKERDIALOG_HIGHLIGHT_COLOR palette().mid().color()
class RDMarkerDialog : public RDDialog
{
Q_OBJECT
public:
RDMarkerDialog(const QString &caption,QWidget *parent=0);
enum PlayMode {FromStart=1,FromCursor=2,Region=3};
enum GainChange {GainNone=0,GainUp=1,GainDown=2};
RDMarkerDialog(const QString &caption,int card,int port,QWidget *parent=0);
~RDMarkerDialog();
QSize sizeHint() const;
@ -68,12 +73,14 @@ class RDMarkerDialog : public RDDialog
void timeFullInData();
void timeInData();
void timeOutData();
void okData();
void cancelData();
protected:
void closeEvent(QCloseEvent *e);
void resizeEvent(QResizeEvent *e);
void paintEvent(QPaintEvent *e);
private:
RDMarkerView *d_marker_view;
@ -88,6 +95,27 @@ class RDMarkerDialog : public RDDialog
RDTransportButton *d_time_out_button;
QPushButton *d_time_fullout_button;
// QGroupBox *d_transport_group;
QLabel *d_overall_label;
QLineEdit *d_overall_edit;
QLabel *d_region_edit_label;
QLineEdit *d_region_edit;
QLabel *d_size_label;
QLineEdit *d_size_edit;
RDTransportButton *d_loop_button;
RDTransportButton *d_play_start_button;
RDTransportButton *d_play_cursor_button;
RDTransportButton *d_pause_button;
RDTransportButton *d_stop_button;
RDStereoMeter *d_meter;
RDMarkerReadout *d_cut_readout;
RDMarkerReadout *d_fadeup_readout;
RDMarkerReadout *d_fadedown_readout;
RDMarkerReadout *d_talk_readout;
RDMarkerReadout *d_segue_readout;
RDMarkerReadout *d_hook_readout;
QPushButton *d_ok_button;
QPushButton *d_cancel_button;
unsigned d_cart_number;

142
lib/rdmarkerreadout.cpp Normal file
View File

@ -0,0 +1,142 @@
// rdmarkerreadout.cpp
//
// Read-only display for cut marker digital information
//
// (C) Copyright 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 "rdconf.h"
#include "rdmarkerreadout.h"
#define LABEL_DISABLED_COLOR QString("#888888")
RDMarkerReadout::RDMarkerReadout(RDMarkerHandle::PointerRole role,
QWidget *parent)
: RDWidget(parent)
{
d_roles.push_back(role);
d_label=new QLabel(RDMarkerHandle::pointerRoleText(role),this);
d_label->setAlignment(Qt::AlignCenter);
d_label->setFont(labelFont());
d_label->setStyleSheet("background-color: "+
RDMarkerHandle::pointerRoleColor(role).name());
// d_label->setDisabled(true);
switch(role) {
case RDMarkerHandle::CutStart:
case RDMarkerHandle::TalkStart:
case RDMarkerHandle::SegueStart:
case RDMarkerHandle::HookStart:
d_roles.push_back((RDMarkerHandle::PointerRole)(role+1));
for(int i=0;i<2;i++) {
d_edits.push_back(new QLabel(this));
d_edits.back()->setFrameShape(QFrame::Box);
d_edits.back()->setFrameShadow(QFrame::Sunken);
d_edits.back()->setAlignment(Qt::AlignCenter);
d_edits.back()->setText("0:00:00");
}
break;
case RDMarkerHandle::FadeUp:
case RDMarkerHandle::FadeDown:
d_edits.push_back(new QLabel(this));
d_edits.back()->setFrameShape(QFrame::Box);
d_edits.back()->setFrameShadow(QFrame::Sunken);
d_edits.back()->setAlignment(Qt::AlignCenter);
d_edits.back()->setText("0:00:00");
break;
case RDMarkerHandle::CutEnd:
case RDMarkerHandle::TalkEnd:
case RDMarkerHandle::LastRole:
case RDMarkerHandle::SegueEnd:
case RDMarkerHandle::HookEnd:
break;
}
setDisabled(true);
}
RDMarkerReadout::~RDMarkerReadout()
{
for(int i=0;i<d_edits.size();i++) {
delete d_edits.at(i);
}
d_edits.clear();
delete d_label;
}
QSize RDMarkerReadout::sizeHint() const
{
return QSize(60,20+20*d_edits.size());
}
QSizePolicy RDMarkerReadout::sizePolicy() const
{
return QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
}
void RDMarkerReadout::setValue(RDMarkerHandle::PointerRole role,int value)
{
for(int i=0;i<d_roles.size();i++) {
if(d_roles.at(i)==role) {
if(value>=0) {
d_edits.at(i)->setText(RDGetTimeLength(value,true,true));
}
else {
d_edits.at(i)->setText("0:00:00");
}
setEnabled(value>=0);
}
}
}
void RDMarkerReadout::setEnabled(bool state)
{
if(state) {
d_label->
setStyleSheet("background-color: "+
RDMarkerHandle::pointerRoleColor(d_roles.first()).name());
}
else {
d_label->setStyleSheet("background-color: "+LABEL_DISABLED_COLOR);
}
for(int i=0;i<d_edits.size();i++) {
d_edits.at(i)->setEnabled(state);
}
}
void RDMarkerReadout::setDisabled(bool state)
{
setEnabled(!state);
}
void RDMarkerReadout::resizeEvent(QResizeEvent *)
{
int w=size().width();
d_label->setGeometry(1,0,w-2,20);
for(int i=0;i<d_edits.size();i++) {
d_edits.at(i)->setGeometry(0,20+i*18,w,20);
}
}

54
lib/rdmarkerreadout.h Normal file
View File

@ -0,0 +1,54 @@
// rdmarkerreadout.h
//
// Read-only display for cut marker digital information
//
// (C) Copyright 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 RDMARKERREADOUT_H
#define RDMARKERREADOUT_H
#include <QLabel>
#include <QList>
#include <rdmarkerview.h>
#include <rdwidget.h>
class RDMarkerReadout : public RDWidget
{
Q_OBJECT;
public:
RDMarkerReadout(RDMarkerHandle::PointerRole role,QWidget *parent=0);
~RDMarkerReadout();
QSize sizeHint() const;
QSizePolicy sizePolicy() const;
public slots:
void setValue(RDMarkerHandle::PointerRole role,int value);
void setEnabled(bool state);
void setDisabled(bool state);
protected:
void resizeEvent(QResizeEvent *);
private:
QLabel *d_label;
QList <QLabel *> d_edits;
QList<RDMarkerHandle::PointerRole> d_roles;
};
#endif // RDMARKERREADOUT_H

View File

@ -18,28 +18,298 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#include <QGraphicsLineItem>
#include <QGraphicsScene>
#include <QGraphicsSceneMouseEvent>
#include <QPen>
#include <QPolygonF>
#include "rdescape_string.h"
#include "rdmarkerview.h"
#define LEFT_MARGIN 20
RDMarkerHandle::RDMarkerHandle(RDMarkerHandle::PointerRole role,
PointerType type,void *mkrview,
QGraphicsItem *parent)
: QGraphicsPolygonItem(parent)
{
setFlags(QGraphicsItem::ItemIsMovable);
d_marker_view=mkrview;
d_minimum=-1;
d_maximum=-1;
QPolygonF triangle;
switch(type) {
case RDMarkerHandle::Start:
triangle << QPointF(0.0,0.0) << QPointF(-16,8) << QPointF(-16,-8);
break;
case RDMarkerHandle::End:
triangle << QPointF(0.0,0.0) << QPointF(16,8) << QPointF(16,-8);
break;
}
setPolygon(triangle);
setPen(QPen(RDMarkerHandle::pointerRoleColor(role)));
setBrush(RDMarkerHandle::pointerRoleColor(role));
d_name=RDMarkerHandle::pointerRoleTypeText(role);
d_role=role;
setToolTip(RDMarkerHandle::pointerRoleTypeText(role));
}
QString RDMarkerHandle::name() const
{
return d_name;
}
RDMarkerHandle::PointerRole RDMarkerHandle::role() const
{
return d_role;
}
int RDMarkerHandle::minimum() const
{
return d_minimum;
}
void RDMarkerHandle::setMinimum(int pos)
{
d_minimum=pos;
}
int RDMarkerHandle::maximum() const
{
return d_maximum;
}
void RDMarkerHandle::setMaximum(int pos)
{
d_maximum=pos;
}
void RDMarkerHandle::setRange(int min,int max)
{
d_minimum=min;
d_maximum=max;
}
void RDMarkerHandle::mousePressEvent(QGraphicsSceneMouseEvent *e)
{
if(e->button()==Qt::LeftButton) {
e->accept();
if(d_peers.size()==0) {
QGraphicsScene *s=scene();
QList<QGraphicsItem *> items=s->items();
for(int i=0;i<items.size();i++) {
if(items.at(i)->toolTip()==toolTip()) {
d_peers.push_back(items.at(i));
}
}
}
}
}
void RDMarkerHandle::mouseMoveEvent(QGraphicsSceneMouseEvent *e)
{
RDMarkerView *view=static_cast<RDMarkerView *>(d_marker_view);
//
// Update the Marker Graphics
//
qreal dx=e->pos().rx()-e->lastPos().rx();
for(int i=0;i<d_peers.size();i++) {
QGraphicsItem *peer=d_peers.at(i);
peer->setPos(peer->pos().rx()+dx,peer->pos().ry());
}
//
// Send Position
//
view->updatePosition(d_role,pos().x()-LEFT_MARGIN);
}
void RDMarkerHandle::mouseReleaseEvent(QGraphicsSceneMouseEvent *e)
{
RDMarkerView *view=static_cast<RDMarkerView *>(d_marker_view);
//
// Send Position
//
view->updatePosition(d_role,pos().x()-LEFT_MARGIN);
}
QString RDMarkerHandle::pointerRoleText(PointerRole role)
{
QString ret=QObject::tr("Unknown");
switch(role) {
case RDMarkerHandle::CutStart:
case RDMarkerHandle::CutEnd:
ret=QObject::tr("Length");
break;
case RDMarkerHandle::TalkStart:
case RDMarkerHandle::TalkEnd:
ret=QObject::tr("Talk");
break;
case RDMarkerHandle::SegueStart:
case RDMarkerHandle::SegueEnd:
ret=QObject::tr("Segue");
break;
case RDMarkerHandle::HookStart:
case RDMarkerHandle::HookEnd:
ret=QObject::tr("Hook");
break;
case RDMarkerHandle::FadeUp:
ret=QObject::tr("Fade Up");
break;
case RDMarkerHandle::FadeDown:
ret=QObject::tr("Fade Down");
break;
case RDMarkerHandle::LastRole:
break;
}
return ret;
}
QString RDMarkerHandle::pointerRoleTypeText(RDMarkerHandle::PointerRole role)
{
QString ret=QObject::tr("Unknown");
switch(role) {
case RDMarkerHandle::CutStart:
ret=QObject::tr("Cut Start");
break;
case RDMarkerHandle::CutEnd:
ret=QObject::tr("Cut End");
break;
case RDMarkerHandle::TalkStart:
ret=QObject::tr("Talk Start");
break;
case RDMarkerHandle::TalkEnd:
ret=QObject::tr("Talk End");
break;
case RDMarkerHandle::SegueStart:
ret=QObject::tr("Segue Start");
break;
case RDMarkerHandle::SegueEnd:
ret=QObject::tr("Segue End");
break;
case RDMarkerHandle::HookStart:
ret=QObject::tr("Hook Start");
break;
case RDMarkerHandle::HookEnd:
ret=QObject::tr("Hook End");
break;
case RDMarkerHandle::FadeUp:
ret=QObject::tr("Fade Up");
break;
case RDMarkerHandle::FadeDown:
ret=QObject::tr("Fade Down");
break;
case RDMarkerHandle::LastRole:
break;
}
return ret;
}
QColor RDMarkerHandle::pointerRoleColor(RDMarkerHandle::PointerRole role)
{
QColor ret;
switch(role) {
case RDMarkerHandle::CutStart:
case RDMarkerHandle::CutEnd:
ret=Qt::red;
break;
case RDMarkerHandle::TalkStart:
case RDMarkerHandle::TalkEnd:
ret=Qt::blue;
break;
case RDMarkerHandle::SegueStart:
case RDMarkerHandle::SegueEnd:
ret=Qt::cyan;
break;
case RDMarkerHandle::HookStart:
case RDMarkerHandle::HookEnd:
ret=Qt::magenta;
break;
case RDMarkerHandle::FadeUp:
case RDMarkerHandle::FadeDown:
ret=Qt::darkYellow;
break;
case RDMarkerHandle::LastRole:
break;
}
return ret;
}
RDMarkerView::RDMarkerView(int width,int height,QWidget *parent)
: QWidget(parent)
{
d_width=width;
d_height=height;
d_cut=NULL;
d_scene=NULL;
d_sample_rate=rda->system()->sampleRate();
clear();
d_view=new QGraphicsView(this);
d_wave_factory=new RDWaveFactory(RDWaveFactory::MultiTrack);
d_pointer_fields.push_back("START_POINT");
d_pointer_fields.push_back("END_POINT");
d_pointer_fields.push_back("TALK_START_POINT");
d_pointer_fields.push_back("TALK_END_POINT");
d_pointer_fields.push_back("SEGUE_START_POINT");
d_pointer_fields.push_back("SEGUE_END_POINT");
d_pointer_fields.push_back("HOOK_START_POINT");
d_pointer_fields.push_back("HOOK_END_POINT");
d_pointer_fields.push_back("FADEUP_POINT");
d_pointer_fields.push_back("FADEDOWN_POINT");
}
RDMarkerView::~RDMarkerView()
{
if(d_cut!=NULL) {
delete d_cut;
}
if(d_scene!=NULL) {
delete d_scene;
}
@ -72,6 +342,31 @@ int RDMarkerView::shrinkFactor() const
}
int RDMarkerView::pointerValue(RDMarkerHandle::PointerRole role)
{
return d_pointers[role];
}
bool RDMarkerView::hasUnsavedChanges() const
{
return d_has_unsaved_changes;
}
void RDMarkerView::updatePosition(RDMarkerHandle::PointerRole role, int offset)
{
//
// Careful! Don't overflow 32 bits.
//
int64_t pframes=(int64_t)(1152*offset*d_shrink_factor);
d_pointers[role]=(int)((int64_t)1000*pframes/(int64_t)d_sample_rate);
d_has_unsaved_changes=true;
emit pointerValueChanged(role,d_pointers[role]);
}
void RDMarkerView::setAudioGain(int lvl)
{
if(d_audio_gain!=lvl) {
@ -98,11 +393,9 @@ void RDMarkerView::setMaximumShrinkFactor()
bool RDMarkerView::setCut(QString *err_msg,unsigned cartnum,int cutnum)
{
if(d_cut!=NULL) {
delete d_cut;
}
d_cut=new RDCut(cartnum,cutnum);
if(!d_cut->exists()) {
d_cart_number=cartnum;
d_cut_number=cutnum;
if(!LoadCutData()) {
*err_msg=tr("No such cart/cut!");
return false;
}
@ -121,20 +414,36 @@ bool RDMarkerView::setCut(QString *err_msg,unsigned cartnum,int cutnum)
}
void RDMarkerView::save()
{
QString sql;
sql=QString("update CUTS set ");
for(int i=0;i<RDMarkerHandle::PointerRole::LastRole;i++) {
sql+=d_pointer_fields.at(i)+QString().sprintf("=%d,",d_pointers[i]);
}
sql=sql.left(sql.length()-1)+" where "+
"CUT_NAME=\""+RDEscapeString(RDCut::cutName(d_cart_number,d_cut_number))+
"\"";
RDSqlQuery::apply(sql);
d_has_unsaved_changes=false;
}
void RDMarkerView::clear()
{
if(d_cut!=NULL) {
delete d_cut;
d_cut=NULL;
}
if(d_scene!=NULL) {
delete d_scene;
d_scene=NULL;
}
for(int i=0;i<RDMarkerHandle::LastRole;i++) {
d_pointers[i]=-1;
}
d_shrink_factor=1;
d_max_shrink_factor=1;
d_pad_size=0;
d_audio_gain=900;
d_has_unsaved_changes=false;
}
@ -144,8 +453,43 @@ void RDMarkerView::resizeEvent(QResizeEvent *e)
}
int RDMarkerView::Frame(int msec) const
{
return (int)((int64_t)msec*(int64_t)d_sample_rate/(d_shrink_factor*1152000));
}
bool RDMarkerView::LoadCutData()
{
QString sql;
RDSqlQuery *q=NULL;
bool ret=false;
sql=QString("select ")+
d_pointer_fields.join(",")+","+ // 00 - 09
"CHANNELS "+ // 10
"from CUTS where "+
"CUT_NAME=\""+
RDEscapeString(RDCut::cutName(d_cart_number,d_cut_number))+"\"";
q=new RDSqlQuery(sql);
if(q->first()) {
ret=true;
for(int i=0;i<RDMarkerHandle::LastRole;i++) {
d_pointers[i]=q->value(i).toInt();
}
d_channels=q->value(10).toInt();
}
delete q;
return ret;
}
void RDMarkerView::WriteWave()
{
//
// Waveform
//
QPixmap wavemap=
d_wave_factory->generate(d_height-20,d_shrink_factor,d_audio_gain,true);
@ -154,7 +498,45 @@ void RDMarkerView::WriteWave()
}
d_scene=new QGraphicsScene(0,0,wavemap.width()+d_pad_size,d_height-20,this);
d_scene->addPixmap(wavemap);
d_scene->addRect(wavemap.width(),0,d_pad_size,d_height-20,QPen(Qt::gray),QBrush(Qt::gray));
d_scene->addRect(0,0,LEFT_MARGIN,d_height-20,QPen(Qt::gray),QBrush(Qt::gray));
d_scene->addPixmap(wavemap)->setPos(LEFT_MARGIN,0);
d_scene->addRect(LEFT_MARGIN+wavemap.width(),0,d_pad_size,d_height-20,QPen(Qt::gray),QBrush(Qt::gray));
//
// Markers
//
DrawMarker(RDMarkerHandle::End,RDMarkerHandle::FadeUp,100);
DrawMarker(RDMarkerHandle::Start,RDMarkerHandle::FadeDown,100);
DrawMarker(RDMarkerHandle::Start,RDMarkerHandle::HookStart,80);
DrawMarker(RDMarkerHandle::End,RDMarkerHandle::HookEnd,80);
DrawMarker(RDMarkerHandle::Start,RDMarkerHandle::TalkStart,60);
DrawMarker(RDMarkerHandle::End,RDMarkerHandle::TalkEnd,60);
DrawMarker(RDMarkerHandle::Start,RDMarkerHandle::SegueStart,40);
DrawMarker(RDMarkerHandle::End,RDMarkerHandle::SegueEnd,40);
DrawMarker(RDMarkerHandle::Start,RDMarkerHandle::CutStart,20);
DrawMarker(RDMarkerHandle::End,RDMarkerHandle::CutEnd,20);
d_view->setScene(d_scene);
}
void RDMarkerView::DrawMarker(RDMarkerHandle::PointerType type,
RDMarkerHandle::PointerRole role,int handle_pos)
{
QGraphicsLineItem *l_item=NULL;
RDMarkerHandle *m_item=NULL;
if(d_pointers[role]>=0) {
l_item=d_scene->addLine(LEFT_MARGIN+Frame(d_pointers[role]),0,
LEFT_MARGIN+Frame(d_pointers[role]),d_height,QPen(RDMarkerHandle::pointerRoleColor(role)));
l_item->setToolTip(RDMarkerHandle::pointerRoleTypeText(role));
m_item=new RDMarkerHandle(role,type,this);
d_scene->addItem(m_item);
m_item->setPos(LEFT_MARGIN+Frame(d_pointers[role]),handle_pos-12);
m_item=new RDMarkerHandle(role,type,this);
d_scene->addItem(m_item);
m_item->setPos(LEFT_MARGIN+Frame(d_pointers[role]),d_height-handle_pos-8);
}
}

View File

@ -21,6 +21,7 @@
#ifndef RDMARKERVIEW_H
#define RDMARKERVIEW_H
#include <QGraphicsPolygonItem>
#include <QGraphicsScene>
#include <QGraphicsView>
#include <QList>
@ -28,6 +29,44 @@
#include <rdcut.h>
#include <rdwavefactory.h>
class RDMarkerHandle : public QGraphicsPolygonItem
{
public:
enum PointerType {Start=0,End=1};
enum PointerRole {CutStart=0,CutEnd=1,
TalkStart=2,TalkEnd=3,
SegueStart=4,SegueEnd=5,
HookStart=6,HookEnd=7,
FadeUp=8,FadeDown=9,
LastRole=10};
RDMarkerHandle(RDMarkerHandle::PointerRole role,PointerType type,
void *mkrview,QGraphicsItem *parent=nullptr);
QString name() const;
PointerRole role() const;
int minimum() const;
void setMinimum(int pos);
int maximum() const;
void setMaximum(int pos);
void setRange(int min,int max);
static QString pointerRoleText(PointerRole role);
static QString pointerRoleTypeText(PointerRole role);
static QColor pointerRoleColor(PointerRole role);
protected:
void mousePressEvent(QGraphicsSceneMouseEvent *e);
void mouseMoveEvent(QGraphicsSceneMouseEvent *e);
void mouseReleaseEvent(QGraphicsSceneMouseEvent *e);
private:
QString d_name;
PointerRole d_role;
QList<QGraphicsItem *> d_peers;
void *d_marker_view;
int d_minimum;
int d_maximum;
};
class RDMarkerView : public QWidget
{
Q_OBJECT;
@ -38,29 +77,46 @@ class RDMarkerView : public QWidget
QSizePolicy sizePolicy() const;
int audioGain() const;
int shrinkFactor() const;
int pointerValue(RDMarkerHandle::PointerRole role);
bool hasUnsavedChanges() const;
void updatePosition(RDMarkerHandle::PointerRole role, int offset);
public slots:
void setAudioGain(int lvl);
void setShrinkFactor(int sf);
void setMaximumShrinkFactor();
bool setCut(QString *err_msg,unsigned cartnum,int cutnum);
void save();
void clear();
signals:
void pointerValueChanged(RDMarkerHandle::PointerRole role,int msec);
protected:
void resizeEvent(QResizeEvent *e);
private:
int Frame(int msec) const;
bool LoadCutData();
void WriteWave();
void DrawMarker(RDMarkerHandle::PointerType type,
RDMarkerHandle::PointerRole role,int handle_pos);
QGraphicsView *d_view;
QGraphicsScene *d_scene;
RDCut *d_cut;
unsigned d_cart_number;
int d_cut_number;
int d_width;
int d_height;
int d_shrink_factor;
int d_max_shrink_factor;
int d_pad_size;
int d_audio_gain;
unsigned d_sample_rate;
unsigned d_channels;
QStringList d_pointer_fields;
RDWaveFactory *d_wave_factory;
bool d_has_unsaved_changes;
int d_pointers[RDMarkerHandle::LastRole];
};

View File

@ -79,7 +79,7 @@ QPixmap RDWaveFactory::generate(int height,int x_shrink,int gain,
p->setPen(Qt::green);
p->drawLine(i,0,i,height);
p->setPen(Qt::red);
for(int j=0;j<d_energy_channels;j++) {
for(unsigned j=0;j<d_energy_channels;j++) {
p->drawText(i+5,(j+1)*height/d_energy_channels-2,
RDGetTimeLength(msec*x_shrink,false,false));
}

View File

@ -51,7 +51,9 @@ AudioCart::AudioCart(AudioControls *controls,RDCart *cart,QString *path,
//
// Dialogs
//
rdcart_marker_dialog=new RDMarkerDialog("RDLibrary",this);
rdcart_marker_dialog=
new RDMarkerDialog("RDLibrary",rda->libraryConf()->outputCard(),
rda->libraryConf()->outputPort(),this);
QColor system_button_text_color = palette().buttonText().color();