Merge branch 'master' into net-add-tap-backend
This commit is contained in:
@@ -93,7 +93,7 @@ MediaMenu::refresh(QMenu *parentMenu)
|
||||
cassetteMenu->addSeparator();
|
||||
for (int slot = 0; slot < MAX_PREV_IMAGES; slot++) {
|
||||
cassetteImageHistoryPos[slot] = cassetteMenu->children().count();
|
||||
cassetteMenu->addAction(QString::asprintf(tr("Image %i").toUtf8().constData(), slot), [this, slot]() { cassetteMenuSelect(slot); })->setCheckable(false);
|
||||
cassetteMenu->addAction(tr("Image %1").arg(slot), [this, slot]() { cassetteMenuSelect(slot); })->setCheckable(false);
|
||||
}
|
||||
cassetteMenu->addSeparator();
|
||||
cassetteRecordPos = cassetteMenu->children().count();
|
||||
@@ -118,7 +118,7 @@ MediaMenu::refresh(QMenu *parentMenu)
|
||||
menu->addSeparator();
|
||||
for (int slot = 0; slot < MAX_PREV_IMAGES; slot++) {
|
||||
cartridgeImageHistoryPos[slot] = menu->children().count();
|
||||
menu->addAction(QString::asprintf(tr("Image %i").toUtf8().constData(), slot), [this, i, slot]() { cartridgeMenuSelect(i, slot); })->setCheckable(false);
|
||||
menu->addAction(tr("Image %1").arg(slot), [this, i, slot]() { cartridgeMenuSelect(i, slot); })->setCheckable(false);
|
||||
}
|
||||
menu->addSeparator();
|
||||
cartridgeEjectPos = menu->children().count();
|
||||
@@ -138,7 +138,7 @@ MediaMenu::refresh(QMenu *parentMenu)
|
||||
menu->addSeparator();
|
||||
for (int slot = 0; slot < MAX_PREV_IMAGES; slot++) {
|
||||
floppyImageHistoryPos[slot] = menu->children().count();
|
||||
menu->addAction(QString::asprintf(tr("Image %i").toUtf8().constData(), slot), [this, i, slot]() { floppyMenuSelect(i, slot); })->setCheckable(false);
|
||||
menu->addAction(tr("Image %1").arg(slot), [this, i, slot]() { floppyMenuSelect(i, slot); })->setCheckable(false);
|
||||
}
|
||||
menu->addSeparator();
|
||||
floppyExportPos = menu->children().count();
|
||||
@@ -154,14 +154,14 @@ MediaMenu::refresh(QMenu *parentMenu)
|
||||
MachineStatus::iterateCDROM([this, parentMenu](int i) {
|
||||
auto *menu = parentMenu->addMenu("");
|
||||
cdromMutePos = menu->children().count();
|
||||
menu->addAction(ProgSettings::loadIcon("/cdrom_mute.ico"), tr("&Mute"), [this, i]() { cdromMute(i); })->setCheckable(true);
|
||||
menu->addAction(QIcon(":/settings/qt/icons/cdrom_mute.ico"), tr("&Mute"), [this, i]() { cdromMute(i); })->setCheckable(true);
|
||||
menu->addSeparator();
|
||||
menu->addAction(ProgSettings::loadIcon("/cdrom_image.ico"), tr("&Image..."), [this, i]() { cdromMount(i, 0, nullptr); })->setCheckable(false);
|
||||
menu->addAction(ProgSettings::loadIcon("/cdrom_folder.ico"), tr("&Folder..."), [this, i]() { cdromMount(i, 1, nullptr); })->setCheckable(false);
|
||||
menu->addAction(QIcon(":/settings/qt/icons/cdrom_image.ico"), tr("&Image..."), [this, i]() { cdromMount(i, 0, nullptr); })->setCheckable(false);
|
||||
menu->addAction(QIcon(":/settings/qt/icons/cdrom_folder.ico"), tr("&Folder..."), [this, i]() { cdromMount(i, 1, nullptr); })->setCheckable(false);
|
||||
menu->addSeparator();
|
||||
for (int slot = 0; slot < MAX_PREV_IMAGES; slot++) {
|
||||
cdromImageHistoryPos[slot] = menu->children().count();
|
||||
menu->addAction(QString::asprintf(tr("Image %i").toUtf8().constData(), slot), [this, i, slot]() { cdromReload(i, slot); })->setCheckable(false);
|
||||
menu->addAction(tr("Image %1").arg(slot), [this, i, slot]() { cdromReload(i, slot); })->setCheckable(false);
|
||||
}
|
||||
menu->addSeparator();
|
||||
#ifdef Q_OS_WINDOWS
|
||||
@@ -170,12 +170,11 @@ MediaMenu::refresh(QMenu *parentMenu)
|
||||
for (const auto &letter : driveLetters) {
|
||||
auto drive = QString("%1:\\").arg(letter);
|
||||
if (GetDriveType(drive.toUtf8().constData()) == DRIVE_CDROM)
|
||||
menu->addAction(ProgSettings::loadIcon("/cdrom_host.ico"), tr("Host CD/DVD Drive (%1:)").arg(letter), [this, i, letter] { cdromMount(i, 2, QString(R"(\\.\%1:)").arg(letter)); })->setCheckable(false);
|
||||
menu->addAction(QIcon(":/settings/qt/icons/cdrom_host.ico"), tr("Host CD/DVD Drive (%1:)").arg(letter), [this, i, letter] { cdromMount(i, 2, QString(R"(\\.\%1:)").arg(letter)); })->setCheckable(false);
|
||||
}
|
||||
menu->addSeparator();
|
||||
#endif // Q_OS_WINDOWS
|
||||
cdromImagePos = menu->children().count();
|
||||
cdromDirPos = menu->children().count();
|
||||
cdromEjectPos = menu->children().count();
|
||||
menu->addAction(tr("E&ject"), [this, i]() { cdromEject(i); })->setCheckable(false);
|
||||
cdromMenus[i] = menu;
|
||||
cdromUpdateMenu(i);
|
||||
@@ -191,7 +190,7 @@ MediaMenu::refresh(QMenu *parentMenu)
|
||||
menu->addSeparator();
|
||||
for (int slot = 0; slot < MAX_PREV_IMAGES; slot++) {
|
||||
zipImageHistoryPos[slot] = menu->children().count();
|
||||
menu->addAction(QString::asprintf(tr("Image %i").toUtf8().constData(), slot), [this, i, slot]() { zipReload(i, slot); })->setCheckable(false);
|
||||
menu->addAction(tr("Image %1").arg(slot), [this, i, slot]() { zipReload(i, slot); })->setCheckable(false);
|
||||
}
|
||||
menu->addSeparator();
|
||||
zipEjectPos = menu->children().count();
|
||||
@@ -210,7 +209,7 @@ MediaMenu::refresh(QMenu *parentMenu)
|
||||
menu->addSeparator();
|
||||
for (int slot = 0; slot < MAX_PREV_IMAGES; slot++) {
|
||||
moImageHistoryPos[slot] = menu->children().count();
|
||||
menu->addAction(QString::asprintf(tr("Image %i").toUtf8().constData(), slot), [this, i, slot]() { moReload(i, slot); })->setCheckable(false);
|
||||
menu->addAction(tr("Image %1").arg(slot), [this, i, slot]() { moReload(i, slot); })->setCheckable(false);
|
||||
}
|
||||
menu->addSeparator();
|
||||
moEjectPos = menu->children().count();
|
||||
@@ -263,7 +262,7 @@ void
|
||||
MediaMenu::cassetteMenuSelect(int slot)
|
||||
{
|
||||
QString filename = mhm.getImageForSlot(0, slot, ui::MediaType::Cassette);
|
||||
cassetteMount(filename.toUtf8().constData(), 0);
|
||||
cassetteMount(filename, 0);
|
||||
cassetteUpdateMenu();
|
||||
ui_sb_update_tip(SB_CASSETTE);
|
||||
}
|
||||
@@ -304,7 +303,8 @@ MediaMenu::cassetteEject()
|
||||
void
|
||||
MediaMenu::cassetteUpdateMenu()
|
||||
{
|
||||
QString name = cassette_fname;
|
||||
QString name = cassette_fname;
|
||||
QFileInfo fi(cassette_fname);
|
||||
const QString mode = cassette_mode;
|
||||
auto childs = cassetteMenu->children();
|
||||
auto *recordMenu = dynamic_cast<QAction *>(childs[cassetteRecordPos]);
|
||||
@@ -318,13 +318,13 @@ MediaMenu::cassetteUpdateMenu()
|
||||
rewindMenu->setEnabled(!name.isEmpty());
|
||||
fastFwdMenu->setEnabled(!name.isEmpty());
|
||||
ejectMenu->setEnabled(!name.isEmpty());
|
||||
ejectMenu->setText(name.isEmpty() ? tr("E&ject") : tr("E&ject %1").arg(fi.fileName()));
|
||||
|
||||
const bool isSaving = (mode == QStringLiteral("save"));
|
||||
recordMenu->setChecked(isSaving);
|
||||
playMenu->setChecked(!isSaving);
|
||||
|
||||
cassetteMenu->setTitle(QString::asprintf(tr("Cassette: %s").toUtf8().constData(),
|
||||
(name.isEmpty() ? tr("(empty)") : name).toUtf8().constData()));
|
||||
cassetteMenu->setTitle(tr("Cassette: %1").arg(name.isEmpty() ? tr("(empty)") : name));
|
||||
|
||||
for (int slot = 0; slot < MAX_PREV_IMAGES; slot++) {
|
||||
updateImageHistory(0, slot, ui::MediaType::Cassette);
|
||||
@@ -365,7 +365,7 @@ void
|
||||
MediaMenu::cartridgeMenuSelect(int index, int slot)
|
||||
{
|
||||
QString filename = mhm.getImageForSlot(index, slot, ui::MediaType::Cartridge);
|
||||
cartridgeMount(index, filename.toUtf8().constData());
|
||||
cartridgeMount(index, filename);
|
||||
cartridgeUpdateMenu(index);
|
||||
ui_sb_update_tip(SB_CARTRIDGE | index);
|
||||
}
|
||||
@@ -385,12 +385,13 @@ void
|
||||
MediaMenu::cartridgeUpdateMenu(int i)
|
||||
{
|
||||
const QString name = cart_fns[i];
|
||||
auto *menu = cartridgeMenus[i];
|
||||
QFileInfo fi(cart_fns[i]);
|
||||
auto *menu = cartridgeMenus[i];
|
||||
auto childs = menu->children();
|
||||
auto *ejectMenu = dynamic_cast<QAction *>(childs[cartridgeEjectPos]);
|
||||
ejectMenu->setEnabled(!name.isEmpty());
|
||||
// menu->setTitle(tr("Cartridge %1: %2").arg(QString::number(i+1), name.isEmpty() ? tr("(empty)") : name));
|
||||
menu->setTitle(QString::asprintf(tr("Cartridge %i: %ls").toUtf8().constData(), i + 1, name.isEmpty() ? tr("(empty)").toStdU16String().data() : name.toStdU16String().data()));
|
||||
ejectMenu->setText(name.isEmpty() ? tr("E&ject") : tr("E&ject %1").arg(fi.fileName()));
|
||||
menu->setTitle(tr("Cartridge %1: %2").arg(QString::number(i + 1), name.isEmpty() ? tr("(empty)") : name));
|
||||
|
||||
for (int slot = 0; slot < MAX_PREV_IMAGES; slot++) {
|
||||
updateImageHistory(i, slot, ui::MediaType::Cartridge);
|
||||
@@ -491,7 +492,7 @@ MediaMenu::floppyUpdateMenu(int i)
|
||||
auto *ejectMenu = dynamic_cast<QAction *>(childs[floppyEjectPos]);
|
||||
auto *exportMenu = dynamic_cast<QAction *>(childs[floppyExportPos]);
|
||||
ejectMenu->setEnabled(!name.isEmpty());
|
||||
ejectMenu->setText(QString::asprintf(tr("Eject %s").toUtf8().constData(), name.isEmpty() ? QString().toUtf8().constData() : fi.fileName().toUtf8().constData()));
|
||||
ejectMenu->setText(name.isEmpty() ? tr("E&ject") : tr("E&ject %1").arg(fi.fileName()));
|
||||
exportMenu->setEnabled(!name.isEmpty());
|
||||
|
||||
for (int slot = 0; slot < MAX_PREV_IMAGES; slot++) {
|
||||
@@ -499,15 +500,15 @@ MediaMenu::floppyUpdateMenu(int i)
|
||||
}
|
||||
|
||||
int type = fdd_get_type(i);
|
||||
// floppyMenus[i]->setTitle(tr("Floppy %1 (%2): %3").arg(QString::number(i+1), fdd_getname(type), name.isEmpty() ? tr("(empty)") : name));
|
||||
floppyMenus[i]->setTitle(QString::asprintf(tr("Floppy %i (%s): %ls").toUtf8().constData(), i + 1, fdd_getname(type), name.isEmpty() ? tr("(empty)").toStdU16String().data() : name.toStdU16String().data()));
|
||||
floppyMenus[i]->setTitle(tr("Floppy %1 (%2): %3").arg(QString::number(i + 1), fdd_getname(type), name.isEmpty() ? tr("(empty)") : name));
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
MediaMenu::floppyMenuSelect(int index, int slot)
|
||||
{
|
||||
QString filename = mhm.getImageForSlot(index, slot, ui::MediaType::Floppy);
|
||||
floppyMount(index, filename.toUtf8().constData(), false);
|
||||
floppyMount(index, filename, false);
|
||||
floppyUpdateMenu(index);
|
||||
ui_sb_update_tip(SB_FLOPPY | index);
|
||||
}
|
||||
@@ -537,10 +538,7 @@ MediaMenu::cdromMount(int i, const QString &filename)
|
||||
if ((fn.data() != NULL) && (strlen(fn.data()) >= 1) && (fn.data()[strlen(fn.data()) - 1] == '\\'))
|
||||
fn.data()[strlen(fn.data()) - 1] = '/';
|
||||
#endif
|
||||
if ((fn.data() != nullptr) && fn.contains("ioctl://"))
|
||||
cdrom_ioctl_open(&(cdrom[i]), fn.data());
|
||||
else
|
||||
cdrom_image_open(&(cdrom[i]), fn.data());
|
||||
cdrom_load(&(cdrom[i]), fn.data(), 1);
|
||||
|
||||
/* Signal media change to the emulated machine. */
|
||||
if (cdrom[i].insert) {
|
||||
@@ -597,7 +595,7 @@ void
|
||||
MediaMenu::cdromReload(int index, int slot)
|
||||
{
|
||||
const QString filename = mhm.getImageForSlot(index, slot, ui::MediaType::Optical);
|
||||
cdromMount(index, filename.toUtf8().constData());
|
||||
cdromMount(index, filename);
|
||||
cdromUpdateMenu(index);
|
||||
ui_sb_update_tip(SB_CDROM | index);
|
||||
}
|
||||
@@ -633,7 +631,7 @@ MediaMenu::updateImageHistory(int index, int slot, ui::MediaType type)
|
||||
|
||||
switch (type) {
|
||||
default:
|
||||
menu_item_name = fi.fileName().isEmpty() ? tr("previous image").toUtf8().constData() : fi.fileName().toUtf8().constData();
|
||||
menu_item_name = fi.fileName().isEmpty() ? tr("Reload previous image") : fn;
|
||||
return;
|
||||
case ui::MediaType::Cassette:
|
||||
if (!MachineStatus::hasCassette())
|
||||
@@ -642,7 +640,7 @@ MediaMenu::updateImageHistory(int index, int slot, ui::MediaType type)
|
||||
children = menu->children();
|
||||
imageHistoryUpdatePos = dynamic_cast<QAction *>(children[cassetteImageHistoryPos[slot]]);
|
||||
fi.setFile(fn);
|
||||
menu_item_name = fi.fileName().isEmpty() ? tr("previous image").toUtf8().constData() : fi.fileName().toUtf8().constData();
|
||||
menu_item_name = fi.fileName().isEmpty() ? tr("Reload previous image") : fn;
|
||||
break;
|
||||
case ui::MediaType::Cartridge:
|
||||
if (!machine_has_cartridge(machine))
|
||||
@@ -651,7 +649,7 @@ MediaMenu::updateImageHistory(int index, int slot, ui::MediaType type)
|
||||
children = menu->children();
|
||||
imageHistoryUpdatePos = dynamic_cast<QAction *>(children[cartridgeImageHistoryPos[slot]]);
|
||||
fi.setFile(fn);
|
||||
menu_item_name = fi.fileName().isEmpty() ? tr("previous image").toUtf8().constData() : fi.fileName().toUtf8().constData();
|
||||
menu_item_name = fi.fileName().isEmpty() ? tr("Reload previous image") : fn;
|
||||
break;
|
||||
case ui::MediaType::Floppy:
|
||||
if (!floppyMenus.contains(index))
|
||||
@@ -660,7 +658,7 @@ MediaMenu::updateImageHistory(int index, int slot, ui::MediaType type)
|
||||
children = menu->children();
|
||||
imageHistoryUpdatePos = dynamic_cast<QAction *>(children[floppyImageHistoryPos[slot]]);
|
||||
fi.setFile(fn);
|
||||
menu_item_name = fi.fileName().isEmpty() ? tr("previous image").toUtf8().constData() : fi.fileName().toUtf8().constData();
|
||||
menu_item_name = fi.fileName().isEmpty() ? tr("Reload previous image") : fn;
|
||||
break;
|
||||
case ui::MediaType::Optical:
|
||||
if (!cdromMenus.contains(index))
|
||||
@@ -669,16 +667,16 @@ MediaMenu::updateImageHistory(int index, int slot, ui::MediaType type)
|
||||
children = menu->children();
|
||||
imageHistoryUpdatePos = dynamic_cast<QAction *>(children[cdromImageHistoryPos[slot]]);
|
||||
if (fn.left(8) == "ioctl://") {
|
||||
menu_icon = ProgSettings::loadIcon("/cdrom_host.ico");
|
||||
menu_icon = QIcon(":/settings/qt/icons/cdrom_host.ico");
|
||||
#ifdef Q_OS_WINDOWS
|
||||
menu_item_name = tr("Host CD/DVD Drive (%1)").arg(fn.right(2)).toUtf8().constData();
|
||||
menu_item_name = tr("Host CD/DVD Drive (%1)").arg(fn.right(2));
|
||||
#else
|
||||
menu_item_name = tr("Host CD/DVD Drive (%1)").arg(fn.right(fn.length() - 8));
|
||||
#endif
|
||||
} else {
|
||||
fi.setFile(fn);
|
||||
menu_icon = fi.isDir() ? ProgSettings::loadIcon("/cdrom_folder.ico") : ProgSettings::loadIcon("/cdrom_image.ico");
|
||||
menu_item_name = fn.isEmpty() ? tr("previous image").toUtf8().constData() : fn.toUtf8().constData();
|
||||
menu_icon = fi.isDir() ? QIcon(":/settings/qt/icons/cdrom_folder.ico") : QIcon(":/settings/qt/icons/cdrom_image.ico");
|
||||
menu_item_name = fn.isEmpty() ? tr("Reload previous image") : fn;
|
||||
}
|
||||
imageHistoryUpdatePos->setIcon(menu_icon);
|
||||
break;
|
||||
@@ -689,7 +687,7 @@ MediaMenu::updateImageHistory(int index, int slot, ui::MediaType type)
|
||||
children = menu->children();
|
||||
imageHistoryUpdatePos = dynamic_cast<QAction *>(children[zipImageHistoryPos[slot]]);
|
||||
fi.setFile(fn);
|
||||
menu_item_name = fi.fileName().isEmpty() ? tr("previous image").toUtf8().constData() : fi.fileName().toUtf8().constData();
|
||||
menu_item_name = fi.fileName().isEmpty() ? tr("Reload previous image") : fn;
|
||||
break;
|
||||
case ui::MediaType::Mo:
|
||||
if (!moMenus.contains(index))
|
||||
@@ -698,11 +696,11 @@ MediaMenu::updateImageHistory(int index, int slot, ui::MediaType type)
|
||||
children = menu->children();
|
||||
imageHistoryUpdatePos = dynamic_cast<QAction *>(children[moImageHistoryPos[slot]]);
|
||||
fi.setFile(fn);
|
||||
menu_item_name = fi.fileName().isEmpty() ? tr("previous image").toUtf8().constData() : fi.fileName().toUtf8().constData();
|
||||
menu_item_name = fi.fileName().isEmpty() ? tr("Reload previous image") : fn;
|
||||
break;
|
||||
}
|
||||
|
||||
imageHistoryUpdatePos->setText(QString::asprintf(tr("%s").toUtf8().constData(), menu_item_name.toUtf8().constData()));
|
||||
imageHistoryUpdatePos->setText(menu_item_name);
|
||||
|
||||
if (fn.left(8) == "ioctl://")
|
||||
imageHistoryUpdatePos->setVisible(true);
|
||||
@@ -730,29 +728,29 @@ MediaMenu::cdromUpdateMenu(int i)
|
||||
auto childs = menu->children();
|
||||
|
||||
auto *muteMenu = dynamic_cast<QAction *>(childs[cdromMutePos]);
|
||||
muteMenu->setIcon(ProgSettings::loadIcon((cdrom[i].sound_on == 0) ? "/cdrom_unmute.ico" : "/cdrom_mute.ico"));
|
||||
muteMenu->setIcon(QIcon((cdrom[i].sound_on == 0) ? ":/settings/qt/icons/cdrom_unmute.ico" : ":/settings/qt/icons/cdrom_mute.ico"));
|
||||
muteMenu->setText((cdrom[i].sound_on == 0) ? tr("&Unmute") : tr("&Mute"));
|
||||
|
||||
auto *imageMenu = dynamic_cast<QAction *>(childs[cdromImagePos]);
|
||||
imageMenu->setEnabled(!name.isEmpty());
|
||||
auto *ejectMenu = dynamic_cast<QAction *>(childs[cdromEjectPos]);
|
||||
ejectMenu->setEnabled(!name.isEmpty());
|
||||
QString menu_item_name;
|
||||
if (name.left(8) == "ioctl://") {
|
||||
#ifdef Q_OS_WINDOWS
|
||||
menu_item_name = tr("Host CD/DVD Drive (%1)").arg(name.right(2)).toUtf8().constData();
|
||||
menu_item_name = tr("Host CD/DVD Drive (%1)").arg(name.right(2));
|
||||
#else
|
||||
menu_item_name = tr("Host CD/DVD Drive (%1)").arg(name.right(name.length() - 8));
|
||||
#endif
|
||||
name2 = menu_item_name;
|
||||
menu_icon = ProgSettings::loadIcon("/cdrom_host.ico");
|
||||
menu_icon = QIcon(":/settings/qt/icons/cdrom_host.ico");
|
||||
} else {
|
||||
QFileInfo fi(cdrom[i].image_path);
|
||||
|
||||
menu_item_name = name.isEmpty() ? QString().toUtf8().constData() : name.toUtf8().constData();
|
||||
menu_item_name = name.isEmpty() ? QString() : fi.fileName();
|
||||
name2 = name;
|
||||
menu_icon = fi.isDir() ? ProgSettings::loadIcon("/cdrom_folder.ico") : ProgSettings::loadIcon("/cdrom_image.ico");
|
||||
menu_icon = fi.isDir() ? QIcon(":/settings/qt/icons/cdrom_folder.ico") : QIcon(":/settings/qt/icons/cdrom_image.ico");
|
||||
}
|
||||
imageMenu->setIcon(menu_icon);
|
||||
imageMenu->setText(QString::asprintf(tr("Eject %s").toUtf8().constData(), menu_item_name.toUtf8().constData()));
|
||||
ejectMenu->setIcon(menu_icon);
|
||||
ejectMenu->setText(name.isEmpty() ? tr("E&ject") : tr("E&ject %1").arg(menu_item_name));
|
||||
|
||||
for (int slot = 0; slot < MAX_PREV_IMAGES; slot++)
|
||||
updateImageHistory(i, slot, ui::MediaType::Optical);
|
||||
@@ -772,8 +770,7 @@ 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(QString::asprintf(tr("CD-ROM %i (%s): %s").toUtf8().constData(), i + 1, busName.toUtf8().data(), name.isEmpty() ? tr("(empty)").toUtf8().data() : name2.toUtf8().data()));
|
||||
menu->setTitle(tr("CD-ROM %1 (%2): %3").arg(QString::number(i+1), busName, name.isEmpty() ? tr("(empty)") : name2));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -806,14 +803,21 @@ MediaMenu::zipSelectImage(int i, bool wp)
|
||||
void
|
||||
MediaMenu::zipMount(int i, const QString &filename, bool wp)
|
||||
{
|
||||
const auto dev = static_cast<zip_t *>(zip_drives[i].priv);
|
||||
const auto dev = static_cast<zip_t *>(zip_drives[i].priv);
|
||||
int was_empty = zip_is_empty(i);
|
||||
|
||||
zip_disk_close(dev);
|
||||
zip_drives[i].read_only = wp;
|
||||
if (!filename.isEmpty()) {
|
||||
QByteArray filenameBytes = filename.toUtf8();
|
||||
zip_load(dev, filenameBytes.data());
|
||||
zip_load(dev, filenameBytes.data(), 1);
|
||||
|
||||
/* Signal media change to the emulated machine. */
|
||||
zip_insert(dev);
|
||||
|
||||
/* The drive was previously empty, transition directly to UNIT ATTENTION. */
|
||||
if (was_empty)
|
||||
zip_insert(dev);
|
||||
}
|
||||
mhm.addImageToHistory(i, ui::MediaType::Zip, zip_drives[i].prev_image_path, zip_drives[i].image_path);
|
||||
|
||||
@@ -875,6 +879,7 @@ MediaMenu::zipUpdateMenu(int i)
|
||||
{
|
||||
const QString name = zip_drives[i].image_path;
|
||||
const QString prev_name = zip_drives[i].prev_image_path;
|
||||
QFileInfo fi(zip_drives[i].image_path);
|
||||
if (!zipMenus.contains(i))
|
||||
return;
|
||||
auto *menu = zipMenus[i];
|
||||
@@ -882,6 +887,7 @@ MediaMenu::zipUpdateMenu(int i)
|
||||
|
||||
auto *ejectMenu = dynamic_cast<QAction *>(childs[zipEjectPos]);
|
||||
ejectMenu->setEnabled(!name.isEmpty());
|
||||
ejectMenu->setText(name.isEmpty() ? tr("E&ject") : tr("E&ject %1").arg(fi.fileName()));
|
||||
|
||||
QString busName = tr("Unknown Bus");
|
||||
switch (zip_drives[i].bus_type) {
|
||||
@@ -895,8 +901,7 @@ 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(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()));
|
||||
menu->setTitle(tr("ZIP %1 %2 (%3): %4").arg((zip_drives[i].is_250 > 0) ? QString("250") : QString("100"), QString::number(i + 1), busName, name.isEmpty() ? tr("(empty)") : name));
|
||||
|
||||
for (int slot = 0; slot < MAX_PREV_IMAGES; slot++)
|
||||
updateImageHistory(i, slot, ui::MediaType::Zip);
|
||||
@@ -935,14 +940,21 @@ MediaMenu::moSelectImage(int i, bool wp)
|
||||
void
|
||||
MediaMenu::moMount(int i, const QString &filename, bool wp)
|
||||
{
|
||||
const auto dev = static_cast<mo_t *>(mo_drives[i].priv);
|
||||
const auto dev = static_cast<mo_t *>(mo_drives[i].priv);
|
||||
int was_empty = mo_is_empty(i);
|
||||
|
||||
mo_disk_close(dev);
|
||||
mo_drives[i].read_only = wp;
|
||||
if (!filename.isEmpty()) {
|
||||
QByteArray filenameBytes = filename.toUtf8();
|
||||
mo_load(dev, filenameBytes.data());
|
||||
mo_load(dev, filenameBytes.data(), 1);
|
||||
|
||||
/* Signal media change to the emulated machine. */
|
||||
mo_insert(dev);
|
||||
|
||||
/* The drive was previously empty, transition directly to UNIT ATTENTION. */
|
||||
if (was_empty)
|
||||
mo_insert(dev);
|
||||
}
|
||||
mhm.addImageToHistory(i, ui::MediaType::Mo, mo_drives[i].prev_image_path, mo_drives[i].image_path);
|
||||
|
||||
@@ -1002,8 +1014,9 @@ MediaMenu::moReload(int index, int slot)
|
||||
void
|
||||
MediaMenu::moUpdateMenu(int i)
|
||||
{
|
||||
QString name = mo_drives[i].image_path;
|
||||
QString prev_name = mo_drives[i].prev_image_path;
|
||||
QString name = mo_drives[i].image_path;
|
||||
QString prev_name = mo_drives[i].prev_image_path;
|
||||
QFileInfo fi(mo_drives[i].image_path);
|
||||
if (!moMenus.contains(i))
|
||||
return;
|
||||
auto *menu = moMenus[i];
|
||||
@@ -1011,6 +1024,7 @@ MediaMenu::moUpdateMenu(int i)
|
||||
|
||||
auto *ejectMenu = dynamic_cast<QAction *>(childs[moEjectPos]);
|
||||
ejectMenu->setEnabled(!name.isEmpty());
|
||||
ejectMenu->setText(name.isEmpty() ? tr("E&ject") : tr("E&ject %1").arg(fi.fileName()));
|
||||
|
||||
QString busName = tr("Unknown Bus");
|
||||
switch (mo_drives[i].bus_type) {
|
||||
@@ -1024,7 +1038,7 @@ MediaMenu::moUpdateMenu(int i)
|
||||
break;
|
||||
}
|
||||
|
||||
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()));
|
||||
menu->setTitle(tr("MO %1 (%2): %3").arg(QString::number(i + 1), busName, name.isEmpty() ? tr("(empty)") : name));
|
||||
|
||||
for (int slot = 0; slot < MAX_PREV_IMAGES; slot++)
|
||||
updateImageHistory(i, slot, ui::MediaType::Mo);
|
||||
@@ -1079,7 +1093,7 @@ MediaMenu::nicUpdateMenu(int i)
|
||||
auto *connectedAction = dynamic_cast<QAction *>(childs[netDisconnPos]);
|
||||
connectedAction->setChecked(network_is_connected(i));
|
||||
|
||||
menu->setTitle(QString::asprintf(tr("NIC %02i (%ls) %ls").toUtf8().constData(), i + 1, netType.toStdU16String().data(), devName.toStdU16String().data()));
|
||||
menu->setTitle(tr("NIC %1 (%2) %3").arg(QString::number(i + 1), netType, devName));
|
||||
}
|
||||
|
||||
QString
|
||||
|
||||
Reference in New Issue
Block a user