[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kstars] kstars/ekos: Cannot use UniqueConnection with labdas so going back to regular signals/slots
From:       Jasem Mutlaq <mutlaqja () ikarustech ! com>
Date:       2016-11-01 7:44:15
Message-ID: E1c1Tjz-0006j8-Io () code ! kde ! org
[Download RAW message or body]

Git commit 8c481c8f39662204e48f1f2838fba8a9e3c6b84e by Jasem Mutlaq.
Committed on 01/11/2016 at 07:44.
Pushed by mutlaqja into branch 'master'.

Cannot use UniqueConnection with labdas so going back to regular signals/slots

M  +13   -0    kstars/ekos/align/align.cpp
M  +3    -0    kstars/ekos/align/align.h
M  +9    -33   kstars/ekos/ekosmanager.cpp
M  +31   -2    kstars/ekos/guide/guide.cpp
M  +6    -1    kstars/ekos/guide/guide.h

http://commits.kde.org/kstars/8c481c8f39662204e48f1f2838fba8a9e3c6b84e

diff --git a/kstars/ekos/align/align.cpp b/kstars/ekos/align/align.cpp
index 4518dfe..913d3d1 100644
--- a/kstars/ekos/align/align.cpp
+++ b/kstars/ekos/align/align.cpp
@@ -1895,6 +1895,19 @@ void Align::saveSettleTime()
     Options::setSettlingTime(delaySpin->value());
 }
 
+void Align::setCaptureStatus(CaptureState newState)
+{
+    switch (newState)
+    {
+    case CAPTURE_ALIGNING:
+        QTimer::singleShot(Options::settlingTime(), this, SLOT(captureAndSolve()));
+        break;
+
+    default:
+        break;
+    }
+}
+
 }
 
 
diff --git a/kstars/ekos/align/align.h b/kstars/ekos/align/align.h
index 8ec4e3c..082a85e 100644
--- a/kstars/ekos/align/align.h
+++ b/kstars/ekos/align/align.h
@@ -279,6 +279,9 @@ public slots:
     // Capture
     void setCaptureComplete();
 
+    // Update Capture Module status
+    void setCaptureStatus(Ekos::CaptureState newState);
+
 private slots:
     /* Solver Options */
     void checkLineEdits();
diff --git a/kstars/ekos/ekosmanager.cpp b/kstars/ekos/ekosmanager.cpp
index 8a8d46a..e846f1a 100644
--- a/kstars/ekos/ekosmanager.cpp
+++ b/kstars/ekos/ekosmanager.cpp
@@ -1403,16 +1403,11 @@ void EkosManager::initCapture()
 
     if (alignProcess)
     {
-        // Alignment flag
-        //connect(alignProcess, SIGNAL(solverComplete(bool)), captureProcess, \
                SLOT(enableAlignmentFlag()), Qt::UniqueConnection);
-        //connect(alignProcess, SIGNAL(solverSlewComplete()), captureProcess, \
                SLOT(checkAlignmentSlewComplete()), Qt::UniqueConnection);
-
+        // Alignment flag       
         connect(alignProcess, SIGNAL(newStatus(Ekos::AlignState)), captureProcess, \
SLOT(setAlignStatus(Ekos::AlignState)), Qt::UniqueConnection);  
-        // Meridian Flip
-        //connect(captureProcess, SIGNAL(meridialFlipTracked()), alignProcess, \
                SLOT(captureAndSolve()), Qt::UniqueConnection);
-        connect(captureProcess, &Ekos::Capture::newStatus, this, \
                [&](Ekos::CaptureState state){if (state == Ekos::CAPTURE_ALIGNING)
-            {QTimer::singleShot(Options::settlingTime(), alignProcess, \
SLOT(captureAndSolve()));}}, Qt::UniqueConnection); +        // Capture Status
+        connect(captureProcess, SIGNAL(newStatus(Ekos::CaptureState)), alignProcess, \
SLOT(setCaptureStatus(Ekos::CaptureState)), Qt::UniqueConnection);  
     }
 
@@ -1443,17 +1438,10 @@ void EkosManager::initAlign()
 
     if (captureProcess)
     {
-        // Alignment flag
-        //connect(alignProcess, SIGNAL(solverComplete(bool)), captureProcess, \
                SLOT(enableAlignmentFlag()), Qt::UniqueConnection);
-        //connect(alignProcess, SIGNAL(solverSlewComplete()), captureProcess, \
                SLOT(checkAlignmentSlewComplete()), Qt::UniqueConnection);
-
-        // Meridian Flip
-        //connect(captureProcess, SIGNAL(meridialFlipTracked()), alignProcess, \
                SLOT(captureAndSolve()), Qt::UniqueConnection);
-
+        // Align Status
         connect(alignProcess, SIGNAL(newStatus(Ekos::AlignState)), captureProcess, \
                SLOT(setAlignStatus(Ekos::AlignState)), Qt::UniqueConnection);
-
-        connect(captureProcess, &Ekos::Capture::newStatus, this, \
                [&](Ekos::CaptureState state){if (state == Ekos::CAPTURE_ALIGNING)
-            {QTimer::singleShot(Options::settlingTime(), alignProcess, \
SLOT(captureAndSolve()));}}, Qt::UniqueConnection); +        // Capture Status
+        connect(captureProcess, SIGNAL(newStatus(Ekos::CaptureState)), alignProcess, \
SLOT(setCaptureStatus(Ekos::CaptureState)), Qt::UniqueConnection);  }
 
     if (focusProcess)
@@ -1537,8 +1525,7 @@ void EkosManager::initMount()
 
     if (guideProcess)
     {
-        connect(mountProcess, &Ekos::Mount::newStatus, this, \
[&](ISD::Telescope::TelescopeStatus state){if (state == \
                ISD::Telescope::MOUNT_PARKING)
-                guideProcess->abort();}, Qt::UniqueConnection);
+        connect(mountProcess, SIGNAL(newStatus(ISD::Telescope::TelescopeStatus)), \
guideProcess, SLOT(setMountStatus(ISD::Telescope::TelescopeStatus)), \
Qt::UniqueConnection);  }
 
 }
@@ -1580,15 +1567,7 @@ void EkosManager::initGuide()
         connect(guideProcess, SIGNAL(newAxisDelta(double,double)), captureProcess, \
SLOT(setGuideDeviation(double,double)));  
         // Dithering
-        //connect(guideProcess, SIGNAL(autoGuidingToggled(bool)), captureProcess, \
                SLOT(setAutoguiding(bool)));
-        //connect(guideProcess, SIGNAL(ditherComplete()), captureProcess, \
                SLOT(resumeCapture()));
-        //connect(guideProcess, SIGNAL(ditherFailed()), captureProcess, \
                SLOT(abort()));
-        //connect(guideProcess, SIGNAL(ditherToggled(bool)), captureProcess, \
                SLOT(setGuideDither(bool)));
-        //connect(captureProcess, SIGNAL(exposureComplete()), guideProcess, \
                SLOT(dither()));
-        //connect(captureProcess, SIGNAL(exposureComplete()), guideProcess, \
                SLOT(dither()));
-
-        connect(captureProcess, &Ekos::Capture::newStatus, this, \
                [&](Ekos::CaptureState state){if (state == Ekos::CAPTURE_DITHERING)
-            {guideProcess->dither();}}, Qt::UniqueConnection);
+        connect(captureProcess, SIGNAL(newStatus(Ekos::CaptureState)), guideProcess, \
SLOT(setCaptureStatus(Ekos::CaptureState)), Qt::UniqueConnection);  
 
         // Guide Head
@@ -1604,10 +1583,7 @@ void EkosManager::initGuide()
     if (mountProcess)
     {
         // Parking
-        //connect(captureProcess, SIGNAL(mountParking()), guideProcess, \
                SLOT(stopGuiding()));
-        connect(mountProcess, &Ekos::Mount::newStatus, this, \
[&](ISD::Telescope::TelescopeStatus state){if (state == \
                ISD::Telescope::MOUNT_PARKING)
-                guideProcess->abort();}, Qt::UniqueConnection);
-
+        connect(mountProcess, SIGNAL(newStatus(ISD::Telescope::TelescopeStatus)), \
guideProcess, SLOT(setMountStatus(ISD::Telescope::TelescopeStatus)), \
Qt::UniqueConnection);  }
 
     if (focusProcess)
diff --git a/kstars/ekos/guide/guide.cpp b/kstars/ekos/guide/guide.cpp
index 2d9e966..bbd9765 100644
--- a/kstars/ekos/guide/guide.cpp
+++ b/kstars/ekos/guide/guide.cpp
@@ -992,6 +992,9 @@ bool Guide::guide()
 
 bool Guide::dither()
 {
+    if (state == GUIDE_DITHERING)
+        return true;
+
     if (guiderType == GUIDE_INTERNAL)
     {
         if (state != GUIDE_GUIDING)
@@ -1025,6 +1028,32 @@ bool Guide::resume()
         return false;
 }
 
+void Guide::setCaptureStatus(CaptureState newState)
+{
+    switch (newState)
+    {
+    case CAPTURE_DITHERING:
+        dither();
+        break;
+
+    default:
+        break;
+    }
+}
+
+void Guide::setMountStatus(ISD::Telescope::TelescopeStatus newState)
+{
+    switch (newState)
+    {
+        case ISD::Telescope::MOUNT_PARKING:
+            abort();
+        break;
+
+        default:
+        break;
+    }
+}
+
 void Guide::setExposure(double value)
 {
     exposureIN->setValue(value);
@@ -1242,11 +1271,11 @@ void Guide::processCCDNumber(INumberVectorProperty *nvp)
     }
 }
 
-void Guide::checkExposureValue(ISD::CCDChip *targetChip, double exposure, IPState \
state) +void Guide::checkExposureValue(ISD::CCDChip *targetChip, double exposure, \
IPState expState)  {
     INDI_UNUSED(exposure);
 
-    if (state == IPS_ALERT && (state == GUIDE_GUIDING) || (state == GUIDE_DITHERING) \
|| (state == GUIDE_CALIBRATING)) +    if (expState == IPS_ALERT && ( (state == \
GUIDE_GUIDING) || (state == GUIDE_DITHERING) || (state == GUIDE_CALIBRATING)) )  {
         appendLogText(i18n("Exposure failed. Restarting exposure..."));
         targetChip->capture(exposureIN->value());
diff --git a/kstars/ekos/guide/guide.h b/kstars/ekos/guide/guide.h
index 98220be..cbfe329 100644
--- a/kstars/ekos/guide/guide.h
+++ b/kstars/ekos/guide/guide.h
@@ -283,7 +283,7 @@ public slots:
       * @param exposure numbers of seconds left in the exposure
       * @param state State of the exposure property
       */
-     void checkExposureValue(ISD::CCDChip *targetChip, double exposure, IPState \
state); +     void checkExposureValue(ISD::CCDChip *targetChip, double exposure, \
IPState expState);  
      /**
       * @brief newFITS is called by the INDI framework whenever there is a new BLOB \
arriving @@ -311,6 +311,11 @@ public slots:
      // Update Guide module status
      void setStatus(Ekos::GuideState newState);
 
+     // Update Capture Module status
+     void setCaptureStatus(Ekos::CaptureState newState);
+     // Update Mount module status
+     void setMountStatus(ISD::Telescope::TelescopeStatus newState);
+
      // Star Position
      void setStarPosition(const QVector3D &newCenter, bool updateNow);
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic