Skip to content

Commit

Permalink
Preparation for #927 , 1/10 sec results config option added, it does
Browse files Browse the repository at this point in the history
nothing currently, combo is disabled.
  • Loading branch information
Fanda Vacek committed Aug 10, 2023
1 parent a138a75 commit 39b116e
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 1 deletion.
2 changes: 2 additions & 0 deletions libquickevent/libquickeventcore/src/og/timems.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ namespace quickevent {
namespace core {
namespace og {

//bool TimeMs::m_oneTenthSecPrecision = false;

TimeMs::TimeMs()
: m_msec(0), m_isValid(false)
{
Expand Down
6 changes: 5 additions & 1 deletion libquickevent/libquickeventcore/src/og/timems.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class QUICKEVENTCORE_DECL_EXPORT TimeMs

TimeMs();
TimeMs(int msec);
public:

bool isValid() const {return m_isValid;}
bool operator==(const TimeMs &o) const
{
Expand Down Expand Up @@ -55,9 +55,13 @@ class QUICKEVENTCORE_DECL_EXPORT TimeMs
static int msecIntervalAM(int from_time_msec, int to_time_msec);

static void registerQVariantFunctions();

//static void setOneTenthSecPrecision(bool b) { m_oneTenthSecPrecision = b; }
//static bool isOneTenthSecPrecision() { return m_oneTenthSecPrecision; }
private:
int m_msec;
bool m_isValid;
//static bool m_oneTenthSecPrecision;
};

}}}
Expand Down
5 changes: 5 additions & 0 deletions quickevent/app/quickevent/plugins/Event/src/eventconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,11 @@ std::optional<int> EventConfig::maximumCardCheckAdvanceSec() const
return {};
}

bool EventConfig::isOneTenthSecResults() const
{
return static_cast<bool>(value(QStringLiteral("oneTenthSecResults")).toInt());
}

/*
const QSet<QString> &EventConfig::knownKeys()
{
Expand Down
1 change: 1 addition & 0 deletions quickevent/app/quickevent/plugins/Event/src/eventconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class EventConfig : public QObject
QDateTime eventDateTime() const;
int dbVersion() const;
std::optional<int> maximumCardCheckAdvanceSec() const;
bool isOneTenthSecResults() const;
private:
void save_helper(QVariantMap &ret, const QString &current_path, const QVariant &val);
QVariantMap setValue_helper(const QVariantMap &m, const QStringList &path, const QVariant &val);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ EventDialogWidget::EventDialogWidget(QWidget *parent) :
setPersistentSettingsId("EventDialogWidget");
ui->setupUi(this);

ui->ed_oneTenthSecResults->setDisabled(true);

QRegularExpression rx("[a-z][a-z0-9_]*"); // PostgreSQL schema must start with small letter and it may contain small letters, digits and underscores only.
QValidator *validator = new QRegularExpressionValidator(rx, this);
ui->ed_eventId->setValidator(validator);
Expand Down Expand Up @@ -63,6 +65,7 @@ void EventDialogWidget::loadParams(const QVariantMap &params)
ui->cbxDisciplineId->setCurrentIndex(0);
ui->ed_importId->setText(params.value("importId").toString());
ui->ed_cardChecCheckTimeSec->setValue(params.value("cardChechCheckTimeSec").toInt());
ui->ed_oneTenthSecResults->setCurrentIndex(params.value("oneTenthSecResults").toInt());
}

QVariantMap EventDialogWidget::saveParams()
Expand All @@ -82,5 +85,6 @@ QVariantMap EventDialogWidget::saveParams()
ret["disciplineId"] = (ui->cbxDisciplineId->currentIndex() <= 0) ? 1 : ui->cbxDisciplineId->currentIndex() + 1;
ret["importId"] = ui->ed_importId->text().toInt();
ret["cardChechCheckTimeSec"] = ui->ed_cardChecCheckTimeSec->value();
ret["oneTenthSecResults"] = ui->ed_oneTenthSecResults->currentIndex();
return ret;
}
24 changes: 24 additions & 0 deletions quickevent/app/quickevent/plugins/Event/src/eventdialogwidget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,30 @@
</property>
</widget>
</item>
<item row="14" column="0">
<widget class="QLabel" name="label_15">
<property name="text">
<string>1/10 sec results</string>
</property>
<property name="buddy">
<cstring>ed_handicapLength</cstring>
</property>
</widget>
</item>
<item row="14" column="1">
<widget class="QComboBox" name="ed_oneTenthSecResults">
<item>
<property name="text">
<string>Disabled</string>
</property>
</item>
<item>
<property name="text">
<string>Enabled</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
<tabstops>
Expand Down

0 comments on commit 39b116e

Please sign in to comment.