Home
Phabricator
Search
Log In
Files
F6436162
reorderJobs.diff
wreissenberger (Wolfgang Reissenberger)
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
TallFurryMan
File Metadata
Details
File Info
Storage
Attached
Author
wreissenberger
Created
Nov 22 2018, 4:41 AM
Size
1 KB
Mime Type
text/x-diff
Engine
blob
Format
Raw Data
Handle
4034195
Attached To
D16429: Rewrite of Scheduler planning
reorderJobs.diff
View Options
diff --git a/kstars/ekos/scheduler/scheduler.cpp b/kstars/ekos/scheduler/scheduler.cpp
index cecb7e50a..a00f7855d 100644
--- a/kstars/ekos/scheduler/scheduler.cpp
+++ b/kstars/ekos/scheduler/scheduler.cpp
@@ -879,6 +879,17 @@ void Scheduler::setJobManipulation(bool can_reorder, bool can_delete)
void Scheduler::reorderJobs(QList<SchedulerJob*> reordered_sublist)
{
int destinationRow = 0;
+ /* identify the new selection position */
+ int selectedRow = queueTable->currentRow();
+ int newPosition = -1;
+
+ if (selectedRow != -1 && selectedRow < jobs.size())
+ {
+ SchedulerJob * const selectedJob = jobs.at(selectedRow);
+ newPosition = reordered_sublist.indexOf(selectedJob);
+ }
+
+ /* re-arrange due to the new order */
foreach (SchedulerJob* job, reordered_sublist)
{
/* Find the reordered job's index in the list */
@@ -890,13 +901,13 @@ void Scheduler::reorderJobs(QList<SchedulerJob*> reordered_sublist)
if (destinationRow != currentRow)
jobs.move(currentRow, destinationRow);
- /* Eventually move selection with moved job */
- if (queueTable->currentRow() == currentRow)
- queueTable->selectRow(destinationRow);
-
destinationRow++;
}
+ /* Eventually move selection with moved job */
+ if (newPosition != -1)
+ queueTable->selectRow(newPosition);
+
/* Post checks */
foreach (SchedulerJob* job, reordered_sublist)
{
TallFurryMan
added a subscriber:
TallFurryMan
.
Nov 22 2018, 6:20 AM
Comment Actions
OK that's clear :) thanks for taking the time to check this!
Log In to Comment