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->addItems(languages);
|
||||||
ui->languageBox->setCurrentIndex(Config::FirmwareLanguage);
|
ui->languageBox->setCurrentIndex(Config::FirmwareLanguage);
|
||||||
|
|
||||||
QDate birthDate = QDate(QDate::currentDate().year(), Config::FirmwareBirthdayMonth, Config::FirmwareBirthdayDay);
|
for (int i = 1; i <= 31; i++)
|
||||||
ui->birthdayEdit->setDate(birthDate);
|
{
|
||||||
|
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++)
|
for (int i = 0; i < 16; i++)
|
||||||
{
|
{
|
||||||
|
@ -62,8 +69,8 @@ void FirmwareSettingsDialog::on_FirmwareSettingsDialog_accepted()
|
||||||
|
|
||||||
Config::FirmwareLanguage = ui->languageBox->currentIndex();
|
Config::FirmwareLanguage = ui->languageBox->currentIndex();
|
||||||
Config::FirmwareFavouriteColour = ui->colorsEdit->currentIndex();
|
Config::FirmwareFavouriteColour = ui->colorsEdit->currentIndex();
|
||||||
Config::FirmwareBirthdayDay = ui->birthdayEdit->date().day();
|
Config::FirmwareBirthdayDay = ui->cbxBirthdayDay->currentIndex() + 1;
|
||||||
Config::FirmwareBirthdayMonth = ui->birthdayEdit->date().month();
|
Config::FirmwareBirthdayMonth = ui->cbxBirthdayMonth->currentIndex() + 1;
|
||||||
Config::FirmwareOverrideSettings = ui->overrideFirmwareBox->isChecked();
|
Config::FirmwareOverrideSettings = ui->overrideFirmwareBox->isChecked();
|
||||||
|
|
||||||
std::string newMessage = ui->messageEdit->text().toStdString();
|
std::string newMessage = ui->messageEdit->text().toStdString();
|
||||||
|
@ -77,3 +84,28 @@ void FirmwareSettingsDialog::on_FirmwareSettingsDialog_rejected()
|
||||||
{
|
{
|
||||||
closeDlg();
|
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"
|
"Spanish"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const QStringList months
|
||||||
|
{
|
||||||
|
"January",
|
||||||
|
"February",
|
||||||
|
"March",
|
||||||
|
"April",
|
||||||
|
"May",
|
||||||
|
"June",
|
||||||
|
"July",
|
||||||
|
"August",
|
||||||
|
"September",
|
||||||
|
"October",
|
||||||
|
"November",
|
||||||
|
"December"
|
||||||
|
};
|
||||||
|
|
||||||
explicit FirmwareSettingsDialog(QWidget* parent);
|
explicit FirmwareSettingsDialog(QWidget* parent);
|
||||||
~FirmwareSettingsDialog();
|
~FirmwareSettingsDialog();
|
||||||
|
|
||||||
|
@ -105,6 +121,8 @@ private slots:
|
||||||
void on_FirmwareSettingsDialog_accepted();
|
void on_FirmwareSettingsDialog_accepted();
|
||||||
void on_FirmwareSettingsDialog_rejected();
|
void on_FirmwareSettingsDialog_rejected();
|
||||||
|
|
||||||
|
void on_cbxBirthdayMonth_currentIndexChanged(int idx);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::FirmwareSettingsDialog* ui;
|
Ui::FirmwareSettingsDialog* ui;
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>511</width>
|
<width>511</width>
|
||||||
<height>272</height>
|
<height>196</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -24,7 +24,10 @@
|
||||||
<enum>QLayout::SetFixedSize</enum>
|
<enum>QLayout::SetFixedSize</enum>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<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">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="usernameLabel">
|
<widget class="QLabel" name="usernameLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -32,7 +35,41 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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">
|
<widget class="QLineEdit" name="usernameEdit">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>melonDS</string>
|
<string>melonDS</string>
|
||||||
|
@ -45,54 +82,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="3" column="1" colspan="2">
|
||||||
<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">
|
|
||||||
<widget class="QComboBox" name="colorsEdit"/>
|
<widget class="QComboBox" name="colorsEdit"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0">
|
<item row="4" column="1" colspan="2">
|
||||||
<widget class="QLabel" name="label_3">
|
|
||||||
<property name="text">
|
|
||||||
<string>Message:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="1">
|
|
||||||
<widget class="QLineEdit" name="messageEdit"/>
|
<widget class="QLineEdit" name="messageEdit"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0" colspan="2">
|
<item row="5" column="0" colspan="3">
|
||||||
<widget class="QCheckBox" name="overrideFirmwareBox">
|
<widget class="QCheckBox" name="overrideFirmwareBox">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Override settings from external firmware</string>
|
<string>Override settings from external firmware</string>
|
||||||
|
|
Loading…
Reference in New Issue