From kde-commits Mon Aug 31 22:02:23 2015 From: Jasem Mutlaq Date: Mon, 31 Aug 2015 22:02:23 +0000 To: kde-commits Subject: [kstars/gsoc2015-ekos] kstars: Use new INDI icon and more progress in scheduler Message-Id: X-MARC-Message: https://marc.info/?l=kde-commits&m=144105855805009 Git commit 3f26d23a7f42b77f751463c8d952096dd07a4f30 by Jasem Mutlaq. Committed on 31/08/2015 at 22:02. Pushed by mutlaqja into branch 'gsoc2015-ekos'. Use new INDI icon and more progress in scheduler M +66 -37 kstars/ekos/scheduler.cpp M +2 -0 kstars/ekos/scheduler.h M +17 -3 kstars/ekos/scheduler.ui M +6 -2 kstars/ekos/schedulerjob.cpp M +1 -1 kstars/ekos/schedulerjob.h A +- -- kstars/icons/22-actions-kstars_indi.png A +- -- kstars/icons/32-actions-kstars_indi.png A +- -- kstars/icons/48-actions-kstars_indi.png A +- -- kstars/icons/64-actions-kstars_indi.png M +4 -0 kstars/icons/CMakeLists.txt M +2 -0 kstars/indi/guimanager.cpp M +1 -1 kstars/kstarsactions.cpp M +9 -9 kstars/kstarsinit.cpp M +0 -1 kstars/kstarsui-indi.rc http://commits.kde.org/kstars/3f26d23a7f42b77f751463c8d952096dd07a4f30 diff --git a/kstars/ekos/scheduler.cpp b/kstars/ekos/scheduler.cpp index 27a6d0c..114adad 100644 --- a/kstars/ekos/scheduler.cpp +++ b/kstars/ekos/scheduler.cpp @@ -39,8 +39,9 @@ Scheduler::Scheduler() startupState =3D STARTUP_IDLE; shutdownState=3D SHUTDOWN_IDLE; = - currentJob =3D NULL; - geo =3D 0; + currentJob =3D NULL; + geo =3D NULL; + captureBatch =3D 0; jobUnderEdit =3D false; mDirty =3D false; = @@ -491,6 +492,12 @@ void Scheduler::stop() return; = // TODO stop any running jobs! + if (currentJob && currentJob->getState() =3D=3D SchedulerJob::JOB_BUSY) + { + currentJob->setStage(SchedulerJob::STAGE_IDLE); + currentJob->setState(SchedulerJob::JOB_ABORTED); + stopEkosAction(); + } = disconnect(KStars::Instance()->data()->clock(), SIGNAL(timeAdvanced())= , this, SLOT(checkStatus())); disconnect(KStars::Instance()->data()->clock(), SIGNAL(timeAdvanced())= , this, SLOT(checkJobStage())); @@ -500,9 +507,12 @@ void Scheduler::stop() indiState =3D INDI_IDLE; = currentJob =3D NULL; + captureBatch =3D0; = pi->stopAnimation(); startB->setText("Start Scheduler"); + addToQueueB->setEnabled(true); + removeFromQueueB->setEnabled(true); } = void Scheduler::start() @@ -531,6 +541,9 @@ void Scheduler::start() = currentJob =3D NULL; = + addToQueueB->setEnabled(false); + removeFromQueueB->setEnabled(false); + connect(KStars::Instance()->data()->clock(), SIGNAL(timeAdvanced()), t= his, SLOT(checkStatus())); = } @@ -837,7 +850,8 @@ int16_t Scheduler::getAltitudeScore(SchedulerJob *job, = const SkyPoint &target) = int16_t Scheduler::getMoonSeparationScore(SchedulerJob *job, const SkyPoin= t &target) { - // TODO Add moon phase to the score + // TODO Use moon brightness model from Khisciunas and Shaefer + int16_t score=3D0; = double mSeparation =3D moon->angularDistanceTo(&target).Degrees(); @@ -1072,20 +1086,13 @@ void Scheduler::checkJobStage() { Q_ASSERT(currentJob !=3D NULL); = - if (currentJob->getCompletionCondition() =3D=3D SchedulerJob::FINISH_A= T) + if (currentJob->getCompletionCondition() =3D=3D SchedulerJob::FINISH_A= T && currentJob->getState() =3D=3D SchedulerJob::JOB_BUSY) { // If the job reached it COMPLETION time, we stop it. - if (currentJob->getCompletionTime().secsTo(KStarsData::Instance()-= >lt()) <=3D 0) + if (KStarsData::Instance()->lt().secsTo(currentJob->getCompletionT= ime()) <=3D 0) { - appendLogText(i18n("%1 observation job reached completion time= . Stopping...", currentJob->getName())); - currentJob->setState(SchedulerJob::JOB_COMPLETE); - - stopEkosAction(); - findNextJob(); - return; - } } = @@ -1293,7 +1300,7 @@ void Scheduler::getNextAction() } = void Scheduler::stopEkosAction() -{ +{ = switch(currentJob->getStage()) { case SchedulerJob::STAGE_IDLE: @@ -1396,22 +1403,34 @@ void Scheduler::findNextJob() { disconnect(KStars::Instance()->data()->clock(), SIGNAL(timeAdvanced())= , this, SLOT(checkJobStage())); = + if (currentJob->getState() =3D=3D SchedulerJob::JOB_ERROR) + { + appendLogText(i18n("%1 observation job terminated due to errors.",= currentJob->getName())); + captureBatch=3D0; + currentJob =3D NULL; + connect(KStars::Instance()->data()->clock(), SIGNAL(timeAdvanced()= ), this, SLOT(checkStatus())); + return; + } + // Check completion criteria = // We're done whether the job completed successfully or not. if (currentJob->getCompletionCondition() =3D=3D SchedulerJob::FINISH_S= EQUENCE) { currentJob->setState(SchedulerJob::JOB_COMPLETE); + captureBatch=3D0; currentJob =3D NULL; connect(KStars::Instance()->data()->clock(), SIGNAL(timeAdvanced()= ), this, SLOT(checkStatus())); return; } = if (currentJob->getCompletionCondition() =3D=3D SchedulerJob::FINISH_L= OOP) - { - currentJob->setState(SchedulerJob::JOB_SCHEDULED); - currentJob->setStage(SchedulerJob::STAGE_IDLE); - connect(KStars::Instance()->data()->clock(), SIGNAL(timeAdvanced()= ), this, SLOT(checkStatus())); + { = + currentJob->setState(SchedulerJob::JOB_BUSY); + currentJob->setStage(SchedulerJob::STAGE_CAPTURING); + captureBatch++; + startCapture(); + connect(KStars::Instance()->data()->clock(), SIGNAL(timeAdvanced()= ), this, SLOT(checkJobStage())); return; } = @@ -1419,19 +1438,24 @@ void Scheduler::findNextJob() { if (currentJob->getCompletionTime().secsTo(KStarsData::Instance()-= >lt()) <=3D 0) { - appendLogText(i18n("%1 observation job reached completion time= . Stopping...", currentJob->getName())); + appendLogText(i18np("%1 observation job reached completion tim= e with #%2 batch done. Stopping...", + "%1 observation job reached completion tim= e with #%2 batches done. Stopping...", currentJob->getName(), captureBatch+= 1)); currentJob->setState(SchedulerJob::JOB_COMPLETE); stopEkosAction(); + captureBatch=3D0; currentJob =3D NULL; connect(KStars::Instance()->data()->clock(), SIGNAL(timeAdvanc= ed()), this, SLOT(checkStatus())); return; } else - { + { = appendLogText(i18n("%1 observation job completed and will rest= art now...", currentJob->getName())); - currentJob->setState(SchedulerJob::JOB_SCHEDULED); - currentJob->setStage(SchedulerJob::STAGE_IDLE); - connect(KStars::Instance()->data()->clock(), SIGNAL(timeAdvanc= ed()), this, SLOT(checkStatus())); + currentJob->setState(SchedulerJob::JOB_BUSY); + currentJob->setStage(SchedulerJob::STAGE_CAPTURING); + + captureBatch++; + startCapture(); + connect(KStars::Instance()->data()->clock(), SIGNAL(timeAdvanc= ed()), this, SLOT(checkJobStage())); return; } } @@ -1475,20 +1499,22 @@ void Scheduler::startCalibrating() = void Scheduler::startCapture() { - QString url =3D currentJob->getSequenceFile().toString(QUrl::PreferLoc= alFile); - - /* - // convert to an url - QRegExp withProtocol(QStringLiteral("^[a-zA-Z]+:")); - if (withProtocol.indexIn(url) =3D=3D 0) - { - dbusargs.append(QUrl::fromUserInput(url).toString()); - } - else - { - const QString path =3D QDir::current().absoluteFilePath(url); - dbusargs.append(QUrl::fromLocalFile(path).toString()); - }*/ + /* + // convert to an url + QRegExp withProtocol(QStringLiteral("^[a-zA-Z]+:")); + if (withProtocol.indexIn(url) =3D=3D 0) + { + dbusargs.append(QUrl::fromUserInput(url).toString()); + } + else + { + const QString path =3D QDir::current().absoluteFilePath(url); + dbusargs.append(QUrl::fromLocalFile(path).toString()); + }*/ + + captureInterface->call(QDBus::AutoDetect,"clearSequenceQueue"); + + QString url =3D currentJob->getSequenceFile().toString(QUrl::PreferLoc= alFile); = = QList dbusargs; dbusargs.append(url); @@ -1498,7 +1524,10 @@ void Scheduler::startCapture() = currentJob->setStage(SchedulerJob::STAGE_CAPTURING); = - appendLogText(i18n("%1 capture is in progress...", currentJob->getName= ())); + if (captureBatch > 0) + appendLogText(i18n("%1 capture is in progress (Batch #%2)...", cur= rentJob->getName(), captureBatch+1)); + else + appendLogText(i18n("%1 capture is in progress...", currentJob->get= Name())); } = /*void Scheduler::stopGuiding() diff --git a/kstars/ekos/scheduler.h b/kstars/ekos/scheduler.h index 3cfcebc..932df68 100644 --- a/kstars/ekos/scheduler.h +++ b/kstars/ekos/scheduler.h @@ -237,6 +237,8 @@ private: = GeoLocation *geo; = + uint16_t captureBatch; + double Dawn, Dusk; = = diff --git a/kstars/ekos/scheduler.ui b/kstars/ekos/scheduler.ui index 387b49e..279709f 100644 --- a/kstars/ekos/scheduler.ui +++ b/kstars/ekos/scheduler.ui @@ -42,14 +42,24 @@ + + Target coordinates in J2000 Epoch + - RA (J2000): + J2000: + + + RA + + + + @@ -59,7 +69,7 @@ - DEC (J2000): + DEC @@ -108,6 +118,9 @@ + + Ekos Sequence File + Sequence: @@ -357,6 +370,7 @@ line + label_6 @@ -530,7 +544,7 @@ - Weather condition must remain safe + Weather conditions must remain safe Weather diff --git a/kstars/ekos/schedulerjob.cpp b/kstars/ekos/schedulerjob.cpp index a12c2fb..48eed23 100644 --- a/kstars/ekos/schedulerjob.cpp +++ b/kstars/ekos/schedulerjob.cpp @@ -126,12 +126,12 @@ void SchedulerJob::setNoMeridianFlip(bool value) } QDateTime SchedulerJob::getCompletionTime() const { - return completionTimeEdit; + return completionTime; } = void SchedulerJob::setCompletionTime(const QDateTime &value) { - completionTimeEdit =3D value; + completionTime =3D value; } = SchedulerJob::CompletionCondition SchedulerJob::getCompletionCondition() c= onst @@ -192,6 +192,10 @@ void SchedulerJob::setState(const JOBStatus &value) statusCell->setText(i18n("Complete")); break; = + case JOB_ABORTED: + statusCell->setText(i18n("Aborted")); + break; + default: statusCell->setText(i18n("Unknown")); break; diff --git a/kstars/ekos/schedulerjob.h b/kstars/ekos/schedulerjob.h index e6a0d8f..7e567e0 100644 --- a/kstars/ekos/schedulerjob.h +++ b/kstars/ekos/schedulerjob.h @@ -106,7 +106,7 @@ private: CompletionCondition completionCondition; = QDateTime startupTime; - QDateTime completionTimeEdit; + QDateTime completionTime; = QUrl sequenceFile; QUrl fitsFile; diff --git a/kstars/icons/22-actions-kstars_indi.png b/kstars/icons/22-acti= ons-kstars_indi.png new file mode 100644 index 0000000..22563c3 Binary files /dev/null and b/kstars/icons/22-actions-kstars_indi.png differ diff --git a/kstars/icons/32-actions-kstars_indi.png b/kstars/icons/32-acti= ons-kstars_indi.png new file mode 100644 index 0000000..4ec8e34 Binary files /dev/null and b/kstars/icons/32-actions-kstars_indi.png differ diff --git a/kstars/icons/48-actions-kstars_indi.png b/kstars/icons/48-acti= ons-kstars_indi.png new file mode 100644 index 0000000..af52f6d Binary files /dev/null and b/kstars/icons/48-actions-kstars_indi.png differ diff --git a/kstars/icons/64-actions-kstars_indi.png b/kstars/icons/64-acti= ons-kstars_indi.png new file mode 100644 index 0000000..0a2ae61 Binary files /dev/null and b/kstars/icons/64-actions-kstars_indi.png differ diff --git a/kstars/icons/CMakeLists.txt b/kstars/icons/CMakeLists.txt index 6535686..d8998ec 100644 --- a/kstars/icons/CMakeLists.txt +++ b/kstars/icons/CMakeLists.txt @@ -14,6 +14,7 @@ ecm_install_icons(ICONS 22-actions-kstars_stars.png 22-actions-kstars_supernovae.png 22-actions-kstars_ekos.png +22-actions-kstars_indi.png 22-actions-kstars_fitsviewer.png 32-actions-kstars_clines.png 32-actions-kstars_cnames.png @@ -29,6 +30,7 @@ ecm_install_icons(ICONS 32-actions-kstars_supernovae.png 32-actions-kstars_ekos.png 32-actions-kstars_fitsviewer.png +32-actions-kstars_indi.png 48-actions-kstars_clines.png 48-actions-kstars_cnames.png 48-actions-kstars_deepsky.png @@ -43,6 +45,7 @@ ecm_install_icons(ICONS 48-actions-kstars_supernovae.png 48-actions-kstars_ekos.png 48-actions-kstars_fitsviewer.png +48-actions-kstars_indi.png 64-actions-kstars_advanced.png 64-actions-kstars_catalog.png 64-actions-kstars_cbound.png @@ -64,5 +67,6 @@ ecm_install_icons(ICONS 64-actions-kstars_xplanet.png 64-actions-kstars_ekos.png 64-actions-kstars_fitsviewer.png +64-actions-kstars_indi.png DESTINATION ${KDE_INSTALL_ICONDIR} THEME hicolor) diff --git a/kstars/indi/guimanager.cpp b/kstars/indi/guimanager.cpp index 6fe7d9e..b4ee343 100644 --- a/kstars/indi/guimanager.cpp +++ b/kstars/indi/guimanager.cpp @@ -65,6 +65,8 @@ GUIManager::GUIManager(QWidget *parent) : QWidget(parent,= Qt::Window) = mainLayout->addWidget(mainTabWidget); = + setWindowIcon(QIcon::fromTheme("kstars_indi")); + setWindowTitle(i18n("INDI Control Panel")); setAttribute(Qt::WA_ShowModal, false); = diff --git a/kstars/kstarsactions.cpp b/kstars/kstarsactions.cpp index c11705c..982a0cd 100644 --- a/kstars/kstarsactions.cpp +++ b/kstars/kstarsactions.cpp @@ -650,7 +650,7 @@ void KStars::slotViewOps() { = #ifdef HAVE_INDI opsindi =3D new OpsINDI(); - dialog->addPage(opsindi, i18n("INDI"), "kstars"); + dialog->addPage(opsindi, i18n("INDI"), "kstars_indi"); = #ifdef HAVE_CFITSIO opsekos =3D new OpsEkos(); diff --git a/kstars/kstarsinit.cpp b/kstars/kstarsinit.cpp index adaa727..1596a9e 100644 --- a/kstars/kstarsinit.cpp +++ b/kstars/kstarsinit.cpp @@ -528,24 +528,24 @@ void KStars::initActions() { = #ifdef HAVE_INDI // =3D=3D=3D=3D INDIToolBar actions =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D - actionCollection()->add("show_device_manager", this, SL= OT( slotINDIToolBar() ) ) - << i18nc("Toggle the device manager in the display", "Device Manag= er" ) - << QIcon::fromTheme("computer" ) - << ToolTip( i18n("Toggle Device Manager") ); - ka =3D actionCollection()->add("show_control_panel", th= is, SLOT( slotINDIToolBar() ) ) - << i18nc("Toggle the control panel in the display", "Control Panel= " ) - << QIcon::fromTheme("kstars" ) - << ToolTip( i18n("Toggle Control Panel") ); - ka->setEnabled(false); actionCollection()->add("show_ekos", this, SLOT( slotIN= DIToolBar() ) ) << i18nc("Toggle Ekos in the display", "Ekos" ) << QIcon::fromTheme("kstars_ekos" ) << ToolTip( i18n("Toggle Ekos") ); + ka =3D actionCollection()->add("show_control_panel", th= is, SLOT( slotINDIToolBar() ) ) + << i18nc("Toggle the INDI Control Panel in the display", "INDI Con= trol Panel" ) + << QIcon::fromTheme("kstars_indi" ) + << ToolTip( i18n("Toggle INDI Control Panel") ); + ka->setEnabled(false); ka =3D actionCollection()->add("show_fits_viewer", this= , SLOT( slotINDIToolBar() ) ) << i18nc("Toggle the FITS Viewer in the display", "FITS Viewer" ) << QIcon::fromTheme("kstars_fitsviewer" ) << ToolTip( i18n("Toggle FITS Viewer") ); ka->setEnabled(false); + actionCollection()->add("show_device_manager", this, SL= OT( slotINDIToolBar() ) ) + << i18nc("Toggle the device manager in the display", "Device Manag= er" ) + << QIcon::fromTheme("computer" ) + << ToolTip( i18n("Toggle Device Manager") ); = #endif = if (Options::fitsDir().isEmpty()) diff --git a/kstars/kstarsui-indi.rc b/kstars/kstarsui-indi.rc index bc878e3..cfbabb6 100644 --- a/kstars/kstarsui-indi.rc +++ b/kstars/kstarsui-indi.rc @@ -71,7 +71,6 @@ -