mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 22:09:19 -07:00
b493bdb912
This doesn't actually modify the checkbox's state, so this can be marked as a const-qualified member function.
41 lines
822 B
C++
41 lines
822 B
C++
// 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() const
|
|
{
|
|
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);
|
|
}
|