Commit 18e7dcec authored by Jasem Mutlaq's avatar Jasem Mutlaq
Browse files

Improved scheduler GUI. Add ability to pause the scheduler. Fix bug with jobs...

Improved scheduler GUI. Add ability to pause the scheduler. Fix bug with jobs being re-shuffled after scoring is complete. Fix single click vs double click issue when it comes to editing a job and resetting its status. Add KDE event in case scheduler is aborted due to whatever reason
parent dde68474
This diff is collapsed.
......@@ -41,7 +41,7 @@ class Scheduler : public QWidget, public Ui::Scheduler
Q_CLASSINFO("D-Bus Interface", "org.kde.kstars.Ekos.Scheduler")
public:
typedef enum { SCHEDULER_IDLE, SCHEDULER_STARTUP, SCHEDULER_RUNNIG, SCHEDULER_SHUTDOWN, SCHEDULER_ABORTED } SchedulerState;
typedef enum { SCHEDULER_IDLE, SCHEDULER_STARTUP, SCHEDULER_RUNNIG, SCHEDULER_PAUSED, SCHEDULER_SHUTDOWN, SCHEDULER_ABORTED } SchedulerState;
typedef enum { EKOS_IDLE, EKOS_STARTING, EKOS_READY } EkosState;
typedef enum { INDI_IDLE, INDI_CONNECTING, INDI_PROPERTY_CHECK, INDI_READY } INDIState;
typedef enum { STARTUP_IDLE, STARTUP_SCRIPT, STARTUP_UNPARK_DOME, STARTUP_UNPARKING_DOME, STARTUP_UNPARK_MOUNT, STARTUP_UNPARKING_MOUNT, STARTUP_UNPARK_CAP, STARTUP_UNPARKING_CAP, STARTUP_ERROR, STARTUP_COMPLETE } StartupState;
......@@ -190,9 +190,10 @@ protected slots:
/**
* @brief removeJob Remove a job from the currently selected row. If no row is selected, it remove the last job in the queue.
*/
void removeJob();
void removeJob();
void toggleScheduler();
void pause();
void save();
void saveAs();
void load();
......@@ -443,7 +444,7 @@ private:
* @param path path of a file
* @return true on success, false on failure.
*/
bool saveScheduler(const QUrl &fileURL);
bool saveScheduler(const QUrl &fileURL);
/**
* @brief processJobInfo Process the job information from a scheduler file and populate jobs accordingly
......@@ -508,7 +509,7 @@ private:
ShutdownState shutdownState;
ParkWaitStatus parkWaitState;
QList<SchedulerJob *> jobs; // List of all jobs
QList<SchedulerJob *> jobs; // List of all jobs as entered by the user or file
SchedulerJob *currentJob; // Active job
QUrl schedulerURL; // URL to store the scheduler file
......@@ -520,7 +521,7 @@ private:
QStringList logText; // Store all log strings
QProgressIndicator *pi; // Busy indicator widget
bool jobUnderEdit; // Are we editing a job right now?
int jobUnderEdit; // Are we editing a job right now? Job row index
KSMoon *moon; // Pointer to Moon object
GeoLocation *geo; // Pointer to Geograpic locatoin
......@@ -533,8 +534,8 @@ private:
QDateTime preDawnDateTime; // Pre-dawn is where we stop all jobs, it is a user-configurable value before Dawn.
QDateTime duskDateTime; // Dusk date time
bool mDirty; // Was job modified and needs saving?
IPState weatherStatus; // Keep watch of weather status
uint8_t noWeatherCounter; // Keep track of how many times we didn't receive weather updates
IPState weatherStatus; // Keep watch of weather status
uint8_t noWeatherCounter; // Keep track of how many times we didn't receive weather updates
bool preemptiveShutdown; // Are we shutting down until later?
bool jobEvaluationOnly; // Only run job evaluation
bool loadAndSlewProgress; // Keep track of Load & Slew operation
......
......@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>722</width>
<height>488</height>
<height>441</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
......@@ -16,7 +16,7 @@
<property name="title">
<string>1. Object &amp;&amp; Sequence Selection</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_18" stretch="1,1,1">
<layout class="QHBoxLayout" name="horizontalLayout_18">
<item>
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="2">
......@@ -534,13 +534,99 @@
<string>End Time</string>
</property>
</column>
<column>
<property name="text">
<string>Est. Duration</string>
</property>
</column>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="bottomLayout">
<item>
<widget class="QPushButton" name="startB">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="toolTip">
<string>Start Scheduler</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pauseB">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="toolTip">
<string>Pause Scheduler</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="sleepLabel">
<property name="maximumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<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>
</layout>
</item>
</layout>
</item>
</layout>
<zorder></zorder>
<zorder>line</zorder>
<zorder></zorder>
</widget>
</item>
<item>
......@@ -1162,44 +1248,17 @@
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="bottomLayout">
<item>
<widget class="QPushButton" name="startB">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Start Scheduler</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="sleepLabel">
<property name="maximumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<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>
</layout>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
......@@ -1214,27 +1273,27 @@
<resources/>
<connections/>
<buttongroups>
<buttongroup name="startupProcedureButtonGroup">
<buttongroup name="stepsButtonGroup">
<property name="exclusive">
<bool>false</bool>
</property>
</buttongroup>
<buttongroup name="startupButtonGroup"/>
<buttongroup name="constraintButtonGroup">
<buttongroup name="shutdownProcedureGroup">
<property name="exclusive">
<bool>false</bool>
</property>
</buttongroup>
<buttongroup name="completionButtonGroup"/>
<buttongroup name="stepsButtonGroup">
<buttongroup name="startupProcedureButtonGroup">
<property name="exclusive">
<bool>false</bool>
</property>
</buttongroup>
<buttongroup name="shutdownProcedureGroup">
<buttongroup name="startupButtonGroup"/>
<buttongroup name="constraintButtonGroup">
<property name="exclusive">
<bool>false</bool>
</property>
</buttongroup>
<buttongroup name="completionButtonGroup"/>
</buttongroups>
</ui>
......@@ -28,6 +28,7 @@ SchedulerJob::SchedulerJob()
statusCell = NULL;
startupCell = NULL;
estimatedTimeCell = NULL;
minAltitude = -1;
minMoonSeparation = -1;
estimatedTime = -1;
......@@ -61,7 +62,7 @@ SchedulerJob::StartupCondition SchedulerJob::getStartupCondition() const
void SchedulerJob::setStartupCondition(const StartupCondition &value)
{
startupCondition = value;
startupCondition = value;
}
QDateTime SchedulerJob::getStartupTime() const
......@@ -191,7 +192,7 @@ void SchedulerJob::setState(const JOBStatus &value)
break;
case JOB_ABORTED:
statusCell->setText(i18n("Aborted"));
statusCell->setText(i18n("Aborted"));
break;
case JOB_ERROR:
......@@ -346,6 +347,12 @@ double SchedulerJob::getEstimatedTime() const
void SchedulerJob::setEstimatedTime(const double &value)
{
estimatedTime = value;
if (estimatedTimeCell)
{
QTime estimatedTime = QTime::fromMSecsSinceStartOfDay(value*3600);
estimatedTimeCell->setText(estimatedTime.toString("HH:mm:ss"));
}
}
bool SchedulerJob::getTimeSlotAllocated() const
{
......@@ -397,13 +404,23 @@ void SchedulerJob::setProfile(const QString &value)
profile = value;
}
QTableWidgetItem *SchedulerJob::getEstimatedTimeCell() const
{
return estimatedTimeCell;
}
void SchedulerJob::setEstimatedTimeCell(QTableWidgetItem *value)
{
estimatedTimeCell = value;
}
void SchedulerJob::setTargetCoords(dms ra, dms dec)
{
targetCoords.setRA0(ra);
targetCoords.setDec0(dec);
targetCoords.updateCoordsNow(KStarsData::Instance()->updateNum());
}
......
......@@ -113,6 +113,9 @@ public:
QString getProfile() const;
void setProfile(const QString &value);
QTableWidgetItem *getEstimatedTimeCell() const;
void setEstimatedTimeCell(QTableWidgetItem *value);
private:
QString name;
......@@ -140,7 +143,7 @@ private:
StepPipeline stepPipeline;
QTableWidgetItem* statusCell, *startupCell;
QTableWidgetItem* statusCell, *startupCell, *estimatedTimeCell;
int score;
int16_t culminationOffset;
......@@ -149,7 +152,7 @@ private:
bool timeSlotAllocated;
bool inSequenceFocus;
double Dawn, Dusk;
double Dawn, Dusk;
QString dateTimeDisplayFormat;
QString profile;
......
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