[qrvthtool] Use QStringLiteral instead of QLatin1String, QString::fromLatin1(), or QString::fromUtf8() where possible.

QStringLiteral encodes a QString struct directly into the executable.
This has some more overhead compared to a Latin-1 or UTF-8 string,
but it means nothing needs to be copied into RAM at runtime.

Related changes:
- Consolidate some string building into QStringLiteral().arg().
- Update copyrights for 2023 where applicable.
This commit is contained in:
David Korth 2023-11-25 10:53:23 -05:00
parent 5e0a1ba149
commit 22ce6af987
12 changed files with 158 additions and 173 deletions

View File

@ -2,7 +2,7 @@
* RVT-H Tool (qrvthtool) *
* RvtHModel.hpp: QAbstractListModel for RvtH objects. *
* *
* Copyright (c) 2018-2019 by David Korth. *
* Copyright (c) 2018-2023 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -134,7 +134,7 @@ void RvtHModelPrivate::style_t::init(void)
brush_lostFile_alt = QBrush(bgColor_lostFile_alt);
// Monospaced font.
fntMonospace = QFont(QLatin1String("Monospace"));
fntMonospace = QFont(QStringLiteral("Monospace"));
fntMonospace.setStyleHint(QFont::TypeWriter);
}
@ -156,7 +156,7 @@ QIcon RvtHModelPrivate::getIcon(RvtHModel::IconID id)
"gcn", "nr", "wii", "rvtr", "rvth"
};
static_assert(ARRAY_SIZE(names) == RvtHModel::ICON_MAX, "names[] needs to be updated!");
ms_icons[id] = loadIcon(QLatin1String("hw"), QLatin1String(names[id]));
ms_icons[id] = loadIcon(QStringLiteral("hw"), QLatin1String(names[id]));
assert(!ms_icons[id].isNull());
}
@ -176,10 +176,7 @@ QIcon RvtHModelPrivate::loadIcon(const QString &dir, const QString &name)
QIcon icon;
for (const uint8_t *p = icoSz; *p != 0; p++) {
const QString s_sz = QString::number(*p);
QString full_path = QLatin1String(":/") +
dir + QChar(L'/') +
s_sz + QChar(L'x') + s_sz + QChar(L'/') +
name + QLatin1String(".png");;
const QString full_path = QStringLiteral(":/%1/%2x%2/%3.png").arg(dir, s_sz, name);
QPixmap pxm(full_path);
if (!pxm.isNull()) {
icon.addPixmap(pxm);

View File

@ -2,7 +2,7 @@
* RVT-H Tool (qrvthtool) *
* DockManager.hpp: DockManager D-Bus implementation. *
* *
* Copyright (c) 2013-2019 by David Korth. *
* Copyright (c) 2013-2023 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -110,8 +110,8 @@ net::launchpad::DockManager *DockManagerPrivate::GetDockManagerInterface(QObject
// Connect to the DockManager over D-Bus.
net::launchpad::DockManager *ifDockManager;
ifDockManager = new net::launchpad::DockManager(
QLatin1String("net.launchpad.DockManager"),
QLatin1String("/net/launchpad/DockManager"),
QStringLiteral("net.launchpad.DockManager"),
QStringLiteral("/net/launchpad/DockManager"),
bus, parent);
if (!ifDockManager->isValid()) {
// Cannot connect to the DockManager.
@ -168,7 +168,7 @@ int DockManagerPrivate::connectToDockManager(void)
}
ifDockItem = new net::launchpad::DockItem(
QLatin1String("net.launchpad.DockManager"),
QStringLiteral("net.launchpad.DockManager"),
paths.at(0).path(), bus, q);
if (!ifDockItem->isValid()) {
// Cannot connect to DockItem.
@ -209,7 +209,7 @@ void DockManagerPrivate::update(void)
} else {
progress = (int)(((float)curVal / (float)curMax) * 100);
}
dockItemProps[QLatin1String("progress")] = progress;
dockItemProps[QStringLiteral("progress")] = progress;
ifDockItem->UpdateDockItem(dockItemProps);
}

View File

@ -2,7 +2,7 @@
* RVT-H Tool (qrvthtool) *
* UnityLauncher.cpp: Unity Launcher implementation. *
* *
* Copyright (c) 2013-2022 by David Korth. *
* Copyright (c) 2013-2023 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -39,11 +39,11 @@ class UnityLauncherPrivate : public TaskbarButtonManagerPrivate
static inline void sendMessage(const QVariantMap &map)
{
QDBusMessage message = QDBusMessage::createSignal(
QLatin1String("/qrvthtool"),
QLatin1String("com.canonical.Unity.LauncherEntry"),
QLatin1String("Update"));
QStringLiteral("/qrvthtool"),
QStringLiteral("com.canonical.Unity.LauncherEntry"),
QStringLiteral("Update"));
QVariantList args;
args << QLatin1String("application://" DESKTOP_FILENAME) << map;
args << QStringLiteral("application://" DESKTOP_FILENAME) << map;
message.setArguments(args);
if (!QDBusConnection::sessionBus().send(message))
qWarning("Unable to send message");
@ -72,7 +72,7 @@ bool UnityLauncher::IsUsable(void)
{
QDBusConnection connection = QDBusConnection::sessionBus();
QStringList services = connection.interface()->registeredServiceNames().value();
return services.contains(QLatin1String("com.canonical.Unity"));
return services.contains(QStringLiteral("com.canonical.Unity"));
}
/**
@ -108,8 +108,8 @@ void UnityLauncher::update(void)
// Progress bar is visible.
const double value = (double)d->progressBarValue / (double)d->progressBarMax;
QVariantMap map;
map.insert(QLatin1String("progress"), value);
map.insert(QLatin1String("progress-visible"), true);
map.insert(QStringLiteral("progress"), value);
map.insert(QStringLiteral("progress-visible"), true);
d->sendMessage(map);
}
}

View File

@ -2,7 +2,7 @@
* RVT-H Tool (qrvthtool) *
* TranslationManager.cpp: Qt translation manager. *
* *
* Copyright (c) 2014-2022 by David Korth. *
* Copyright (c) 2014-2023 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -60,7 +60,7 @@ TranslationManagerPrivate::TranslationManagerPrivate(TranslationManager *q)
#ifdef Q_OS_WIN
// Win32: Search the program's /translations/ and main directories.
pathList.append(QCoreApplication::applicationDirPath() + QLatin1String("/translations"));
pathList.append(QCoreApplication::applicationDirPath() + QStringLiteral("/translations"));
pathList.append(QCoreApplication::applicationDirPath());
#else /* !Q_OS_WIN */
// Check if the program's directory is within the user's home directory.
@ -82,12 +82,12 @@ TranslationManagerPrivate::TranslationManagerPrivate(TranslationManager *q)
// This usually means they're working on it themselves.
// Search the program's /translations/ and main directories.
pathList.append(QCoreApplication::applicationDirPath() + QLatin1String("/translations"));
pathList.append(QCoreApplication::applicationDirPath() + QStringLiteral("/translations"));
pathList.append(QCoreApplication::applicationDirPath());
}
// Search the installed translations directory.
pathList.append(QString::fromUtf8(QRVTHTOOL_TRANSLATIONS_DIRECTORY));
pathList.append(QStringLiteral(QRVTHTOOL_TRANSLATIONS_DIRECTORY));
#endif /* Q_OS_WIN */
// Search the user's configuration directory.
@ -95,7 +95,7 @@ TranslationManagerPrivate::TranslationManagerPrivate(TranslationManager *q)
#if 0
QDir configDir(ConfigStore::ConfigPath());
if (configDir != QDir(QCoreApplication::applicationDirPath())) {
pathList.append(configDir.absoluteFilePath(QLatin1String("translations")));
pathList.append(configDir.absoluteFilePath(QStringLiteral("translations")));
pathList.append(configDir.absolutePath());
}
#endif
@ -135,7 +135,7 @@ void TranslationManager::setTranslation(const QString &locale)
Q_D(TranslationManager);
// Initialize the Qt translation system.
QString qtLocale = QLatin1String("qt_") + locale;
QString qtLocale = QStringLiteral("qt_") + locale;
bool isQtSysTranslator = false;
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
// Qt on Unix (but not Mac) is usually installed system-wide.
@ -162,7 +162,7 @@ void TranslationManager::setTranslation(const QString &locale)
}
// Initialize the application translator.
QString prgLocale = QLatin1String("rvthtool_") + locale;
QString prgLocale = QStringLiteral("rvthtool_") + locale;
foreach (const QString &path, d->pathList) {
if (d->prgTranslator->load(prgLocale, path)) {
break;

View File

@ -2,7 +2,7 @@
* RVT-H Tool (librvth) *
* qrvthtool.cpp: Main program. *
* *
* Copyright (c) 2018 by David Korth. *
* Copyright (c) 2018-2023 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -80,14 +80,14 @@ int main(int argc, char *argv[])
#endif /* QT_VERSION >= QT_VERSION_CHECK(5,0,0) && QT_VERSION < QT_VERSION_CHECK(6,0,0) */
QApplication *app = new QApplication(argc, argv);
app->setApplicationName(QLatin1String("qrvthtool"));
app->setOrganizationDomain(QLatin1String("gerbilsoft.com"));
app->setOrganizationName(QLatin1String("GerbilSoft"));
app->setApplicationVersion(QLatin1String(VERSION_STRING));
app->setApplicationName(QStringLiteral("qrvthtool"));
app->setOrganizationDomain(QStringLiteral("gerbilsoft.com"));
app->setOrganizationName(QStringLiteral("GerbilSoft"));
app->setApplicationVersion(QStringLiteral(VERSION_STRING));
app->setApplicationDisplayName(QLatin1String("RVT-H Tool"));
app->setApplicationDisplayName(QStringLiteral("RVT-H Tool"));
#if QT_VERSION >= QT_VERSION_CHECK(5,7,0)
app->setDesktopFileName(QLatin1String("com.gerbilsoft.qrvthtool"));
app->setDesktopFileName(QStringLiteral("com.gerbilsoft.qrvthtool"));
#endif /* QT_VERSION >= QT_VERSION_CHECK(5,7,0) */
// Initialize the TranslationManager.
@ -102,11 +102,11 @@ int main(int argc, char *argv[])
#if defined(_WIN32) || defined(__APPLE__)
// Check if an icon theme is available.
if (!QIcon::hasThemeIcon(QLatin1String("application-exit"))) {
if (!QIcon::hasThemeIcon(QStringLiteral("application-exit"))) {
// Icon theme is not available.
// Use the built-in Oxygen icon theme.
// Reference: http://tkrotoff.blogspot.com/2010/02/qiconfromtheme-under-windows.html
QIcon::setThemeName(QLatin1String("oxygen"));
QIcon::setThemeName(QStringLiteral("oxygen"));
}
#endif /* _WIN32 || __APPLE__ */
@ -119,9 +119,9 @@ int main(int argc, char *argv[])
// TODO: Better device file check.
const QString &filename = args.at(1);
#ifdef _WIN32
bool isDevice = filename.startsWith(QLatin1String("\\\\.\\PhysicalDrive"), Qt::CaseInsensitive);
bool isDevice = filename.startsWith(QStringLiteral("\\\\.\\PhysicalDrive"), Qt::CaseInsensitive);
#else /* !_WIN32 */
bool isDevice = filename.startsWith(QLatin1String("/dev/"));
bool isDevice = filename.startsWith(QStringLiteral("/dev/"));
#endif /* _WIN32 */
window->openRvtH(QDir::fromNativeSeparators(filename), isDevice);
}

View File

@ -2,7 +2,7 @@
* RVT-H Tool (qrvthtool) *
* BankEntryView.cpp: Bank Entry view widget. *
* *
* Copyright (c) 2018-2022 by David Korth. *
* Copyright (c) 2018-2023 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -146,7 +146,7 @@ QString BankEntryViewPrivate::formatFileSize(quint64 size)
// Should not get here...
assert(!"Invalid code path.");
return QLatin1String("QUACK");
return QStringLiteral("QUACK");
}
/**
@ -179,21 +179,20 @@ QString BankEntryViewPrivate::sigStatusString(
switch (sig_status) {
default:
case RVL_SigStatus_Unknown:
status += QLatin1String(" (") +
QString::number(sig_status) +
QChar(L')');
status += QStringLiteral(" (%1)")
.arg(static_cast<int>(sig_status));
break;
case RVL_SigStatus_OK:
status += QLatin1String(" (") +
BankEntryView::tr("realsigned") + QChar(L')');
status += QStringLiteral(" (%1)")
.arg(BankEntryView::tr("realsigned"));
break;
case RVL_SigStatus_Invalid:
status += QLatin1String(" (") +
BankEntryView::tr("INVALID") + QChar(L')');
status += QStringLiteral(" (%1)")
.arg(BankEntryView::tr("INVALID"));
break;
case RVL_SigStatus_Fake:
status += QLatin1String(" (") +
BankEntryView::tr("fakesigned") + QChar(L')');
status += QStringLiteral(" (%1)")
.arg(BankEntryView::tr("fakesigned"));
break;
}
}
@ -265,9 +264,8 @@ void BankEntryViewPrivate::updateWidgetDisplay(void)
.trimmed().toHtmlEscaped();
if (bankEntry->is_deleted) {
// Indicate that this bank is deleted.
s_title += QLatin1String("<br/><b>");
s_title += BankEntryView::tr("[DELETED]");
s_title += QLatin1String("</b>");
s_title += QStringLiteral("<br/><b>%1</b>")
.arg(BankEntryView::tr("[DELETED]"));
}
ui.lblGameTitle->setText(s_title);
ui.lblGameTitle->show();
@ -388,29 +386,29 @@ void BankEntryViewPrivate::updateWidgetDisplay(void)
// NOTE: Not translatable. These strings are based on
// the strings from the original AppLoader.
// NOTE: lblAppLoader uses RichText.
QString aplerr = QLatin1String("<b>APPLOADER ERROR >>></b><br>\n");
QString aplerr = QStringLiteral("<b>APPLOADER ERROR >>></b><br>\n");
switch (bankEntry->aplerr) {
default:
aplerr += QString::fromLatin1("Unknown (%1)")
aplerr += QStringLiteral("Unknown (%1)")
.arg(bankEntry->aplerr);
break;
// TODO: Get values for these errors.
case APLERR_FSTLENGTH:
aplerr += QString::fromLatin1("FSTLength(%1) in BB2 is greater than FSTMaxLength(%2).")
aplerr += QStringLiteral("FSTLength(%1) in BB2 is greater than FSTMaxLength(%2).")
.arg(bankEntry->aplerr_val[0])
.arg(bankEntry->aplerr_val[1]);
break;
case APLERR_DEBUGMONSIZE_UNALIGNED:
aplerr += QString::fromLatin1("Debug monitor size (%1) should be a multiple of 32.")
aplerr += QStringLiteral("Debug monitor size (%1) should be a multiple of 32.")
.arg(bankEntry->aplerr_val[0]);
break;
case APLERR_SIMMEMSIZE_UNALIGNED:
aplerr += QString::fromLatin1("Simulated memory size (%1) should be a multiple of 32.")
aplerr += QStringLiteral("Simulated memory size (%1) should be a multiple of 32.")
.arg(bankEntry->aplerr_val[0]);
break;
case APLERR_PHYSMEMSIZE_MINUS_SIMMEMSIZE_NOT_GT_DEBUGMONSIZE:
aplerr += QString::fromLatin1("[Physical memory size(0x%1)] - "
aplerr += QStringLiteral("[Physical memory size(0x%1)] - "
"[Console simulated memory size(0x%2)] "
"must be greater than debug monitor size(0x%3).")
.arg(bankEntry->aplerr_val[0], 0, 16)
@ -418,18 +416,18 @@ void BankEntryViewPrivate::updateWidgetDisplay(void)
.arg(bankEntry->aplerr_val[2], 0, 16);
break;
case APLERR_SIMMEMSIZE_NOT_LE_PHYSMEMSIZE:
aplerr += QString::fromLatin1("Physical memory size is 0x%1 bytes."
aplerr += QStringLiteral("Physical memory size is 0x%1 bytes."
"Console simulated memory size (0x%2) must be smaller than "
"or equal to the Physical memory size.")
.arg(bankEntry->aplerr_val[0], 0, 16)
.arg(bankEntry->aplerr_val[1], 0, 16);
break;
case APLERR_ILLEGAL_FST_ADDRESS:
aplerr += QString::fromLatin1("Illegal FST destination address! (0x%1)")
aplerr += QStringLiteral("Illegal FST destination address! (0x%1)")
.arg(bankEntry->aplerr_val[0], 0, 16);
break;
case APLERR_DOL_EXCEEDS_SIZE_LIMIT:
aplerr += QString::fromLatin1("Total size of text/data sections of the dol file are too big (%1(0x%2) bytes). "
aplerr += QStringLiteral("Total size of text/data sections of the dol file are too big (%1(0x%2) bytes). "
"Currently the limit is set as %3(0x%4) bytes.")
.arg(bankEntry->aplerr_val[0])
.arg(bankEntry->aplerr_val[0], 0, 16, QChar(L'0'))
@ -437,23 +435,23 @@ void BankEntryViewPrivate::updateWidgetDisplay(void)
.arg(bankEntry->aplerr_val[1], 0, 16, QChar(L'0'));
break;
case APLERR_DOL_ADDR_LIMIT_RETAIL_EXCEEDED:
aplerr += QString::fromLatin1("One of the sections in the dol file exceeded its boundary. "
aplerr += QStringLiteral("One of the sections in the dol file exceeded its boundary. "
"All the sections should not exceed 0x%1 (production mode).<br>\n"
"<i>*** NOTE: This disc will still boot on devkits.</i>")
.arg(bankEntry->aplerr_val[0], 0, 16, QChar(L'0'));
break;
case APLERR_DOL_ADDR_LIMIT_DEBUG_EXCEEDED:
aplerr += QString::fromLatin1("One of the sections in the dol file exceeded its boundary. "
aplerr += QStringLiteral("One of the sections in the dol file exceeded its boundary. "
"All the sections should not exceed 0x%1 (development mode).")
.arg(bankEntry->aplerr_val[0], 0, 16, QChar(L'0'));
break;
case APLERR_DOL_TEXTSEG2BIG:
aplerr += QString::fromLatin1("Too big text segment! (0x%1 - 0x%2)")
aplerr += QStringLiteral("Too big text segment! (0x%1 - 0x%2)")
.arg(bankEntry->aplerr_val[0], 0, 16)
.arg(bankEntry->aplerr_val[1], 0, 16);
break;
case APLERR_DOL_DATASEG2BIG:
aplerr += QString::fromLatin1("Too big data segment! (0x%1 - 0x%2)")
aplerr += QStringLiteral("Too big data segment! (0x%1 - 0x%2)")
.arg(bankEntry->aplerr_val[0], 0, 16)
.arg(bankEntry->aplerr_val[1], 0, 16);
break;

View File

@ -2,7 +2,7 @@
* RVT-H Tool (qrvthtool) *
* LanguageMenu.cpp: QMenu subclass for selecting a UI language. *
* *
* Copyright (c) 2012-2022 by David Korth. *
* Copyright (c) 2012-2023 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -156,9 +156,8 @@ QIcon LanguageMenuPrivate::iconForLocale(const QString &locale)
QStringList locale_parts = locale.split(QChar(L'_'), QT_SKIPEMPTYPARTS);
QIcon flagIcon;
for (int i = (locale_parts.size() - 1); i >= 0; i--) {
QString filename = QLatin1String(":/flags/") +
locale_parts.at(i).toLower() +
QLatin1String(".png");
QString filename = QStringLiteral(":/flags/%1.png")
.arg(locale_parts.at(i).toLower());
// TODO: Optimize by getting rid of QFile::exists()?
if (QFile::exists(filename)) {
flagIcon = QIcon(filename);

View File

@ -2,7 +2,7 @@
* RVT-H Tool (qrvthtool) *
* MessageWidget.hpp: Message widget. *
* *
* Copyright (c) 2014-2019 by David Korth. *
* Copyright (c) 2014-2023 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -98,14 +98,14 @@ MessageWidgetPrivate::~MessageWidgetPrivate()
void MessageWidgetPrivate::Ui_MessageWidget::setupUi(QWidget *MessageWidget)
{
if (MessageWidget->objectName().isEmpty())
MessageWidget->setObjectName(QLatin1String("MessageWidget"));
MessageWidget->setObjectName(QStringLiteral("MessageWidget"));
hboxMain = new QHBoxLayout(MessageWidget);
hboxMain->setContentsMargins(2, 2, 2, 2);
hboxMain->setObjectName(QLatin1String("hboxMain"));
hboxMain->setObjectName(QStringLiteral("hboxMain"));
content = new QFrame(MessageWidget);
content->setObjectName(QLatin1String("content"));
content->setObjectName(QStringLiteral("content"));
QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
sizePolicy.setHorizontalStretch(0);
sizePolicy.setVerticalStretch(0);
@ -116,10 +116,10 @@ void MessageWidgetPrivate::Ui_MessageWidget::setupUi(QWidget *MessageWidget)
hboxFrame = new QHBoxLayout(content);
hboxFrame->setContentsMargins(0, 0, 0, 0);
hboxFrame->setObjectName(QLatin1String("hboxFrame"));
hboxFrame->setObjectName(QStringLiteral("hboxFrame"));
lblIcon = new QLabel(content);
lblIcon->setObjectName(QLatin1String("lblIcon"));
lblIcon->setObjectName(QStringLiteral("lblIcon"));
QSizePolicy sizePolicy1(QSizePolicy::Fixed, QSizePolicy::Fixed);
sizePolicy1.setHorizontalStretch(0);
sizePolicy1.setVerticalStretch(0);
@ -131,7 +131,7 @@ void MessageWidgetPrivate::Ui_MessageWidget::setupUi(QWidget *MessageWidget)
hboxFrame->setAlignment(lblIcon, Qt::AlignTop);
lblMessage = new QLabel(content);
lblMessage->setObjectName(QLatin1String("lblMessage"));
lblMessage->setObjectName(QStringLiteral("lblMessage"));
lblMessage->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop);
lblMessage->setTextInteractionFlags(Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse);
@ -139,13 +139,13 @@ void MessageWidgetPrivate::Ui_MessageWidget::setupUi(QWidget *MessageWidget)
hboxFrame->setAlignment(lblMessage, Qt::AlignTop);
btnDismiss = new QToolButton(content);
btnDismiss->setObjectName(QLatin1String("btnDismiss"));
btnDismiss->setObjectName(QStringLiteral("btnDismiss"));
btnDismiss->setFocusPolicy(Qt::NoFocus);
btnDismiss->setStyleSheet(QLatin1String("margin: 0px; padding: 0px;"));
btnDismiss->setStyleSheet(QStringLiteral("margin: 0px; padding: 0px;"));
// Icon for the "Dismiss" button.
if (QIcon::hasThemeIcon(QLatin1String("dialog-close"))) {
btnDismiss->setIcon(QIcon::fromTheme(QLatin1String("dialog-close")));
if (QIcon::hasThemeIcon(QStringLiteral("dialog-close"))) {
btnDismiss->setIcon(QIcon::fromTheme(QStringLiteral("dialog-close")));
} else {
btnDismiss->setIcon(MessageWidget->style()->standardIcon(
QStyle::SP_DialogCloseButton, nullptr, btnDismiss));

View File

@ -2,7 +2,7 @@
* RVT-H Tool (qrvthtool) *
* MessageWidgetStack.hpp: Message widget stack. *
* *
* Copyright (c) 2014-2022 by David Korth. *
* Copyright (c) 2014-2023 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -62,10 +62,10 @@ MessageWidgetStackPrivate::~MessageWidgetStackPrivate()
void MessageWidgetStackPrivate::Ui_MessageWidgetStack::setupUi(QWidget *MessageWidgetStack)
{
if (MessageWidgetStack->objectName().isEmpty())
MessageWidgetStack->setObjectName(QLatin1String("MessageWidgetStack"));
MessageWidgetStack->setObjectName(QStringLiteral("MessageWidgetStack"));
vboxMain = new QVBoxLayout(MessageWidgetStack);
vboxMain->setObjectName(QLatin1String("vboxMain"));
vboxMain->setObjectName(QStringLiteral("vboxMain"));
vboxMain->setContentsMargins(0, 0, 0, 0);
QMetaObject::connectSlotsByName(MessageWidgetStack);

View File

@ -2,7 +2,7 @@
* RVT-H Tool (qrvthtool) *
* AboutDialog.cpp: About Dialog. *
* *
* Copyright (c) 2013-2022 by David Korth. *
* Copyright (c) 2013-2023 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -29,8 +29,8 @@
// Linebreaks
#define BR "<br/>\n"
#define BRBR "<br/>\n<br/>\n"
#define ql1BR QLatin1String(BR)
#define ql1BRBR QLatin1String(BRBR)
#define ql1BR QStringLiteral(BR)
#define ql1BRBR QStringLiteral(BRBR)
/** AboutDialogPrivate **/
@ -83,15 +83,14 @@ void AboutDialogPrivate::initAboutDialogText(void)
// Build the program title text.
QString sPrgTitle;
sPrgTitle.reserve(4096);
sPrgTitle += QLatin1String("<b>") +
QApplication::applicationDisplayName() +
QLatin1String("</b>" BR) +
AboutDialog::tr("Version %1")
.arg(QApplication::applicationVersion());
sPrgTitle += QStringLiteral("<b>%1</b>" BR)
.arg(QApplication::applicationDisplayName());
sPrgTitle += AboutDialog::tr("Version %1")
.arg(QApplication::applicationVersion());
#ifdef RP_GIT_VERSION
sPrgTitle += QString::fromUtf8(BR RP_GIT_VERSION);
sPrgTitle += QStringLiteral(BR RP_GIT_VERSION);
#ifdef RP_GIT_DESCRIBE
sPrgTitle += QString::fromUtf8(BR RP_GIT_DESCRIBE);
sPrgTitle += QStringLiteral(BR RP_GIT_DESCRIBE);
#endif /* RP_GIT_DESCRIBE */
#endif /* RP_GIT_DESCRIBE */
@ -108,11 +107,11 @@ void AboutDialogPrivate::initAboutDialogText(void)
// Qt Designer's QScrollArea implementation is horribly broken.
// Also, this has to be done after the labels are set, because
// QScrollArea is kinda dumb.
const QString css = QLatin1String(
const QString css = QStringLiteral(
"QScrollArea, QLabel { background-color: transparent; }");
QScrollArea *const scrlCredits = new QScrollArea();
scrlCredits->setObjectName(QLatin1String("scrlCredits"));
scrlCredits->setObjectName(QStringLiteral("scrlCredits"));
scrlCredits->setFrameShape(QFrame::NoFrame);
scrlCredits->setFrameShadow(QFrame::Plain);
scrlCredits->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
@ -123,7 +122,7 @@ void AboutDialogPrivate::initAboutDialogText(void)
ui.vboxCredits->addWidget(scrlCredits);
QScrollArea *const scrlLibraries = new QScrollArea();
scrlLibraries->setObjectName(QLatin1String("scrlLibraries"));
scrlLibraries->setObjectName(QStringLiteral("scrlLibraries"));
scrlLibraries->setFrameShape(QFrame::NoFrame);
scrlLibraries->setFrameShadow(QFrame::Plain);
scrlLibraries->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
@ -134,7 +133,7 @@ void AboutDialogPrivate::initAboutDialogText(void)
ui.vboxLibraries->addWidget(scrlLibraries);
QScrollArea *const scrlSupport = new QScrollArea();
scrlSupport->setObjectName(QLatin1String("setObjectName"));
scrlSupport->setObjectName(QStringLiteral("setObjectName"));
scrlSupport->setFrameShape(QFrame::NoFrame);
scrlSupport->setFrameShadow(QFrame::Plain);
scrlSupport->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
@ -157,13 +156,13 @@ void AboutDialogPrivate::initAboutDialogText(void)
*/
void AboutDialogPrivate::initCreditsTab(void)
{
const QLatin1String sIndent("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
const QString sIndent(QStringLiteral("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"));
static const QChar chrBullet(0x2022); // U+2022: BULLET
QString credits;
credits.reserve(4096);
credits += QLatin1String(
"Copyright (c) 2018-2022 by David Korth." BR
credits += QStringLiteral(
"Copyright (c) 2018-2023 by David Korth." BR
"This program is <b>NOT</b> licensed or endorsed by Nintendo Co., Ltd.");
enum CreditType_t {
@ -195,36 +194,35 @@ void AboutDialogPrivate::initCreditsTab(void)
creditsData->type != lastCreditType)
{
// New credit type.
credits += QLatin1String(BRBR "<b>");
QString creditType;
switch (creditsData->type) {
case CT_TESTERS:
credits += AboutDialog::tr("Testers:");
creditType = AboutDialog::tr("Testers:");
break;
case CT_TRANSLATORS:
credits += AboutDialog::tr("UI Translators:");
creditType = AboutDialog::tr("UI Translators:");
default:
break;
}
credits += QLatin1String("</b>");
credits += QStringLiteral(BRBR "<b>%1</b>")
.arg(creditType);
}
// Append the contributor's name.
credits += ql1BRBR + sIndent + chrBullet + QChar(L' ');
if (creditsData->url) {
credits += QLatin1String("<a href='") +
QLatin1String(creditsData->url) +
QLatin1String("'>");
credits += QStringLiteral("<a href='%1'>")
.arg(QLatin1String(creditsData->url));
}
credits += QString::fromUtf8(creditsData->name);
if (creditsData->url) {
credits += QLatin1String("</a>");
credits += QStringLiteral("</a>");
}
if (creditsData->sub) {
credits += QLatin1String(" (") +
QLatin1String(creditsData->sub) +
QChar(L')');
credits += QStringLiteral(" (%1)")
.arg(QLatin1String(creditsData->sub));
}
}
@ -257,25 +255,25 @@ void AboutDialogPrivate::initLibrariesTab(void)
sLibraries.reserve(4096);
// Icon set.
sLibraries = QLatin1String(
sLibraries = QStringLiteral(
"Icon set is based on KDE's Oxygen icons. (5.46.0)" BR
"Copyright (C) 2005-2018 by David Vignoni." BR);
sLibraries += sLicenses.arg(QLatin1String("CC BY-SA 3.0, GNU LGPL v2.1+"));
sLibraries += sLicenses.arg(QStringLiteral("CC BY-SA 3.0, GNU LGPL v2.1+"));
// TODO: Don't show compiled-with version if the same as in-use version?
/** Qt **/
sLibraries += ql1BRBR;
QString qtVersion = QLatin1String("Qt ") + QLatin1String(qVersion());
QString qtVersion = QStringLiteral("Qt %1").arg(QLatin1String(qVersion()));
#ifdef QT_IS_STATIC
sLibraries += sIntCopyOf.arg(qtVersion);
#else
QString qtVersionCompiled = QLatin1String("Qt " QT_VERSION_STR);
QString qtVersionCompiled = QStringLiteral("Qt " QT_VERSION_STR);
sLibraries += sCompiledWith.arg(qtVersionCompiled) + ql1BR;
sLibraries += sUsingDll.arg(qtVersion);
#endif /* QT_IS_STATIC */
sLibraries += QLatin1String(BR "Copyright (C) 1995-2019 The Qt Company Ltd. and/or its subsidiaries." BR);
sLibraries += sLicenses.arg(QLatin1String("GNU LGPL v2.1+, GNU GPL v2+"));
sLibraries += QStringLiteral(BR "Copyright (C) 1995-2019 The Qt Company Ltd. and/or its subsidiaries." BR);
sLibraries += sLicenses.arg(QStringLiteral("GNU LGPL v2.1+, GNU GPL v2+"));
/** nettle **/
sLibraries += ql1BRBR;
@ -291,7 +289,7 @@ void AboutDialogPrivate::initLibrariesTab(void)
nettle_minor = 0; // NOTE: handle as "2.x"
#endif
const QString nettleVersion(QLatin1String("GNU Nettle %1.%2"));
const QString nettleVersion(QStringLiteral("GNU Nettle %1.%2"));
QString nettleVersionCompiled = nettleVersion.arg(nettle_major);
#ifdef HAVE_NETTLE_3
nettleVersionCompiled = nettleVersionCompiled.arg(nettle_minor);
@ -312,19 +310,19 @@ void AboutDialogPrivate::initLibrariesTab(void)
#ifdef HAVE_NETTLE_3
if (nettle_minor >= 1) {
sLibraries += QString::fromUtf8("Copyright (C) 2001-2022 Niels Möller." BR
sLibraries += QStringLiteral("Copyright (C) 2001-2022 Niels Möller." BR
"<a href='https://www.lysator.liu.se/~nisse/nettle/'>https://www.lysator.liu.se/~nisse/nettle/</a>" BR);
} else {
sLibraries += QString::fromUtf8("Copyright (C) 2001-2014 Niels Möller." BR
sLibraries += QStringLiteral("Copyright (C) 2001-2014 Niels Möller." BR
"<a href='https://www.lysator.liu.se/~nisse/nettle/'>https://www.lysator.liu.se/~nisse/nettle/</a>" BR);
}
sLibraries += sLicenses.arg(QLatin1String("GNU LGPL v3+, GNU GPL v2+"));
sLibraries += sLicenses.arg(QStringLiteral("GNU LGPL v3+, GNU GPL v2+"));
#else /* !HAVE_NETTLE_3 */
sLibraries += sCompiledWith.arg(QLatin1String("GNU Nettle 2.x"));
sLibraries += QString::fromUtf8("\n"
sLibraries += sCompiledWith.arg(QStringLiteral("GNU Nettle 2.x"));
sLibraries += QStringLiteral("\n"
"Copyright (C) 2001-2013 Niels Möller.\n"
"<a href='https://www.lysator.liu.se/~nisse/nettle/'>https://www.lysator.liu.se/~nisse/nettle/</a>" BR;
sLibraries += sLicense.arg(QLatin1String("GNU LGPL v2.1+"));
sLibraries += sLicense.arg(QStringLiteral("GNU LGPL v2.1+"));
#endif /* HAVE_NETTLE_3 */
/** getopt_msvc (TODO) **/
@ -360,13 +358,8 @@ void AboutDialogPrivate::initSupportTab(void)
for (const supportSite_t *supportSite = &supportSites[0];
supportSite->name != nullptr; supportSite++)
{
QString siteUrl = QLatin1String(supportSite->url);
QString siteName = QLatin1String(supportSite->name);
QString siteUrlHtml = QLatin1String("<a href=\"") +
siteUrl +
QLatin1String("\">") +
siteName +
QLatin1String("</a>");
QString siteUrlHtml = QStringLiteral("<a href=\"%1\">%2</a>")
.arg(QLatin1String(supportSite->url), QLatin1String(supportSite->name));
sSupport += chrBullet + QChar(L' ') + siteUrlHtml + ql1BR;
}
@ -375,8 +368,7 @@ void AboutDialogPrivate::initSupportTab(void)
sSupport += ql1BR +
AboutDialog::tr(
"You can also email the developer directly:") +
ql1BR + chrBullet + QChar(L' ') +
QLatin1String(
ql1BR + chrBullet + QChar(L' ') + QStringLiteral(
"<a href=\"mailto:gerbilsoft@gerbilsoft.com\">"
"gerbilsoft@gerbilsoft.com"
"</a>");

View File

@ -435,8 +435,8 @@ QString QRvtHToolWindowPrivate::getDisplayFilename(const QString &filename)
#ifdef _WIN32
// Does the path start with "\\\\.\\PhysicalDriveN"?
// FIXME: How does Qt's native slashes interact with this?
if (rfn.startsWith(QLatin1String("\\\\.\\PhysicalDrive"), Qt::CaseInsensitive) ||
rfn.startsWith(QLatin1String("//./PhysicalDrive"), Qt::CaseInsensitive))
if (rfn.startsWith(QStringLiteral("\\\\.\\PhysicalDrive"), Qt::CaseInsensitive) ||
rfn.startsWith(QStringLiteral("//./PhysicalDrive"), Qt::CaseInsensitive))
{
// Physical drive.
// TODO: Make sure it's all backslashes.
@ -444,7 +444,7 @@ QString QRvtHToolWindowPrivate::getDisplayFilename(const QString &filename)
}
#else /* !_WIN32 */
// Does the path start with "/dev/"?
if (rfn.startsWith(QLatin1String("/dev/"))) {
if (rfn.startsWith(QStringLiteral("/dev/"))) {
// Physical drive.
removeDir = false;
}
@ -476,7 +476,7 @@ void QRvtHToolWindowPrivate::initToolbar(void)
// Recryption key.
ui.toolBar->insertSeparator(ui.actionAbout);
lblRecryptionKey = new QLabel(QRvtHToolWindow::tr("Recryption Key:"), q);
lblRecryptionKey->setObjectName(QLatin1String("lblRecryptionKey"));
lblRecryptionKey->setObjectName(QStringLiteral("lblRecryptionKey"));
lblRecryptionKey->setToolTip(QRvtHToolWindow::tr(
"Set the encryption key to use when extracting disc images.\n"
"Default is None, which retains the original key."));
@ -484,7 +484,7 @@ void QRvtHToolWindowPrivate::initToolbar(void)
ui.toolBar->insertWidget(ui.actionAbout, lblRecryptionKey);
cboRecryptionKey = new QComboBox(q);
cboRecryptionKey->setObjectName(QLatin1String("cboRecryptionKey"));
cboRecryptionKey->setObjectName(QStringLiteral("cboRecryptionKey"));
cboRecryptionKey->addItem(QString(), -1); // None
cboRecryptionKey->addItem(QString(), RVL_CryptoType_Retail); // Retail (fakesigned)
cboRecryptionKey->addItem(QString(), RVL_CryptoType_Korean); // Korean (fakesigned)
@ -571,7 +571,7 @@ QRvtHToolWindow::QRvtHToolWindow(QWidget *parent)
// the Aero theme on Windows Vista and 7.
#if 0
this->Ui_QRvtHToolWindow::menuBar->setStyleSheet(
QLatin1String("QMenuBar { border: none }"));
QStringLiteral("QMenuBar { border: none }"));
#endif
#endif
@ -610,20 +610,20 @@ QRvtHToolWindow::QRvtHToolWindow(QWidget *parent)
/** Progress bar widgets **/
d->lblMessage = new QLabel();
d->lblMessage->setObjectName(QLatin1String("lblMessage"));
d->lblMessage->setObjectName(QStringLiteral("lblMessage"));
d->lblMessage->setTextFormat(Qt::PlainText);
d->ui.statusBar->addWidget(d->lblMessage, 1);
// TODO: Handle "Escape" keypresses as cancel?
// Disabling focus to prevent it from being highlighted.
d->btnCancel = new QToolButton();
d->btnCancel->setObjectName(QLatin1String("btnCancel"));
d->btnCancel->setObjectName(QStringLiteral("btnCancel"));
d->btnCancel->setVisible(false);
d->btnCancel->setFocusPolicy(Qt::NoFocus);
d->btnCancel->setToolTip(tr("Cancel the current operation."));
d->btnCancel->setStyleSheet(QLatin1String("margin: 0px; padding: 0px;"));
if (QIcon::hasThemeIcon(QLatin1String("dialog-close"))) {
d->btnCancel->setIcon(QIcon::fromTheme(QLatin1String("dialog-close")));
d->btnCancel->setStyleSheet(QStringLiteral("margin: 0px; padding: 0px;"));
if (QIcon::hasThemeIcon(QStringLiteral("dialog-close"))) {
d->btnCancel->setIcon(QIcon::fromTheme(QStringLiteral("dialog-close")));
} else {
d->btnCancel->setIcon(style()->standardIcon(
QStyle::SP_DialogCloseButton, nullptr, d->btnCancel));
@ -633,7 +633,7 @@ QRvtHToolWindow::QRvtHToolWindow(QWidget *parent)
d->ui.statusBar->addPermanentWidget(d->btnCancel, 1);
d->progressBar = new QProgressBar();
d->progressBar->setObjectName(QLatin1String("progressBar"));
d->progressBar->setObjectName(QStringLiteral("progressBar"));
d->progressBar->setVisible(false);
d->ui.statusBar->addPermanentWidget(d->progressBar, 1);
@ -737,17 +737,17 @@ void QRvtHToolWindow::openRvtH(const QString &filename, bool isDevice)
case NHCD_STATUS_UNKNOWN:
case NHCD_STATUS_MISSING:
message = tr("NHCD table is missing.");
d->nhcd_status = QLatin1String("!NHCD");
d->nhcd_status = QStringLiteral("!NHCD");
break;
case NHCD_STATUS_HAS_MBR:
message = tr("This appears to be a PC MBR-partitioned HDD.");
d->nhcd_status = QLatin1String("MBR?");
d->nhcd_status = QStringLiteral("MBR?");
break;
case NHCD_STATUS_HAS_GPT:
message = tr("This appears to be a PC GPT-partitioned HDD.");
d->nhcd_status = QLatin1String("GPT?");
d->nhcd_status = QStringLiteral("GPT?");
break;
}
@ -960,20 +960,20 @@ void QRvtHToolWindow::on_actionOpenDiskImage_triggered(void)
// On Linux, Qt shows an extra space after the filter name, since
// it doesn't show the extension. Not sure about Windows...
const QString allSupportedFilter = tr("All Supported Files") +
QLatin1String(" (*.img *.bin *.gcm *.wbfs *.ciso *.cso *.iso)");
QStringLiteral(" (*.img *.bin *.gcm *.wbfs *.ciso *.cso *.iso)");
const QString hddFilter = tr("RVT-H Reader Disk Image Files") +
QLatin1String(" (*.img *.bin)");
QStringLiteral(" (*.img *.bin)");
const QString gcmFilter = tr("GameCube/Wii Disc Image Files") +
QLatin1String(" (*.gcm *.wbfs *.ciso *.cso *.iso)");
const QString allFilter = tr("All Files") + QLatin1String(" (*)");
QStringLiteral(" (*.gcm *.wbfs *.ciso *.cso *.iso)");
const QString allFilter = tr("All Files") + QStringLiteral(" (*)");
// NOTE: Using a QFileDialog instead of QFileDialog::getOpenFileName()
// causes a non-native appearance on Windows. Hence, we should use
// QFileDialog::getOpenFileName().
const QString filters =
allSupportedFilter + QLatin1String(";;") +
hddFilter + QLatin1String(";;") +
gcmFilter + QLatin1String(";;") +
allSupportedFilter + QStringLiteral(";;") +
hddFilter + QStringLiteral(";;") +
gcmFilter + QStringLiteral(";;") +
allFilter;
// Get the filename.
@ -1001,7 +1001,7 @@ void QRvtHToolWindow::on_actionOpenDevice_triggered(void)
{
// Prompt the user to select a device.
SelectDeviceDialog *const selectDeviceDialog = new SelectDeviceDialog();
selectDeviceDialog->setObjectName(QLatin1String("selectDeviceDialog"));
selectDeviceDialog->setObjectName(QStringLiteral("selectDeviceDialog"));
int ret = selectDeviceDialog->exec();
if (ret == QDialog::Accepted) {
QString deviceName = selectDeviceDialog->deviceName();
@ -1050,7 +1050,7 @@ void QRvtHToolWindow::on_actionAbout_triggered(void)
}
d->aboutDialog = new AboutDialog(this);
d->aboutDialog->setObjectName(QLatin1String("aboutDialog"));
d->aboutDialog->setObjectName(QStringLiteral("aboutDialog"));
QObject::connect(d->aboutDialog, &QObject::destroyed,
[d](QObject *obj) { Q_UNUSED(obj); d->aboutDialog = nullptr; });
d->aboutDialog->show();
@ -1086,8 +1086,8 @@ void QRvtHToolWindow::on_actionExtract_triggered(void)
tr("Extract Disc Image"),
QString(), // Default filename (TODO)
// TODO: Remove extra space from the filename filter?
tr("GameCube/Wii Disc Images") + QLatin1String(" (*.gcm);;") +
tr("All Files") + QLatin1String(" (*)"));
tr("GameCube/Wii Disc Images") + QStringLiteral(" (*.gcm);;") +
tr("All Files") + QStringLiteral(" (*)"));
if (filename.isEmpty())
return;
@ -1118,9 +1118,9 @@ void QRvtHToolWindow::on_actionExtract_triggered(void)
// Create the worker thread and object.
d->workerThread = new QThread(this);
d->workerThread->setObjectName(QLatin1String("workerThread"));
d->workerThread->setObjectName(QStringLiteral("workerThread"));
d->workerObject = new WorkerObject();
d->workerObject->setObjectName(QLatin1String("workerObject"));
d->workerObject->setObjectName(QStringLiteral("workerObject"));
d->workerObject->moveToThread(d->workerThread);
d->workerObject->setRvtH(d->rvth);
d->workerObject->setBank(bank);
@ -1170,8 +1170,8 @@ void QRvtHToolWindow::on_actionImport_triggered(void)
tr("Import Disc Image"),
QString(), // Default filename (TODO)
// TODO: Remove extra space from the filename filter?
tr("GameCube/Wii Disc Images") + QLatin1String(" (*.gcm *.wbfs *.ciso);;") +
tr("All Files") + QLatin1String(" (*)"));
tr("GameCube/Wii Disc Images") + QStringLiteral(" (*.gcm *.wbfs *.ciso);;") +
tr("All Files") + QStringLiteral(" (*)"));
if (filename.isEmpty())
return;
@ -1196,9 +1196,9 @@ void QRvtHToolWindow::on_actionImport_triggered(void)
// Create the worker thread and object.
d->workerThread = new QThread(this);
d->workerThread->setObjectName(QLatin1String("workerThread"));
d->workerThread->setObjectName(QStringLiteral("workerThread"));
d->workerObject = new WorkerObject();
d->workerObject->setObjectName(QLatin1String("workerObject"));
d->workerObject->setObjectName(QStringLiteral("workerObject"));
d->workerObject->moveToThread(d->workerThread);
d->workerObject->setRvtH(d->rvth);
d->workerObject->setBank(bank);

View File

@ -2,7 +2,7 @@
* RVT-H Tool (qrvthtool) *
* SelectDeviceDialog.hpp: Select an RVT-H Reader device. *
* *
* Copyright (c) 2018-2022 by David Korth. *
* Copyright (c) 2018-2023 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -268,9 +268,8 @@ void SelectDeviceDialogPrivate::refreshDeviceList(void)
QString s_err;
if (err != 0) {
// TODO: Enable rich text for the message and bold the first line?
s_err = QLatin1String("*** ") +
SelectDeviceDialog::tr("ERROR enumerating RVT-H Reader devices:") +
QLatin1String(" ***\n");
s_err = QStringLiteral("*** %1 ***\n")
.arg(SelectDeviceDialog::tr("ERROR enumerating RVT-H Reader devices:"));
// TODO: Translate strerror().
s_err += QString::fromUtf8(strerror(err));
if (err == EACCES) {
@ -283,10 +282,10 @@ void SelectDeviceDialogPrivate::refreshDeviceList(void)
osvi.dwMajorVersion = 0;
}
if (osvi.dwMajorVersion >= 6) {
s_err += QLatin1String("\n\n") +
s_err += QStringLiteral("\n\n") +
SelectDeviceDialog::tr("Try rerunning qrvthtool as Administrator.");
} else {
s_err += QLatin1String("\n\n") +
s_err += QStringLiteral("\n\n") +
SelectDeviceDialog::tr("Try rerunning qrvthtool using an Administrator account.");
}
#else /* _WIN32 */
@ -375,9 +374,9 @@ SelectDeviceDialog::SelectDeviceDialog(QWidget *parent)
// Change the "Reset" button to "Refresh".
QPushButton *const btnRefresh = d->ui.buttonBox->button(QDialogButtonBox::Reset);
btnRefresh->setObjectName(QLatin1String("btnRefresh"));
btnRefresh->setObjectName(QStringLiteral("btnRefresh"));
btnRefresh->setText(tr("&Refresh"));
btnRefresh->setIcon(QIcon::fromTheme(QLatin1String("view-refresh")));
btnRefresh->setIcon(QIcon::fromTheme(QStringLiteral("view-refresh")));
connect(btnRefresh, SIGNAL(clicked()), this, SLOT(refresh()));
// Set the device list's decoration position.