StimulatorMainWindow
::StimulatorMainWindow(QWidget *parent
) : _patternsListDelegate(new PatternsListDelegate(this)),
_regularItemDelegate(new QStyledItemDelegate(this)),
_treatmentEditDialog(new CustomTreatmentDialog(this)),
_treatmentCreateDialog(new CustomTreatmentDialog(this)),
_configDiag(new ConfigurationDialog(this)),
_patternsMenu
(new QMenu(this)),
_interfaceMachine(new QStateMachine(this)),
_patternsModel(new TreatmentsModel(this)),
_ui(new Ui::StimulatorMainWindow)
{
setupUi();
loadConfigs();
initBackend();
setupStates();
setupModels();
setupActions();
setupConnections();
initWaveTypes();
}
void StimulatorMainWindow::setupUi()
{
_ui->setupUi(this);
_ui->patternWidget->hide();
_ui->engineDetailsWidget->hide();
_ui->centralWidgetLayout->addWidget(_treatmentEditDialog);
_ui
->deleteConfirmationButtons
->addButton
(tr
("Yes"),
QDialogButtonBox::YesRole);
_ui->treatmentPatternsList->setItemDelegate(_patternsListDelegate);
_treatmentWarning->setText(tr("Please check ALL connectors before proceeding."));
_treatmentWarning->setInformativeText(tr("Starting treatment without attaching <u>all</u> connectors correctly may cause <b>severe injuries</b> to the patient."));
_treatmentWarning
->addButton
(tr
("Proceed"),
QMessageBox::YesRole);
_treatmentWarning->setDefaultButton(cancel);
_treatmentWarning->setWindowTitle(tr("Check all connectors first"));
_aaa = 12; // The only place I use _aaa. All those tr()s above work normally.
statusBar()->hide();
}
void StimulatorMainWindow::initBackend()
{
tr("A valid backend executable is needed for the stimulations to work, but none is set. Please choose one at %1"
).arg("Configure... > Backend"), // But then I get a segfault right here, because this method comes after my setupUi()
noFeatureSupported =
tr("No feature is supported by the current backend. %1",
"The argument is the rest of the message"
).arg(tr("Please choose another backend for full feature support at %1"
).arg(tr("Configure... > Backend"))),
someFeaturesMissing =
tr("Some features are not supported by the current backend: %1",
"The argument is the rest of the message"
).arg(tr("Please choose another backend for full feature support at %1"
).arg(tr("Configure... > Backend")));
_aaa = 44; // If _aaa was initialized here instead of in the method above, any subsequent tr() calls would segfault as well
// Rest of the method
}
// Rest of the class
StimulatorMainWindow::StimulatorMainWindow(QWidget *parent) :
QMainWindow(parent),
_patternsListDelegate(new PatternsListDelegate(this)),
_regularItemDelegate(new QStyledItemDelegate(this)),
_treatmentEditDialog(new CustomTreatmentDialog(this)),
_treatmentCreateDialog(new CustomTreatmentDialog(this)),
_configDiag(new ConfigurationDialog(this)),
_patternsMenu(new QMenu(this)),
_interfaceMachine(new QStateMachine(this)),
_patternsModel(new TreatmentsModel(this)),
_ui(new Ui::StimulatorMainWindow)
{
setupUi();
loadConfigs();
initBackend();
setupStates();
setupModels();
setupActions();
setupConnections();
initWaveTypes();
}
void StimulatorMainWindow::setupUi()
{
_ui->setupUi(this);
_ui->patternWidget->hide();
_ui->engineDetailsWidget->hide();
_ui->centralWidgetLayout->addWidget(_treatmentEditDialog);
_ui->deleteConfirmationButtons->addButton(tr("Yes"), QDialogButtonBox::YesRole);
_ui->deleteConfirmationButtons->addButton(tr("No"), QDialogButtonBox::NoRole);
_ui->treatmentPatternsList->setItemDelegate(_patternsListDelegate);
_treatmentWarning = new QMessageBox;
_treatmentWarning->setText(tr("Please check ALL connectors before proceeding."));
_treatmentWarning->setInformativeText(tr("Starting treatment without attaching <u>all</u> connectors correctly may cause <b>severe injuries</b> to the patient."));
QPushButton *cancel = _treatmentWarning->addButton(tr("Cancel"), QMessageBox::RejectRole);
_treatmentWarning->addButton(tr("Proceed"), QMessageBox::YesRole);
_treatmentWarning->setDefaultButton(cancel);
_treatmentWarning->setIcon(QMessageBox::Warning);
_treatmentWarning->setWindowTitle(tr("Check all connectors first"));
_aaa = 12; // The only place I use _aaa. All those tr()s above work normally.
statusBar()->hide();
}
void StimulatorMainWindow::initBackend()
{
QString validBackendNeeded =
tr("A valid backend executable is needed for the stimulations to work, but none is set. Please choose one at %1"
).arg("Configure... > Backend"), // But then I get a segfault right here, because this method comes after my setupUi()
noFeatureSupported =
tr("No feature is supported by the current backend. %1",
"The argument is the rest of the message"
).arg(tr("Please choose another backend for full feature support at %1"
).arg(tr("Configure... > Backend"))),
someFeaturesMissing =
tr("Some features are not supported by the current backend: %1",
"The argument is the rest of the message"
).arg(tr("Please choose another backend for full feature support at %1"
).arg(tr("Configure... > Backend")));
_aaa = 44; // If _aaa was initialized here instead of in the method above, any subsequent tr() calls would segfault as well
// Rest of the method
}
// Rest of the class
To copy to clipboard, switch view to plain text mode
Bookmarks