better suited entry method for the firmware birthday
This commit is contained in:
parent
08eda46706
commit
1fc775d964
|
@ -33,8 +33,15 @@ FirmwareSettingsDialog::FirmwareSettingsDialog(QWidget* parent) : QDialog(parent
|
|||
ui->languageBox->addItems(languages);
|
||||
ui->languageBox->setCurrentIndex(Config::FirmwareLanguage);
|
||||
|
||||
QDate birthDate = QDate(QDate::currentDate().year(), Config::FirmwareBirthdayMonth, Config::FirmwareBirthdayDay);
|
||||
ui->birthdayEdit->setDate(birthDate);
|
||||
for (int i = 1; i <= 31; i++)
|
||||
{
|
||||
ui->cbxBirthdayDay->addItem(QString("%1").arg(i));
|
||||
}
|
||||
|
||||
ui->cbxBirthdayMonth->addItems(months);
|
||||
ui->cbxBirthdayMonth->setCurrentIndex(Config::FirmwareBirthdayMonth - 1);
|
||||
|
||||
ui->cbxBirthdayDay->setCurrentIndex(Config::FirmwareBirthdayDay - 1);
|
||||
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
|
@ -62,8 +69,8 @@ void FirmwareSettingsDialog::on_FirmwareSettingsDialog_accepted()
|
|||
|
||||
Config::FirmwareLanguage = ui->languageBox->currentIndex();
|
||||
Config::FirmwareFavouriteColour = ui->colorsEdit->currentIndex();
|
||||
Config::FirmwareBirthdayDay = ui->birthdayEdit->date().day();
|
||||
Config::FirmwareBirthdayMonth = ui->birthdayEdit->date().month();
|
||||
Config::FirmwareBirthdayDay = ui->cbxBirthdayDay->currentIndex() + 1;
|
||||
Config::FirmwareBirthdayMonth = ui->cbxBirthdayMonth->currentIndex() + 1;
|
||||
Config::FirmwareOverrideSettings = ui->overrideFirmwareBox->isChecked();
|
||||
|
||||
std::string newMessage = ui->messageEdit->text().toStdString();
|
||||
|
@ -77,3 +84,28 @@ void FirmwareSettingsDialog::on_FirmwareSettingsDialog_rejected()
|
|||
{
|
||||
closeDlg();
|
||||
}
|
||||
|
||||
void FirmwareSettingsDialog::on_cbxBirthdayMonth_currentIndexChanged(int idx)
|
||||
{
|
||||
// the DS firmware caps the birthday day depending on the birthday month
|
||||
// for February, the limit is 29
|
||||
const int ndays[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
|
||||
|
||||
int nday_old = ui->cbxBirthdayDay->count();
|
||||
int nday_cur = ndays[idx];
|
||||
|
||||
if (nday_cur > nday_old)
|
||||
{
|
||||
for (int i = nday_old+1; i <= nday_cur; i++)
|
||||
{
|
||||
ui->cbxBirthdayDay->insertItem(i-1, QString("%1").arg(i));
|
||||
}
|
||||
}
|
||||
else if (nday_cur < nday_old)
|
||||
{
|
||||
for (int i = nday_old; i >= nday_cur+1; i--)
|
||||
{
|
||||
ui->cbxBirthdayDay->removeItem(i-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,6 +80,22 @@ public:
|
|||
"Spanish"
|
||||
};
|
||||
|
||||
const QStringList months
|
||||
{
|
||||
"January",
|
||||
"February",
|
||||
"March",
|
||||
"April",
|
||||
"May",
|
||||
"June",
|
||||
"July",
|
||||
"August",
|
||||
"September",
|
||||
"October",
|
||||
"November",
|
||||
"December"
|
||||
};
|
||||
|
||||
explicit FirmwareSettingsDialog(QWidget* parent);
|
||||
~FirmwareSettingsDialog();
|
||||
|
||||
|
@ -105,6 +121,8 @@ private slots:
|
|||
void on_FirmwareSettingsDialog_accepted();
|
||||
void on_FirmwareSettingsDialog_rejected();
|
||||
|
||||
void on_cbxBirthdayMonth_currentIndexChanged(int idx);
|
||||
|
||||
private:
|
||||
Ui::FirmwareSettingsDialog* ui;
|
||||
};
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>511</width>
|
||||
<height>272</height>
|
||||
<height>196</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
|
@ -24,7 +24,10 @@
|
|||
<enum>QLayout::SetFixedSize</enum>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="cbxBirthdayDay"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="usernameLabel">
|
||||
<property name="text">
|
||||
|
@ -32,7 +35,41 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Message:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Color:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Language:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Birthday:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QComboBox" name="cbxBirthdayMonth"/>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QComboBox" name="languageBox"/>
|
||||
</item>
|
||||
<item row="0" column="1" colspan="2">
|
||||
<widget class="QLineEdit" name="usernameEdit">
|
||||
<property name="text">
|
||||
<string>melonDS</string>
|
||||
|
@ -45,54 +82,13 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Language:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="languageBox"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Birthday:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QDateEdit" name="birthdayEdit">
|
||||
<property name="displayFormat">
|
||||
<string>dd/MM</string>
|
||||
</property>
|
||||
<property name="calendarPopup">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Color:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<item row="3" column="1" colspan="2">
|
||||
<widget class="QComboBox" name="colorsEdit"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Message:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<item row="4" column="1" colspan="2">
|
||||
<widget class="QLineEdit" name="messageEdit"/>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="2">
|
||||
<item row="5" column="0" colspan="3">
|
||||
<widget class="QCheckBox" name="overrideFirmwareBox">
|
||||
<property name="text">
|
||||
<string>Override settings from external firmware</string>
|
||||
|
|
Loading…
Reference in New Issue