diff options
| author | spycrab <spycrab@users.noreply.github.com> | 2019-03-31 04:49:57 +0200 |
|---|---|---|
| committer | spycrab <spycrab@users.noreply.github.com> | 2019-03-31 05:27:34 +0200 |
| commit | 039b1baa3a20441c136ac115098f69374a1ead13 (patch) | |
| tree | a90c0704684b5860510e7b9e802717136f77f9fe /Source/Core/DolphinQt/TAS/TASCheckBox.cpp | |
| parent | 0bce1c509de46e3be3eeef732f264f1b17e3e333 (diff) | |
Qt/TAS: Implement turbo mode
Diffstat (limited to 'Source/Core/DolphinQt/TAS/TASCheckBox.cpp')
| -rw-r--r-- | Source/Core/DolphinQt/TAS/TASCheckBox.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/Source/Core/DolphinQt/TAS/TASCheckBox.cpp b/Source/Core/DolphinQt/TAS/TASCheckBox.cpp new file mode 100644 index 0000000000..9f4d34514e --- /dev/null +++ b/Source/Core/DolphinQt/TAS/TASCheckBox.cpp @@ -0,0 +1,40 @@ +// Copyright 2019 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#include "DolphinQt/TAS/TASCheckBox.h" + +#include <QMouseEvent> + +#include "Core/Movie.h" + +TASCheckBox::TASCheckBox(const QString& text) : QCheckBox(text) +{ + setTristate(true); +} + +bool TASCheckBox::GetValue() +{ + if (checkState() == Qt::PartiallyChecked) + return Movie::GetCurrentFrame() % 2 == static_cast<u64>(m_trigger_on_odd); + + return isChecked(); +} + +void TASCheckBox::mousePressEvent(QMouseEvent* event) +{ + if (event->button() != Qt::RightButton) + { + setChecked(!isChecked()); + return; + } + + if (checkState() == Qt::PartiallyChecked) + { + setCheckState(Qt::Unchecked); + return; + } + + m_trigger_on_odd = Movie::GetCurrentFrame() % 2 == 0; + setCheckState(Qt::PartiallyChecked); +} |
