RDSqlQuery::RDSqlQuery (const QString &query, QSqlDatabase *dbase): QSqlQuery (query,dbase) { //printf("lastQuery: %s\n",(const char *)lastQuery()); // With any luck, by the time we get here, we have already done the biz... unsigned schema; if (!isActive()){ //DB Offline? QString err=QObject::tr("invalid SQL or failed DB connection")+ +"["+lastError().text()+"]: "+query; fprintf(stderr,"%s\n",(const char *)err); #ifndef WIN32 syslog(LOG_ERR,(const char *)err); #endif // WIN32 QSqlDatabase *ldb = QSqlDatabase::database(); // Something went wrong with the DB, trying a reconnect ldb->removeDatabase(RDConfiguration()->mysqlDbname()); ldb->close(); db = NULL; RDInitDb (&schema); QSqlQuery::prepare (query); QSqlQuery::exec (); if (RDDbStatus()){ if (isActive()){ RDDbStatus()->sendRecon(); } else { RDDbStatus()->sendDiscon(query); } } } else { RDDbStatus()->sendRecon(); } }
MainObject::MainObject(QObject *parent,const char *name) : QObject(parent,name) { // // Read Command Options // RDCmdSwitch *cmd= new RDCmdSwitch(qApp->argc(),qApp->argv(),"sas_filter",SAS_FILTER_USAGE); delete cmd; rd_config=new RDConfig(RD_CONF_FILE); rd_config->load(); filter_switch_count=0; filter_macro_count=0; // // Open Database // QString err(tr("sas_filter: ")); filter_db=RDInitDb (&err); if(!filter_db) { fprintf(stderr,"%s\n",err.ascii()); exit(1); } // // RIPCD Connection // filter_ripc=new RDRipc(""); filter_ripc->connectHost("localhost",RIPCD_TCP_PORT,rd_config->password()); // // Station Configuration // filter_rdstation=new RDStation(rd_config->stationName()); // // RDCatchd Connection // filter_connect=new RDCatchConnect(0,this,"filter_connect"); filter_connect->connectHost("localhost",RDCATCHD_TCP_PORT, rd_config->password()); // // Read Switches // if((qApp->argc()==2)&&(!strcmp(qApp->argv()[1],"-d"))) { // Delete List DeleteList(); filter_connect->reset(); exit(0); } if((qApp->argc()==3)&&(!strcmp(qApp->argv()[1],"-i"))) { // Insert List InsertList(); filter_connect->reset(); exit(0); } fprintf(stderr,"\nsas_filter %s\n",SAS_FILTER_USAGE); exit(1); }
MainWidget::MainWidget(QWidget *parent,const char *name) :QWidget(parent,name) { unsigned schema=0; // // Fix the Window Size // setMinimumWidth(sizeHint().width()); setMaximumWidth(sizeHint().width()); setMinimumHeight(sizeHint().height()); setMaximumHeight(sizeHint().height()); // // Generate Fonts // QFont font("Helvetica",12,QFont::Normal); font.setPixelSize(12); // // Open Database // rd_config=new RDConfig(RD_CONF_FILE); rd_config->load(); QString err; test_db=RDInitDb(&schema,&err); if(!test_db) { QMessageBox::warning(this,"Can't Connect", err,0,1,1); exit(0); } // // Generate Button // QPushButton *button=new QPushButton(this,"generate_button"); button->setGeometry(10,10,sizeHint().width()-20,50); button->setText("Generate Test"); button->setFont(font); connect(button,SIGNAL(clicked()),this,SLOT(generateData())); // // Remove Button // button=new QPushButton(this,"remove_button"); button->setGeometry(10,70,sizeHint().width()-20,50); button->setText("Remove Test"); button->setFont(font); connect(button,SIGNAL(clicked()),this,SLOT(removeData())); // // Exit Button // button=new QPushButton(this,"cancel_button"); button->setGeometry(10,130,sizeHint().width()-20,50); button->setText("Exit"); button->setFont(font); connect(button,SIGNAL(clicked()),this,SLOT(cancelData())); }
bool MainObject::OpenDb() { unsigned schema=0; QString err(tr("rdcheckcuts: ")); QSqlDatabase *db=RDInitDb(&schema,&err); if(!db) { fprintf(stderr,err.ascii()); return false; } return true; }
MainObject::MainObject(QObject *parent,const char *name) :QObject(parent,name) { // // Read Command Options // RDCmdSwitch *cmd= new RDCmdSwitch(qApp->argc(),qApp->argv(),"ripcd",RIPCD_USAGE); delete cmd; // // Load Local Configs // ripcd_config=new RDConfig(RD_CONF_FILE); ripcd_config->load(); // // Make sure we're the only instance running // if(RDCheckDaemon(RD_RIPCD_PID)) { LogLine(RDConfig::LogErr, "ERROR ripcd aborting - multiple instances not allowed"); exit(1); } // // Initialize Data Structures // debug=false; for(int i=0;i<RIPCD_MAX_CONNECTIONS;i++) { socket[i]=NULL; istate[i]=0; argnum[i]=0; argptr[i]=0; auth[i]=false; } for(int i=0;i<MAX_MATRICES;i++) { for(int j=0;j<MAX_GPIO_PINS;j++) { ripcd_gpi_state[i][j]=false; ripcd_gpo_state[i][j]=false; } } ripc_onair_flag=false; server=new RipcdSocket(RIPCD_TCP_PORT,0,this,"socket"); if(!server->ok()) { exit(1); } connect(server,SIGNAL(connection(int)),this,SLOT(newConnection(int))); // // Macro Timers // QSignalMapper *mapper=new QSignalMapper(this,"macro_timer_mapper"); connect(mapper,SIGNAL(mapped(int)),this,SLOT(macroTimerData(int))); for(int i=0;i<RD_MAX_MACRO_TIMERS;i++) { ripc_macro_cart[i]=0; ripc_macro_timer[i]=new QTimer(this); mapper->setMapping(ripc_macro_timer[i],i); connect(ripc_macro_timer[i],SIGNAL(timeout()),mapper,SLOT(map())); } // // Open Database // QString err (tr("ripcd: ")); ripcd_db = RDInitDb (&err); if(!ripcd_db) { printf ("%s\n",err.ascii()); exit (1); } connect (RDDbStatus(),SIGNAL(logText(RDConfig::LogPriority,const QString &)), this,SLOT(log(RDConfig::LogPriority,const QString &))); // // CAE Connection // rdcae=new RDCae(parent,name); rdcae->connectHost("localhost",CAED_TCP_PORT,ripcd_config->password()); // // Station // rdstation=new RDStation(ripcd_config->stationName()); rdstation->setUserName(rdstation->defaultName()); ripcd_host_addr=rdstation->address(); if(qApp->argc()==1) { RDDetach(ripcd_config->logCoreDumpDirectory()); } else { debug=true; } ::signal(SIGCHLD,SigHandler); ::signal(SIGTERM,SigHandler); ::signal(SIGINT,SigHandler); if(!RDWritePid(RD_PID_DIR,"ripcd.pid",ripcd_config->uid())) { printf("ripcd: can't write pid file\n"); exit(1); } // // The RML Sockets // ripcd_rml_send=new QSocketDevice(QSocketDevice::Datagram); ripcd_rml_echo=new QSocketDevice(QSocketDevice::Datagram); ripcd_rml_echo->bind(QHostAddress(),RD_RML_ECHO_PORT); ripcd_rml_echo->setBlocking(false); ripcd_rml_noecho=new QSocketDevice(QSocketDevice::Datagram); ripcd_rml_noecho->bind(QHostAddress(),RD_RML_NOECHO_PORT); ripcd_rml_noecho->setBlocking(false); ripcd_rml_reply=new QSocketDevice(QSocketDevice::Datagram); ripcd_rml_reply->bind(QHostAddress(),RD_RML_REPLY_PORT); ripcd_rml_reply->setBlocking(false); LoadGpiTable(); // // Initialize local RMLs // LoadLocalMacros(); // // Start RML Polling // QTimer *timer=new QTimer(this,"timer"); timer->changeInterval(RIPCD_RML_READ_INTERVAL); connect(timer,SIGNAL(timeout()),this,SLOT(readRml())); timer->start(true); // // Database Backup Timer // databaseBackup(); ripcd_backup_timer=new QTimer(this,"ripcd_backup_timer"); connect(ripcd_backup_timer,SIGNAL(timeout()),this,SLOT(databaseBackup())); ripcd_backup_timer->start(86400000); // // Maintenance Routine Timer // srandom(QTime::currentTime().msec()); ripcd_maint_timer=new QTimer(this,"ripcd_maint_timer"); connect(ripcd_maint_timer,SIGNAL(timeout()),this,SLOT(checkMaintData())); int interval=GetMaintInterval(); ripcd_maint_timer->start(interval); LogLine(RDConfig::LogInfo,"started"); }
MainWidget::MainWidget(QWidget *parent) :QWidget(parent) { bool skip_db_check=false; unsigned schema=0; // // Force a reasonable default font. // QFont mfont("helvetica",12,QFont::Normal); mfont.setPixelSize(12); qApp->setFont(mfont); // // Load Local Configs // panel_config=new RDConfig(); panel_config->load(); // // Load the command-line arguments // RDCmdSwitch *cmd=new RDCmdSwitch(qApp->argc(),qApp->argv(),"rdcartslots", RDCARTSLOTS_USAGE); for(unsigned i=0;i<cmd->keys();i++) { if(cmd->key(i)=="--skip-db-check") { skip_db_check=true; } } // // Create Icons // lib_rivendell_map=new QPixmap(rivendell_xpm); setIcon(*lib_rivendell_map); // // Ensure that system daemons are running // RDInitializeDaemons(); // // Open Database // QString err; QSqlDatabase *db=RDInitDb(&schema,&err); if(!db) { QMessageBox::warning(this,tr("Can't Connect"),err); exit(0); } if((schema!=RD_VERSION_DATABASE)&&(!skip_db_check)) { fprintf(stderr, "rdcastmanager: database version mismatch, should be %u, is %u\n", RD_VERSION_DATABASE,schema); exit(256); } new RDDbHeartbeat(panel_config->mysqlHeartbeatInterval(),this); // // Allocate Global Resources // panel_station=new RDStation(panel_config->stationName()); panel_system=new RDSystem(); // // RDAirPlay Configuration // panel_airplay_conf=new RDAirPlayConf(panel_config->stationName(),"RDAIRPLAY"); // // CAE Connection // panel_cae=new RDCae(panel_station,panel_config,parent); panel_cae->connectHost(); // // RIPC Connection // panel_ripc=new RDRipc(panel_config->stationName()); connect(panel_ripc,SIGNAL(userChanged()),this,SLOT(userData())); connect(panel_ripc,SIGNAL(rmlReceived(RDMacro *)), this,SLOT(rmlReceivedData(RDMacro *))); // // User // panel_user=NULL; // // Service Picker // panel_svcs_dialog=new RDListSvcs(tr("RDCartSlots"),this); // // Macro Player // panel_player=new RDEventPlayer(panel_ripc,this); // // Dialogs // panel_cart_dialog=new RDCartDialog(&panel_filter,&panel_group, &panel_schedcode,panel_cae,panel_ripc, panel_station,panel_system,panel_config, this); panel_slot_dialog=new RDSlotDialog(tr("RDCartSlots"),this); panel_cue_dialog=new RDCueEditDialog(panel_cae,panel_station->cueCard(), panel_station->cuePort(), tr("RDCartSlots"),this); // // Cart Slots // QTimer *timer=new QTimer(this); for(int i=0;i<panel_station->cartSlotColumns();i++) { for(int j=0;j<panel_station->cartSlotRows();j++) { panel_slots. push_back(new RDCartSlot(panel_slots.size(),panel_ripc,panel_cae, panel_station,panel_config,panel_svcs_dialog, panel_slot_dialog,panel_cart_dialog, panel_cue_dialog,tr("RDCartSlots"), panel_airplay_conf,this)); panel_slots.back()-> setGeometry(10+i*(panel_slots.back()->sizeHint().width()+10), 10+j*(panel_slots.back()->sizeHint().height()+5), panel_slots.back()->sizeHint().width(), panel_slots.back()->sizeHint().height()); connect(timer,SIGNAL(timeout()), panel_slots.back(),SLOT(updateMeters())); } } timer->start(METER_INTERVAL); panel_ripc->connectHost("localhost",RIPCD_TCP_PORT,panel_config->password()); // // Fix the Window Size // #ifndef RESIZABLE setMinimumWidth(sizeHint().width()); setMaximumWidth(sizeHint().width()); setMinimumHeight(sizeHint().height()); setMaximumHeight(sizeHint().height()); #endif // RESIZABLE }
MainWidget::MainWidget(QWidget *parent,const char *name) :QWidget(parent,name) { login_user_width=160; QString str; QString sql; RDSqlQuery *q; // // HACK: Disable the Broken Custom SuSE Dialogs // setenv("QT_NO_KDE_INTEGRATION","1",1); // // Read Command Options // RDCmdSwitch *cmd=new RDCmdSwitch(qApp->argc(),qApp->argv(),"rdlogin","\n"); delete cmd; // // Fix the Window Size // setMinimumWidth(sizeHint().width()); setMinimumHeight(sizeHint().height()); setMaximumHeight(sizeHint().height()); // // Generate Fonts // QFont default_font("Helvetica",12,QFont::Normal); default_font.setPixelSize(12); qApp->setFont(default_font); QFont button_font=QFont("Helvetica",12,QFont::Bold); button_font.setPixelSize(12); QFont label_font=QFont("Helvetica",16,QFont::Bold); label_font.setPixelSize(12); QFont small_label_font=QFont("Helvetica",12,QFont::Bold); small_label_font.setPixelSize(12); QFont line_edit_font=QFont("Helvetica",12,QFont::Normal); line_edit_font.setPixelSize(12); // // Create And Set Icon // login_rivendell_map=new QPixmap(rivendell_xpm); setIcon(*login_rivendell_map); // // Text Validator // RDTextValidator *validator=new RDTextValidator(this,"validator"); // // Ensure that the system daemons are running // RDInitializeDaemons(); // // Load Configs // login_config=new RDConfig(); login_config->load(); str=QString(tr("RDLogin - Station:")); setCaption(QString().sprintf("%s %s",(const char *)str, (const char *)login_config->stationName())); // // Open Database // QString err(tr("rdlogin : "******"Can't Connect"),err); exit(0); } // // RIPC Connection // login_ripc=new RDRipc(login_config->stationName()); connect(login_ripc,SIGNAL(connected(bool)),this,SLOT(connectedData(bool))); connect(login_ripc,SIGNAL(userChanged()),this,SLOT(userData())); login_ripc->connectHost("localhost",RIPCD_TCP_PORT, login_config->password()); // // Station // login_station=new RDStation(login_config->stationName()); // // User Label // login_label=new QLabel(this,"login_label"); login_label->setFont(label_font); login_label->setAlignment(AlignCenter); login_label->setText(tr("Current User: unknown")); // // User Name // login_username_box=new QComboBox(this,"login_username_box"); login_username_box->setFont(line_edit_font); login_username_box->setFocus(); QFontMetrics fm(line_edit_font); sql="select LOGIN_NAME from USERS where ADMIN_CONFIG_PRIV=\"N\"\ order by LOGIN_NAME"; q=new RDSqlQuery(sql); while(q->next()) { login_username_box->insertItem(q->value(0).toString()); if(fm.width(q->value(0).toString())>login_user_width) { login_user_width=fm.width(q->value(0).toString()); } } delete q; if(login_user_width>900) { login_user_width=900; } login_username_label=new QLabel(login_username_box,tr("&Username:"******"login_username_label"); login_username_label->setFont(small_label_font); login_username_label->setAlignment(AlignRight|AlignVCenter|ShowPrefix); // // Password // login_password_edit=new QLineEdit(this,"login_password_edit"); login_password_edit->setFont(line_edit_font); login_password_edit->setMaxLength(16); login_password_edit->setValidator(validator); login_password_edit->setEchoMode(QLineEdit::Password); login_password_label=new QLabel(login_password_edit,tr("&Password:"******"login_password_label"); login_password_label->setFont(small_label_font); login_password_label->setAlignment(AlignRight|AlignVCenter|ShowPrefix); connect(login_password_edit,SIGNAL(returnPressed()),this,SLOT(loginData())); // // Login Button // login_button=new QPushButton(this,"login_button"); login_button->setFont(button_font); login_button->setText(tr("&Set User")); connect(login_button,SIGNAL(clicked()),this,SLOT(loginData())); // // Logout Button // logout_button=new QPushButton(this,"logout_button"); logout_button->setFont(button_font); logout_button->setText(tr("&Default\nUser")); connect(logout_button,SIGNAL(clicked()),this,SLOT(logoutData())); // // Cancel Button // cancel_button=new QPushButton(this,"cancel_button"); cancel_button->setFont(button_font); cancel_button->setText(tr("&Cancel")); connect(cancel_button,SIGNAL(clicked()),this,SLOT(cancelData())); resizeEvent(NULL); }
MainObject::MainObject(QObject *parent,const char *name) :QObject(parent,name) { username="******"; password=""; destination_settings=new RDSettings(); cart_number=0; cut_number=0; use_metadata=false; bool ok=false; RDAudioConvert::ErrorCode audio_conv_err; RDAudioImport::ErrorCode conv_err; unsigned schema=0; // // Read Command Options // RDCmdSwitch *cmd= new RDCmdSwitch(qApp->argc(),qApp->argv(),"audio_import_test", AUDIO_IMPORT_TEST_USAGE); for(unsigned i=0;i<cmd->keys();i++) { if(cmd->key(i)=="--username") { username=cmd->value(i); cmd->setProcessed(i,true); } if(cmd->key(i)=="--password") { password=cmd->value(i); cmd->setProcessed(i,true); } if(cmd->key(i)=="--cart-number") { cart_number=cmd->value(i).toUInt(&ok); if((!ok)||(cart_number>999999)) { fprintf(stderr,"audio_import_test: invalid cart number\n"); exit(256); } cmd->setProcessed(i,true); } if(cmd->key(i)=="--cut-number") { cut_number=cmd->value(i).toUInt(&ok); if((!ok)||(cut_number>999)) { fprintf(stderr,"audio_import_test: invalid cut number\n"); exit(256); } cmd->setProcessed(i,true); } if(cmd->key(i)=="--source-file") { source_filename=cmd->value(i); cmd->setProcessed(i,true); } if(cmd->key(i)=="--destination-channels") { unsigned channels=cmd->value(i).toInt(&ok); if(!ok) { fprintf(stderr,"audio_import_test: invalid destination channels\n"); exit(256); } destination_settings->setChannels(channels); cmd->setProcessed(i,true); } if(cmd->key(i)=="--normalization-level") { int normalization_level=cmd->value(i).toInt(&ok); if((!ok)||(normalization_level>0)) { fprintf(stderr,"audio_import_test: invalid normalization level\n"); exit(256); } destination_settings->setNormalizationLevel(normalization_level); cmd->setProcessed(i,true); } if(cmd->key(i)=="--autotrim-level") { int autotrim_level=cmd->value(i).toInt(&ok); if((!ok)||(autotrim_level>0)) { fprintf(stderr,"audio_import_test: invalid autotrim level\n"); exit(256); } destination_settings->setAutotrimLevel(autotrim_level); cmd->setProcessed(i,true); } if(cmd->key(i)=="--use-metadata") { use_metadata=true; cmd->setProcessed(i,true); } } if(cart_number==0) { fprintf(stderr,"audio_import_test: missing cart-number\n"); exit(256); } if(cut_number==0) { fprintf(stderr,"audio_import_test: missing cut-number\n"); exit(256); } if(source_filename.isEmpty()) { fprintf(stderr,"audio_import_test: missing source-file\n"); exit(256); } // // Read Configuration // rdconfig=new RDConfig(); rdconfig->load(); // // Open Database // QString err (tr("audio_import_test: ")); QSqlDatabase *db=RDInitDb(&schema,&err); if(!db) { fprintf(stderr,err.ascii()); delete cmd; exit(256); } RDStation *station=new RDStation(rdconfig->stationName()); RDAudioImport *conv=new RDAudioImport(station,rdconfig,this); conv->setCartNumber(cart_number); conv->setCutNumber(cut_number); conv->setSourceFile(source_filename); conv->setDestinationSettings(destination_settings); conv->setUseMetadata(use_metadata); printf("Importing...\n"); conv_err=conv->runImport(username,password,&audio_conv_err); printf("Result: %s\n", (const char *)RDAudioImport::errorText(conv_err,audio_conv_err)); delete conv; exit(0); }
MainWidget::MainWidget(QWidget *parent,const char *name) :QWidget(parent,name) { // // HACK: Disable the Broken Custom SuSE Dialogs // #ifndef WIN32 setenv("QT_NO_KDE_INTEGRATION","1",1); #endif // WIN32 // // Read Command Options // bool cmd_generate = false; bool cmd_merge_music = false; bool cmd_merge_traffic = false; QString cmd_service = NULL; QDate cmd_date = QDate::currentDate().addDays(1); RDCmdSwitch *cmd= new RDCmdSwitch(qApp->argc(),qApp->argv(),"rdlogmanager","\n"); for(unsigned i=0;i<cmd->keys();i++) { if (cmd->key(i)=="-g") cmd_generate = true; if (cmd->key(i)=="-m") cmd_merge_music = true; if (cmd->key(i)=="-t") cmd_merge_traffic = true; if (cmd->key(i)=="-s") if (i+1<cmd->keys()) { i++; cmd_service = cmd->key(i); } if (cmd->key(i)=="-d") if (i+1<cmd->keys()) { i++; cmd_date = QDate::currentDate().addDays(cmd->key(i).toInt()); } } delete cmd; // // Fix the Window Size // setMinimumWidth(sizeHint().width()); setMaximumWidth(sizeHint().width()); setMinimumHeight(sizeHint().height()); setMaximumHeight(sizeHint().height()); // // Ensure that the system daemons are running // #ifndef WIN32 RDInitializeDaemons(); #endif // WIN32 // // Load Local Configs // log_config=new RDConfig(); log_config->load(); setCaption(tr("RDLogManager")); // // Open Database // QString err; log_db=RDInitDb(&err); if(!log_db) { QMessageBox::warning(this,tr("Can't Connect"),err); exit(0); } new RDDbHeartbeat(log_config->mysqlHeartbeatInterval(),this); // // Allocate Global Resources // rdstation_conf=new RDStation(log_config->stationName()); // // CAE Connection // #ifndef WIN32 rdcae=new RDCae(parent,name); rdcae->connectHost("localhost",CAED_TCP_PORT,log_config->password()); #endif // WIN32 // // RIPC Connection // rdripc=new RDRipc(log_config->stationName()); connect(rdripc,SIGNAL(userChanged()),this,SLOT(userData())); rdripc->connectHost("localhost",RIPCD_TCP_PORT,log_config->password()); // // User // rduser=NULL; // // Generate Fonts // QFont default_font("Helvetica",12,QFont::Normal); default_font.setPixelSize(12); qApp->setFont(default_font); QFont button_font=QFont("Helvetica",12,QFont::Bold); button_font.setPixelSize(12); QFont label_font=QFont("Helvetica",12,QFont::Bold); label_font.setPixelSize(12); QFont day_font=QFont("Helvetica",12,QFont::Normal); day_font.setPixelSize(12); // // Create And Set Icon // log_rivendell_map=new QPixmap(rivendell_xpm); setIcon(*log_rivendell_map); // // Filters // event_filter=new QString(); clock_filter=new QString(); // // Title Label // QLabel *label=new QLabel(tr("RDLogManager"),this,"title_label"); label->setGeometry(0,5,sizeHint().width(),32); label->setFont(label_font); label->setAlignment(AlignHCenter); label=new QLabel(tr("Select an operation:"),this,"instruction_label"); label->setGeometry(0,25,sizeHint().width(),16); label->setFont(day_font); label->setAlignment(AlignCenter); // // Edit Events Button // log_events_button=new QPushButton(this,"events_button"); log_events_button->setGeometry(10,45,sizeHint().width()-20,50); log_events_button->setFont(button_font); log_events_button->setText(tr("Edit &Events")); connect(log_events_button,SIGNAL(clicked()),this,SLOT(eventsData())); // // Edit Clocks Button // log_clocks_button=new QPushButton(this,"clocks_button"); log_clocks_button->setGeometry(10,95,sizeHint().width()-20,50); log_clocks_button->setFont(button_font); log_clocks_button->setText(tr("Edit C&locks")); connect(log_clocks_button,SIGNAL(clicked()),this,SLOT(clocksData())); // // Edit Grids Button // log_grids_button=new QPushButton(this,"grid_button"); log_grids_button->setGeometry(10,145,sizeHint().width()-20,50); log_grids_button->setFont(button_font); log_grids_button->setText(tr("Edit G&rids")); connect(log_grids_button,SIGNAL(clicked()),this,SLOT(gridsData())); // // Generate Logs Button // log_logs_button=new QPushButton(this,"logs_button"); log_logs_button->setGeometry(10,195,sizeHint().width()-20,50); log_logs_button->setFont(button_font); log_logs_button->setText(tr("&Generate Logs")); connect(log_logs_button,SIGNAL(clicked()),this,SLOT(generateData())); // // Generate Reports Button // log_reports_button=new QPushButton(this,"reports_button"); log_reports_button->setGeometry(10,245,sizeHint().width()-20,50); log_reports_button->setFont(button_font); log_reports_button->setText(tr("Manage &Reports")); connect(log_reports_button,SIGNAL(clicked()),this,SLOT(reportsData())); // // Close Button // log_close_button=new QPushButton(this,"close_button"); log_close_button->setGeometry(10,sizeHint().height()-60, sizeHint().width()-20,50); log_close_button->setFont(button_font); log_close_button->setText(tr("&Close")); log_close_button->setDefault(true); connect(log_close_button,SIGNAL(clicked()),this,SLOT(quitMainWidget())); if (cmd_generate) { GenerateLog *generatelog=new GenerateLog(this,"list_grids",1,&cmd_service,&cmd_date); delete generatelog; } if (cmd_merge_music) { GenerateLog *generatelog=new GenerateLog(this,"list_grids",2,&cmd_service,&cmd_date); delete generatelog; } if (cmd_merge_traffic) { GenerateLog *generatelog=new GenerateLog(this,"list_grids",3,&cmd_service,&cmd_date); delete generatelog; } if (cmd_generate || cmd_merge_music ||cmd_merge_traffic ) quitMainWidget(); #ifndef WIN32 signal(SIGCHLD,SigHandler); #endif // WIN32 }
bool MainWidget::HighLevelDbTests(RDUnitTestData *data) { QString sql; // QSqlQuery *q; RDSqlQuery *r; QString err_str; // bool pass; bool ret=true; data->clear(); data->setGroupName("High-Level Database Tests"); // // Create Database Test // ret=ret&&RDMakeDb(&err_str,rda->config()); if(ret) { data->addTest("Create Database Test",ret); } else { data->addTest("Create Database Test",ret,err_str); return ret; } // // Initialize Database Test // ret=ret&&RDInitDb(&err_str,rda->config()); if(ret) { data->addTest("Initialize Database Test",ret); } else { data->addTest("Initialize Database Test",ret,err_str); return ret; } // // Host Creation Test // sql=QString("select NAME from STATIONS"); r=new RDSqlQuery(sql); if(r->first()) { if(r->value(0).toString()==rda->config()->stationName()) { data->addTest("Host Creation Test",true); } else { data->addTest("Host Creation Test",false,"Created hostname: "+ r->value(0).toString()); } } else { data->addTest("Host Creation Test",false,"No station records found"); } delete r; // // Clean Up // RemoveAllTables(); return ret; }