* @brief Applies a non-RepeatNTimes timer mode to an action's QTimer. */
| 120 | * @brief Applies a non-RepeatNTimes timer mode to an action's QTimer. |
| 121 | */ |
| 122 | static void applyTimerMode(QTimer* timer, |
| 123 | DataModel::TimerMode mode, |
| 124 | bool guiTrigger, |
| 125 | const QString& actionTitle) |
| 126 | { |
| 127 | if (!timer) { |
| 128 | qWarning() << "Invalid timer pointer for action" << actionTitle; |
| 129 | return; |
| 130 | } |
| 131 | |
| 132 | if (mode == DataModel::TimerMode::StartOnTrigger && !timer->isActive()) |
| 133 | timer->start(); |
| 134 | |
| 135 | else if (mode == DataModel::TimerMode::ToggleOnTrigger && guiTrigger) { |
| 136 | if (timer->isActive()) |
| 137 | timer->stop(); |
| 138 | else |
| 139 | timer->start(); |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | //-------------------------------------------------------------------------------------------------- |
| 144 | // Constructor & singleton access |
no test coverage detected