mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-06-07 15:42:34 +02:00
commit
48bbe8ee67
12
ChangeLog
12
ChangeLog
@ -17643,6 +17643,7 @@
|
||||
* Corrected an omission in the documentation of the
|
||||
'Start Button' ['PB'] RML.
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
2018-10-01 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Applied a PR from Patrick Linstruth <patrick@deltecent.com> that
|
||||
fixed a regression where the 'Stop' button would fail to function
|
||||
@ -17811,3 +17812,14 @@
|
||||
* Disabled the 'More than half the audio will be faded...' warning
|
||||
in the 'Edit Audio' dialog in rdlibrary(1) if the 'No Fade on
|
||||
Segue Out' checkbox is ticked.
|
||||
2018-10-17 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Fixed a bug in rivwebcapi's 'RD_ListCartCuts()' and
|
||||
'RD_ListCartsCuts()' functions that threw a segfault if the WebAPI
|
||||
returned an error response.
|
||||
2018-10-17 Patrick Linstruth <patrick@deltecent.com>
|
||||
* Modified rddbconfig(8) to query the user before modifying the
|
||||
DB to the current schema after a DB restore.
|
||||
2018-10-17 Patrick Linstruth <patrick@deltecent.com>
|
||||
* Added talk (intro) column to cart list view in rdlibrary(1)
|
||||
* Added ability to expand cart to view individual cuts in rdlibrary(1)
|
||||
* Added play/stop buttons to cart list in rdlibrary(1)
|
||||
|
@ -357,6 +357,7 @@ int RD_ListCartCuts(struct rd_cart *carts[],
|
||||
* Setup the CURL call
|
||||
*/
|
||||
memset(&xml_data,0,sizeof(xml_data));
|
||||
xml_data.cut_ptr=-1;
|
||||
parser=XML_ParserCreate(NULL);
|
||||
XML_SetUserData(parser,&xml_data);
|
||||
XML_SetElementHandler(parser,__ListCartCutsElementStart,
|
||||
|
@ -362,6 +362,7 @@ int RD_ListCartsCuts(struct rd_cart *carts[],
|
||||
*/
|
||||
memset(&xml_data,0,sizeof(xml_data));
|
||||
xml_data.cart_ptr=-1;
|
||||
xml_data.cut_ptr=-1;
|
||||
parser=XML_ParserCreate(NULL);
|
||||
XML_SetUserData(parser,&xml_data);
|
||||
XML_SetElementHandler(parser,__ListCartsCutsElementStart,
|
||||
|
@ -39,6 +39,20 @@ RDListViewItem::RDListViewItem(Q3ListView *parent)
|
||||
}
|
||||
}
|
||||
|
||||
RDListViewItem::RDListViewItem(RDListViewItem *parent)
|
||||
: Q3ListViewItem((Q3ListViewItem *)parent)
|
||||
{
|
||||
item_line=-1;
|
||||
item_id=-1;
|
||||
list_parent=(RDListView *)listView();
|
||||
item_background_color=
|
||||
list_parent->palette().color(QPalette::Active,QColorGroup::Base);
|
||||
for(int i=0;i<list_parent->columns();i++) {
|
||||
item_text_color.
|
||||
push_back(list_parent->palette().color(QPalette::Active,QColorGroup::Text));
|
||||
item_text_weight.push_back(list_parent->font().weight());
|
||||
}
|
||||
}
|
||||
|
||||
int RDListViewItem::line() const
|
||||
{
|
||||
|
@ -32,6 +32,7 @@ class RDListViewItem : public Q3ListViewItem
|
||||
{
|
||||
public:
|
||||
RDListViewItem(Q3ListView *parent);
|
||||
RDListViewItem(RDListViewItem *parent);
|
||||
int line() const;
|
||||
void setLine(int line);
|
||||
int id() const;
|
||||
|
@ -36,6 +36,7 @@ RDSimplePlayer::RDSimplePlayer(RDCae *cae,RDRipc *ripc,int card,int port,
|
||||
play_end_cart=end_cart;
|
||||
play_stream=-1;
|
||||
play_cart=0;
|
||||
play_cut="";
|
||||
play_is_playing=false;
|
||||
|
||||
//
|
||||
@ -74,12 +75,37 @@ RDSimplePlayer::~RDSimplePlayer()
|
||||
}
|
||||
|
||||
|
||||
bool RDSimplePlayer::isPlaying()
|
||||
{
|
||||
return play_is_playing;
|
||||
}
|
||||
|
||||
|
||||
void RDSimplePlayer::setCart(unsigned cart)
|
||||
{
|
||||
play_cart=cart;
|
||||
}
|
||||
|
||||
|
||||
void RDSimplePlayer::setCart(QString cart)
|
||||
{
|
||||
QStringList cartcut=cart.split("_");
|
||||
play_cart=cartcut[0].toUInt();
|
||||
if(cartcut.size()>1) {
|
||||
setCut(cart);
|
||||
}
|
||||
else {
|
||||
play_cut="";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void RDSimplePlayer::setCut(QString cut)
|
||||
{
|
||||
play_cut=cut;
|
||||
}
|
||||
|
||||
|
||||
RDTransportButton *RDSimplePlayer::playButton() const
|
||||
{
|
||||
return play_start_button;
|
||||
@ -112,14 +138,14 @@ void RDSimplePlayer::play(int start_pos)
|
||||
stop();
|
||||
}
|
||||
|
||||
QString cut = "";
|
||||
if(play_cut.isEmpty()) {
|
||||
RDCart *cart=new RDCart(play_cart);
|
||||
if(cart->selectCut(&cut)) {
|
||||
if(cut.isEmpty()) {
|
||||
return;
|
||||
cart->selectCut(&play_cut);
|
||||
delete cart;
|
||||
}
|
||||
if(!play_cut.isEmpty()) {
|
||||
play_cae->
|
||||
loadPlay(play_card,cut,&play_stream,&handle);
|
||||
loadPlay(play_card,play_cut,&play_stream,&handle);
|
||||
|
||||
if(play_stream<0) {
|
||||
return;
|
||||
@ -130,7 +156,7 @@ void RDSimplePlayer::play(int start_pos)
|
||||
"END_POINT,"+ // 01
|
||||
"PLAY_GAIN "+ // 02
|
||||
"from CUTS where "+
|
||||
"CUT_NAME=\""+RDEscapeString(cut)+"\"";
|
||||
"CUT_NAME=\""+RDEscapeString(play_cut)+"\"";
|
||||
q=new RDSqlQuery(sql);
|
||||
if(q->first()) {
|
||||
play_cut_gain=q->value(2).toInt();
|
||||
@ -147,7 +173,6 @@ void RDSimplePlayer::play(int start_pos)
|
||||
}
|
||||
delete q;
|
||||
}
|
||||
delete cart;
|
||||
}
|
||||
|
||||
|
||||
|
@ -38,6 +38,9 @@ class RDSimplePlayer : public QWidget
|
||||
unsigned start_cart,unsigned end_cart,QWidget *parent=0);
|
||||
~RDSimplePlayer();
|
||||
void setCart(unsigned cart);
|
||||
void setCart(QString cart);
|
||||
void setCut(QString cart);
|
||||
bool isPlaying();
|
||||
RDTransportButton *playButton() const;
|
||||
RDTransportButton *stopButton() const;
|
||||
|
||||
@ -62,6 +65,7 @@ class RDSimplePlayer : public QWidget
|
||||
int play_port;
|
||||
std::queue<int> play_handles;
|
||||
unsigned play_cart;
|
||||
QString play_cut;
|
||||
unsigned play_start_cart;
|
||||
unsigned play_end_cart;
|
||||
bool play_is_playing;
|
||||
|
@ -47,6 +47,7 @@
|
||||
#include <rdaudioexport.h>
|
||||
#include <rdupload.h>
|
||||
|
||||
#include "rdlibrary.h"
|
||||
#include "cdripper.h"
|
||||
#include "edit_cart.h"
|
||||
#include "edit_notes.h"
|
||||
@ -937,9 +938,9 @@ void EditCart::okData()
|
||||
while(it->current()) {
|
||||
if(it->current()->isSelected()) {
|
||||
RDListViewItem *item=(RDListViewItem *)it->current();
|
||||
if(item->text(21).isEmpty()) {
|
||||
if(item->text(MainWidget::OwnedBy).isEmpty()) {
|
||||
|
||||
rdcart_cart_medit=new RDCart(item->text(1).toUInt());
|
||||
rdcart_cart_medit=new RDCart(item->text(MainWidget::Cart).toUInt());
|
||||
|
||||
if(!rdcart_group_box->currentText().stripWhiteSpace().isEmpty()) {
|
||||
rdcart_cart_medit->setGroupName(rdcart_group_box->currentText());
|
||||
|
@ -20,7 +20,7 @@
|
||||
//
|
||||
|
||||
#include <rdcartdrag.h>
|
||||
|
||||
#include <rdlibrary.h>
|
||||
#include <rdlistviewitem.h>
|
||||
|
||||
#include "globals.h"
|
||||
@ -50,10 +50,10 @@ void LibListView::contentsMouseMoveEvent(QMouseEvent *e)
|
||||
if(item==NULL) {
|
||||
return;
|
||||
}
|
||||
if(item->text(21).isEmpty()) { // Voice tracks cannot be dragged
|
||||
if(item->text(MainWidget::OwnedBy).isEmpty()&&!item->parent()) { // Voice tracks and cuts cannot be dragged
|
||||
RDCartDrag *d=
|
||||
new RDCartDrag(item->text(1).toUInt(),item->text(4),item->textColor(2),
|
||||
this);
|
||||
new RDCartDrag(item->text(MainWidget::Cart).left(6).toUInt(),item->text(MainWidget::Title),
|
||||
item->textColor(MainWidget::Group), this);
|
||||
d->dragCopy();
|
||||
emit clicked(item);
|
||||
}
|
||||
|
@ -321,80 +321,85 @@ MainWidget::MainWidget(QWidget *parent)
|
||||
lib_cart_list->setAllColumnsShowFocus(true);
|
||||
lib_cart_list->setItemMargin(5);
|
||||
lib_cart_list->setSelectionMode(Q3ListView::Extended);
|
||||
lib_cart_list->setRootIsDecorated(true);
|
||||
// lib_cart_tip=new CartTip(lib_cart_list->viewport());
|
||||
connect(lib_cart_list,
|
||||
SIGNAL(doubleClicked(Q3ListViewItem *,const QPoint &,int)),
|
||||
this,
|
||||
SLOT(cartDoubleclickedData(Q3ListViewItem *,const QPoint &,int)));
|
||||
connect(lib_cart_list,SIGNAL(pressed(Q3ListViewItem *)),
|
||||
this,SLOT(cartClickedData(Q3ListViewItem *)));
|
||||
connect(lib_cart_list,SIGNAL(selectionChanged()),
|
||||
this,SLOT(cartClickedData()));
|
||||
connect(lib_cart_list,SIGNAL(onItem(Q3ListViewItem *)),
|
||||
this,SLOT(cartOnItemData(Q3ListViewItem *)));
|
||||
lib_cart_list->addColumn("");
|
||||
lib_cart_list->setColumnAlignment(0,Qt::AlignHCenter);
|
||||
lib_cart_list->setColumnAlignment(Icon,Qt::AlignHCenter);
|
||||
lib_cart_list->addColumn(tr("Cart"));
|
||||
lib_cart_list->setColumnAlignment(1,Qt::AlignHCenter);
|
||||
lib_cart_list->setColumnAlignment(Cart,Qt::AlignLeft);
|
||||
|
||||
lib_cart_list->addColumn(tr("Group"));
|
||||
lib_cart_list->setColumnAlignment(2,Qt::AlignHCenter);
|
||||
lib_cart_list->setColumnAlignment(Group,Qt::AlignHCenter);
|
||||
|
||||
lib_cart_list->addColumn(tr("Length"));
|
||||
lib_cart_list->setColumnAlignment(3,Qt::AlignRight);
|
||||
lib_cart_list->setColumnSortType(3,RDListView::TimeSort);
|
||||
lib_cart_list->setColumnAlignment(Length,Qt::AlignRight);
|
||||
lib_cart_list->setColumnSortType(Length,RDListView::TimeSort);
|
||||
|
||||
lib_cart_list->addColumn(tr("Talk"));
|
||||
lib_cart_list->setColumnAlignment(Talk,Qt::AlignRight);
|
||||
lib_cart_list->setColumnSortType(Length,RDListView::TimeSort);
|
||||
|
||||
lib_cart_list->addColumn(tr("Title"));
|
||||
lib_cart_list->setColumnAlignment(4,Qt::AlignLeft);
|
||||
lib_cart_list->setColumnAlignment(Title,Qt::AlignLeft);
|
||||
|
||||
lib_cart_list->addColumn(tr("Artist"));
|
||||
lib_cart_list->setColumnAlignment(5,Qt::AlignLeft);
|
||||
lib_cart_list->setColumnAlignment(Artist,Qt::AlignLeft);
|
||||
|
||||
lib_cart_list->addColumn(tr("Start"));
|
||||
lib_cart_list->setColumnAlignment(6,Qt::AlignHCenter);
|
||||
lib_cart_list->setColumnAlignment(Start,Qt::AlignHCenter);
|
||||
|
||||
lib_cart_list->addColumn(tr("End"));
|
||||
lib_cart_list->setColumnAlignment(7,Qt::AlignHCenter);
|
||||
lib_cart_list->setColumnAlignment(End,Qt::AlignHCenter);
|
||||
|
||||
lib_cart_list->addColumn(tr("Album"));
|
||||
lib_cart_list->setColumnAlignment(8,Qt::AlignLeft);
|
||||
lib_cart_list->setColumnAlignment(Album,Qt::AlignLeft);
|
||||
|
||||
lib_cart_list->addColumn(tr("Label"));
|
||||
lib_cart_list->setColumnAlignment(9,Qt::AlignLeft);
|
||||
lib_cart_list->setColumnAlignment(Label,Qt::AlignLeft);
|
||||
|
||||
lib_cart_list->addColumn(tr("Composer"));
|
||||
lib_cart_list->setColumnAlignment(10,Qt::AlignLeft);
|
||||
lib_cart_list->setColumnAlignment(Composer,Qt::AlignLeft);
|
||||
|
||||
lib_cart_list->addColumn(tr("Conductor"));
|
||||
lib_cart_list->setColumnAlignment(11,Qt::AlignLeft);
|
||||
lib_cart_list->setColumnAlignment(Conductor,Qt::AlignLeft);
|
||||
|
||||
lib_cart_list->addColumn(tr("Publisher"));
|
||||
lib_cart_list->setColumnAlignment(12,Qt::AlignLeft);
|
||||
lib_cart_list->setColumnAlignment(Publisher,Qt::AlignLeft);
|
||||
|
||||
lib_cart_list->addColumn(tr("Client"));
|
||||
lib_cart_list->setColumnAlignment(13,Qt::AlignLeft);
|
||||
lib_cart_list->setColumnAlignment(Client,Qt::AlignLeft);
|
||||
|
||||
lib_cart_list->addColumn(tr("Agency"));
|
||||
lib_cart_list->setColumnAlignment(14,Qt::AlignLeft);
|
||||
lib_cart_list->setColumnAlignment(Agency,Qt::AlignLeft);
|
||||
|
||||
lib_cart_list->addColumn(tr("User Defined"));
|
||||
lib_cart_list->setColumnAlignment(15,Qt::AlignLeft);
|
||||
lib_cart_list->setColumnAlignment(UserDefined,Qt::AlignLeft);
|
||||
|
||||
lib_cart_list->addColumn(tr("Cuts"));
|
||||
lib_cart_list->setColumnAlignment(16,Qt::AlignRight);
|
||||
lib_cart_list->setColumnAlignment(Cuts,Qt::AlignRight);
|
||||
|
||||
lib_cart_list->addColumn(tr("Last Cut Played"));
|
||||
lib_cart_list->setColumnAlignment(17,Qt::AlignHCenter);
|
||||
lib_cart_list->setColumnAlignment(LastCutPlayed,Qt::AlignHCenter);
|
||||
|
||||
lib_cart_list->addColumn(tr("Enforce Length"));
|
||||
lib_cart_list->setColumnAlignment(18,Qt::AlignHCenter);
|
||||
lib_cart_list->setColumnAlignment(EnforceLength,Qt::AlignHCenter);
|
||||
|
||||
lib_cart_list->addColumn(tr("Preserve Pitch"));
|
||||
lib_cart_list->setColumnAlignment(19,Qt::AlignHCenter);
|
||||
lib_cart_list->setColumnAlignment(PreservePitch,Qt::AlignHCenter);
|
||||
|
||||
lib_cart_list->addColumn(tr("Length Deviation"));
|
||||
lib_cart_list->setColumnAlignment(20,Qt::AlignHCenter);
|
||||
lib_cart_list->setColumnAlignment(LengthDeviation,Qt::AlignHCenter);
|
||||
|
||||
lib_cart_list->addColumn(tr("Owned By"));
|
||||
lib_cart_list->setColumnAlignment(21,Qt::AlignHCenter);
|
||||
lib_cart_list->setColumnAlignment(OwnedBy,Qt::AlignHCenter);
|
||||
|
||||
//
|
||||
// Add Button
|
||||
@ -410,6 +415,7 @@ MainWidget::MainWidget(QWidget *parent)
|
||||
lib_edit_button=new QPushButton(this);
|
||||
lib_edit_button->setFont(button_font);
|
||||
lib_edit_button->setText(tr("&Edit"));
|
||||
lib_edit_button->setEnabled(false);
|
||||
connect(lib_edit_button,SIGNAL(clicked()),this,SLOT(editData()));
|
||||
|
||||
//
|
||||
@ -418,6 +424,7 @@ MainWidget::MainWidget(QWidget *parent)
|
||||
lib_delete_button=new QPushButton(this);
|
||||
lib_delete_button->setFont(button_font);
|
||||
lib_delete_button->setText(tr("&Delete"));
|
||||
lib_delete_button->setEnabled(false);
|
||||
connect(lib_delete_button,SIGNAL(clicked()),this,SLOT(deleteData()));
|
||||
|
||||
//
|
||||
@ -450,6 +457,25 @@ MainWidget::MainWidget(QWidget *parent)
|
||||
lib_close_button->setText(tr("&Close"));
|
||||
connect(lib_close_button,SIGNAL(clicked()),this,SLOT(quitMainWidget()));
|
||||
|
||||
|
||||
//
|
||||
// Load Output Assignment
|
||||
//
|
||||
lib_output_card=rda->libraryConf()->outputCard();
|
||||
lib_output_port=rda->libraryConf()->outputPort();
|
||||
|
||||
|
||||
//
|
||||
// Cart Player
|
||||
//
|
||||
lib_player=
|
||||
new RDSimplePlayer(rda->cae(),rda->ripc(),lib_output_card,lib_output_port,
|
||||
0,0,this);
|
||||
lib_player->playButton()->setEnabled(false);
|
||||
lib_player->stopButton()->setEnabled(false);
|
||||
lib_player->stopButton()->setOnColor(Qt::red);
|
||||
|
||||
|
||||
//
|
||||
// Setup Signal Handling
|
||||
//
|
||||
@ -531,8 +557,6 @@ void MainWidget::userData()
|
||||
}
|
||||
else {
|
||||
lib_add_button->setEnabled(rda->user()->createCarts());
|
||||
lib_edit_button->setEnabled(true);
|
||||
lib_delete_button->setEnabled(rda->user()->deleteCarts());
|
||||
lib_rip_button->setEnabled(rda->user()->editAudio());
|
||||
}
|
||||
|
||||
@ -596,6 +620,7 @@ void MainWidget::addData()
|
||||
RDCart::Type cart_type=RDCart::All;
|
||||
QString cart_title;
|
||||
|
||||
lib_player->stop();
|
||||
LockUser();
|
||||
|
||||
RDAddCart *add_cart=new RDAddCart(&lib_default_group,&cart_type,&cart_title,
|
||||
@ -622,7 +647,7 @@ void MainWidget::addData()
|
||||
}
|
||||
else {
|
||||
RDListViewItem *item=new RDListViewItem(lib_cart_list);
|
||||
item->setText(1,QString().sprintf("%06u",cart_num));
|
||||
item->setText(Cart,QString().sprintf("%06u",cart_num));
|
||||
RefreshLine(item);
|
||||
SendNotification(RDNotification::AddAction,cart_num);
|
||||
Q3ListViewItemIterator it(lib_cart_list);
|
||||
@ -645,11 +670,12 @@ void MainWidget::editData()
|
||||
int sel_count=0;
|
||||
Q3ListViewItemIterator *it;
|
||||
|
||||
lib_player->stop();
|
||||
LockUser();
|
||||
|
||||
it=new Q3ListViewItemIterator(lib_cart_list);
|
||||
while(it->current()) {
|
||||
if (it->current()->isSelected()) {
|
||||
if (it->current()->isSelected() && !it->current()->parent()) {
|
||||
sel_count++;
|
||||
}
|
||||
++(*it);
|
||||
@ -662,17 +688,17 @@ void MainWidget::editData()
|
||||
}
|
||||
if(sel_count==1) { //single edit
|
||||
it=new Q3ListViewItemIterator(lib_cart_list);
|
||||
while(!it->current()->isSelected()) {
|
||||
while(!it->current()->isSelected() || it->current()->parent()) {
|
||||
++(*it);
|
||||
}
|
||||
RDListViewItem *item=(RDListViewItem *)it->current();
|
||||
|
||||
EditCart *edit_cart=new EditCart(item->text(1).toUInt(),&lib_import_path,
|
||||
EditCart *edit_cart=new EditCart(item->text(Cart).toUInt(),&lib_import_path,
|
||||
false,profile_ripping,this);
|
||||
edit_cart->exec();
|
||||
RefreshLine(item);
|
||||
cartOnItemData(item);
|
||||
SendNotification(RDNotification::ModifyAction,item->text(1).toUInt());
|
||||
SendNotification(RDNotification::ModifyAction,item->text(Cart).toUInt());
|
||||
delete edit_cart;
|
||||
delete it;
|
||||
}
|
||||
@ -687,7 +713,7 @@ void MainWidget::editData()
|
||||
|
||||
it=new Q3ListViewItemIterator(lib_cart_list);
|
||||
while(it->current()) {
|
||||
if (it->current()->isSelected()) {
|
||||
if (it->current()->isSelected() && !it->current()->parent()) {
|
||||
RefreshLine((RDListViewItem *)it->current());
|
||||
SendNotification(RDNotification::ModifyAction,
|
||||
it->current()->text(1).toUInt());
|
||||
@ -711,11 +737,12 @@ void MainWidget::deleteData()
|
||||
Q3ListViewItemIterator *it;
|
||||
bool del_flag;
|
||||
|
||||
lib_player->stop();
|
||||
LockUser();
|
||||
|
||||
it=new Q3ListViewItemIterator(lib_cart_list);
|
||||
while(it->current()) {
|
||||
if (it->current()->isSelected()) {
|
||||
if (it->current()->isSelected() && !it->current()->parent()) {
|
||||
sel_count++;
|
||||
}
|
||||
++(*it);
|
||||
@ -735,16 +762,16 @@ void MainWidget::deleteData()
|
||||
}
|
||||
it=new Q3ListViewItemIterator(lib_cart_list);
|
||||
while(it->current()) {
|
||||
if (it->current()->isSelected()) {
|
||||
if (it->current()->isSelected() && !it->current()->parent()) {
|
||||
del_flag=true;
|
||||
RDListViewItem *item=(RDListViewItem *)it->current();
|
||||
sql=QString().sprintf("select CUT_NAME from RECORDINGS where \
|
||||
(CUT_NAME like \"%06u_%%\")||(MACRO_CART=%u)",
|
||||
item->text(1).toUInt(),item->text(1).toUInt());
|
||||
item->text(Cart).toUInt(),item->text(Cart).toUInt());
|
||||
q=new RDSqlQuery(sql);
|
||||
if(q->first()) {
|
||||
QString str=QString().sprintf(tr("Cart %06u is used in one or more RDCatch events!\n\
|
||||
Do you still want to delete it?"),item->text(1).toUInt());
|
||||
Do you still want to delete it?"),item->text(Cart).toUInt());
|
||||
if(QMessageBox::warning(this,tr("RDCatch Event Exists"),str,
|
||||
QMessageBox::Yes,QMessageBox::No)==QMessageBox::No) {
|
||||
del_flag=false;
|
||||
@ -752,9 +779,9 @@ Do you still want to delete it?"),item->text(1).toUInt());
|
||||
}
|
||||
delete q;
|
||||
if(cut_clipboard!=NULL) {
|
||||
if(item->text(1).toUInt()==cut_clipboard->cartNumber()) {
|
||||
if(item->text(Cart).toUInt()==cut_clipboard->cartNumber()) {
|
||||
QString str=QString().sprintf(tr("Deleting cart %06u will also empty the clipboard.\n\
|
||||
Do you still want to proceed?"),item->text(1).toUInt());
|
||||
Do you still want to proceed?"),item->text(Cart).toUInt());
|
||||
switch(QMessageBox::question(this,tr("Empty Clipboard"),str,
|
||||
QMessageBox::Yes,
|
||||
QMessageBox::No)) {
|
||||
@ -769,8 +796,8 @@ Do you still want to delete it?"),item->text(1).toUInt());
|
||||
cut_clipboard=NULL;
|
||||
}
|
||||
}
|
||||
if(del_flag && item->text(21).isEmpty()) {
|
||||
RDCart *rdcart=new RDCart(item->text(1).toUInt());
|
||||
if(del_flag && item->text(OwnedBy).isEmpty()) {
|
||||
RDCart *rdcart=new RDCart(item->text(Cart).toUInt());
|
||||
if(!rdcart->remove(rda->station(),rda->user(),rda->config())) {
|
||||
QMessageBox::warning(this,tr("RDLibrary"),tr("Unable to delete audio!"));
|
||||
return;
|
||||
@ -795,6 +822,7 @@ Do you still want to delete it?"),item->text(1).toUInt());
|
||||
|
||||
void MainWidget::ripData()
|
||||
{
|
||||
lib_player->stop();
|
||||
LockUser();
|
||||
QString group=lib_group_box->currentText();
|
||||
QString schedcode=lib_codes_box->currentText();
|
||||
@ -818,6 +846,7 @@ void MainWidget::ripData()
|
||||
|
||||
void MainWidget::reportsData()
|
||||
{
|
||||
lib_player->stop();
|
||||
LockUser();
|
||||
ListReports *lr=
|
||||
new ListReports(lib_filter_edit->text(),GetTypeFilter(),
|
||||
@ -835,21 +864,27 @@ void MainWidget::cartOnItemData(Q3ListViewItem *item)
|
||||
return;
|
||||
}
|
||||
// lib_cart_tip->
|
||||
// setCartNumber(lib_cart_list->itemRect(item),item->text(1).toUInt());
|
||||
// setCartNumber(lib_cart_list->itemRect(item),item->text(Cart).toUInt());
|
||||
}
|
||||
|
||||
|
||||
void MainWidget::cartClickedData(Q3ListViewItem *item)
|
||||
void MainWidget::cartClickedData()
|
||||
{
|
||||
int del_count=0;
|
||||
int sel_count=0;
|
||||
int play_count=0;
|
||||
Q3ListViewItemIterator *it;
|
||||
Q3ListViewItem *item;
|
||||
|
||||
it=new Q3ListViewItemIterator(lib_cart_list);
|
||||
while(it->current()) {
|
||||
if (it->current()->isSelected()) {
|
||||
play_count++;
|
||||
item=it->current();
|
||||
if(!it->current()->parent()) {
|
||||
sel_count++;
|
||||
if(it->current()->text(21).isEmpty()) {
|
||||
}
|
||||
if(it->current()->text(OwnedBy).isEmpty() && !it->current()->parent()) {
|
||||
del_count++;
|
||||
}
|
||||
}
|
||||
@ -863,7 +898,22 @@ void MainWidget::cartClickedData(Q3ListViewItem *item)
|
||||
else {
|
||||
lib_delete_button->setEnabled(false);
|
||||
}
|
||||
if(sel_count>1) {
|
||||
|
||||
if(play_count==1) {
|
||||
lib_player->setCart(item->text(Cart));
|
||||
lib_player->playButton()->setEnabled(true);
|
||||
lib_player->stopButton()->setEnabled(true);
|
||||
if(lib_player->isPlaying()) {
|
||||
lib_player->play();
|
||||
}
|
||||
}
|
||||
else {
|
||||
lib_player->stop();
|
||||
lib_player->playButton()->setEnabled(false);
|
||||
lib_player->stopButton()->setEnabled(false);
|
||||
}
|
||||
|
||||
if(sel_count) {
|
||||
if(del_count==0) {
|
||||
lib_edit_button->setEnabled(false);
|
||||
}
|
||||
@ -872,7 +922,7 @@ void MainWidget::cartClickedData(Q3ListViewItem *item)
|
||||
}
|
||||
}
|
||||
else {
|
||||
lib_edit_button->setEnabled(true);
|
||||
lib_edit_button->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -930,7 +980,7 @@ void MainWidget::notificationReceivedData(RDNotification *notify)
|
||||
q=new RDSqlQuery(sql);
|
||||
if(q->first()) {
|
||||
item=new RDListViewItem(lib_cart_list);
|
||||
item->setText(1,QString().sprintf("%06u",cartnum));
|
||||
item->setText(Cart,QString().sprintf("%06u",cartnum));
|
||||
RefreshLine(item);
|
||||
}
|
||||
delete q;
|
||||
@ -938,7 +988,7 @@ void MainWidget::notificationReceivedData(RDNotification *notify)
|
||||
|
||||
case RDNotification::ModifyAction:
|
||||
if((item=(RDListViewItem *)lib_cart_list->
|
||||
findItem(QString().sprintf("%06u",cartnum),1))!=NULL) {
|
||||
findItem(QString().sprintf("%06u",cartnum),Cart))!=NULL) {
|
||||
RefreshLine(item);
|
||||
}
|
||||
break;
|
||||
@ -948,7 +998,7 @@ void MainWidget::notificationReceivedData(RDNotification *notify)
|
||||
lib_deleted_carts.push_back(cartnum);
|
||||
}
|
||||
else {
|
||||
if((item=(RDListViewItem *)lib_cart_list->findItem(QString().sprintf("%06u",cartnum),1))!=NULL) {
|
||||
if((item=(RDListViewItem *)lib_cart_list->findItem(QString().sprintf("%06u",cartnum),Cart))!=NULL) {
|
||||
delete item;
|
||||
}
|
||||
}
|
||||
@ -1009,8 +1059,8 @@ void MainWidget::resizeEvent(QResizeEvent *e)
|
||||
lib_add_button->setGeometry(10,e->size().height()-60,80,50);
|
||||
lib_edit_button->setGeometry(100,e->size().height()-60,80,50);
|
||||
lib_delete_button->setGeometry(190,e->size().height()-60,80,50);
|
||||
disk_gauge->setGeometry(285,e->size().height()-55,
|
||||
e->size().width()-585,
|
||||
disk_gauge->setGeometry(475,e->size().height()-55,
|
||||
e->size().width()-775,
|
||||
disk_gauge->sizeHint().height());
|
||||
lib_rip_button->
|
||||
setGeometry(e->size().width()-290,e->size().height()-60,80,50);
|
||||
@ -1018,9 +1068,74 @@ void MainWidget::resizeEvent(QResizeEvent *e)
|
||||
setGeometry(e->size().width()-200,e->size().height()-60,80,50);
|
||||
lib_close_button->setGeometry(e->size().width()-90,e->size().height()-60,
|
||||
80,50);
|
||||
lib_player->playButton()->setGeometry(290,e->size().height()-60,80,50);
|
||||
lib_player->stopButton()->setGeometry(380,e->size().height()-60,80,50);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWidget::RefreshCuts(RDListViewItem *p,unsigned cartnum)
|
||||
{
|
||||
RDListViewItem *l=NULL;
|
||||
Q3ListViewItem *i=NULL;
|
||||
RDSqlQuery *q;
|
||||
QString sql;
|
||||
QDateTime current_datetime(QDate::currentDate(),QTime::currentTime());
|
||||
QDateTime end_datetime;
|
||||
RDCart::Validity validity=RDCart::NeverValid;
|
||||
|
||||
while ((i=p->firstChild())) {
|
||||
delete i;
|
||||
}
|
||||
|
||||
sql=QString("select ")+
|
||||
"CUTS.CART_NUMBER,"+ // 00
|
||||
"CUTS.CUT_NAME,"+ // 01
|
||||
"CUTS.DESCRIPTION,"+ // 02
|
||||
"CUTS.TALK_START_POINT,"+ // 03
|
||||
"CUTS.TALK_END_POINT,"+ // 04
|
||||
"CUTS.LENGTH,"+ // 05 offsets begin here
|
||||
"CUTS.EVERGREEN,"+ // 06
|
||||
"CUTS.START_DATETIME,"+ // 07
|
||||
"CUTS.END_DATETIME,"+ // 08
|
||||
"CUTS.START_DAYPART,"+ // 09
|
||||
"CUTS.END_DAYPART,"+ // 10
|
||||
"CUTS.MON,"+ // 11
|
||||
"CUTS.TUE,"+ // 12
|
||||
"CUTS.WED,"+ // 13
|
||||
"CUTS.THU,"+ // 14
|
||||
"CUTS.FRI,"+ // 15
|
||||
"CUTS.SAT,"+ // 16
|
||||
"CUTS.SUN "+ // 17
|
||||
"from CUTS ";
|
||||
sql+=QString().sprintf("where CUTS.CART_NUMBER=%u ",cartnum);
|
||||
sql+="order by CUTS.CUT_NAME";
|
||||
q=new RDSqlQuery(sql);
|
||||
if (q->size()>1) {
|
||||
while(q->next()) {
|
||||
l=new RDListViewItem(p);
|
||||
l->setDragEnabled(false);
|
||||
l->setText(Cart,q->value(1).toString());
|
||||
l->setText(Length,RDGetTimeLength(q->value(5).toUInt()));
|
||||
l->setText(Talk,RDGetTimeLength(q->value(4).toUInt()-q->value(3).toUInt()));
|
||||
l->setText(Title,q->value(2).toString());
|
||||
if(!q->value(7).toDateTime().isNull()) {
|
||||
l->setText(Start,q->value(7).toDateTime().
|
||||
toString("MM/dd/yyyy hh:mm:ss"));
|
||||
}
|
||||
if(!q->value(8).toDateTime().isNull()) {
|
||||
l->setText(End,q->value(8).toDateTime().
|
||||
toString("MM/dd/yyyy - hh:mm:ss"));
|
||||
}
|
||||
else {
|
||||
l->setText(End,"TFN");
|
||||
}
|
||||
validity=ValidateCut(q,5,validity,current_datetime);
|
||||
end_datetime=q->value(8).toDateTime();
|
||||
UpdateItemColor(l,validity,end_datetime,current_datetime);
|
||||
}
|
||||
}
|
||||
delete q;
|
||||
}
|
||||
|
||||
void MainWidget::RefreshList()
|
||||
{
|
||||
@ -1035,6 +1150,9 @@ void MainWidget::RefreshList()
|
||||
|
||||
lib_cart_list->clear();
|
||||
|
||||
lib_edit_button->setEnabled(false);
|
||||
lib_delete_button->setEnabled(false);
|
||||
|
||||
type_filter=GetTypeFilter();
|
||||
if(type_filter.isEmpty()) {
|
||||
return;
|
||||
@ -1064,19 +1182,21 @@ void MainWidget::RefreshList()
|
||||
"CART.OWNER,"+ // 21
|
||||
"CART.VALIDITY,"+ // 22
|
||||
"GROUPS.COLOR,"+ // 23
|
||||
"CUTS.LENGTH,"+ // 24 offsets begin here
|
||||
"CUTS.EVERGREEN,"+ // 25
|
||||
"CUTS.START_DATETIME,"+ // 26
|
||||
"CUTS.END_DATETIME,"+ // 27
|
||||
"CUTS.START_DAYPART,"+ // 28
|
||||
"CUTS.END_DAYPART,"+ // 29
|
||||
"CUTS.MON,"+ // 30
|
||||
"CUTS.TUE,"+ // 31
|
||||
"CUTS.WED,"+ // 32
|
||||
"CUTS.THU,"+ // 33
|
||||
"CUTS.FRI,"+ // 34
|
||||
"CUTS.SAT,"+ // 35
|
||||
"CUTS.SUN "+ // 36
|
||||
"CUTS.TALK_START_POINT,"+ // 24
|
||||
"CUTS.TALK_END_POINT,"+ // 25
|
||||
"CUTS.LENGTH,"+ // 26 offsets begin here
|
||||
"CUTS.EVERGREEN,"+ // 27
|
||||
"CUTS.START_DATETIME,"+ // 28
|
||||
"CUTS.END_DATETIME,"+ // 29
|
||||
"CUTS.START_DAYPART,"+ // 30
|
||||
"CUTS.END_DAYPART,"+ // 31
|
||||
"CUTS.MON,"+ // 32
|
||||
"CUTS.TUE,"+ // 33
|
||||
"CUTS.WED,"+ // 34
|
||||
"CUTS.THU,"+ // 35
|
||||
"CUTS.FRI,"+ // 36
|
||||
"CUTS.SAT,"+ // 37
|
||||
"CUTS.SUN "+ // 38
|
||||
"from CART left join GROUPS on CART.GROUP_NAME=GROUPS.NAME "+
|
||||
"left join CUTS on CART.NUMBER=CUTS.CART_NUMBER";
|
||||
sql+=WhereClause();
|
||||
@ -1096,7 +1216,7 @@ void MainWidget::RefreshList()
|
||||
validity=RDCart::AlwaysValid;
|
||||
}
|
||||
else {
|
||||
validity=ValidateCut(q,24,validity,current_datetime);
|
||||
validity=ValidateCut(q,26,validity,current_datetime);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -1112,75 +1232,82 @@ void MainWidget::RefreshList()
|
||||
validity=RDCart::AlwaysValid;
|
||||
}
|
||||
else {
|
||||
validity=ValidateCut(q,24,RDCart::NeverValid,current_datetime);
|
||||
validity=ValidateCut(q,26,RDCart::NeverValid,current_datetime);
|
||||
}
|
||||
l=new RDListViewItem(lib_cart_list);
|
||||
l->setExpandable(false);
|
||||
switch((RDCart::Type)q->value(15).toUInt()) {
|
||||
case RDCart::Audio:
|
||||
if(q->value(21).isNull()) {
|
||||
l->setPixmap(0,*lib_playout_map);
|
||||
l->setPixmap(Icon,*lib_playout_map);
|
||||
}
|
||||
else {
|
||||
l->setPixmap(0,*lib_track_cart_map);
|
||||
l->setPixmap(Icon,*lib_track_cart_map);
|
||||
}
|
||||
break;
|
||||
|
||||
case RDCart::Macro:
|
||||
l->setPixmap(0,*lib_macro_map);
|
||||
l->setPixmap(Icon,*lib_macro_map);
|
||||
l->setBackgroundColor(backgroundColor());
|
||||
break;
|
||||
|
||||
case RDCart::All:
|
||||
break;
|
||||
}
|
||||
l->setText(1,QString().sprintf("%06d",q->value(0).toUInt()));
|
||||
l->setText(2,q->value(12).toString());
|
||||
l->setTextColor(2,q->value(23).toString(),QFont::Bold);
|
||||
l->setText(3,RDGetTimeLength(q->value(1).toUInt()));
|
||||
l->setText(4,q->value(2).toString());
|
||||
l->setText(5,q->value(3).toString());
|
||||
l->setText(Cart,QString().sprintf("%06d",q->value(0).toUInt()));
|
||||
l->setText(Group,q->value(12).toString());
|
||||
l->setTextColor(Group,q->value(23).toString(),QFont::Bold);
|
||||
if(q->value(16).toUInt()==1) {
|
||||
l->setText(Length,RDGetTimeLength(q->value(1).toUInt()));
|
||||
l->setText(Talk,RDGetTimeLength(q->value(25).toUInt()-q->value(24).toUInt()));
|
||||
}
|
||||
l->setText(Title,q->value(2).toString());
|
||||
l->setText(Artist,q->value(3).toString());
|
||||
if(!q->value(13).toDateTime().isNull()) {
|
||||
l->setText(6,q->value(13).toDateTime().
|
||||
l->setText(Start,q->value(13).toDateTime().
|
||||
toString("MM/dd/yyyy - hh:mm:ss"));
|
||||
}
|
||||
if(!q->value(14).toDateTime().isNull()) {
|
||||
l->setText(7,q->value(14).toDateTime().
|
||||
l->setText(End,q->value(14).toDateTime().
|
||||
toString("MM/dd/yyyy - hh:mm:ss"));
|
||||
}
|
||||
else {
|
||||
l->setText(7,"TFN");
|
||||
l->setText(End,"TFN");
|
||||
}
|
||||
l->setText(8,q->value(4).toString());
|
||||
l->setText(9,q->value(5).toString());
|
||||
l->setText(10,q->value(9).toString());
|
||||
l->setText(11,q->value(11).toString());
|
||||
l->setText(12,q->value(10).toString());
|
||||
l->setText(13,q->value(6).toString());
|
||||
l->setText(14,q->value(7).toString());
|
||||
l->setText(15,q->value(8).toString());
|
||||
l->setText(16,q->value(16).toString());
|
||||
l->setText(17,q->value(17).toString());
|
||||
l->setText(18,q->value(18).toString());
|
||||
l->setText(19,q->value(19).toString());
|
||||
l->setText(20,q->value(20).toString());
|
||||
l->setText(21,q->value(21).toString());
|
||||
l->setText(Album,q->value(4).toString());
|
||||
l->setText(Label,q->value(5).toString());
|
||||
l->setText(Composer,q->value(9).toString());
|
||||
l->setText(Conductor,q->value(11).toString());
|
||||
l->setText(Publisher,q->value(10).toString());
|
||||
l->setText(Client,q->value(6).toString());
|
||||
l->setText(Agency,q->value(7).toString());
|
||||
l->setText(UserDefined,q->value(8).toString());
|
||||
l->setText(Cuts,q->value(16).toString());
|
||||
l->setText(LastCutPlayed,q->value(17).toString());
|
||||
l->setText(EnforceLength,q->value(18).toString());
|
||||
l->setText(PreservePitch,q->value(19).toString());
|
||||
l->setText(LengthDeviation,q->value(20).toString());
|
||||
l->setText(OwnedBy,q->value(21).toString());
|
||||
if(q->value(18).toString()=="Y") {
|
||||
l->setTextColor(3,QColor(RDLIBRARY_ENFORCE_LENGTH_COLOR),QFont::Bold);
|
||||
l->setTextColor(Length,QColor(RDLIBRARY_ENFORCE_LENGTH_COLOR),QFont::Bold);
|
||||
}
|
||||
else {
|
||||
if((q->value(20).toUInt()>RDLIBRARY_MID_LENGTH_LIMIT)&&
|
||||
(q->value(18).toString()=="N")) {
|
||||
if(q->value(20).toUInt()>RDLIBRARY_MAX_LENGTH_LIMIT) {
|
||||
l->setTextColor(3,QColor(RDLIBRARY_MAX_LENGTH_COLOR),QFont::Bold);
|
||||
l->setTextColor(Length,QColor(RDLIBRARY_MAX_LENGTH_COLOR),QFont::Bold);
|
||||
}
|
||||
else {
|
||||
l->setTextColor(3,QColor(RDLIBRARY_MID_LENGTH_COLOR),QFont::Bold);
|
||||
l->setTextColor(Length,QColor(RDLIBRARY_MID_LENGTH_COLOR),QFont::Bold);
|
||||
}
|
||||
}
|
||||
else {
|
||||
l->setTextColor(3,QColor(Qt::black),QFont::Normal);
|
||||
l->setTextColor(Length,QColor(Qt::black),QFont::Normal);
|
||||
}
|
||||
}
|
||||
if(q->value(16).toUInt() > 1) {
|
||||
RefreshCuts(l,q->value(0).toUInt());
|
||||
}
|
||||
}
|
||||
cartnum=q->value(0).toUInt();
|
||||
if(count++>RDLIBRARY_STEP_SIZE) {
|
||||
@ -1266,6 +1393,8 @@ void MainWidget::RefreshLine(RDListViewItem *item)
|
||||
"CART.OWNER,"+ // 20
|
||||
"CART.VALIDITY,"+ // 21
|
||||
"GROUPS.COLOR,"+ // 22
|
||||
"CUTS.TALK_START_POINT,"+ // 23
|
||||
"CUTS.TALK_END_POINT,"+ // 24
|
||||
"CUTS.LENGTH,"+ // 23
|
||||
"CUTS.EVERGREEN,"+ // 24
|
||||
"CUTS.START_DATETIME,"+ // 25
|
||||
@ -1282,24 +1411,24 @@ void MainWidget::RefreshLine(RDListViewItem *item)
|
||||
"from CART left join GROUPS "+
|
||||
"on CART.GROUP_NAME=GROUPS.NAME left join CUTS on "+
|
||||
"CART.NUMBER=CUTS.CART_NUMBER where "+
|
||||
QString().sprintf("CART.NUMBER=%u",item->text(1).toUInt());
|
||||
QString().sprintf("CART.NUMBER=%u",item->text(Cart).toUInt());
|
||||
RDSqlQuery *q=new RDSqlQuery(sql);
|
||||
while(q->next()) {
|
||||
if((RDCart::Type)q->value(14).toUInt()==RDCart::Macro) {
|
||||
validity=RDCart::AlwaysValid;
|
||||
}
|
||||
else {
|
||||
validity=ValidateCut(q,23,validity,current_datetime);
|
||||
validity=ValidateCut(q,24,validity,current_datetime);
|
||||
}
|
||||
switch((RDCart::Type)q->value(14).toUInt()) {
|
||||
case RDCart::Audio:
|
||||
if(q->value(20).isNull()) {
|
||||
item->setPixmap(0,*lib_playout_map);
|
||||
item->setPixmap(Icon,*lib_playout_map);
|
||||
}
|
||||
else {
|
||||
item->setPixmap(0,*lib_track_cart_map);
|
||||
item->setPixmap(Icon,*lib_track_cart_map);
|
||||
}
|
||||
if(q->value(0).toUInt()==0) {
|
||||
if(q->value(Icon).toUInt()==0) {
|
||||
item->setBackgroundColor(RD_CART_ERROR_COLOR);
|
||||
}
|
||||
else {
|
||||
@ -1309,62 +1438,67 @@ void MainWidget::RefreshLine(RDListViewItem *item)
|
||||
break;
|
||||
|
||||
case RDCart::Macro:
|
||||
item->setPixmap(0,*lib_macro_map);
|
||||
item->setPixmap(Icon,*lib_macro_map);
|
||||
break;
|
||||
|
||||
case RDCart::All:
|
||||
break;
|
||||
}
|
||||
item->setText(2,q->value(11).toString());
|
||||
item->setTextColor(2,q->value(22).toString(),QFont::Bold);
|
||||
item->setText(3,RDGetTimeLength(q->value(0).toUInt()));
|
||||
item->setText(4,q->value(1).toString());
|
||||
item->setText(5,q->value(2).toString());
|
||||
item->setText(8,q->value(3).toString());
|
||||
item->setText(9,q->value(4).toString());
|
||||
item->setText(10,q->value(8).toString());
|
||||
item->setText(11,q->value(9).toString());
|
||||
item->setText(Group,q->value(11).toString());
|
||||
item->setTextColor(Group,q->value(22).toString(),QFont::Bold);
|
||||
if(q->value(15).toUInt()==1) {
|
||||
item->setText(Length,RDGetTimeLength(q->value(0).toUInt()));
|
||||
item->setText(Talk,RDGetTimeLength(q->value(24).toUInt()-q->value(23).toUInt()));
|
||||
}
|
||||
item->setText(Title,q->value(1).toString());
|
||||
item->setText(Artist,q->value(2).toString());
|
||||
item->setText(Album,q->value(3).toString());
|
||||
item->setText(Label,q->value(4).toString());
|
||||
item->setText(Composer,q->value(8).toString());
|
||||
item->setText(Conductor,q->value(9).toString());
|
||||
|
||||
item->setText(12,q->value(10).toString());
|
||||
item->setText(13,q->value(5).toString());
|
||||
item->setText(14,q->value(6).toString());
|
||||
item->setText(Publisher,q->value(10).toString());
|
||||
item->setText(Client,q->value(5).toString());
|
||||
item->setText(Agency,q->value(6).toString());
|
||||
if(!q->value(12).toDateTime().isNull()) {
|
||||
item->setText(6,q->value(12).toDateTime().
|
||||
item->setText(Start,q->value(12).toDateTime().
|
||||
toString("MM/dd/yyyy - hh:mm:ss"));
|
||||
}
|
||||
else {
|
||||
item->setText(6,"");
|
||||
item->setText(Start,"");
|
||||
}
|
||||
if(!q->value(13).toDateTime().isNull()) {
|
||||
item->setText(7,q->value(13).toDateTime().
|
||||
item->setText(End,q->value(13).toDateTime().
|
||||
toString("MM/dd/yyyy - hh:mm:ss"));
|
||||
}
|
||||
else {
|
||||
item->setText(7,tr("TFN"));
|
||||
item->setText(End,tr("TFN"));
|
||||
}
|
||||
item->setText(16,q->value(15).toString());
|
||||
item->setText(17,q->value(16).toString());
|
||||
item->setText(18,q->value(17).toString());
|
||||
item->setText(19,q->value(18).toString());
|
||||
item->setText(20,q->value(19).toString());
|
||||
item->setText(21,q->value(20).toString());
|
||||
item->setText(Cuts,q->value(15).toString());
|
||||
item->setText(LastCutPlayed,q->value(16).toString());
|
||||
item->setText(EnforceLength,q->value(17).toString());
|
||||
item->setText(PreservePitch,q->value(18).toString());
|
||||
item->setText(LengthDeviation,q->value(19).toString());
|
||||
item->setText(OwnedBy,q->value(20).toString());
|
||||
if(q->value(17).toString()=="Y") {
|
||||
item->setTextColor(3,QColor(RDLIBRARY_ENFORCE_LENGTH_COLOR),QFont::Bold);
|
||||
item->setTextColor(Length,QColor(RDLIBRARY_ENFORCE_LENGTH_COLOR),QFont::Bold);
|
||||
}
|
||||
else {
|
||||
if((q->value(19).toUInt()>RDLIBRARY_MID_LENGTH_LIMIT)&&
|
||||
(q->value(17).toString()=="N")) {
|
||||
if(q->value(19).toUInt()>RDLIBRARY_MAX_LENGTH_LIMIT) {
|
||||
item->setTextColor(3,QColor(RDLIBRARY_MAX_LENGTH_COLOR),QFont::Bold);
|
||||
item->setTextColor(Length,QColor(RDLIBRARY_MAX_LENGTH_COLOR),QFont::Bold);
|
||||
}
|
||||
else {
|
||||
item->setTextColor(3,QColor(RDLIBRARY_MID_LENGTH_COLOR),QFont::Bold);
|
||||
item->setTextColor(Length,QColor(RDLIBRARY_MID_LENGTH_COLOR),QFont::Bold);
|
||||
}
|
||||
}
|
||||
else {
|
||||
item->setTextColor(3,QColor(Qt::black),QFont::Normal);
|
||||
item->setTextColor(Length,QColor(Qt::black),QFont::Normal);
|
||||
}
|
||||
}
|
||||
|
||||
RefreshCuts(item,item->text(Cart).toUInt());
|
||||
}
|
||||
delete q;
|
||||
}
|
||||
@ -1471,9 +1605,6 @@ void MainWidget::LoadGeometry()
|
||||
void MainWidget::SaveGeometry()
|
||||
{
|
||||
QString geometry_file=GeometryFile();
|
||||
if(geometry_file.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
FILE *file=fopen(geometry_file,"w");
|
||||
if(file==NULL) {
|
||||
return;
|
||||
@ -1515,7 +1646,7 @@ bool MainWidget::UnlockUser()
|
||||
// Process Deleted Carts
|
||||
//
|
||||
for(unsigned i=0;i<lib_deleted_carts.size();i++) {
|
||||
if((item=(RDListViewItem *)lib_cart_list->findItem(QString().sprintf("%06u",lib_deleted_carts.at(i)),1))!=NULL) {
|
||||
if((item=(RDListViewItem *)lib_cart_list->findItem(QString().sprintf("%06u",lib_deleted_carts.at(i)),Cart))!=NULL) {
|
||||
delete item;
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <qsizepolicy.h>
|
||||
#include <qsqldatabase.h>
|
||||
#include <rdlistview.h>
|
||||
#include <rdsimpleplayer.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qcombobox.h>
|
||||
#include <qlabel.h>
|
||||
@ -65,6 +66,11 @@ class MainWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum Column {Icon=0,Cart=1,Group=2,Length=3,Talk=4,Title=5,Artist=6,
|
||||
Start=7,End=8,Album=9,Label=10,Composer=11,Conductor=12,
|
||||
Publisher=13,Client=14,Agency=15,UserDefined=16,
|
||||
Cuts=17,LastCutPlayed=18,EnforceLength=19,PreservePitch=20,
|
||||
LengthDeviation=21,OwnedBy=22};
|
||||
MainWidget(QWidget *parent=0);
|
||||
QSize sizeHint() const;
|
||||
QSizePolicy sizePolicy() const;
|
||||
@ -82,7 +88,7 @@ class MainWidget : public QWidget
|
||||
void ripData();
|
||||
void reportsData();
|
||||
void cartOnItemData(Q3ListViewItem *item);
|
||||
void cartClickedData(Q3ListViewItem *item);
|
||||
void cartClickedData();
|
||||
void cartDoubleclickedData(Q3ListViewItem *,const QPoint &,int);
|
||||
void audioChangedData(int state);
|
||||
void macroChangedData(int state);
|
||||
@ -97,6 +103,7 @@ class MainWidget : public QWidget
|
||||
|
||||
private:
|
||||
void RefreshList();
|
||||
void RefreshCuts(RDListViewItem *p,unsigned cartnum);
|
||||
QString WhereClause() const;
|
||||
void RefreshLine(RDListViewItem *item);
|
||||
void UpdateItemColor(RDListViewItem *item,RDCart::Validity validity,
|
||||
@ -131,6 +138,9 @@ class MainWidget : public QWidget
|
||||
QPushButton *lib_rip_button;
|
||||
QPushButton *lib_reports_button;
|
||||
QPushButton *lib_close_button;
|
||||
RDSimplePlayer *lib_player;
|
||||
int lib_output_card;
|
||||
int lib_output_port;
|
||||
QCheckBox *lib_allowdrag_box;
|
||||
QLabel *lib_allowdrag_label;
|
||||
QCheckBox *lib_showaudio_box;
|
||||
|
@ -1478,6 +1478,10 @@ Přesto smazat?</translation>
|
||||
<source>Owned By</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Talk</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RecordCut</name>
|
||||
|
@ -1455,6 +1455,10 @@ verwendet. Trotzdem löschen?</translation>
|
||||
<source>Owned By</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Talk</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RecordCut</name>
|
||||
|
@ -1464,6 +1464,10 @@ Do you still want to delete it?</source>
|
||||
<source>Owned By</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Talk</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RecordCut</name>
|
||||
|
@ -1172,6 +1172,10 @@ Do you still want to delete it?</source>
|
||||
<source>Owned By</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Talk</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RecordCut</name>
|
||||
|
@ -1451,6 +1451,10 @@ Vil du sletta ho likevel?</translation>
|
||||
<source>Owned By</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Talk</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RecordCut</name>
|
||||
|
@ -1451,6 +1451,10 @@ Vil du sletta ho likevel?</translation>
|
||||
<source>Owned By</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Talk</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RecordCut</name>
|
||||
|
@ -1453,6 +1453,10 @@ Você ainda quer deletá-lo?</translation>
|
||||
<source>Owned By</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Talk</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RecordCut</name>
|
||||
|
@ -63,6 +63,20 @@ Db::~Db()
|
||||
QSqlDatabase::removeDatabase("Rivendell");
|
||||
}
|
||||
|
||||
void Db::clearDatabase(QString name)
|
||||
{
|
||||
QSqlQuery *q;
|
||||
QSqlDatabase db=QSqlDatabase::database("Rivendell");
|
||||
|
||||
if(db.isOpen()){
|
||||
q=new QSqlQuery(QString().sprintf("drop database if exists `%s`",(const char *)name),db);
|
||||
delete q;
|
||||
|
||||
q=new QSqlQuery(QString().sprintf("create database `%s`",(const char *)name),db);
|
||||
delete q;
|
||||
}
|
||||
}
|
||||
|
||||
bool Db::isOpen()
|
||||
{
|
||||
QSqlDatabase db=QSqlDatabase::database("Rivendell");
|
||||
|
@ -31,6 +31,7 @@ class Db
|
||||
Db(QString *err_str,RDConfig *config);
|
||||
~Db();
|
||||
bool isOpen();
|
||||
void clearDatabase(QString name);
|
||||
unsigned schema();
|
||||
|
||||
private:
|
||||
|
@ -19,8 +19,6 @@
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
|
||||
#define LINE fprintf(stderr,"%s:%d\n",__FILE__,__LINE__);
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
@ -31,11 +29,11 @@
|
||||
#include <q3filedialog.h>
|
||||
|
||||
#include <rdconfig.h>
|
||||
#include <dbversion.h>
|
||||
|
||||
#include "../../icons/rivendell-22x22.xpm"
|
||||
|
||||
#include <rddbconfig.h>
|
||||
|
||||
#include "rddbconfig.h"
|
||||
#include "db.h"
|
||||
#include "createdb.h"
|
||||
#include "mysql_login.h"
|
||||
@ -146,7 +144,15 @@ MainWidget::MainWidget(QWidget *parent)
|
||||
db_close_button->setFont(label_font);
|
||||
connect(db_close_button,SIGNAL(clicked()),this,SLOT(closeData()));
|
||||
|
||||
updateLabels();
|
||||
//
|
||||
// Signals
|
||||
//
|
||||
connect(this,SIGNAL(dbChanged()),this,SLOT(updateLabels()));
|
||||
connect(this,SIGNAL(dbMismatch()),this,SLOT(mismatchData()));
|
||||
|
||||
this->show();
|
||||
|
||||
emit dbChanged();
|
||||
}
|
||||
|
||||
|
||||
@ -166,6 +172,36 @@ QSizePolicy MainWidget::sizePolicy() const
|
||||
return QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||
}
|
||||
|
||||
void MainWidget::mismatchData()
|
||||
{
|
||||
if (!db->schema()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (QMessageBox::question(this,tr("Database Mismatch"),QString().sprintf("Your database is version %d. Your Rivendell %s installation requires version %d. Would you like to modify your database to the current version?",db->schema(),VERSION,RD_VERSION_DATABASE),(QMessageBox::No|QMessageBox::Yes)) != QMessageBox::Yes) {
|
||||
return;
|
||||
}
|
||||
|
||||
QProcess modifyProcess(this);
|
||||
QStringList args;
|
||||
args << QString("--modify");
|
||||
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
||||
modifyProcess.start("rddbmgr", args);
|
||||
modifyProcess.waitForFinished(-1);
|
||||
QApplication::restoreOverrideCursor();
|
||||
if (modifyProcess.exitCode()) {
|
||||
QMessageBox::critical(this,tr("RDDbConfig Error"),
|
||||
QString(modifyProcess.readAllStandardError()));
|
||||
}
|
||||
else {
|
||||
QMessageBox::information(this,"Database Modified Successfully",
|
||||
QString().sprintf("Modified database to version %d", RD_VERSION_DATABASE));
|
||||
rd_config->log("rddbconfig",RDConfig::LogInfo,QString().sprintf("Modified database to version %d", RD_VERSION_DATABASE));
|
||||
|
||||
emit dbChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWidget::updateLabels()
|
||||
{
|
||||
QString err_msg="";
|
||||
@ -184,6 +220,10 @@ void MainWidget::updateLabels()
|
||||
label_schema->setText(QString().sprintf("DB Version: %d",db->schema()));
|
||||
db_backup_button->setEnabled(true);
|
||||
db_restore_button->setEnabled(true);
|
||||
|
||||
if(db->schema()!=RD_VERSION_DATABASE) {
|
||||
emit dbMismatch();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -234,7 +274,7 @@ void MainWidget::createData()
|
||||
|
||||
startDaemons();
|
||||
|
||||
updateLabels();
|
||||
emit updateLabels();
|
||||
|
||||
delete db_create;
|
||||
}
|
||||
@ -264,10 +304,9 @@ void MainWidget::backupData()
|
||||
backupProcess.setStandardOutputFile(filename);
|
||||
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
||||
backupProcess.start("mysqldump", args);
|
||||
backupProcess.waitForFinished();
|
||||
backupProcess.waitForFinished(-1);
|
||||
QApplication::restoreOverrideCursor();
|
||||
if (backupProcess.exitCode()) {
|
||||
fprintf(stderr,"Exit Code=%d\n",backupProcess.exitCode());
|
||||
QMessageBox::critical(this,tr("RDDbConfig Error"),
|
||||
QString(backupProcess.readAllStandardError()));
|
||||
}
|
||||
@ -303,6 +342,9 @@ void MainWidget::restoreData()
|
||||
if (QMessageBox::question(this,tr("Restore Entire Database"),tr("Are you sure you want to restore your entire Rivendell database?"),(QMessageBox::No|QMessageBox::Yes)) != QMessageBox::Yes) {
|
||||
return;
|
||||
}
|
||||
|
||||
db->clearDatabase(rd_config->mysqlDbname());
|
||||
|
||||
QProcess restoreProcess(this);
|
||||
QStringList args;
|
||||
args << QString().sprintf("--user=%s",(const char *)rd_config->mysqlUsername())
|
||||
@ -313,7 +355,7 @@ void MainWidget::restoreData()
|
||||
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
||||
stopDaemons();
|
||||
restoreProcess.start("mysql", args);
|
||||
restoreProcess.waitForFinished();
|
||||
restoreProcess.waitForFinished(-1);
|
||||
QApplication::restoreOverrideCursor();
|
||||
if (restoreProcess.exitCode()) {
|
||||
QMessageBox::critical(this,tr("RDDbConfig Error"),
|
||||
@ -329,6 +371,7 @@ void MainWidget::restoreData()
|
||||
(const char *)rd_config->mysqlDbname(),
|
||||
(const char *)filename));
|
||||
}
|
||||
emit updateLabels();
|
||||
startDaemons();
|
||||
}
|
||||
}
|
||||
@ -371,14 +414,6 @@ void MainWidget::stopDaemons()
|
||||
}
|
||||
}
|
||||
QApplication::restoreOverrideCursor();
|
||||
#if 0
|
||||
if(system("/usr/bin/systemctl status rivendell")==0) {
|
||||
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
||||
system("/usr/bin/systemctl stop rivendell");
|
||||
QApplication::restoreOverrideCursor();
|
||||
db_daemon_start_needed=true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -405,8 +440,5 @@ int main(int argc,char *argv[])
|
||||
QApplication a(argc,argv);
|
||||
MainWidget *w=new MainWidget();
|
||||
a.setMainWidget(w);
|
||||
w->setGeometry(QRect(QPoint(0,0),w->sizeHint()));
|
||||
w->move(250,250);
|
||||
w->show();
|
||||
return a.exec();
|
||||
}
|
||||
|
@ -39,6 +39,7 @@
|
||||
class MainWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MainWidget(QWidget *parent=0);
|
||||
~MainWidget();
|
||||
@ -53,12 +54,17 @@ class MainWidget : public QWidget
|
||||
void backupData();
|
||||
void restoreData();
|
||||
void closeData();
|
||||
void mismatchData();
|
||||
void updateLabels();
|
||||
|
||||
signals:
|
||||
void dbMismatch();
|
||||
void dbChanged();
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *e);
|
||||
|
||||
private:
|
||||
void updateLabels();
|
||||
RDConfig *rd_config;
|
||||
bool db_manage_daemons;
|
||||
bool db_daemon_start_needed;
|
||||
|
Loading…
x
Reference in New Issue
Block a user