2018-10-26 Fred Gleason <fredg@paravelsystems.com>

* Added a warning when starting a module if the host does not
	have a corresponding entry in the database.
This commit is contained in:
Fred Gleason
2018-10-26 10:57:41 -04:00
parent 326de7c1aa
commit 501ed6ae1f
10 changed files with 107 additions and 3 deletions

View File

@@ -93,12 +93,16 @@ RDApplication::~RDApplication()
}
bool RDApplication::open(QString *err_msg)
bool RDApplication::open(QString *err_msg,RDApplication::ErrorType *err_type)
{
int schema=0;
QString db_err;
bool skip_db_check=false;
if(err_type!=NULL) {
*err_type=RDApplication::ErrorOk;
}
//
// Read command switches
//
@@ -126,6 +130,9 @@ bool RDApplication::open(QString *err_msg)
return false;
}
if((RD_VERSION_DATABASE!=schema)&&(!skip_db_check)) {
if(err_type!=NULL) {
*err_type=RDApplication::ErrorDbVersionSkew;
}
*err_msg=QObject::tr("Database version mismatch, should be")+
QString().sprintf(" %u, ",RD_VERSION_DATABASE)+
QObject::tr("is")+
@@ -137,8 +144,17 @@ bool RDApplication::open(QString *err_msg)
//
// Open Accessors
//
app_system=new RDSystem();
app_station=new RDStation(app_config->stationName());
if(!app_station->exists()) {
if(err_type!=NULL) {
*err_type=RDApplication::ErrorNoHostEntry;
}
*err_msg=QObject::tr("This host")+" (\""+app_config->stationName()+"\") "+
QObject::tr("does not have a Hosts entry in the database.")+"\n"+
QObject::tr("Open RDAdmin->ManageHosts->Add to create one.");
return false;
}
app_system=new RDSystem();
app_library_conf=new RDLibraryConf(app_config->stationName());
app_logedit_conf=new RDLogeditConf(app_config->stationName());
app_airplay_conf=new RDAirPlayConf(app_config->stationName(),"RDAIRPLAY");