warningDialog("Connecting to Server",err,msg);
}
otabd = new QTabWidget(this);
oconfigureWin = new ConfigureWin(this,ocontrol);
ocontrolDataWin = new ControlDataWin(this,ocontrol);
opupeDiagnosticsWin = new PupeDiagnosticsWin(this,ocontrol);
opupeSimulateWin = new PupeSimulateWin(this,ocontrol);
otestWin = new TestWin(this,ocontrol);
ostatisticsWin = new StatisticsWin(this,ocontrol);
ostatusWin = new StatusWin(this,ocontrol);
ooptionsWin = new OptionsWin(this,ocontrol);
ophaseTableWin = new PhaseTableWin(this,ocontrol);
setCentralWidget(otabd);
otabd->setName("Tab Widget");
otabd->setMinimumSize(1000,860);
otabd->setTabPosition(QTabWidget::Bottom);
otabd->addTab(oconfigureWin,"Configure System");
otabd->addTab(ocontrolDataWin,"Control/Data View");
otabd->addTab(opupeDiagnosticsWin,"Pupe Diagnostics");
otabd->addTab(opupeSimulateWin,"Pupe Simulation");
otabd->addTab(ophaseTableWin,"Cycle Params");
otabd->addTab(otestWin,"Server SelfTest");
otabd->addTab(ostatusWin,"Status");
otabd->addTab(ostatisticsWin,"Statistics");
otabd->show();
oconfigureWin->show();
f = qApp->font();
f.setPointSize(10);
qApp->setFont(f,true);
gstatusbar = statusBar();
}
void TmsControlMainWin::slotQuit() {
exit(0);
}
void TmsControlMainWin::initToolbar() {
}
void TmsControlMainWin::slotPrefferences() {
ooptionsWin->show();
}
void TmsControlMainWin::slotEnterWhatsThis() {
whatsThis();
}
void TmsControlMainWin::warningDialog(BString title,BError err,BString msg){
BString m;
m = BString("<h5>") + title + "</h5><p>" + msg + "<br>" + err.getString() + "</p>";
QMessageBox::warning(this, "tmsControlGui - Warning", m.retStr());
}
void TmsControlMainWin::slotNewConnection() {
BError err;
bool ok;
BString host = ghostName;
QString s = host.retStr();
// host = QInputDialog::getText("tsmControlGui", "Enter Host Name:",QLineEdit::Normal,QString::null, &ok, this );
host = QInputDialog::getText("tsmControlGui", "Enter Host Name:",QLineEdit::Normal, s, &ok, this );
if (ok && (host.len() > 0)) {
ghostName = host;
ocontrol.setHost(host);
}
if (err = ocontrol.init()) {
BString msg = BString("Attempting to conect to (") + host + ")";
warningDialog("Connecting to Remote",err,msg);
}
}
void TmsControlMainWin::configurationChanged() {
}
void TmsControlMainWin::slotAbout() {
BString msg;
QImage logo("alphadata_beam_logo.png");
QMessageBox mbox(this);
msg = "<p><b>tmsControlGui</b> - Trajectory Measurement System Test Interface</p>";
msg += BString("<p>© BEAM Ltd 2007</p><p>Version: ") + VERSION + "</p>";
mbox.setIconPixmap(logo);
mbox.setCaption("About");
mbox.setText(msg.retStr());
mbox.exec();
}
void TmsControlMainWin::slotManual() {
BIter i;
BList<BString> fnames;
BString fname;
BString cmd;
fnames.append("/usr/tms/doc/TmsControlGui.pdf");
fnames.append("./TmsControlGui.pdf");
fnames.append("../doc/TmsControlGui.pdf");
fnames.append("../../doc/TmsControlGui.pdf");
for (fnames.start(i);! fnames.isEnd(i); fnames.next(i)) {
if (access(fnames[i].retStr(),R_OK) == 0) {
fname = fnames[i];
break;
}
}
if (! fnames.isEnd(i)) {
cmd =BString("firefox ") + fname + "&";
system(cmd.retStr());
}
else {
QMessageBox::warning(this, "Warning", "Unable to locate the help files");
}
}
void TmsControlMainWin::slotTmsManual() {
BIter i;
BList<BString> fnames;
BString fname;
BString cmd;
fnames.append("/usr/tms/doc/index.html");
fnames.append("./index.html");
fnames.append("../doc/index.html");
fnames.append("../../doc/index.html");
for (fnames.start(i);! fnames.isEnd(i); fnames.next(i)) {
if (access(fnames[i].retStr(),R_OK) == 0) {
fname = fnames[i];
break;
}
}
if (! fnames.isEnd(i)) {
cmd =BString("firefox ") + fname + "&";
system(cmd.retStr());
}
else {
QMessageBox::warning(this, "Warning", "Unable to locate the help files");
}
}