Commit ea4edb27 authored by Jasem Mutlaq's avatar Jasem Mutlaq

Add live video button to capture module

parent 9eabf40f
......@@ -140,6 +140,8 @@ Capture::Capture()
connect(CCDCaptureCombo, SIGNAL(activated(QString)), this, SLOT(setDefaultCCD(QString)));
connect(CCDCaptureCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(checkCCD(int)));
connect(liveVideoB, SIGNAL(clicked(bool)), this, SLOT(toggleVideoStream(bool)));
guideDeviationTimer.setInterval(GD_TIMER_TIMEOUT);
connect(&guideDeviationTimer, SIGNAL(timeout()), this, SLOT(checkGuideDeviationTimeout()));
......@@ -513,6 +515,7 @@ void Capture::checkCCD(int ccdNum)
disconnect(ccd, SIGNAL(numberUpdated(INumberVectorProperty*)), this, SLOT(processCCDNumber(INumberVectorProperty*)));
disconnect(ccd, SIGNAL(newTemperatureValue(double)), this, SLOT(updateCCDTemperature(double)));
disconnect(ccd, SIGNAL(newRemoteFile(QString)), this, SLOT(setNewRemoteFile(QString)));
disconnect(ccd, SIGNAL(videoStreamToggled(bool)), this, SLOT(setVideoStreamEnabled(bool)));
}
if (ccdNum <= CCDs.count())
......@@ -603,9 +606,12 @@ void Capture::checkCCD(int ccdNum)
ISOCombo->setCurrentIndex(targetChip->getISOIndex());
}
liveVideoB->setEnabled(currentCCD->hasVideoStream());
connect(currentCCD, SIGNAL(numberUpdated(INumberVectorProperty*)), this, SLOT(processCCDNumber(INumberVectorProperty*)), Qt::UniqueConnection);
connect(currentCCD, SIGNAL(newTemperatureValue(double)), this, SLOT(updateCCDTemperature(double)), Qt::UniqueConnection);
connect(currentCCD, SIGNAL(newRemoteFile(QString)), this, SLOT(setNewRemoteFile(QString)));
connect(currentCCD, SIGNAL(videoStreamToggled(bool)), this, SLOT(setVideoStreamEnabled(bool)));
}
}
......@@ -4064,4 +4070,26 @@ void Capture::showFilterOffsetDialog()
}
}
void Capture::toggleVideoStream(bool enable)
{
if (currentCCD == NULL)
return;
currentCCD->setVideoStreamEnabled(enable);
}
void Capture::setVideoStreamEnabled(bool enabled)
{
if (enabled)
{
liveVideoB->setChecked(true);
liveVideoB->setStyleSheet("color:red;");
}
else
{
liveVideoB->setChecked(false);
liveVideoB->setStyleSheet(QString());
}
}
}
......@@ -380,8 +380,6 @@ public slots:
void setFocusStatus(Ekos::FocusState state);
void setHFR(double newHFR) { focusHFR = newHFR; }
// Guide
void setGuideStatus(Ekos::GuideState state);
// Align
......@@ -444,6 +442,10 @@ private slots:
// Filter focus offset
void showFilterOffsetDialog();
// Live Video Preview
void toggleVideoStream(bool enable);
void setVideoStreamEnabled(bool enabled);
signals:
void newLog();
void checkFocus(double);
......
......@@ -1257,6 +1257,28 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="liveVideoB">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>32</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>Live Video</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="buttonSpacer">
<property name="orientation">
......@@ -1775,23 +1797,33 @@
<tabstops>
<tabstop>CCDCaptureCombo</tabstop>
<tabstop>FilterCaptureCombo</tabstop>
<tabstop>FilterPosCombo</tabstop>
<tabstop>filterOffsetB</tabstop>
<tabstop>temperatureCheck</tabstop>
<tabstop>temperatureIN</tabstop>
<tabstop>setTemperatureB</tabstop>
<tabstop>exposureIN</tabstop>
<tabstop>binXIN</tabstop>
<tabstop>binYIN</tabstop>
<tabstop>FilterPosCombo</tabstop>
<tabstop>countIN</tabstop>
<tabstop>delayIN</tabstop>
<tabstop>frameTypeCombo</tabstop>
<tabstop>calibrationB</tabstop>
<tabstop>frameXIN</tabstop>
<tabstop>frameYIN</tabstop>
<tabstop>resetFrameB</tabstop>
<tabstop>frameWIN</tabstop>
<tabstop>frameHIN</tabstop>
<tabstop>temperatureCheck</tabstop>
<tabstop>temperatureIN</tabstop>
<tabstop>binXIN</tabstop>
<tabstop>binYIN</tabstop>
<tabstop>ISOCombo</tabstop>
<tabstop>prefixIN</tabstop>
<tabstop>filterCheck</tabstop>
<tabstop>expDurationCheck</tabstop>
<tabstop>ISOCheck</tabstop>
<tabstop>postCaptureScriptIN</tabstop>
<tabstop>fitsDir</tabstop>
<tabstop>selectFITSDirB</tabstop>
<tabstop>uploadModeCombo</tabstop>
<tabstop>remoteDirIN</tabstop>
<tabstop>addToQueueB</tabstop>
<tabstop>removeFromQueueB</tabstop>
<tabstop>queueUpB</tabstop>
......@@ -1802,11 +1834,17 @@
<tabstop>queueSaveAsB</tabstop>
<tabstop>queueTable</tabstop>
<tabstop>previewB</tabstop>
<tabstop>liveVideoB</tabstop>
<tabstop>startB</tabstop>
<tabstop>pauseB</tabstop>
<tabstop>guideDeviationCheck</tabstop>
<tabstop>guideDeviation</tabstop>
<tabstop>autofocusCheck</tabstop>
<tabstop>HFRPixels</tabstop>
<tabstop>meridianCheck</tabstop>
<tabstop>meridianHours</tabstop>
<tabstop>darkSubCheck</tabstop>
<tabstop>filterCombo</tabstop>
</tabstops>
<resources/>
<connections/>
......
......@@ -786,6 +786,7 @@ CCD::CCD(GDInterface *iPtr) : DeviceDecorator(iPtr)
HasGuideHead = false;
HasCooler = false;
HasCoolerControl = false;
HasVideoStream = false;
fv = NULL;
streamWindow = NULL;
ST4Driver = NULL;
......@@ -873,6 +874,11 @@ void CCD::registerProperty(INDI::Property *prop)
// Can turn cooling on/off
HasCoolerControl = true;
}
else if (!strcmp(prop->getName(), "CCD_VIDEO_STREAM"))
{
// Has Video Stream
HasVideoStream = true;
}
else if (!strcmp(prop->getName(), "CCD_TRANSFER_FORMAT"))
{
ISwitchVectorProperty *sp = prop->getSwitch();
......@@ -991,10 +997,13 @@ void CCD::processSwitch(ISwitchVectorProperty *svp)
{
// Can turn cooling on/off
HasCoolerControl = true;
return;
}
if (!strcmp(svp->name, "CCD_VIDEO_STREAM") || !strcmp(svp->name, "VIDEO_STREAM"))
{
HasVideoStream = true;
if (streamWindow == NULL && svp->sp[0].s == ISS_ON)
{
streamWindow = new StreamWG();
......@@ -1024,13 +1033,10 @@ void CCD::processSwitch(ISwitchVectorProperty *svp)
{
connect(streamWindow, SIGNAL(hidden()), this, SLOT(StreamWindowHidden()), Qt::UniqueConnection);
if (svp->sp[0].s == ISS_ON)
streamWindow->enableStream(true);
else
streamWindow->enableStream(false);
streamWindow->enableStream(svp->sp[0].s == ISS_ON);
emit videoStreamToggled(svp->sp[0].s == ISS_ON);
}
emit switchUpdated(svp);
return;
......@@ -1055,6 +1061,7 @@ void CCD::processSwitch(ISwitchVectorProperty *svp)
if (dSwitch && dSwitch->s == ISS_ON && streamWindow != NULL)
{
streamWindow->enableStream(false);
emit videoStreamToggled(false);
streamWindow->close();
delete(streamWindow);
streamWindow = NULL;
......@@ -1861,4 +1868,25 @@ bool CCD::setTransformFormat(CCD::TransferFormat format)
return true;
}
bool CCD::setVideoStreamEnabled(bool enable)
{
if (HasVideoStream == false)
return false;
ISwitchVectorProperty *svp = baseDevice->getSwitch("CCD_VIDEO_STREAM");
if (svp == NULL)
return false;
// If already on and enable is set or vice versa no need to change anything we return true
if ( (enable && svp->sp[0].s == ISS_ON) || (!enable && svp->sp[1].s == ISS_ON))
return true;
svp->sp[0].s = enable ? ISS_ON : ISS_OFF;
svp->sp[1].s = enable ? ISS_OFF : ISS_ON;
clientManager->sendNewSwitch(svp);
return true;
}
}
......@@ -150,6 +150,7 @@ public:
bool hasGuideHead();
bool hasCooler();
bool hasCoolerControl();
bool hasVideoStream() { return HasVideoStream; }
bool setCoolerControl(bool enable);
// Utitlity functions
......@@ -173,6 +174,9 @@ public:
TransferFormat getTransferFormat() { return transferFormat; }
bool setTransformFormat(CCD::TransferFormat format);
// Video Stream
bool setVideoStreamEnabled(bool enable);
FITSViewer *getViewer() { return fv;}
CCDChip * getChip(CCDChip::ChipType cType);
void setFITSDir(const QString &dir) { fitsDir = dir;}
......@@ -188,6 +192,7 @@ signals:
void newGuideStarData(ISD::CCDChip *chip, double dx, double dy, double fit);
void newRemoteFile(QString);
void newImage(QImage *image, ISD::CCDChip *targetChip);
void videoStreamToggled(bool enabled);
private:
void addFITSKeywords(QString filename);
......@@ -197,6 +202,7 @@ private:
bool HasGuideHead;
bool HasCooler;
bool HasCoolerControl;
bool HasVideoStream;
QString seqPrefix;
QString fitsDir;
char BLOBFilename[MAXINDIFILENAME];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment