Construct QString more efficiently

This commit is contained in:
Chocobo1
2020-03-22 18:35:16 +08:00
parent 2c23840947
commit 7de8a4d6e0
25 changed files with 60 additions and 61 deletions

View File

@@ -587,7 +587,7 @@ int Application::exec(const QStringList &params)
#ifndef DISABLE_WEBUI
Preferences *const pref = Preferences::instance();
// Display some information to the user
const QString mesg = QString("\n******** %1 ********\n").arg(tr("Information"))
const QString mesg = QString::fromLatin1("\n******** %1 ********\n").arg(tr("Information"))
+ tr("To control qBittorrent, access the Web UI at %1")
.arg(QString("http://localhost:") + QString::number(pref->getWebUiPort())) + '\n';
printf("%s", qUtf8Printable(mesg));

View File

@@ -364,7 +364,7 @@ QStringList QBtCommandLineParameters::paramList() const
// torrent paths or URLs.
if (!savePath.isEmpty())
result.append(QString("@savePath=%1").arg(savePath));
result.append(QLatin1String("@savePath=") + savePath);
if (addPaused == TriStateBool::True) {
result.append(QLatin1String("@addPaused=1"));
@@ -377,7 +377,7 @@ QStringList QBtCommandLineParameters::paramList() const
result.append(QLatin1String("@skipChecking"));
if (!category.isEmpty())
result.append(QString("@category=%1").arg(category));
result.append(QLatin1String("@category=") + category);
if (sequential)
result.append(QLatin1String("@sequential"));

View File

@@ -395,7 +395,7 @@ bool userAgreesWithLegalNotice()
Q_ASSERT(!pref->getAcceptedLegal());
#ifdef DISABLE_GUI
const QString eula = QString("\n*** %1 ***\n").arg(QObject::tr("Legal Notice"))
const QString eula = QString::fromLatin1("\n*** %1 ***\n").arg(QObject::tr("Legal Notice"))
+ QObject::tr("qBittorrent is a file sharing program. When you run a torrent, its data will be made available to others by means of upload. Any content you share is your sole responsibility.") + "\n\n"
+ QObject::tr("No further notices will be issued.") + "\n\n"
+ QObject::tr("Press %1 key to accept and continue...").arg("'y'") + '\n';

View File

@@ -93,8 +93,8 @@ BOOL CALLBACK straceWin::EnumModulesCB(LPCSTR ModuleName, DWORD64 BaseOfDll, PVO
EnumModulesContext* context = (EnumModulesContext*)UserContext;
mod.SizeOfStruct = sizeof(IMAGEHLP_MODULE64);
if(SymGetModuleInfo64(context->hProcess, BaseOfDll, &mod)) {
QString moduleBase = QString("0x%1").arg(BaseOfDll, 16, 16, QLatin1Char('0'));
QString line = QString("%1 %2 Image: %3")
QString moduleBase = QString::fromLatin1("0x%1").arg(BaseOfDll, 16, 16, QLatin1Char('0'));
QString line = QString::fromLatin1("%1 %2 Image: %3")
.arg(mod.ModuleName, -25)
.arg(moduleBase, -13)
.arg(mod.LoadedImageName);
@@ -102,7 +102,7 @@ BOOL CALLBACK straceWin::EnumModulesCB(LPCSTR ModuleName, DWORD64 BaseOfDll, PVO
QString pdbName(mod.LoadedPdbName);
if(!pdbName.isEmpty()) {
QString line2 = QString("%1 %2")
QString line2 = QString::fromLatin1("%1 %2")
.arg("", 35)
.arg(pdbName);
context->stream << line2 << '\n';
@@ -165,7 +165,7 @@ QString straceWin::getSourcePathAndLineNumber(HANDLE hProcess, DWORD64 addr)
}
#endif
#endif
return QString("%1 : %2").arg(path).arg(line.LineNumber);
return QString::fromLatin1("%1 : %2").arg(path).arg(line.LineNumber);
}
return QString();
@@ -296,7 +296,7 @@ const QString straceWin::getBacktrace()
sourceFile = getSourcePathAndLineNumber(hProcess, ihsf.InstructionOffset - 1);
}
else {
funcName = QString("0x%1").arg(ihsf.InstructionOffset, 8, 16, QLatin1Char('0'));
funcName = QString::fromLatin1("0x%1").arg(ihsf.InstructionOffset, 8, 16, QLatin1Char('0'));
}
SymSetContext(hProcess, &ihsf, NULL);
#ifndef __MINGW32__
@@ -304,7 +304,7 @@ const QString straceWin::getBacktrace()
SymEnumSymbols(hProcess, 0, NULL, EnumSymbolsCB, (PVOID)&params);
#endif
QString insOffset = QString("0x%1").arg(ihsf.InstructionOffset, 16, 16, QLatin1Char('0'));
QString insOffset = QString::fromLatin1("0x%1").arg(ihsf.InstructionOffset, 16, 16, QLatin1Char('0'));
QString formatLine = "#%1 %2 %3 %4";
#ifndef __MINGW32__
formatLine += "(%5)";
@@ -318,7 +318,7 @@ const QString straceWin::getBacktrace()
.arg(params.join(", "));
if (!sourceFile.isEmpty())
debugLine += QString("[ %1 ]").arg(sourceFile);
debugLine += QString::fromLatin1("[ %1 ]").arg(sourceFile);
#else
;
#endif