|
|
|
|
@ -3,12 +3,32 @@
|
|
|
|
|
#include "nmPebiResultPlaybackController.h"
|
|
|
|
|
|
|
|
|
|
#include <QCheckBox>
|
|
|
|
|
#include <QCoreApplication>
|
|
|
|
|
#include <QDialogButtonBox>
|
|
|
|
|
#include <QFormLayout>
|
|
|
|
|
#include <QIcon>
|
|
|
|
|
#include <QLayout>
|
|
|
|
|
#include <QPushButton>
|
|
|
|
|
#include <QShowEvent>
|
|
|
|
|
#include <QSize>
|
|
|
|
|
#include <QSpinBox>
|
|
|
|
|
#include <QTimer>
|
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
|
#include <QtGlobal>
|
|
|
|
|
|
|
|
|
|
#include <limits.h>
|
|
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
|
|
QString resultAnimationIconPath(const QString& sFileName)
|
|
|
|
|
{
|
|
|
|
|
const QString sApplicationDir = QCoreApplication::applicationDirPath();
|
|
|
|
|
return sApplicationDir.section('/', 0, -2) +
|
|
|
|
|
"/Res/Icon/" + sFileName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nmWxPebiResultAnimationSettingsDlg::
|
|
|
|
|
nmWxPebiResultAnimationSettingsDlg(
|
|
|
|
|
int nStepsPerSecond,
|
|
|
|
|
@ -19,17 +39,16 @@ nmWxPebiResultAnimationSettingsDlg(
|
|
|
|
|
m_pLoopCheck(new QCheckBox(tr("Loop enabled"), this))
|
|
|
|
|
{
|
|
|
|
|
setWindowTitle(tr("Animation settings"));
|
|
|
|
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
|
|
|
|
setModal(true);
|
|
|
|
|
|
|
|
|
|
m_pSpeedSpin->setRange(
|
|
|
|
|
nmPebiResultPlaybackController::MinimumPlaybackSpeed,
|
|
|
|
|
nmPebiResultPlaybackController::MaximumPlaybackSpeed);
|
|
|
|
|
m_pSpeedSpin->setValue(qBound(
|
|
|
|
|
INT_MAX);
|
|
|
|
|
m_pSpeedSpin->setValue(qMax(
|
|
|
|
|
static_cast<int>(
|
|
|
|
|
nmPebiResultPlaybackController::MinimumPlaybackSpeed),
|
|
|
|
|
nStepsPerSecond,
|
|
|
|
|
static_cast<int>(
|
|
|
|
|
nmPebiResultPlaybackController::MaximumPlaybackSpeed)));
|
|
|
|
|
nStepsPerSecond));
|
|
|
|
|
m_pLoopCheck->setChecked(bLoopEnabled);
|
|
|
|
|
|
|
|
|
|
QFormLayout* pFormLayout = new QFormLayout();
|
|
|
|
|
@ -39,6 +58,21 @@ nmWxPebiResultAnimationSettingsDlg(
|
|
|
|
|
QDialogButtonBox* pButtonBox = new QDialogButtonBox(
|
|
|
|
|
QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
|
|
|
|
|
Qt::Horizontal, this);
|
|
|
|
|
QPushButton* pOkButton = pButtonBox->button(QDialogButtonBox::Ok);
|
|
|
|
|
QPushButton* pCancelButton =
|
|
|
|
|
pButtonBox->button(QDialogButtonBox::Cancel);
|
|
|
|
|
const QSize oButtonIconSize(16, 16);
|
|
|
|
|
pOkButton->setIcon(QIcon(resultAnimationIconPath(
|
|
|
|
|
QString::fromLatin1("OK.png"))));
|
|
|
|
|
pCancelButton->setIcon(QIcon(resultAnimationIconPath(
|
|
|
|
|
QString::fromLatin1("Cancel.png"))));
|
|
|
|
|
pOkButton->setIconSize(oButtonIconSize);
|
|
|
|
|
pCancelButton->setIconSize(oButtonIconSize);
|
|
|
|
|
pOkButton->setMinimumWidth(72);
|
|
|
|
|
pCancelButton->setMinimumWidth(72);
|
|
|
|
|
if(pButtonBox->layout() != nullptr) {
|
|
|
|
|
pButtonBox->layout()->setSpacing(6);
|
|
|
|
|
}
|
|
|
|
|
connect(pButtonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
|
|
|
|
connect(pButtonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
|
|
|
|
|
|
|
|
|
@ -62,3 +96,10 @@ bool nmWxPebiResultAnimationSettingsDlg::isLoopEnabled() const
|
|
|
|
|
{
|
|
|
|
|
return m_pLoopCheck->isChecked();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nmWxPebiResultAnimationSettingsDlg::showEvent(QShowEvent* pEvent)
|
|
|
|
|
{
|
|
|
|
|
QDialog::showEvent(pEvent);
|
|
|
|
|
m_pSpeedSpin->setFocus(Qt::OtherFocusReason);
|
|
|
|
|
QTimer::singleShot(0, m_pSpeedSpin, SLOT(selectAll()));
|
|
|
|
|
}
|
|
|
|
|
|