mirror of
https://github.com/86Box/86Box.git
synced 2025-01-22 09:11:50 -05:00
Begin Qt translation framework
This commit is contained in:
parent
27e144f7fa
commit
81055c03e2
26 changed files with 22782 additions and 111 deletions
|
@ -90,6 +90,7 @@ if(QT)
|
|||
#set(CMAKE_PREFIX_PATH "path/to/qt5-static")
|
||||
|
||||
find_package(Qt5 COMPONENTS Core Widgets REQUIRED)
|
||||
find_package(Qt5LinguistTools REQUIRED)
|
||||
endif()
|
||||
|
||||
find_package(Freetype REQUIRED)
|
||||
|
|
1332
src/qt/86box_de.ts
Normal file
1332
src/qt/86box_de.ts
Normal file
File diff suppressed because it is too large
Load diff
1332
src/qt/86box_en-GB.ts
Normal file
1332
src/qt/86box_en-GB.ts
Normal file
File diff suppressed because it is too large
Load diff
1332
src/qt/86box_en.ts
Normal file
1332
src/qt/86box_en.ts
Normal file
File diff suppressed because it is too large
Load diff
1332
src/qt/86box_es.ts
Normal file
1332
src/qt/86box_es.ts
Normal file
File diff suppressed because it is too large
Load diff
1332
src/qt/86box_fi.ts
Normal file
1332
src/qt/86box_fi.ts
Normal file
File diff suppressed because it is too large
Load diff
1332
src/qt/86box_fr.ts
Normal file
1332
src/qt/86box_fr.ts
Normal file
File diff suppressed because it is too large
Load diff
1332
src/qt/86box_hr.ts
Normal file
1332
src/qt/86box_hr.ts
Normal file
File diff suppressed because it is too large
Load diff
1332
src/qt/86box_hu.ts
Normal file
1332
src/qt/86box_hu.ts
Normal file
File diff suppressed because it is too large
Load diff
1332
src/qt/86box_it.ts
Normal file
1332
src/qt/86box_it.ts
Normal file
File diff suppressed because it is too large
Load diff
1332
src/qt/86box_ja.ts
Normal file
1332
src/qt/86box_ja.ts
Normal file
File diff suppressed because it is too large
Load diff
1332
src/qt/86box_ko.ts
Normal file
1332
src/qt/86box_ko.ts
Normal file
File diff suppressed because it is too large
Load diff
1332
src/qt/86box_pt-BR.ts
Normal file
1332
src/qt/86box_pt-BR.ts
Normal file
File diff suppressed because it is too large
Load diff
1332
src/qt/86box_pt-PT.ts
Normal file
1332
src/qt/86box_pt-PT.ts
Normal file
File diff suppressed because it is too large
Load diff
1332
src/qt/86box_ru.ts
Normal file
1332
src/qt/86box_ru.ts
Normal file
File diff suppressed because it is too large
Load diff
1332
src/qt/86box_sl.ts
Normal file
1332
src/qt/86box_sl.ts
Normal file
File diff suppressed because it is too large
Load diff
1332
src/qt/86box_tr.ts
Normal file
1332
src/qt/86box_tr.ts
Normal file
File diff suppressed because it is too large
Load diff
1332
src/qt/86box_zh.ts
Normal file
1332
src/qt/86box_zh.ts
Normal file
File diff suppressed because it is too large
Load diff
|
@ -172,3 +172,6 @@ if (UNIX AND NOT APPLE)
|
|||
endif()
|
||||
endif()
|
||||
endif()
|
||||
qt5_create_translation(QM_FILES ${CMAKE_CURRENT_SOURCE_DIR} 86box_en.ts 86box_en-GB.ts 86box_de.ts 86box_es.ts 86box_fi.ts 86box_fr.ts 86box_hr.ts 86box_hu.ts 86box_it.ts 86box_ja.ts 86box_ko.ts 86box_pt-BR.ts 86box_pt-PT.ts 86box_ru.ts 86box_sl.ts 86box_tr.ts 86box_zh.ts)
|
||||
configure_file(qt_translations.qrc ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)
|
||||
target_sources(ui PRIVATE ${QM_FILES} ${CMAKE_CURRENT_BINARY_DIR}/qt_translations.qrc)
|
||||
|
|
56
src/qt/qt.c
56
src/qt/qt.c
|
@ -21,62 +21,6 @@ int qt_nvr_save(void) {
|
|||
|
||||
char icon_set[256] = ""; /* name of the iconset to be used */
|
||||
|
||||
#ifdef _WIN32
|
||||
#define LIB_NAME_FLUIDSYNTH "libfluidsynth.dll"
|
||||
#else
|
||||
#define LIB_NAME_FLUIDSYNTH "libfluidsynth"
|
||||
#endif
|
||||
|
||||
wchar_t* plat_get_string(int i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case IDS_2077:
|
||||
return L"Click to capture mouse.";
|
||||
case IDS_2078:
|
||||
#ifdef _WIN32
|
||||
return L"Press F8+F12 to release mouse";
|
||||
#else
|
||||
return L"Press CTRL-END to release mouse";
|
||||
#endif
|
||||
case IDS_2079:
|
||||
#ifdef _WIN32
|
||||
return L"Press F8+F12 or middle button to release mouse";
|
||||
#else
|
||||
return L"Press CTRL-END or middle button to release mouse";
|
||||
#endif
|
||||
case IDS_2080:
|
||||
return L"Failed to initialize FluidSynth";
|
||||
case IDS_4099:
|
||||
return L"MFM/RLL or ESDI CD-ROM drives never existed";
|
||||
case IDS_2093:
|
||||
return L"Failed to set up PCap";
|
||||
case IDS_2094:
|
||||
return L"No PCap devices found";
|
||||
case IDS_2110:
|
||||
return L"Unable to initialize FreeType";
|
||||
case IDS_2111:
|
||||
return L"Unable to initialize SDL, libsdl2 is required";
|
||||
case IDS_2131:
|
||||
return L"libfreetype is required for ESC/P printer emulation.";
|
||||
case IDS_2132:
|
||||
return L"libgs is required for automatic conversion of PostScript files to PDF.\n\nAny documents sent to the generic PostScript printer will be saved as PostScript (.ps) files.";
|
||||
case IDS_2133:
|
||||
return L""LIB_NAME_FLUIDSYNTH" is required for FluidSynth MIDI output.";
|
||||
case IDS_2129:
|
||||
return L"Make sure libpcap is installed and that you are on a libpcap-compatible network connection.";
|
||||
case IDS_2114:
|
||||
return L"Unable to initialize Ghostscript";
|
||||
case IDS_2063:
|
||||
return L"Machine \"%hs\" is not available due to missing ROMs in the roms/machines directory. Switching to an available machine.";
|
||||
case IDS_2064:
|
||||
return L"Video card \"%hs\" is not available due to missing ROMs in the roms/video directory. Switching to an available video card.";
|
||||
case IDS_2128:
|
||||
return L"Hardware not available";
|
||||
}
|
||||
return L"";
|
||||
}
|
||||
|
||||
int
|
||||
plat_vidapi(char* api) {
|
||||
if (!strcasecmp(api, "default") || !strcasecmp(api, "system")) {
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
#include <QElapsedTimer>
|
||||
#include <QThread>
|
||||
#include <QTimer>
|
||||
#include <QTranslator>
|
||||
#include <QDirIterator>
|
||||
#include <QLibraryInfo>
|
||||
|
||||
#ifdef QT_STATIC
|
||||
/* Static builds need plugin imports */
|
||||
|
@ -25,6 +28,7 @@ Q_IMPORT_PLUGIN(QWindowsVistaStylePlugin)
|
|||
#include <86box/video.h>
|
||||
|
||||
#include <thread>
|
||||
#include <iostream>
|
||||
|
||||
#include "qt_mainwindow.hpp"
|
||||
#include "cocoa_mouse.hpp"
|
||||
|
@ -95,10 +99,21 @@ main_thread_fn()
|
|||
|
||||
int main(int argc, char* argv[]) {
|
||||
QApplication app(argc, argv);
|
||||
Q_INIT_RESOURCE(qt_resources);
|
||||
Q_INIT_RESOURCE(qt_translations);
|
||||
QSurfaceFormat fmt = QSurfaceFormat::defaultFormat();
|
||||
fmt.setSwapInterval(0);
|
||||
QSurfaceFormat::setDefaultFormat(fmt);
|
||||
app.setStyle(new StyleOverride());
|
||||
|
||||
QTranslator translator;
|
||||
if (translator.load(QLocale(), QLatin1String("86box"), QLatin1String("_"), QLatin1String(":/")))
|
||||
{
|
||||
translator.load(QLocale(), QLatin1String("qt"), QLatin1String("_"), QLibraryInfo::location(QLibraryInfo::TranslationsPath));
|
||||
translator.load(QLocale(), QLatin1String("qt_help"), QLatin1String("_"), QLibraryInfo::location(QLibraryInfo::TranslationsPath));
|
||||
translator.load(QLocale(), QLatin1String("qtbase"), QLatin1String("_"), QLibraryInfo::location(QLibraryInfo::TranslationsPath));
|
||||
QCoreApplication::installTranslator(&translator);
|
||||
}
|
||||
#ifdef __APPLE__
|
||||
CocoaEventFilter cocoafilter;
|
||||
app.installNativeEventFilter(&cocoafilter);
|
||||
|
@ -110,11 +125,7 @@ int main(int argc, char* argv[]) {
|
|||
return 0;
|
||||
}
|
||||
if (! pc_init_modules()) {
|
||||
#ifdef Q_OS_MACOS
|
||||
ui_msgbox_header(MBX_FATAL, VC(L"No ROMs found."), VC(L"86Box could not find any usable ROM images.\n\nPlease <a href='https://github.com/86Box/roms/releases/latest'>download</a> a ROM set and extract it into the \"~/Library/Application Support/net.86box.86box/roms\" directory."));
|
||||
#else
|
||||
ui_msgbox_header(MBX_FATAL, VC(L"No ROMs found."), VC(L"86Box could not find any usable ROM images.\n\nPlease <a href='https://github.com/86Box/roms/releases/latest'>download</a> a ROM set and extract it into the \"roms\" directory."));
|
||||
#endif
|
||||
ui_msgbox_header(MBX_FATAL, (void*)IDS_2120, (void*)IDS_2056);
|
||||
return 6;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,6 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
QMainWindow(parent),
|
||||
ui(new Ui::MainWindow)
|
||||
{
|
||||
Q_INIT_RESOURCE(qt_resources);
|
||||
mm = std::make_shared<MediaMenu>(this);
|
||||
MediaMenu::ptr = mm;
|
||||
status = std::make_unique<MachineStatus>(this);
|
||||
|
|
|
@ -36,22 +36,22 @@ void MediaMenu::refresh(QMenu *parentMenu) {
|
|||
|
||||
if(MachineStatus::hasCassette()) {
|
||||
cassetteMenu = parentMenu->addMenu("");
|
||||
cassetteMenu->addAction("New Image", [this]() { cassetteNewImage(); });
|
||||
cassetteMenu->addAction(tr("New Image"), [this]() { cassetteNewImage(); });
|
||||
cassetteMenu->addSeparator();
|
||||
cassetteMenu->addAction("Existing Image", [this]() { cassetteSelectImage(false); });
|
||||
cassetteMenu->addAction("Existing Image (Write Protected)", [this]() { cassetteSelectImage(true); });
|
||||
cassetteMenu->addAction(tr("Existing Image"), [this]() { cassetteSelectImage(false); });
|
||||
cassetteMenu->addAction(tr("Existing Image (Write Protected)"), [this]() { cassetteSelectImage(true); });
|
||||
cassetteMenu->addSeparator();
|
||||
cassetteRecordPos = cassetteMenu->children().count();
|
||||
cassetteMenu->addAction("Record", [this] { pc_cas_set_mode(cassette, 1); cassetteUpdateMenu(); })->setCheckable(true);
|
||||
cassetteMenu->addAction(tr("Record"), [this] { pc_cas_set_mode(cassette, 1); cassetteUpdateMenu(); })->setCheckable(true);
|
||||
cassettePlayPos = cassetteMenu->children().count();
|
||||
cassetteMenu->addAction("Play", [this] { pc_cas_set_mode(cassette, 0); cassetteUpdateMenu(); })->setCheckable(true);
|
||||
cassetteMenu->addAction(tr("Play"), [this] { pc_cas_set_mode(cassette, 0); cassetteUpdateMenu(); })->setCheckable(true);
|
||||
cassetteRewindPos = cassetteMenu->children().count();
|
||||
cassetteMenu->addAction("Rewind", [] { pc_cas_rewind(cassette); });
|
||||
cassetteMenu->addAction(tr("Rewind"), [] { pc_cas_rewind(cassette); });
|
||||
cassetteFastFwdPos = cassetteMenu->children().count();
|
||||
cassetteMenu->addAction("Fast Forward", [] { pc_cas_append(cassette); });
|
||||
cassetteMenu->addAction(tr("Fast Forward"), [] { pc_cas_append(cassette); });
|
||||
cassetteMenu->addSeparator();
|
||||
cassetteEjectPos = cassetteMenu->children().count();
|
||||
cassetteMenu->addAction("Eject", [this]() { cassetteEject(); });
|
||||
cassetteMenu->addAction(tr("Eject"), [this]() { cassetteEject(); });
|
||||
cassetteUpdateMenu();
|
||||
}
|
||||
|
||||
|
@ -59,10 +59,10 @@ void MediaMenu::refresh(QMenu *parentMenu) {
|
|||
if (machine_has_cartridge(machine)) {
|
||||
for(int i = 0; i < 2; i++) {
|
||||
auto* menu = parentMenu->addMenu("");
|
||||
menu->addAction("Image", [this, i]() { cartridgeSelectImage(i); });
|
||||
menu->addAction(tr("Image"), [this, i]() { cartridgeSelectImage(i); });
|
||||
menu->addSeparator();
|
||||
cartridgeEjectPos = menu->children().count();
|
||||
menu->addAction("Eject", [this, i]() { cartridgeEject(i); });
|
||||
menu->addAction(tr("Eject"), [this, i]() { cartridgeEject(i); });
|
||||
cartridgeMenus[i] = menu;
|
||||
cartridgeUpdateMenu(i);
|
||||
}
|
||||
|
@ -71,16 +71,16 @@ void MediaMenu::refresh(QMenu *parentMenu) {
|
|||
floppyMenus.clear();
|
||||
MachineStatus::iterateFDD([this, parentMenu](int i) {
|
||||
auto* menu = parentMenu->addMenu("");
|
||||
menu->addAction("New Image", [this, i]() { floppyNewImage(i); });
|
||||
menu->addAction(tr("New Image"), [this, i]() { floppyNewImage(i); });
|
||||
menu->addSeparator();
|
||||
menu->addAction("Existing Image", [this, i]() { floppySelectImage(i, false); });
|
||||
menu->addAction("Existing Image (Write Protected)", [this, i]() { floppySelectImage(i, true); });
|
||||
menu->addAction(tr("Existing Image"), [this, i]() { floppySelectImage(i, false); });
|
||||
menu->addAction(tr("Existing Image (Write Protected)"), [this, i]() { floppySelectImage(i, true); });
|
||||
menu->addSeparator();
|
||||
floppyExportPos = menu->children().count();
|
||||
menu->addAction("Export to 86F", [this, i]() { floppyExportTo86f(i); });
|
||||
menu->addAction(tr("Export to 86F"), [this, i]() { floppyExportTo86f(i); });
|
||||
menu->addSeparator();
|
||||
floppyEjectPos = menu->children().count();
|
||||
menu->addAction("Eject", [this, i]() { floppyEject(i); });
|
||||
menu->addAction(tr("Eject"), [this, i]() { floppyEject(i); });
|
||||
floppyMenus[i] = menu;
|
||||
floppyUpdateMenu(i);
|
||||
});
|
||||
|
@ -89,15 +89,15 @@ void MediaMenu::refresh(QMenu *parentMenu) {
|
|||
MachineStatus::iterateCDROM([this, parentMenu](int i) {
|
||||
auto* menu = parentMenu->addMenu("");
|
||||
cdromMutePos = menu->children().count();
|
||||
menu->addAction("Mute", [this, i]() { cdromMute(i); })->setCheckable(true);
|
||||
menu->addAction(tr("Mute"), [this, i]() { cdromMute(i); })->setCheckable(true);
|
||||
menu->addSeparator();
|
||||
cdromEmptyPos = menu->children().count();
|
||||
menu->addAction("Empty", [this, i]() { cdromEject(i); })->setCheckable(true);
|
||||
menu->addAction(tr("Empty"), [this, i]() { cdromEject(i); })->setCheckable(true);
|
||||
cdromReloadPos = menu->children().count();
|
||||
menu->addAction("Reload previous image", [this, i]() { cdromReload(i); });
|
||||
menu->addAction(tr("Reload previous image"), [this, i]() { cdromReload(i); });
|
||||
menu->addSeparator();
|
||||
cdromImagePos = menu->children().count();
|
||||
menu->addAction("Image", [this, i]() { cdromMount(i); })->setCheckable(true);
|
||||
menu->addAction(tr("Image"), [this, i]() { cdromMount(i); })->setCheckable(true);
|
||||
cdromMenus[i] = menu;
|
||||
cdromUpdateMenu(i);
|
||||
});
|
||||
|
@ -105,15 +105,15 @@ void MediaMenu::refresh(QMenu *parentMenu) {
|
|||
zipMenus.clear();
|
||||
MachineStatus::iterateZIP([this, parentMenu](int i) {
|
||||
auto* menu = parentMenu->addMenu("");
|
||||
menu->addAction("New Image", [this, i]() { zipNewImage(i); });
|
||||
menu->addAction(tr("New Image"), [this, i]() { zipNewImage(i); });
|
||||
menu->addSeparator();
|
||||
menu->addAction("Existing Image", [this, i]() { zipSelectImage(i, false); });
|
||||
menu->addAction("Existing Image (Write Protected)", [this, i]() { zipSelectImage(i, true); });
|
||||
menu->addAction(tr("Existing Image"), [this, i]() { zipSelectImage(i, false); });
|
||||
menu->addAction(tr("Existing Image (Write Protected)"), [this, i]() { zipSelectImage(i, true); });
|
||||
menu->addSeparator();
|
||||
zipEjectPos = menu->children().count();
|
||||
menu->addAction("Eject", [this, i]() { zipEject(i); });
|
||||
menu->addAction(tr("Eject"), [this, i]() { zipEject(i); });
|
||||
zipReloadPos = menu->children().count();
|
||||
menu->addAction("Reload previous image", [this, i]() { zipReload(i); });
|
||||
menu->addAction(tr("Reload previous image"), [this, i]() { zipReload(i); });
|
||||
zipMenus[i] = menu;
|
||||
zipUpdateMenu(i);
|
||||
});
|
||||
|
@ -121,22 +121,22 @@ void MediaMenu::refresh(QMenu *parentMenu) {
|
|||
moMenus.clear();
|
||||
MachineStatus::iterateMO([this, parentMenu](int i) {
|
||||
auto* menu = parentMenu->addMenu("");
|
||||
menu->addAction("New Image", [this, i]() { moNewImage(i); });
|
||||
menu->addAction(tr("New Image"), [this, i]() { moNewImage(i); });
|
||||
menu->addSeparator();
|
||||
menu->addAction("Existing Image", [this, i]() { moSelectImage(i, false); });
|
||||
menu->addAction("Existing Image (Write Protected)", [this, i]() { moSelectImage(i, true); });
|
||||
menu->addAction(tr("Existing Image"), [this, i]() { moSelectImage(i, false); });
|
||||
menu->addAction(tr("Existing Image (Write Protected)"), [this, i]() { moSelectImage(i, true); });
|
||||
menu->addSeparator();
|
||||
moEjectPos = menu->children().count();
|
||||
menu->addAction("Eject", [this, i]() { moEject(i); });
|
||||
menu->addAction(tr("Eject"), [this, i]() { moEject(i); });
|
||||
moReloadPos = menu->children().count();
|
||||
menu->addAction("Reload previous image", [this, i]() { moReload(i); });
|
||||
menu->addAction(tr("Reload previous image"), [this, i]() { moReload(i); });
|
||||
moMenus[i] = menu;
|
||||
moUpdateMenu(i);
|
||||
});
|
||||
}
|
||||
|
||||
void MediaMenu::cassetteNewImage() {
|
||||
auto filename = QFileDialog::getSaveFileName(parentWidget, "Create...");
|
||||
auto filename = QFileDialog::getSaveFileName(parentWidget, tr("Create..."));
|
||||
QFileInfo fileinfo(filename);
|
||||
if (fileinfo.suffix().isEmpty()) {
|
||||
filename.append(".cas");
|
||||
|
@ -145,7 +145,7 @@ void MediaMenu::cassetteNewImage() {
|
|||
}
|
||||
|
||||
void MediaMenu::cassetteSelectImage(bool wp) {
|
||||
auto filename = QFileDialog::getOpenFileName(parentWidget, "Open", QString(), "Cassette images (*.pcm *.PCM *.raw *.RAW *.wav *.WAV *.cas *.CAS);;All files (*)");
|
||||
auto filename = QFileDialog::getOpenFileName(parentWidget, tr("Open"), QString(), tr("Cassette images (*.pcm *.PCM *.raw *.RAW *.wav *.WAV *.cas *.CAS);;All files (*)"));
|
||||
cassetteMount(filename, wp);
|
||||
}
|
||||
|
||||
|
@ -195,11 +195,11 @@ void MediaMenu::cassetteUpdateMenu() {
|
|||
recordMenu->setChecked(isSaving);
|
||||
playMenu->setChecked(! isSaving);
|
||||
|
||||
cassetteMenu->setTitle(QString("Cassette: %1").arg(name.isEmpty() ? "(empty)" : name));
|
||||
cassetteMenu->setTitle(tr("Cassette: %1").arg(name.isEmpty() ? tr("(empty)") : name));
|
||||
}
|
||||
|
||||
void MediaMenu::cartridgeSelectImage(int i) {
|
||||
auto filename = QFileDialog::getOpenFileName(parentWidget, "Open", QString(), "Cartridge images (*.a *.b *.jrc *.A *.B *.JRC);;All files (*)");
|
||||
auto filename = QFileDialog::getOpenFileName(parentWidget, tr("Open"), QString(), tr("Cartridge images (*.a *.b *.jrc *.A *.B *.JRC);;All files (*)"));
|
||||
if (filename.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
@ -227,7 +227,7 @@ void MediaMenu::cartridgeUpdateMenu(int i) {
|
|||
auto childs = menu->children();
|
||||
auto* ejectMenu = dynamic_cast<QAction*>(childs[cartridgeEjectPos]);
|
||||
ejectMenu->setEnabled(!name.isEmpty());
|
||||
menu->setTitle(QString("Cartridge %1: %2").arg(QString::number(i+1), name.isEmpty() ? "(empty)" : name));
|
||||
menu->setTitle(tr("Cartridge %1: %2").arg(QString::number(i+1), name.isEmpty() ? tr("(empty)") : name));
|
||||
}
|
||||
|
||||
void MediaMenu::floppyNewImage(int i) {
|
||||
|
@ -241,7 +241,7 @@ void MediaMenu::floppyNewImage(int i) {
|
|||
}
|
||||
|
||||
void MediaMenu::floppySelectImage(int i, bool wp) {
|
||||
auto filename = QFileDialog::getOpenFileName(parentWidget, "Open", QString(), "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 (*)");
|
||||
auto filename = QFileDialog::getOpenFileName(parentWidget, "Open", 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);
|
||||
}
|
||||
|
||||
|
@ -267,12 +267,12 @@ void MediaMenu::floppyEject(int i) {
|
|||
}
|
||||
|
||||
void MediaMenu::floppyExportTo86f(int i) {
|
||||
auto filename = QFileDialog::getSaveFileName(parentWidget, "Save as 86f", QString(), "Surface images (*.86f)");
|
||||
auto filename = QFileDialog::getSaveFileName(parentWidget, tr("Save as 86f"), QString(), tr("Surface images (*.86f)"));
|
||||
if (! filename.isEmpty()) {
|
||||
QByteArray filenameBytes = filename.toUtf8();
|
||||
plat_pause(1);
|
||||
if (d86f_export(i, filenameBytes.data()) == 0) {
|
||||
QMessageBox::critical(parentWidget, "Unable to write file", "Make sure the file is being saved to a writable directory");
|
||||
QMessageBox::critical(parentWidget, tr("Unable to write file"), tr("Make sure the file is being saved to a writable directory"));
|
||||
}
|
||||
plat_pause(0);
|
||||
}
|
||||
|
@ -290,7 +290,7 @@ void MediaMenu::floppyUpdateMenu(int i) {
|
|||
exportMenu->setEnabled(!name.isEmpty());
|
||||
|
||||
int type = fdd_get_type(i);
|
||||
floppyMenus[i]->setTitle(QString("Floppy %1 (%2): %3").arg(QString::number(i+1), fdd_getname(type), name.isEmpty() ? "(empty)" : name));
|
||||
floppyMenus[i]->setTitle(tr("Floppy %1 (%2): %3").arg(QString::number(i+1), fdd_getname(type), name.isEmpty() ? tr("(empty)") : name));
|
||||
}
|
||||
|
||||
void MediaMenu::cdromMute(int i) {
|
||||
|
@ -304,7 +304,7 @@ void MediaMenu::cdromMount(int i) {
|
|||
QString dir;
|
||||
QFileInfo fi(cdrom[i].image_path);
|
||||
|
||||
auto filename = QFileDialog::getOpenFileName(parentWidget, "Open", QString(), "CD-ROM images (*.ISO *.CUE *.iso *.cue);;All files (*)");
|
||||
auto filename = QFileDialog::getOpenFileName(parentWidget, tr("Open"), QString(), tr("CD-ROM images (*.ISO *.CUE *.iso *.cue);;All files (*)"));
|
||||
if (filename.isEmpty()) {
|
||||
auto* imageMenu = dynamic_cast<QAction*>(cdromMenus[i]->children()[cdromImagePos]);
|
||||
imageMenu->setChecked(false);
|
||||
|
@ -362,7 +362,7 @@ void MediaMenu::cdromUpdateMenu(int i) {
|
|||
auto* prevMenu = dynamic_cast<QAction*>(childs[cdromReloadPos]);
|
||||
prevMenu->setEnabled(cdrom[i].prev_host_drive != 0);
|
||||
|
||||
QString busName = "Unknown Bus";
|
||||
QString busName = tr("Unknown Bus");
|
||||
switch (cdrom[i].bus_type) {
|
||||
case CDROM_BUS_ATAPI:
|
||||
busName = "ATAPI";
|
||||
|
@ -372,7 +372,7 @@ void MediaMenu::cdromUpdateMenu(int i) {
|
|||
break;
|
||||
}
|
||||
|
||||
menu->setTitle(QString("CD-ROM %1 (%2): %3").arg(QString::number(i+1), busName, name.isEmpty() ? "(empty)" : name));
|
||||
menu->setTitle(tr("CD-ROM %1 (%2): %3").arg(QString::number(i+1), busName, name.isEmpty() ? tr("(empty)") : name));
|
||||
}
|
||||
|
||||
void MediaMenu::zipNewImage(int i) {
|
||||
|
@ -386,7 +386,7 @@ void MediaMenu::zipNewImage(int i) {
|
|||
}
|
||||
|
||||
void MediaMenu::zipSelectImage(int i, bool wp) {
|
||||
auto filename = QFileDialog::getOpenFileName(parentWidget, "Open", QString(), "ZIP images (*.im? *.zdi *.IM? *.ZDI);;All files (*)");
|
||||
auto filename = QFileDialog::getOpenFileName(parentWidget, tr("Open"), QString(), tr("ZIP images (*.im? *.zdi *.IM? *.ZDI);;All files (*)"));
|
||||
zipMount(i, filename, wp);
|
||||
}
|
||||
|
||||
|
@ -450,7 +450,7 @@ void MediaMenu::zipUpdateMenu(int i) {
|
|||
ejectMenu->setEnabled(!name.isEmpty());
|
||||
reloadMenu->setEnabled(!prev_name.isEmpty());
|
||||
|
||||
QString busName = "Unknown Bus";
|
||||
QString busName = tr("Unknown Bus");
|
||||
switch (zip_drives[i].bus_type) {
|
||||
case ZIP_BUS_ATAPI:
|
||||
busName = "ATAPI";
|
||||
|
@ -460,7 +460,7 @@ void MediaMenu::zipUpdateMenu(int i) {
|
|||
break;
|
||||
}
|
||||
|
||||
menu->setTitle(QString("ZIP %1 %2 (%3): %4").arg((zip_drives[i].is_250 > 0) ? "250" : "100", QString::number(i+1), busName, name.isEmpty() ? "(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));
|
||||
}
|
||||
|
||||
void MediaMenu::moNewImage(int i) {
|
||||
|
@ -474,7 +474,7 @@ void MediaMenu::moNewImage(int i) {
|
|||
}
|
||||
|
||||
void MediaMenu::moSelectImage(int i, bool wp) {
|
||||
auto filename = QFileDialog::getOpenFileName(parentWidget, "Open", QString(), "MO images (*.im? *.mdi *.IM? *.MDI);;All files (*)");
|
||||
auto filename = QFileDialog::getOpenFileName(parentWidget, tr("Open"), QString(), tr("MO images (*.im? *.mdi *.IM? *.MDI);;All files (*)"));
|
||||
moMount(i, filename, wp);
|
||||
}
|
||||
|
||||
|
@ -538,7 +538,7 @@ void MediaMenu::moUpdateMenu(int i) {
|
|||
ejectMenu->setEnabled(!name.isEmpty());
|
||||
reloadMenu->setEnabled(!prev_name.isEmpty());
|
||||
|
||||
QString busName = "Unknown Bus";
|
||||
QString busName = tr("Unknown Bus");
|
||||
switch (mo_drives[i].bus_type) {
|
||||
case MO_BUS_ATAPI:
|
||||
busName = "ATAPI";
|
||||
|
@ -548,7 +548,7 @@ void MediaMenu::moUpdateMenu(int i) {
|
|||
break;
|
||||
}
|
||||
|
||||
menu->setTitle(QString("MO %1 (%2): %3").arg(QString::number(i+1), busName, name.isEmpty() ? "(empty)" : name));
|
||||
menu->setTitle(tr("MO %1 (%2): %3").arg(QString::number(i+1), busName, name.isEmpty() ? tr("(empty)") : name));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <thread>
|
||||
#include <memory>
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
|
@ -470,6 +471,52 @@ size_t c16stombs(char dst[], const uint16_t src[], int len)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#define LIB_NAME_FLUIDSYNTH "libfluidsynth.dll"
|
||||
#define MOUSE_CAPTURE_KEYSEQ "F8+F12"
|
||||
#else
|
||||
#define LIB_NAME_FLUIDSYNTH "libfluidsynth"
|
||||
#define MOUSE_CAPTURE_KEYSEQ "CTRL-END"
|
||||
#endif
|
||||
#ifdef Q_OS_MACOS
|
||||
#define ROMDIR "~/Library/Application Support/net.86box.86box/roms"
|
||||
#else
|
||||
#define ROMDIR "roms"
|
||||
#endif
|
||||
|
||||
|
||||
static std::map<int, std::wstring> translatedstrings;
|
||||
|
||||
static void reload_strings()
|
||||
{
|
||||
translatedstrings.clear();
|
||||
translatedstrings[IDS_2077] = QObject::tr("Click to capture mouse.").toStdWString();
|
||||
translatedstrings[IDS_2078] = QObject::tr("Press %1 to release mouse").arg(MOUSE_CAPTURE_KEYSEQ).toStdWString();
|
||||
translatedstrings[IDS_2079] = QObject::tr("Press %1 or middle button to release mouse").arg(MOUSE_CAPTURE_KEYSEQ).toStdWString();
|
||||
translatedstrings[IDS_2080] = QObject::tr("Failed to initialize FluidSynth").toStdWString();
|
||||
translatedstrings[IDS_4099] = QObject::tr("MFM/RLL or ESDI CD-ROM drives never existed").toStdWString();
|
||||
translatedstrings[IDS_2093] = QObject::tr("Failed to set up PCap").toStdWString();
|
||||
translatedstrings[IDS_2094] = QObject::tr("No PCap devices found").toStdWString();
|
||||
translatedstrings[IDS_2110] = QObject::tr("Unable to initialize FreeType").toStdWString();
|
||||
translatedstrings[IDS_2111] = QObject::tr("Unable to initialize SDL, libsdl2 is required").toStdWString();
|
||||
translatedstrings[IDS_2131] = QObject::tr("libfreetype is required for ESC/P printer emulation.").toStdWString();
|
||||
translatedstrings[IDS_2132] = QObject::tr("libgs is required for automatic conversion of PostScript files to PDF.\n\nAny documents sent to the generic PostScript printer will be saved as PostScript (.ps) files.").toStdWString();
|
||||
translatedstrings[IDS_2133] = QObject::tr("%1 is required for FluidSynth MIDI output.").arg(LIB_NAME_FLUIDSYNTH).toStdWString();
|
||||
translatedstrings[IDS_2129] = QObject::tr("Make sure libpcap is installed and that you are on a libpcap-compatible network connection.").toStdWString();
|
||||
translatedstrings[IDS_2114] = QObject::tr("Unable to initialize Ghostscript").toStdWString();
|
||||
translatedstrings[IDS_2063] = QObject::tr("Machine \"%hs\" is not available due to missing ROMs in the roms/machines directory. Switching to an available machine.").toStdWString();
|
||||
translatedstrings[IDS_2064] = QObject::tr("Video card \"%hs\" is not available due to missing ROMs in the roms/video directory. Switching to an available video card.").toStdWString();
|
||||
translatedstrings[IDS_2128] = QObject::tr("Hardware not available").toStdWString();
|
||||
translatedstrings[IDS_2120] = QObject::tr("No ROMs found.").toStdWString();
|
||||
translatedstrings[IDS_2056] = QObject::tr("86Box could not find any usable ROM images.\n\nPlease <a href='https://github.com/86Box/roms/releases/latest'>download</a> a ROM set and extract it into the \"%1\" directory.").arg(ROMDIR).toStdWString();
|
||||
}
|
||||
|
||||
wchar_t* plat_get_string(int i)
|
||||
{
|
||||
if (translatedstrings.empty()) reload_strings();
|
||||
return translatedstrings[i].data();
|
||||
}
|
||||
|
||||
int
|
||||
plat_chdir(char *path)
|
||||
{
|
||||
|
|
21
src/qt/qt_translations.qrc
Normal file
21
src/qt/qt_translations.qrc
Normal file
|
@ -0,0 +1,21 @@
|
|||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>86box_de.qm</file>
|
||||
<file>86box_en-GB.qm</file>
|
||||
<file>86box_en.qm</file>
|
||||
<file>86box_es.qm</file>
|
||||
<file>86box_fi.qm</file>
|
||||
<file>86box_fr.qm</file>
|
||||
<file>86box_hr.qm</file>
|
||||
<file>86box_hu.qm</file>
|
||||
<file>86box_it.qm</file>
|
||||
<file>86box_ja.qm</file>
|
||||
<file>86box_ko.qm</file>
|
||||
<file>86box_pt-BR.qm</file>
|
||||
<file>86box_pt-PT.qm</file>
|
||||
<file>86box_ru.qm</file>
|
||||
<file>86box_sl.qm</file>
|
||||
<file>86box_tr.qm</file>
|
||||
<file>86box_zh.qm</file>
|
||||
</qresource>
|
||||
</RCC>
|
|
@ -10,6 +10,7 @@
|
|||
"openal-soft",
|
||||
"sdl2",
|
||||
"rtmidi",
|
||||
"qt5-base"
|
||||
"qt5-base",
|
||||
"qt5-translations",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue