wiRedPanda
Logic Circuit Simulator
Loading...
Searching...
No Matches
LengthDialogUI.cpp
Go to the documentation of this file.
1// Copyright 2015 - 2026, GIBIS-UNIFESP and the wiRedPanda contributors
2// SPDX-License-Identifier: GPL-3.0-or-later
3
5
6#include <QtCore/QCoreApplication>
7#include <QtCore/QMetaObject>
8#include <QtGui/QIcon>
9
11{
12 if (LengthDialog->objectName().isEmpty()) {
13 LengthDialog->setObjectName("LengthDialog");
14 }
15
16 LengthDialog->resize(184, 116);
17
18 LengthDialog->setWindowIcon(QIcon(":/Interface/Toolbar/wavyIcon.svg"));
19
20 gridLayout_2 = new QGridLayout(LengthDialog);
21 gridLayout_2->setObjectName("gridLayout_2");
22
23 // Minimum of 2 time steps (need at least one rising and one falling edge to be meaningful);
24 // maximum of 2048 is enforced throughout the app to keep memory and render time bounded.
25 // Default of 64 is a reasonable starting point for a small circuit demo.
26 lengthSlider = new QSlider(LengthDialog);
27 lengthSlider->setObjectName("lengthSlider");
28 lengthSlider->setMinimum(2);
29 lengthSlider->setMaximum(2048);
30 lengthSlider->setSingleStep(1);
31 lengthSlider->setValue(64);
32 lengthSlider->setOrientation(Qt::Horizontal);
33 gridLayout_2->addWidget(lengthSlider, 3, 0, 1, 2);
34
35 minLabel = new QLabel(LengthDialog);
36 minLabel->setObjectName("minLabel");
37 minLabel->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop);
38 gridLayout_2->addWidget(minLabel, 4, 0, 1, 1);
39
40 titleLabel = new QLabel(LengthDialog);
41 titleLabel->setObjectName("titleLabel");
42 gridLayout_2->addWidget(titleLabel, 0, 0, 1, 1);
43
44 maxLabel = new QLabel(LengthDialog);
45 maxLabel->setObjectName("maxLabel");
46 maxLabel->setAlignment(Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing);
47 gridLayout_2->addWidget(maxLabel, 4, 1, 1, 1);
48
49 lengthSpinBox = new QSpinBox(LengthDialog);
50 lengthSpinBox->setObjectName("lengthSpinBox");
51 lengthSpinBox->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter);
52 lengthSpinBox->setMinimum(2);
53 lengthSpinBox->setMaximum(2048);
54 lengthSpinBox->setSingleStep(1);
55 lengthSpinBox->setValue(64);
56 gridLayout_2->addWidget(lengthSpinBox, 0, 1, 1, 1);
57
58 buttonBox = new QDialogButtonBox(LengthDialog);
59 buttonBox->setObjectName("buttonBox");
60 buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
61 gridLayout_2->addWidget(buttonBox, 5, 0, 1, 2);
62
64
65 // Bidirectionally sync slider and spin box so either control can drive the other
66 QObject::connect(lengthSlider, &QSlider::valueChanged, lengthSpinBox, &QSpinBox::setValue);
67 QObject::connect(lengthSpinBox, QOverload<int>::of(&QSpinBox::valueChanged), lengthSlider, &QSlider::setValue);
68
69 QMetaObject::connectSlotsByName(LengthDialog);
70}
71
73{
74 LengthDialog->setWindowTitle(QCoreApplication::translate("LengthDialog", "Simulation Length"));
75 titleLabel->setText(QCoreApplication::translate("LengthDialog", "Simulation Length"));
76 // Range end labels are numbers, not translatable text — build them from the slider's
77 // actual bounds instead of shipping bare "2"/"2048" strings to the Weblate catalog.
78 minLabel->setText(QString::number(lengthSlider->minimum()));
79 maxLabel->setText(QString::number(lengthSlider->maximum()));
80}
LengthDialogUi: hand-written UI class for the LengthDialog.
QGridLayout * gridLayout_2
QSlider * lengthSlider
QLabel * titleLabel
QDialogButtonBox * buttonBox
QSpinBox * lengthSpinBox
void setupUi(QDialog *LengthDialog)
Creates and lays out all child widgets inside LengthDialog.
void retranslateUi(QDialog *LengthDialog)
Updates all translatable strings in the dialog.
Modal dialog for setting the BeWavedDolphin simulation length (number of time steps).