mirror of
https://github.com/GerbilSoft/rom-properties.git
synced 2025-06-18 11:35:38 -04:00
[kde,win32] Add QString/tstring macros for localization.
This merely reduces e.g. U82Q(C_(blah)) to QC_(blah) and doesn't affect other functionality. FIXME: MinGW-w64 11.0.0's headers declare _swprintf_p(), but the import libraries don't have a definition, so we can't use it. [win32] CacheTab: Use _sntprintf() and TCHAR buffers with TC_() instead of converting after snprintf(). [win32] KeyManagerTabPrivate::importKeysFromBin(): - Fold the tpgettext_expr() calls into the LibWin32UI::getOpenFileName() call so we don't need to store temporary variables.
This commit is contained in:
parent
6e5d5232fc
commit
1ff728e22d
@ -187,7 +187,7 @@ int AchQtDBus::notifyFunc(Achievements::ID id)
|
||||
hints.insert(QLatin1String("icon_data"), var);
|
||||
}
|
||||
|
||||
const QString qs_summary = U82Q(C_("Achievements", "Achievement Unlocked"));
|
||||
const QString qs_summary = QC_("Achievements", "Achievement Unlocked");
|
||||
iface.Notify(
|
||||
QLatin1String("rom-properties"), // app-name [s]
|
||||
0, // replaces_id [u]
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ROM Properties Page shell extension. (KDE4/KF5) *
|
||||
* ListDataModel.cpp: QAbstractListModel for RFT_LISTDATA. *
|
||||
* *
|
||||
* Copyright (c) 2012-2023 by David Korth. *
|
||||
* Copyright (c) 2012-2024 by David Korth. *
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later *
|
||||
***************************************************************************/
|
||||
|
||||
@ -234,7 +234,7 @@ vector<QString> ListDataModelPrivate::convertListDataToVector(const RomFields::L
|
||||
if (likely(!str.isEmpty())) {
|
||||
data.emplace_back(std::move(str));
|
||||
} else {
|
||||
data.emplace_back(U82Q(C_("RomData", "Unknown")));
|
||||
data.emplace_back(QC_("RomData", "Unknown"));
|
||||
}
|
||||
} else {
|
||||
data.emplace_back(U82Q(u8_str));
|
||||
|
@ -37,7 +37,7 @@ OptionsMenuButton::OptionsMenuButton(QWidget *parent)
|
||||
, romOps_firstActionIndex(-1)
|
||||
{
|
||||
// tr: "Options" button.
|
||||
const QString s_options = U82Q(C_("OptionsMenuButton", "&Options"));
|
||||
const QString s_options = QC_("OptionsMenuButton", "&Options");
|
||||
this->setText(s_options);
|
||||
|
||||
// Create the menu.
|
||||
@ -67,7 +67,7 @@ void OptionsMenuButton::reinitMenu(const LibRpBase::RomData *romData)
|
||||
// Add the standard actions.
|
||||
for (const option_menu_action_t &p : stdacts) {
|
||||
QAction *const action = menuOptions->addAction(
|
||||
U82Q(pgettext_expr("OptionsMenuButton", p.desc)));
|
||||
qpgettext_expr("OptionsMenuButton", p.desc));
|
||||
#ifdef RP_OMB_USE_LAMBDA_FUNCTIONS
|
||||
// Qt5: Use a lambda function.
|
||||
const int id = p.id; // only capture id, not the whole reference
|
||||
|
@ -688,7 +688,7 @@ QLabel *RomDataViewPrivate::initDateTime(QLabel *lblDesc,
|
||||
// Date/Time
|
||||
if (field.data.date_time == -1) {
|
||||
// tr: Invalid date/time
|
||||
return initString(lblDesc, field, U82Q(C_("RomDataView", "Unknown")));
|
||||
return initString(lblDesc, field, QC_("RomDataView", "Unknown"));
|
||||
}
|
||||
|
||||
QString str = formatDateTime(field.data.date_time, field.flags);
|
||||
@ -717,7 +717,7 @@ QLabel *RomDataViewPrivate::initAgeRatings(QLabel *lblDesc,
|
||||
// Convert the age ratings field to a string.
|
||||
const QString str = (age_ratings
|
||||
? U82Q(RomFields::ageRatingsDecode(age_ratings))
|
||||
: U82Q(C_("RomDataView", "ERROR")));
|
||||
: QC_("RomDataView", "ERROR"));
|
||||
return initString(lblDesc, field, str);
|
||||
}
|
||||
|
||||
|
@ -52,6 +52,17 @@ static inline QString U82Q(const char *str, int len = -1)
|
||||
return QString::fromUtf8(str, len);
|
||||
}
|
||||
|
||||
// Helper macro for using C_() with U82Q().
|
||||
// NOTE: Must include i18n.h before using this macro!
|
||||
#define Q_(msgid) U82Q(_(msgid))
|
||||
#define QC_(msgctxt, msgid) U82Q(C_(msgctxt, msgid))
|
||||
#define QN_(msgid1, msgid2, n) U82Q(N_(msgid1, msgid2, n))
|
||||
#define QNC_(msgctxt, msgid1, msgid2, n) U82Q(NC_(msgctxt, msgid1, msgid2, n))
|
||||
#define qpgettext_expr(msgctxt, msgid) U82Q(pgettext_expr(msgctxt, msgid))
|
||||
#define qdpgettext_expr(domain, msgctxt, msgid) U82Q(dpgettext_expr(domain, msgctxt, msgid))
|
||||
#define qnpgettext_expr(msgctxt, msgid1, msgid2, n) U82Q(npgettext_expr(msgctxt, msgid1, msgid2, n))
|
||||
#define qdnpgettext_expr(domain, msgctxt, msgid1, msgid2, n) U82Q(dnpgettext_expr(domain, msgctxt, msgid1, msgid2, n))
|
||||
|
||||
/**
|
||||
* Get const char* from QString.
|
||||
* NOTE: This is temporary; assign to an std::string immediately.
|
||||
|
@ -580,7 +580,7 @@ void AboutTabPrivate::checkForUpdates(void)
|
||||
Q_Q(AboutTab);
|
||||
|
||||
// Run the update check thread.
|
||||
ui.lblUpdateCheck->setText(U82Q(C_("AboutTab", "Checking for updates...")));
|
||||
ui.lblUpdateCheck->setText(QC_("AboutTab", "Checking for updates..."));
|
||||
thrUpdate.start();
|
||||
}
|
||||
|
||||
@ -648,7 +648,7 @@ void AboutTab::updChecker_error(const QString &error)
|
||||
Q_D(AboutTab);
|
||||
|
||||
// tr: Error message template. (Qt version, with formatting)
|
||||
const QString errTemplate = U82Q(C_("ConfigDialog", "<b>ERROR:</b> %1"));
|
||||
const QString errTemplate = QC_("ConfigDialog", "<b>ERROR:</b> %1");
|
||||
d->ui.lblUpdateCheck->setText(errTemplate.arg(error));
|
||||
}
|
||||
|
||||
|
@ -141,13 +141,13 @@ void CacheTabPrivate::clearCacheDir(CacheCleaner::CacheDir cacheDir)
|
||||
switch (cacheDir) {
|
||||
default:
|
||||
assert(!"Invalid cache directory specified.");
|
||||
q->ccCleaner_error(U82Q(C_("CacheTab", "Invalid cache directory specified.")));
|
||||
q->ccCleaner_error(QC_("CacheTab", "Invalid cache directory specified."));
|
||||
return;
|
||||
case CacheCleaner::CD_System:
|
||||
s_label = U82Q(C_("CacheTab", "Clearing the system thumbnail cache..."));
|
||||
s_label = QC_("CacheTab", "Clearing the system thumbnail cache...");
|
||||
break;
|
||||
case CacheCleaner::CD_RomProperties:
|
||||
s_label = U82Q(C_("CacheTab", "Clearing the ROM Properties Page cache..."));
|
||||
s_label = QC_("CacheTab", "Clearing the ROM Properties Page cache...");
|
||||
break;
|
||||
}
|
||||
ui.lblStatus->setText(s_label);
|
||||
@ -252,7 +252,7 @@ void CacheTab::ccCleaner_error(const QString &error)
|
||||
d->ui.pbStatus->setValue(1);
|
||||
d->ui.pbStatus->setError(true);
|
||||
// tr: Error message template. (Qt version, with formatting)
|
||||
const QString qs_msg = U82Q(C_("ConfigDialog", "<b>ERROR:</b> %1")).arg(error);
|
||||
const QString qs_msg = QC_("ConfigDialog", "<b>ERROR:</b> %1").arg(error);
|
||||
d->ui.lblStatus->setText(qs_msg);
|
||||
MessageSound::play(QMessageBox::Warning, qs_msg, this);
|
||||
}
|
||||
@ -267,13 +267,13 @@ void CacheTab::ccCleaner_cacheIsEmpty(CacheCleaner::CacheDir cacheDir)
|
||||
switch (cacheDir) {
|
||||
default:
|
||||
assert(!"Invalid cache directory specified.");
|
||||
qs_msg = U82Q(C_("CacheTab", "Invalid cache directory specified."));
|
||||
qs_msg = QC_("CacheTab", "Invalid cache directory specified.");
|
||||
break;
|
||||
case CacheCleaner::CD_System:
|
||||
qs_msg = U82Q(C_("CacheTab", "System thumbnail cache is empty. Nothing to do."));
|
||||
qs_msg = QC_("CacheTab", "System thumbnail cache is empty. Nothing to do.");
|
||||
break;
|
||||
case CacheCleaner::CD_RomProperties:
|
||||
qs_msg = U82Q(C_("CacheTab", "rom-properties cache is empty. Nothing to do."));
|
||||
qs_msg = QC_("CacheTab", "rom-properties cache is empty. Nothing to do.");
|
||||
break;
|
||||
}
|
||||
|
||||
@ -296,8 +296,8 @@ void CacheTab::ccCleaner_cacheCleared(CacheCleaner::CacheDir cacheDir, unsigned
|
||||
|
||||
if (dirErrs > 0 || fileErrs > 0) {
|
||||
// tr: Error message template. (Qt version, with formatting)
|
||||
const QString qs_msg = U82Q(C_("ConfigDialog", "<b>ERROR:</b> %1")).arg(
|
||||
U82Q(rp_sprintf_p(C_("CacheTab", "Unable to delete %1$u file(s) and/or %2$u dir(s)."),
|
||||
const QString qs_msg = QC_("ConfigDialog", "<b>ERROR:</b> %1")
|
||||
.arg(U82Q(rp_sprintf_p(C_("CacheTab", "Unable to delete %1$u file(s) and/or %2$u dir(s)."),
|
||||
fileErrs, dirErrs)));
|
||||
d->ui.lblStatus->setText(qs_msg);
|
||||
MessageSound::play(QMessageBox::Warning, qs_msg, this);
|
||||
@ -309,15 +309,15 @@ void CacheTab::ccCleaner_cacheCleared(CacheCleaner::CacheDir cacheDir, unsigned
|
||||
switch (cacheDir) {
|
||||
default:
|
||||
assert(!"Invalid cache directory specified.");
|
||||
qs_msg = U82Q(C_("CacheTab", "Invalid cache directory specified."));
|
||||
qs_msg = QC_("CacheTab", "Invalid cache directory specified.");
|
||||
icon = QMessageBox::Warning;
|
||||
break;
|
||||
case CacheCleaner::CD_System:
|
||||
qs_msg = U82Q(C_("CacheTab", "System thumbnail cache cleared successfully."));
|
||||
qs_msg = QC_("CacheTab", "System thumbnail cache cleared successfully.");
|
||||
icon = QMessageBox::Information;
|
||||
break;
|
||||
case CacheCleaner::CD_RomProperties:
|
||||
qs_msg = U82Q(C_("CacheTab", "rom-properties cache cleared successfully."));
|
||||
qs_msg = QC_("CacheTab", "rom-properties cache cleared successfully.");
|
||||
icon = QMessageBox::Information;
|
||||
break;
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ROM Properties Page shell extension. (KDE) *
|
||||
* ConfigDialog.cpp: Configuration dialog. *
|
||||
* *
|
||||
* Copyright (c) 2016-2023 by David Korth. *
|
||||
* Copyright (c) 2016-2024 by David Korth. *
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later *
|
||||
***************************************************************************/
|
||||
|
||||
@ -76,7 +76,7 @@ ConfigDialogPrivate::ConfigDialogPrivate(ConfigDialog* q)
|
||||
void ConfigDialogPrivate::retranslateUi_nonDesigner(void)
|
||||
{
|
||||
ui.tabWidget->setTabText(ui.tabWidget->indexOf(tabKeyManager),
|
||||
U82Q(C_("ConfigDialog", "&Key Manager")));
|
||||
QC_("ConfigDialog", "&Key Manager"));
|
||||
}
|
||||
#endif /* ENABLE_DECRYPTION */
|
||||
|
||||
|
@ -245,7 +245,7 @@ void ImageTypesTabPrivate::addComboBoxStrings(unsigned int cbid, int max_prio)
|
||||
assert(max_prio <= static_cast<int>(ImageTypesConfig::imageTypeCount()));
|
||||
const bool blockCbo = cbo->blockSignals(true);
|
||||
// tr: Don't use this image type for this particular system.
|
||||
cbo->addItem(U82Q(C_("ImageTypesTab|Values", "No")));
|
||||
cbo->addItem(QC_("ImageTypesTab|Values", "No"));
|
||||
for (int i = 1; i <= max_prio; i++) {
|
||||
cbo->addItem(QString::number(i));
|
||||
}
|
||||
@ -353,14 +353,12 @@ void ImageTypesTabPrivate::cboImageType_setPriorityValue(unsigned int cbid, unsi
|
||||
*/
|
||||
void ImageTypesTabPrivate::initStrings(void)
|
||||
{
|
||||
QString sCredits = U82Q(
|
||||
// tr: External image credits.
|
||||
C_("ImageTypesTab",
|
||||
"GameCube, Wii, Wii U, Nintendo DS, and Nintendo 3DS external images\n"
|
||||
"are provided by <a href=\"https://www.gametdb.com/\">GameTDB</a>.\n"
|
||||
"amiibo images are provided by <a href=\"https://amiibo.life/\">amiibo.life</a>,"
|
||||
" the Unofficial amiibo Database.")
|
||||
);
|
||||
// tr: External image credits.
|
||||
QString sCredits = QC_("ImageTypesTab",
|
||||
"GameCube, Wii, Wii U, Nintendo DS, and Nintendo 3DS external images\n"
|
||||
"are provided by <a href=\"https://www.gametdb.com/\">GameTDB</a>.\n"
|
||||
"amiibo images are provided by <a href=\"https://amiibo.life/\">amiibo.life</a>,"
|
||||
" the Unofficial amiibo Database.");
|
||||
|
||||
// Replace "\n" with "<br/>".
|
||||
sCredits.replace(QChar(L'\n'), QLatin1String("<br/>"));
|
||||
|
@ -323,7 +323,7 @@ KeyManagerTab::KeyManagerTab(QWidget *parent)
|
||||
d->ui.treeKeyStore->setItemDelegate(new KeyStoreItemDelegate(this));
|
||||
|
||||
// Create the dropdown menu for the "Import" button.
|
||||
QMenu *const menuImport = new QMenu(U82Q(C_("KeyManagerTab", "I&mport")), d->ui.btnImport);
|
||||
QMenu *const menuImport = new QMenu(QC_("KeyManagerTab", "I&mport"), d->ui.btnImport);
|
||||
menuImport->setObjectName(QLatin1String("menuImport"));
|
||||
menuImport->addAction(d->ui.actionImportWiiKeysBin);
|
||||
menuImport->addAction(d->ui.actionImportWiiUOtpBin);
|
||||
@ -449,7 +449,7 @@ void KeyManagerTab::on_actionImportWiiKeysBin_triggered(void)
|
||||
Q_D(KeyManagerTab);
|
||||
const QString filename = QFileDialog::getOpenFileName(this,
|
||||
// tr: Wii keys.bin dialog title
|
||||
U82Q(C_("KeyManagerTab", "Select Wii keys.bin File")),
|
||||
QC_("KeyManagerTab", "Select Wii keys.bin File"),
|
||||
d->keyFileDir, // dir
|
||||
// tr: Wii keys.bin file filter (RP format)
|
||||
rpFileDialogFilterToQt(
|
||||
@ -471,7 +471,7 @@ void KeyManagerTab::on_actionImportWiiUOtpBin_triggered(void)
|
||||
Q_D(KeyManagerTab);
|
||||
const QString filename = QFileDialog::getOpenFileName(this,
|
||||
// tr: Wii U otp.bin dialog title
|
||||
U82Q(C_("KeyManagerTab", "Select Wii U otp.bin File")),
|
||||
QC_("KeyManagerTab", "Select Wii U otp.bin File"),
|
||||
d->keyFileDir, // dir
|
||||
// tr: Wii U otp.bin file filter (RP format)
|
||||
rpFileDialogFilterToQt(
|
||||
@ -493,7 +493,7 @@ void KeyManagerTab::on_actionImport3DSboot9bin_triggered(void)
|
||||
Q_D(KeyManagerTab);
|
||||
const QString filename = QFileDialog::getOpenFileName(this,
|
||||
// tr: Nintendo 3DS boot9.bin dialog title
|
||||
U82Q(C_("KeyManagerTab", "Select 3DS boot9.bin File")),
|
||||
QC_("KeyManagerTab", "Select 3DS boot9.bin File"),
|
||||
d->keyFileDir, // dir
|
||||
// tr: Nintendo 3DS boot9.bin file filter (RP format)
|
||||
rpFileDialogFilterToQt(
|
||||
@ -515,7 +515,7 @@ void KeyManagerTab::on_actionImport3DSaeskeydb_triggered(void)
|
||||
Q_D(KeyManagerTab);
|
||||
const QString filename = QFileDialog::getOpenFileName(this,
|
||||
// tr: Nintendo 3DS aeskeydb.bin dialog title
|
||||
U82Q(C_("KeyManagerTab", "Select 3DS aeskeydb.bin File")),
|
||||
QC_("KeyManagerTab", "Select 3DS aeskeydb.bin File"),
|
||||
d->keyFileDir, // dir
|
||||
// tr: Nintendo 3DS aeskeydb.bin file filter (RP format)
|
||||
rpFileDialogFilterToQt(
|
||||
|
@ -92,11 +92,11 @@ KeyStoreModelPrivate::KeyStoreModelPrivate(KeyStoreModel *q)
|
||||
// Translate and cache the column names.
|
||||
|
||||
// tr: Column 0: Key Name.
|
||||
columnNames[0] = U82Q(C_("KeyManagerTab", "Key Name"));
|
||||
columnNames[0] = QC_("KeyManagerTab", "Key Name");
|
||||
// tr: Column 1: Value.
|
||||
columnNames[1] = U82Q(C_("KeyManagerTab", "Value"));
|
||||
columnNames[1] = QC_("KeyManagerTab", "Value");
|
||||
// tr: Column 2: Verification status.
|
||||
columnNames[2] = U82Q(C_("KeyManagerTab", "Valid?"));
|
||||
columnNames[2] = QC_("KeyManagerTab", "Valid?");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ROM Properties Page shell extension. (KDE) *
|
||||
* UpdateChecker.hpp: Update checker object for AboutTab. *
|
||||
* *
|
||||
* Copyright (c) 2016-2023 by David Korth. *
|
||||
* Copyright (c) 2016-2024 by David Korth. *
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later *
|
||||
***************************************************************************/
|
||||
|
||||
@ -57,7 +57,7 @@ void UpdateChecker::run(void)
|
||||
const string cache_filename = cache.download(updateVersionCacheKey);
|
||||
if (cache_filename.empty()) {
|
||||
// Unable to download the version file.
|
||||
emit error(U82Q(C_("UpdateChecker", "Failed to download version file.")));
|
||||
emit error(QC_("UpdateChecker", "Failed to download version file."));
|
||||
emit finished();
|
||||
return;
|
||||
}
|
||||
@ -66,7 +66,7 @@ void UpdateChecker::run(void)
|
||||
QFile file(U82Q(cache_filename));
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
// TODO: Error code?
|
||||
emit error(U82Q(C_("UpdateChecker", "Failed to open version file.")));
|
||||
emit error(QC_("UpdateChecker", "Failed to open version file."));
|
||||
emit finished();
|
||||
return;
|
||||
}
|
||||
@ -75,7 +75,7 @@ void UpdateChecker::run(void)
|
||||
const QString sVersion = U82Q(file.readLine().constData()).trimmed();
|
||||
const QStringList sVersionArray = sVersion.split(QChar(L'.'));
|
||||
if (sVersion.isEmpty() || sVersionArray.size() != 4) {
|
||||
emit error(U82Q(C_("UpdateChecker", "Version file is invalid.")));
|
||||
emit error(QC_("UpdateChecker", "Version file is invalid."));
|
||||
emit finished();
|
||||
return;
|
||||
}
|
||||
@ -86,7 +86,7 @@ void UpdateChecker::run(void)
|
||||
for (unsigned int i = 0; i < 3; i++, updateVersion <<= 16U) {
|
||||
const int x = sVersionArray[i].toInt(&ok);
|
||||
if (!ok || x < 0) {
|
||||
emit error(U82Q(C_("UpdateChecker", "Version file is invalid.")));
|
||||
emit error(QC_("UpdateChecker", "Version file is invalid."));
|
||||
emit finished();
|
||||
return;
|
||||
}
|
||||
|
@ -125,8 +125,7 @@ void ExtractorPlugin::extract_properties(KFileMetaData::ExtractionResult *result
|
||||
|
||||
const string *str = prop.data.str;
|
||||
if (str) {
|
||||
result->add(static_cast<KFileMetaData::Property::Property>(prop_name),
|
||||
QString::fromUtf8(str->data(), static_cast<int>(str->size())));
|
||||
result->add(static_cast<KFileMetaData::Property::Property>(prop_name), U82Q(*str));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -121,6 +121,6 @@ RomPropertiesDialogPlugin::RomPropertiesDialogPlugin(QObject *parent, const QVar
|
||||
RomDataView *const romDataView = createRomDataView(fileItem, props);
|
||||
if (romDataView) {
|
||||
// tr: RomDataView tab title
|
||||
props->addPage(romDataView, U82Q(C_("RomDataView", "ROM Properties")));
|
||||
props->addPage(romDataView, QC_("RomDataView", "ROM Properties"));
|
||||
}
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ void Ext2AttrViewPrivate::retranslateUi_nonDesigner(void)
|
||||
pgettext_expr("Ext2AttrView", p->label));
|
||||
|
||||
checkBoxes[i]->setText(U82Q(buf));
|
||||
checkBoxes[i]->setToolTip(U82Q(pgettext_expr("Ext2AttrView", p->tooltip)));
|
||||
checkBoxes[i]->setToolTip(qpgettext_expr("Ext2AttrView", p->tooltip));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -181,10 +181,10 @@ int XAttrViewPrivate::loadPosixXattrs(void)
|
||||
const XAttrReader::XAttrList &xattrList = xattrReader->genericXAttrs();
|
||||
for (const auto &xattr : xattrList) {
|
||||
QTreeWidgetItem *const treeWidgetItem = new QTreeWidgetItem(ui.treeXAttr);
|
||||
treeWidgetItem->setData(0, Qt::DisplayRole, QString::fromUtf8(xattr.first.c_str(), xattr.first.size()));
|
||||
treeWidgetItem->setData(0, Qt::DisplayRole, U82Q(xattr.first));
|
||||
// NOTE: Trimming leading and trailing spaces from the value.
|
||||
// TODO: If copy is added, include the spaces.
|
||||
treeWidgetItem->setData(1, Qt::DisplayRole, QString::fromUtf8(xattr.second.c_str(), xattr.second.size()).trimmed());
|
||||
treeWidgetItem->setData(1, Qt::DisplayRole, U82Q(xattr.second).trimmed());
|
||||
}
|
||||
|
||||
// Set column stretch modes.
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ROM Properties Page shell extension. (KDE4/KF5) *
|
||||
* XAttrViewPropertiesDialogPlugin.cpp: KPropertiesDialogPlugin implementation *
|
||||
* *
|
||||
* Copyright (c) 2016-2023 by David Korth. *
|
||||
* Copyright (c) 2016-2024 by David Korth. *
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later *
|
||||
*******************************************************************************/
|
||||
|
||||
@ -80,6 +80,6 @@ XAttrViewPropertiesDialogPlugin::XAttrViewPropertiesDialogPlugin(QObject *parent
|
||||
XAttrView *const xattrView = createXAttrView(fileItem, props);
|
||||
if (xattrView) {
|
||||
// tr: XAttrView tab title
|
||||
props->addPage(xattrView, U82Q(C_("XAttrView", "xattrs")));
|
||||
props->addPage(xattrView, QC_("XAttrView", "xattrs"));
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/***************************************************************************
|
||||
* ROM Properties Page shell extension. (KDE4/KF5) *
|
||||
* XfsAttrView.cpp: XFS file system attribute viewer widget. *
|
||||
* XfsAttrView.cpp: XFS file system attribute viewer widget. *
|
||||
* *
|
||||
* Copyright (c) 2022-2024 by David Korth. *
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later *
|
||||
@ -72,8 +72,8 @@ void XfsAttrViewPrivate::retranslateUi_nonDesigner(void)
|
||||
{
|
||||
for (size_t i = 0; i < checkBoxes.size(); i++) {
|
||||
const XfsAttrCheckboxInfo_t *const p = xfsAttrCheckboxInfo(static_cast<XfsAttrCheckboxID>(i));
|
||||
checkBoxes[i]->setText(U82Q(pgettext_expr("XfsAttrView", p->label)));
|
||||
checkBoxes[i]->setToolTip(U82Q(pgettext_expr("XfsAttrView", p->tooltip)));
|
||||
checkBoxes[i]->setText(qpgettext_expr("XfsAttrView", p->label));
|
||||
checkBoxes[i]->setToolTip(qpgettext_expr("XfsAttrView", p->tooltip));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
* wchar.hpp: wchar_t text conversion macros *
|
||||
* Generally only used on Windows. *
|
||||
* *
|
||||
* Copyright (c) 2009-2023 by David Korth. *
|
||||
* Copyright (c) 2009-2024 by David Korth. *
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later *
|
||||
***************************************************************************/
|
||||
|
||||
@ -218,4 +218,16 @@ static inline std::string T2U8(const std::tstring &tcs)
|
||||
}
|
||||
|
||||
#endif /* UNICODE */
|
||||
|
||||
// Helper macro for using C_() with U82T_c().
|
||||
// NOTE: Must include i18n.h before using this macro!
|
||||
#define T_(msgid) U82T_c(_(msgid))
|
||||
#define TC_(msgctxt, msgid) U82T_c(C_(msgctxt, msgid))
|
||||
#define TN_(msgid1, msgid2, n) U82T_c(N_(msgid1, msgid2, n))
|
||||
#define TNC_(msgctxt, msgid1, msgid2, n) U82T_c(NC_(msgctxt, msgid1, msgid2, n))
|
||||
#define tpgettext_expr(msgctxt, msgid) U82T_c(pgettext_expr(msgctxt, msgid))
|
||||
#define tdpgettext_expr(domain, msgctxt, msgid) U82T_c(dpgettext_expr(domain, msgctxt, msgid))
|
||||
#define tnpgettext_expr(msgctxt, msgid1, msgid2, n) U82T_c(npgettext_expr(msgctxt, msgid1, msgid2, n))
|
||||
#define tdnpgettext_expr(domain, msgctxt, msgid1, msgid2, n) U82T_c(dnpgettext_expr(domain, msgctxt, msgid1, msgid2, n))
|
||||
|
||||
#endif /* _WIN32 */
|
||||
|
@ -286,7 +286,7 @@ int AchWin32Private::notifyFunc(Achievements::ID id)
|
||||
}
|
||||
nid.hBalloonIcon = hBalloonIcon;
|
||||
|
||||
const tstring ts_summary = U82T_c(C_("Achievements", "Achievement Unlocked"));
|
||||
const tstring ts_summary = TC_("Achievements", "Achievement Unlocked");
|
||||
_tcsncpy(nid.szInfoTitle, ts_summary.c_str(), _countof(nid.szInfoTitle));
|
||||
nid.szInfoTitle[_countof(nid.szInfoTitle)-1] = _T('\0');
|
||||
|
||||
|
@ -91,7 +91,7 @@ OptionsMenuButtonPrivate::OptionsMenuButtonPrivate(HWND hWnd)
|
||||
SetWindowLong(hWnd, GWL_STYLE, lStyle);
|
||||
|
||||
// tr: "Options" button.
|
||||
SetWindowText(hWnd, U82T_c(C_("OptionsMenuButton", "&Options")));
|
||||
SetWindowText(hWnd, TC_("OptionsMenuButton", "&Options"));
|
||||
|
||||
// Button split.
|
||||
BUTTON_SPLITINFO bsi;
|
||||
@ -104,7 +104,7 @@ OptionsMenuButtonPrivate::OptionsMenuButtonPrivate(HWND hWnd)
|
||||
// Maybe we *should* use ownerdraw...
|
||||
|
||||
// tr: "Options" button. (WinXP version, with ellipsis.)
|
||||
SetWindowText(hWnd, U82T_c(C_("OptionsMenuButton", "&Options...")));
|
||||
SetWindowText(hWnd, TC_("OptionsMenuButton", "&Options..."));
|
||||
}
|
||||
}
|
||||
|
||||
@ -134,7 +134,7 @@ void OptionsMenuButtonPrivate::reinitMenu(const RomData *romData)
|
||||
// Add the standard actions.
|
||||
for (const option_menu_action_t &p : stdacts) {
|
||||
AppendMenu(hMenuOptions, MF_STRING, IDM_OPTIONS_MENU_BASE + p.id,
|
||||
U82T_c(pgettext_expr("RomDataView|Options", p.desc)));
|
||||
tpgettext_expr("RomDataView|Options", p.desc));
|
||||
}
|
||||
|
||||
/** ROM operations. **/
|
||||
|
@ -479,7 +479,7 @@ IFACEMETHODIMP RP_ContextMenu::QueryContextMenu(_In_ HMENU hMenu, _In_ UINT inde
|
||||
HBITMAP hbmPng = d->getPngIcon();
|
||||
|
||||
// Menu item text
|
||||
const tstring ts_text = U82T_c(C_("ServiceMenu", "Convert to PNG"));
|
||||
const tstring ts_text = TC_("ServiceMenu", "Convert to PNG");
|
||||
|
||||
// Add "Convert to PNG".
|
||||
// TODO: Verify that it can be converted to PNG first.
|
||||
|
@ -1007,7 +1007,7 @@ int RP_ShellPropSheetExt_Private::initListData(_In_ HWND hWndTab,
|
||||
tstr = formatDateTime(time_string.time,
|
||||
listDataDesc.col_attrs.dtflags);
|
||||
if (unlikely(tstr.empty())) {
|
||||
tstr = U82T_c(C_("RomData", "Unknown"));
|
||||
tstr = TC_("RomData", "Unknown");
|
||||
}
|
||||
} else {
|
||||
tstr = U82T_s(data_str);
|
||||
@ -1278,7 +1278,7 @@ int RP_ShellPropSheetExt_Private::initDateTime(_In_ HWND hWndTab,
|
||||
if (field.data.date_time == -1) {
|
||||
// Invalid date/time.
|
||||
return initString(hWndTab, pt_start, size, field, fieldIdx,
|
||||
U82T_c(C_("RomDataView", "Unknown")));
|
||||
TC_("RomDataView", "Unknown"));
|
||||
}
|
||||
|
||||
// Format the date/time.
|
||||
@ -1286,7 +1286,7 @@ int RP_ShellPropSheetExt_Private::initDateTime(_In_ HWND hWndTab,
|
||||
|
||||
// Initialize the string.
|
||||
return initString(hWndTab, pt_start, size, field, fieldIdx,
|
||||
(likely(!dateTimeStr.empty()) ? dateTimeStr.c_str() : U82T_c(C_("RomDataView", "Unknown"))));
|
||||
(likely(!dateTimeStr.empty()) ? dateTimeStr.c_str() : TC_("RomDataView", "Unknown")));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1308,7 +1308,7 @@ int RP_ShellPropSheetExt_Private::initAgeRatings(_In_ HWND hWndTab,
|
||||
if (!age_ratings) {
|
||||
// No age ratings data.
|
||||
return initString(hWndTab, pt_start, size, field, fieldIdx,
|
||||
U82T_c(C_("RomDataView", "ERROR")));
|
||||
TC_("RomDataView", "ERROR"));
|
||||
}
|
||||
|
||||
// Convert the age ratings field to a string.
|
||||
@ -1508,7 +1508,7 @@ void RP_ShellPropSheetExt_Private::updateMulti(uint32_t user_lc)
|
||||
tstr = formatDateTime(time_string.time,
|
||||
listDataDesc.col_attrs.dtflags);
|
||||
if (unlikely(tstr.empty())) {
|
||||
tstr = U82T_c(C_("RomData", "Unknown"));
|
||||
tstr = TC_("RomData", "Unknown");
|
||||
}
|
||||
} else {
|
||||
tstr = U82T_s(*iter_sdr);
|
||||
@ -2281,7 +2281,7 @@ IFACEMETHODIMP RP_ShellPropSheetExt::AddPages(_In_ LPFNADDPROPSHEETPAGE pfnAddPa
|
||||
}
|
||||
|
||||
// tr: Tab title.
|
||||
const tstring tsTabTitle = U82T_c(C_("RomDataView", "ROM Properties"));
|
||||
const tstring tsTabTitle = TC_("RomDataView", "ROM Properties");
|
||||
|
||||
// Create a property sheet page.
|
||||
PROPSHEETPAGE psp;
|
||||
|
@ -382,8 +382,8 @@ void RP_ShellPropSheetExt_Private::btnOptions_action_triggered(int menuId)
|
||||
}
|
||||
|
||||
const tstring tfilename = LibWin32UI::getSaveFileName(hDlgSheet,
|
||||
U82T_c(pgettext_expr("RomDataView", info.title)),
|
||||
U82T_c(pgettext_expr("RomDataView", info.filter)),
|
||||
tpgettext_expr("RomDataView", info.title),
|
||||
tpgettext_expr("RomDataView", info.filter),
|
||||
defaultFileName.c_str());
|
||||
if (tfilename.empty())
|
||||
return;
|
||||
|
@ -1066,7 +1066,7 @@ void AboutTabPrivate::initCreditsTab(void)
|
||||
sCredits += '}';
|
||||
|
||||
// Add the "Credits" tab.
|
||||
const tstring tsTabTitle = U82T_c(C_("AboutTab", "Credits"));
|
||||
const tstring tsTabTitle = TC_("AboutTab", "Credits");
|
||||
TCITEM tcItem;
|
||||
tcItem.mask = TCIF_TEXT;
|
||||
tcItem.pszText = const_cast<LPTSTR>(tsTabTitle.c_str());
|
||||
@ -1241,7 +1241,7 @@ void AboutTabPrivate::initLibrariesTab(void)
|
||||
sLibraries += '}';
|
||||
|
||||
// Add the "Libraries" tab.
|
||||
const tstring tsTabTitle = U82T_c(C_("AboutTab", "Libraries"));
|
||||
const tstring tsTabTitle = TC_("AboutTab", "Libraries");
|
||||
TCITEM tcItem;
|
||||
tcItem.mask = TCIF_TEXT;
|
||||
tcItem.pszText = const_cast<LPTSTR>(tsTabTitle.c_str());
|
||||
@ -1285,7 +1285,7 @@ void AboutTabPrivate::initSupportTab(void)
|
||||
sSupport += ">}";
|
||||
|
||||
// Add the "Support" tab.
|
||||
const tstring tsTabTitle = U82T_c(C_("AboutTab", "Support"));
|
||||
const tstring tsTabTitle = TC_("AboutTab", "Support");
|
||||
TCITEM tcItem;
|
||||
tcItem.mask = TCIF_TEXT;
|
||||
tcItem.pszText = const_cast<LPTSTR>(tsTabTitle.c_str());
|
||||
@ -1566,7 +1566,7 @@ HPROPSHEETPAGE AboutTab::getHPropSheetPage(void)
|
||||
}
|
||||
|
||||
// tr: Tab title.
|
||||
const tstring tsTabTitle = U82T_c(C_("AboutTab", "About"));
|
||||
const tstring tsTabTitle = TC_("AboutTab", "About");
|
||||
|
||||
PROPSHEETPAGE psp;
|
||||
psp.dwSize = sizeof(psp);
|
||||
|
@ -553,13 +553,13 @@ void AchievementsTabPrivate::reset(void)
|
||||
lvColumn.mask = LVCF_TEXT | LVCF_FMT;
|
||||
|
||||
// Column 0: Achievement
|
||||
tstring tstr = U82T_c(C_("AchievementsTab", "Achievement"));
|
||||
tstring tstr = TC_("AchievementsTab", "Achievement");
|
||||
lvColumn.pszText = const_cast<LPTSTR>(tstr.c_str());
|
||||
lvColumn.fmt = LVCFMT_LEFT;
|
||||
ListView_InsertColumn(hListView, 0, &lvColumn);
|
||||
|
||||
// Column 1: Unlock Time
|
||||
tstr = U82T_c(C_("AchievementsTab", "Unlock Time"));
|
||||
tstr = TC_("AchievementsTab", "Unlock Time");
|
||||
lvColumn.pszText = const_cast<LPTSTR>(tstr.c_str());
|
||||
lvColumn.fmt = LVCFMT_LEFT;
|
||||
ListView_InsertColumn(hListView, 1, &lvColumn);
|
||||
@ -664,7 +664,7 @@ HPROPSHEETPAGE AchievementsTab::getHPropSheetPage(void)
|
||||
}
|
||||
|
||||
// tr: Tab title.
|
||||
const tstring tsTabTitle = U82T_c(C_("AchievementsTab", "Achievements"));
|
||||
const tstring tsTabTitle = TC_("AchievementsTab", "Achievements");
|
||||
|
||||
PROPSHEETPAGE psp;
|
||||
psp.dwSize = sizeof(psp);
|
||||
|
@ -376,7 +376,7 @@ int CacheTabPrivate::clearThumbnailCacheVista(void)
|
||||
SendMessage(hProgressBar, PBM_SETPOS, 0, 0);
|
||||
|
||||
// Get all available drive letters.
|
||||
char errbuf[128];
|
||||
TCHAR errbuf[128];
|
||||
DWORD driveLetters = GetLogicalDrives();
|
||||
driveLetters &= 0x3FFFFFF; // Mask out non-drive letter bits.
|
||||
if (driveLetters == 0) {
|
||||
@ -384,10 +384,10 @@ int CacheTabPrivate::clearThumbnailCacheVista(void)
|
||||
// NOTE: PBM_SETSTATE is Vista+, which is fine here because
|
||||
// this is only run on Vista+.
|
||||
DWORD dwErr = GetLastError();
|
||||
snprintf(errbuf, sizeof(errbuf), C_("CacheTab|Win32",
|
||||
_sntprintf(errbuf, _countof(errbuf), TC_("CacheTab|Win32",
|
||||
"ERROR: GetLogicalDrives() failed. (GetLastError() == 0x%08X)"),
|
||||
static_cast<unsigned int>(dwErr));
|
||||
SetWindowText(hStatusLabel, U82T_c(errbuf));
|
||||
SetWindowText(hStatusLabel, errbuf);
|
||||
SendMessage(hProgressBar, PBM_SETSTATE, PBST_ERROR, 0);
|
||||
return 1;
|
||||
}
|
||||
@ -410,8 +410,8 @@ int CacheTabPrivate::clearThumbnailCacheVista(void)
|
||||
}
|
||||
if (driveLetters == 0) {
|
||||
// No fixed hard drives detected...
|
||||
SetWindowText(hStatusLabel, U82T_c(C_("CacheTab|Win32",
|
||||
"ERROR: No fixed HDDs or SSDs detected.")));
|
||||
SetWindowText(hStatusLabel, TC_("CacheTab|Win32",
|
||||
"ERROR: No fixed HDDs or SSDs detected."));
|
||||
SendMessage(hProgressBar, PBM_SETSTATE, PBST_ERROR, 0);
|
||||
return 2;
|
||||
}
|
||||
@ -420,10 +420,10 @@ int CacheTabPrivate::clearThumbnailCacheVista(void)
|
||||
RegKey hKey(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\VolumeCaches\\Thumbnail Cache"), KEY_READ, false);
|
||||
if (!hKey.isOpen()) {
|
||||
// Failed to open the registry key.
|
||||
snprintf(errbuf, sizeof(errbuf), C_("CacheTab|Win32",
|
||||
_sntprintf(errbuf, _countof(errbuf), TC_("CacheTab|Win32",
|
||||
"ERROR: Thumbnail Cache cleaner not found. (res == %ld)"),
|
||||
hKey.lOpenRes());
|
||||
SetWindowText(hStatusLabel, U82T_c(errbuf));
|
||||
SetWindowText(hStatusLabel, errbuf);
|
||||
SendMessage(hProgressBar, PBM_SETSTATE, PBST_ERROR, 0);
|
||||
return 3;
|
||||
}
|
||||
@ -432,8 +432,8 @@ int CacheTabPrivate::clearThumbnailCacheVista(void)
|
||||
const tstring s_clsidThumbnailCacheCleaner = hKey.read(nullptr);
|
||||
if (s_clsidThumbnailCacheCleaner.size() != 38) {
|
||||
// Not a CLSID.
|
||||
SetWindowText(hStatusLabel, U82T_c(C_("CacheTab|Win32",
|
||||
"ERROR: Thumbnail Cache cleaner CLSID is invalid.")));
|
||||
SetWindowText(hStatusLabel, TC_("CacheTab|Win32",
|
||||
"ERROR: Thumbnail Cache cleaner CLSID is invalid."));
|
||||
SendMessage(hProgressBar, PBM_SETSTATE, PBST_ERROR, 0);
|
||||
return 4;
|
||||
}
|
||||
@ -441,8 +441,8 @@ int CacheTabPrivate::clearThumbnailCacheVista(void)
|
||||
HRESULT hr = CLSIDFromString(s_clsidThumbnailCacheCleaner.c_str(), &clsidThumbnailCacheCleaner);
|
||||
if (FAILED(hr)) {
|
||||
// Failed to convert the CLSID from string.
|
||||
SetWindowText(hStatusLabel, U82T_c(C_("CacheTab|Win32",
|
||||
"ERROR: Thumbnail Cache cleaner CLSID is invalid.")));
|
||||
SetWindowText(hStatusLabel, TC_("CacheTab|Win32",
|
||||
"ERROR: Thumbnail Cache cleaner CLSID is invalid."));
|
||||
SendMessage(hProgressBar, PBM_SETSTATE, PBST_ERROR, 0);
|
||||
return 5;
|
||||
}
|
||||
@ -455,10 +455,10 @@ int CacheTabPrivate::clearThumbnailCacheVista(void)
|
||||
CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER, IID_PPV_ARGS(&pCleaner));
|
||||
if (FAILED(hr)) {
|
||||
// Failed...
|
||||
snprintf(errbuf, sizeof(errbuf), C_("CacheTab|Win32",
|
||||
_sntprintf(errbuf, _countof(errbuf), TC_("CacheTab|Win32",
|
||||
"ERROR: CoCreateInstance() failed. (hr == 0x%08X)"),
|
||||
static_cast<unsigned int>(hr));
|
||||
SetWindowText(hStatusLabel, U82T_c(errbuf));
|
||||
SetWindowText(hStatusLabel, errbuf);
|
||||
SendMessage(hProgressBar, PBM_SETSTATE, PBST_ERROR, 0);
|
||||
return 6;
|
||||
}
|
||||
@ -509,10 +509,10 @@ int CacheTabPrivate::clearThumbnailCacheVista(void)
|
||||
} else if (hr != S_OK) {
|
||||
// Some error occurred.
|
||||
// TODO: Continue with other drives?
|
||||
snprintf(errbuf, sizeof(errbuf), C_("CacheTab|Win32",
|
||||
_sntprintf(errbuf, _countof(errbuf), TC_("CacheTab|Win32",
|
||||
"ERROR: IEmptyVolumeCache::Initialize() failed on drive %c. (hr == 0x%08X)"),
|
||||
(char)szDrivePath[0], static_cast<unsigned int>(hr));
|
||||
SetWindowText(hStatusLabel, U82T_c(errbuf));
|
||||
szDrivePath[0], static_cast<unsigned int>(hr));
|
||||
SetWindowText(hStatusLabel, errbuf);
|
||||
SendMessage(hProgressBar, PBM_SETSTATE, PBST_ERROR, 0);
|
||||
pCallback->Release();
|
||||
EnableWindow(hClearSysThumbs, TRUE);
|
||||
@ -526,10 +526,10 @@ int CacheTabPrivate::clearThumbnailCacheVista(void)
|
||||
hr = pCleaner->Purge(-1LL, pCallback);
|
||||
if (FAILED(hr)) {
|
||||
// Cleanup failed. (TODO: Figure out why!)
|
||||
snprintf(errbuf, sizeof(errbuf), C_("CacheTab|Win32",
|
||||
_sntprintf(errbuf, _countof(errbuf), TC_("CacheTab|Win32",
|
||||
"ERROR: IEmptyVolumeCache::Purge() failed on drive %c. (hr == 0x%08X)"),
|
||||
(char)szDrivePath[0], static_cast<unsigned int>(hr));
|
||||
SetWindowText(hStatusLabel, U82T_c(errbuf));
|
||||
szDrivePath[0], static_cast<unsigned int>(hr));
|
||||
SetWindowText(hStatusLabel, errbuf);
|
||||
SendMessage(hProgressBar, PBM_SETSTATE, PBST_ERROR, 0);
|
||||
pCallback->Release();
|
||||
EnableWindow(hClearSysThumbs, TRUE);
|
||||
@ -611,7 +611,7 @@ int CacheTabPrivate::clearRomPropertiesCache(void)
|
||||
EnableWindow(hClearRpDl, FALSE);
|
||||
SetCursor(LoadCursor(nullptr, IDC_WAIT));
|
||||
|
||||
SetWindowText(hStatusLabel, U82T_c(C_("CacheTab", "Clearing the rom-properties cache...")));
|
||||
SetWindowText(hStatusLabel, TC_("CacheTab", "Clearing the rom-properties cache..."));
|
||||
|
||||
// Initialize the progress bar.
|
||||
// TODO: Before or after scanning?
|
||||
@ -623,7 +623,7 @@ int CacheTabPrivate::clearRomPropertiesCache(void)
|
||||
// If it doesn't, we'll act like it's empty.
|
||||
if (FileSystem::access(cacheDirT.c_str(), R_OK) != 0) {
|
||||
// Unable to read the directory. Assume it's missing.
|
||||
SetWindowText(hStatusLabel, U82T_c(C_("CacheTab", "rom-properties cache is empty. Nothing to do.")));
|
||||
SetWindowText(hStatusLabel, TC_("CacheTab", "rom-properties cache is empty. Nothing to do."));
|
||||
SendMessage(hProgressBar, PBM_SETRANGE, 0, MAKELONG(0, 1));
|
||||
SendMessage(hProgressBar, PBM_SETPOS, 1, 0);
|
||||
EnableWindow(hClearSysThumbs, TRUE);
|
||||
@ -654,7 +654,7 @@ int CacheTabPrivate::clearRomPropertiesCache(void)
|
||||
return 0;
|
||||
} else if (rlist.empty()) {
|
||||
// Nothing to do!
|
||||
SetWindowText(hStatusLabel, U82T_c(C_("CacheTab", "rom-properties cache is empty. Nothing to do.")));
|
||||
SetWindowText(hStatusLabel, TC_("CacheTab", "rom-properties cache is empty. Nothing to do."));
|
||||
SendMessage(hProgressBar, PBM_SETRANGE, 0, MAKELONG(0, 1));
|
||||
SendMessage(hProgressBar, PBM_SETPOS, 1, 0);
|
||||
EnableWindow(hClearSysThumbs, TRUE);
|
||||
@ -719,14 +719,15 @@ int CacheTabPrivate::clearRomPropertiesCache(void)
|
||||
}
|
||||
|
||||
if (dirErrs > 0 || fileErrs > 0) {
|
||||
char buf[256];
|
||||
snprintf_p(buf, sizeof(buf), C_("CacheTab", "Unable to delete %1$u file(s) and/or %2$u dir(s)."),
|
||||
// FIXME: MinGW-w64 11.0.0 doesn't have _swprintf_p() implemented.
|
||||
char errbuf[256];
|
||||
snprintf_p(errbuf, sizeof(errbuf), C_("CacheTab", "Unable to delete %1$u file(s) and/or %2$u dir(s)."),
|
||||
fileErrs, dirErrs);
|
||||
const string s_err = rp_sprintf(C_("CacheTab", "ERROR: %s"), buf);
|
||||
const string s_err = rp_sprintf(C_("CacheTab", "ERROR: %s"), errbuf);
|
||||
SetWindowText(hStatusLabel, U82T_s(s_err));
|
||||
MessageBeep(MB_ICONWARNING);
|
||||
} else {
|
||||
SetWindowText(hStatusLabel, U82T_c(C_("CacheTab", "rom-properties cache cleared successfully.")));
|
||||
SetWindowText(hStatusLabel, TC_("CacheTab", "rom-properties cache cleared successfully."));
|
||||
MessageBeep(MB_ICONINFORMATION);
|
||||
}
|
||||
|
||||
@ -1022,7 +1023,7 @@ HPROPSHEETPAGE CacheTab::getHPropSheetPage(void)
|
||||
}
|
||||
|
||||
// tr: Tab title.
|
||||
const tstring tsTabTitle = U82T_c(C_("CacheTab", "Thumbnail Cache"));
|
||||
const tstring tsTabTitle = TC_("CacheTab", "Thumbnail Cache");
|
||||
|
||||
PROPSHEETPAGE psp;
|
||||
psp.dwSize = sizeof(psp);
|
||||
|
@ -243,7 +243,7 @@ LRESULT CALLBACK ConfigDialogPrivate::subclassProc(
|
||||
}
|
||||
|
||||
// tr: Dialog title.
|
||||
const tstring tsTitle = U82T_c(C_("ConfigDialog", "ROM Properties Page configuration"));
|
||||
const tstring tsTitle = TC_("ConfigDialog", "ROM Properties Page configuration");
|
||||
SetWindowText(hWnd, tsTitle.c_str());
|
||||
|
||||
// Create the "Reset" and "Defaults" buttons.
|
||||
@ -289,7 +289,7 @@ LRESULT CALLBACK ConfigDialogPrivate::subclassProc(
|
||||
|
||||
HWND hBtnReset = CreateWindowEx(0, WC_BUTTON,
|
||||
// tr: "Reset" button.
|
||||
U82T_c(C_("ConfigDialog", "&Reset")),
|
||||
TC_("ConfigDialog", "&Reset"),
|
||||
WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_GROUP | BS_CENTER,
|
||||
ptBtn.x, ptBtn.y, szBtn.cx, szBtn.cy,
|
||||
hWnd, (HMENU)IDC_RP_RESET, nullptr, nullptr);
|
||||
@ -306,7 +306,7 @@ LRESULT CALLBACK ConfigDialogPrivate::subclassProc(
|
||||
ptBtn.x += szBtn.cx + (rect_btnCancel.left - rect_btnOK.right);
|
||||
HWND hBtnDefaults = CreateWindowEx(0, WC_BUTTON,
|
||||
// tr: "Defaults" button.
|
||||
U82T_c(C_("ConfigDialog", "Defaults")),
|
||||
TC_("ConfigDialog", "Defaults"),
|
||||
WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_GROUP | BS_CENTER,
|
||||
ptBtn.x, ptBtn.y, szBtn.cx, szBtn.cy,
|
||||
hWnd, (HMENU)IDC_RP_DEFAULTS, nullptr, nullptr);
|
||||
|
@ -401,7 +401,7 @@ void ImageTypesTabPrivate::addComboBoxStrings(unsigned int cbid, int max_prio)
|
||||
// since "No" counts as an entry.
|
||||
assert(max_prio <= static_cast<int>(ImageTypesConfig::imageTypeCount()));
|
||||
// tr: Don't use this image type for this particular system.
|
||||
ComboBox_AddString(cboImageType, U82T_c(C_("ImageTypesTab|Values", "No")));
|
||||
ComboBox_AddString(cboImageType, TC_("ImageTypesTab|Values", "No"));
|
||||
for (int i = 1; i <= max_prio; i++) {
|
||||
TCHAR buf[16];
|
||||
_sntprintf(buf, _countof(buf), _T("%d"), i);
|
||||
@ -525,14 +525,12 @@ void ImageTypesTabPrivate::cboImageType_setPriorityValue(unsigned int cbid, unsi
|
||||
*/
|
||||
void ImageTypesTabPrivate::initStrings(void)
|
||||
{
|
||||
SetWindowText(GetDlgItem(hWndPropSheet, IDC_IMAGETYPES_CREDITS), U82T_c(
|
||||
// tr: External image credits.
|
||||
C_("ImageTypesTab",
|
||||
"GameCube, Wii, Wii U, Nintendo DS, and Nintendo 3DS external images\n"
|
||||
"are provided by <a href=\"https://www.gametdb.com/\">GameTDB</a>.\n"
|
||||
"amiibo images are provided by <a href=\"https://amiibo.life/\">amiibo.life</a>,"
|
||||
" the Unofficial amiibo Database.")
|
||||
));
|
||||
// tr: External image credits.
|
||||
SetWindowText(GetDlgItem(hWndPropSheet, IDC_IMAGETYPES_CREDITS), TC_("ImageTypesTab",
|
||||
"GameCube, Wii, Wii U, Nintendo DS, and Nintendo 3DS external images\n"
|
||||
"are provided by <a href=\"https://www.gametdb.com/\">GameTDB</a>.\n"
|
||||
"amiibo images are provided by <a href=\"https://amiibo.life/\">amiibo.life</a>,"
|
||||
" the Unofficial amiibo Database."));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -793,7 +791,7 @@ HPROPSHEETPAGE ImageTypesTab::getHPropSheetPage(void)
|
||||
// FIXME: SysLink controls won't work in ANSI builds.
|
||||
|
||||
// tr: Tab title.
|
||||
const tstring tsTabTitle = U82T_c(C_("ImageTypesTab", "Image Types"));
|
||||
const tstring tsTabTitle = TC_("ImageTypesTab", "Image Types");
|
||||
|
||||
PROPSHEETPAGE psp;
|
||||
psp.dwSize = sizeof(psp);
|
||||
|
@ -349,7 +349,7 @@ void KeyManagerTabPrivate::initDialog(void)
|
||||
// COMCTL32 is older than v6.10. Use a regular button.
|
||||
// NOTE: The Unicode down arrow doesn't show on on Windows XP.
|
||||
// Maybe we *should* use ownerdraw...
|
||||
SetWindowText(hBtnImport, U82T_c(C_("KeyManagerTab", "I&mport...")));
|
||||
SetWindowText(hBtnImport, TC_("KeyManagerTab", "I&mport..."));
|
||||
}
|
||||
|
||||
// Ensure the images are loaded before initializing the ListView.
|
||||
@ -367,7 +367,7 @@ void KeyManagerTabPrivate::initDialog(void)
|
||||
tstring tsColTitle;
|
||||
|
||||
// tr: Column 0: Key Name.
|
||||
tsColTitle = U82T_c(C_("KeyManagerTab", "Key Name"));
|
||||
tsColTitle = TC_("KeyManagerTab", "Key Name");
|
||||
LVCOLUMN lvCol;
|
||||
memset(&lvCol, 0, sizeof(lvCol));
|
||||
lvCol.mask = LVCF_FMT | LVCF_TEXT | LVCF_SUBITEM;
|
||||
@ -376,12 +376,12 @@ void KeyManagerTabPrivate::initDialog(void)
|
||||
ListView_InsertColumn(hListView, 0, &lvCol);
|
||||
|
||||
// tr: Column 1: Value.
|
||||
tsColTitle = U82T_c(C_("KeyManagerTab", "Value"));
|
||||
tsColTitle = TC_("KeyManagerTab", "Value");
|
||||
lvCol.pszText = const_cast<LPTSTR>(tsColTitle.c_str());
|
||||
ListView_InsertColumn(hListView, 1, &lvCol);
|
||||
|
||||
// tr: Column 2: Verification status.
|
||||
tsColTitle = U82T_c(C_("KeyManagerTab", "Valid?"));
|
||||
tsColTitle = TC_("KeyManagerTab", "Valid?");
|
||||
lvCol.pszText = const_cast<LPTSTR>(tsColTitle.c_str());
|
||||
ListView_InsertColumn(hListView, 2, &lvCol);
|
||||
|
||||
@ -1590,29 +1590,29 @@ void KeyManagerTabPrivate::showKeyImportReturnStatus(
|
||||
switch (iret.status) {
|
||||
case KeyStoreUI::ImportStatus::InvalidParams:
|
||||
default:
|
||||
msg = LibWin32UI::unix2dos(U82T_s(C_("KeyManagerTab",
|
||||
msg = LibWin32UI::unix2dos(TC_("KeyManagerTab",
|
||||
"An invalid parameter was passed to the key importer.\n"
|
||||
"THIS IS A BUG; please report this to the developers!")));
|
||||
"THIS IS A BUG; please report this to the developers!"));
|
||||
type = MB_ICONSTOP;
|
||||
break;
|
||||
|
||||
case KeyStoreUI::ImportStatus::UnknownKeyID:
|
||||
msg = LibWin32UI::unix2dos(U82T_s(C_("KeyManagerTab",
|
||||
msg = LibWin32UI::unix2dos(TC_("KeyManagerTab",
|
||||
"An unknown key ID was passed to the key importer.\n"
|
||||
"THIS IS A BUG; please report this to the developers!")));
|
||||
"THIS IS A BUG; please report this to the developers!"));
|
||||
type = MB_ICONSTOP;
|
||||
break;
|
||||
|
||||
case KeyStoreUI::ImportStatus::OpenError:
|
||||
if (iret.error_code != 0) {
|
||||
// tr: %1$s == filename, %2$s == error message
|
||||
msg = rp_stprintf_p(U82T_c(C_("KeyManagerTab",
|
||||
"An error occurred while opening '%1$s': %2$s")),
|
||||
msg = rp_stprintf_p(TC_("KeyManagerTab",
|
||||
"An error occurred while opening '%1$s': %2$s"),
|
||||
fileNoPath.c_str(), _wcserror(iret.error_code));
|
||||
} else {
|
||||
// tr: %s == filename
|
||||
msg = rp_stprintf(U82T_c(C_("KeyManagerTab",
|
||||
"An error occurred while opening '%s'.")),
|
||||
msg = rp_stprintf(TC_("KeyManagerTab",
|
||||
"An error occurred while opening '%s'."),
|
||||
fileNoPath.c_str());
|
||||
}
|
||||
type = MB_ICONSTOP;
|
||||
@ -1622,13 +1622,13 @@ void KeyManagerTabPrivate::showKeyImportReturnStatus(
|
||||
// TODO: Error code for short reads.
|
||||
if (iret.error_code != 0) {
|
||||
// tr: %1$s == filename, %2$s == error message
|
||||
msg = rp_stprintf_p(U82T_c(C_("KeyManagerTab",
|
||||
"An error occurred while reading '%1$s': %2$s")),
|
||||
msg = rp_stprintf_p(TC_("KeyManagerTab",
|
||||
"An error occurred while reading '%1$s': %2$s"),
|
||||
fileNoPath, _wcserror(iret.error_code));
|
||||
} else {
|
||||
// tr: %s == filename
|
||||
msg = rp_stprintf(U82T_c(C_("KeyManagerTab",
|
||||
"An error occurred while reading '%s'.")),
|
||||
msg = rp_stprintf(TC_("KeyManagerTab",
|
||||
"An error occurred while reading '%s'."),
|
||||
fileNoPath.c_str());
|
||||
}
|
||||
type = MB_ICONSTOP;
|
||||
@ -1636,16 +1636,16 @@ void KeyManagerTabPrivate::showKeyImportReturnStatus(
|
||||
|
||||
case KeyStoreUI::ImportStatus::InvalidFile:
|
||||
// tr: %1$s == filename, %2$s == type of file
|
||||
msg = rp_stprintf_p(U82T_c(C_("KeyManagerTab",
|
||||
"The file '%1$s' is not a valid %2$s file.")),
|
||||
msg = rp_stprintf_p(TC_("KeyManagerTab",
|
||||
"The file '%1$s' is not a valid %2$s file."),
|
||||
fileNoPath.c_str(), keyType);
|
||||
type = MB_ICONWARNING;
|
||||
break;
|
||||
|
||||
case KeyStoreUI::ImportStatus::NoKeysImported:
|
||||
// tr: %s == filename
|
||||
msg = rp_stprintf(U82T_c(C_("KeyManagerTab",
|
||||
"No keys were imported from '%s'.")),
|
||||
msg = rp_stprintf(TC_("KeyManagerTab",
|
||||
"No keys were imported from '%s'."),
|
||||
fileNoPath.c_str());
|
||||
type = MB_ICONINFORMATION;
|
||||
showKeyStats = true;
|
||||
@ -1655,10 +1655,10 @@ void KeyManagerTabPrivate::showKeyImportReturnStatus(
|
||||
const unsigned int keyCount = iret.keysImportedVerify + iret.keysImportedNoVerify;
|
||||
toss << keyCount;
|
||||
// tr: %1$s == number of keys (formatted), %2$u == filename
|
||||
msg = rp_stprintf_p(U82T_c(NC_("KeyManagerTab",
|
||||
msg = rp_stprintf_p(TNC_("KeyManagerTab",
|
||||
"%1$s key was imported from '%2$s'.",
|
||||
"%1$s keys were imported from '%2$s'.",
|
||||
keyCount)),
|
||||
keyCount),
|
||||
toss.str().c_str(), fileNoPath.c_str());
|
||||
type = MB_ICONINFORMATION;
|
||||
showKeyStats = true;
|
||||
@ -1681,10 +1681,10 @@ void KeyManagerTabPrivate::showKeyImportReturnStatus(
|
||||
toss << iret.keysExist;
|
||||
msg += nl_bullet;
|
||||
// tr: %s == number of keys (formatted)
|
||||
msg += rp_stprintf(U82T_c(NC_("KeyManagerTab",
|
||||
msg += rp_stprintf(TNC_("KeyManagerTab",
|
||||
"%s key already exists in the Key Manager.",
|
||||
"%s keys already exist in the Key Manager.",
|
||||
iret.keysExist)),
|
||||
iret.keysExist),
|
||||
toss.str().c_str());
|
||||
}
|
||||
if (iret.keysInvalid > 0) {
|
||||
@ -1693,10 +1693,10 @@ void KeyManagerTabPrivate::showKeyImportReturnStatus(
|
||||
toss << iret.keysInvalid;
|
||||
msg += nl_bullet;
|
||||
// tr: %s == number of keys (formatted)
|
||||
msg += rp_stprintf(U82T_c(NC_("KeyManagerTab",
|
||||
msg += rp_stprintf(TNC_("KeyManagerTab",
|
||||
"%s key was not imported because it is incorrect.",
|
||||
"%s keys were not imported because they are incorrect.",
|
||||
iret.keysInvalid)),
|
||||
iret.keysInvalid),
|
||||
toss.str().c_str());
|
||||
}
|
||||
if (iret.keysNotUsed > 0) {
|
||||
@ -1705,10 +1705,10 @@ void KeyManagerTabPrivate::showKeyImportReturnStatus(
|
||||
toss << iret.keysNotUsed;
|
||||
msg += nl_bullet;
|
||||
// tr: %s == number of keys (formatted)
|
||||
msg += rp_stprintf(U82T_c(NC_("KeyManagerTab",
|
||||
msg += rp_stprintf(TNC_("KeyManagerTab",
|
||||
"%s key was not imported because it isn't used by rom-properties.",
|
||||
"%s keys were not imported because they aren't used by rom-properties.",
|
||||
iret.keysNotUsed)),
|
||||
iret.keysNotUsed),
|
||||
toss.str().c_str());
|
||||
}
|
||||
if (iret.keysCantDecrypt > 0) {
|
||||
@ -1717,10 +1717,10 @@ void KeyManagerTabPrivate::showKeyImportReturnStatus(
|
||||
toss << iret.keysCantDecrypt;
|
||||
msg += nl_bullet;
|
||||
// tr: %s == number of keys (formatted)
|
||||
msg += rp_stprintf(U82T_c(NC_("KeyManagerTab",
|
||||
msg += rp_stprintf(TNC_("KeyManagerTab",
|
||||
"%s key was not imported because it is encrypted and the master key isn't available.",
|
||||
"%s keys were not imported because they are encrypted and the master key isn't available.",
|
||||
iret.keysCantDecrypt)),
|
||||
iret.keysCantDecrypt),
|
||||
toss.str().c_str());
|
||||
}
|
||||
if (iret.keysImportedVerify > 0) {
|
||||
@ -1729,10 +1729,10 @@ void KeyManagerTabPrivate::showKeyImportReturnStatus(
|
||||
toss << iret.keysImportedVerify;
|
||||
msg += nl_bullet;
|
||||
// tr: %s == number of keys (formatted)
|
||||
msg += rp_stprintf(U82T_c(NC_("KeyManagerTab",
|
||||
msg += rp_stprintf(TNC_("KeyManagerTab",
|
||||
"%s key has been imported and verified as correct.",
|
||||
"%s keys have been imported and verified as correct.",
|
||||
iret.keysImportedVerify)),
|
||||
iret.keysImportedVerify),
|
||||
toss.str().c_str());
|
||||
}
|
||||
if (iret.keysImportedNoVerify > 0) {
|
||||
@ -1740,10 +1740,10 @@ void KeyManagerTabPrivate::showKeyImportReturnStatus(
|
||||
toss.clear();
|
||||
toss << iret.keysImportedVerify;
|
||||
msg += nl_bullet;
|
||||
msg += rp_stprintf(U82T_c(NC_("KeyManagerTab",
|
||||
msg += rp_stprintf(TNC_("KeyManagerTab",
|
||||
"%s key has been imported without verification.",
|
||||
"%s keys have been imported without verification.",
|
||||
iret.keysImportedNoVerify)),
|
||||
iret.keysImportedNoVerify),
|
||||
toss.str().c_str());
|
||||
}
|
||||
}
|
||||
@ -1816,6 +1816,10 @@ void KeyManagerTabPrivate::importKeysFromBin(KeyStoreUI::ImportFileID id)
|
||||
id > KeyStoreUI::ImportFileID::N3DSaeskeydb)
|
||||
return;
|
||||
|
||||
assert(hWndPropSheet != nullptr);
|
||||
if (!hWndPropSheet)
|
||||
return;
|
||||
|
||||
static constexpr char dialog_titles_tbl[][32] = {
|
||||
// tr: Wii keys.bin dialog title
|
||||
NOP_C_("KeyManagerTab", "Select Wii keys.bin File"),
|
||||
@ -1838,15 +1842,10 @@ void KeyManagerTabPrivate::importKeysFromBin(KeyStoreUI::ImportFileID id)
|
||||
NOP_C_("KeyManagerTab", "aeskeydb.bin|aeskeydb.bin|-|Binary Files|*.bin|-|All Files|*|-"),
|
||||
};
|
||||
|
||||
const char *const s_title = pgettext_expr("KeyManagerTab", dialog_titles_tbl[(int)id]);
|
||||
const char *const s_filter = pgettext_expr("KeyManagerTab", file_filters_tbl[(int)id]);
|
||||
|
||||
assert(hWndPropSheet != nullptr);
|
||||
if (!hWndPropSheet)
|
||||
return;
|
||||
|
||||
const tstring tfilename = LibWin32UI::getOpenFileName(hWndPropSheet,
|
||||
U82T_c(s_title), U82T_c(s_filter), ts_keyFileDir.c_str());
|
||||
tpgettext_expr("KeyManagerTab", dialog_titles_tbl[(int)id]),
|
||||
tpgettext_expr("KeyManagerTab", file_filters_tbl[(int)id]),
|
||||
ts_keyFileDir.c_str());
|
||||
if (tfilename.empty())
|
||||
return;
|
||||
|
||||
@ -1886,7 +1885,7 @@ HPROPSHEETPAGE KeyManagerTab::getHPropSheetPage(void)
|
||||
}
|
||||
|
||||
// tr: Tab title.
|
||||
const tstring tsTabTitle = U82T_c(C_("KeyManagerTab", "Key Manager"));
|
||||
const tstring tsTabTitle = TC_("KeyManagerTab", "Key Manager");
|
||||
|
||||
PROPSHEETPAGE psp;
|
||||
psp.dwSize = sizeof(psp);
|
||||
|
@ -440,9 +440,9 @@ INT_PTR CALLBACK OptionsTabPrivate::dlgProc(HWND hDlg, UINT uMsg, WPARAM wParam,
|
||||
d->lastDarkModeEnabled = g_darkModeEnabled;
|
||||
|
||||
// Populate the combo boxes.
|
||||
const tstring s_dl_None = U82T_c(C_("OptionsTab", "Don't download any images"));
|
||||
const tstring s_dl_NormalRes = U82T_c(C_("OptionsTab", "Download normal-resolution images"));
|
||||
const tstring s_dl_HighRes = U82T_c(C_("OptionsTab", "Download high-resolution images"));
|
||||
const tstring s_dl_None = TC_("OptionsTab", "Don't download any images");
|
||||
const tstring s_dl_NormalRes = TC_("OptionsTab", "Download normal-resolution images");
|
||||
const tstring s_dl_HighRes = TC_("OptionsTab", "Download high-resolution images");
|
||||
HWND cboUnmeteredDL = GetDlgItem(hDlg, IDC_OPTIONS_CBO_UNMETERED_DL);
|
||||
ComboBox_AddString(cboUnmeteredDL, s_dl_None.c_str());
|
||||
ComboBox_AddString(cboUnmeteredDL, s_dl_NormalRes.c_str());
|
||||
@ -683,7 +683,7 @@ HPROPSHEETPAGE OptionsTab::getHPropSheetPage(void)
|
||||
}
|
||||
|
||||
// tr: Tab title.
|
||||
const tstring tsTabTitle = U82T_c(C_("OptionsTab", "Options"));
|
||||
const tstring tsTabTitle = TC_("OptionsTab", "Options");
|
||||
|
||||
PROPSHEETPAGE psp;
|
||||
psp.dwSize = sizeof(psp);
|
||||
|
@ -470,7 +470,7 @@ HPROPSHEETPAGE SystemsTab::getHPropSheetPage(void)
|
||||
}
|
||||
|
||||
// tr: Tab title.
|
||||
const tstring tsTabTitle = U82T_c(C_("SystemsTab", "Systems"));
|
||||
const tstring tsTabTitle = TC_("SystemsTab", "Systems");
|
||||
|
||||
PROPSHEETPAGE psp;
|
||||
psp.dwSize = sizeof(psp);
|
||||
|
Loading…
Reference in New Issue
Block a user