mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2026-01-12 07:35:55 +01:00
2021-02-23 Fred Gleason <fredg@paravelsystems.com>
* Removed the Qt3Support library from the build system. Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
## Makefile.am
|
||||
##
|
||||
## (C) Copyright 2009-2020 Fred Gleason <fredg@paravelsystems.com>
|
||||
## (C) Copyright 2009-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
|
||||
@@ -18,7 +18,7 @@
|
||||
## Use automake to process this into a Makefile.in
|
||||
##
|
||||
|
||||
AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib -I$(top_srcdir)/rdhpi @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -DQT3_SUPPORT -I/usr/include/Qt3Support
|
||||
AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib -I$(top_srcdir)/rdhpi @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@
|
||||
LIBS = -L$(top_srcdir)/lib -L$(top_srcdir)/rdhpi
|
||||
MOC = @QT_MOC@
|
||||
|
||||
@@ -33,7 +33,7 @@ dist_rddbconfig_SOURCES = rddbconfig.cpp rddbconfig.h mysql_login.cpp mysql_logi
|
||||
|
||||
nodist_rddbconfig_SOURCES = moc_rddbconfig.cpp moc_mysql_login.cpp
|
||||
|
||||
rddbconfig_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @LIBALSA@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support
|
||||
rddbconfig_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @LIBALSA@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@
|
||||
|
||||
CLEANFILES = *~\
|
||||
*.qm\
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// Create Rivendell MySQL database RDDbConfig
|
||||
//
|
||||
// (C) Copyright 2002-2018 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2002-2021 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
@@ -18,9 +18,9 @@
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
|
||||
#include <qapplication.h>
|
||||
#include <qprocess.h>
|
||||
#include <qmessagebox.h>
|
||||
#include <QApplication>
|
||||
#include <QProcess>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include <rdconfig.h>
|
||||
#include <rdpaths.h>
|
||||
@@ -53,13 +53,15 @@ bool CreateDb::create(QWidget *parent,QString *err_str,RDConfig *rd_config)
|
||||
db.setUserName(db_user);
|
||||
db.setPassword(db_pass);
|
||||
if(!db.open()) {
|
||||
*err_str+=QString().sprintf("Couldn't open MySQL connection on %s",(const char *)db_host);
|
||||
*err_str+=QString().sprintf("Couldn't open MySQL connection on %s",
|
||||
db_host.toUtf8().constData());
|
||||
return true;
|
||||
}
|
||||
|
||||
QSqlQuery *q;
|
||||
|
||||
sql=QString().sprintf("drop database if exists `%s`",(const char *)db_name);
|
||||
sql=QString().sprintf("drop database if exists `%s`",
|
||||
db_name.toUtf8().constData());
|
||||
q=new QSqlQuery(sql,db);
|
||||
if (!q->isActive()) {
|
||||
*err_str+=QString(QObject::tr("Could not remove old database"));
|
||||
@@ -67,7 +69,8 @@ bool CreateDb::create(QWidget *parent,QString *err_str,RDConfig *rd_config)
|
||||
}
|
||||
delete q;
|
||||
|
||||
sql=QString().sprintf("create database if not exists `%s`",(const char *)db_name);
|
||||
sql=QString().sprintf("create database if not exists `%s`",
|
||||
db_name.toUtf8().constData());
|
||||
q=new QSqlQuery(sql,db);
|
||||
if (!q->isActive()) {
|
||||
*err_str+=QString(QObject::tr("Could not create new database"));
|
||||
@@ -78,10 +81,12 @@ bool CreateDb::create(QWidget *parent,QString *err_str,RDConfig *rd_config)
|
||||
//
|
||||
// Drop any existing 'rduser'@'%' and 'rduser'@'localhost' users
|
||||
//
|
||||
sql=QString().sprintf("drop user '%s'@'%%'",(const char *)rd_config->mysqlUsername());
|
||||
sql=QString().sprintf("drop user '%s'@'%%'",
|
||||
rd_config->mysqlUsername().toUtf8().constData());
|
||||
q=new QSqlQuery(sql,db);
|
||||
delete q;
|
||||
sql=QString().sprintf("drop user '%s'@'localhost'",(const char *)rd_config->mysqlUsername());
|
||||
sql=QString().sprintf("drop user '%s'@'localhost'",
|
||||
rd_config->mysqlUsername().toUtf8().constData());
|
||||
q=new QSqlQuery(sql,db);
|
||||
delete q;
|
||||
|
||||
@@ -90,29 +95,35 @@ bool CreateDb::create(QWidget *parent,QString *err_str,RDConfig *rd_config)
|
||||
delete q;
|
||||
|
||||
sql=QString().sprintf("create user '%s'@'%%' identified by \"%s\"",
|
||||
(const char *)rd_config->mysqlUsername(),(const char *)rd_config->mysqlPassword());
|
||||
rd_config->mysqlUsername().toUtf8().constData(),
|
||||
rd_config->mysqlPassword().toUtf8().constData());
|
||||
q=new QSqlQuery(sql,db);
|
||||
if (!q->isActive()) {
|
||||
*err_str+=QString().sprintf("Could not create user: '%s'@'%%'",(const char *)sql);
|
||||
*err_str+=QString().sprintf("Could not create user: '%s'@'%%'",
|
||||
sql.toUtf8().constData());
|
||||
return true;
|
||||
}
|
||||
delete q;
|
||||
|
||||
sql=QString().sprintf("create user '%s'@'localhost' identified by \"%s\"",
|
||||
(const char *)rd_config->mysqlUsername(),(const char *)rd_config->mysqlPassword());
|
||||
rd_config->mysqlUsername().toUtf8().constData(),
|
||||
rd_config->mysqlPassword().toUtf8().constData());
|
||||
q=new QSqlQuery(sql,db);
|
||||
if (!q->isActive()) {
|
||||
*err_str+=QString().sprintf("Could not create user: '%s'@'localhost'",(const char *)sql);
|
||||
*err_str+=QString().sprintf("Could not create user: '%s'@'localhost'",
|
||||
sql.toUtf8().constData());
|
||||
return true;
|
||||
}
|
||||
delete q;
|
||||
|
||||
sql=QString().sprintf("grant SELECT, INSERT, UPDATE, DELETE, CREATE, DROP,\
|
||||
INDEX, ALTER, LOCK TABLES on %s.* to %s",
|
||||
(const char *)db_name, (const char *)rd_config->mysqlUsername());
|
||||
db_name.toUtf8().constData(),
|
||||
rd_config->mysqlUsername().toUtf8().constData());
|
||||
q=new QSqlQuery(sql,db);
|
||||
if (!q->isActive()) {
|
||||
*err_str+=QString().sprintf("Could not set permissions: %s",(const char *)sql);
|
||||
*err_str+=QString().sprintf("Could not set permissions: %s",
|
||||
sql.toUtf8().constData());
|
||||
return true;
|
||||
}
|
||||
delete q;
|
||||
@@ -129,8 +140,10 @@ bool CreateDb::create(QWidget *parent,QString *err_str,RDConfig *rd_config)
|
||||
rddbmgrProcess.waitForFinished();
|
||||
QApplication::restoreOverrideCursor();
|
||||
if (rddbmgrProcess.exitCode()) {
|
||||
*err_str+=QString().sprintf("Failed to create %s database. Rddbmgr exit code=%d",
|
||||
(const char *)db_name,rddbmgrProcess.exitCode());
|
||||
*err_str+=
|
||||
QString().sprintf("Failed to create %s database. Rddbmgr exit code=%d",
|
||||
db_name.toUtf8().constData(),
|
||||
rddbmgrProcess.exitCode());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// Create Rivendell MySQL database RDDbConfig
|
||||
//
|
||||
// (C) Copyright 2002-2018 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2002-2021 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
@@ -18,8 +18,7 @@
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
|
||||
#include <qsqldatabase.h>
|
||||
#include <qsqlquery.h>
|
||||
#include <QSqlQuery>
|
||||
|
||||
#include "db.h"
|
||||
|
||||
@@ -42,7 +41,7 @@ Db::Db(QString *err_str,RDConfig *config)
|
||||
db.setPassword(config->mysqlPassword());
|
||||
if(!db.open()) {
|
||||
*err_str+=QString().sprintf("Couldn't open MySQL connection on %s",
|
||||
(const char *)config->mysqlHostname());
|
||||
config->mysqlHostname().toUtf8().constData());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -69,10 +68,12 @@ void Db::clearDatabase(QString name)
|
||||
QSqlDatabase db=QSqlDatabase::database("Rivendell");
|
||||
|
||||
if(db.isOpen()){
|
||||
q=new QSqlQuery(QString().sprintf("drop database if exists `%s`",(const char *)name),db);
|
||||
q=new QSqlQuery(QString().sprintf("drop database if exists `%s`",
|
||||
name.toUtf8().constData()),db);
|
||||
delete q;
|
||||
|
||||
q=new QSqlQuery(QString().sprintf("create database `%s`",(const char *)name),db);
|
||||
q=new QSqlQuery(QString().sprintf("create database `%s`",
|
||||
name.toUtf8().constData()),db);
|
||||
delete q;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// mySQL Administrative Login widget for RDDbConfig
|
||||
//
|
||||
// (C) Copyright 2002-2020 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2002-2021 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
@@ -18,8 +18,7 @@
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
|
||||
#include <qlabel.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <QPushButton>
|
||||
|
||||
#include "mysql_login.h"
|
||||
|
||||
@@ -46,10 +45,10 @@ MySqlLogin::MySqlLogin(QString *username,QString *password, QWidget *parent)
|
||||
login_name_edit->setGeometry(sizeHint().width()/2-125+90,50,140,19);
|
||||
login_name_edit->setMaxLength(16);
|
||||
login_name_edit->setFocus();
|
||||
QLabel *login_name_label=new QLabel(login_name_edit,tr("&Username:"),this);
|
||||
QLabel *login_name_label=new QLabel(tr("Username:"),this);
|
||||
login_name_label->setFont(labelFont());
|
||||
login_name_label->setGeometry(sizeHint().width()/2-125,50,85,19);
|
||||
login_name_label->setAlignment(Qt::AlignRight|Qt::ShowPrefix);
|
||||
login_name_label->setAlignment(Qt::AlignRight);
|
||||
|
||||
//
|
||||
// MySql Login Password
|
||||
@@ -58,11 +57,10 @@ MySqlLogin::MySqlLogin(QString *username,QString *password, QWidget *parent)
|
||||
login_password_edit->setGeometry(sizeHint().width()/2-125+90,70,140,19);
|
||||
login_password_edit->setMaxLength(16);
|
||||
login_password_edit->setEchoMode(QLineEdit::Password);
|
||||
QLabel *login_password_label=
|
||||
new QLabel(login_password_edit,tr("&Password:"),this);
|
||||
QLabel *login_password_label=new QLabel(tr("Password:"),this);
|
||||
login_password_label->setFont(labelFont());
|
||||
login_password_label->setGeometry(sizeHint().width()/2-125,70,85,19);
|
||||
login_password_label->setAlignment(Qt::AlignRight|Qt::ShowPrefix);
|
||||
login_password_label->setAlignment(Qt::AlignRight);
|
||||
|
||||
//
|
||||
// OK Button
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// A Qt-based application to configure, backup, and restore
|
||||
// the Rivendell database.
|
||||
//
|
||||
// (C) Copyright 2009-2019 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2009-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
|
||||
@@ -24,10 +24,9 @@
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <qapplication.h>
|
||||
#include <qfiledialog.h>
|
||||
#include <qmessagebox.h>
|
||||
#include <qprocess.h>
|
||||
#include <QApplication>
|
||||
#include <QFileDialog>
|
||||
#include <QProcess>
|
||||
|
||||
#include <dbversion.h>
|
||||
#include <rdapplication.h>
|
||||
@@ -87,19 +86,19 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent)
|
||||
label->setAlignment(Qt::AlignCenter);
|
||||
|
||||
label_hostname=new QLabel(QString().sprintf("SQL Server: %s",
|
||||
(const char *)rd_config->mysqlHostname()),this);
|
||||
rd_config->mysqlHostname().toUtf8().constData()),this);
|
||||
label_hostname->setGeometry(0,5,sizeHint().width(),16);
|
||||
label_hostname->setFont(day_font);
|
||||
label_hostname->setAlignment(Qt::AlignCenter);
|
||||
|
||||
label_username=new QLabel(QString().sprintf("SQL Usename: %s",
|
||||
(const char *)rd_config->mysqlUsername()),this);
|
||||
rd_config->mysqlUsername().toUtf8().constData()),this);
|
||||
label_username->setGeometry(0,20,sizeHint().width(),16);
|
||||
label_username->setFont(day_font);
|
||||
label_username->setAlignment(Qt::AlignCenter);
|
||||
|
||||
label_dbname=new QLabel(QString().sprintf("SQL Database: %s",
|
||||
(const char *)rd_config->mysqlDbname()),this);
|
||||
rd_config->mysqlDbname().toUtf8().constData()),this);
|
||||
label_dbname->setGeometry(0,35,sizeHint().width(),16);
|
||||
label_dbname->setFont(day_font);
|
||||
label_dbname->setAlignment(Qt::AlignCenter);
|
||||
@@ -191,7 +190,7 @@ void MainWidget::mismatchData()
|
||||
if(!stderr.isEmpty()) {
|
||||
QMessageBox::information(this,"Database Modified with Warnings",
|
||||
QString().sprintf("Modified database to version %d with warnings:\n\n%s",
|
||||
RD_VERSION_DATABASE,(const char *)stderr));
|
||||
RD_VERSION_DATABASE,stderr.toUtf8().constData()));
|
||||
}
|
||||
else {
|
||||
QMessageBox::information(this,"Database Modified Successfully",
|
||||
@@ -296,7 +295,7 @@ void MainWidget::backupData()
|
||||
if (!db->isOpen()) {
|
||||
QMessageBox::critical(this,tr("RDDbConfig Error"),
|
||||
QString().sprintf("Could not open %s database.",
|
||||
(const char *)rd_config->mysqlDbname()));
|
||||
rd_config->mysqlDbname().toUtf8().constData()));
|
||||
return;
|
||||
}
|
||||
filename=QFileDialog::getSaveFileName(this,"RDDbConfig - "+
|
||||
@@ -307,9 +306,9 @@ void MainWidget::backupData()
|
||||
if (!filename.isEmpty()) {
|
||||
QProcess backupProcess(this);
|
||||
QStringList args;
|
||||
args << QString().sprintf("--user=%s",(const char *)rd_config->mysqlUsername())
|
||||
<< QString().sprintf("--password=%s",(const char *)rd_config->mysqlPassword())
|
||||
<< QString().sprintf("--host=%s",(const char *)rd_config->mysqlHostname())
|
||||
args << QString().sprintf("--user=%s",rd_config->mysqlUsername().toUtf8().constData())
|
||||
<< QString().sprintf("--password=%s",rd_config->mysqlPassword().toUtf8().constData())
|
||||
<< QString().sprintf("--host=%s",rd_config->mysqlHostname().toUtf8().constData())
|
||||
<< rd_config->mysqlDbname();
|
||||
backupProcess.setStandardOutputFile(filename);
|
||||
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
||||
@@ -323,11 +322,11 @@ void MainWidget::backupData()
|
||||
else {
|
||||
QMessageBox::information(this,"Database Backed Up Successfully",
|
||||
QString().sprintf("Backed up %s database to %s",
|
||||
(const char *)rd_config->mysqlDbname(),
|
||||
(const char *)filename));
|
||||
rd_config->mysqlDbname().toUtf8().constData(),
|
||||
filename.toUtf8().constData()));
|
||||
RDApplication::syslog(rd_config,LOG_INFO,"backed up %s database to %s",
|
||||
(const char *)rd_config->mysqlDbname(),
|
||||
(const char *)filename);
|
||||
rd_config->mysqlDbname().toUtf8().constData(),
|
||||
filename.toUtf8().constData());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -357,9 +356,9 @@ void MainWidget::restoreData()
|
||||
|
||||
QProcess restoreProcess(this);
|
||||
QStringList args;
|
||||
args << QString().sprintf("--user=%s",(const char *)rd_config->mysqlUsername())
|
||||
<< QString().sprintf("--password=%s",(const char *)rd_config->mysqlPassword())
|
||||
<< QString().sprintf("--host=%s",(const char *)rd_config->mysqlHostname())
|
||||
args << QString().sprintf("--user=%s",rd_config->mysqlUsername().toUtf8().constData())
|
||||
<< QString().sprintf("--password=%s",rd_config->mysqlPassword().toUtf8().constData())
|
||||
<< QString().sprintf("--host=%s",rd_config->mysqlHostname().toUtf8().constData())
|
||||
<< rd_config->mysqlDbname();
|
||||
restoreProcess.setStandardInputFile(filename);
|
||||
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
||||
@@ -374,11 +373,11 @@ void MainWidget::restoreData()
|
||||
else {
|
||||
QMessageBox::information(this,"Database Restored Successfully",
|
||||
QString().sprintf("Restored %s database from %s",
|
||||
(const char *)rd_config->mysqlDbname(),
|
||||
(const char *)filename));
|
||||
rd_config->mysqlDbname().toUtf8().constData(),
|
||||
filename.toUtf8().constData()));
|
||||
RDApplication::syslog(rd_config,LOG_INFO,"restored %s database from %s",
|
||||
(const char *)rd_config->mysqlDbname(),
|
||||
(const char *)filename);
|
||||
rd_config->mysqlDbname().toUtf8().constData(),
|
||||
filename.toUtf8().constData());
|
||||
}
|
||||
emit updateLabels();
|
||||
startDaemons();
|
||||
@@ -448,7 +447,6 @@ int main(int argc,char *argv[])
|
||||
RDConfig *config=new RDConfig();
|
||||
config->load();
|
||||
QApplication a(argc,argv);
|
||||
MainWidget *w=new MainWidget(config);
|
||||
a.setMainWidget(w);
|
||||
new MainWidget(config);
|
||||
return a.exec();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user