mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-07-04 14:39:09 +02:00
2021-03-12 Fred Gleason <fredg@paravelsystems.com>
* Added a 'RDMarkerView' class. * Added a 'RDMarkerDialog' class. Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
parent
f2b8f6ddba
commit
e5631a1b5f
@ -21264,3 +21264,6 @@
|
||||
* Added a 'RDWaveWidget' class.
|
||||
2021-03-11 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Added a 'RDWaveFactory' class.
|
||||
2021-03-12 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Added a 'RDMarkerView' class.
|
||||
* Added a 'RDMarkerDialog' class.
|
||||
|
@ -190,6 +190,8 @@ dist_librd_la_SOURCES = dbversion.h\
|
||||
rdmarker_bar.cpp rdmarker_bar.h\
|
||||
rdmarker_button.cpp rdmarker_button.h\
|
||||
rdmarker_edit.cpp rdmarker_edit.h\
|
||||
rdmarkerdialog.cpp rdmarkerdialog.h\
|
||||
rdmarkerview.cpp rdmarkerview.h\
|
||||
rdmatrix.cpp rdmatrix.h\
|
||||
rdmatrixlistmodel.cpp rdmatrixlistmodel.h\
|
||||
rdmblookup.cpp rdmblookup.h\
|
||||
@ -368,6 +370,8 @@ nodist_librd_la_SOURCES = moc_rdadd_cart.cpp\
|
||||
moc_rdmacrocartmodel.cpp\
|
||||
moc_rdmarker_bar.cpp\
|
||||
moc_rdmarker_edit.cpp\
|
||||
moc_rdmarkerdialog.cpp\
|
||||
moc_rdmarkerview.cpp\
|
||||
moc_rdmatrixlistmodel.cpp\
|
||||
moc_rdmblookup.cpp\
|
||||
moc_rdmulticaster.cpp\
|
||||
|
@ -143,6 +143,8 @@ SOURCES += rdmacro_event.cpp
|
||||
SOURCES += rdmacrocartmodel.cpp
|
||||
SOURCES += rdmarker_button.cpp
|
||||
SOURCES += rdmarker_edit.cpp
|
||||
SOURCES += rdmarkerdialog.cpp
|
||||
SOURCES += rdmarkerview.cpp
|
||||
SOURCES += rdmatrix.cpp
|
||||
SOURCES += rdmatrixlistmodel.cpp
|
||||
SOURCES += rdmblookup.cpp
|
||||
@ -321,6 +323,8 @@ HEADERS += rdmacro_event.h
|
||||
HEADERS += rdmacrocartmodel.h
|
||||
HEADERS += rdmarker_button.h
|
||||
HEADERS += rdmarker_edit.h
|
||||
HEADERS += rdmarkerdialog.h
|
||||
HEADERS += rdmarkerview.h
|
||||
HEADERS += rdmatrix.h
|
||||
HEADERS += rdmatrixlistmodel.h
|
||||
HEADERS += rdmblookup.h
|
||||
|
@ -3486,6 +3486,52 @@ Bitte Kofiguration prüfen und erneut versuchen.</translation>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDMarkerDialog</name>
|
||||
<message>
|
||||
<source>OK</source>
|
||||
<translation type="unfinished">OK</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished">Zrušit</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Edit Audio</source>
|
||||
<translation type="unfinished">Upravit zvuk</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Amplitude</source>
|
||||
<translation type="unfinished">Rozkmit</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Time</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Full
|
||||
In</source>
|
||||
<translation type="unfinished">Plný
|
||||
In</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Full
|
||||
Out</source>
|
||||
<translation type="unfinished">Plný
|
||||
Out</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDMarkerView</name>
|
||||
<message>
|
||||
<source>No such cart/cut!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDMatrixListModel</name>
|
||||
<message>
|
||||
|
@ -3475,6 +3475,52 @@ Bitte Kofiguration prüfen und erneut versuchen.</translation>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDMarkerDialog</name>
|
||||
<message>
|
||||
<source>OK</source>
|
||||
<translation type="unfinished">OK</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished">Abbrechen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Edit Audio</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Amplitude</source>
|
||||
<translation type="unfinished">Amplitude</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Time</source>
|
||||
<translation type="unfinished">Zeit</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Full
|
||||
In</source>
|
||||
<translation type="unfinished">Full
|
||||
In</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Full
|
||||
Out</source>
|
||||
<translation type="unfinished">Full
|
||||
Out</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDMarkerView</name>
|
||||
<message>
|
||||
<source>No such cart/cut!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDMatrixListModel</name>
|
||||
<message>
|
||||
|
@ -3462,6 +3462,52 @@ Do you still want to proceed?</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDMarkerDialog</name>
|
||||
<message>
|
||||
<source>OK</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished">Cancelar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Edit Audio</source>
|
||||
<translation type="unfinished">Editar Audio</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Amplitude</source>
|
||||
<translation type="unfinished">Amplitud</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Time</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Full
|
||||
In</source>
|
||||
<translation type="unfinished">Acercar
|
||||
Máximo</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Full
|
||||
Out</source>
|
||||
<translation type="unfinished">Ver
|
||||
Todo</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDMarkerView</name>
|
||||
<message>
|
||||
<source>No such cart/cut!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDMatrixListModel</name>
|
||||
<message>
|
||||
|
@ -2882,6 +2882,50 @@ Do you want to overwrite it?</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDMarkerDialog</name>
|
||||
<message>
|
||||
<source>OK</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Edit Audio</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Amplitude</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Time</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Full
|
||||
In</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Full
|
||||
Out</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDMarkerView</name>
|
||||
<message>
|
||||
<source>No such cart/cut!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDMatrixListModel</name>
|
||||
<message>
|
||||
|
@ -3425,6 +3425,52 @@ Sjekk eksportoppsettet ditt og prøv att.</translation>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDMarkerDialog</name>
|
||||
<message>
|
||||
<source>OK</source>
|
||||
<translation type="unfinished">OK</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Edit Audio</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Amplitude</source>
|
||||
<translation type="unfinished">Lydstyrke</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Time</source>
|
||||
<translation type="unfinished">Tid</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Full
|
||||
In</source>
|
||||
<translation type="unfinished">Heilt
|
||||
inn</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Full
|
||||
Out</source>
|
||||
<translation type="unfinished">Heilt
|
||||
ut</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDMarkerView</name>
|
||||
<message>
|
||||
<source>No such cart/cut!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDMatrixListModel</name>
|
||||
<message>
|
||||
|
@ -3425,6 +3425,52 @@ Sjekk eksportoppsettet ditt og prøv att.</translation>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDMarkerDialog</name>
|
||||
<message>
|
||||
<source>OK</source>
|
||||
<translation type="unfinished">OK</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Edit Audio</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Amplitude</source>
|
||||
<translation type="unfinished">Lydstyrke</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Time</source>
|
||||
<translation type="unfinished">Tid</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Full
|
||||
In</source>
|
||||
<translation type="unfinished">Heilt
|
||||
inn</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Full
|
||||
Out</source>
|
||||
<translation type="unfinished">Heilt
|
||||
ut</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDMarkerView</name>
|
||||
<message>
|
||||
<source>No such cart/cut!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDMatrixListModel</name>
|
||||
<message>
|
||||
|
@ -3464,6 +3464,52 @@ Por Favor, cheque suas configurações e tenbte outra vez.</translation>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDMarkerDialog</name>
|
||||
<message>
|
||||
<source>OK</source>
|
||||
<translation type="unfinished">OK</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished">Cancelar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Edit Audio</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Amplitude</source>
|
||||
<translation type="unfinished">Amplitude</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Time</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Full
|
||||
In</source>
|
||||
<translation type="unfinished">Zoom
|
||||
Máximo</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Full
|
||||
Out</source>
|
||||
<translation type="unfinished">Zoom
|
||||
Mínimo</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDMarkerView</name>
|
||||
<message>
|
||||
<source>No such cart/cut!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDMatrixListModel</name>
|
||||
<message>
|
||||
|
184
lib/rdmarkerdialog.cpp
Normal file
184
lib/rdmarkerdialog.cpp
Normal file
@ -0,0 +1,184 @@
|
||||
// rdmarkerdialog.cpp
|
||||
//
|
||||
// Rivendell Audio Marker Editor
|
||||
//
|
||||
// (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 <QMessageBox>
|
||||
|
||||
#include "rdmarkerdialog.h"
|
||||
|
||||
RDMarkerDialog::RDMarkerDialog(const QString &caption,QWidget *parent)
|
||||
: RDDialog(parent)
|
||||
{
|
||||
d_caption=caption;
|
||||
|
||||
setMinimumSize(sizeHint());
|
||||
setMaximumSize(sizeHint());
|
||||
|
||||
d_marker_view=new RDMarkerView(sizeHint().width()-104,374,this);
|
||||
|
||||
//
|
||||
// Amplitude
|
||||
//
|
||||
d_amplitude_box=new QGroupBox(tr("Amplitude"),this);
|
||||
d_amplitude_box->setFont(labelFont());
|
||||
d_amplitude_up_button=
|
||||
new RDTransportButton(RDTransportButton::Up,d_amplitude_box);
|
||||
connect(d_amplitude_up_button,SIGNAL(clicked()),
|
||||
this,SLOT(amplitudeUpData()));
|
||||
d_amplitude_down_button=
|
||||
new RDTransportButton(RDTransportButton::Down,d_amplitude_box);
|
||||
connect(d_amplitude_down_button,SIGNAL(clicked()),
|
||||
this,SLOT(amplitudeDownData()));
|
||||
|
||||
//
|
||||
// Time
|
||||
//
|
||||
d_time_box=new QGroupBox(tr("Time"),this);
|
||||
d_time_box->setFont(labelFont());
|
||||
d_time_fullin_button=new QPushButton(tr("Full\nIn"),d_time_box);
|
||||
d_time_fullin_button->setFont(buttonFont());
|
||||
connect(d_time_fullin_button,SIGNAL(clicked()),this,SLOT(timeFullInData()));
|
||||
|
||||
d_time_in_button=new RDTransportButton(RDTransportButton::Up,d_time_box);
|
||||
connect(d_time_in_button,SIGNAL(clicked()),this,SLOT(timeInData()));
|
||||
|
||||
d_time_out_button=new RDTransportButton(RDTransportButton::Down,d_time_box);
|
||||
connect(d_time_out_button,SIGNAL(clicked()),this,SLOT(timeOutData()));
|
||||
|
||||
d_time_fullout_button=new QPushButton(tr("Full\nOut"),d_time_box);
|
||||
d_time_fullout_button->setFont(buttonFont());
|
||||
connect(d_time_fullout_button,SIGNAL(clicked()),
|
||||
d_marker_view,SLOT(setMaximumShrinkFactor()));
|
||||
|
||||
//
|
||||
// OK Button
|
||||
//
|
||||
d_ok_button=new QPushButton(tr("OK"),this);
|
||||
d_ok_button->setFont(buttonFont());
|
||||
connect(d_ok_button,SIGNAL(clicked()),this,SLOT(okData()));
|
||||
|
||||
//
|
||||
// Cancel Button
|
||||
//
|
||||
d_cancel_button=new QPushButton(tr("Cancel"),this);
|
||||
d_cancel_button->setFont(buttonFont());
|
||||
connect(d_cancel_button,SIGNAL(clicked()),this,SLOT(cancelData()));
|
||||
}
|
||||
|
||||
|
||||
RDMarkerDialog::~RDMarkerDialog()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
QSize RDMarkerDialog::sizeHint() const
|
||||
{
|
||||
return QSize(1000,600);
|
||||
}
|
||||
|
||||
|
||||
int RDMarkerDialog::exec(unsigned cartnum,int cutnum)
|
||||
{
|
||||
QString err_msg;
|
||||
|
||||
d_cart_number=cartnum;
|
||||
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;
|
||||
}
|
||||
|
||||
return QDialog::exec();
|
||||
}
|
||||
|
||||
|
||||
void RDMarkerDialog::amplitudeUpData()
|
||||
{
|
||||
d_marker_view->setAudioGain(d_marker_view->audioGain()+300);
|
||||
}
|
||||
|
||||
|
||||
void RDMarkerDialog::amplitudeDownData()
|
||||
{
|
||||
d_marker_view->setAudioGain(d_marker_view->audioGain()-300);
|
||||
}
|
||||
|
||||
|
||||
void RDMarkerDialog::timeFullInData()
|
||||
{
|
||||
d_marker_view->setShrinkFactor(1);
|
||||
}
|
||||
|
||||
|
||||
void RDMarkerDialog::timeInData()
|
||||
{
|
||||
int sf=d_marker_view->shrinkFactor();
|
||||
if(sf>1) {
|
||||
d_marker_view->setShrinkFactor(sf/2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void RDMarkerDialog::timeOutData()
|
||||
{
|
||||
d_marker_view->setShrinkFactor(2*d_marker_view->shrinkFactor());
|
||||
}
|
||||
|
||||
|
||||
void RDMarkerDialog::okData()
|
||||
{
|
||||
done(true);
|
||||
}
|
||||
|
||||
|
||||
void RDMarkerDialog::cancelData()
|
||||
{
|
||||
done(false);
|
||||
}
|
||||
|
||||
|
||||
void RDMarkerDialog::closeEvent(QCloseEvent *e)
|
||||
{
|
||||
cancelData();
|
||||
}
|
||||
|
||||
|
||||
void RDMarkerDialog::resizeEvent(QResizeEvent *e)
|
||||
{
|
||||
int w=size().width();
|
||||
int h=size().height();
|
||||
|
||||
d_marker_view->setGeometry(2,2,w-104,d_marker_view->sizeHint().height());
|
||||
|
||||
d_amplitude_box->setGeometry(w-100,2,90,130);
|
||||
d_amplitude_up_button->setGeometry(5,24,80,50);
|
||||
d_amplitude_down_button->setGeometry(5,74,80,50);
|
||||
|
||||
d_time_box->setGeometry(w-100,142,90,230);
|
||||
d_time_fullin_button->setGeometry(5,24,80,50);
|
||||
d_time_in_button->setGeometry(5,74,80,50);
|
||||
d_time_out_button->setGeometry(5,124,80,50);
|
||||
d_time_fullout_button->setGeometry(5,174,80,50);
|
||||
|
||||
|
||||
d_ok_button->setGeometry(w-180,h-60,80,50);
|
||||
d_cancel_button->setGeometry(w-90,h-60,80,50);
|
||||
}
|
99
lib/rdmarkerdialog.h
Normal file
99
lib/rdmarkerdialog.h
Normal file
@ -0,0 +1,99 @@
|
||||
// rdmarkerdialog.h
|
||||
//
|
||||
// Rivendell Audio Marker Editor
|
||||
//
|
||||
// (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 RDMARKERDIALOG_H
|
||||
#define RDMARKERDIALOG_H
|
||||
|
||||
#include <QGroupBox>
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
|
||||
#include <rddialog.h>
|
||||
#include <rdmarkerview.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
|
||||
|
||||
//
|
||||
// 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()
|
||||
*/
|
||||
class RDMarkerDialog : public RDDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
RDMarkerDialog(const QString &caption,QWidget *parent=0);
|
||||
~RDMarkerDialog();
|
||||
QSize sizeHint() const;
|
||||
|
||||
public slots:
|
||||
int exec(unsigned cartnum,int cutnum);
|
||||
|
||||
private slots:
|
||||
void amplitudeUpData();
|
||||
void amplitudeDownData();
|
||||
void timeFullInData();
|
||||
void timeInData();
|
||||
void timeOutData();
|
||||
void okData();
|
||||
void cancelData();
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *e);
|
||||
void resizeEvent(QResizeEvent *e);
|
||||
|
||||
private:
|
||||
RDMarkerView *d_marker_view;
|
||||
|
||||
QGroupBox *d_amplitude_box;
|
||||
RDTransportButton *d_amplitude_up_button;
|
||||
RDTransportButton *d_amplitude_down_button;
|
||||
|
||||
QGroupBox *d_time_box;
|
||||
QPushButton *d_time_fullin_button;
|
||||
RDTransportButton *d_time_in_button;
|
||||
RDTransportButton *d_time_out_button;
|
||||
QPushButton *d_time_fullout_button;
|
||||
|
||||
QPushButton *d_ok_button;
|
||||
QPushButton *d_cancel_button;
|
||||
unsigned d_cart_number;
|
||||
int d_cut_number;
|
||||
QString d_caption;
|
||||
};
|
||||
|
||||
|
||||
#endif // RDMARKERDIALOG_H
|
160
lib/rdmarkerview.cpp
Normal file
160
lib/rdmarkerview.cpp
Normal file
@ -0,0 +1,160 @@
|
||||
// rdmarkerview.cpp
|
||||
//
|
||||
// Widget for displaying/editing cut markers
|
||||
//
|
||||
// (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 "rdmarkerview.h"
|
||||
|
||||
RDMarkerView::RDMarkerView(int width,int height,QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
d_width=width;
|
||||
d_height=height;
|
||||
d_cut=NULL;
|
||||
d_scene=NULL;
|
||||
clear();
|
||||
|
||||
d_view=new QGraphicsView(this);
|
||||
|
||||
d_wave_factory=new RDWaveFactory(RDWaveFactory::MultiTrack);
|
||||
}
|
||||
|
||||
|
||||
RDMarkerView::~RDMarkerView()
|
||||
{
|
||||
if(d_cut!=NULL) {
|
||||
delete d_cut;
|
||||
}
|
||||
if(d_scene!=NULL) {
|
||||
delete d_scene;
|
||||
}
|
||||
delete d_wave_factory;
|
||||
delete d_view;
|
||||
}
|
||||
|
||||
|
||||
QSize RDMarkerView::sizeHint() const
|
||||
{
|
||||
return QSize(1000,d_height);
|
||||
}
|
||||
|
||||
|
||||
QSizePolicy RDMarkerView::sizePolicy() const
|
||||
{
|
||||
return QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Fixed);
|
||||
}
|
||||
|
||||
|
||||
int RDMarkerView::audioGain() const
|
||||
{
|
||||
return d_audio_gain;
|
||||
}
|
||||
|
||||
|
||||
int RDMarkerView::shrinkFactor() const
|
||||
{
|
||||
return d_shrink_factor;
|
||||
}
|
||||
|
||||
|
||||
void RDMarkerView::setAudioGain(int lvl)
|
||||
{
|
||||
if(d_audio_gain!=lvl) {
|
||||
d_audio_gain=lvl;
|
||||
WriteWave();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void RDMarkerView::setShrinkFactor(int sf)
|
||||
{
|
||||
if((d_shrink_factor!=sf)&&(sf<=d_max_shrink_factor)) {
|
||||
d_shrink_factor=sf;
|
||||
WriteWave();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void RDMarkerView::setMaximumShrinkFactor()
|
||||
{
|
||||
setShrinkFactor(d_max_shrink_factor);
|
||||
}
|
||||
|
||||
|
||||
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()) {
|
||||
*err_msg=tr("No such cart/cut!");
|
||||
return false;
|
||||
}
|
||||
if(!d_wave_factory->setCut(err_msg,cartnum,cutnum)) {
|
||||
return false;
|
||||
}
|
||||
d_max_shrink_factor=1;
|
||||
while(d_wave_factory->energySize()>=(d_width*d_max_shrink_factor)) {
|
||||
d_max_shrink_factor=d_max_shrink_factor*2;
|
||||
}
|
||||
d_pad_size=(d_width*d_max_shrink_factor-d_wave_factory->energySize())/d_max_shrink_factor-1;
|
||||
d_shrink_factor=d_max_shrink_factor;
|
||||
WriteWave();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void RDMarkerView::clear()
|
||||
{
|
||||
if(d_cut!=NULL) {
|
||||
delete d_cut;
|
||||
d_cut=NULL;
|
||||
}
|
||||
if(d_scene!=NULL) {
|
||||
delete d_scene;
|
||||
d_scene=NULL;
|
||||
}
|
||||
d_shrink_factor=1;
|
||||
d_max_shrink_factor=1;
|
||||
d_pad_size=0;
|
||||
d_audio_gain=900;
|
||||
}
|
||||
|
||||
|
||||
void RDMarkerView::resizeEvent(QResizeEvent *e)
|
||||
{
|
||||
d_view->setGeometry(0,0,size().width(),size().height());
|
||||
}
|
||||
|
||||
|
||||
void RDMarkerView::WriteWave()
|
||||
{
|
||||
QPixmap wavemap=
|
||||
d_wave_factory->generate(d_height-20,d_shrink_factor,d_audio_gain,true);
|
||||
|
||||
if(d_scene!=NULL) {
|
||||
d_scene->deleteLater();
|
||||
}
|
||||
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_view->setScene(d_scene);
|
||||
}
|
67
lib/rdmarkerview.h
Normal file
67
lib/rdmarkerview.h
Normal file
@ -0,0 +1,67 @@
|
||||
// rdmarkerview.h
|
||||
//
|
||||
// Widget for displaying/editing cut markers
|
||||
//
|
||||
// (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 RDMARKERVIEW_H
|
||||
#define RDMARKERVIEW_H
|
||||
|
||||
#include <QGraphicsScene>
|
||||
#include <QGraphicsView>
|
||||
#include <QList>
|
||||
|
||||
#include <rdcut.h>
|
||||
#include <rdwavefactory.h>
|
||||
|
||||
class RDMarkerView : public QWidget
|
||||
{
|
||||
Q_OBJECT;
|
||||
public:
|
||||
RDMarkerView(int width,int height,QWidget *parent=0);
|
||||
~RDMarkerView();
|
||||
QSize sizeHint() const;
|
||||
QSizePolicy sizePolicy() const;
|
||||
int audioGain() const;
|
||||
int shrinkFactor() const;
|
||||
|
||||
public slots:
|
||||
void setAudioGain(int lvl);
|
||||
void setShrinkFactor(int sf);
|
||||
void setMaximumShrinkFactor();
|
||||
bool setCut(QString *err_msg,unsigned cartnum,int cutnum);
|
||||
void clear();
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *e);
|
||||
|
||||
private:
|
||||
void WriteWave();
|
||||
QGraphicsView *d_view;
|
||||
QGraphicsScene *d_scene;
|
||||
RDCut *d_cut;
|
||||
int d_width;
|
||||
int d_height;
|
||||
int d_shrink_factor;
|
||||
int d_max_shrink_factor;
|
||||
int d_pad_size;
|
||||
int d_audio_gain;
|
||||
RDWaveFactory *d_wave_factory;
|
||||
};
|
||||
|
||||
|
||||
#endif // RDMARKERVIEW_H
|
@ -22,6 +22,7 @@
|
||||
#include <QPainter>
|
||||
|
||||
#include "rdapplication.h"
|
||||
#include "rdconf.h"
|
||||
#include "rdcut.h"
|
||||
#include "rdpeaksexport.h"
|
||||
#include "rdwavefactory.h"
|
||||
@ -31,6 +32,14 @@ RDWaveFactory::RDWaveFactory(RDWaveFactory::TrackMode mode)
|
||||
d_track_mode=mode;
|
||||
d_cart_number=0;
|
||||
d_cut_number=-1;
|
||||
|
||||
d_font_engine=new RDFontEngine();
|
||||
}
|
||||
|
||||
|
||||
RDWaveFactory::~RDWaveFactory()
|
||||
{
|
||||
delete d_font_engine;
|
||||
}
|
||||
|
||||
|
||||
@ -52,12 +61,31 @@ int RDWaveFactory::cutNumber() const
|
||||
}
|
||||
|
||||
|
||||
QPixmap RDWaveFactory::generate(int height,int x_shrink,int gain)
|
||||
QPixmap RDWaveFactory::generate(int height,int x_shrink,int gain,
|
||||
bool incl_scale)
|
||||
{
|
||||
QPixmap pix(d_energy.size()/(x_shrink*d_energy_channels),height);
|
||||
pix.fill(Qt::white); // FIXME: make the background transparent
|
||||
QPainter *p=new QPainter(&pix);
|
||||
p->setPen(Qt::black);
|
||||
p->setFont(d_font_engine->defaultFont());
|
||||
|
||||
//
|
||||
// Time Scale
|
||||
//
|
||||
if(incl_scale) {
|
||||
int interval=2*rda->system()->sampleRate()/1152;
|
||||
int msec=2000;
|
||||
for(int i=interval;i<(d_energy.size()/x_shrink);i+=interval) {
|
||||
p->setPen(Qt::green);
|
||||
p->drawLine(i,0,i,height);
|
||||
p->setPen(Qt::red);
|
||||
for(int j=0;j<d_energy_channels;j++) {
|
||||
p->drawText(i+5,(j+1)*height/d_energy_channels-2,
|
||||
RDGetTimeLength(msec*x_shrink,false,false));
|
||||
}
|
||||
msec+=2000;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Gain Ratio
|
||||
@ -67,8 +95,22 @@ QPixmap RDWaveFactory::generate(int height,int x_shrink,int gain)
|
||||
//
|
||||
// Waveform
|
||||
//
|
||||
p->setPen(Qt::black);
|
||||
int ref_line=exp10((double)(-REFERENCE_LEVEL)/2000.00)*height*ratio/
|
||||
((double)d_energy_channels*2.0);
|
||||
int clip_line=height/(2*d_energy_channels);
|
||||
for(unsigned i=0;i<d_energy_channels;i++) {
|
||||
int zero_line=height/(d_energy_channels*2)+i*height/(d_energy_channels);
|
||||
if(incl_scale) {
|
||||
if(ref_line<clip_line) {
|
||||
p->setPen(Qt::red);
|
||||
p->drawLine(0,zero_line+ref_line,
|
||||
d_energy.size()/x_shrink,zero_line+ref_line);
|
||||
p->drawLine(0,zero_line-ref_line,
|
||||
d_energy.size()/x_shrink,zero_line-ref_line);
|
||||
p->setPen(Qt::black);
|
||||
}
|
||||
}
|
||||
p->drawLine(0,zero_line,d_energy.size()/x_shrink,zero_line);
|
||||
for(int j=i;j<d_energy.size();j+=(d_energy_channels*x_shrink)) {
|
||||
uint16_t lvl=d_energy.at(j);
|
||||
@ -79,9 +121,12 @@ QPixmap RDWaveFactory::generate(int height,int x_shrink,int gain)
|
||||
}
|
||||
int rlvl=(int)(ratio*(double)lvl*(double)height/
|
||||
(65534.0*(double)d_energy_channels));
|
||||
if(rlvl>clip_line) {
|
||||
rlvl=clip_line;
|
||||
}
|
||||
// Bottom half
|
||||
p->fillRect(j/(x_shrink*d_energy_channels),zero_line,1,rlvl,Qt::black);
|
||||
|
||||
|
||||
// Top half
|
||||
p->fillRect(j/(x_shrink*d_energy_channels),zero_line,1,-rlvl,Qt::black);
|
||||
}
|
||||
@ -156,3 +201,16 @@ bool RDWaveFactory::setCut(QString *err_msg,unsigned cartnum,int cutnum)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
int RDWaveFactory::energySize() const
|
||||
{
|
||||
return d_energy.size()/d_energy_channels;
|
||||
}
|
||||
|
||||
|
||||
int RDWaveFactory::referenceHeight(int height,int gain)
|
||||
{
|
||||
return (int)((double)height*32767.0*
|
||||
exp10((double)(gain-REFERENCE_LEVEL)/2000.0));
|
||||
}
|
||||
|
@ -24,16 +24,21 @@
|
||||
#include <QList>
|
||||
#include <QPixmap>
|
||||
|
||||
#include <rdfontengine.h>
|
||||
|
||||
class RDWaveFactory
|
||||
{
|
||||
public:
|
||||
enum TrackMode {SingleTrack=0,MultiTrack=1};
|
||||
RDWaveFactory(TrackMode mode);
|
||||
~RDWaveFactory();
|
||||
TrackMode trackMode() const;
|
||||
unsigned cartNumber() const;
|
||||
int cutNumber() const;
|
||||
QPixmap generate(int height,int x_shrink,int gain);
|
||||
QPixmap generate(int height,int x_shrink,int gain,bool incl_scale);
|
||||
bool setCut(QString *err_msg,unsigned cartnum,int cutnum);
|
||||
int energySize() const;
|
||||
static int referenceHeight(int height,int gain);
|
||||
|
||||
private:
|
||||
TrackMode d_track_mode;
|
||||
@ -42,6 +47,7 @@ class RDWaveFactory
|
||||
QList<uint16_t> d_energy;
|
||||
unsigned d_channels;
|
||||
unsigned d_energy_channels;
|
||||
RDFontEngine *d_font_engine;
|
||||
};
|
||||
|
||||
|
||||
|
@ -46,9 +46,12 @@ AudioCart::AudioCart(AudioControls *controls,RDCart *cart,QString *path,
|
||||
rdcart_profile_rip=profile_rip;
|
||||
rdcart_modification_allowed=rda->user()->editAudio()&&cart->owner().isEmpty();
|
||||
|
||||
|
||||
rdcart_use_weighting=true;
|
||||
|
||||
//
|
||||
// Dialogs
|
||||
//
|
||||
rdcart_marker_dialog=new RDMarkerDialog("RDLibrary",this);
|
||||
|
||||
QColor system_button_text_color = palette().buttonText().color();
|
||||
|
||||
@ -183,6 +186,12 @@ AudioCart::AudioCart(AudioControls *controls,RDCart *cart,QString *path,
|
||||
}
|
||||
|
||||
|
||||
AudioCart::~AudioCart()
|
||||
{
|
||||
delete rdcart_marker_dialog;
|
||||
}
|
||||
|
||||
|
||||
QSize AudioCart::sizeHint() const
|
||||
{
|
||||
return QSize(640,290);
|
||||
@ -416,6 +425,29 @@ void AudioCart::extEditorCutData()
|
||||
}
|
||||
|
||||
|
||||
void AudioCart::editCutData()
|
||||
{
|
||||
QModelIndex row=SingleSelectedLine();
|
||||
|
||||
if(!row.isValid()) {
|
||||
return;
|
||||
}
|
||||
QString cutname=rdcart_cut_model->cutName(row);
|
||||
if(!RDAudioExists(cutname)) {
|
||||
QMessageBox::information(this,"RDLibrary",
|
||||
tr("No audio is present in the cut!"));
|
||||
return;
|
||||
}
|
||||
if(rdcart_marker_dialog->exec(RDCut::cartNumber(cutname),RDCut::cutNumber(cutname))) {
|
||||
emit cartDataChanged();
|
||||
rdcart_cart->updateLength(rdcart_controls->enforce_length_box->isChecked(),
|
||||
QTime().msecsTo(rdcart_controls->
|
||||
forced_length_edit->time()));
|
||||
rdcart_cut_model->refresh(row);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
void AudioCart::editCutData()
|
||||
{
|
||||
QModelIndex row=SingleSelectedLine();
|
||||
@ -443,7 +475,7 @@ void AudioCart::editCutData()
|
||||
}
|
||||
delete edit;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
void AudioCart::recordCutData()
|
||||
{
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
#include <rdcart.h>
|
||||
#include <rdcutlistmodel.h>
|
||||
#include <rdmarkerdialog.h>
|
||||
#include <rdtableview.h>
|
||||
#include <rdwidget.h>
|
||||
|
||||
@ -37,6 +38,7 @@ class AudioCart : public RDWidget
|
||||
public:
|
||||
AudioCart(AudioControls *controls,RDCart *cart,QString *path,bool select_cut,
|
||||
bool profile_rip,QWidget *parent=0);
|
||||
~AudioCart();
|
||||
QSize sizeHint() const;
|
||||
QSizePolicy sizePolicy() const;
|
||||
RDCutListModel *cutListModel();
|
||||
@ -79,6 +81,8 @@ class AudioCart : public RDWidget
|
||||
bool rdcart_import_metadata;
|
||||
bool rdcart_profile_rip;
|
||||
bool rdcart_use_weighting;
|
||||
|
||||
RDMarkerDialog *rdcart_marker_dialog;
|
||||
};
|
||||
|
||||
|
||||
|
@ -37,6 +37,7 @@ MainWidget::MainWidget(QWidget *parent)
|
||||
d_cut_number=-1;
|
||||
d_scene=NULL;
|
||||
bool track_mode_set=false;
|
||||
d_show_scale=false;
|
||||
|
||||
//
|
||||
// Open the database
|
||||
@ -69,6 +70,10 @@ MainWidget::MainWidget(QWidget *parent)
|
||||
}
|
||||
rda->cmdSwitch()->setProcessed(i,true);
|
||||
}
|
||||
if(rda->cmdSwitch()->key(i)=="--show-scale") {
|
||||
d_show_scale=true;
|
||||
rda->cmdSwitch()->setProcessed(i,true);
|
||||
}
|
||||
if(rda->cmdSwitch()->key(i)=="--track-mode") {
|
||||
if(rda->cmdSwitch()->value(i)=="single") {
|
||||
d_track_mode=RDWaveFactory::SingleTrack;
|
||||
@ -219,7 +224,7 @@ void MainWidget::resizeEvent(QResizeEvent *e)
|
||||
void MainWidget::UpdateWave()
|
||||
{
|
||||
QPixmap pix=d_factory->generate(200,d_shrink_factor_edit->text().toInt(),
|
||||
100*d_audio_gain_spin->value());
|
||||
100*d_audio_gain_spin->value(),d_show_scale);
|
||||
|
||||
if(d_scene!=NULL) {
|
||||
d_scene->deleteLater();
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include <rdtransportbutton.h>
|
||||
#include <rdwavefactory.h>
|
||||
|
||||
#define WAVEFACTORY_TEST_USAGE "--cart-number=<cartnum> --cut-number=<cutnum> --track-mode=single|multi\n"
|
||||
#define WAVEFACTORY_TEST_USAGE "--cart-number=<cartnum> --cut-number=<cutnum> --track-mode=single|multi [--show-scale]\n"
|
||||
|
||||
class MainWidget : public QWidget
|
||||
{
|
||||
@ -58,6 +58,7 @@ class MainWidget : public QWidget
|
||||
unsigned d_cart_number;
|
||||
int d_cut_number;
|
||||
RDWaveFactory::TrackMode d_track_mode;
|
||||
bool d_show_scale;
|
||||
RDFontEngine *d_font_engine;
|
||||
RDTransportButton *d_up_button;
|
||||
RDTransportButton *d_down_button;
|
||||
|
Loading…
x
Reference in New Issue
Block a user