[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kstars/gsoc2015-ekos] kstars: Use new INDI icon and more progress in scheduler
From: Jasem Mutlaq <mutlaqja () ikarustech ! com>
Date: 2015-08-31 22:02:23
Message-ID: E1ZWX9j-0006og-Lg () scm ! kde ! org
[Download RAW message or body]
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 = STARTUP_IDLE;
shutdownState= SHUTDOWN_IDLE;
- currentJob = NULL;
- geo = 0;
+ currentJob = NULL;
+ geo = NULL;
+ captureBatch = 0;
jobUnderEdit = false;
mDirty = false;
@@ -491,6 +492,12 @@ void Scheduler::stop()
return;
// TODO stop any running jobs!
+ if (currentJob && currentJob->getState() == 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 = INDI_IDLE;
currentJob = NULL;
+ captureBatch =0;
pi->stopAnimation();
startB->setText("Start Scheduler");
+ addToQueueB->setEnabled(true);
+ removeFromQueueB->setEnabled(true);
}
void Scheduler::start()
@@ -531,6 +541,9 @@ void Scheduler::start()
currentJob = NULL;
+ addToQueueB->setEnabled(false);
+ removeFromQueueB->setEnabled(false);
+
connect(KStars::Instance()->data()->clock(), SIGNAL(timeAdvanced()), this, \
SLOT(checkStatus()));
}
@@ -837,7 +850,8 @@ int16_t Scheduler::getAltitudeScore(SchedulerJob *job, const \
SkyPoint &target)
int16_t Scheduler::getMoonSeparationScore(SchedulerJob *job, const SkyPoint &target)
{
- // TODO Add moon phase to the score
+ // TODO Use moon brightness model from Khisciunas and Shaefer
+
int16_t score=0;
double mSeparation = moon->angularDistanceTo(&target).Degrees();
@@ -1072,20 +1086,13 @@ void Scheduler::checkJobStage()
{
Q_ASSERT(currentJob != NULL);
- if (currentJob->getCompletionCondition() == SchedulerJob::FINISH_AT)
+ if (currentJob->getCompletionCondition() == SchedulerJob::FINISH_AT && \
currentJob->getState() == SchedulerJob::JOB_BUSY) {
// If the job reached it COMPLETION time, we stop it.
- if (currentJob->getCompletionTime().secsTo(KStarsData::Instance()->lt()) <= \
0) + if (KStarsData::Instance()->lt().secsTo(currentJob->getCompletionTime()) \
<= 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() == SchedulerJob::JOB_ERROR)
+ {
+ appendLogText(i18n("%1 observation job terminated due to errors.", \
currentJob->getName())); + captureBatch=0;
+ currentJob = 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() == SchedulerJob::FINISH_SEQUENCE)
{
currentJob->setState(SchedulerJob::JOB_COMPLETE);
+ captureBatch=0;
currentJob = NULL;
connect(KStars::Instance()->data()->clock(), SIGNAL(timeAdvanced()), this, \
SLOT(checkStatus())); return;
}
if (currentJob->getCompletionCondition() == SchedulerJob::FINISH_LOOP)
- {
- 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()) <= \
0) {
- appendLogText(i18n("%1 observation job reached completion time. \
Stopping...", currentJob->getName())); + appendLogText(i18np("%1 \
observation job reached completion time with #%2 batch done. Stopping...", + \
"%1 observation job reached completion time with #%2 batches done. Stopping...", \
currentJob->getName(), captureBatch+1)); \
currentJob->setState(SchedulerJob::JOB_COMPLETE); stopEkosAction();
+ captureBatch=0;
currentJob = NULL;
connect(KStars::Instance()->data()->clock(), SIGNAL(timeAdvanced()), \
this, SLOT(checkStatus())); return;
}
else
- {
+ {
appendLogText(i18n("%1 observation job completed and will restart \
now...", currentJob->getName()));
- 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;
}
}
@@ -1475,20 +1499,22 @@ void Scheduler::startCalibrating()
void Scheduler::startCapture()
{
- QString url = currentJob->getSequenceFile().toString(QUrl::PreferLocalFile);
-
- /*
- // convert to an url
- QRegExp withProtocol(QStringLiteral("^[a-zA-Z]+:"));
- if (withProtocol.indexIn(url) == 0)
- {
- dbusargs.append(QUrl::fromUserInput(url).toString());
- }
- else
- {
- const QString path = QDir::current().absoluteFilePath(url);
- dbusargs.append(QUrl::fromLocalFile(path).toString());
- }*/
+ /*
+ // convert to an url
+ QRegExp withProtocol(QStringLiteral("^[a-zA-Z]+:"));
+ if (withProtocol.indexIn(url) == 0)
+ {
+ dbusargs.append(QUrl::fromUserInput(url).toString());
+ }
+ else
+ {
+ const QString path = QDir::current().absoluteFilePath(url);
+ dbusargs.append(QUrl::fromLocalFile(path).toString());
+ }*/
+
+ captureInterface->call(QDBus::AutoDetect,"clearSequenceQueue");
+
+ QString url = currentJob->getSequenceFile().toString(QUrl::PreferLocalFile);
QList<QVariant> 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)...", \
currentJob->getName(), captureBatch+1)); + else
+ appendLogText(i18n("%1 capture is in progress...", currentJob->getName()));
}
/*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 @@
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
+ <property name="toolTip">
+ <string>Target coordinates in J2000 Epoch</string>
+ </property>
<property name="text">
- <string>RA (J2000):</string>
+ <string>J2000:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_17">
<item>
+ <widget class="QLabel" name="label_6">
+ <property name="text">
+ <string>RA</string>
+ </property>
+ </widget>
+ </item>
+ <item>
<widget class="dmsBox" name="raBox">
<property name="toolTip">
<string/>
@@ -59,7 +69,7 @@
<item>
<widget class="QLabel" name="label_2">
<property name="text">
- <string>DEC (J2000):</string>
+ <string>DEC</string>
</property>
</widget>
</item>
@@ -108,6 +118,9 @@
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_3">
+ <property name="toolTip">
+ <string>Ekos Sequence File</string>
+ </property>
<property name="text">
<string>Sequence:</string>
</property>
@@ -357,6 +370,7 @@
</layout>
<zorder></zorder>
<zorder>line</zorder>
+ <zorder>label_6</zorder>
</widget>
</item>
<item>
@@ -530,7 +544,7 @@
<item row="2" column="0">
<widget class="QCheckBox" name="weatherB">
<property name="toolTip">
- <string>Weather condition must remain safe</string>
+ <string>Weather conditions must remain safe</string>
</property>
<property name="text">
<string>Weather</string>
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 = value;
+ completionTime = value;
}
SchedulerJob::CompletionCondition SchedulerJob::getCompletionCondition() const
@@ -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-actions-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-actions-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-actions-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-actions-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 = new OpsINDI();
- dialog->addPage(opsindi, i18n("INDI"), "kstars");
+ dialog->addPage(opsindi, i18n("INDI"), "kstars_indi");
#ifdef HAVE_CFITSIO
opsekos = 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
// ==== INDIToolBar actions ================
- actionCollection()->add<KToggleAction>("show_device_manager", this, SLOT( \
slotINDIToolBar() ) )
- << i18nc("Toggle the device manager in the display", "Device Manager" )
- << QIcon::fromTheme("computer" )
- << ToolTip( i18n("Toggle Device Manager") );
- ka = actionCollection()->add<KToggleAction>("show_control_panel", this, 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<KToggleAction>("show_ekos", this, SLOT( \
slotINDIToolBar() ) ) << i18nc("Toggle Ekos in the display", "Ekos" )
<< QIcon::fromTheme("kstars_ekos" )
<< ToolTip( i18n("Toggle Ekos") );
+ ka = actionCollection()->add<KToggleAction>("show_control_panel", this, SLOT( \
slotINDIToolBar() ) ) + << i18nc("Toggle the INDI Control Panel in the \
display", "INDI Control Panel" ) + << QIcon::fromTheme("kstars_indi" )
+ << ToolTip( i18n("Toggle INDI Control Panel") );
+ ka->setEnabled(false);
ka = actionCollection()->add<KToggleAction>("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<KToggleAction>("show_device_manager", this, SLOT( \
slotINDIToolBar() ) ) + << i18nc("Toggle the device manager in the display", \
"Device Manager" ) + << 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 @@
<Action name="altitude_vs_time" />
<Action name="whats_up_tonight" />
<Action name="whats_interesting" />
- <Action name="ekos" />
<Action name="glossary" />
<Action name="scriptbuilder" />
<Action name="solarsystem" />
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic