mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-11-29 16:50:13 +01:00
Fixed conflicts when merging 'master' into 'rss'
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// mySQL Administrative Login widget for RDDbConfig
|
||||
//
|
||||
// (C) Copyright 2002-2019 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2002-2020 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
@@ -18,10 +18,9 @@
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
|
||||
#include <qlabel.h>
|
||||
#include <qpushbutton.h>
|
||||
|
||||
#include <rdlabel.h>
|
||||
|
||||
#include "mysql_login.h"
|
||||
|
||||
MySqlLogin::MySqlLogin(QString *username,QString *password, QWidget *parent)
|
||||
@@ -35,7 +34,7 @@ MySqlLogin::MySqlLogin(QString *username,QString *password, QWidget *parent)
|
||||
//
|
||||
// Message Label
|
||||
//
|
||||
RDLabel *label=new RDLabel(tr("Enter your MySQL administrator username and password\nThe Hostname and Database are found in /etc/rd.conf"),this);
|
||||
QLabel *label=new QLabel(tr("Enter your MySQL administrator username and password\nThe Hostname and Database are found in /etc/rd.conf"),this);
|
||||
label->setFont(labelFont());
|
||||
label->setGeometry(10,10,sizeHint().width()-20,30);
|
||||
label->setAlignment(Qt::AlignCenter);
|
||||
|
||||
@@ -25,12 +25,13 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <qapplication.h>
|
||||
#include <qprocess.h>
|
||||
#include <qfiledialog.h>
|
||||
#include <qmessagebox.h>
|
||||
#include <q3filedialog.h>
|
||||
#include <qprocess.h>
|
||||
|
||||
#include <dbversion.h>
|
||||
#include <rdapplication.h>
|
||||
#include <rdconf.h>
|
||||
#include <rdconfig.h>
|
||||
#include <rdpaths.h>
|
||||
|
||||
@@ -298,9 +299,10 @@ void MainWidget::backupData()
|
||||
(const char *)rd_config->mysqlDbname()));
|
||||
return;
|
||||
}
|
||||
|
||||
filename=Q3FileDialog::getSaveFileName("rivendell.sql",
|
||||
"MySQL (*.sql)",this,"open file dialog","Enter the MySQL Backup Filename");
|
||||
filename=QFileDialog::getSaveFileName(this,"RDDbConfig - "+
|
||||
tr("Enter the MySQL Backup Filename"),
|
||||
RDHomeDir(),
|
||||
"MySQL files (*.sql);;All files (*.*)");
|
||||
|
||||
if (!filename.isEmpty()) {
|
||||
QProcess backupProcess(this);
|
||||
@@ -340,10 +342,11 @@ void MainWidget::restoreData()
|
||||
tr("Could not open Rivendell database."));
|
||||
return;
|
||||
}
|
||||
|
||||
filename=Q3FileDialog::getOpenFileName("",
|
||||
"MySQL (*.sql);;All Files(*)",this,"open file dialog",
|
||||
"Choose the MySQL Backup File to Restore");
|
||||
filename=
|
||||
QFileDialog::getOpenFileName(this,"RDDbConfig - "+
|
||||
tr("Choose the MySQL Backup File to Restore"),
|
||||
RDHomeDir(),
|
||||
"MySQL files (*.sql);;All files (*.*)");
|
||||
|
||||
if(!filename.isEmpty()) {
|
||||
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) {
|
||||
|
||||
@@ -41,6 +41,9 @@
|
||||
|
||||
#include "rddbmgr.h"
|
||||
|
||||
#define RDDBMGR_CHARSET_STRING "pRiKaZiDatFoO"
|
||||
#define RDDBMGR_COLLATION_STRING "pRiKaZiDatBaR"
|
||||
|
||||
bool MainObject::Check(QString *err_msg)
|
||||
{
|
||||
if(GetCurrentSchema()!=RD_VERSION_DATABASE) {
|
||||
@@ -222,6 +225,7 @@ void MainObject::RewriteTable(const QString &tblname,
|
||||
const QString &new_charset,
|
||||
const QString &new_collation)
|
||||
{
|
||||
QString err_msg;
|
||||
QProcess *proc=NULL;
|
||||
QStringList args;
|
||||
QString tempdir=RDTempDir();
|
||||
@@ -229,7 +233,9 @@ void MainObject::RewriteTable(const QString &tblname,
|
||||
return;
|
||||
}
|
||||
QString filename=tempdir+"/table.sql";
|
||||
QString temp_filename=tempdir+"/table-temp.sql";
|
||||
QString temp1_filename=tempdir+"/table-temp1.sql";
|
||||
QString temp2_filename=tempdir+"/table-temp2.sql";
|
||||
QString temp3_filename=tempdir+"/table-temp3.sql";
|
||||
QString out_filename=tempdir+"/table-out.sql";
|
||||
/*
|
||||
printf("table \"%s\" using: %s\n",
|
||||
@@ -256,28 +262,36 @@ void MainObject::RewriteTable(const QString &tblname,
|
||||
delete proc;
|
||||
|
||||
//
|
||||
// Modify COLLATION
|
||||
// Stage 1
|
||||
//
|
||||
args.clear();
|
||||
args.push_back("s/"+old_collation+"/"+new_collation+"/g");
|
||||
args.push_back(filename);
|
||||
proc=new QProcess(this);
|
||||
proc->setStandardOutputFile(temp_filename);
|
||||
proc->start("sed",args);
|
||||
proc->waitForFinished(-1);
|
||||
delete proc;
|
||||
if(!RewriteFile(filename,old_collation,
|
||||
temp1_filename,RDDBMGR_COLLATION_STRING,
|
||||
&err_msg)) {
|
||||
fprintf(stderr,"rddbmgr: %s\n",err_msg.toUtf8().constData());
|
||||
exit(1);
|
||||
}
|
||||
if(!RewriteFile(temp1_filename,old_charset,
|
||||
temp2_filename,RDDBMGR_CHARSET_STRING,
|
||||
&err_msg)) {
|
||||
fprintf(stderr,"rddbmgr: %s\n",err_msg.toUtf8().constData());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
//
|
||||
// Modify CHARSET
|
||||
// Stage 2
|
||||
//
|
||||
args.clear();
|
||||
args.push_back("s/"+old_charset+"/"+new_charset+"/g");
|
||||
args.push_back(temp_filename);
|
||||
proc=new QProcess(this);
|
||||
proc->setStandardOutputFile(out_filename);
|
||||
proc->start("sed",args);
|
||||
proc->waitForFinished(-1);
|
||||
delete proc;
|
||||
if(!RewriteFile(temp2_filename,RDDBMGR_COLLATION_STRING,
|
||||
temp3_filename,new_collation,
|
||||
&err_msg)) {
|
||||
fprintf(stderr,"rddbmgr: %s\n",err_msg.toUtf8().constData());
|
||||
exit(1);
|
||||
}
|
||||
if(!RewriteFile(temp3_filename,RDDBMGR_CHARSET_STRING,
|
||||
out_filename,new_charset,
|
||||
&err_msg)) {
|
||||
fprintf(stderr,"rddbmgr: %s\n",err_msg.toUtf8().constData());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
//
|
||||
// Push Back Modified Table
|
||||
@@ -293,18 +307,76 @@ void MainObject::RewriteTable(const QString &tblname,
|
||||
proc->setStandardInputFile(out_filename);
|
||||
proc->start("mysql",args);
|
||||
proc->waitForFinished(-1);
|
||||
if(proc->exitStatus()!=QProcess::NormalExit) {
|
||||
fprintf(stderr,
|
||||
"rddbmgr: \"mysql %s\" crashed when rewriting table \"%s\"\n",
|
||||
args.join(" ").toUtf8().constData(),tblname.toUtf8().constData());
|
||||
fprintf(stderr,"rddbmgr: source SQL data in \"%s\"\n",
|
||||
out_filename.toUtf8().constData());
|
||||
exit(1);
|
||||
}
|
||||
if(proc->exitCode()!=0) {
|
||||
fprintf(stderr,
|
||||
"rddbmgr: \"mysql %s\" returned exit code %d [%s] when rewriting table \"%s\"\n",
|
||||
args.join(" ").toUtf8().constData(),
|
||||
proc->exitCode(),proc->readAllStandardError().constData(),
|
||||
tblname.toUtf8().constData());
|
||||
fprintf(stderr,"rddbmgr: source SQL data in \"%s\"\n",
|
||||
out_filename.toUtf8().constData());
|
||||
exit(1);
|
||||
}
|
||||
delete proc;
|
||||
|
||||
//
|
||||
// Clean Up
|
||||
//
|
||||
unlink(filename.toUtf8());
|
||||
unlink(temp_filename.toUtf8());
|
||||
unlink(temp1_filename.toUtf8());
|
||||
unlink(temp2_filename.toUtf8());
|
||||
unlink(temp3_filename.toUtf8());
|
||||
unlink(out_filename.toUtf8());
|
||||
rmdir(tempdir);
|
||||
}
|
||||
|
||||
|
||||
bool MainObject::RewriteFile(const QString &old_filename,
|
||||
const QString &old_str,
|
||||
const QString &new_filename,
|
||||
const QString &new_str,
|
||||
QString *err_msg)
|
||||
{
|
||||
QStringList args;
|
||||
QProcess *proc=NULL;
|
||||
|
||||
args.clear();
|
||||
args.push_back(QString("s/")+old_str+"/"+new_str+"/g");
|
||||
args.push_back(old_filename);
|
||||
proc=new QProcess(this);
|
||||
proc->setStandardOutputFile(new_filename);
|
||||
proc->start("sed",args);
|
||||
proc->waitForFinished(-1);
|
||||
if(proc->exitStatus()!=QProcess::NormalExit) {
|
||||
*err_msg=QString("\"sed ")+args.join(" ")+"\" "+
|
||||
"crashed when rewriting file \""+old_filename+"\" "+
|
||||
"to \""+new_filename+"\"";
|
||||
delete proc;
|
||||
return false;
|
||||
}
|
||||
if(proc->exitCode()!=0) {
|
||||
*err_msg=QString("\"sed ")+args.join(" ")+"\" "+
|
||||
"returned exit code "+QString().sprintf("%d",proc->exitCode())+
|
||||
"["+QString::fromUtf8(proc->readAllStandardError())+"] "+
|
||||
" when rewriting file \""+old_filename+"\" "+
|
||||
"to \""+new_filename+"\"";
|
||||
delete proc;
|
||||
return false;
|
||||
}
|
||||
delete proc;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void MainObject::RelinkAudio(const QString &srcdir) const
|
||||
{
|
||||
QString sql;
|
||||
|
||||
@@ -87,7 +87,7 @@ bool MainObject::ModifyCharset(const QString &charset,
|
||||
while(q->next()) {
|
||||
QStringList f0=q->value(1).toString().split("_");
|
||||
QString prev_charset=f0.at(0);
|
||||
if(q->value(1).toString().toLower()!=collation) {
|
||||
if(q->value(1).toString().toLower()!=charset) {
|
||||
RewriteTable(q->value(0).toString(),
|
||||
prev_charset,q->value(1).toString(),charset,collation);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// Rivendell database management utility
|
||||
//
|
||||
// (C) Copyright 2018 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2018-2020 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
@@ -22,8 +22,6 @@
|
||||
#define RDDBMGR_H
|
||||
|
||||
#include <qobject.h>
|
||||
//Added by qt3to4:
|
||||
#include <QSqlQuery>
|
||||
|
||||
#include <rdconfig.h>
|
||||
#include <rdstation.h>
|
||||
@@ -47,6 +45,9 @@ class MainObject : public QObject
|
||||
const QString &old_collation,
|
||||
const QString &new_charset,
|
||||
const QString &new_collation);
|
||||
bool RewriteFile(const QString &old_filename,const QString &old_str,
|
||||
const QString &new_filename,const QString &new_str,
|
||||
QString *err_msg);
|
||||
void RelinkAudio(const QString &srcdir) const;
|
||||
void CheckOrphanedTracks() const;
|
||||
void CheckCutCounts() const;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// A Qt-based application for importing TM Century GoldDisc CDs
|
||||
//
|
||||
// (C) Copyright 2013-2019 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2013-2020 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
@@ -18,9 +18,8 @@
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
|
||||
#include <q3filedialog.h>
|
||||
|
||||
#include <qapplication.h>
|
||||
#include <qfiledialog.h>
|
||||
#include <qmessagebox.h>
|
||||
#include <qtranslator.h>
|
||||
|
||||
@@ -158,14 +157,14 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent)
|
||||
dg_disc_label=new QLabel(tr("Disk Progress"),this);
|
||||
dg_disc_label->setFont(labelFont());
|
||||
dg_disc_label->setDisabled(true);
|
||||
dg_disc_bar=new Q3ProgressBar(this);
|
||||
dg_disc_bar=new QProgressBar(this);
|
||||
dg_disc_bar->setDisabled(true);
|
||||
|
||||
dg_track_label=new QLabel(tr("Track Progress"),this);
|
||||
dg_track_label->setFont(labelFont());
|
||||
dg_track_label->setDisabled(true);
|
||||
dg_track_bar=new Q3ProgressBar(this);
|
||||
dg_track_bar->setTotalSteps(dg_ripper->totalSteps()+1);
|
||||
dg_track_bar=new QProgressBar(this);
|
||||
dg_track_bar->setMaximum(dg_ripper->totalSteps()+1);
|
||||
dg_track_bar->setDisabled(true);
|
||||
connect(dg_ripper,SIGNAL(progressChanged(int)),
|
||||
dg_track_bar,SLOT(setProgress(int)));
|
||||
@@ -287,9 +286,10 @@ void MainWidget::indexFileSelectedData()
|
||||
QString filename;
|
||||
int lines;
|
||||
|
||||
filename=Q3FileDialog::getOpenFileName(dg_indexfile_edit->text(),
|
||||
"CSV Files *.csv",this,"",
|
||||
tr("RDDiscImport - Open Index File"));
|
||||
filename=QFileDialog::getOpenFileName(this,"RDDiscImport - "+
|
||||
tr("Open Index File"),
|
||||
dg_indexfile_edit->text(),
|
||||
"CSV files (*.csv);;All files (*.*)");
|
||||
dg_metalibrary->clear();
|
||||
if((lines=dg_metalibrary->load(filename))<0) {
|
||||
QMessageBox::warning(this,"RDDiscImport - "+tr("Read Error"),
|
||||
@@ -446,12 +446,12 @@ void MainWidget::ripData()
|
||||
//
|
||||
// Rip and Import
|
||||
//
|
||||
dg_disc_bar->setTotalSteps(dg_player->tracks());
|
||||
dg_disc_bar->setMaximum(dg_player->tracks());
|
||||
for(int i=0;i<dg_player->tracks();i++) {
|
||||
if(dg_rip_enableds[i]) {
|
||||
MetaRecord *r=dg_metalibrary->track(dg_discid_edit->text(),i);
|
||||
if(r!=NULL) {
|
||||
dg_disc_bar->setProgress(i);
|
||||
dg_disc_bar->setValue(i);
|
||||
dg_track_label->setText(QString().sprintf("Track %d: ",i+1)+
|
||||
r->title()+" - "+r->artist());
|
||||
dg_ripper->rip(i);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// A Qt-based application for importing TM Century GoldDisc CDs
|
||||
//
|
||||
// (C) Copyright 2013-2019 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2013-2020 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
@@ -21,12 +21,12 @@
|
||||
#ifndef RDDISCIMPORT_H
|
||||
#define RDDISCIMPORT_H
|
||||
|
||||
#include <q3progressbar.h>
|
||||
|
||||
#include <qcheckbox.h>
|
||||
#include <qlabel.h>
|
||||
#include <qcombobox.h>
|
||||
#include <qlabel.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qprogressbar.h>
|
||||
#include <qspinbox.h>
|
||||
|
||||
#include <rdaudioimport.h>
|
||||
@@ -78,9 +78,9 @@ class MainWidget : public RDWidget
|
||||
QLineEdit *dg_userdef_edit;
|
||||
RDListView *dg_track_list;
|
||||
QLabel *dg_disc_label;
|
||||
Q3ProgressBar *dg_disc_bar;
|
||||
QProgressBar *dg_disc_bar;
|
||||
QLabel *dg_track_label;
|
||||
Q3ProgressBar *dg_track_bar;
|
||||
QProgressBar *dg_track_bar;
|
||||
QLabel *dg_discid_label;
|
||||
QLineEdit *dg_discid_edit;
|
||||
QPushButton *dg_rip_button;
|
||||
|
||||
@@ -95,10 +95,6 @@
|
||||
<source>Rip Complete!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>RDDiscImport - Open Index File</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>File Read</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@@ -155,5 +151,9 @@
|
||||
<source>Unknown command option</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Open Index File</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
||||
@@ -95,10 +95,6 @@
|
||||
<source>Rip Complete!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>RDDiscImport - Open Index File</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>File Read</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@@ -155,5 +151,9 @@
|
||||
<source>Unknown command option</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Open Index File</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
||||
@@ -95,10 +95,6 @@
|
||||
<source>Rip Complete!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>RDDiscImport - Open Index File</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>File Read</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@@ -155,5 +151,9 @@
|
||||
<source>Unknown command option</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Open Index File</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
||||
@@ -95,10 +95,6 @@
|
||||
<source>Rip Complete!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>RDDiscImport - Open Index File</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>File Read</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@@ -155,5 +151,9 @@
|
||||
<source>Unknown command option</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Open Index File</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
||||
@@ -95,10 +95,6 @@
|
||||
<source>Rip Complete!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>RDDiscImport - Open Index File</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>File Read</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@@ -155,5 +151,9 @@
|
||||
<source>Unknown command option</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Open Index File</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
||||
@@ -95,10 +95,6 @@
|
||||
<source>Rip Complete!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>RDDiscImport - Open Index File</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>File Read</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@@ -155,5 +151,9 @@
|
||||
<source>Unknown command option</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Open Index File</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
||||
Reference in New Issue
Block a user