diff options
author | SudhakarKuma | 2017-10-25 15:53:45 +0530 |
---|---|---|
committer | SudhakarKuma | 2017-10-25 15:53:45 +0530 |
commit | 09c89f6242ecf2495f86140a3f53ef4678f8563b (patch) | |
tree | 96c9a2836be76442376b166f63304a0b2adef560 /src/gui | |
download | Open-Sky-Planetarium-09c89f6242ecf2495f86140a3f53ef4678f8563b.tar.gz Open-Sky-Planetarium-09c89f6242ecf2495f86140a3f53ef4678f8563b.tar.bz2 Open-Sky-Planetarium-09c89f6242ecf2495f86140a3f53ef4678f8563b.zip |
Updated OSP-plugin
Diffstat (limited to 'src/gui')
-rwxr-xr-x | src/gui/OSPMainDialog.cpp | 838 | ||||
-rwxr-xr-x | src/gui/OSPMainDialog.hpp | 312 | ||||
-rwxr-xr-x | src/gui/OSPMainDialog.ui | 758 |
3 files changed, 1908 insertions, 0 deletions
diff --git a/src/gui/OSPMainDialog.cpp b/src/gui/OSPMainDialog.cpp new file mode 100755 index 0000000..fe3cbbb --- /dev/null +++ b/src/gui/OSPMainDialog.cpp @@ -0,0 +1,838 @@ +/* + * Copyright (C) 2016 Dhiraj Salian + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. + */ + +#include "OpenSkyPlanetarium.hpp" +#include "OSPMainDialog.hpp" +#include "ui_OSPMainDialog.h" +#include "Calibrate.hpp" + +#include "StelApp.hpp" +#include "StelLocaleMgr.hpp" +#include "StelModule.hpp" +#include "StelModuleMgr.hpp" +#include "StelObjectMgr.hpp" +#include "StelUtils.hpp" +#include "StelFileMgr.hpp" +#include "StarMgr.hpp" +#include "StelAudioMgr.hpp" +#include "StelObjectMgr.hpp" + +#include <QMediaPlayer> +#include <QCompleter> +#include <QFileDialog> +#include <QFile> +#include <QInputDialog> +#include <QException> +#include <QRegExp> +#include <QRegExpValidator> +#include <QList> +#include <QMessageBox> +#include <QWidget> +#include <QByteArray> +#include <QDateTime> +#include <QCoreApplication> + +OSPMainDialog::OSPMainDialog() +{ + ui = new Ui_OSPMainDialog(); + calMode = false; + nRef = 0; + moduleDirectoryPath = StelFileMgr::getUserDir() + "/modules/OpenSkyPlanetarium"; + if(!StelFileMgr::exists(moduleDirectoryPath)){ + StelFileMgr::mkDir(moduleDirectoryPath); + } + scriptDirectoryPath = StelFileMgr::getUserDir() + "/modules/OpenSkyPlanetarium/script"; + if(!StelFileMgr::exists(scriptDirectoryPath)){ + StelFileMgr::mkDir(scriptDirectoryPath); + } + audioDirectoryPath = StelFileMgr::getUserDir() + "/modules/OpenSkyPlanetarium/audio"; + if(!StelFileMgr::exists(audioDirectoryPath)){ + StelFileMgr::mkDir(audioDirectoryPath); + } + + // Objects Initialization + player = new QMediaPlayer(); + playlist = new QMediaPlaylist(); + volumeSlider = new QAbstractSlider(); + player->setPlaylist(playlist); + player->setVolume(50); + playerState = QMediaPlayer::StoppedState; + remtim = 0; +} + +OSPMainDialog::~OSPMainDialog() +{ + //qDebug()<<"Closing Window"<<endl; + //device.closeWindow(); + delete ui; + +} + +void OSPMainDialog::retranslate() +{ + if (dialog) + { + ui->retranslateUi(dialog); + } +} + + +void OSPMainDialog::createDialogContent() +{ + ui->setupUi(dialog); + ui->tabWidg->setCurrentIndex(2); + setSignals(); + connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate())); + connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(closeWin())); +} + +/* +setSignals(): + THis function connects the various gui signals to its corresponding slots + this function is called in the createDialogContent() function of this classs +*/ +void OSPMainDialog :: setSignals(){ + + //Setting signals for the laser movements + connect(ui->mvUp,SIGNAL(pressed()),this,SLOT(upPressed())); + connect(ui->mvDown,SIGNAL(pressed()),this,SLOT(downPressed())); + connect(ui->mvLeft,SIGNAL(pressed()),this,SLOT(leftPressed())); + connect(ui->mvRight,SIGNAL(pressed()),this,SLOT(rightPressed())); + connect(ui->mvUp,SIGNAL(released()),this,SLOT(arrow_released())); + connect(ui->mvDown,SIGNAL(released()),this,SLOT(arrow_released())); + connect(ui->mvRight,SIGNAL(released()),this,SLOT(arrow_released())); + connect(ui->mvLeft,SIGNAL(released()),this,SLOT(arrow_released())); + connect(ui->reset,SIGNAL(clicked()),this,SLOT(reset())); + + //Connecting LaserDev signals to their respective slots + connect(&device,SIGNAL(debug_send(QString)),this,SLOT(debug_received(QString))); + connect(&device,SIGNAL(pos_received(QString,QString)),this,SLOT(pos_received(QString,QString))); + + //Device connection and Calibration buttons + connect(ui->selectDev,SIGNAL(clicked()),this,SLOT(selectDevice())); + connect(ui->startCal,SIGNAL(clicked()),this,SLOT(initDevice())); + + //LASER on/off + connect(ui->laserOn,SIGNAL(clicked()),this,SLOT(laserToggled())); + connect(ui->laserOff,SIGNAL(clicked()),this,SLOT(laserToggled())); + connect(ui->intensity,SIGNAL(valueChanged(int)),this,SLOT(setIntensity(int))); + + // Motor speed control + connect(ui->CoarseAdj,SIGNAL(clicked()),this,SLOT(adjToggled())); + connect(ui->FineAdj,SIGNAL(clicked()),this,SLOT(adjToggled())); + + //setReference and goTo button + connect(ui->setRef,SIGNAL(clicked()),this,SLOT(setReference())); + connect(ui->goTo,SIGNAL(clicked()),this,SLOT(goTo())); + + //script engine buttons + connect(ui->compScript,SIGNAL(clicked()),this,SLOT(compileScript())); + connect(ui->openScript,SIGNAL(clicked()),this,SLOT(openScript())); + connect(ui->saveScript,SIGNAL(clicked()),this,SLOT(saveScript())); + connect(ui->execScript,SIGNAL(clicked()),this,SLOT(execScript())); + + //scriptEngine Command Buttons + connect(ui->gt,SIGNAL(clicked()),this,SLOT(gt())); + connect(ui->pl,SIGNAL(clicked()),this,SLOT(pl())); + connect(ui->wt,SIGNAL(clicked()),this,SLOT(wt())); + connect(ui->lo,SIGNAL(clicked()),this,SLOT(lo())); + + //all emit signals for our scriptEngine connected to their respective functions + connect(this,SIGNAL(comGOTO(QString,QString)),this,SLOT(move(QString,QString))); + connect(this,SIGNAL(comTURN(bool)),this,SLOT(laser(bool))); + connect(this,SIGNAL(comPLAY(QString)),this,SLOT(playAudio(QString))); + connect(this,SIGNAL(comWAIT(int,int)),this,SLOT(waitforsec(int,int))); + + //Signals for audio + connect(ui->playui,SIGNAL(clicked()),this,SLOT(playClicked())); + connect(ui->stopui,SIGNAL(clicked()),this,SLOT(stopClick())); + connect(ui->volumeChanged,SIGNAL(sliderMoved(int)),this,SLOT(setVolume(int))); + connect(this,SIGNAL(play()),player,SLOT(play())); + connect(this,SIGNAL(pause()),player,SLOT(pause())); + connect(this,SIGNAL(stop()),player,SLOT(stop())); +} + + +/* +/////////////////////////////////////User Defined Functions and Slots////////////////////////////////////// + All the required functions and slots for the gui written below +*/ + +///////////////////////////////////////////////Programmer helper slots//////////////////////////////////////////// + +/* +debug_received(): + Connected to many signals for debugging purpose +*/ +void OSPMainDialog :: debug_received(QString s){ + qDebug() << "[OpenSkyPlanetarium] __debug__"<<s; +} + +/* +pos_received(): + This slot is called when the laser device sends us the coordinates + The coordinates are then used for setting the references in transformation matrix +*/ +void OSPMainDialog :: pos_received(QString x,QString y){ + qDebug() << "Printing X and Y = ["<<x <<","<<y<<"]"; + acTemp = x; + altTemp = y; + double l=x.toDouble()*(180.0/3.14159); + double m=y.toDouble()*(180.0/3.14159); + QString s=QString::number(l); + QString t=QString::number(m); + ui->X->setText(s); + ui->Y->setText(t); + +} + +/* +showMessage(QString): + this function is called to display error/information messages +*/ +void OSPMainDialog :: showMessage(QString m){ + QMessageBox msgBox; + msgBox.setWindowTitle("OpenSkyPlanetarium"); + msgBox.setText(m); + msgBox.exec(); +} + +//////////////////////////////////////////DEvice RElated slots//////////////////////////////////////////////////////////////////////////// + +/* +initDevice(): + This function initiates the arduino device i-e:Counts the no. of steps and sets device's postion . + This function is connected to "Start Calibration" (startCal) button of the gui +*/ +void OSPMainDialog :: initDevice(){ + nRef=0; + QDateTime dt = QDateTime::currentDateTime(); + double time = StelUtils::hmsToRad (dt.time().hour(), dt.time().minute(), dt.time().second()); + calib.setTime(time); + qDebug() << "t0 =["<<time<<"] //Initial time"; + device.init(); + ui->setRef->setEnabled(true); + ui->goTo->setEnabled(false); + ui->execScript->setEnabled(true); //change after testing to false + ui->mvUp->setEnabled(true); + ui->mvLeft->setEnabled(true); + ui->mvDown->setEnabled(true); + ui->mvRight->setEnabled(true); + ui->reset->setEnabled(true); + ui->refStat->setText("0/3"); +} + +/* +selectDevice(): + this slot is connected to the selectDev button of the gui + this slot shows a list of connected device to select from + after selection enables many buttons +*/ +void OSPMainDialog :: selectDevice(){ + nRef=0; + QStringList itemsList; + bool ok; + foreach (const QSerialPortInfo &info, QSerialPortInfo::availablePorts()) + itemsList.append(info.portName()); + portName = QInputDialog::getItem(NULL, "Open Sky Planetarium","Select Device:",itemsList, 0, false, &ok); + device.setPortName(portName); + if (ok && !portName.isEmpty()){ + ui->mvUp->setEnabled(false); + ui->mvDown->setEnabled(false); + ui->mvRight->setEnabled(false); + ui->mvLeft->setEnabled(false); + ui->selectDev->setEnabled(true); + ui->startCal->setEnabled(true); + ui->reset->setEnabled(false); + ui->setRef->setEnabled(false); + ui->goTo->setEnabled(false); + ui->execScript->setEnabled(true); //change after testing to false + ui->laserOn->setEnabled(true); + ui->laserOff->setEnabled(true); + ui->CoarseAdj->setEnabled(true); + ui->FineAdj->setEnabled(true); + ui->refStat->setText("0/3"); + } + else{ + showMessage("Please select the device"); + } +} + +/* +arrow_released(): + this function is called when the Up(mvUp), Down(mvDown), Right(mvRight) and Left(mvLeft) button is released + this function sends the stop command to the arduino device to stop its movement along any of the four directions +*/ +void OSPMainDialog :: arrow_released(){ + device.stop(); +} + +/* +upPressed(), downPressed(), rightPressed(), leftPressed(): + these functions are called when the buttons Up(mvUp), Down(mvDown), Right(mvRight) and Left(mvLeft) is pressed + these functions send appropriate move signals to the arduino device +*/ +void OSPMainDialog :: upPressed(){ + device.movy(1); +} + +void OSPMainDialog :: downPressed(){ + device.movy(0); +} + +void OSPMainDialog :: rightPressed(){ + device.movx(1); +} + +void OSPMainDialog :: leftPressed(){ + device.movx(0); +} +/* + reset(): + this function is called when the reset button is clicked. + this function calls move(0,0) and takes the laser to the initial coordinates. + */ + +void OSPMainDialog ::reset(){ + //this->initDevice(); + device.resetAll(); + QString val="0.000000"; + ui->X->setText(val); + ui->Y->setText(val); +} + + +/* +laserToggled(): + this slot is connected to the laser turnOn/turnOff radioButtons of the gui +*/ +void OSPMainDialog :: laserToggled(){ + if (ui->laserOn->isChecked()){ + device.laserOn(); + ui->intensity->setEnabled(true); + qDebug() << "[OpenSkyPlanetarium]:Turning LASER on" << endl; + } + else{ + ui->intensity->setEnabled(false); + // ui->intensity->setSliderPosition(50); + device.laserOff(); + qDebug() << "[OpenSkyPlanetarium]:Turning LASER off" << endl; + } +} + +/* +closeWin(): + this slot is connected to the close button of the gui +*/ +void OSPMainDialog :: closeWin(){ + debug_received("closing window"); + device.closeWindow(); + close(); + +} + + +///////////////////////////////////Calibration Related SLots///////////////////////////////////////////////////////////////////////// + +/* + setIntensity(): + this function is connected to the laser intensity control slider of the gui +*/ +void OSPMainDialog :: setIntensity(int x){ + int l=ui->intensity->value(); + device.setIntensity(l); + qDebug() << "[OpenSkyPlanetarium]:Changing intensity" << endl; +} + +/* +adjToggled(): + this slot is connected to the motor speed control radio buttons of the gui +*/ +void OSPMainDialog :: adjToggled(){ + if (ui->CoarseAdj->isChecked()){ + device.CoarseAdj(); + qDebug() << "[OpenSkyPlanetarium]:High Speed ON" << endl; + } + else{ + device.FineAdj(); + qDebug() << "[OpenSkyPlanetarium]:Low Speed ON" << endl; + } +} + + +/* +setReference(): + this function sets three references for the matrix transformation + basically it sends three references for matrix transformation to the device for its calculations +*/ + +void OSPMainDialog :: setReference(){ + nRef++; + QString sRef; + double dec = 0,ra = 0; + QDateTime dt = QDateTime::currentDateTime(); + double time = StelUtils::hmsToRad (dt.time().hour(), dt.time().minute(), dt.time().second()); + const QList<StelObjectP>& selected = GETSTELMODULE(StelObjectMgr)->getSelectedObject(); + if(nRef>3) + { + nRef=3; + ui->setRef->setEnabled(false); + } + if (!selected.isEmpty()) { + StelUtils::rectToSphe(&ra,&dec,selected[0]->getEquinoxEquatorialPos(StelApp::getInstance().getCore())); + osp_ra=ra - 3.14159; + osp_dec=dec; + osp_time=time; + qDebug() << "Star = ["<<osp_time <<"," <<osp_ra <<"," <<osp_dec<<"]"; + + double ac,alt; + switch(nRef){ + case 1: + device.getPos(); + ac = acTemp.toDouble(); + alt = altTemp.toDouble(); + calib.setRef_1(osp_ra,osp_dec,osp_time,ac,alt); + showMessage(QString("First reference point has been set\n az = %1; alt = %2").arg(ac).arg(alt)); + break; + case 2: + device.getPos(); + ac = acTemp.toDouble(); + alt = altTemp.toDouble(); + calib.setRef_2(osp_ra,osp_dec,osp_time,ac,alt); + ui->goTo->setEnabled(true); + ui->execScript->setEnabled(true); + showMessage(QString("Second reference point has been set\n az = %1; alt = %2").arg(ac).arg(alt)); + //showMessage("Second reference point has been set"); + break; + case 3: + device.getPos(); + ac = acTemp.toDouble(); + alt = altTemp.toDouble(); + calib.setRef_3(osp_ra,osp_dec,osp_time,ac,alt); + ui->setRef->setEnabled(false); + ui->goTo->setEnabled(true); + ui->execScript->setEnabled(true); + ui->mvDown->setEnabled(false); + ui->mvUp->setEnabled(false); + ui->mvRight->setEnabled(false); + ui->mvLeft->setEnabled(false); + showMessage(QString("Third reference point has been set\n az = %1; alt = %2").arg(ac).arg(alt)); + //showMessage("Third reference point has been set"); + break; + + + } + sRef.setNum(nRef); + ui->refStat->setText(sRef+"/3"); + + } + else{ + showMessage("Please select a star to set as a Reference"); + } +} + +/* +goTo(): + This function sends the coordinates from stellarium to device so that the laser could point the star + this function is enabled only after calibration is performed +*/ +void OSPMainDialog :: goTo(){ + QString sora,sodec,snra,sndec,sac,salt; //for testing purpose + double dec=0,ra=0,ac=0,alt=0; + QDateTime dt = QDateTime::currentDateTime(); + double time = StelUtils::hmsToRad (dt.time().hour(), dt.time().minute(), dt.time().second()); + const QList<StelObjectP>& selected = GETSTELMODULE(StelObjectMgr)->getSelectedObject(); + if (!selected.isEmpty()) { + StelUtils::rectToSphe(&ra,&dec,selected[0]->getEquinoxEquatorialPos(StelApp::getInstance().getCore())); + } + qDebug() << "[goto_star_ra,dec,time]:"<<ra <<"," <<dec <<"," <<time; + calib.getHCoords(ra-3.14159,dec,time,&ac,&alt); + salt.setNum(alt); //for testing purpose + sac.setNum(ac); //for testing purpose + sora.setNum(3.14159+ra); //for testing purpose + sodec.setNum(dec); //for testing purpose + calib.getECoords(ac,alt,time,&ra,&dec); //for testing purpose + snra.setNum(ra); //for testing purpose + sndec.setNum(dec); //for testing purpose + showMessage(QString("Old ra/dec = %1/%2 ; New ra/dec = %3/%4 ; LASER Coordinates = %5/%6").arg(sora).arg(sodec).arg(snra).arg(sndec).arg(sac).arg(salt)); //for testing purpose + device.move(ac,alt); + double xo=ac*(180.0/3.14159); + double yo=alt*(180.0/3.14159); + QString s=QString::number(xo); + QString t=QString::number(yo); + ui->X->setText(s); + ui->Y->setText(t); + qDebug() << "[goto_telescope_ac,alt]:"<<ac <<"," <<alt; +} + +/* +openScript(): + This function opens an existing file if present in the script directory of our module +*/ +void OSPMainDialog :: openScript(){ + QString fileName = QFileDialog::getOpenFileName(NULL,QString("Open Script"), scriptDirectoryPath,QString("Script Files (*.osp)")); + if(!fileName.isNull()){ + QFile file(fileName); + if (!file.open(QIODevice::ReadOnly | QIODevice::Text)){ + showMessage("File Not Accessible"); + return; + } + ui->scriptEdit->setText(file.readAll()); + file.close(); + } + +} + +/* +saveScript(): + This function is used to save the script +*/ +void OSPMainDialog :: saveScript(){ + if(!ui->scriptEdit->toPlainText().isEmpty()){ + QString fileName = QFileDialog::getSaveFileName(NULL,QString("Save Script"), scriptDirectoryPath,QString("Script Files (*.osp)")); + if(!fileName.isNull()){ + QFile file(fileName+".osp"); + if (!file.open(QIODevice::WriteOnly | QIODevice::Text)){ + showMessage("File Not Accessible"); + return; + } + file.write(ui->scriptEdit->toPlainText().toLocal8Bit()); + file.close(); + } + } +} + + +/* +execScript(): + This function is used to execute script + This function calls compile function before executing +*/ +void OSPMainDialog :: execScript(){ + compileScript(); + if(buildStatus){ + foreach(QString commands, commandsList){ + QStringList com = commands.split("_"); + if(com[0].compare("goto")==0){ + qDebug()<<com; + emit comGOTO(com[1],com[2]); + } + else if(com[0].compare("wait")==0){ + emit comWAIT(com[1].toInt(),com[2].toInt()); + } + else if(com[0].compare("turn")==0){ + if(com[1].compare("on")==0){ + emit comTURN(true); + } + else{ + emit comTURN(false); + } + } + else if(com[0].compare("play")==0){ + emit comPLAY(com[1]); + } + } + } +} + + +/* +compileScript(): + This function is used to compile script + this function maps the user script commands to the C++ functions +*/ +void OSPMainDialog :: compileScript(){ + QRegExp scriptExp("^([goto | wait | turn | play]{4})\\s*([\u0370-\u03FF0-9a-zA-Z\\.\\s]*)\\s*;$"); + bool compileStatus = true,i; + int line_count=0; + commandsList.clear(); + i = playlist->clear(); + + if(nRef<2) + { + compileStatus=false; + showMessage(QString("Please do the calibration")); + } + else{ + + foreach(QString w, ui->scriptEdit->toPlainText().split("\n")){ + line_count++; + if(!scriptExp.exactMatch(w) && w.compare("")!=0){ + compileStatus=false; + showMessage(QString("Syntax Error at line %1").arg(line_count)); + } + else{ + QStringList com_par=scriptExp.capturedTexts(); + if(com_par[1].compare("goto")==0){ + double ra=0.0,dec=0.0; + QString sra,sdec; + //Todo:add checks before going down + StelObjectP star = GETSTELMODULE(StelObjectMgr)->searchByNameI18n(com_par[2].trimmed()); + if(!star.isNull()){ + StelUtils::rectToSphe(&ra,&dec,star->getEquinoxEquatorialPos(StelApp::getInstance().getCore())); + sra.setNum(ra); + sdec.setNum(dec); + commandsList << QString("goto_"+sra+"_"+sdec); + qDebug()<<sra<<sdec; + } + else{ + showMessage("Could not find the star with the given name"); + } + } + else if(com_par[1].compare("turn")==0){ + if(com_par[2].trimmed().compare("on")!=0 && com_par[2].trimmed().compare("off")!=0){ + compileStatus=false; + showMessage(QString("The parameter for laser must be either 'on' or 'off' at line %1").arg(line_count)); + break; + } + else{ + commandsList << QString("turn_"+com_par[2].trimmed()); + } + } + else if(com_par[1].compare("play")==0){ + QFile f(QString(audioDirectoryPath+"/"+com_par[2].trimmed())); + if(!f.exists()){ + compileStatus=false; + showMessage(QString("File not found in [{Stellarium User Directory}/modules/OpenSkyPlanetarium/audio/] at line %1").arg(line_count)); + break; + } + else{ + commandsList << QString("play_"+com_par[2].trimmed()); + } + } + else if(com_par[1].compare("wait")==0){ + QRegExp a("([1-5]?[0-9])\\s*m\\s*([1-5]?[0-9])\\s*s"); + if(!a.exactMatch(com_par[2].trimmed())){ + showMessage(QString("(X)m(Y)s format expected as argument for wait at line %1").arg(line_count)); + compileStatus=false; + break; + } + else{ + QStringList temp = a.capturedTexts(); + commandsList << QString("wait_"+temp[1].trimmed()+"_"+temp[2].trimmed()); + } + } + } + } + } + if (!compileStatus){ + commandsList.clear(); + } + else{ + //showMessage("Build Successful"); + } + buildStatus=compileStatus; +} + +////////////////////////SLOTS FOR FUNCTIONS TO BE CALLED WHILE EXECUTION OF SCRIPT/////////////////////////////////////////// + +/* +move(QString,QString): + This is slot connected to goto command from our script engine + It takes ra/dec of star as its parameters and converts them to move +*/ +void OSPMainDialog :: move(QString x,QString y){ + qDebug() << "Moveto X and Y = ["<<x <<","<<y<<"]"; + double ra,dec,ac,alt; + ra=x.toDouble(); + dec=y.toDouble(); + QDateTime dt = QDateTime::currentDateTime(); + double time = StelUtils::hmsToRad (dt.time().hour(), dt.time().minute(), dt.time().second()); + calib.getHCoords(ra - 3.14159,dec,time,&ac,&alt); + device.move(ac,alt); +} + +/* +laser(bool): + This is a slot for our script engine emit signal comTURN + This is used when playing the script +*/ +void OSPMainDialog :: laser(bool stat){ + if(stat){ + device.laserOn(); + ui->laserOn->setChecked(true); + ui->laserOff->setChecked(false); + } + else{ + device.laserOff(); + ui->laserOff->setChecked(true); + ui->laserOn->setChecked(false); + } +} + +/* +waitforsec(int,int): + this is used when playing the script + this is used to give wait functionality in the script +*/ +void OSPMainDialog :: waitforsec(int min,int sec){ + dieTime = QTime::currentTime().addSecs(min*60 + sec); + qDebug()<<"Current Time"<<QTime::currentTime(); + qDebug()<<"before While"<<dieTime; + while( QTime::currentTime() < dieTime || playerState == QMediaPlayer::PausedState) + { + QCoreApplication::processEvents(QEventLoop::AllEvents, 100); + } + qDebug()<<"remTim"<<remtim; + qDebug()<<"After while"<<dieTime; +} +/* +playAudio(QString): + This function is used to play audio files + This is used to give play Audio functionality in our script +*/ +void OSPMainDialog :: playAudio(QString fname){ + playlist->addMedia(QUrl::fromLocalFile(QString(audioDirectoryPath+QString("/")+fname))); + emit play(); + ui->playui->setEnabled(true); + ui->playui->setText(QString("Pause")); + playerState = QMediaPlayer::PlayingState; +} + + +//////////////////////////////////////////////////////////////////SLOTS FOR SCRIPT ENGINE COMMAND BUTTONS/////////////////////////////// + + + +/* +gt(): + This slot is connected to Goto Button of the Script Engine + Adds the goto command to your script +*/ +void OSPMainDialog :: gt(){ + QString sra,sdec; + const QList<StelObjectP>& selected = GETSTELMODULE(StelObjectMgr)->getSelectedObject(); + if (!selected.isEmpty()) { + double dec_equinox = 0; + double ra_equinox = 0; + StelUtils::rectToSphe(&ra_equinox,&dec_equinox,selected[0]->getEquinoxEquatorialPos(StelApp::getInstance().getCore())); + ui->scriptEdit->setText(ui->scriptEdit->toPlainText().append(QString("goto %1;\n").arg(selected[0]->getNameI18n()))); + } + else { + showMessage("Please select an object first"); + } +} + +/* +pl(): + This slot is connected to Play Button of the Script Engine + Adds the play audio command to your script +*/ +void OSPMainDialog :: pl(){ + QString fileName = QFileDialog::getOpenFileName(NULL,QString("Select Audio File"), audioDirectoryPath,QString("Audio Files (*.wav)")); + if (!fileName.isNull()){ + QFileInfo f(fileName); + ui->scriptEdit->setText(ui->scriptEdit->toPlainText().append(QString("play %1;\n").arg(f.fileName()))); + } + else{ + showMessage("Please select the audio file"); + } +} + +/* +lo(): + This slot is connected to laser on/off button of the Script Engine + Adds the laser on/off command to your script +*/ +void OSPMainDialog :: lo(){ + QStringList items; + items << "on"<<"off"; + bool ok; + QString item = QInputDialog::getItem(NULL, "Open Sky Planetarium","Select State(on/off):", items, 0, false, &ok); + if (ok && !item.isEmpty()){ + ui->scriptEdit->setText(ui->scriptEdit->toPlainText().append(QString("turn %1;\n").arg(item))); + } + else{ + showMessage("Please select either on/off"); + } +} + +/* +wt(): + This slot is connected to wait button of the Script Engine + Adds the wait command to your script +*/ +void OSPMainDialog :: wt(){ + bool ok; + QRegExp a("([1-5][0-9])\\s*m\\s*([1-5][0-9])\\s*s"); + QString time = QInputDialog::getText(NULL,"Open Sky Planetarium","Enter time(in [X]m[Y]s):",QLineEdit::Normal,"", &ok); + if (ok && !time.isEmpty() && !a.exactMatch(time)){ + ui->scriptEdit->setText(ui->scriptEdit->toPlainText().append(QString("wait %1;\n").arg(time))); + } + else{ + showMessage("Please enter time in (X)m(Y)s format"); + } +} + +////////////////////// Media Functions ///////////////////////////// + +/* +setVolume(int): + This slot is connected to the volume slider of the Script Engine + Sets the volume for the player. +*/ + +void OSPMainDialog::setVolume(int volume) +{ + player->setVolume(volume); +} + +/* +stopClick(): + This slot is connected to the stopui function of the Script Engine + Stops the player. +*/ + +void OSPMainDialog::stopClick() +{ + playerState = QMediaPlayer::StoppedState; + ui->playui->setText(QString("Play")); + player->stop(); +} + +/* +playClicked(): + This slot is connected to the playui function of the Script Engine + Play or pause the audio in the script engine. +*/ + +void OSPMainDialog::playClicked() +{ + switch (playerState) { + case QMediaPlayer::StoppedState: + emit play(); + emit execScript(); + ui->playui->setText(QString("Pause")); + playerState = QMediaPlayer::PlayingState; + break; + case QMediaPlayer::PausedState: + emit play(); + ui->playui->setText(QString("Pause")); + remtim = pauseWait.restart(); + dieTime = dieTime.addMSecs(remtim); + playerState = QMediaPlayer::PlayingState; + break; + case QMediaPlayer::PlayingState: + emit pause(); + pauseWait.start(); + ui->playui->setText(QString("Play")); + playerState = QMediaPlayer::PausedState; + break; + } +} + diff --git a/src/gui/OSPMainDialog.hpp b/src/gui/OSPMainDialog.hpp new file mode 100755 index 0000000..c6d37f8 --- /dev/null +++ b/src/gui/OSPMainDialog.hpp @@ -0,0 +1,312 @@ +/* + * Copyright (C) 2016 Dhiraj Salian + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. + */ + +#ifndef OSPMAINDIALOG_H +#define OSPMAINDIALOG_H + +#include "Calibrate.hpp" +#include "StelDialog.hpp" +#include "LaserDev.hpp" +#include "StarMgr.hpp" +#include<QMediaPlayer> +#include <QWidget> +#include <QtSerialPort/QSerialPort> +#include <QtSerialPort/QSerialPortInfo> +#include<QList> +#include<QHash> +#include <QMediaPlaylist> +#include <QAbstractSlider> + + +class Ui_OSPMainDialog; + +//! This is the main class used in connecting all the signals to gui. +class OSPMainDialog : public StelDialog +{ + Q_OBJECT + +public: + OSPMainDialog(); + + ~OSPMainDialog(); + + + /** + * This function connects the various gui signals to its corresponding slots. + * This function is called in the createDialogContent() function of this class. + */ + void setSignals(); + + /** + * This function is called to display error/information messages + */ + void showMessage(QString m); + + +public slots: + + /** + * This function retranslate the language of plugin. + */ + void retranslate(); + /** + * This funtion is connected to many signals for debugging purpose. + * \param s Debug string + */ + void debug_received(QString s); + /** + * This slot is called when the laser device sends us the coordinates + * The coordinates are then used for setting the references in transformation matrix + * \param x Azimuth in string. + * \param y Altitude in string. + */ + void pos_received(QString x,QString y); + /** + * This slot is connected to the selectDev button of the gui. + * This slot shows a list of connected device to select from after selection enables many buttons. + */ + void selectDevice(); + /** + * This function initiates the arduino device i-e: Counts the no. of steps and sets device's postion. + * This function is connected to "Start Calibration" (startCal) button of the gui + */ + void initDevice(); + /** + * This function is called when the Up(mvUp), Down(mvDown), Right(mvRight) and Left(mvLeft) button is released + * This function sends the stop command to the arduino device to stop its movement along any of the four directions + */ + void arrow_released(); + /** + * This functions is called when the buttons Up(mvUp) is pressed + */ + void upPressed(); + /** + * This functions is called when the buttons Down(mvDown) is pressed + */ + void downPressed(); + /** + * This functions is called when the buttons Right(mvRight) is pressed + */ + void rightPressed(); + /** + * This functions is called when the buttons Left(mvLeft) is pressed + */ + void leftPressed(); + /** + * This function is connected to the laser turnOn/turnOff radioButtons of the gui + */ + void laserToggled(); + + /** + * This function sets three references for the matrix transformation basically it sends three references for matrix transformation to the device for its calculations + */ + void setReference(); + + /** + * This function is connected to the laser intensity control slider + */ + void setIntensity(int x); + + /** + * This function is connected to the close button of gui + */ + void closeWin(); + + /** + * This function is connected to the motor control radioButtons of the gui + */ + void adjToggled(); + + /** + * This function sends the coordinates from stellarium to device so that the laser could point the star. This function is enabled only after calibration is performed + */ + void goTo(); + + /** + * This function opens an existing file if present in the script directory of our module. + */ + void openScript(); + + /** + * This function is used to save the script + */ + void saveScript(); + + /** + * This function is used to execute script. This function calls compile function before executing + */ + void execScript(); + + /** + * This function is used to compile script. This function maps the user script commands to the C++ functions + */ + void compileScript(); + + /** + * This is a slot for our script engine emit signal comTURN. This is used when playing the script + */ + void laser(bool stat); + + /** + * This function is used to play audio files. This is used to give play Audio functionality in our script + */ + void playAudio(QString fname); + + /** + * This is used when playing the script. This is used to give wait functionality in the script + * \param min time in minute + * \param sec time in second + */ + void waitforsec(int min,int sec); + + /** + * This is slot connected to goto command from our script engine. It takes ra/dec of star as its parameters and converts them to move + * \param sra Right Ascension (equatorial coordinates). + * \param dec Declination (equatorial coordinates). + */ + void move(QString,QString); + + /** + * This slot is connected to Goto Button of the Script Engine. Adds the goto command to your script + */ + void gt(); + + /** + * This slot is connected to Play Button of the Script Engine. Adds the play audio command to your script + */ + void pl(); + + /** + * This slot is connected to laser on/off button of the Script Engine. Adds the laser on/off command to your script + */ + void lo(); + + /** + * This slot is connected to wait button of the Script Engine. Adds the wait command to your script + */ + void wt(); + /** + * This slot is for hard reset of the arduino. + */ + void reset(); + +signals: + + /** + * This signal is connected to move of OSPMainDialog class + * \param sra Right Ascension (equatorial coordinates). + * \param dec Declination (equatorial coordinates). + */ + void comGOTO(QString sra,QString sdec); + + /** + * This signal is connected to laser of OSPMainDialog class + * \param stat status of laser + */ + void comTURN(bool stat); + + /** + * This signal is connected to waitforsec of OSPMainDialog class + * \param min time in minute + * \param sec time in second + */ + void comWAIT(int min,int sec); + + + /** + * This signal is connected to playAudio of OSPMainDialog class + * \param fname file name + */ + void comPLAY(QString fname); + +protected: + + /** + * This function is used to create a dialog box and set the current index of the box + */ + void createDialogContent(); + +private: + OpenSkyPlanetarium *osp; + Ui_OSPMainDialog *ui; + LaserDev device; + Calibrate calib; + QString acTemp; + QString altTemp; + double osp_time; + double osp_ra; + double osp_dec; + bool buildStatus; + QString portName; + QHash<QString,QString> i18n_to_coords; + QString moduleDirectoryPath; + QString scriptDirectoryPath; + QString audioDirectoryPath; + QStringList commandsList; + bool calMode; + int nRef; + + // Audio functions + +signals: + + /** + * This signal is connected to play of QMediaPlayer class + */ + void play(); + + + /** + * This signal is connected to pause of QMediaPlayer class + */ + void pause(); + + /** + * This signal is connected to stop of QMediaPlayer class + */ + void stop(); + +public slots: + + /** + * This slot is connected to volume slider. + * \param volume by slider + */ + void setVolume(int volume); + + /** + * This slot is connected to play and pause button. + */ + void playClicked(); + + /** + * This slot is connected to stop button. + */ + void stopClick(); + +private: + QMediaPlayer* player; + QMediaPlaylist* playlist; + QMediaPlayer::State playerState; + QAbstractSlider *volumeSlider; + QTime dieTime; + QTime pauseWait; + qint32 remtim; +}; + +#endif // OSPMAINDIALOG_H diff --git a/src/gui/OSPMainDialog.ui b/src/gui/OSPMainDialog.ui new file mode 100755 index 0000000..4a509ae --- /dev/null +++ b/src/gui/OSPMainDialog.ui @@ -0,0 +1,758 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>OSPMainDialog</class> + <widget class="QWidget" name="OSPMainDialog"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>510</width> + <height>461</height> + </rect> + </property> + <property name="focusPolicy"> + <enum>Qt::ClickFocus</enum> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="BarFrame" name="TitleBar"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>25</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>30</height> + </size> + </property> + <property name="focusPolicy"> + <enum>Qt::NoFocus</enum> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum> + </property> + <layout class="QHBoxLayout" name="_2"> + <property name="spacing"> + <number>6</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>4</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <spacer name="leftSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="stelWindowTitle"> + <property name="text"> + <string>Open Sky Planetarium</string> + </property> + </widget> + </item> + <item> + <spacer name="rightSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="closeStelWindow"> + <property name="minimumSize"> + <size> + <width>16</width> + <height>16</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16</width> + <height>16</height> + </size> + </property> + <property name="focusPolicy"> + <enum>Qt::NoFocus</enum> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QTabWidget" name="tabWidg"> + <property name="tabPosition"> + <enum>QTabWidget::North</enum> + </property> + <property name="tabShape"> + <enum>QTabWidget::Rounded</enum> + </property> + <property name="currentIndex"> + <number>2</number> + </property> + <property name="movable"> + <bool>false</bool> + </property> + <property name="tabBarAutoHide"> + <bool>false</bool> + </property> + <widget class="QWidget" name="calTab"> + <attribute name="title"> + <string>Calibration</string> + </attribute> + <layout class="QHBoxLayout" name="horizontalLayout_4"> + <item> + <layout class="QVBoxLayout" name="verticalLayout_8"> + <item> + <widget class="QGroupBox" name="laserDirControl"> + <property name="toolTip"> + <string/> + </property> + <property name="title"> + <string>LASER Direction Control</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="2" column="2"> + <widget class="QPushButton" name="mvDown"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip"> + <string>Makes the LASER move downward only if it is not at (0,0).</string> + </property> + <property name="text"> + <string>down</string> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QPushButton" name="mvUp"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip"> + <string>Makes the LASER move upwards upto 90 degrees from (0,0).</string> + </property> + <property name="text"> + <string>up</string> + </property> + </widget> + </item> + <item row="1" column="3"> + <widget class="QPushButton" name="mvRight"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip"> + <string>Makes the LASER move rightwards upto 360 degrees from (0,0).</string> + </property> + <property name="text"> + <string>right</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QPushButton" name="mvLeft"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip"> + <string>Makes the LASER move leftwards only if it is not at (0,0).</string> + </property> + <property name="text"> + <string>left</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="1" column="4"> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="1" column="2"> + <widget class="QPushButton" name="reset"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip"> + <string>Takes the LASER to (0,0).</string> + </property> + <property name="text"> + <string>reset</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="MotorSwitchingControl"> + <property name="title"> + <string>Motor Speed Control</string> + </property> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <spacer name="horizontalSpacer_6"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>46</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QRadioButton" name="CoarseAdj"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="toolTip"> + <string>Makes the movement of LASER fast during its direction control.</string> + </property> + <property name="text"> + <string>Coarse</string> + </property> + <property name="checked"> + <bool>false</bool> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="FineAdj"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip"> + <string>Makes the movement of LASER slow during its direction control. </string> + </property> + <property name="text"> + <string>Fine</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_5"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>45</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="laserlightControl"> + <property name="contextMenuPolicy"> + <enum>Qt::PreventContextMenu</enum> + </property> + <property name="toolTip"> + <string/> + </property> + <property name="title"> + <string>LASER Light Control</string> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> + </property> + <layout class="QFormLayout" name="formLayout"> + <item row="0" column="0"> + <spacer name="horizontalSpacer_3"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="0" column="1"> + <widget class="QRadioButton" name="laserOn"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="toolTip"> + <string>Turns the LASER on and enables slider to control intensity.</string> + </property> + <property name="text"> + <string>Turn ON</string> + </property> + <property name="checked"> + <bool>false</bool> + </property> + <attribute name="buttonGroup"> + <string notr="true">buttonGroup</string> + </attribute> + </widget> + </item> + <item row="2" column="1"> + <widget class="QRadioButton" name="laserOff"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip"> + <string>Turns the LASER off and sends the slider to its initial position. </string> + </property> + <property name="text"> + <string>Turn OFF</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <attribute name="buttonGroup"> + <string notr="true">buttonGroup</string> + </attribute> + </widget> + </item> + <item row="3" column="1"> + <spacer name="horizontalSpacer_4"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="4" column="0" colspan="2"> + <widget class="QSlider" name="intensity"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip"> + <string>Controls the intensity of LASER. Drag the slider to change the intensity.</string> + </property> + <property name="minimum"> + <number>50</number> + </property> + <property name="maximum"> + <number>255</number> + </property> + <property name="value"> + <number>50</number> + </property> + <property name="sliderPosition"> + <number>50</number> + </property> + <property name="tracking"> + <bool>false</bool> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QVBoxLayout" name="verticalLayout_6"> + <item> + <widget class="QGroupBox" name="configDevice"> + <property name="title"> + <string>Device Configuration</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_5"> + <item> + <widget class="QPushButton" name="selectDev"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="toolTip"> + <string>Selects the connected device.</string> + </property> + <property name="text"> + <string>Select</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="startCal"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip"> + <string>Initializes calibration using 2 or 3 reference stars. Also, it sets the current position of LASER as (0,0).</string> + </property> + <property name="text"> + <string>Start Calibrate</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="goTo"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip"> + <string>Takes the LASER to selected star after calibration has been accomplished.</string> + </property> + <property name="text"> + <string>GoTo</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="refStatus"> + <property name="title"> + <string>Reference Status</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_7"> + <item> + <widget class="QPushButton" name="setRef"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip"> + <string>Sets reference when a star is selected. It is disabled when three references have been set successfully.</string> + </property> + <property name="text"> + <string>Set Ref.</string> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="refStat"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="toolTip"> + <string>Displays the number of references set.</string> + </property> + <property name="text"> + <string>0/3</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox_2"> + <property name="toolTip"> + <string/> + </property> + <property name="title"> + <string>Current Coordinates</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_5"> + <item> + <widget class="QLabel" name="label"> + <property name="toolTip"> + <string>Displays the current horizontal position of LASER in degrees. </string> + </property> + <property name="text"> + <string>X:</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="X"> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_6"> + <item> + <widget class="QLabel" name="label_3"> + <property name="toolTip"> + <string>Displays the current vertical position of LASER in degrees.</string> + </property> + <property name="text"> + <string>Y:</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="Y"> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <widget class="QWidget" name="scriptTab"> + <attribute name="title"> + <string>ScriptEngine</string> + </attribute> + <widget class="QSplitter" name="splitter"> + <property name="geometry"> + <rect> + <x>341</x> + <y>41</y> + <width>101</width> + <height>291</height> + </rect> + </property> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <widget class="QSlider" name="volumeChanged"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="cursor"> + <cursorShape>BusyCursor</cursorShape> + </property> + <property name="value"> + <number>50</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + <widget class="QPushButton" name="playui"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Play</string> + </property> + </widget> + <widget class="QPushButton" name="stopui"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="text"> + <string>Stop</string> + </property> + </widget> + <widget class="QPushButton" name="openScript"> + <property name="text"> + <string>Open</string> + </property> + </widget> + <widget class="QPushButton" name="saveScript"> + <property name="text"> + <string>Save</string> + </property> + </widget> + <widget class="QPushButton" name="compScript"> + <property name="text"> + <string>Build</string> + </property> + </widget> + <widget class="QPushButton" name="execScript"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="text"> + <string>Build + Run</string> + </property> + </widget> + </widget> + <widget class="QSplitter" name="splitter_2"> + <property name="geometry"> + <rect> + <x>10</x> + <y>10</y> + <width>431</width> + <height>23</height> + </rect> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <widget class="QPushButton" name="gt"> + <property name="text"> + <string>Goto</string> + </property> + </widget> + <widget class="QPushButton" name="pl"> + <property name="text"> + <string>Audio</string> + </property> + </widget> + <widget class="QPushButton" name="wt"> + <property name="text"> + <string>WAIT</string> + </property> + </widget> + <widget class="QPushButton" name="lo"> + <property name="text"> + <string>LASER ON/OFF</string> + </property> + </widget> + </widget> + <widget class="QTextEdit" name="scriptEdit"> + <property name="geometry"> + <rect> + <x>13</x> + <y>42</y> + <width>321</width> + <height>291</height> + </rect> + </property> + <property name="autoFillBackground"> + <bool>true</bool> + </property> + <property name="inputMethodHints"> + <set>Qt::ImhLowercaseOnly|Qt::ImhMultiLine|Qt::ImhNoAutoUppercase</set> + </property> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum> + </property> + <property name="readOnly"> + <bool>false</bool> + </property> + </widget> + </widget> + <widget class="QWidget" name="abtTab"> + <attribute name="title"> + <string>About</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_4"> + <item> + <widget class="QTextBrowser" name="textBrowser"> + <property name="html"> + <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:20pt; font-weight:600; text-decoration: underline;">OpenSkyPlanetarium</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">An Open Source Initiative by IIT Bombay to bring interesting objects in the Open Sky closer to the common masses and school childrens.</p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Contact: IIT Bombay</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Email: openskyplanetarium@fossee.in</p></body></html></string> + </property> + </widget> + </item> + </layout> + </widget> + </widget> + </item> + </layout> + </widget> + <customwidgets> + <customwidget> + <class>BarFrame</class> + <extends>QFrame</extends> + <header>Dialog.hpp</header> + <container>1</container> + </customwidget> + </customwidgets> + <resources/> + <connections/> + <buttongroups> + <buttongroup name="buttonGroup"/> + </buttongroups> +</ui> |