summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinQt/TAS/TASCheckBox.cpp
diff options
context:
space:
mode:
authorspycrab <spycrab@users.noreply.github.com>2019-04-03 18:43:11 +0200
committerGitHub <noreply@github.com>2019-04-03 18:43:11 +0200
commit923151e3e3aeb5caa3f76fc51ea0d10bb1c4a0f7 (patch)
treee1db6379ea181a034863b7f37dcaddcff95a74c6 /Source/Core/DolphinQt/TAS/TASCheckBox.cpp
parent741a975ac27d35f98926d1adafd13b0cbdea1a91 (diff)
parent039b1baa3a20441c136ac115098f69374a1ead13 (diff)
Merge pull request #7949 from spycrab/turbo_btn
Qt/TAS: Implement turbo mode
Diffstat (limited to 'Source/Core/DolphinQt/TAS/TASCheckBox.cpp')
-rw-r--r--Source/Core/DolphinQt/TAS/TASCheckBox.cpp40
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);
+}