You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nmWTAI-Platform/Src/nmNum/nmSubWxs/nmWxPebiResultAnimationSett...

65 lines
2.0 KiB
C++

#include "nmWxPebiResultAnimationSettingsDlg.h"
#include "nmPebiResultPlaybackController.h"
#include <QCheckBox>
#include <QDialogButtonBox>
#include <QFormLayout>
#include <QSpinBox>
#include <QVBoxLayout>
#include <QtGlobal>
nmWxPebiResultAnimationSettingsDlg::
nmWxPebiResultAnimationSettingsDlg(
int nStepsPerSecond,
bool bLoopEnabled,
QWidget* pParent)
: QDialog(pParent),
m_pSpeedSpin(new QSpinBox(this)),
m_pLoopCheck(new QCheckBox(tr("Loop enabled"), this))
{
setWindowTitle(tr("Animation settings"));
setModal(true);
m_pSpeedSpin->setRange(
nmPebiResultPlaybackController::MinimumPlaybackSpeed,
nmPebiResultPlaybackController::MaximumPlaybackSpeed);
m_pSpeedSpin->setValue(qBound(
static_cast<int>(
nmPebiResultPlaybackController::MinimumPlaybackSpeed),
nStepsPerSecond,
static_cast<int>(
nmPebiResultPlaybackController::MaximumPlaybackSpeed)));
m_pLoopCheck->setChecked(bLoopEnabled);
QFormLayout* pFormLayout = new QFormLayout();
pFormLayout->addRow(tr("Speed (steps/second)"), m_pSpeedSpin);
pFormLayout->addRow(QString(), m_pLoopCheck);
QDialogButtonBox* pButtonBox = new QDialogButtonBox(
QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
Qt::Horizontal, this);
connect(pButtonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(pButtonBox, SIGNAL(rejected()), this, SLOT(reject()));
QVBoxLayout* pMainLayout = new QVBoxLayout(this);
pMainLayout->addLayout(pFormLayout);
pMainLayout->addWidget(pButtonBox);
setMinimumWidth(320);
}
nmWxPebiResultAnimationSettingsDlg::
~nmWxPebiResultAnimationSettingsDlg()
{
}
int nmWxPebiResultAnimationSettingsDlg::getPlaybackSpeed() const
{
return m_pSpeedSpin->value();
}
bool nmWxPebiResultAnimationSettingsDlg::isLoopEnabled() const
{
return m_pLoopCheck->isChecked();
}