/* find gpl GhostScript version */ double getGSVersion() { QProcess process; QString Stversion; bool ok; double GS_version = 0.00; QRegExp regExp1(" (\\d+)\\.(\\d+).*"); process.setReadChannelMode(QProcess::MergedChannels); process.start( getGSDefaultExeName() , QStringList() << "-v"); if (!process.waitForFinished()) { return GS_version; } else { QString pu = process.readAll(); QStringList line1 = pu.split("\n"); int pos1 = regExp1.indexIn(line1.at(0)); /* only first line */ if (pos1 > 0) { Stversion = QString("%1.%2").arg(regExp1.cap(1).toInt()).arg(regExp1.cap(2).toInt()); double GS_version = Stversion.toDouble(&ok); if (ok && GS_version > 5) { return GS_version; } } else { return GS_version; } } return GS_version; }
double JavaVersion() { QProcess process; QString Stversion; bool ok; double js_version = 0.00; QRegExp regExp1(" (\\d+)\\.(\\d+).*"); process.setReadChannelMode(QProcess::MergedChannels); process.start( "java" , QStringList() << "-version"); if (!process.waitForFinished()) { return js_version; } else { QString pu = process.readAll(); /////QStringList line1 = pu.split("\n"); ////////qDebug() << "### jsversion " << pu; int pos1 = regExp1.indexIn(pu); /* only first line */ if (pos1 > 0) { Stversion = QString("%1.%2").arg(regExp1.cap(1).toInt()).arg(regExp1.cap(2).toInt()); double js_version = Stversion.toDouble(&ok); if (ok && js_version > 1) { return js_version; } } else { return js_version; } } return js_version; }
checkInForm::checkInForm(QWidget *parent) : QDialog(parent), ui(new Ui::checkInForm) { ui->setupUi(this); QRegExp regExp1("[A-Za-z][A-Za-z ]*[A-Za-z0-9]*"); ui->nameText->setValidator(new QRegExpValidator(regExp1, this)); QRegExp regExp2("[1-9][0-9]*[0-9]*"); ui->phone->setValidator(new QRegExpValidator(regExp2, this)); QRegExp regExp3("[A-Za-z0-9][A-Za-z0-9, ]*[A-Za-z0-9 ]*"); ui->addText->setValidator(new QRegExpValidator(regExp3, this)); QRegExp regExp4("[0-9]{8,8}"); ui->LinCIN->setValidator(new QRegExpValidator(regExp4, this)); QDate QDTime = QDate::currentDate(); QDTime.addDays(1); ui->datedepart2->setDate(QDTime); ui->datedepart2->setShown(1); ui->dated2->setShown(1); ui->dated->setShown(0); ui->datedepart->setShown(0); setupview(); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), bin(new binary) { setupUi(this); //setGeometry(400, 250, 542, 390); // define theta double dth = PI / (Ntheta); for(int i=0; i<Ntheta; i++) theta[i] = i*dth; // set up regexp validator so numerical inputs can only be numbers QRegExp regExp1("[1-9][0-9.]{0,3}"); mass1Edit->setValidator(new QRegExpValidator(regExp1, this)); mass2Edit->setValidator(new QRegExpValidator(regExp1, this)); smaEdit->setValidator(new QRegExpValidator(regExp1, this)); // set up more restrictive input for eccentricity QRegExp regExp2("[0][.][0-9 ]{0,3}"); eccEdit->setValidator(new QRegExpValidator(regExp2, this)); eccEdit->setInputMask("\\0\\.999"); // input mask for eccEdit to force input of the from 0.xxx, where the //0//. means 0 and . cannot be deleted // connections connect(eccEdit,SIGNAL(returnPressed()),this,SLOT(replotTwoBodyOrbits())); connect(mass1Edit,SIGNAL(returnPressed()),this,SLOT(replotTwoBodyOrbits())); connect(mass2Edit,SIGNAL(returnPressed()),this,SLOT(replotTwoBodyOrbits())); connect(smaEdit,SIGNAL(returnPressed()),this,SLOT(replotTwoBodyOrbits())); // get initial binary values getParams(); plotTwoBodyOrbits(); }
editRoom::editRoom(QWidget *parent) : QDialog(parent), ui(new Ui::editRoom) { ui->setupUi(this); QRegExp regExp1("[0-9][0-9 ][0-9]*"); ui->roomName->setValidator(new QRegExpValidator(regExp1, this)); ui->catList->addItem(" :: Select One :: "); setupview(); }
editAddRestaurant::editAddRestaurant(QWidget *parent) : QDialog(parent), ui(new Ui::editAddRestaurant) { ui->setupUi(this); QRegExp regExp1("[A-Za-z0-9][A-Za-z0-9 ].[A-Za-z0-9 ]*"); ui->name->setValidator(new QRegExpValidator(regExp1, this)); QRegExp regExp2("[1-9][0-9]*"); ui->price->setValidator(new QRegExpValidator(regExp2, this)); }
addOtherOrders::addOtherOrders(QWidget *parent) : QDialog(parent), ui(new Ui::addOtherOrders) { ui->setupUi(this); QRegExp regExp1("[A-Za-z0-9][A-Za-z0-9 ].[A-Za-z0-9 ]*"); ui->name->setValidator(new QRegExpValidator(regExp1, this)); QRegExp regExp2("[1-9][0-9]*"); ui->price->setValidator(new QRegExpValidator(regExp2, this)); ui->roomNo->addItem(":: select one ::"); QSqlDatabase db = QSqlDatabase::addDatabase( "QSQLITE" ); db.setDatabaseName( "./innovativedb.db" ); if( !db.open() ) { qDebug() << db.lastError(); qFatal( "Failed to connect." ); } qDebug( "Connected!" ); QSqlQuery qry; qry.prepare("CREATE TABLE IF NOT EXISTS roomlist (id INTEGET PRIMARY KEY, roomno VARCHAR(5), cat INTEGER, occupied INTEGER)"); if(!qry.exec()) qDebug() << qry.lastError(); else qDebug( "Room Table Validated..." ); qry.prepare("SELECT roomno FROM roomlist WHERE occupied <> 0"); if(!qry.exec()) qDebug() << qry.lastError(); else qDebug( "Room Table Validated..." ); while (qry.next()) { QString roomno = qry.value(0).toString(); ui->roomNo->addItem(roomno); } }