• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

graphia-app / graphia / 43963853428

16 Nov 2026 09:48PM UTC coverage: 82.248% (+0.03%) from 82.223%
43963853428

push

github

timangus
CLAUDE: PROBE Share one set of element programs between every renderer

13318 of 18586 branches covered (71.66%)

Branch coverage included in aggregate %.

3 of 7 new or added lines in 1 file covered. (42.86%)

2 existing lines in 2 files now uncovered.

36432 of 41902 relevant lines covered (86.95%)

767190.63 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

80.59
/source/app/commands/commandmanager.cpp
1
/* Copyright © 2013-2025 Tim Angus
2
 * Copyright © 2013-2025 Tom Freeman
3
 *
4
 * This file is part of Graphia.
5
 *
6
 * Graphia is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU General Public License as published by
8
 * the Free Software Foundation, either version 3 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * Graphia is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with Graphia.  If not, see <http://www.gnu.org/licenses/>.
18
 */
19

20
#include "commandmanager.h"
21

22
#include "shared/utils/thread.h"
23
#include "app/preferences.h"
24

25
#include <QDebug>
26

27
#include <cstddef>
28

29
using namespace Qt::Literals::StringLiterals;
30

31
CommandManager::CommandManager() :
32
    _graphChanged(false), _debug(qEnvironmentVariableIntValue("COMMAND_DEBUG"))
756 ✔
33
{
756 ✔
34
    connect(this, &CommandManager::commandQueued, this, &CommandManager::update);
756 ✔
35
    connect(this, &CommandManager::commandCompleted, this, &CommandManager::onCommandCompleted);
756 ✔
36
    connect(this, &CommandManager::postCommandFunctionScheduled, this, &CommandManager::update);
756 ✔
37
    connect(this, &CommandManager::postCommandFunctionCompleted, this, &CommandManager::onPostCommandFunctionCompleted);
756 ✔
38
}
756 ✔
39

40
CommandManager::~CommandManager()
41
{
756 ✔
42
    if(_thread.joinable())
756 !
43
    {
×
44
        if(_currentCommand != nullptr)
×
45
            _currentCommand->cancel();
×
46

47
        joinThread();
×
48
    }
×
49
}
756 ✔
50

51
void CommandManager::execute(ExecutePolicy policy, ICommandPtr command)
52
{
744 ✔
53
    CommandAction action;
744 ✔
54

55
    switch(policy)
744 ✔
56
    {
744 ✔
57
    default:
×
58
    case ExecutePolicy::Add:        action = CommandAction::Execute; break;
262 ✔
59
    case ExecutePolicy::Replace:    action = CommandAction::ExecuteReplace; break;
2 ✔
60

61
    case ExecutePolicy::OnceMutate: command->_notAllowedToChangeGraph = false;
4 ✔
62
        [[fallthrough]];
4 ✔
63
    case ExecutePolicy::Once:       action = CommandAction::ExecuteOnce; break;
480 ✔
64
    }
744 ✔
65

66
    const std::unique_lock<std::recursive_mutex> lock(_queueMutex);
744 ✔
67
    _pendingCommands.emplace_back(action, std::move(command));
744 ✔
68
    emit commandQueued();
744 ✔
69
}
744 ✔
70

71
void CommandManager::setPhase(const QString& phase)
72
{
2,440 ✔
73
    const std::unique_lock<std::recursive_mutex> lock(_currentCommandMutex);
2,440 ✔
74

75
    if(_currentCommand != nullptr)
2,440 ✔
76
        _currentCommand->setPhase(phase);
176 ✔
77
}
2,440 ✔
78

79
void CommandManager::undo()
80
{
66 ✔
81
    const std::unique_lock<std::recursive_mutex> lock(_queueMutex);
66 ✔
82
    _pendingCommands.emplace_back(CommandAction::Undo);
66 ✔
83
    emit commandQueued();
66 ✔
84
}
66 ✔
85

86
void CommandManager::redo()
87
{
16 ✔
88
    const std::unique_lock<std::recursive_mutex> lock(_queueMutex);
16 ✔
89
    _pendingCommands.emplace_back(CommandAction::Redo);
16 ✔
90
    emit commandQueued();
16 ✔
91
}
16 ✔
92

93
void CommandManager::rollback()
94
{
4 ✔
95
    const std::unique_lock<std::recursive_mutex> lock(_queueMutex);
4 ✔
96
    _pendingCommands.emplace_back(CommandAction::Rollback);
4 ✔
97
    emit commandQueued();
4 ✔
98
}
4 ✔
99

100
static void commandStartDebug(int debug, bool busy, const QString& verb)
101
{
824 ✔
102
    if(debug > 0 && !busy)
824 !
103
        qDebug() << "CommandManager started";
824 ✔
104

105
    if(debug > 1)
824 !
106
    {
×
107
        if(verb.isEmpty())
×
108
            qDebug() << "Command started" << verb;
×
109
        else
×
110
            qDebug() << "Command started";
×
111
    }
×
112
}
824 ✔
113

114
void CommandManager::executeReal(ICommandPtr command, CommandAction action)
115
{
742 ✔
116
    Q_ASSERT(action == CommandAction::Execute ||
742 !
117
        action == CommandAction::ExecuteReplace ||
742 ✔
118
        action == CommandAction::ExecuteOnce);
742 ✔
119

120
    commandStartDebug(_debug, _busy, command->description());
742 ✔
121

122
    auto* commandPtr = command.get();
742 ✔
123
    auto verb = command->verb();
742 ✔
124
    auto maxUndoLevels = u::pref(u"misc/maxUndoLevels"_s).toInt();
742 ✔
125
    doCommand(commandPtr, verb, [this, command = std::move(command), action, maxUndoLevels]() mutable
742 ✔
126
    {
742 ✔
127
        const std::unique_lock<std::recursive_mutex> lock(_mutex);
742 ✔
128

129
        const QString commandName = command->description().length() > 0 ?
742 ✔
130
            command->description() : u"Anon Command"_s;
662 ✔
131
        u::setCurrentThreadName(commandName);
742 ✔
132

133
        _graphChanged = false;
742 ✔
134

135
        QString description;
742 ✔
136
        QString pastParticiple;
742 ✔
137
        bool success = false;
742 ✔
138

139
        if(action == CommandAction::ExecuteReplace && lastExecutedCommand() != nullptr)
742 !
140
            command->replaces(lastExecutedCommand());
2 ✔
141

142
        if(command->execute() && !command->cancelled())
742 ✔
143
        {
694 ✔
144
            description = command->description();
694 ✔
145
            pastParticiple = command->pastParticiple();
694 ✔
146
            success = true;
694 ✔
147

148
            if(action != CommandAction::ExecuteOnce)
694 ✔
149
            {
256 ✔
150
                // There are commands on the stack ahead of us; throw them away
151
                while(canRedoNoLocking())
266 ✔
152
                    _stack.pop_back();
10 ✔
153

154
                if(!_stack.empty() && action == CommandAction::ExecuteReplace)
256 ✔
155
                    _stack.pop_back();
2 ✔
156

157
                _stack.push_back(std::move(command));
256 ✔
158

159
                if(maxUndoLevels > 0)
256 !
160
                {
256 ✔
161
                    // Lose commands at the bottom of the stack until
162
                    // we reach the maximum stack size
163
                    while(static_cast<int>(_stack.size()) > maxUndoLevels)
258 ✔
164
                        _stack.pop_front();
2 ✔
165
                }
256 ✔
166

167
                _lastExecutedIndex = static_cast<int>(_stack.size()) - 1;
256 ✔
168
            }
256 ✔
169
            else if(command->_notAllowedToChangeGraph && _graphChanged)
438 !
170
            {
×
171
                // The graph changed during an irreversible command, so throw
172
                // away our redo history as it is likely no longer coherent with
173
                // the current state
174
                clearCommandStackNoLocking();
×
175
                qDebug() << "WARNING: ExecuteOnce command" << commandName <<
×
176
                    "changed state, so the command stack was cleared";
×
177
            }
×
178
        }
694 ✔
179

180
        runPostCommandFunction();
742 ✔
181
        clearCurrentCommand();
742 ✔
182

183
        emit commandCompleted(success, description, pastParticiple);
742 ✔
184
    });
742 ✔
185
}
742 ✔
186

187
void CommandManager::undoReal(NamedBool<"rollback"> rollback)
188
{
70 ✔
189
    if(!canUndoNoLocking())
70 ✔
190
        return;
2 ✔
191

192
    auto* command = _stack.at(static_cast<size_t>(_lastExecutedIndex)).get();
68 ✔
193

194
    QString undoVerb = !command->description().isEmpty() ?
68 !
195
                QObject::tr("Undoing %1").arg(command->description()) :
68 ✔
196
                QObject::tr("Undoing");
68 ✔
197

198
    if(rollback)
68 ✔
199
    {
4 ✔
200
        // Rollbacks are silent to the user
201
        undoVerb.clear();
4 ✔
202
    }
4 ✔
203

204
    commandStartDebug(_debug, _busy, undoVerb);
68 ✔
205

206
    doCommand(command, undoVerb, [this, command, rollback]
68 ✔
207
    {
68 ✔
208
        const std::unique_lock<std::recursive_mutex> lock(_mutex);
68 ✔
209

210
        u::setCurrentThreadName(u"(u) "_s + command->description());
68 ✔
211
        auto description = QObject::tr("Undo %1").arg(command->description());
68 ✔
212

213
        command->undo();
68 ✔
214
        _lastExecutedIndex--;
68 ✔
215

216
        runPostCommandFunction();
68 ✔
217
        clearCurrentCommand();
68 ✔
218

219
        if(rollback)
68 ✔
220
        {
4 ✔
221
            // If rolling back, prevent redo, of this command and of any that were
222
            // undone before it, as they can't be redone without it
223
            _stack.erase(_stack.begin() + (_lastExecutedIndex + 1), _stack.end());
4 ✔
224
        }
4 ✔
225

226
        emit commandCompleted(true, description, {});
68 ✔
227
    });
68 ✔
228
}
68 ✔
229

230
void CommandManager::redoReal()
231
{
16 ✔
232
    if(!canRedoNoLocking())
16 ✔
233
        return;
2 ✔
234

235
    auto* command = _stack.at(static_cast<size_t>(++_lastExecutedIndex)).get();
14 ✔
236

237
    const QString redoVerb = !command->description().isEmpty() ?
14 !
238
                QObject::tr("Redoing %1").arg(command->description()) :
14 ✔
239
                QObject::tr("Redoing");
14 ✔
240

241
    commandStartDebug(_debug, _busy, redoVerb);
14 ✔
242

243
    doCommand(command, redoVerb, [this, command]
14 ✔
244
    {
14 ✔
245
        const std::unique_lock<std::recursive_mutex> lock(_mutex);
14 ✔
246

247
        u::setCurrentThreadName(u"(r) "_s + command->description());
14 ✔
248
        auto description = QObject::tr("Redo %1").arg(command->description());
14 ✔
249

250
        command->execute();
14 ✔
251

252
        runPostCommandFunction();
14 ✔
253
        clearCurrentCommand();
14 ✔
254

255
        emit commandCompleted(true, description, command->pastParticiple());
14 ✔
256
    });
14 ✔
257
}
14 ✔
258

259
bool CommandManager::canUndo() const
260
{
20 ✔
261
    const std::unique_lock<std::recursive_mutex> lock(_mutex, std::try_to_lock);
20 ✔
262

263
    if(lock.owns_lock())
20 !
264
        return canUndoNoLocking();
20 ✔
265

266
    return false;
×
267
}
20 ✔
268

269
bool CommandManager::canRedo() const
270
{
16 ✔
271
    const std::unique_lock<std::recursive_mutex> lock(_mutex, std::try_to_lock);
16 ✔
272

273
    if(lock.owns_lock())
16 !
274
        return canRedoNoLocking();
16 ✔
275

276
    return false;
×
277
}
16 ✔
278

279
bool CommandManager::commandIsCancellable() const
280
{
8 ✔
281
    const std::unique_lock<std::recursive_mutex> lock(_currentCommandMutex);
8 ✔
282

283
    if(_currentCommand != nullptr)
8 ✔
284
        return _currentCommand->cancellable();
4 ✔
285

286
    return false;
4 ✔
287
}
8 ✔
288

289
std::vector<QString> CommandManager::undoableCommandDescriptions() const
290
{
20 ✔
291
    const std::unique_lock<std::recursive_mutex> lock(_mutex, std::try_to_lock);
20 ✔
292
    std::vector<QString> commandDescriptions;
20 ✔
293
    commandDescriptions.reserve(static_cast<size_t>(_lastExecutedIndex));
20 ✔
294

295
    if(lock.owns_lock() && canUndoNoLocking())
20 !
296
    {
20 ✔
297
        for(int index = _lastExecutedIndex; index >= 0; index--)
48 ✔
298
            commandDescriptions.push_back(_stack.at(static_cast<size_t>(index))->description());
28 ✔
299
    }
20 ✔
300

301
    return commandDescriptions;
20 ✔
302
}
20 ✔
303

304
std::vector<QString> CommandManager::redoableCommandDescriptions() const
305
{
4 ✔
306
    const std::unique_lock<std::recursive_mutex> lock(_mutex, std::try_to_lock);
4 ✔
307
    std::vector<QString> commandDescriptions;
4 ✔
308
    commandDescriptions.reserve(_stack.size());
4 ✔
309

310
    if(lock.owns_lock() && canRedoNoLocking())
4 !
311
    {
4 ✔
312
        for(size_t index = static_cast<size_t>(_lastExecutedIndex) + 1; index < _stack.size(); index++)
10 ✔
313
            commandDescriptions.push_back(_stack.at(index)->description());
6 ✔
314
    }
4 ✔
315

316
    return commandDescriptions;
4 ✔
317
}
4 ✔
318

319
QString CommandManager::nextUndoAction() const
320
{
8 ✔
321
    const std::unique_lock<std::recursive_mutex> lock(_mutex, std::try_to_lock);
8 ✔
322

323
    if(lock.owns_lock() && canUndoNoLocking())
8 !
324
    {
8 ✔
325
        const auto& command = _stack.at(static_cast<size_t>(_lastExecutedIndex));
8 ✔
326
        if(!command->description().isEmpty())
8 !
327
            return QObject::tr("&Undo %1").arg(command->description());
8 ✔
328
    }
8 ✔
329

330
    return tr("&Undo");
×
331
}
8 ✔
332

333
QString CommandManager::nextRedoAction() const
334
{
2 ✔
335
    const std::unique_lock<std::recursive_mutex> lock(_mutex, std::try_to_lock);
2 ✔
336

337
    if(lock.owns_lock() && canRedoNoLocking())
2 !
338
    {
2 ✔
339
        const auto& command = _stack.at(static_cast<size_t>(_lastExecutedIndex) + 1);
2 ✔
340
        if(!command->description().isEmpty())
2 !
341
            return QObject::tr("&Redo %1").arg(command->description());
2 ✔
342
    }
2 ✔
343

344
    return tr("&Redo");
×
345
}
2 ✔
346

347
bool CommandManager::busy() const
348
{
15,368 ✔
349
    return _busy;
15,368 ✔
350
}
15,368 ✔
351

352
void CommandManager::setPostCommandFunction(std::function<void()> task)
353
{
1,300 ✔
354
    // The task is read by the command thread, which only ever starts after this
355
    Q_ASSERT(!_threadActive);
1,300 !
356

357
    _postCommandFunction = std::move(task);
1,300 ✔
358
}
1,300 ✔
359

360
void CommandManager::clearPostCommandFunction()
361
{
694 ✔
362
    setPostCommandFunction({});
694 ✔
363
}
694 ✔
364

365
void CommandManager::schedulePostCommandFunction()
366
{
482 ✔
367
    // Only the first request since the task last ran needs to do anything; this
368
    // is called from any thread, and possibly very often
369
    if(!_postCommandFunctionScheduled.exchange(true))
482 ✔
370
        emit postCommandFunctionScheduled();
470 ✔
371
}
482 ✔
372

373
void CommandManager::runPostCommandFunction()
374
{
922 ✔
375
    // Anything requested from here on needs another run, so clear this first
376
    _postCommandFunctionScheduled = false;
922 ✔
377

378
    if(_postCommandFunction)
922 ✔
379
        _postCommandFunction();
802 ✔
380
}
922 ✔
381

382
void CommandManager::runPostCommandFunctionAsync()
383
{
98 ✔
384
    // If the command thread is still joinable, we shouldn't be here
385
    Q_ASSERT(!_thread.joinable());
98 !
386

387
    if(_debug > 1)
98 !
388
        qDebug() << "Post command task started";
98 ✔
389

390
    _threadActive = true;
98 ✔
391
    _thread = std::thread([this]
98 ✔
392
    {
98 ✔
393
        runPostCommandFunction();
98 ✔
394
        emit postCommandFunctionCompleted();
98 ✔
395
    });
98 ✔
396
}
98 ✔
397

398
void CommandManager::onPostCommandFunctionCompleted()
399
{
78 ✔
400
    joinThread();
78 ✔
401
    update();
78 ✔
402
}
78 ✔
403

404
void CommandManager::clearCommandStack()
405
{
2 ✔
406
    const std::unique_lock<std::recursive_mutex> lock(_mutex);
2 ✔
407

408
    // If a command is still in progress, wait until it's finished
409
    joinThread();
2 ✔
410

411
    clearCommandStackNoLocking();
2 ✔
412
}
2 ✔
413

414
void CommandManager::clearCommandStackNoLocking()
415
{
2 ✔
416
    _stack.clear();
2 ✔
417
    _lastExecutedIndex = -1;
2 ✔
418

419
    // Force a UI update
420
    emit commandStackCleared();
2 ✔
421
}
2 ✔
422

423
void CommandManager::clearCurrentCommand()
424
{
824 ✔
425
    // _currentCommand is a raw pointer, so we must ensure it is reset to null
426
    // when the underlying unique_ptr is destroyed
427
    const std::unique_lock<std::recursive_mutex> lock(_currentCommandMutex);
824 ✔
428
    _currentCommand = nullptr;
824 ✔
429

430
    const bool wasCancelling = _cancelling;
824 ✔
431
    _cancelling = false;
824 ✔
432

433
    if(wasCancelling)
824 ✔
434
        emit commandIsCancellingChanged();
6 ✔
435
}
824 ✔
436

437

438
void CommandManager::cancel()
439
{
8 ✔
440
    const std::unique_lock<std::recursive_mutex> lock(_currentCommandMutex);
8 ✔
441

442
    if(_currentCommand != nullptr)
8 ✔
443
    {
6 ✔
444
        _cancelling = true;
6 ✔
445
        emit commandIsCancellingChanged();
6 ✔
446
        _currentCommand->cancel();
6 ✔
447

448
        if(_debug > 0)
6 !
449
            qDebug() << "Command cancel request" << _currentCommand->description();
6 ✔
450
    }
6 ✔
451
}
8 ✔
452

453
void CommandManager::waitForCompletionAndDiscard()
454
{
696 ✔
455
    joinThread();
696 ✔
456

457
    // Queued commands are only started once the main thread processes the completion
458
    // of the one before, which it can't do while it's waiting here, so discard them
459
    const std::unique_lock<std::recursive_mutex> lock(_queueMutex);
696 ✔
460
    _pendingCommands.clear();
696 ✔
461
}
696 ✔
462

463
QString CommandManager::commandStackSummary() const
464
{
×
465
    // Strictly speaking this should be locked, but since
466
    // it is only ever called in a setting where we're
467
    // crashed, that could cause problems
468

469
    QString text;
×
470
    int index = 0;
×
471

472
    for(const auto& command : _stack)
×
473
    {
×
474
        if(!text.isEmpty())
×
475
            text.append("\n");
×
476

477
        if(_lastExecutedIndex == index++)
×
478
            text.append("*");
×
479

480
        text.append(command->debugDescription());
×
481
    }
×
482

483
    if(_currentCommand != nullptr)
×
484
    {
×
485
        text.append(u"\n#%1"_s.arg(
×
486
            _currentCommand->debugDescription()));
×
487
    }
×
488

489
    return text;
×
490
}
×
491

492
void CommandManager::joinThread()
493
{
1,600 ✔
494
    if(_thread.joinable())
1,600 ✔
495
    {
922 ✔
496
        _thread.join();
922 ✔
497
        _threadActive = false;
922 ✔
498
    }
922 ✔
499
}
1,600 ✔
500

501
void CommandManager::timerEvent(QTimerEvent*)
502
{
2 ✔
503
    const std::unique_lock<std::recursive_mutex> lock(_currentCommandMutex);
2 ✔
504

505
    if(_currentCommand == nullptr)
2 !
UNCOV
506
        return;
×
507

508
    auto newCommandProgress = _currentCommand->progress();
2 ✔
509

510
    if(newCommandProgress != _commandProgress)
2 !
511
    {
2 ✔
512
        _commandProgress = newCommandProgress;
2 ✔
513
        emit commandProgressChanged();
2 ✔
514
    }
2 ✔
515

516
    auto newCommandPhase = _currentCommand->phase();
2 ✔
517

518
    if(newCommandPhase != _commandPhase)
2 !
519
    {
×
520
        _commandPhase = newCommandPhase;
×
521
        emit commandPhaseChanged();
×
522
    }
×
523
}
2 ✔
524

525
bool CommandManager::canUndoNoLocking() const
526
{
118 ✔
527
    return _lastExecutedIndex >= 0;
118 ✔
528
}
118 ✔
529

530
bool CommandManager::canRedoNoLocking() const
531
{
304 ✔
532
    return _lastExecutedIndex < static_cast<int>(_stack.size()) - 1;
304 ✔
533
}
304 ✔
534

535
const ICommand* CommandManager::lastExecutedCommand() const
536
{
4 ✔
537
    if(_stack.empty() || _lastExecutedIndex < 0)
4 !
538
        return nullptr;
×
539

540
    return _stack.at(static_cast<size_t>(_lastExecutedIndex)).get();
4 ✔
541
}
4 ✔
542

543
bool CommandManager::commandsArePending() const
544
{
2,476 ✔
545
    const std::unique_lock<std::recursive_mutex> lock(_queueMutex);
2,476 ✔
546

547
    return !_pendingCommands.empty();
2,476 ✔
548
}
2,476 ✔
549

550
CommandManager::PendingCommand CommandManager::nextPendingCommand()
551
{
828 ✔
552
    const std::unique_lock<std::recursive_mutex> lock(_queueMutex);
828 ✔
553

554
    if(_pendingCommands.empty())
828 !
555
        return {};
×
556

557
    auto pendingCommand = std::move(_pendingCommands.front());
828 ✔
558
    _pendingCommands.pop_front();
828 ✔
559

560
    return pendingCommand;
828 ✔
561
}
828 ✔
562

563
void CommandManager::onCommandCompleted(bool success, const QString& description, const QString&)
564
{
824 ✔
565
    killTimer(_commandProgressTimerId);
824 ✔
566
    _commandProgressTimerId = -1;
824 ✔
567

568
    joinThread();
824 ✔
569

570
    if(_debug > 1)
824 !
571
    {
×
572
        if(success)
×
573
        {
×
574
            if(!description.isEmpty())
×
575
                qDebug() << "Command completed" << description;
×
576
            else
×
577
                qDebug() << "Command completed";
×
578
        }
×
579
        else
×
580
            qDebug() << "Command failed/cancelled";
×
581
    }
×
582

583
    if(commandsArePending())
824 ✔
584
        update();
58 ✔
585
    else
766 ✔
586
    {
766 ✔
587
        _busy = false;
766 ✔
588
        emit finished();
766 ✔
589

590
        if(_debug > 0)
766 !
591
            qDebug() << "CommandManager finished";
766 ✔
592

593
        emit commandIsCancellableChanged();
766 ✔
594

595
        // The post command task may have been requested again since it last ran
596
        update();
766 ✔
597
    }
766 ✔
598
}
824 ✔
599

600
void CommandManager::update()
601
{
2,202 ✔
602
    if(_threadActive)
2,202 ✔
603
        return;
550 ✔
604

605
    if(!commandsArePending())
1,652 ✔
606
    {
824 ✔
607
        // Commands take precedence; each of them runs the task anyway once it's done
608
        if(_postCommandFunctionScheduled && _postCommandFunction)
824 !
609
            runPostCommandFunctionAsync();
98 ✔
610

611
        return;
824 ✔
612
    }
824 ✔
613

614
    auto pendingCommand = nextPendingCommand();
828 ✔
615
    switch(pendingCommand._action)
828 ✔
616
    {
828 ✔
617
    case CommandAction::Execute:
260 ✔
618
    case CommandAction::ExecuteReplace:
262 ✔
619
    case CommandAction::ExecuteOnce:
742 ✔
620
        executeReal(std::move(pendingCommand._command), pendingCommand._action);
742 ✔
621
        break;
742 ✔
622

623
    case CommandAction::Undo:       undoReal(); break;
66 ✔
624
    case CommandAction::Redo:       redoReal(); break;
16 ✔
625
    case CommandAction::Rollback:   undoReal("rollback"_yes); break;
4 ✔
626
    default: break;
×
627
    }
828 ✔
628
}
828 ✔
629

630
void CommandManager::onGraphChanged(const Graph*, bool changeOccurred)
631
{
94 ✔
632
    if(changeOccurred)
94 ✔
633
        _graphChanged = true;
72 ✔
634
}
94 ✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc