Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
Executable
+64
@@ -0,0 +1,64 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Restock Charges - UI Element for a single charge.
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Iuliana Ojog - 2022-03-17
|
||||
*/
|
||||
|
||||
#include "participant_gear_restock_charge.h"
|
||||
#include "ui_participant_gear_restock_charge.h"
|
||||
|
||||
ParticipantGearRestockCharge::ParticipantGearRestockCharge(QWidget *parent, bool showAllOptions)
|
||||
: QWidget(parent)
|
||||
, m_ui(new Ui::ParticipantGearRestockCharge)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
m_ui->rbValue->setVisible(showAllOptions);
|
||||
m_ui->rbDefault->setVisible(showAllOptions);
|
||||
m_ui->rbNoChange->setVisible(showAllOptions);
|
||||
m_ui->rbUnlimited->setVisible(showAllOptions);
|
||||
}
|
||||
|
||||
ParticipantGearRestockCharge::~ParticipantGearRestockCharge()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
bool ParticipantGearRestockCharge::init(int chargeTypeId, const QString &chargeName, int initialValue, int maxThisCharge)
|
||||
{
|
||||
m_chargeTypeId = chargeTypeId;
|
||||
m_maxThisCharge = maxThisCharge;
|
||||
m_ui->lblChargeName->setText(chargeName);
|
||||
m_ui->sbValue->setRange(0,9999);
|
||||
m_ui->sbValue->setValue(initialValue);
|
||||
m_ui->sbValue->setFixedWidth(50);
|
||||
|
||||
setObjectName(QStringLiteral("pgrc-")+QString::number(m_chargeTypeId));
|
||||
|
||||
connect(m_ui->sbValue, QOverload<int>::of(&QSpinBox::valueChanged), this, &ParticipantGearRestockCharge::valueChanged);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ParticipantGearRestockCharge::setMaxValue(int maxVal)
|
||||
{
|
||||
if (m_maxThisCharge > 0)
|
||||
m_ui->sbValue->setMaximum(qMin(maxVal, m_maxThisCharge));
|
||||
else
|
||||
m_ui->sbValue->setMaximum(maxVal);
|
||||
}
|
||||
|
||||
int ParticipantGearRestockCharge::value() const
|
||||
{
|
||||
if (m_ui->rbDefault->isChecked())
|
||||
return 0xffff;
|
||||
if (m_ui->rbNoChange->isChecked())
|
||||
return 0xfffe;
|
||||
if (m_ui->rbUnlimited->isChecked())
|
||||
return 0xfffd;
|
||||
|
||||
return m_ui->sbValue->value();
|
||||
}
|
||||
Reference in new issue
Block a user