mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 06:39:46 -06:00
Qt/TAS: Implement turbo mode
This commit is contained in:
40
Source/Core/DolphinQt/TAS/TASCheckBox.cpp
Normal file
40
Source/Core/DolphinQt/TAS/TASCheckBox.cpp
Normal file
@ -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);
|
||||
}
|
Reference in New Issue
Block a user