1. Media menu strings are translated now.

2. Save/Quit dialogs are also translated now.
3. Fix Sound Gain text cutoff.
This commit is contained in:
Cacodemon345
2022-01-07 16:21:40 +06:00
parent 3e4b2583e3
commit 69325aff02
7 changed files with 31 additions and 24 deletions

View File

@@ -139,6 +139,7 @@ void DeviceConfig::ConfigureDevice(const _device_* device, int instance) {
auto* fileField = new FileField();
fileField->setObjectName(config->name);
fileField->setFileName(fileName);
fileField->setFilter(QString(config->file_filter).left(strcspn(config->file_filter, "|")));
dc.ui->formLayout->addRow(config->description, fileField);
break;
}

View File

@@ -29,6 +29,7 @@ HarddiskDialog::HarddiskDialog(bool existing, QWidget *parent) :
{
ui->setupUi(this);
ui->fileField->setFilter(tr("Hard disk images (*.HD? *.hd? *.IM? *.im? *.VHD *.vhd);;All files (*)"));
if (existing) {
setWindowTitle(tr("Add Existing Hard Disk"));
ui->lineEditCylinders->setEnabled(false);

View File

@@ -414,39 +414,39 @@ void MachineStatus::refresh(QStatusBar* sbar) {
if ((has_mfm || hdc_name.left(5) == QStringLiteral("st506")) && c_mfm > 0) {
d->hdds[HDD_BUS_MFM].label = std::make_unique<QLabel>();
d->hdds[HDD_BUS_MFM].setActive(false);
d->hdds[HDD_BUS_MFM].label->setToolTip(QStringLiteral("Hard Disk (%1)").arg("MFM/RLL"));
d->hdds[HDD_BUS_MFM].label->setToolTip(tr("Hard disk (%s)").replace("%s", "MFM/RLL"));
sbar->addWidget(d->hdds[HDD_BUS_MFM].label.get());
}
if ((has_esdi || hdc_name.left(4) == QStringLiteral("esdi")) && c_esdi > 0) {
d->hdds[HDD_BUS_ESDI].label = std::make_unique<QLabel>();
d->hdds[HDD_BUS_ESDI].setActive(false);
d->hdds[HDD_BUS_ESDI].label->setToolTip(QStringLiteral("Hard Disk (%1)").arg("ESDI"));
d->hdds[HDD_BUS_ESDI].label->setToolTip(tr("Hard disk (%s)").replace("%s", "ESDI"));
sbar->addWidget(d->hdds[HDD_BUS_ESDI].label.get());
}
if ((has_xta || hdc_name.left(3) == QStringLiteral("xta")) && c_xta > 0) {
d->hdds[HDD_BUS_XTA].label = std::make_unique<QLabel>();
d->hdds[HDD_BUS_XTA].setActive(false);
d->hdds[HDD_BUS_XTA].label->setToolTip(QStringLiteral("Hard Disk (%1)").arg("XTA"));
d->hdds[HDD_BUS_XTA].label->setToolTip(tr("Hard disk (%s)").replace("%s", "XTA"));
sbar->addWidget(d->hdds[HDD_BUS_XTA].label.get());
}
if ((hasIDE() || hdc_name.left(5) == QStringLiteral("xtide") || hdc_name.left(3) == QStringLiteral("ide")) && c_ide > 0) {
d->hdds[HDD_BUS_IDE].label = std::make_unique<QLabel>();
d->hdds[HDD_BUS_IDE].setActive(false);
d->hdds[HDD_BUS_IDE].label->setToolTip(QStringLiteral("Hard Disk (%1)").arg("IDE"));
d->hdds[HDD_BUS_IDE].label->setToolTip(tr("Hard disk (%s)").replace("%s", "IDE"));
sbar->addWidget(d->hdds[HDD_BUS_IDE].label.get());
}
if ((hasSCSI() || (scsi_card_current[0] != 0) || (scsi_card_current[1] != 0) ||
(scsi_card_current[2] != 0) || (scsi_card_current[3] != 0)) && c_scsi > 0) {
d->hdds[HDD_BUS_SCSI].label = std::make_unique<QLabel>();
d->hdds[HDD_BUS_SCSI].setActive(false);
d->hdds[HDD_BUS_SCSI].label->setToolTip(QStringLiteral("Hard Disk (%1)").arg("SCSI"));
d->hdds[HDD_BUS_SCSI].label->setToolTip(tr("Hard disk (%s)").replace("%s", "SCSI"));
sbar->addWidget(d->hdds[HDD_BUS_SCSI].label.get());
}
if (do_net) {
d->net.label = std::make_unique<QLabel>();
d->net.setActive(false);
d->net.label->setToolTip("Network");
d->net.label->setToolTip(tr("Network"));
sbar->addWidget(d->net.label.get());
}
d->sound = std::make_unique<ClickableLabel>();
@@ -456,7 +456,7 @@ void MachineStatus::refresh(QStatusBar* sbar) {
SoundGain gain(main_window);
gain.exec();
});
d->sound->setToolTip("Sound");
d->sound->setToolTip(tr("Sound"));
sbar->addWidget(d->sound.get());
d->text = std::make_unique<QLabel>();
sbar->addWidget(d->text.get());

View File

@@ -290,8 +290,8 @@ MainWindow::MainWindow(QWidget *parent) :
void MainWindow::closeEvent(QCloseEvent *event) {
if (confirm_exit && cpu_thread_run)
{
QMessageBox questionbox(QMessageBox::Icon::Question, "86Box", "Are you sure you want to exit 86Box?", QMessageBox::Yes | QMessageBox::No, this);
QCheckBox *chkbox = new QCheckBox("Do not ask me again");
QMessageBox questionbox(QMessageBox::Icon::Question, "86Box", tr("Are you sure you want to exit 86Box?"), QMessageBox::Yes | QMessageBox::No, this);
QCheckBox *chkbox = new QCheckBox(tr("Don't show this message again"));
questionbox.setCheckBox(chkbox);
chkbox->setChecked(!confirm_exit);
bool confirm_exit_temp = false;

View File

@@ -145,7 +145,7 @@ void MediaMenu::cassetteNewImage() {
}
void MediaMenu::cassetteSelectImage(bool wp) {
auto filename = QFileDialog::getOpenFileName(parentWidget, tr("Open"), QString(), tr("Cassette images (*.pcm *.PCM *.raw *.RAW *.wav *.WAV *.cas *.CAS);;All files (*)"));
auto filename = QFileDialog::getOpenFileName(parentWidget, QString(), QString(), tr("Cassette images (*.pcm *.PCM *.raw *.RAW *.wav *.WAV *.cas *.CAS);;All files (*)"));
cassetteMount(filename, wp);
}
@@ -199,7 +199,7 @@ void MediaMenu::cassetteUpdateMenu() {
}
void MediaMenu::cartridgeSelectImage(int i) {
auto filename = QFileDialog::getOpenFileName(parentWidget, tr("Open"), QString(), tr("Cartridge images (*.a *.b *.jrc *.A *.B *.JRC);;All files (*)"));
auto filename = QFileDialog::getOpenFileName(parentWidget, QString(), QString(), tr("Cartridge images (*.A *.a *.B *.b *.JRC *.jrc);;All files (*)"));
if (filename.isEmpty()) {
return;
}
@@ -242,7 +242,7 @@ void MediaMenu::floppyNewImage(int i) {
}
void MediaMenu::floppySelectImage(int i, bool wp) {
auto filename = QFileDialog::getOpenFileName(parentWidget, "Open", QString(), tr("All images (*.86F *.86f *.DSK *.dsk *.FLP *.flp *.IM? *.im? *.*FD? *.*fd?);;Basic sector images (*.DSK *.dsk *.FLP *.flp *.IM? *.im? *.IMG *.img *.*FD? *.*fd?);;Surface images (*.86F *.86f)"));
auto filename = QFileDialog::getOpenFileName(parentWidget, QString(), QString(), tr("All images (*.0?? *.1?? *.??0 *.86F *.86f *.BIN *.bin *.CQ? *.cq? *.D?? *.d?? *.FLP *.flp *.HDM *.hdm *.IM? *.im? *.JSON *.json *.TD0 *.td0 *.*FD? *.*fd? *.MFM *.mfm *.XDF *.xdf);;Advanced sector images (*.IMD *.imd *.JSON *.json *.TD0 *.td0);;Basic sector images (*.0?? *.1?? *.??0 *.BIN *.bin *.CQ? *.cq? *.D?? *.d?? *.FLP *.flp *.HDM *.hdm *.IM? *.im? *.XDF *.xdf *.*FD? *.*fd?);;Flux images (*.FDI *.fdi);;Surface images (*.86F *.86f *.MFM *.mfm);;All files (*)"));
floppyMount(i, filename, wp);
}
@@ -268,7 +268,7 @@ void MediaMenu::floppyEject(int i) {
}
void MediaMenu::floppyExportTo86f(int i) {
auto filename = QFileDialog::getSaveFileName(parentWidget, tr("Save as 86f"), QString(), tr("Surface images (*.86F *.86f)"));
auto filename = QFileDialog::getSaveFileName(parentWidget, QString(), QString(), tr("Surface images (*.86F *.86f)"));
if (! filename.isEmpty()) {
QByteArray filenameBytes = filename.toUtf8();
plat_pause(1);
@@ -306,7 +306,7 @@ void MediaMenu::cdromMount(int i) {
QString dir;
QFileInfo fi(cdrom[i].image_path);
auto filename = QFileDialog::getOpenFileName(parentWidget, tr("Open"), QString(), tr("CD-ROM images (*.ISO *.iso *.CUE *.cue);;All files (*)"));
auto filename = QFileDialog::getOpenFileName(parentWidget, QString(), QString(), tr("CD-ROM images (*.ISO *.iso *.CUE *.cue);;All files (*)"));
if (filename.isEmpty()) {
auto* imageMenu = dynamic_cast<QAction*>(cdromMenus[i]->children()[cdromImagePos]);
imageMenu->setChecked(false);
@@ -374,7 +374,8 @@ void MediaMenu::cdromUpdateMenu(int i) {
break;
}
menu->setTitle(tr("CD-ROM %1 (%2): %3").arg(QString::number(i+1), busName, name.isEmpty() ? tr("(empty)") : name));
//menu->setTitle(tr("CD-ROM %1 (%2): %3").arg(QString::number(i+1), busName, name.isEmpty() ? tr("(empty)") : name));
menu->setTitle(QString::asprintf(tr("CD-ROM %i (%s): %s").toUtf8().constData(), i + 1, busName.toUtf8().data(), name.isEmpty() ? tr("(empty)").toUtf8().data() : name.toUtf8().data()));
}
void MediaMenu::zipNewImage(int i) {
@@ -388,7 +389,7 @@ void MediaMenu::zipNewImage(int i) {
}
void MediaMenu::zipSelectImage(int i, bool wp) {
auto filename = QFileDialog::getOpenFileName(parentWidget, tr("Open"), QString(), tr("ZIP images (*.im? *.zdi *.IM? *.ZDI);;All files (*)"));
auto filename = QFileDialog::getOpenFileName(parentWidget, QString(), QString(), tr("ZIP images (*.IM? *.im? *.ZDI *.zdi);;All files (*)"));
zipMount(i, filename, wp);
}
@@ -462,7 +463,8 @@ void MediaMenu::zipUpdateMenu(int i) {
break;
}
menu->setTitle(tr("ZIP %1 %2 (%3): %4").arg((zip_drives[i].is_250 > 0) ? "250" : "100", QString::number(i+1), busName, name.isEmpty() ? tr("(empty)") : name));
//menu->setTitle(tr("ZIP %1 %2 (%3): %4").arg((zip_drives[i].is_250 > 0) ? "250" : "100", QString::number(i+1), busName, name.isEmpty() ? tr("(empty)") : name));
menu->setTitle(QString::asprintf(tr("ZIP %03i %i (%s): %ls").toUtf8().constData(), (zip_drives[i].is_250 > 0) ? 250 : 100, i + 1, busName.toUtf8().data(), name.isEmpty() ? tr("(empty)").toStdU16String().data() : name.toStdU16String().data()));
}
void MediaMenu::moNewImage(int i) {
@@ -476,7 +478,7 @@ void MediaMenu::moNewImage(int i) {
}
void MediaMenu::moSelectImage(int i, bool wp) {
auto filename = QFileDialog::getOpenFileName(parentWidget, tr("Open"), QString(), tr("MO images (*.im? *.mdi *.IM? *.MDI);;All files (*)"));
auto filename = QFileDialog::getOpenFileName(parentWidget, QString(), QString(), tr("MO images (*.im? *.mdi *.IM? *.MDI);;All files (*)"));
moMount(i, filename, wp);
}
@@ -550,7 +552,7 @@ void MediaMenu::moUpdateMenu(int i) {
break;
}
menu->setTitle(tr("MO %1 (%2): %3").arg(QString::number(i+1), busName, name.isEmpty() ? tr("(empty)") : name));
menu->setTitle(QString::asprintf(tr("MO %i (%ls): %ls").toUtf8().constData(), i + 1, busName.toStdU16String().data(), name.isEmpty() ? tr("(empty)").toStdU16String().data() : name.toStdU16String().data()));
}

View File

@@ -144,8 +144,8 @@ void Settings::accept()
{
if (confirm_save)
{
QMessageBox questionbox(QMessageBox::Icon::Question, "86Box", "Do you want to save the settings?\n\nThis will hard reset the emulated machine.", QMessageBox::Save | QMessageBox::Cancel, this);
QCheckBox *chkbox = new QCheckBox("Do not ask me again");
QMessageBox questionbox(QMessageBox::Icon::Question, "86Box", QStringLiteral("%1\n\n%2").arg(tr("Do you want to save the settings?"), tr("This will hard reset the emulated machine.")), QMessageBox::Save | QMessageBox::Cancel, this);
QCheckBox *chkbox = new QCheckBox(tr("Don't show this message again"));
questionbox.setCheckBox(chkbox);
chkbox->setChecked(!confirm_save);
QObject::connect(chkbox, &QCheckBox::stateChanged, [](int state) {

View File

@@ -60,15 +60,18 @@
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>30</x>
<x>-20</x>
<y>10</y>
<width>54</width>
<height>17</height>
<width>131</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Gain</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</widget>
<resources/>