ORE Studio 0.0.4
Loading...
Searching...
No Matches
CronFieldWidget.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * Copyright (C) 2026 Marco Craveiro <marco.craveiro@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License as published by the Free Software
7 * Foundation; either version 3 of the License, or (at your option) any later
8 * version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 51
17 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 *
19 */
20#ifndef ORES_QT_CRON_FIELD_WIDGET_HPP
21#define ORES_QT_CRON_FIELD_WIDGET_HPP
22
23#include <QWidget>
24#include <QList>
25#include <QVector>
26#include <QString>
27#include <QStringList>
28
29class QRadioButton;
30class QComboBox;
31class QCheckBox;
32
33namespace ores::qt {
34
39 int min_val;
40 int max_val;
41 QStringList labels; // empty -> zero-padded numbers
42 QList<int> freq_steps; // step values for the Frequency combo
43 int checkboxes_per_row;
44};
45
54class CronFieldWidget : public QWidget {
55 Q_OBJECT
56
57public:
58 explicit CronFieldWidget(const FieldConfig& cfg, QWidget* parent = nullptr);
59
61 QString value() const;
62
64 void setValue(const QString& cron_field);
65
66signals:
67 void changed();
68
69private slots:
70 void onModeClicked();
71
72private:
73 void updateEnabled();
74 QString labelFor(int v) const;
75
76 FieldConfig cfg_;
77
78 QRadioButton* freqRadio_;
79 QComboBox* everyCombo_;
80 QComboBox* startCombo_;
81
82 QRadioButton* rangeRadio_;
83 QComboBox* minCombo_;
84 QComboBox* maxCombo_;
85
86 QRadioButton* choiceRadio_;
87 QVector<QCheckBox*> checkboxes_;
88};
89
90}
91
92#endif
Qt-based graphical user interface for ORE Studio.
Definition AboutDialog.hpp:29
Configuration for one cron field (minutes, hours, etc.).
Definition CronFieldWidget.hpp:38
One tab inside CronEditorDialog.
Definition CronFieldWidget.hpp:54
QString value() const
Definition CronEditorDialog.cpp:177
void setValue(const QString &cron_field)
Definition CronEditorDialog.cpp:206