void PreferencesDialog::initialize(PreferencesTab initialTab, const Persistence::Settings *settings, const QMap<QString, QString> &jamRecorders) { Q_UNUSED(initialTab); this->settings = settings; this->jamRecorders = jamRecorders; this->jamRecorderCheckBoxes = QMap<QCheckBox *, QString>(); foreach(const QString &jamRecorder, jamRecorders.keys()) { QCheckBox *myCheckBox = new QCheckBox(this); myCheckBox->setObjectName(jamRecorder); myCheckBox->setText(jamRecorders.value(jamRecorder)); ui->layoutRecorders->addWidget(myCheckBox); jamRecorderCheckBoxes[myCheckBox] = jamRecorder; } setupSignals(); populateAllTabs(); }
void PreferencesDialog::initialize(PreferencesTab initialTab, const persistence::Settings *settings, const QMap<QString, QString> &jamRecorders) { Q_UNUSED(initialTab); this->settings = settings; this->jamRecorders = jamRecorders; this->jamRecorderCheckBoxes = QMap<QCheckBox *, QString>(); this->jamDateFormatRadioButtons = QMap<const QRadioButton *, QString>(); for (const auto &jamRecorder : jamRecorders.keys()) { QCheckBox *myCheckBox = new QCheckBox(this); myCheckBox->setObjectName(jamRecorder); myCheckBox->setText(jamRecorders.value(jamRecorder)); ui->layoutRecorders->addWidget(myCheckBox); jamRecorderCheckBoxes[myCheckBox] = jamRecorder; } QDateTime now = QDateTime::currentDateTime(); Qt::DateFormat dateFormat; QString nowString; QRadioButton *myRadioButton; dateFormat = Qt::TextDate; nowString = "Jam-" + now.toString(dateFormat).replace(QRegExp("[/:]"), "-").replace(QRegExp("[ ]"), "_"); myRadioButton = new QRadioButton(this); myRadioButton->setObjectName("rbdfTextDate"); myRadioButton->setText(nowString); myRadioButton->setProperty("buttonGroup", "rbDateFormat"); ui->layoutDateFormats->addWidget(myRadioButton); jamDateFormatRadioButtons[myRadioButton] = "Qt::TextDate"; dateFormat = Qt::ISODate; nowString = "Jam-" + now.toString(dateFormat).replace(QRegExp("[/:]"), "-").replace(QRegExp("[ ]"), "_"); myRadioButton = new QRadioButton(this); myRadioButton->setObjectName("rbdfISODate"); myRadioButton->setText(nowString); myRadioButton->setProperty("buttonGroup", "rbDateFormat"); ui->layoutDateFormats->addWidget(myRadioButton); jamDateFormatRadioButtons[myRadioButton] = "Qt::ISODate"; setupSignals(); populateAllTabs(); }