diff --git a/CMakeLists.txt b/CMakeLists.txt
index a5c63b78..93826bbf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -106,6 +106,7 @@ add_compile_definitions(
QT_NO_CAST_TO_ASCII
QT_NO_CAST_FROM_ASCII
QT_MESSAGELOGCONTEXT
+ QT_USE_QSTRINGBUILDER
)
find_package(Qt6
diff --git a/src/backend/backendapplication.cpp b/src/backend/backendapplication.cpp
index 3c4738ca..9d3b58c8 100755
--- a/src/backend/backendapplication.cpp
+++ b/src/backend/backendapplication.cpp
@@ -42,8 +42,8 @@ BackendApplication::~BackendApplication()
void BackendApplication::init()
{
//TODO5: find out why we are blacklisted ... for now, fake the UA
- Transfer::setDefaultUserAgent(u"Br1ckstore/" % QCoreApplication::applicationVersion()
- % u" (" + QSysInfo::prettyProductName() % u')');
+ Transfer::setDefaultUserAgent(u"Br1ckstore/" + QCoreApplication::applicationVersion()
+ + u" (" + QSysInfo::prettyProductName() + u')');
try {
BrickLink::create(QStandardPaths::writableLocation(QStandardPaths::CacheLocation));
diff --git a/src/backend/rebuilddatabase.cpp b/src/backend/rebuilddatabase.cpp
index a7974947..fada16ba 100644
--- a/src/backend/rebuilddatabase.cpp
+++ b/src/backend/rebuilddatabase.cpp
@@ -24,7 +24,6 @@
#include
#include
#include
-#include
#if defined(Q_OS_WINDOWS)
# include
@@ -130,7 +129,7 @@ int RebuildDatabase::exec()
this, &RebuildDatabase::downloadJobFinished);
if (!httpReply.isEmpty())
- return error(u"Failed to log into BrickLink:\n"_qs % QLatin1String(httpReply));
+ return error(u"Failed to log into BrickLink:\n"_qs + QLatin1String(httpReply));
}
/////////////////////////////////////////////////////////////////////////////////
@@ -363,12 +362,12 @@ bool RebuildDatabase::download()
m_downloads_failed = 0;
{ // workaround for U type
- QFile uif(path % u"items_U.txt"_qs);
+ QFile uif(path + u"items_U.txt"_qs);
uif.open(QIODevice::WriteOnly);
}
for (tptr = table; tptr->m_url; tptr++) {
- auto *f = new QSaveFile(path % QLatin1String(tptr->m_file));
+ auto *f = new QSaveFile(path + QLatin1String(tptr->m_file));
if (!f->open(QIODevice::WriteOnly)) {
m_error = QString::fromLatin1("failed to write %1: %2")
@@ -446,9 +445,9 @@ bool RebuildDatabase::downloadInventories(const std::vector &in
if (!f || !f->isOpen()) {
if (f)
- m_error = u"failed to write "_qs % f->fileName() % u": " % f->errorString();
+ m_error = u"failed to write "_qs + f->fileName() + u": " + f->errorString();
else
- m_error = u"could not get a file handle to write inventory for "_qs % QLatin1String(item->id());
+ m_error = u"could not get a file handle to write inventory for "_qs + QLatin1String(item->id());
delete f;
failed = true;
break;
diff --git a/src/bricklink/cart.cpp b/src/bricklink/cart.cpp
index 7929553b..fbd455e6 100755
--- a/src/bricklink/cart.cpp
+++ b/src/bricklink/cart.cpp
@@ -247,7 +247,7 @@ Carts::Carts(Core *core)
try {
if (!jobCompleted) {
- throw Exception(message % u": " % job->errorString());
+ throw Exception(message + u": " + job->errorString());
} else {
int invalidCount = parseSellerCart(*it, *job->data());
if (invalidCount) {
@@ -258,7 +258,7 @@ Carts::Carts(Core *core)
}
} catch (const Exception &e) {
success = false;
- message = message % u": " % e.error();
+ message = message + u": " + e.errorString();
}
emit fetchLotsFinished(*it, success, message);
@@ -290,7 +290,7 @@ Carts::Carts(Core *core)
} catch (const Exception &e) {
success = false;
- message = message % u": " % e.error();
+ message = message + u": " + e.errorString();
}
}
m_lastUpdated = QDateTime::currentDateTime();
@@ -334,7 +334,7 @@ int Carts::parseSellerCart(Cart *cart, const QByteArray &data)
double price = en_US.toDouble(priceStr.mid(4));
if (itemSeq)
- itemId = itemId % '-' % QByteArray::number(itemSeq);
+ itemId = itemId + '-' + QByteArray::number(itemSeq);
auto item = m_core->item(itemTypeId, itemId);
auto color = m_core->color(colorId);
@@ -401,7 +401,7 @@ QVector Carts::parseGlobalCart(const QByteArray &data)
cart->setLotCount(lots);
cart->setItemCount(items);
if (totalPrice.mid(2, 2) == u" $") // why does if have to be different?
- cart->setCurrencyCode(totalPrice.left(2) % u'D');
+ cart->setCurrencyCode(totalPrice.left(2) + u'D');
else
cart->setCurrencyCode(totalPrice.left(3));
cart->setTotal(totalPrice.mid(4).toDouble());
@@ -504,7 +504,7 @@ QVariant Carts::data(const QModelIndex &index, int role) const
switch (col) {
case Date: return QLocale::system().toString(cart->lastUpdated(), QLocale::ShortFormat);
case Type: return cart->domestic() ? tr("Domestic") : tr("International");
- case Store: return QString(cart->storeName() % u" (" % cart->sellerName() % u")");
+ case Store: return QString(cart->storeName() + u" (" + cart->sellerName() + u")");
case ItemCount: return QLocale::system().toString(cart->itemCount());
case LotCount: return QLocale::system().toString(cart->lotCount());
case Total: return Currency::toDisplayString(cart->total(), cart->currencyCode(), 2);
@@ -516,8 +516,8 @@ QVariant Carts::data(const QModelIndex &index, int role) const
QString cc = cart->countryCode();
flag = m_flags.value(cc);
if (flag.isNull()) {
- flag.addFile(u":/assets/flags/" % cc, { }, QIcon::Normal);
- flag.addFile(u":/assets/flags/" % cc, { }, QIcon::Selected);
+ flag.addFile(u":/assets/flags/" + cc, { }, QIcon::Normal);
+ flag.addFile(u":/assets/flags/" + cc, { }, QIcon::Selected);
m_flags.insert(cc, flag);
}
return flag;
diff --git a/src/bricklink/core.cpp b/src/bricklink/core.cpp
index 823de1df..1540f803 100755
--- a/src/bricklink/core.cpp
+++ b/src/bricklink/core.cpp
@@ -23,7 +23,6 @@
#include
#include
#include
-#include
#include
#include
#include
@@ -178,7 +177,7 @@ void Core::openUrl(Url u, const void *opt, const void *opt2)
queryTerm.remove(u')');
}
if (item->itemType()->hasColors() && color)
- queryTerm = color->name() % u' ' % queryTerm;
+ queryTerm = color->name() + u' ' + queryTerm;
query.addQueryItem(u"q"_qs, Utility::urlQueryEscape(queryTerm));
url.setQuery(query);
}
@@ -248,10 +247,10 @@ QString Core::dataFileName(QStringView fileName, const Item *item, const Color *
// please note: Qt6's qHash is incompatible
uchar hash = q5Hash(QString::fromLatin1(item->id()), 42) & 0xff;
- QString p = m_datadir % QLatin1Char(item->itemTypeId()) % u'/' % (hash < 0x10 ? u"0" : u"")
- % QString::number(hash, 16) % u'/' % QLatin1String(item->id()) % u'/'
- % (color ? QString::number(color->id()) : QString()) % (color ? u"/" : u"")
- % fileName;
+ QString p = m_datadir + QLatin1Char(item->itemTypeId()) + u'/' + (hash < 0x10 ? u"0" : u"")
+ + QString::number(hash, 16) + u'/' + QLatin1String(item->id()) + u'/'
+ + (color ? QString::number(color->id()) : QString()) + (color ? u"/" : u"")
+ + fileName;
return p;
}
@@ -793,19 +792,19 @@ QString Core::itemHtmlDescription(const Item *item, const Color *color, const QC
if (item) {
QString cs;
if (!QByteArray("MP").contains(item->itemTypeId())) {
- cs = cs % uR"( )" %
- item->itemType()->name() % uR"( )";
+ cs = cs + uR"( )" %
+ item->itemType()->name() + uR"( )";
}
if (color && color->id()) {
QColor c = color->color();
- cs = cs % uR"( )" %
- color->name() % uR"( )";
+ cs = cs + uR"( )" %
+ color->name() + uR"( )";
}
- return u"" % QLatin1String(item->id()) % u" " % cs %
- item->name() % u"";
+ return u"" + QLatin1String(item->id()) + u" " + cs %
+ item->name() + u"";
} else {
return { };
}
@@ -915,7 +914,7 @@ bool Core::applyChangeLog(const Item *&item, const Color *&color, Incomplete *in
// there are a items that changed their name multiple times, so we have to loop (e.g. 3069bpb78)
if (!item) {
- QByteArray itemTypeAndId = inc->m_itemtype_id % inc->m_item_id;
+ QByteArray itemTypeAndId = inc->m_itemtype_id + inc->m_item_id;
if (!inc->m_itemtype_name.isEmpty())
itemTypeAndId[0] = inc->m_itemtype_name.at(0).toUpper().toLatin1();
@@ -925,7 +924,7 @@ bool Core::applyChangeLog(const Item *&item, const Color *&color, Incomplete *in
break;
item = core()->item(it->toItemTypeId(), it->toItemId());
if (!item)
- itemTypeAndId = it->toItemTypeId() % it->toItemId();
+ itemTypeAndId = it->toItemTypeId() + it->toItemId();
}
}
if (!color) {
@@ -1332,13 +1331,13 @@ void Core::updatePicture(Picture *pic, bool highPriority)
QString url;
if (large) {
- url = u"https://img.bricklink.com/" % QLatin1Char(pic->item()->itemType()->id())
- % u"L/" % QLatin1String(pic->item()->id()) % u".jpg";
+ url = u"https://img.bricklink.com/" + QLatin1Char(pic->item()->itemType()->id())
+ + u"L/" + QLatin1String(pic->item()->id()) + u".jpg";
}
else {
- url = u"https://img.bricklink.com/ItemImage/" % QLatin1Char(pic->item()->itemType()->id())
- % u"N/" % QString::number(pic->color()->id()) % u'/'
- % QLatin1String(pic->item()->id()) % u".png";
+ url = u"https://img.bricklink.com/ItemImage/" + QLatin1Char(pic->item()->itemType()->id())
+ + u"N/" + QString::number(pic->color()->id()) + u'/'
+ + QLatin1String(pic->item()->id()) + u".png";
}
//qDebug() << "PIC request started for" << url;
diff --git a/src/bricklink/database.cpp b/src/bricklink/database.cpp
index eac75a10..edfb1715 100755
--- a/src/bricklink/database.cpp
+++ b/src/bricklink/database.cpp
@@ -20,7 +20,6 @@
#include
#include
#include
-#include
#include
#include "utility/stopwatch.h"
@@ -76,16 +75,16 @@ Database::Database(const QString &updateUrl, QObject *parent)
emit updateFinished(true, tr("Already up-to-date."));
setUpdateStatus(UpdateStatus::Ok);
} else if (j->isFailed()) {
- throw Exception(tr("download and decompress failed") % u":\n" % j->errorString());
+ throw Exception(tr("download and decompress failed") + u":\n" + j->errorString());
} else if (!hhc->hasValidChecksum()) {
throw Exception(tr("checksum mismatch after decompression"));
} else if (!file->commit()) {
- throw Exception(tr("saving failed") % u":\n" % file->errorString());
+ throw Exception(tr("saving failed") + u":\n" + file->errorString());
} else {
read(file->fileName());
m_etag = j->lastETag();
- QFile etagf(file->fileName() % u".etag");
+ QFile etagf(file->fileName() + u".etag");
if (etagf.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
etagf.write(m_etag.toUtf8());
etagf.close();
@@ -97,7 +96,7 @@ Database::Database(const QString &updateUrl, QObject *parent)
emit databaseReset();
} catch (const Exception &e) {
- emit updateFinished(false, tr("Could not load the new database") % u":\n" % e.error());
+ emit updateFinished(false, tr("Could not load the new database") + u":\n" + e.errorString());
setUpdateStatus(UpdateStatus::UpdateFailed);
}
});
@@ -116,7 +115,7 @@ bool Database::isUpdateNeeded() const
QString Database::defaultDatabaseName(Version version)
{
- return u"database-v" % QString::number(int(version));
+ return u"database-v" + QString::number(int(version));
}
void Database::setUpdateStatus(UpdateStatus updateStatus)
@@ -150,15 +149,15 @@ bool Database::startUpdate(bool force)
return false;
QString dbName = defaultDatabaseName();
- QString remotefile = m_updateUrl % dbName % u".lzma";
- QString localfile = core()->dataPath() % dbName;
+ QString remotefile = m_updateUrl + dbName + u".lzma";
+ QString localfile = core()->dataPath() + dbName;
if (!QFile::exists(localfile))
force = true;
if (m_etag.isEmpty()) {
QString dbfile = core()->dataPath() + Database::defaultDatabaseName();
- QFile etagf(dbfile % u".etag");
+ QFile etagf(dbfile + u".etag");
if (etagf.open(QIODevice::ReadOnly))
m_etag = QString::fromUtf8(etagf.readAll());
}
@@ -499,12 +498,12 @@ void Database::write(const QString &filename, Version version) const
check(cw.startChunk(ChunkId('C','H','G','L'), 1));
ds << quint32(m_itemChangelog.size() + m_colorChangelog.size());
for (const ItemChangeLogEntry &e : m_itemChangelog) {
- ds << static_cast("\x03\t" % QByteArray(1, e.fromItemTypeId()) % '\t' % e.fromItemId()
- % '\t' % e.toItemTypeId() % '\t' % e.toItemId());
+ ds << static_cast("\x03\t" + QByteArray(1, e.fromItemTypeId()) + '\t' + e.fromItemId()
+ + '\t' + e.toItemTypeId() + '\t' + e.toItemId());
}
for (const ColorChangeLogEntry &e : m_colorChangelog) {
- ds << static_cast("\x07\t" % QByteArray::number(e.fromColorId()) % "\tx\t"
- % QByteArray::number(e.toColorId()) % "\tx");
+ ds << static_cast("\x07\t" + QByteArray::number(e.fromColorId()) + "\tx\t"
+ + QByteArray::number(e.toColorId()) + "\tx");
}
check(cw.endChunk());
}
diff --git a/src/bricklink/delegate.cpp b/src/bricklink/delegate.cpp
index e56233ba..3a48110d 100755
--- a/src/bricklink/delegate.cpp
+++ b/src/bricklink/delegate.cpp
@@ -214,19 +214,19 @@ QString ToolTip::createItemToolTip(const Item *item, Picture *pic) const
{
static const QString str = QLatin1String(R"(%2
%3
%1
)");
static const QString img_left = QLatin1String(R"(
)");
- QString note_left = u"" % ItemDelegate::tr("[Image is loading]") % u"";
+ QString note_left = u"" + ItemDelegate::tr("[Image is loading]") + u"";
QString yearStr;
QString id = QString::fromLatin1(item->id());
if (item->yearReleased())
yearStr = QString::number(item->yearReleased());
if (item->yearLastProduced() && (item->yearLastProduced() != item->yearReleased()))
- yearStr = yearStr % u'-' % QString::number(item->yearLastProduced());
+ yearStr = yearStr + u'-' + QString::number(item->yearLastProduced());
QColor color = qApp->palette().color(QPalette::Highlight);
- id = id % uR"( )" %
- item->itemType()->name() % uR"( )";
+ id = id + uR"( )" %
+ item->itemType()->name() + uR"( )";
if (pic && ((pic->updateStatus() == UpdateStatus::Updating)
|| (pic->updateStatus() == UpdateStatus::Loading))) {
@@ -249,11 +249,11 @@ QString ToolTip::createColorToolTip(const Color *color) const
if (color->id() > 0) {
static const QString tpl = uR"(
%2 (%3)
BrickLink id: %4)"_qs;
- str = str % tpl.arg(color->color().name(), color->name(), color->color().name(),
+ str = str + tpl.arg(color->color().name(), color->name(), color->color().name(),
QString::number(color->id()));
if (color->ldrawId() != -1)
- str = str % u", LDraw id: " % QString::number(color->ldrawId());
+ str = str + u", LDraw id: " + QString::number(color->ldrawId());
} else {
str = color->name();
}
diff --git a/src/bricklink/io.cpp b/src/bricklink/io.cpp
index df85ea3e..77ccc98e 100755
--- a/src/bricklink/io.cpp
+++ b/src/bricklink/io.cpp
@@ -27,7 +27,7 @@ static QDateTime parseESTDateTimeString(const QString &v)
if (v.isEmpty())
return { };
- //TOO SLOW: QDateTime::fromString(v % u" EST", u"M/d/yyyy h:mm:ss AP t"));
+ //TOO SLOW: QDateTime::fromString(v + u" EST", u"M/d/yyyy h:mm:ss AP t"));
//TOO SLOW: { QDate::fromString(v, u"M/d/yyyy"), QTime(0, 0), est };
QStringList sl = QString(v).replace(u'/', u' ').replace(u':', u' ').split(u' ');
@@ -257,7 +257,7 @@ IO::ParseResult IO::fromBrickLinkXML(const QByteArray &data, Hint hint)
}
} catch (const Exception &e) {
throw Exception("XML parse error at line %1, column %2: %3")
- .arg(xml.lineNumber()).arg(xml.columnNumber()).arg(e.error());
+ .arg(xml.lineNumber()).arg(xml.columnNumber()).arg(e.errorString());
}
}
diff --git a/src/bricklink/lot.cpp b/src/bricklink/lot.cpp
index 3ed28cf9..f19a0801 100755
--- a/src/bricklink/lot.cpp
+++ b/src/bricklink/lot.cpp
@@ -12,7 +12,6 @@
** See http://fsf.org/licensing/licenses/gpl.html for GPL licensing information.
*/
#include
-#include
#include "bricklink/core.h"
#include "bricklink/lot.h"
diff --git a/src/bricklink/model.cpp b/src/bricklink/model.cpp
index 4fe32332..51d18f63 100644
--- a/src/bricklink/model.cpp
+++ b/src/bricklink/model.cpp
@@ -678,7 +678,7 @@ void ItemModel::setFilterText(const QString &filter)
continue;
if (!quoted.isEmpty()) {
- quoted = quoted % u' ' % s;
+ quoted = quoted + u' ' + s;
if (quoted.endsWith(u'"')) {
quoted.chop(1);
m_filter_text << qMakePair(quotedNegate, quoted);
@@ -799,7 +799,7 @@ bool ItemModel::filterAccepts(const void *pointer) const
else if (m_year_max_filter && (!item->yearLastProduced() || (item->yearLastProduced() > m_year_max_filter)))
return false;
else {
- const QString matchStr = QLatin1String(item->id()) % u' ' % item->name();
+ const QString matchStr = QLatin1String(item->id()) + u' ' + item->name();
// .first is always "bool negate"
@@ -1074,7 +1074,7 @@ QVariant InternalInventoryModel::data(const QModelIndex &index, int role) const
case InventoryModel::QuantityColumn:
return (e.m_quantity < 0) ? u"-"_qs : QString::number(e.m_quantity);
case InventoryModel::ItemIdColumn:
- return QString(QChar::fromLatin1(e.m_item->itemTypeId()) % u' ' % QString::fromLatin1(e.m_item->id()));
+ return QString(QChar::fromLatin1(e.m_item->itemTypeId()) + u' ' + QString::fromLatin1(e.m_item->id()));
case InventoryModel::ItemNameColumn:
return e.m_item->name();
case InventoryModel::ColorColumn:
diff --git a/src/bricklink/order.cpp b/src/bricklink/order.cpp
index 46abe9be..bfda9d97 100755
--- a/src/bricklink/order.cpp
+++ b/src/bricklink/order.cpp
@@ -202,7 +202,7 @@ LotList Order::loadLots() const
try {
return orders->loadOrderLots(this);
} catch (const Exception &e) {
- qWarning() << "Order::loadLots() failed:" << e.error();
+ qWarning() << "Order::loadLots() failed:" << e.errorString();
return { };
}
} else {
@@ -654,7 +654,7 @@ Orders::Orders(Core *core)
, m_core(core)
{
//TODO: Remove in 2022.6.x
- QDir legacyPath(core->dataPath() % u"orders/");
+ QDir legacyPath(core->dataPath() + u"orders/");
if (legacyPath.cd(u"received"_qs)) {
legacyPath.removeRecursively();
legacyPath.cdUp();
@@ -715,7 +715,7 @@ Orders::Orders(Core *core)
QJsonDocument json = QJsonDocument::fromVariant(vm);
QByteArray utf8 = json.toJson();
- std::unique_ptr saveFile { orderSaveFile(QString(order->id() % u".brickstore.json"),
+ std::unique_ptr saveFile { orderSaveFile(QString(order->id() + u".brickstore.json"),
order->type(), order->date()) };
if (!saveFile
@@ -727,7 +727,7 @@ Orders::Orders(Core *core)
}
} catch (const Exception &e) {
qWarning() << "Failed to retrieve address for order"
- << job->userData(type).toString() << ":" << e.error();
+ << job->userData(type).toString() << ":" << e.errorString();
}
} else if ((m_updateStatus == UpdateStatus::Updating) && m_jobs.contains(job)) {
bool success = true;
@@ -748,7 +748,7 @@ Orders::Orders(Core *core)
if (order->id().isEmpty() || !order->date().isValid())
throw Exception("Invalid order without ID and DATE");
- std::unique_ptr saveFile { orderSaveFile(QString(order->id() % u".order.xml"),
+ std::unique_ptr saveFile { orderSaveFile(QString(order->id() + u".order.xml"),
orderType, order->date()) };
if (!saveFile
|| (saveFile->write(orderXml) != orderXml.size())
@@ -764,7 +764,7 @@ Orders::Orders(Core *core)
}
} catch (const Exception &e) {
success = false;
- message = tr("Could not parse the received order XML data") % u": " % e.error();
+ message = tr("Could not parse the received order XML data") + u": " + e.errorString();
}
qDeleteAll(orders.keyBegin(), orders.keyEnd());
}
@@ -781,7 +781,7 @@ Orders::Orders(Core *core)
}
setUpdateStatus(overallSuccess ? UpdateStatus::Ok : UpdateStatus::UpdateFailed);
- QFile stampFile(m_core->dataPath() % u"orders/" % m_core->userId() % u"/.stamp");
+ QFile stampFile(m_core->dataPath() + u"orders/" + m_core->userId() + u"/.stamp");
if (overallSuccess) {
m_lastUpdated = QDateTime::currentDateTime();
stampFile.open(QIODevice::WriteOnly | QIODevice::Truncate);
@@ -808,9 +808,9 @@ void Orders::reloadOrdersFromCache()
if (m_core->userId().isEmpty())
return;
- QString path = m_core->dataPath() % u"orders/" % m_core->userId();
+ QString path = m_core->dataPath() + u"orders/" + m_core->userId();
- QFileInfo stamp(path % u"/.stamp");
+ QFileInfo stamp(path + u"/.stamp");
m_lastUpdated = stamp.lastModified();
setUpdateStatus(stamp.exists() ? UpdateStatus::Ok : UpdateStatus::UpdateFailed);
@@ -832,7 +832,7 @@ void Orders::reloadOrdersFromCache()
order->moveToThread(this->thread());
QDir d = dit.fileInfo().absoluteDir();
- QString addressFileName = order->id() % u".brickstore.json";
+ QString addressFileName = order->id() + u".brickstore.json";
if (d.exists(addressFileName)) {
QFile fa(d.absoluteFilePath(addressFileName));
if (fa.open(QIODevice::ReadOnly) && (fa.size() < 5000)) {
@@ -849,7 +849,7 @@ void Orders::reloadOrdersFromCache()
});
} catch (const Exception &e) {
// keep this UI silent for now
- qWarning() << "Failed to load order XML:" << e.error();
+ qWarning() << "Failed to load order XML:" << e.errorString();
}
}
});
@@ -1114,11 +1114,11 @@ QSaveFile *Orders::orderSaveFile(QStringView fileName, OrderType type, const QDa
QString Orders::orderFilePath(QStringView fileName, OrderType type, const QDate &date) const
{
- return m_core->dataPath() % u"orders/" % m_core->userId()
- % ((type == OrderType::Received) ? u"/received/": u"/placed/")
- % QString::number(date.year()) % u'/'
- % u"%1"_qs.arg(date.month(), 2, 10, QChar(u'0')) % u'/'
- % fileName;
+ return m_core->dataPath() + u"orders/" + m_core->userId()
+ + ((type == OrderType::Received) ? u"/received/": u"/placed/")
+ + QString::number(date.year()) + u'/'
+ + u"%1"_qs.arg(date.month(), 2, 10, QChar(u'0')) + u'/'
+ + fileName;
}
@@ -1191,7 +1191,7 @@ void Orders::cancelUpdate()
LotList Orders::loadOrderLots(const Order *order) const
{
- QString fileName = order->id() % u".order.xml";
+ QString fileName = order->id() + u".order.xml";
QFile f(Orders::orderFilePath(fileName, order->type(), order->date()));
if (!f.open(QIODevice::ReadOnly))
throw Exception(&f, tr("Cannot open order XML"));
@@ -1257,8 +1257,8 @@ QVariant Orders::data(const QModelIndex &index, int role) const
QString cc = order->countryCode();
flag = m_flags.value(cc);
if (flag.isNull()) {
- flag.addFile(u":/assets/flags/" % cc, { }, QIcon::Normal);
- flag.addFile(u":/assets/flags/" % cc, { }, QIcon::Selected);
+ flag.addFile(u":/assets/flags/" + cc, { }, QIcon::Normal);
+ flag.addFile(u":/assets/flags/" + cc, { }, QIcon::Selected);
m_flags.insert(cc, flag);
}
return flag;
@@ -1280,7 +1280,7 @@ QVariant Orders::data(const QModelIndex &index, int role) const
QString tt = data(index, Qt::DisplayRole).toString();
if (!order->address().isEmpty())
- tt = tt % u"\n\n" % order->address();
+ tt = tt + u"\n\n" + order->address();
return tt;
} else if (role == OrderPointerRole) {
return QVariant::fromValue(order);
diff --git a/src/bricklink/store.cpp b/src/bricklink/store.cpp
index 07376bec..575e055a 100755
--- a/src/bricklink/store.cpp
+++ b/src/bricklink/store.cpp
@@ -49,10 +49,10 @@ BrickLink::Store::Store(Core *core)
m_valid = true;
} catch (const Exception &e) {
success = false;
- message = tr("Failed to import the store inventory") % u": " % e.error();
+ message = tr("Failed to import the store inventory") + u": " + e.errorString();
}
} else {
- message = tr("Failed to download the store inventory") % u": " % job->errorString();
+ message = tr("Failed to download the store inventory") + u": " + job->errorString();
}
setUpdateStatus(success ? UpdateStatus::Ok : UpdateStatus::UpdateFailed);
emit updateFinished(success, message);
diff --git a/src/bricklink/textimport.cpp b/src/bricklink/textimport.cpp
index 28ae80b1..facd0455 100644
--- a/src/bricklink/textimport.cpp
+++ b/src/bricklink/textimport.cpp
@@ -75,27 +75,27 @@ bool BrickLink::TextImport::import(const QString &path)
{
try {
// colors
- readColors(path % u"colors.xml");
- readLDrawColors(path % u"ldconfig.ldr", path % u"rebrickable_colors.json");
+ readColors(path + u"colors.xml");
+ readLDrawColors(path + u"ldconfig.ldr", path + u"rebrickable_colors.json");
calculateColorPopularity();
// categories
- readCategories(path % u"categories.xml");
+ readCategories(path + u"categories.xml");
// itemtypes
- readItemTypes(path % u"itemtypes.xml");
+ readItemTypes(path + u"itemtypes.xml");
// speed up loading (exactly 137522 items on 16.06.2020)
m_items.reserve(200000);
for (ItemType &itt : m_item_types) {
- readItems(path % u"items_" % QLatin1Char(itt.m_id) % u".xml", &itt);
- readAdditionalItemCategories(path % u"items_" % QLatin1Char(itt.m_id) % u".csv", &itt);
+ readItems(path + u"items_" + QLatin1Char(itt.m_id) + u".xml", &itt);
+ readAdditionalItemCategories(path + u"items_" + QLatin1Char(itt.m_id) + u".csv", &itt);
}
- readPartColorCodes(path % u"part_color_codes.xml");
- readInventoryList(path % u"btinvlist.csv");
- readChangeLog(path % u"btchglog.csv");
+ readPartColorCodes(path + u"part_color_codes.xml");
+ readInventoryList(path + u"btinvlist.csv");
+ readChangeLog(path + u"btchglog.csv");
return true;
} catch (const Exception &e) {
@@ -114,7 +114,7 @@ void BrickLink::TextImport::readColors(const QString &path)
col.m_id = colid;
col.m_name = p.elementText(e, "COLORNAME").simplified();
- col.m_color = QColor(u'#' % p.elementText(e, "COLORRGB"));
+ col.m_color = QColor(u'#' + p.elementText(e, "COLORRGB"));
col.m_ldraw_id = -1;
col.m_type = Color::Type();
@@ -409,7 +409,7 @@ bool BrickLink::TextImport::readInventory(const Item *item, ImportInventoriesSte
// if this itemid was involved in a changelog entry after the last time we downloaded
// the inventory, we need to reload
- QByteArray itemTypeAndId = itemTypeId % itemId;
+ QByteArray itemTypeAndId = itemTypeId + itemId;
auto it = std::lower_bound(m_itemChangelog.cbegin(), m_itemChangelog.cend(), itemTypeAndId);
if ((it != m_itemChangelog.cend()) && (*it == itemTypeAndId) && (it->date() > fileDate)) {
throw Exception("Item id %1 changed on %2 (last download: %3)")
@@ -467,7 +467,7 @@ bool BrickLink::TextImport::readInventory(const Item *item, ImportInventoriesSte
} catch (const Exception &e) {
if (step != ImportFromDiskCache)
- qWarning() << " >" << qPrintable(e.error());
+ qWarning() << " >" << qPrintable(e.errorString());
return false;
}
}
@@ -650,7 +650,7 @@ void BrickLink::TextImport::readLDrawColors(const QString &ldconfigPath, const Q
// be able to render composite parts with fixed colors (e.g. electric motors)
if (!found) {
Color c;
- c.m_name = u"LDraw: " % name;
+ c.m_name = u"LDraw: " + name;
c.m_type = type;
c.m_color = color;
updateColor(c);
@@ -797,8 +797,8 @@ void BrickLink::TextImport::readChangeLog(const QString &path)
QString toId = strs.at(6);
if ((fromType.length() == 1) && (toType.length() == 1)
&& !fromId.isEmpty() && !toId.isEmpty()) {
- m_itemChangelog.emplace_back((fromType % fromId).toLatin1(),
- (toType % toId).toLatin1(), date);
+ m_itemChangelog.emplace_back((fromType + fromId).toLatin1(),
+ (toType + toId).toLatin1(), date);
}
break;
}
diff --git a/src/bricklink/wantedlist.cpp b/src/bricklink/wantedlist.cpp
index ff6460bc..09bdfc15 100755
--- a/src/bricklink/wantedlist.cpp
+++ b/src/bricklink/wantedlist.cpp
@@ -206,7 +206,7 @@ WantedLists::WantedLists(Core *core)
try {
if (!jobCompleted) {
- throw Exception(message % u": " % job->errorString());
+ throw Exception(message + u": " + job->errorString());
} else {
int invalidCount = parseWantedList(*it, *job->data());
if (invalidCount) {
@@ -217,7 +217,7 @@ WantedLists::WantedLists(Core *core)
}
} catch (const Exception &e) {
success = false;
- message = message % u": " % e.error();
+ message = message + u": " + e.errorString();
}
emit fetchLotsFinished(*it, success, message);
@@ -247,7 +247,7 @@ WantedLists::WantedLists(Core *core)
} catch (const Exception &e) {
success = false;
- message = message % u": " % e.error();
+ message = message + u": " + e.errorString();
}
}
m_lastUpdated = QDateTime::currentDateTime();
@@ -406,7 +406,7 @@ QVariant WantedLists::data(const QModelIndex &index, int role) const
case ItemLeftCount: return QLocale::system().toString(wantedList->itemLeftCount());
case ItemCount: return QLocale::system().toString(wantedList->itemCount());
case LotCount: return QLocale::system().toString(wantedList->lotCount());
- case Filled: return QLocale::system().toString(int(wantedList->filled() * 100)) + u'%';
+ case Filled: return QLocale::system().toString(int(wantedList->filled() * 100)).append(u'%');
}
} else if (role == Qt::TextAlignmentRole) {
return int(Qt::AlignVCenter) | Qt::AlignLeft;
@@ -419,7 +419,7 @@ QVariant WantedLists::data(const QModelIndex &index, int role) const
case ItemLeftCount: return wantedList->itemLeftCount();
case ItemCount: return wantedList->itemCount();
case LotCount: return wantedList->lotCount();
- case Filled: return QString::number(int(wantedList->filled() * 100)) + u'%';
+ case Filled: return QString::number(int(wantedList->filled() * 100)).append(u'%');
}
} else if (role == NameRole) {
return wantedList->name();
diff --git a/src/common/application.cpp b/src/common/application.cpp
index 3c5d3856..abb3b4c7 100755
--- a/src/common/application.cpp
+++ b/src/common/application.cpp
@@ -126,8 +126,8 @@ void Application::init()
QNetworkProxyFactory::setUseSystemConfiguration(true);
//TODO5: find out why we are blacklisted ... for now, fake the UA
- Transfer::setDefaultUserAgent(u"Br1ckstore/" % QCoreApplication::applicationVersion()
- % u" (" + QSysInfo::prettyProductName() % u')');
+ Transfer::setDefaultUserAgent(u"Br1ckstore/" + QCoreApplication::applicationVersion()
+ + u" (" + QSysInfo::prettyProductName() + u')');
#if defined(Q_CC_MSVC)
// std::set_terminate is a per-thread setting on Windows
@@ -162,7 +162,7 @@ void Application::init()
try {
initBrickLink();
} catch (const Exception &e) {
- m_startupErrors << tr("Could not initialize the BrickLink kernel:") % u' ' % e.error();
+ m_startupErrors << tr("Could not initialize the BrickLink kernel:") + u' ' + e.errorString();
}
try {
@@ -176,7 +176,7 @@ void Application::init()
connect(BrickLink::core(), &BrickLink::Core::authenticationFailed,
this, [](const QString &userName, const QString &error) {
UIHelpers::warning(tr("Failed to authenticate with BrickLink as user %1")
- .arg(userName) % u"
" % error % u"");
+ .arg(userName) + u"
" + error + u"");
});
m_undoGroup = new UndoGroup(this);
@@ -231,15 +231,15 @@ void Application::afterInit()
} },
{ "configure", [this](auto) { emit showSettings(); } },
{ "help_extensions", [](auto) {
- QString url = u"https://" % Application::inst()->gitHubPagesUrl() % u"/extensions/";
+ QString url = u"https://" + Application::inst()->gitHubPagesUrl() + u"/extensions/";
QDesktopServices::openUrl(url);
} },
{ "help_reportbug", [](auto) {
- QString url = u"https://" % Application::inst()->gitHubUrl() % u"/issues/new";
+ QString url = u"https://" + Application::inst()->gitHubUrl() + u"/issues/new";
QDesktopServices::openUrl(url);
} },
{ "help_releasenotes", [](auto) {
- QString url = u"https://" % Application::inst()->gitHubUrl() % u"/releases";
+ QString url = u"https://" + Application::inst()->gitHubUrl() + u"/releases";
QDesktopServices::openUrl(url);
} },
{ "help_announcements", [](auto) {
@@ -289,7 +289,7 @@ QCoro::Task<> Application::restoreLastSession()
int restorable = Document::restorableAutosaves();
if (restorable > 0) {
bool b = (co_await UIHelpers::question(tr("It seems like BrickStore crashed while %n document(s) had unsaved modifications.", nullptr, restorable)
- % u"
" % tr("Should these documents be restored from their last available auto-save state?"),
+ + u"
" + tr("Should these documents be restored from their last available auto-save state?"),
UIHelpers::Yes | UIHelpers::No, UIHelpers::Yes, tr("Restore Documents"))
== UIHelpers::Yes);
@@ -336,14 +336,14 @@ QCoro::Task<> Application::setupLDraw()
if (success)
UIHelpers::toast(tr("Finished downloading an LDraw library update"));
else
- UIHelpers::toast(tr("Failed to download a LDraw library update") % u":
" % message);
+ UIHelpers::toast(tr("Failed to download a LDraw library update") + u":
" + message);
});
auto loadLibrary = [](QString ldrawDirLoad) -> QCoro::Task<> {
bool isInternalZip = ldrawDirLoad.isEmpty();
if (isInternalZip)
- ldrawDirLoad = Config::inst()->cacheDir() % u"/ldraw/complete.zip";
+ ldrawDirLoad = Config::inst()->cacheDir() + u"/ldraw/complete.zip";
co_await LDraw::library()->setPath(ldrawDirLoad);
@@ -438,7 +438,7 @@ QString Application::gitHubPagesUrl() const
{
const auto sections = QString::fromLatin1(BRICKSTORE_GITHUB_URL).split(u"/"_qs);
Q_ASSERT(sections.count() == 3);
- return sections[1] % u".github.io/" % sections[2];
+ return sections[1] + u".github.io/" + sections[2];
}
QString Application::databaseUrl() const
@@ -461,7 +461,7 @@ QCoro::Task Application::checkBrickLinkLogin()
co_return true;
} else {
if (auto pw = co_await UIHelpers::getPassword(tr("Please enter the password for the BrickLink account %1:")
- .arg(u"" % Config::inst()->brickLinkUsername() % u""))) {
+ .arg(u"" + Config::inst()->brickLinkUsername() + u""))) {
Config::inst()->setBrickLinkPassword(*pw, true /*do not save*/);
co_return true;
}
@@ -620,7 +620,7 @@ void Application::updateTranslations()
QCoreApplication::installTranslator(m_trans_qt.get());
}
if ((language != u"en") || (!m_translationOverride.isEmpty())) {
- QString translationFile = u"brickstore_"_qs % language;
+ QString translationFile = u"brickstore_"_qs + language;
QString translationDir = i18n;
QFileInfo qm(m_translationOverride);
@@ -637,28 +637,28 @@ void Application::updateTranslations()
QVariantMap Application::about() const
{
QString header = uR"()"_qs
- % uR"()" BRICKSTORE_NAME "
"
- % u"" % tr("Version %1 (build: %2)").arg(BRICKSTORE_VERSION u"", BRICKSTORE_BUILD_NUMBER u"")
- % u"
"
- % tr("Copyright © %1").arg(BRICKSTORE_COPYRIGHT u"") % u"
"
- % tr("Visit %1").arg(uR"()" BRICKSTORE_URL R"()")
- % u"
";
+ + uR"()" BRICKSTORE_NAME "
"
+ + u"" + tr("Version %1 (build: %2)").arg(BRICKSTORE_VERSION u"", BRICKSTORE_BUILD_NUMBER u"")
+ + u"
"
+ + tr("Copyright © %1").arg(BRICKSTORE_COPYRIGHT u"") + u"
"
+ + tr("Visit %1").arg(uR"()" BRICKSTORE_URL R"()")
+ + u"
";
QString license = tr(R"(This program is free software; it may be distributed and/or modified under the terms of the GNU General Public License version 2 as published by the Free Software Foundation and appearing in the file LICENSE.GPL included in this software package.
This program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
See www.gnu.org/licenses/old-licenses/gpl-2.0.html for GPL licensing information.
All data from www.bricklink.com is owned by BrickLink. Both BrickLink and LEGO are trademarks of the LEGO group, which does not sponsor, authorize or endorse this software. All other trademarks recognized.
Only made possible by Dan Jezek's support.
)");
- license = u"
" % tr("License") % uR"()"
- % license % u"
";
+ license = u"
" + tr("License") + uR"()"
+ + license + u"
";
QString translators;
const QString transRow = uR"(| %1 | | %2 %4 |
)"_qs;
const auto translations = Config::inst()->translations();
for (const Config::Translation &trans : translations) {
if ((trans.language != u"en") && !trans.author.isEmpty()) {
- QString langname = trans.localName % u" (" % trans.name % u")";
- translators = translators % transRow.arg(langname, trans.author, trans.authorEmail, trans.authorEmail);
+ QString langname = trans.localName + u" (" + trans.name + u")";
+ translators = translators + transRow.arg(langname, trans.author, trans.authorEmail, trans.authorEmail);
}
}
- translators = u"
" % tr("Translators") % uR"(";
+ translators = u"
" + tr("Translators") + uR"(";
return QVariantMap {
{ u"header"_qs, header },
@@ -691,8 +691,8 @@ void Application::setupSentry()
sentry_options_set_release(sentry, "brickstore@" BRICKSTORE_BUILD_NUMBER);
sentry_options_set_require_user_consent(sentry, 1);
- QString dbPath = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) % u"/.sentry";
- QString crashHandler = QCoreApplication::applicationDirPath() % u"/crashpad_handler";
+ QString dbPath = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + u"/.sentry";
+ QString crashHandler = QCoreApplication::applicationDirPath() + u"/crashpad_handler";
# if defined(Q_OS_WINDOWS)
crashHandler.append(u".exe"_qs);
diff --git a/src/common/brickstore_wrapper.cpp b/src/common/brickstore_wrapper.cpp
index 69b88246..23deeb3d 100755
--- a/src/common/brickstore_wrapper.cpp
+++ b/src/common/brickstore_wrapper.cpp
@@ -18,7 +18,6 @@
#include
#include
#include
-#include
#include "utility/utility.h"
#include "common/currency.h"
@@ -309,12 +308,12 @@ QString QmlBrickStore::cacheStats() const
ldBar += QString(16 - ldBar.length(), u' ');
return u"Cache stats:\n"_qs
- % u"Pictures : [" % picBar % u"] " % QString::number(pic.first / 1000)
- % u" / " % QString::number(pic.second / 1000) % u" MB\n"
- % u"Price guides: [" % pgBar % u"] " % QString::number(pg.first)
- % u" / " % QString::number(pg.second) % u" entries\n"
- % u"LDraw parts : [" % ldBar % u"] " % QString::number(ld.first)
- % u" / " % QString::number(ld.second) % u" lines";
+ + u"Pictures : [" + picBar + u"] " + QString::number(pic.first / 1000)
+ + u" / " + QString::number(pic.second / 1000) + u" MB\n"
+ + u"Price guides: [" + pgBar + u"] " + QString::number(pg.first)
+ + u" / " + QString::number(pg.second) + u" entries\n"
+ + u"LDraw parts : [" + ldBar + u"] " + QString::number(ld.first)
+ + u" / " + QString::number(ld.second) + u" lines";
}
diff --git a/src/common/config.cpp b/src/common/config.cpp
index 076eb174..dd69fb33 100644
--- a/src/common/config.cpp
+++ b/src/common/config.cpp
@@ -24,7 +24,6 @@
#include
#include
#include
-#include
#include
#include "config.h"
@@ -324,7 +323,7 @@ void Config::setUpdateIntervals(const QMap &uiv)
it.next();
if (it.value() != old_uiv.value(it.key())) {
- setValue(u"BrickLink/UpdateInterval/"_qs % QLatin1String(it.key()), it.value());
+ setValue(u"BrickLink/UpdateInterval/"_qs + QLatin1String(it.key()), it.value());
modified = true;
}
}
@@ -358,21 +357,21 @@ QByteArray Config::columnLayout(const QString &id) const
{
if (id.isEmpty())
return { };
- return value(u"ColumnLayouts/"_qs % id % u"/Layout").toByteArray();
+ return value(u"ColumnLayouts/"_qs + id + u"/Layout").toByteArray();
}
QString Config::columnLayoutName(const QString &id) const
{
if (id.isEmpty())
return { };
- return value(u"ColumnLayouts/"_qs % id % u"/Name").toString();
+ return value(u"ColumnLayouts/"_qs + id + u"/Name").toString();
}
int Config::columnLayoutOrder(const QString &id) const
{
if (id.isEmpty())
return -1;
- return value(u"ColumnLayouts/"_qs % id % u"/Order", -1).toInt();
+ return value(u"ColumnLayouts/"_qs + id + u"/Order", -1).toInt();
}
QStringList Config::columnLayoutIds() const
@@ -402,11 +401,11 @@ QString Config::setColumnLayout(const QString &id, const QByteArray &layout)
return { };
}
}
- setValue(u"ColumnLayouts/"_qs % nid % u"/Layout", layout);
+ setValue(u"ColumnLayouts/"_qs + nid + u"/Layout", layout);
if (isNew) {
auto newIds = columnLayoutIds();
- setValue(u"ColumnLayouts/"_qs % nid % u"/Order", newIds.count() - 1);
+ setValue(u"ColumnLayouts/"_qs + nid + u"/Order", newIds.count() - 1);
emit columnLayoutIdsChanged(newIds);
}
emit columnLayoutChanged(nid, layout);
@@ -422,7 +421,7 @@ bool Config::deleteColumnLayout(const QString &id)
bool hasLayout = childGroups().contains(id);
endGroup();
if (hasLayout) {
- remove(u"ColumnLayouts/"_qs % id);
+ remove(u"ColumnLayouts/"_qs + id);
emit columnLayoutIdsChanged(columnLayoutIds());
return true;
}
@@ -438,9 +437,9 @@ bool Config::renameColumnLayout(const QString &id, const QString &name)
endGroup();
if (hasLayout) {
- QString oldname = value(u"ColumnLayouts/"_qs % id % u"/Name").toString();
+ QString oldname = value(u"ColumnLayouts/"_qs + id + u"/Name").toString();
if (oldname != name) {
- setValue(u"ColumnLayouts/"_qs % id % u"/Name", name);
+ setValue(u"ColumnLayouts/"_qs + id + u"/Name", name);
emit columnLayoutNameChanged(id, name);
return true;
}
@@ -458,7 +457,7 @@ bool Config::reorderColumnLayouts(const QStringList &ids)
if (oldIds == newIds) {
for (int i = 0; i < ids.count(); ++i)
- setValue(u"ColumnLayouts/"_qs % ids.at(i) % u"/Order", i);
+ setValue(u"ColumnLayouts/"_qs + ids.at(i) + u"/Order", i);
emit columnLayoutIdsOrderChanged(ids);
return true;
}
diff --git a/src/common/currency.cpp b/src/common/currency.cpp
index 28b2ebc7..42efa5ad 100644
--- a/src/common/currency.cpp
+++ b/src/common/currency.cpp
@@ -170,7 +170,7 @@ QCoro::Task<> Currency::updateRates(bool silent)
if (reply->error() != QNetworkReply::NoError) {
if (OnlineState::inst()->isOnline() && !m_silent)
emit updateRatesFailed(tr("There was an error downloading the exchange rates from the ECB server:")
- % u"
" % reply->errorString());
+ + u"
" + reply->errorString());
} else {
auto r = reply->readAll();
QXmlStreamReader reader(r);
@@ -199,7 +199,7 @@ QCoro::Task<> Currency::updateRates(bool silent)
else
err = tr("no currency data found");
emit updateRatesFailed(tr("There was an error parsing the exchange rates from the ECB server:")
- % u"
" % err);
+ + u"
" + err);
}
} else {
m_rates = newRates;
@@ -221,7 +221,7 @@ QString Currency::toDisplayString(double value, const QString ¤cyCode, int
if (currencyCode.isEmpty())
return loc.toString(value, 'f', precision);
else
- return currencyCode % u' ' % loc.toString(value, 'f', precision);
+ return currencyCode + u' ' + loc.toString(value, 'f', precision);
}
QString Currency::toString(double value, const QString ¤cyCode, int precision)
@@ -231,7 +231,7 @@ QString Currency::toString(double value, const QString ¤cyCode, int precis
if (currencyCode.isEmpty())
return loc.toString(value, 'f', precision);
else
- return loc.toString(value, 'f', precision) % u' ' % currencyCode;
+ return loc.toString(value, 'f', precision) + u' ' + currencyCode;
}
double Currency::fromString(const QString &str)
diff --git a/src/common/document.cpp b/src/common/document.cpp
index 7b7ad017..ce747505 100755
--- a/src/common/document.cpp
+++ b/src/common/document.cpp
@@ -554,8 +554,8 @@ void Document::setActive(bool active)
}
if (!messages.isEmpty()) {
- const QString msg = u"" % filePathOrTitle() % u"
- "
- % messages.join(u"
- ") % u"
";
+ const QString msg = u"" + filePathOrTitle() + u"
- "
+ + messages.join(u"
- ") + u"
";
static auto notifyUser = [](QString s) -> QCoro::Task<> {
co_await UIHelpers::information(s);
@@ -578,7 +578,7 @@ QCoro::Task Document::requestClose()
if (m_model->isModified()) {
switch (co_await UIHelpers::question(tr("The document %1 has been modified.").arg(CMB_BOLD(fileName()))
- % u"
" % tr("Do you want to save your changes?"),
+ + u"
" + tr("Do you want to save your changes?"),
UIHelpers::Save | UIHelpers::Discard | UIHelpers::Cancel,
UIHelpers::Save)) {
case UIHelpers::Save:
@@ -1139,7 +1139,7 @@ void Document::priceGuideUpdated(BrickLink::PriceGuide *pg)
QString s = tr("Prices of the selected items have been updated to Price Guide values.");
if (failCount) {
- s = s % u"
" % tr("%1 have been skipped, because of missing Price Guide records or network errors.")
+ s = s + u"
" + tr("%1 have been skipped, because of missing Price Guide records or network errors.")
.arg(CMB_BOLD(QString::number(failCount)));
}
@@ -1376,7 +1376,7 @@ void Document::addRemarks(const QString &addRemarks)
void Document::removeRemarks(const QString &remRemarks)
{
- QRegularExpression regexp(u"\\b" % QRegularExpression::escape(remRemarks) % u"\\b");
+ QRegularExpression regexp(u"\\b" + QRegularExpression::escape(remRemarks) + u"\\b");
applyTo(selectedLots(), "edit_remark_rem", [=](const auto &from, auto &to) {
QString remarks = from.remarks();
@@ -1414,7 +1414,7 @@ void Document::addComments(const QString &addComments)
void Document::removeComments(const QString &remComments)
{
- QRegularExpression regexp(u"\\b" % QRegularExpression::escape(remComments) % u"\\b");
+ QRegularExpression regexp(u"\\b" + QRegularExpression::escape(remComments) + u"\\b");
applyTo(selectedLots(), "edit_comment_rem", [=](const auto &from, auto &to) {
QString comments = from.comments();
@@ -1505,7 +1505,7 @@ QCoro::Task<> Document::exportBrickLinkXMLToFile()
#if !defined(Q_OS_ANDROID)
if (fn.right(4) != u".xml")
- fn = fn % u".xml";
+ fn = fn + u".xml";
#endif
const QByteArray xml = BrickLink::IO::toBrickLinkXML(lots).toUtf8();
@@ -1521,7 +1521,7 @@ QCoro::Task<> Document::exportBrickLinkXMLToFile()
throw Exception(tr("Failed to save data to file %1."));
} catch (const Exception &e) {
- UIHelpers::warning(e.error().arg(f.fileName()) % u"
" % f.errorString());
+ UIHelpers::warning(e.errorString().arg(f.fileName()) + u"
" + f.errorString());
}
}
@@ -1545,7 +1545,7 @@ QCoro::Task<> Document::exportBrickLinkUpdateXMLToClipboard()
if (!lots.isEmpty()) {
auto warnings = model()->hasDifferenceUpdateWarnings(lots);
if (!warnings.isEmpty()) {
- QString s = u"- " % warnings.join(u"
- ") % u"
";
+ QString s = u"- " + warnings.join(u"
- ") + u"
";
s = tr("There are problems: %1Do you really want to export this list?").arg(s);
if (co_await UIHelpers::question(s) != UIHelpers::Yes)
@@ -1630,7 +1630,7 @@ QCoro::Task Document::load(QString fileName)
QMetaObject::invokeMethod(doc, &Document::requestActivation, Qt::QueuedConnection);
co_return doc;
} catch (const Exception &e) {
- UIHelpers::warning(e.error());
+ UIHelpers::warning(e.errorString());
co_return nullptr;
}
}
@@ -1647,7 +1647,7 @@ Document *Document::loadFromFile(const QString &fileName)
RecentFiles::inst()->add(doc->filePath(), doc->fileName());
return doc;
} catch (const Exception &e) {
- throw Exception(tr("Failed to load document %1: %2").arg(fileName).arg(e.error()));
+ throw Exception(tr("Failed to load document %1: %2").arg(fileName).arg(e.errorString()));
}
}
@@ -1681,7 +1681,7 @@ QCoro::Task Document::save(bool saveAs)
QString suffix = filters.at(0).right(5).left(4);
if (fn.right(4) != suffix)
- fn = fn % suffix;
+ fn = fn + suffix;
#endif
try {
QGuiApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
@@ -1690,7 +1690,7 @@ QCoro::Task Document::save(bool saveAs)
co_return true;
} catch (const Exception &e) {
- UIHelpers::warning(e.error());
+ UIHelpers::warning(e.errorString());
}
}
co_return false;
@@ -2180,7 +2180,7 @@ void Document::setColumnLayoutFromId(const QString &layoutId)
undoName = Config::inst()->columnLayoutName(layoutId);
}
- model()->undoStack()->beginMacro(tr("Set column layout:") % u' ' % undoName);
+ model()->undoStack()->beginMacro(tr("Set column layout:") + u' ' + undoName);
switch (clc) {
case ColumnLayoutCommand::BrickStoreDefault:
@@ -2408,7 +2408,7 @@ void AutosaveJob::run()
{
QDir temp(QStandardPaths::writableLocation(QStandardPaths::TempLocation));
QString fileName = QString::fromLatin1(autosaveTemplate).arg(m_uuid.toString());
- QString newFileName = fileName % u".new";
+ QString newFileName = fileName + u".new";
{ // reading is cheaper than writing, so check first
QFile f(temp.filePath(fileName));
@@ -2529,14 +2529,14 @@ int Document::processAutosaves(AutosaveAction action)
if (!savedFileName.isEmpty()) {
QFileInfo fi(savedFileName);
- QString newFileName = fi.dir().filePath(restoredTag % u" " % fi.fileName());
+ QString newFileName = fi.dir().filePath(restoredTag + u" " + fi.fileName());
try {
doc->saveToFile(newFileName);
} catch (const Exception &) {
// not really much we can do here
}
} else {
- doc->setTitle(restoredTag % u" " % savedTitle);
+ doc->setTitle(restoredTag + u" " + savedTitle);
}
QMetaObject::invokeMethod(doc, &Document::requestActivation, Qt::QueuedConnection);
diff --git a/src/common/documentio.cpp b/src/common/documentio.cpp
index e224ca9b..273b0863 100755
--- a/src/common/documentio.cpp
+++ b/src/common/documentio.cpp
@@ -17,7 +17,6 @@
#include
#include
#include
-#include
#include
#include
#include
@@ -44,29 +43,29 @@
QStringList DocumentIO::nameFiltersForBrickLinkXML(bool includeAll)
{
QStringList filters;
- filters << tr("BrickLink XML File") % u" (*.xml)";
+ filters << tr("BrickLink XML File") + u" (*.xml)";
if (includeAll)
- filters << tr("All Files") % u"(*)";
+ filters << tr("All Files") + u"(*)";
return filters;
}
QStringList DocumentIO::nameFiltersForBrickStoreXML(bool includeAll)
{
QStringList filters;
- filters << tr("BrickStore XML Data") % u" (*.bsx)";
+ filters << tr("BrickStore XML Data") + u" (*.bsx)";
if (includeAll)
- filters << tr("All Files") % u"(*)";
+ filters << tr("All Files") + u"(*)";
return filters;
}
QStringList DocumentIO::nameFiltersForLDraw(bool includeAll)
{
QStringList filters;
- filters << tr("All Models") % u" (*.dat *.ldr *.mpd *.io)";
- filters << tr("LDraw Models") % u" (*.dat *.ldr *.mpd)";
- filters << tr("BrickLink Studio Models") % u" (*.io)";
+ filters << tr("All Models") + u" (*.dat *.ldr *.mpd *.io)";
+ filters << tr("LDraw Models") + u" (*.dat *.ldr *.mpd)";
+ filters << tr("BrickLink Studio Models") + u" (*.io)";
if (includeAll)
- filters << tr("All Files") % u" (*)";
+ filters << tr("All Files") + u" (*)";
return filters;
}
@@ -157,7 +156,7 @@ QCoro::Task DocumentIO::importBrickLinkXML(QString fileName)
co_return document;
} catch (const Exception &e) {
- UIHelpers::warning(tr("Could not parse the XML data.") % u"
" % e.error());
+ UIHelpers::warning(tr("Could not parse the XML data.") + u"
" + e.errorString());
}
} else {
co_await UIHelpers::warning(tr("Could not open file %1 for reading.").arg(CMB_BOLD(fn)));
@@ -194,7 +193,7 @@ QCoro::Task DocumentIO::importLDrawModel(QString fileName)
MiniZip::unzip(fn, f.get(), "model2.ldr", "soho0909");
f->close();
} catch (const Exception &e) {
- throw Exception(tr("Could not open the Studio ZIP container") % u": " % e.error());
+ throw Exception(tr("Could not open the Studio ZIP container") + u": " + e.errorString());
}
}
} else {
@@ -222,7 +221,7 @@ QCoro::Task DocumentIO::importLDrawModel(QString fileName)
} catch (const Exception &e) {
UIHelpers::warning(tr("Failed to import the LDraw/Studio model %1")
- .arg(QFileInfo(fn).fileName()) % u":
" % e.error());
+ .arg(QFileInfo(fn).fileName()) + u":
" + e.errorString());
}
co_return nullptr;
}
@@ -370,8 +369,8 @@ bool DocumentIO::parseLDrawModelInternal(QFile *f, bool isStudio, const QString
}
if (!got_subfile) {
- for (const auto &path : qAsConst(searchpath)) {
- QFile subf(path % u'/' % partname);
+ for (const auto &path : std::as_const(searchpath)) {
+ QFile subf(path + u'/' + partname);
if (subf.open(QIODevice::ReadOnly)) {
@@ -657,7 +656,7 @@ Document *DocumentIO::parseBsxInventory(QIODevice *in)
}
} catch (const Exception &e) {
throw Exception("XML parse error at line %1, column %2: %3")
- .arg(xml.lineNumber()).arg(xml.columnNumber()).arg(e.error());
+ .arg(xml.lineNumber()).arg(xml.columnNumber()).arg(e.errorString());
}
}
diff --git a/src/common/documentlist.cpp b/src/common/documentlist.cpp
index 6701238d..76b27acd 100755
--- a/src/common/documentlist.cpp
+++ b/src/common/documentlist.cpp
@@ -11,7 +11,6 @@
**
** See http://fsf.org/licensing/licenses/gpl.html for GPL licensing information.
*/
-#include
#include
#include
#include
@@ -118,7 +117,7 @@ QVariant DocumentList::data(const QModelIndex &index, int role) const
}
}
if (noClash) {
- s = minBase % u'/' % s;
+ s = minBase + u'/' + s;
break;
}
}
diff --git a/src/common/documentmodel.cpp b/src/common/documentmodel.cpp
index f6f83cfa..9ec96c51 100755
--- a/src/common/documentmodel.cpp
+++ b/src/common/documentmodel.cpp
@@ -19,7 +19,6 @@
#include
#include
#include
-#include
#include
#include
#include
@@ -118,15 +117,15 @@ private:
QString t = (to.*G)();
if (!f.isEmpty() && !t.isEmpty() && (f != t)) {
- QRegularExpression fromRe { u"\\b" % QRegularExpression::escape(f) % u"\\b" };
+ QRegularExpression fromRe { u"\\b" + QRegularExpression::escape(f) + u"\\b" };
if (!fromRe.match(t).hasMatch()) {
- QRegularExpression toRe { u"\\b" % QRegularExpression::escape(t) % u"\\b" };
+ QRegularExpression toRe { u"\\b" + QRegularExpression::escape(t) + u"\\b" };
if (toRe.match(f).hasMatch())
(to.*S)(f);
else
- (to.*S)(t % u" " % f);
+ (to.*S)(t + u" " + f);
return true;
}
} else if (!f.isEmpty()) {
@@ -524,7 +523,7 @@ QString DocumentStatistics::asHtmlTable() const
QString profitstr;
if (!qFuzzyIsNull(cost())) {
int percent = int(std::round(value() / cost() * 100. - 100.));
- profitstr = (percent > 0 ? u"(+" : u"(") % loc.toString(percent) % u" %)";
+ profitstr = (percent > 0 ? u"(+" : u"(") + loc.toString(percent) + u" %)";
}
@@ -535,7 +534,7 @@ QString DocumentStatistics::asHtmlTable() const
if (weight < 0) {
weight = -weight;
- wgtstr = tr("min.") % u' ';
+ wgtstr = tr("min.") + u' ';
}
wgtstr += Utility::weightToString(weight, Config::inst()->measurementSystem(), true, true);
diff --git a/src/common/filter.cpp b/src/common/filter.cpp
index 77b7fa3b..a2d9ee54 100644
--- a/src/common/filter.cpp
+++ b/src/common/filter.cpp
@@ -13,7 +13,6 @@
*/
#include
-#include
#include
#include
#include
@@ -26,7 +25,7 @@
static QString quote(const QString &str)
{
if (str.isEmpty() || str.contains(u' '))
- return u'"' % str % u'"';
+ return u'"' + str + u'"';
else
return str;
};
@@ -179,7 +178,7 @@ QString Filter::Parser::toString(const QVector &filter, bool preferSymbo
if ((f.field() != -1) || (f.comparison() != Matches)) {
for (const auto &ft : m_field_tokens) {
if (ft.first == f.field()) {
- result = result % quote(ft.second);
+ result = result + quote(ft.second);
break;
}
}
@@ -187,19 +186,19 @@ QString Filter::Parser::toString(const QVector &filter, bool preferSymbo
if (ct.first == f.comparison()) {
if (preferSymbolic && ct.second.at(0).isLetterOrNumber())
continue;
- result = result % u' ' % quote(ct.second) % u' ';
+ result = result + u' ' + quote(ct.second) + u' ';
break;
}
}
}
- result = result % quote(f.expression());
+ result = result + quote(f.expression());
if (i < (filter.size() - 1)) {
for (const auto &ct : m_combination_tokens) {
if (ct.first == f.combination()) {
if (preferSymbolic && ct.second.at(0).isLetterOrNumber())
continue;
- result = result % u' ' % quote(ct.second) % u' ';
+ result = result + u' ' + quote(ct.second) + u' ';
break;
}
}
@@ -234,7 +233,7 @@ QVector Filter::Parser::parse(const QString &str)
{
// match words, which are either quoted with ["], quoted with ['] or unquoted
static const QRegularExpression re(uR"-("([^"]*)"|'([^']*)'|([^ ]+))-"_qs);
- auto matches = re.globalMatch(str % u" &&"_qs);
+ auto matches = re.globalMatch(str + u" &&"_qs);
QVector filters;
Filter f;
@@ -242,7 +241,7 @@ QVector Filter::Parser::parse(const QString &str)
while (state != StateInvalid && matches.hasNext()) {
auto match = matches.next();
- QString word = match.captured(1) % match.captured(2) % match.captured(3);
+ QString word = match.captured(1) + match.captured(2) + match.captured(3);
retryState:
switch(state) {
@@ -307,8 +306,8 @@ static QString toHtml(const QVector> &tokens, const QString &b
if (first_key)
first_key = false;
else
- res = res % key_separator;
- res = res % key_before;
+ res = res + key_separator;
+ res = res + key_before;
bool first_value = true;
for (const auto &p : tokens) {
if (p.first != key)
@@ -317,13 +316,13 @@ static QString toHtml(const QVector> &tokens, const QString &b
if (first_value)
first_value = false;
else
- res = res % value_separator;
- res = res % value_before % quote(p.second).toHtmlEscaped() % value_after;
+ res = res + value_separator;
+ res = res + value_before + quote(p.second).toHtmlEscaped() + value_after;
}
- res = res % key_after;
+ res = res + key_after;
}
if (!res.isEmpty())
- res = before % res % after;
+ res = before + res + after;
return res;
}
diff --git a/src/common/printjob.cpp b/src/common/printjob.cpp
index dbf38bac..d201ee5a 100755
--- a/src/common/printjob.cpp
+++ b/src/common/printjob.cpp
@@ -20,7 +20,6 @@
#endif
#include
#include
-#include
#include
#include "printjob.h"
@@ -160,7 +159,7 @@
QmlPrintPage::QmlPrintPage(const QmlPrintJob *job)
: QObject(const_cast (job)), m_job(job)
{
- setObjectName(u"Page" % QString::number(job->pageCount() + 1));
+ setObjectName(u"Page" + QString::number(job->pageCount() + 1));
m_attr.m_font = QFont(u"Arial"_qs, 10);
m_attr.m_color = QColor(Qt::black);
diff --git a/src/common/scriptmanager.cpp b/src/common/scriptmanager.cpp
index 36863384..fa0e03be 100755
--- a/src/common/scriptmanager.cpp
+++ b/src/common/scriptmanager.cpp
@@ -21,7 +21,6 @@
#include
#include
#include
-#include
#include "utility/exception.h"
#include "script.h"
@@ -38,7 +37,7 @@ public:
: Exception(msg)
{
for (auto &error : errors)
- m_message = m_message % u'\n' % error.toString();
+ m_errorString = m_errorString + u'\n' + error.toString();
}
};
@@ -85,18 +84,19 @@ static QString stringifyQObject(const QObject *o, const QMetaObject *mo, int lev
if (indentFirstLine)
str.append(indent);
- str = str % QLatin1String(mo->className()) % u" {\n";
+ str = str + QLatin1String(mo->className()) + u" {\n";
- if (!isGadget && mo->superClass()) {
- str = str % nextIndent % u"superclass: "
- % stringifyQObject(o, mo->superClass(), level + 1, false) % u'\n';
+ if (!isGadget && mo->superClass()
+ && ((mo->superClass() != &QObject::staticMetaObject) || !o->objectName().isEmpty())) {
+ str = str + nextIndent + u"superclass: "
+ + stringifyQObject(o, mo->superClass(), level + 1, false) + u'\n';
}
for (int i = mo->propertyOffset(); i < mo->propertyCount(); ++i) {
QMetaProperty p = mo->property(i);
QVariant value = isGadget ? p.readOnGadget(o) : p.read(o);
- str = str % nextIndent % stringifyType(p.metaType()) % u' '
- % QLatin1String(p.name()) % u": " % stringify(value, level + 1, false) % u'\n';
+ str = str + nextIndent + stringifyType(p.metaType()) + u' '
+ + QLatin1String(p.name()) + u": " + stringify(value, level + 1, false) + u'\n';
}
/*
for (int i = mo->methodOffset(); i < mo->methodCount(); ++i) {
@@ -109,13 +109,13 @@ static QString stringifyQObject(const QObject *o, const QMetaObject *mo, int lev
const auto pnames = m.parameterNames();
QStringList params;
for (int pi = 0; pi < m.parameterCount(); ++pi)
- params.append(stringifyType(m.parameterMetaType(pi)) % u' ' % QLatin1String(pnames.at(pi)));
+ params.append(stringifyType(m.parameterMetaType(pi)) + u' ' + QLatin1String(pnames.at(pi)));
- str = str % nextIndent % stringifyType(m.returnMetaType()) % u' ' % QLatin1String(m.name())
- % u'(' % params.join(u", ") % u")\n";
+ str = str + nextIndent + stringifyType(m.returnMetaType()) + u' ' + QLatin1String(m.name())
+ + u'(' + params.join(u", ") + u")\n";
}
*/
- str = str % indent % u'}';
+ str = str + indent + u'}';
return str;
}
@@ -143,12 +143,12 @@ static QString stringify(const QVariant &value, int level, bool indentFirstLine)
str = str.append(u"[\n");
while (it.hasNext()) {
- str = str % stringify(it.next(), level + 1, true);
+ str = str + stringify(it.next(), level + 1, true);
if (it.hasNext())
str.append(u',');
str.append(u'\n');
}
- str = str % indent % u']';
+ str = str + indent + u']';
}
break;
}
@@ -161,18 +161,18 @@ static QString stringify(const QVariant &value, int level, bool indentFirstLine)
while (it.hasNext()) {
it.next();
- str = str % nextIndent % it.key() % u": " % stringify(it.value(), level + 1, false);
+ str = str + nextIndent + it.key() + u": " + stringify(it.value(), level + 1, false);
if (it.hasNext())
str.append(u',');
str.append(u'\n');
}
- str = str % indent % u'}';
+ str = str + indent + u'}';
}
break;
}
case QMetaType::QString: {
if (level > 0)
- str = str % u'"' % value.toString().remove(u"\0"_qs) % u'"';
+ str = str + u'"' + value.toString().remove(u"\0"_qs) + u'"';
else
str = value.toString().remove(u"\0"_qs);
break;
@@ -180,7 +180,7 @@ static QString stringify(const QVariant &value, int level, bool indentFirstLine)
case QMetaType::QSize:
case QMetaType::QSizeF: {
const auto s = value.toSizeF();
- str = QString::number(s.width()) % u" x " % QString::number(s.height());
+ str = QString::number(s.width()) + u" x " + QString::number(s.height());
break;
}
case QMetaType::QDateTime: {
@@ -269,7 +269,7 @@ bool ScriptManager::reload()
for (const QFileInfo &fi : fis) {
QString filePath = fi.absoluteFilePath();
if (filePath.startsWith(u':'))
- filePath = u"qrc://" % filePath.mid(1);
+ filePath = u"qrc://" + filePath.mid(1);
try {
loadScript(filePath);
@@ -330,7 +330,7 @@ std::tuple ScriptManager::executeString(const QString &s)
QQmlComponent component(m_engine);
component.setData(script, QUrl());
if (component.status() == QQmlComponent::Error)
- return { u"JS compile error: "_qs % component.errorString(), false };
+ return { u"JS compile error: "_qs + component.errorString(), false };
m_rootObject = component.create();
QQmlExpression e(m_engine->rootContext(), m_rootObject, s);
diff --git a/src/common/uihelpers.cpp b/src/common/uihelpers.cpp
index ae4b1e07..8ed3b006 100644
--- a/src/common/uihelpers.cpp
+++ b/src/common/uihelpers.cpp
@@ -82,7 +82,7 @@ QCoro::Task > UIHelpers::getFileNameHelper(bool doSave, Q
if (!fileName.isEmpty())
fn = fileName;
else if (!fileTitle.isEmpty())
- fn = fn % u'/' % sanitizeFileName(fileTitle);
+ fn = fn + u'/' + sanitizeFileName(fileTitle);
}
auto result = co_await getFileName(doSave, fn, filters, title);
diff --git a/src/common/uihelpers.h b/src/common/uihelpers.h
index c0390d2f..038ab906 100644
--- a/src/common/uihelpers.h
+++ b/src/common/uihelpers.h
@@ -17,14 +17,13 @@
#include
#include
-#include
#include "qcoro/task.h"
inline QString CMB_BOLD(const QString &str)
{
- return u"" % str % u"";
+ return u"" + str + u"";
}
class UIHelpers_ProgressDialogInterface : public QObject
diff --git a/src/desktop/additemdialog.cpp b/src/desktop/additemdialog.cpp
index 3c250cf5..5fde5f81 100644
--- a/src/desktop/additemdialog.cpp
+++ b/src/desktop/additemdialog.cpp
@@ -29,7 +29,6 @@
#include
#include
#include
-#include
#include
#include
#include
@@ -326,7 +325,7 @@ AddItemDialog::AddItemDialog(QWidget *parent)
QString tips;
for (const auto &entry : m_addHistory)
- tips = tips % pre % addhistoryTextFor(entry.first, entry.second) % post;
+ tips = tips + pre + addhistoryTextFor(entry.first, entry.second) + post;
QToolTip::showText(he->globalPos(), tips, w_last_added, w_last_added->geometry());
}
@@ -606,14 +605,14 @@ QString AddItemDialog::addhistoryTextFor(const QDateTime &when, const BrickLink:
QString cs;
if (lot.color() && lot.color()->id()) {
QColor color = lot.color()->color();
- cs = uR"( )" %
- lot.colorName() % uR"( )";
+ cs = uR"( )" %
+ lot.colorName() + uR"( )";
}
QString s = tr("Added %1").arg(HumanReadableTimeDelta::toString(now, when)) %
- u": " % QString::number(lot.quantity()) % u" " % cs %
- lot.itemName() % u" [" + QLatin1String(lot.itemId()) % u"]";
+ u": " + QString::number(lot.quantity()) + u" " + cs %
+ lot.itemName() + u" [" + QLatin1String(lot.itemId()) + u"]";
return s;
}
@@ -799,7 +798,7 @@ void AddItemDialog::recordBrowseEntry(bool onlyUpdateHistory)
if (!item)
return;
- QByteArray fullItemId = item->itemTypeId() % item->id();
+ QByteArray fullItemId = item->itemTypeId() + item->id();
BrowseHistoryEntry he { fullItemId, color ? color->id() : BrickLink::Color::InvalidId,
QDateTime::currentDateTime(), w_select_item->saveState(),
@@ -913,9 +912,9 @@ void AddItemDialog::buildBrowseMenu(BrowseMenuType type)
if (item) {
QString s = item->name();
if (color && color->id())
- s = color->name() % u' ' % s;
+ s = color->name() + u' ' + s;
if (type == BrowseMenuType::History)
- s = s % u"\t(" % HumanReadableTimeDelta::toString(now, bhe.m_lastVisited) % u')';
+ s = s + u"\t(" + HumanReadableTimeDelta::toString(now, bhe.m_lastVisited) + u')';
auto *a = m->addAction(s);
a->setData(i);
diff --git a/src/desktop/announcementsdialog.cpp b/src/desktop/announcementsdialog.cpp
index 655bb887..f616dfde 100755
--- a/src/desktop/announcementsdialog.cpp
+++ b/src/desktop/announcementsdialog.cpp
@@ -61,7 +61,7 @@ AnnouncementsDialog::AnnouncementsDialog(const QString &markdown, QWidget *paren
m_browser = new QTextBrowser();
m_browser->setReadOnly(true);
m_browser->setFrameStyle(QFrame::NoFrame);
- m_browser->setMarkdown(markdown % u"\n\n___\n");
+ m_browser->setMarkdown(markdown + u"\n\n___\n");
m_browser->setOpenLinks(true);
m_browser->setOpenExternalLinks(true);
m_browser->viewport()->setAutoFillBackground(false);
@@ -143,10 +143,10 @@ QCoro::Task<> AnnouncementsDialog::showNewAnnouncements(Announcements *announcem
shownIds << vm.value(u"id"_qs).toUInt();
if (!md.isEmpty())
- md = md % u"\n\n___\n\n";
- md = md % u"**" % vm.value(u"title"_qs).toString() % u"** — *"
- % QLocale().toString(vm.value(u"date"_qs).toDate(), QLocale::ShortFormat)
- % u"*\n\n" % vm.value(u"text"_qs).toString();
+ md = md + u"\n\n___\n\n";
+ md = md + u"**" + vm.value(u"title"_qs).toString() + u"** — *"
+ + QLocale().toString(vm.value(u"date"_qs).toDate(), QLocale::ShortFormat)
+ + u"*\n\n" + vm.value(u"text"_qs).toString();
}
if (shownIds.isEmpty())
diff --git a/src/desktop/bettercommandbutton.cpp b/src/desktop/bettercommandbutton.cpp
index a956e45f..f486151f 100755
--- a/src/desktop/bettercommandbutton.cpp
+++ b/src/desktop/bettercommandbutton.cpp
@@ -11,7 +11,6 @@
**
** See http://fsf.org/licensing/licenses/gpl.html for GPL licensing information.
*/
-#include
#include
#include
#include
@@ -235,7 +234,7 @@ void BetterCommandButton::updateDescriptionText()
QString desc = m_descriptionText;
if (!sc.isEmpty())
- desc = desc % u" (%1)"_qs.arg(sc.toString(QKeySequence::NativeText));
+ desc = desc + u" (%1)"_qs.arg(sc.toString(QKeySequence::NativeText));
if (m_description.text() != desc) {
m_description.setText(desc);
diff --git a/src/desktop/brickstoreproxystyle.cpp b/src/desktop/brickstoreproxystyle.cpp
index a68a8bf4..324d378c 100755
--- a/src/desktop/brickstoreproxystyle.cpp
+++ b/src/desktop/brickstoreproxystyle.cpp
@@ -11,7 +11,6 @@
**
** See http://fsf.org/licensing/licenses/gpl.html for GPL licensing information.
*/
-#include
#include
#include
#include
@@ -227,15 +226,15 @@ void BrickStoreProxyStyle::drawControl(ControlElement element, const QStyleOptio
for (int i = 0; i < sortColumns.size(); ++i) {
if (sortColumns.at(i).first == headerOpt->section) {
- QString key = u"hv_" % QString::number(iconSize) % u"-" %
- QString::number(i) % u"-" % QString::number(
+ QString key = u"hv_" + QString::number(iconSize) + u"-" %
+ QString::number(i) + u"-" + QString::number(
headerView->isSorted() ? int(sortColumns.at(i).second) : 2);
QPixmap pix;
if (!QPixmapCache::find(key, &pix)) {
QString name = u"view-sort"_qs;
if (headerView->isSorted()) {
- name = name % ((sortColumns.at(i).second == Qt::AscendingOrder)
+ name = name + ((sortColumns.at(i).second == Qt::AscendingOrder)
? u"-ascending" : u"-descending");
}
pix = QIcon::fromTheme(name).pixmap(QSize(iconSize, iconSize),
diff --git a/src/desktop/checkforupdates.cpp b/src/desktop/checkforupdates.cpp
index 68770895..a8b69b0c 100755
--- a/src/desktop/checkforupdates.cpp
+++ b/src/desktop/checkforupdates.cpp
@@ -27,7 +27,6 @@
#include
#include
#include
-#include
#include
#include
@@ -54,7 +53,7 @@ CheckForUpdates::CheckForUpdates(const QString &baseUrl, QWidget *parent)
m_downloadUrl.prepend(u"https://"_qs);
m_downloadUrl.append(u"/releases/tag/v%1"_qs);
- m_updatesPath = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) % u"/updates/";
+ m_updatesPath = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + u"/updates/";
QDir d(m_updatesPath);
d.mkpath(u"."_qs);
const auto leftOvers = d.entryList(QDir::Files);
@@ -185,7 +184,7 @@ QCoro::Task<> CheckForUpdates::showVersionChanges(QVersionNumber latestVersion)
.arg(s1, latestVersion.toString(), s2);
const QString url = m_downloadUrl.arg(latestVersion.toString());
- md = top % md.mid(toHeader, fromHeader - toHeader);
+ md = top + md.mid(toHeader, fromHeader - toHeader);
QTimer t;
t.start(0);
@@ -263,7 +262,7 @@ QCoro::Task<> CheckForUpdates::downloadInstaller()
if (reply->error() != QNetworkReply::NoError) {
QMessageBox::warning(nullptr, m_title, tr("Download failed: %1").arg(reply->errorString()));
} else {
- QFile f(m_updatesPath % m_installerName);
+ QFile f(m_updatesPath + m_installerName);
if (f.open(QIODevice::WriteOnly))
f.write(reply->readAll());
f.close();
diff --git a/src/desktop/consolidatedialog.cpp b/src/desktop/consolidatedialog.cpp
index d1a1aec3..51df30fe 100755
--- a/src/desktop/consolidatedialog.cpp
+++ b/src/desktop/consolidatedialog.cpp
@@ -15,7 +15,6 @@
#include
#include
#include
-#include
#include
#include "common/config.h"
@@ -164,8 +163,8 @@ ConsolidateDialog::ConsolidateDialog(View *view, QVector
"
- % tr("Do you still want to consolidate the rest?");
+ text = text + u"
"
+ + tr("Do you still want to consolidate the rest?");
if (QMessageBox::question(this, title, text) == QMessageBox::Yes)
accept();
}
@@ -193,14 +192,14 @@ ConsolidateDialog::ConsolidateDialog(View *view, QVectorvalue(s_baseConfigPath % u"Geometry").toByteArray();
+ QByteArray ba = Config::inst()->value(s_baseConfigPath + u"Geometry").toByteArray();
if (!ba.isEmpty())
restoreGeometry(ba);
}
ConsolidateDialog::~ConsolidateDialog()
{
- Config::inst()->setValue(s_baseConfigPath % u"Geometry", saveGeometry());
+ Config::inst()->setValue(s_baseConfigPath + u"Geometry", saveGeometry());
}
int ConsolidateDialog::nextId() const
@@ -248,13 +247,13 @@ void ConsolidateDialog::initializeCurrentPage()
// load default settings
const QString configPath = s_baseConfigPath
- % (m_addingItems ? u"Add/" : u"Consolidate/");
+ + (m_addingItems ? u"Add/" : u"Consolidate/");
const auto destinationDefault = m_addingItems ? Destination::IntoExisting
: Destination::IntoTopSorted;
const auto destination = static_cast(
- Config::inst()->value(configPath % u"Destination/" % (m_forAll ? u"ForAll/" : u"Individual/"),
+ Config::inst()->value(configPath + u"Destination/" + (m_forAll ? u"ForAll/" : u"Individual/"),
int(destinationDefault)).toInt());
int destinationIndex = w_defaultDestination->findData(QVariant::fromValue(destination));
@@ -262,7 +261,7 @@ void ConsolidateDialog::initializeCurrentPage()
destinationIndex = w_defaultDestination->findData(QVariant::fromValue(destinationDefault));
w_defaultDestination->setCurrentIndex(destinationIndex < 0 ? 0 : destinationIndex);
- QByteArray ba = Config::inst()->value(configPath % u"FieldMergeModes").toByteArray();
+ QByteArray ba = Config::inst()->value(configPath + u"FieldMergeModes").toByteArray();
if (ba.isEmpty() || !w_defaultFieldMergeModes->restoreState(ba)) {
w_defaultFieldMergeModes->setFieldMergeModes(DocumentModel::createFieldMergeModes(
DocumentModel::MergeMode::MergeAverage));
@@ -270,7 +269,7 @@ void ConsolidateDialog::initializeCurrentPage()
if (!m_addingItems) {
w_defaultDoNotDeleteEmpty->setChecked(
- Config::inst()->value(configPath % u"DoNotDeleteEmpty", false).toBool());
+ Config::inst()->value(configPath + u"DoNotDeleteEmpty", false).toBool());
}
break;
}
@@ -306,13 +305,13 @@ bool ConsolidateDialog::validateCurrentPage()
// save default settings
QString configPath = s_baseConfigPath
- % (m_addingItems ? u"Add/" : u"Consolidate/");
+ + (m_addingItems ? u"Add/" : u"Consolidate/");
- Config::inst()->setValue(configPath % u"Destination/" % (m_forAll ? u"ForAll/" : u"Individual/"),
+ Config::inst()->setValue(configPath + u"Destination/" + (m_forAll ? u"ForAll/" : u"Individual/"),
int(w_defaultDestination->currentData().value()));
- Config::inst()->setValue(configPath % u"FieldMergeModes", w_defaultFieldMergeModes->saveState());
+ Config::inst()->setValue(configPath + u"FieldMergeModes", w_defaultFieldMergeModes->saveState());
if (!m_addingItems)
- Config::inst()->setValue(configPath % u"DoNotDeleteEmpty", w_defaultDoNotDeleteEmpty->isChecked());
+ Config::inst()->setValue(configPath + u"DoNotDeleteEmpty", w_defaultDoNotDeleteEmpty->isChecked());
return true;
}
diff --git a/src/desktop/desktopuihelpers_p.h b/src/desktop/desktopuihelpers_p.h
index b423c450..a007ea04 100755
--- a/src/desktop/desktopuihelpers_p.h
+++ b/src/desktop/desktopuihelpers_p.h
@@ -55,7 +55,7 @@ public:
setPalette(pal);
auto *layout = new QHBoxLayout(this);
layout->setContentsMargins(20, 10, 20, 10);
- auto *label = new QLabel(u"" % message % u"");
+ auto *label = new QLabel(u"" + message + u"");
label->setTextFormat(Qt::AutoText);
label->setAlignment(Qt::AlignCenter);
layout->addWidget(label, 1);
diff --git a/src/desktop/developerconsole.cpp b/src/desktop/developerconsole.cpp
index f1bf722f..a19df131 100755
--- a/src/desktop/developerconsole.cpp
+++ b/src/desktop/developerconsole.cpp
@@ -17,7 +17,6 @@
#include
#include
#include
-#include
#include
#include
@@ -73,14 +72,14 @@ DeveloperConsole::DeveloperConsole(const QString &prompt,
this, [this]() {
auto cmd = m_cmd->text();
if (!cmd.isEmpty() && m_executeFunction) {
- m_log->appendPlainText(m_prompt->text() % cmd);
+ m_log->appendPlainText(m_prompt->text() + cmd);
auto [message, succeeded] = m_executeFunction(cmd);
if (succeeded) {
m_log->appendPlainText(message);
m_history.removeAll(cmd);
m_history.append(cmd);
} else {
- m_log->appendPlainText(u"ERROR: " % message);
+ m_log->appendPlainText(u"ERROR: " + message);
}
m_log->moveCursor(QTextCursor::End);
}
@@ -152,24 +151,24 @@ void DeveloperConsole::appendLogMessage(QtMsgType type, const QString &category,
QString str = u""_qs;
const auto lines = msg.split(u"\n"_qs);
for (int i = 0; i < lines.count(); ++i) {
- str = str % uR"()"
- % QLatin1String(msgTypeNames[type]) % uR"()"
- % uR"( )" % category % uR"()" % u": "
- % lines.at(i).toHtmlEscaped();
+ str = str + uR"()"
+ + QLatin1String(msgTypeNames[type]) + uR"()"
+ + uR"( )" + category + uR"()" + u": "
+ + lines.at(i).toHtmlEscaped();
if (i == (lines.count() - 1)) {
if ((type != QtInfoMsg) && !filename.isEmpty()) {
- str = str % uR"( at )" % filename
- % uR"(, line )" % QString::number(line) % uR"()";
+ str = str + uR"( at )" + filename
+ + uR"(, line )" + QString::number(line) + uR"()";
} else {
- str = str % u"";
+ str = str + u"";
}
} else {
- str = str % u"
";
+ str = str + u"
";
}
}
diff --git a/src/desktop/documentdelegate.cpp b/src/desktop/documentdelegate.cpp
index 93251581..3f678496 100755
--- a/src/desktop/documentdelegate.cpp
+++ b/src/desktop/documentdelegate.cpp
@@ -29,7 +29,6 @@
#include
#include
#include
-#include
#include
#include
#include
@@ -186,7 +185,7 @@ void DocumentDelegate::paint(QPainter *p, const QStyleOptionViewItem &option, co
if (differenceFlags & (1ULL << idx.column())) {
bool warn = (differenceFlags & differenceWarningMask & (1ULL << idx.column()));
int s = option.fontMetrics.height() / 10 * 8;
- QString key = u"dd_ti_"_qs % (warn ? u"!"_qs : u""_qs) % QString::number(s);
+ QString key = u"dd_ti_"_qs + (warn ? u"!"_qs : u""_qs) + QString::number(s);
QPixmap pix;
if (!QPixmapCache::find(key, &pix)) {
@@ -289,7 +288,7 @@ void DocumentDelegate::paint(QPainter *p, const QStyleOptionViewItem &option, co
}
case DocumentModel::Status: {
int iconSize = std::min(fm.height() * 5 / 4, h * 3 / 4);
- QString key = u"dd_st_" % QString::number(quint32(lot->status())) % u"-" %
+ QString key = u"dd_st_" + QString::number(quint32(lot->status())) + u"-" %
QString::number(iconSize);
QPixmap pix;
@@ -380,7 +379,7 @@ void DocumentDelegate::paint(QPainter *p, const QStyleOptionViewItem &option, co
if (nocolor || noitem) {
int d = option.rect.height();
- QString key = u"dd_stripe_" % QString::number(d);
+ QString key = u"dd_stripe_" + QString::number(d);
QPixmap pix;
if (!QPixmapCache::find(key, &pix)) {
pix = QPixmap::fromImage(Utility::stripeImage(d, Qt::red));
@@ -398,7 +397,7 @@ void DocumentDelegate::paint(QPainter *p, const QStyleOptionViewItem &option, co
int itw = qMax(int(1.5 * fontmetrics.height()),
2 * fontmetrics.horizontalAdvance(tag.text));
- QString key = u"dd_tag_" % QString::number(itw) % u"-" % tag.background.name();
+ QString key = u"dd_tag_" + QString::number(itw) + u"-" + tag.background.name();
QPixmap pix;
if (!QPixmapCache::find(key, &pix)) {
pix = QPixmap(itw, itw);
@@ -862,14 +861,14 @@ bool DocumentDelegate::helpEvent(QHelpEvent *event, QAbstractItemView *view,
if (tip.isEmpty())
tip = text;
if (differenceFlags & differenceWarningMask & (1ULL << idx.column())) {
- tip = tip % u"
" %
+ tip = tip + u"
" %
tr("This change cannot be applied via BrickLink's Mass-Update mechanism!");
}
QVariant vold = idx.data(DocumentModel::BaseDisplayRole);
QString oldText = displayData(idx, vold, true);
- tip = tip % u"
" %
- tr("The original value of this field was:") % u"
" % oldText % u"";
+ tip = tip + u"
" %
+ tr("The original value of this field was:") + u"
" + oldText + u"";
}
bool isElided = m_elided.contains(quint64(idx.row()) << 32 | quint64(idx.column()));
@@ -1006,9 +1005,9 @@ QString DocumentDelegate::displayData(const QModelIndex &idx, const QVariant &di
const auto *item = idx.data(DocumentModel::LotPointerRole).value();
if (item->counterPart())
- tip = tip % u"
(" % tr("Counter part") % u")";
+ tip = tip + u"
(" + tr("Counter part") + u")";
else if (item->alternateId())
- tip = tip % u"
(" % tr("Alternate match id: %1").arg(item->alternateId()) % u")";
+ tip = tip + u"
(" + tr("Alternate match id: %1").arg(item->alternateId()) + u")";
return tip;
}
case DocumentModel::Condition: {
@@ -1034,9 +1033,9 @@ QString DocumentDelegate::displayData(const QModelIndex &idx, const QVariant &di
}
if (!scStr.isEmpty()) {
if (toolTip)
- str = str % u"
" % scStr % u"";
+ str = str + u"
" + scStr + u"";
else
- str = str % u" (" % scStr % u")";
+ str = str + u" (" + scStr + u")";
}
}
return str;
@@ -1058,7 +1057,7 @@ QString DocumentDelegate::displayData(const QModelIndex &idx, const QVariant &di
default:
case BrickLink::Stockroom::None: tip = tr("None", "ToolTip Stockroom>None"); break;
}
- tip = tr("Stockroom") % u": " % tip;
+ tip = tr("Stockroom") + u": " + tip;
return tip;
}
case DocumentModel::QuantityOrig:
@@ -1078,7 +1077,7 @@ QString DocumentDelegate::displayData(const QModelIndex &idx, const QVariant &di
const auto *lot = idx.data(DocumentModel::LotPointerRole).value();
int yearTo = lot->itemYearLastProduced();
if (yearTo && (yearTo != yearFrom))
- return QString::number(yearFrom) % u" - " % QString::number(yearTo);
+ return QString::number(yearFrom) + u" - " + QString::number(yearTo);
else
return QString::number(yearFrom);
}
@@ -1104,7 +1103,7 @@ QString DocumentDelegate::displayData(const QModelIndex &idx, const QVariant &di
}
case DocumentModel::Sale: {
int i = display.toInt();
- return (!i && !toolTip) ? dash : loc.toString(i) % u'%';
+ return (!i && !toolTip) ? dash : loc.toString(i) + u'%';
}
case DocumentModel::Weight:
case DocumentModel::TotalWeight: {
diff --git a/src/desktop/filtertermwidget.cpp b/src/desktop/filtertermwidget.cpp
index 5aa87071..502f91c0 100755
--- a/src/desktop/filtertermwidget.cpp
+++ b/src/desktop/filtertermwidget.cpp
@@ -306,10 +306,10 @@ const Filter &FilterTermWidget::filter() const
QString FilterTermWidget::filterString() const
{
- QString s = m_fields->currentText() % u' ' % m_comparisons->currentText() %
- u" '" % m_value->currentText() % u"'";
+ QString s = m_fields->currentText() + u' ' + m_comparisons->currentText() %
+ u" '" + m_value->currentText() + u"'";
if (m_andOrGroup->checkedId() >= 0)
- s = s % u' ' % m_andOrGroup->checkedButton()->text();
+ s = s + u' ' + m_andOrGroup->checkedButton()->text();
return s;
}
diff --git a/src/desktop/headerview.cpp b/src/desktop/headerview.cpp
index 43e439b6..4049e4bf 100644
--- a/src/desktop/headerview.cpp
+++ b/src/desktop/headerview.cpp
@@ -11,7 +11,6 @@
**
** See http://fsf.org/licensing/licenses/gpl.html for GPL licensing information.
*/
-#include
#include
#include
#include
@@ -395,11 +394,11 @@ bool HeaderView::viewportEvent(QEvent *e)
auto he = static_cast(e);
int li = logicalIndexAt(he->pos());
if (li >= 0) {
- QString t = model()->headerData(li, orientation()).toString() % u"\n\n"
- % tr("Click to set as primary sort column.") % u"\n"
- % tr("Shift-click to set as additional sort column.") % u"\n"
- % tr("Right-click for context menu.") % u"\n"
- % tr("Drag to reposition and resize.");
+ QString t = model()->headerData(li, orientation()).toString() + u"\n\n"
+ + tr("Click to set as primary sort column.") + u"\n"
+ + tr("Shift-click to set as additional sort column.") + u"\n"
+ + tr("Right-click for context menu.") + u"\n"
+ + tr("Drag to reposition and resize.");
QToolTip::showText(he->globalPos(), t, this);
}
e->accept();
diff --git a/src/desktop/importcartdialog.cpp b/src/desktop/importcartdialog.cpp
index 46376a70..9520fcac 100755
--- a/src/desktop/importcartdialog.cpp
+++ b/src/desktop/importcartdialog.cpp
@@ -11,7 +11,6 @@
**
** See http://fsf.org/licensing/licenses/gpl.html for GPL licensing information.
*/
-#include
#include
#include
#include
@@ -237,7 +236,7 @@ void ImportCartDialog::updateStatusLabel()
break;
case BrickLink::UpdateStatus::UpdateFailed:
- s = tr("Last update failed") % u": " % m_updateMessage;
+ s = tr("Last update failed") + u": " + m_updateMessage;
break;
default:
diff --git a/src/desktop/importinventorydialog.cpp b/src/desktop/importinventorydialog.cpp
index d79792cc..b27d8d1d 100644
--- a/src/desktop/importinventorydialog.cpp
+++ b/src/desktop/importinventorydialog.cpp
@@ -11,7 +11,6 @@
**
** See http://fsf.org/licensing/licenses/gpl.html for GPL licensing information.
*/
-#include
#include
#include
#include
@@ -52,8 +51,8 @@ ImportInventoryDialog::ImportInventoryDialog(const BrickLink::Item *item, int qu
setFocusProxy(m_select);
} else {
m_verifyLabel = new QLabel(this);
- m_verifyLabel->setText(tr("Parting out:") % u" " % QString::fromLatin1(m_verifyItem->id())
- % u" " % m_verifyItem->name() % u"setText(tr("Parting out:") + u" " + QString::fromLatin1(m_verifyItem->id())
+ + u" " + m_verifyItem->name() + u"
#include
#include
#include
@@ -242,8 +241,8 @@ void ImportOrderDialog::importOrders(const QModelIndexList &rows, bool combined)
if (combined && m_selectedCurrencyCodes.size() > 1) {
if (QMessageBox::question(this, tr("Import Order"),
tr("You have selected multiple orders with differing currencies, which cannot be combined as-is.")
- % u"
"
- % tr("Do you want to continue and convert all prices to your default currency (%1)?")
+ + u"
"
+ + tr("Do you want to continue and convert all prices to your default currency (%1)?")
.arg(Config::inst()->defaultCurrencyCode())) == QMessageBox::No) {
return;
}
@@ -270,9 +269,9 @@ void ImportOrderDialog::importOrders(const QModelIndexList &rows, bool combined)
for (auto orderLot : orderLots) {
QString marker = orderLot->markerText();
- orderLot->setMarkerText(order->id() % u' ' % order->otherParty() %
+ orderLot->setMarkerText(order->id() + u' ' + order->otherParty() %
(marker.isEmpty() ? QString()
- : QString(u' ' % tr("Batch") % u": " % marker)));
+ : QString(u' ' + tr("Batch") + u": " + marker)));
orderLot->setMarkerColor(col);
if (!qFuzzyIsNull(crate)) {
@@ -351,7 +350,7 @@ void ImportOrderDialog::updateStatusLabel()
break;
case BrickLink::UpdateStatus::UpdateFailed:
- s = tr("Last update failed") % u": " % m_updateMessage;
+ s = tr("Last update failed") + u": " + m_updateMessage;
break;
default:
diff --git a/src/desktop/importwantedlistdialog.cpp b/src/desktop/importwantedlistdialog.cpp
index 894fe378..9852df47 100755
--- a/src/desktop/importwantedlistdialog.cpp
+++ b/src/desktop/importwantedlistdialog.cpp
@@ -11,7 +11,6 @@
**
** See http://fsf.org/licensing/licenses/gpl.html for GPL licensing information.
*/
-#include
#include
#include
#include
@@ -235,7 +234,7 @@ void ImportWantedListDialog::updateStatusLabel()
break;
case BrickLink::UpdateStatus::UpdateFailed:
- s = tr("Last update failed") % u": " % m_updateMessage;
+ s = tr("Last update failed") + u": " + m_updateMessage;
break;
default:
diff --git a/src/desktop/mainwindow.cpp b/src/desktop/mainwindow.cpp
index 1b92e27f..6b242d5b 100755
--- a/src/desktop/mainwindow.cpp
+++ b/src/desktop/mainwindow.cpp
@@ -38,7 +38,6 @@
#include
#include
#include
-#include
#include
#include
#include
@@ -349,7 +348,7 @@ void MainWindow::setupScripts()
try {
extensionAction->executeAction();
} catch (const Exception &e) {
- UIHelpers::warning(e.error());
+ UIHelpers::warning(e.errorString());
}
});
}
@@ -1267,7 +1266,7 @@ void MainWindow::titleUpdate()
QString file;
if (m_activeView) {
- title = m_activeView->windowTitle() % u" \u2014 " % title;
+ title = m_activeView->windowTitle() + u" \u2014 " + title;
file = m_activeView->document()->filePath();
}
setWindowTitle(title);
diff --git a/src/desktop/mainwindow_p.h b/src/desktop/mainwindow_p.h
index 4da37557..1e1b565b 100755
--- a/src/desktop/mainwindow_p.h
+++ b/src/desktop/mainwindow_p.h
@@ -13,7 +13,6 @@
*/
#pragma once
-#include
#include
#include
#include
@@ -58,7 +57,7 @@ public:
QString fn = rf->data(rf->index(i, 0), RecentFiles::FileNameRole).toString();
QString dn = rf->data(rf->index(i, 0), RecentFiles::DirNameRole).toString();
- QString s = fn % u" (" % dn % u")";
+ QString s = fn + u" (" + dn + u")";
#if !defined(Q_OS_MACOS)
if (i < 9)
s.prepend(QString(u"&%1 "_qs).arg(i + 1));
@@ -109,7 +108,7 @@ public:
QModelIndex idx = DocumentList::inst()->index(i);
QString s = idx.data().toString();
if (m_shortcut && (cnt < 10))
- s = u'&' % QString::number((cnt + 1) % 10) % u" " % s;
+ s = u'&' + QString::number((cnt + 1) % 10) + u" " + s;
QAction *a = m_menu->addAction(s);
a->setCheckable(true);
@@ -331,7 +330,7 @@ public slots:
{
QString str = (m_type == Undo) ? tr("Undo") : tr("Redo");
if (!desc.isEmpty())
- str = str % u" (" % desc % u')';
+ str = str + u" (" + desc + u')';
setText(str);
}
diff --git a/src/desktop/orderinformationdialog.cpp b/src/desktop/orderinformationdialog.cpp
index d744b60a..7d8994ca 100755
--- a/src/desktop/orderinformationdialog.cpp
+++ b/src/desktop/orderinformationdialog.cpp
@@ -13,7 +13,6 @@
*/
#include
#include
-#include
#include
#include
#include "utility/utility.h"
@@ -53,10 +52,10 @@ OrderInformationDialog::OrderInformationDialog(const BrickLink::Order *order, QW
const QString boff(u""_qs);
w_info->setText(tr("Order %1, %2 %3 on %4").arg(
- bon % order->id() % boff,
+ bon + order->id() + boff,
order->type() == BrickLink::OrderType::Received ? tr("received from")
: tr("placed at"),
- bon % order->otherParty() % boff,
+ bon + order->otherParty() + boff,
loc.toString(order->date())));
w_status->setText(order->statusAsString());
w_lastUpdated->setText(loc.toString(order->lastUpdated()));
@@ -81,13 +80,13 @@ OrderInformationDialog::OrderInformationDialog(const BrickLink::Order *order, QW
setup(w_address8, w_address8Copy, adr.value(7), adrSize >= 8);
setup(w_phone, w_phoneCopy, order->phone(), !order->phone().isEmpty(), w_phoneLabel);
- w_countryFlag->setPixmap(QPixmap(u":/assets/flags/" % order->countryCode()));
+ w_countryFlag->setPixmap(QPixmap(u":/assets/flags/" + order->countryCode()));
w_paymentType->setText(order->paymentType());
if (!order->paymentStatus().isEmpty() && !order->paymentLastUpdated().isValid()) {
- w_paymentStatus->setText(order->paymentStatus() % u" ("
- % loc.toString(order->paymentLastUpdated(), QLocale::ShortFormat)
- % u')');
+ w_paymentStatus->setText(order->paymentStatus() + u" ("
+ + loc.toString(order->paymentLastUpdated(), QLocale::ShortFormat)
+ + u')');
} else {
w_paymentStatus->hide();
w_paymentStatusLabel->hide();
@@ -96,8 +95,8 @@ OrderInformationDialog::OrderInformationDialog(const BrickLink::Order *order, QW
if (order->currencyCode() == order->paymentCurrencyCode()) {
w_currencyCode->setText(order->currencyCode());
} else {
- w_currencyCode->setText(order->currencyCode() % u", " % tr("Payment in") % u' '
- % order->paymentCurrencyCode());
+ w_currencyCode->setText(order->currencyCode() + u", " + tr("Payment in") + u' '
+ + order->paymentCurrencyCode());
}
bool vatFromSeller = !qFuzzyIsNull(order->vatChargeSeller());
@@ -113,9 +112,9 @@ OrderInformationDialog::OrderInformationDialog(const BrickLink::Order *order, QW
w_vatInfoLabel->setVisible(vatFromSeller);
w_vatSeparator->setVisible(vatFromSeller);
w_vatSellerLabel->setText(w_vatSellerLabel->text()
- .arg(loc.toString(vatPercent, 'f', QLocale::FloatingPointShortest) % u'%'));
+ .arg(loc.toString(vatPercent, 'f', QLocale::FloatingPointShortest) + u'%'));
w_vatBLLabel->setText(w_vatBLLabel->text()
- .arg(loc.toString(vatPercent, 'f', QLocale::FloatingPointShortest) % u'%'));
+ .arg(loc.toString(vatPercent, 'f', QLocale::FloatingPointShortest) + u'%'));
setup(w_shipping, w_shippingCopy, Currency::toDisplayString(order->shipping(), { }, 2),
!qFuzzyIsNull(order->shipping()), w_shippingLabel);
diff --git a/src/desktop/picturewidget.cpp b/src/desktop/picturewidget.cpp
index f9a7d093..ebe9a43c 100644
--- a/src/desktop/picturewidget.cpp
+++ b/src/desktop/picturewidget.cpp
@@ -24,7 +24,6 @@
#include
#include
#include
-#include
#include
#include
@@ -183,7 +182,7 @@ PictureWidget::PictureWidget(QWidget *parent)
img = m_image;
}
QStringList filters;
- filters << tr("PNG Image") % u" (*.png)";
+ filters << tr("PNG Image") + u" (*.png)";
QString fn = QFileDialog::getSaveFileName(this, tr("Save image as"),
Config::inst()->lastDirectory(),
@@ -355,7 +354,7 @@ void PictureWidget::showImage()
if (m_pic && ((m_pic->updateStatus() == BrickLink::UpdateStatus::Updating) ||
(m_pic->updateStatus() == BrickLink::UpdateStatus::Loading))) {
- w_image->setText(u"" % tr("Please wait... updating") % u"");
+ w_image->setText(u"" + tr("Please wait... updating") + u"");
} else if (m_pic && w_image->isVisible()) {
bool hasImage = !m_image.isNull();
QPixmap p;
diff --git a/src/desktop/priceguidewidget.cpp b/src/desktop/priceguidewidget.cpp
index 2e3dd530..2f3d4cd7 100644
--- a/src/desktop/priceguidewidget.cpp
+++ b/src/desktop/priceguidewidget.cpp
@@ -23,7 +23,6 @@
#include
#include
#include
-#include
#include "bricklink/core.h"
#include "bricklink/priceguide.h"
@@ -419,7 +418,7 @@ void PriceGuideWidget::recalcLayoutHorizontal(const QSize &s, const QFontMetrics
dy = ch;
for (const auto &htime : d->m_str_htime) {
- d->m_cells.emplace_back(cell::Header, dx, dy, cw[0], d->s_cond_count * ch, Qt::AlignLeft | Qt::AlignVCenter, htime[0] % u'\n' % htime[1], true);
+ d->m_cells.emplace_back(cell::Header, dx, dy, cw[0], d->s_cond_count * ch, Qt::AlignLeft | Qt::AlignVCenter, htime[0] + u'\n' + htime[1], true);
for (const auto &cond : d->m_str_cond) {
d->m_cells.emplace_back(cell::Header, dx + cw[0], dy, cw[1], ch, Qt::AlignCenter, cond);
@@ -738,7 +737,7 @@ bool PriceGuideWidget::event(QEvent *e)
}
tt = tr("Double-click to set the price of the current item")
- % u"
" % pt % u"";
+ + u"
" + pt + u"";
} else if (c && (c->m_type == cell::Quantity) && d->m_pg && d->m_pg->isValid()) {
int items = d->m_pg->quantity(c->m_time, c->m_condition);
@@ -747,10 +746,10 @@ bool PriceGuideWidget::event(QEvent *e)
if (items && lots) {
if (c->m_time == BrickLink::Time::Current) {
tt = tr("A total quantity of %Ln item(s) is available for purchase", nullptr, items)
- % u" (" % tr("in %Ln individual lot(s)", nullptr, lots) % u")";
+ + u" (" + tr("in %Ln individual lot(s)", nullptr, lots) + u")";
} else {
tt = tr("A total quantity of %Ln item(s) has been sold", nullptr, items)
- % u" (" % tr("in %Ln individual lot(s)", nullptr, lots) % u")";
+ + u" (" + tr("in %Ln individual lot(s)", nullptr, lots) + u")";
}
} else {
if (c->m_time == BrickLink::Time::Current)
diff --git a/src/desktop/printdialog.cpp b/src/desktop/printdialog.cpp
index dd62a29a..d3954d39 100755
--- a/src/desktop/printdialog.cpp
+++ b/src/desktop/printdialog.cpp
@@ -15,7 +15,6 @@
#include
#include
#include
-#include
#include
#include
#include
@@ -83,7 +82,7 @@ PrintDialog::PrintDialog(bool asPdf, View *window)
w_pageSelectWarning->hide();
w_scalePercent->hide();
- w_sysprint->setText(uR"()" % tr("Print using the system dialog...") % u"");
+ w_sysprint->setText(uR"()" + tr("Print using the system dialog...") + u"");
connect(w_page_first, &QToolButton::clicked,
this, [this]() { gotoPage(1); });
@@ -415,9 +414,9 @@ void PrintDialog::updateActions()
w_page_next->setEnabled(p < last);
w_page_last->setEnabled(p < last);
- w_pages->setText(QString::number(p) % u" / " % QString::number(last));
+ w_pages->setText(QString::number(p) + u" / " + QString::number(last));
double z = w_print_preview->zoomFactor() * logicalDpiX() / physicalDpiX();
- w_zoom->setText(QString::number(int(z * 100)) % u" %");
+ w_zoom->setText(QString::number(int(z * 100)) + u" %");
}
void PrintDialog::gotoPage(int page)
@@ -439,7 +438,7 @@ void PrintDialog::print()
pdfname = d.filePath(pdfname);
pdfname = QFileDialog::getSaveFileName(this, tr("Save as PDF"), pdfname,
- tr("PDF Documents") % u" (*" % suffix % u")");
+ tr("PDF Documents") + u" (*" + suffix + u")");
if (pdfname.isEmpty())
return;
if (QFileInfo(pdfname).suffix().isEmpty())
diff --git a/src/desktop/progressdialog.cpp b/src/desktop/progressdialog.cpp
index 7ca16f81..f1bc5dbc 100644
--- a/src/desktop/progressdialog.cpp
+++ b/src/desktop/progressdialog.cpp
@@ -11,7 +11,6 @@
**
** See http://fsf.org/licensing/licenses/gpl.html for GPL licensing information.
*/
-#include
#include
#include
#include
@@ -95,7 +94,7 @@ void ProgressDialog::done(int r)
void ProgressDialog::setHeaderText(const QString &str)
{
- m_header->setText(u"" % str % u"");
+ m_header->setText(u"" + str + u"");
syncRepaint(m_header);
}
@@ -114,7 +113,7 @@ void ProgressDialog::setMessageText(const QString &str)
void ProgressDialog::setErrorText(const QString &str)
{
- m_message->setText(u"" % tr("Error") % u": " % str);
+ m_message->setText(u"" + tr("Error") + u": " + str);
setFinished(false);
syncRepaint(m_message);
diff --git a/src/desktop/rendersettingsdialog.cpp b/src/desktop/rendersettingsdialog.cpp
index df26c20a..c29b9bbd 100755
--- a/src/desktop/rendersettingsdialog.cpp
+++ b/src/desktop/rendersettingsdialog.cpp
@@ -11,7 +11,6 @@
**
** See http://fsf.org/licensing/licenses/gpl.html for GPL licensing information.
*/
-#include
#include
#include "ldraw/rendersettings.h"
@@ -96,7 +95,7 @@ void RenderSettingsDialog::connectToggleButton(QAbstractButton *checkBox, const
};
auto dummyMapper = new QSignalMapper(checkBox);
- QByteArray chgSig = "2" % propName % "Changed(bool)";
+ QByteArray chgSig = "2" + propName + "Changed(bool)";
connect(rs, chgSig.constData(), dummyMapper, SLOT(map()));
dummyMapper->setMapping(rs, 42);
connect(dummyMapper, &QSignalMapper::mappedInt, this, setter);
@@ -118,7 +117,7 @@ void RenderSettingsDialog::connectComboBox(QComboBox *comboBox, const QByteArray
};
auto dummyMapper = new QSignalMapper(comboBox);
- QByteArray chgSig = "2" % propName % "Changed(int)";
+ QByteArray chgSig = "2" + propName + "Changed(int)";
connect(rs, chgSig.constData(), dummyMapper, SLOT(map()));
dummyMapper->setMapping(rs, 42);
connect(dummyMapper, &QSignalMapper::mappedInt, this, setter);
@@ -151,7 +150,7 @@ void RenderSettingsDialog::connectSliderAndSpinBox(QSlider *slider, QDoubleSpinB
};
auto dummyMapper = new QSignalMapper(spinBox);
- QByteArray chgSig = "2" % propName + "Changed(float)";
+ QByteArray chgSig = "2" + propName + "Changed(float)";
connect(rs, chgSig.constData(), dummyMapper, SLOT(map()));
dummyMapper->setMapping(rs, 42);
connect(dummyMapper, &QSignalMapper::mappedInt, this, setter);
diff --git a/src/desktop/selectitem.cpp b/src/desktop/selectitem.cpp
index 30b7bcd5..e0b0fe4c 100755
--- a/src/desktop/selectitem.cpp
+++ b/src/desktop/selectitem.cpp
@@ -24,7 +24,6 @@
#include
#include
#include
-#include
#include
#include
#include
@@ -280,7 +279,7 @@ void SelectItem::init()
this, [this]() { setZoomFactor(2); });
auto *zoomMenu = new QMenu(d->w_zoomLevel);
for (int zl : { 50, 75, 100, 125, 150, 175, 200, 250, 300, 350, 400, 500 }) {
- zoomMenu->addAction(QString::number(zl) % u'%')->setData(zl);
+ zoomMenu->addAction(QString::number(zl) + u'%')->setData(zl);
}
connect(zoomMenu, &QMenu::triggered, this, [this](QAction *a) {
setZoomFactor(double(a->data().toInt()) / 100.);
@@ -897,9 +896,9 @@ void SelectItem::showContextMenu(const QPoint &p)
auto partPicture = BrickLink::core()->picture(partItem, partColor, true);
- QString filter = BrickLink::ItemModel::tr("consists-of:") % QLatin1String(partItem->id());
+ QString filter = BrickLink::ItemModel::tr("consists-of:") + QLatin1String(partItem->id());
if (partItem->itemType()->hasColors() && partColor)
- filter = filter % u'@' % QString::number(partColor->id());
+ filter = filter + u'@' + QString::number(partColor->id());
QIcon icon;
if (partPicture->isValid())
icon = QPixmap::fromImage(partPicture->image());
@@ -907,8 +906,8 @@ void SelectItem::showContextMenu(const QPoint &p)
m->addSeparator();
QString section;
if (partColor && partColor->id())
- section = partColor->name() % u' ';
- section = section % partItem->name() % u" [" % QLatin1String(partItem->id()) % u']';
+ section = partColor->name() + u' ';
+ section = section + partItem->name() + u" [" + QLatin1String(partItem->id()) + u']';
m->addAction(icon, section)->setEnabled(false);
connect(m->addAction(tr("Set filter to Minifigs consisting of this part")),
@@ -918,7 +917,7 @@ void SelectItem::showContextMenu(const QPoint &p)
if (!d->w_filter->text().isEmpty()) {
connect(m->addAction(tr("Narrow filter to Minifigs consisting of this part")),
&QAction::triggered, this, [this, filter]() {
- d->w_filter->setText(d->w_filter->text() % u' ' % filter);
+ d->w_filter->setText(d->w_filter->text() + u' ' + filter);
});
}
}
diff --git a/src/desktop/settingsdialog.cpp b/src/desktop/settingsdialog.cpp
index 8bd9ae1d..f8d54fae 100644
--- a/src/desktop/settingsdialog.cpp
+++ b/src/desktop/settingsdialog.cpp
@@ -22,7 +22,6 @@
#include
#include
#include
-#include
#include
#include
#include
@@ -721,7 +720,7 @@ SettingsDialog::SettingsDialog(const QString &start_on_page, QWidget *parent)
w_font_size_percent->setFixedWidth(w_font_size_percent->width());
auto setFontSize = [this](int v) {
- w_font_size_percent->setText(QString::number(v * 10) % u" %");
+ w_font_size_percent->setText(QString::number(v * 10) + u" %");
QFont f = font();
double defaultFontSize = qApp->property("_bs_defaultFontSize").toReal();
if (defaultFontSize <= 0)
@@ -1053,7 +1052,7 @@ void SettingsDialog::load()
for (const auto &trans : translations) {
QString s = trans.name;
if (!trans.localName.isEmpty())
- s = trans.localName % u" (" % s % u')';
+ s = trans.localName + u" (" + s + u')';
w_language->addItem(s, trans.language);
@@ -1199,7 +1198,7 @@ void SettingsDialog::checkLDrawDir()
QString checkDir = isExternal
? w_ldraw_dir->currentText()
- : Config::inst()->cacheDir() % u"/ldraw/complete.zip";
+ : Config::inst()->cacheDir() + u"/ldraw/complete.zip";
bool valid = LDraw::Library::checkLDrawDir(checkDir);
diff --git a/src/desktop/systeminfodialog.cpp b/src/desktop/systeminfodialog.cpp
index f5fcbce9..03c18b35 100755
--- a/src/desktop/systeminfodialog.cpp
+++ b/src/desktop/systeminfodialog.cpp
@@ -50,8 +50,8 @@ SystemInfoDialog::SystemInfoDialog(QWidget *parent)
QGuiApplication::clipboard()->setText(text);
});
- QString text = u"### BrickStore " % QCoreApplication::applicationVersion()
- % u" (build: " % Application::inst()->buildNumber() % u")\n\n";
+ QString text = u"### BrickStore " + QCoreApplication::applicationVersion()
+ + u" (build: " + Application::inst()->buildNumber() + u")\n\n";
auto sysInfo = SystemInfo::inst()->asMap();
sysInfo.remove(u"os.type"_qs);
sysInfo.remove(u"os.version"_qs);
@@ -60,7 +60,7 @@ SystemInfoDialog::SystemInfoDialog(QWidget *parent)
sysInfo[u"brickstore.ldraw"_qs] = LDraw::library()->lastUpdated().toString(Qt::RFC2822Date);
for (auto it = sysInfo.cbegin(); it != sysInfo.cend(); ++it) {
- text = text % u" * **" % it.key() % u"**: " % it.value().toString() % u"\n";
+ text = text + u" * **" + it.key() + u"**: " + it.value().toString() + u"\n";
}
ui->text->setMarkdown(text);
diff --git a/src/desktop/taskwidgets.cpp b/src/desktop/taskwidgets.cpp
index a3d71d75..27744701 100644
--- a/src/desktop/taskwidgets.cpp
+++ b/src/desktop/taskwidgets.cpp
@@ -21,7 +21,6 @@
#include
#include
#include
-#include
#include
#include
#include
@@ -255,7 +254,7 @@ void TaskInfoWidget::delayedSelectionUpdate()
QString s = QString::fromLatin1("%1
")
.arg(m_selection.isEmpty() ? tr("Document statistics") : tr("Multiple lots selected"))
- % stat.asHtmlTable();
+ + stat.asHtmlTable();
m_pic->setItemAndColor(nullptr);
m_text->setText(s);
diff --git a/src/desktop/view.cpp b/src/desktop/view.cpp
index 3b06cf4c..8654d407 100755
--- a/src/desktop/view.cpp
+++ b/src/desktop/view.cpp
@@ -31,7 +31,6 @@
#include
#include
#include
-#include
#include
#include
#include
@@ -843,7 +842,7 @@ void View::printScriptAction(PrintingScriptAction *printingAction)
if (!dlg->property("bsFailOnce").toBool()) {
dlg->setProperty("bsFailOnce", true);
- QString msg = e.error();
+ QString msg = e.errorString();
if (msg.isEmpty())
msg = tr("Printing failed.");
else
diff --git a/src/desktop/viewpane.cpp b/src/desktop/viewpane.cpp
index 45c09419..040b8cb8 100755
--- a/src/desktop/viewpane.cpp
+++ b/src/desktop/viewpane.cpp
@@ -12,7 +12,6 @@
** See http://fsf.org/licensing/licenses/gpl.html for GPL licensing information.
*/
#include
-#include
#include
#include
#include
@@ -517,7 +516,7 @@ void ViewPane::updateCurrencyRates()
void ViewPane::documentCurrencyChanged(const QString &ccode)
{
- m_currency->setText(ccode % u" ");
+ m_currency->setText(ccode + u" ");
// the menu might still be open right now, so we need to delay deleting the actions
QMetaObject::invokeMethod(this, &ViewPane::updateCurrencyRates, Qt::QueuedConnection);
}
@@ -554,7 +553,7 @@ void ViewPane::updateStatistics()
bool b = (stat.differences() > 0);
if (b && Config::inst()->showDifferenceIndicators()) {
auto oldShortcut = m_differences->shortcut();
- m_differences->setText(u' ' % loc.toString(stat.differences()));
+ m_differences->setText(u' ' + loc.toString(stat.differences()));
m_differences->setShortcut(oldShortcut);
}
m_differences->setVisible(b);
@@ -563,14 +562,14 @@ void ViewPane::updateStatistics()
b = (stat.errors() > 0);
if (b && Config::inst()->showInputErrors()) {
auto oldShortcut = m_errors->shortcut();
- m_errors->setText(u' ' % loc.toString(stat.errors()));
+ m_errors->setText(u' ' + loc.toString(stat.errors()));
m_errors->setShortcut(oldShortcut);
}
m_errors->setVisible(b);
m_errorsSeparator->setVisible(b);
- QString cntstr = tr("Items") % u": " % loc.toString(stat.items())
- % u" (" % loc.toString(stat.lots()) % u")";
+ QString cntstr = tr("Items") + u": " + loc.toString(stat.items())
+ + u" (" + loc.toString(stat.lots()) + u")";
m_count->setText(cntstr);
QString wgtstr;
@@ -593,7 +592,7 @@ void ViewPane::updateStatistics()
b = !qFuzzyIsNull(stat.cost());
if (b) {
int percent = int(std::round(stat.value() / stat.cost() * 100. - 100.));
- QString profitstr = (percent > 0 ? u"(+" : u"(") % loc.toString(percent) % u" %)";
+ QString profitstr = (percent > 0 ? u"(+" : u"(") + loc.toString(percent) + u" %)";
m_profit->setText(profitstr);
}
m_profit->setVisible(/*b*/ false);
diff --git a/src/desktop/welcomewidget.cpp b/src/desktop/welcomewidget.cpp
index 4624f959..8a485555 100644
--- a/src/desktop/welcomewidget.cpp
+++ b/src/desktop/welcomewidget.cpp
@@ -20,7 +20,6 @@
#include
#include
#include
-#include
#include
#include
#include
@@ -191,10 +190,10 @@ void WelcomeWidget::updateVersionsText()
auto delta = HumanReadableTimeDelta::toString(QDateTime::currentDateTime(),
BrickLink::core()->database()->lastUpdated());
- QString dbd = u"" % delta % u"";
- QString ver = u"" % QCoreApplication::applicationVersion() % u"";
+ QString dbd = u"" + delta + u"";
+ QString ver = u"" + QCoreApplication::applicationVersion() + u"";
- QString s = QCoreApplication::applicationName() % u" " %
+ QString s = QCoreApplication::applicationName() + u" " %
tr("version %1 (build: %2)").arg(ver).arg(Application::inst()->buildNumber()) %
u" · " %
tr("Using a database that was generated %1").arg(dbd);
diff --git a/src/ldraw/library.cpp b/src/ldraw/library.cpp
index f1d1ae13..0961b200 100644
--- a/src/ldraw/library.cpp
+++ b/src/ldraw/library.cpp
@@ -19,9 +19,7 @@
#include
#include
#include
-#include
#include
-#include
#include
#if defined(Q_OS_WINDOWS)
@@ -122,17 +120,17 @@ Library::Library(const QString &updateUrl, QObject *parent)
// no need to emit updateFinished() here, because we didn't emit updateStarted()
setUpdateStatus(UpdateStatus::Ok);
} else if (j->isFailed()) {
- throw Exception(tr("download failed") % u": " % j->errorString());
+ throw Exception(tr("download failed") + u": " + j->errorString());
} else {
QString etag = j->lastETag();
- QFile etagf(file->fileName() % u".etag");
+ QFile etagf(file->fileName() + u".etag");
if (m_zip)
m_zip->close();
if (!file->commit()) {
QString error = file->errorString(); // file is dead after the co_await
co_await setPath(m_path, true); // at least try to reload the old library
- throw Exception(tr("saving failed") % u": " % error);
+ throw Exception(tr("saving failed") + u": " + error);
}
if (!co_await setPath(file->fileName(), true))
throw Exception(tr("reloading failed - please restart the application."));
@@ -150,7 +148,7 @@ Library::Library(const QString &updateUrl, QObject *parent)
} catch (const Exception &e) {
emitUpdateStartedIfNecessary();
- emit updateFinished(false, tr("Could not load the new parts library") % u": \n\n" % e.error());
+ emit updateFinished(false, tr("Could not load the new parts library") + u": \n\n" + e.errorString());
setUpdateStatus(UpdateStatus::UpdateFailed);
}
emit libraryReset();
@@ -171,7 +169,7 @@ Library::~Library()
QFuture Library::partFromId(const QByteArray &id)
{
- QString filename = QLatin1String(id) % u".dat";
+ QString filename = QLatin1String(id) + u".dat";
return partFromFile(filename);
}
@@ -305,7 +303,7 @@ QCoro::Task Library::setPath(const QString &path, bool forceReload)
for (auto subdir : subdirs) {
if (m_zip) {
- m_searchpath << QString(u"!ZIP!ldraw/" % QLatin1String(subdir));
+ m_searchpath << QString(u"!ZIP!ldraw/" + QLatin1String(subdir));
} else {
QDir sdir(m_path);
QString s = QLatin1String(subdir);
@@ -319,7 +317,7 @@ QCoro::Task Library::setPath(const QString &path, bool forceReload)
m_etag.clear();
if (m_zip) {
- QFile f(m_path % u".etag");
+ QFile f(m_path + u".etag");
if (f.open(QIODevice::ReadOnly))
m_etag = QString::fromUtf8(f.readAll());
}
@@ -364,7 +362,7 @@ bool Library::startUpdate(bool force)
QScopedValueRollback locker(m_locked, true);
- QString remotefile = m_updateUrl % u"complete.zip";
+ QString remotefile = m_updateUrl + u"complete.zip";
QString localfile = m_path;
if (!QFile::exists(localfile))
@@ -396,11 +394,11 @@ QByteArray Library::readLDrawFile(const QString &filename)
{
QByteArray data;
if (m_zip) {
- QString zipFilename = u"ldraw/" % filename;
+ QString zipFilename = u"ldraw/" + filename;
if (m_zip->contains(zipFilename))
data = m_zip->readFile(zipFilename);
} else {
- QFile f(path() % u'/' % filename);
+ QFile f(path() + u'/' + filename);
if (!f.open(QIODevice::ReadOnly))
throw Exception(&f, "Failed to read file");
@@ -452,23 +450,23 @@ Part *Library::findPart(const QString &_filename, const QString &_parentdir)
if (!parentdir.isEmpty() && !searchpath.contains(parentdir))
searchpath.prepend(parentdir);
- for (const QString &sp : qAsConst(searchpath)) {
+ for (const QString &sp : std::as_const(searchpath)) {
if (sp.startsWith(u"!ZIP!")) {
filename = filename.toLower();
- QString testname = sp.mid(5) % u'/' % filename;
+ QString testname = sp.mid(5) + u'/' + filename;
if (m_zip->contains(testname)) {
QFileInfo fi(filename);
parentdir = sp;
if (fi.path() != u".")
- parentdir = parentdir % u'/' % fi.path();
+ parentdir = parentdir + u'/' + fi.path();
filename = testname;
inZip = true;
found = true;
break;
}
} else {
- QString testname = sp % u'/' % filename;
+ QString testname = sp + u'/' + filename;
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) && !defined(Q_OS_IOS)
if (!QFile::exists(testname))
testname = testname.toLower();
@@ -505,7 +503,7 @@ Part *Library::findPart(const QString &_filename, const QString &_parentdir)
try {
data = m_zip->readFile(filename);
} catch (const Exception &e) {
- qCWarning(LogLDraw) << "Failed to read from LDraw ZIP:" << e.error();
+ qCWarning(LogLDraw) << "Failed to read from LDraw ZIP:" << e.errorString();
}
} else {
QFile f(filename);
@@ -547,7 +545,7 @@ bool Library::checkLDrawDir(const QString &ldir)
if (dir.exists(u"stud.dat"_qs) || dir.exists(u"STUD.DAT"_qs)) {
if (dir.cd(u"../parts"_qs) || dir.cd(u"../PARTS"_qs)) {
if (dir.exists(u"3001.dat"_qs) || dir.exists(u"3001.DAT"_qs)) {
- QFile f(ldir % u"/LDConfig.ldr");
+ QFile f(ldir + u"/LDConfig.ldr");
if (f.open(QIODevice::ReadOnly) && f.size()) {
ok = true;
}
diff --git a/src/ldraw/rendercontroller.cpp b/src/ldraw/rendercontroller.cpp
index 9d18d39e..674e7363 100755
--- a/src/ldraw/rendercontroller.cpp
+++ b/src/ldraw/rendercontroller.cpp
@@ -15,7 +15,6 @@
#include
#include
-#include
#include
#include
#include
@@ -516,14 +515,14 @@ QQuick3DTextureData *RenderController::generateMaterialTextureData(const BrickLi
const bool isSpeckle = color->isSpeckle();
QString cacheName = QLatin1String(isSpeckle ? "Speckle" : "Glitter")
- % u'_' % color->ldrawColor().name(QColor::HexArgb)
- % u'_' % color->particleColor().name(QColor::HexArgb)
- % u'_' % QString::number(double(color->particleMinSize()))
- % u'_' % QString::number(double(color->particleMaxSize()))
- % u'_' % QString::number(double(color->particleFraction()));
+ + u'_' + color->ldrawColor().name(QColor::HexArgb)
+ + u'_' + color->particleColor().name(QColor::HexArgb)
+ + u'_' + QString::number(double(color->particleMinSize()))
+ + u'_' + QString::number(double(color->particleMaxSize()))
+ + u'_' + QString::number(double(color->particleFraction()));
static auto cacheDir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation);
- QString cacheFile = cacheDir % u"/ldraw-textures/" % cacheName % u".png";
+ QString cacheFile = cacheDir + u"/ldraw-textures/" + cacheName + u".png";
if (!texImage.load(cacheFile) || texImage.isNull()) {
const int particleSize = 50;
diff --git a/src/ldraw/rendersettings.cpp b/src/ldraw/rendersettings.cpp
index 6116d573..71a9c79b 100755
--- a/src/ldraw/rendersettings.cpp
+++ b/src/ldraw/rendersettings.cpp
@@ -12,7 +12,6 @@
** See http://fsf.org/licensing/licenses/gpl.html for GPL licensing information.
*/
#include
-#include
#include
#include "common/config.h"
@@ -50,7 +49,7 @@ void RenderSettings::forEachProperty(std::function callba
void RenderSettings::save()
{
forEachProperty([this](QMetaProperty &mp) {
- Config::inst()->setValue(u"LDraw/RenderSettings/" % QLatin1String(mp.name()), mp.read(this));
+ Config::inst()->setValue(u"LDraw/RenderSettings/" + QLatin1String(mp.name()), mp.read(this));
});
}
@@ -60,7 +59,7 @@ void RenderSettings::load()
forEachProperty([this, pdv](QMetaProperty &mp) {
QString name = QLatin1String(mp.name());
- auto v = Config::inst()->value(u"LDraw/RenderSettings/" % name);
+ auto v = Config::inst()->value(u"LDraw/RenderSettings/" + name);
if (!v.isValid())
v = pdv.value(name);
if (v.isValid())
@@ -118,7 +117,7 @@ void RenderSettings::resetToDefaults()
auto v = pdv.value(name);
if (v.isValid())
mp.write(this, v);
- Config::inst()->remove(u"LDraw/RenderSettings/" % name);
+ Config::inst()->remove(u"LDraw/RenderSettings/" + name);
});
}
diff --git a/src/mobile/mobileuihelpers.cpp b/src/mobile/mobileuihelpers.cpp
index a748bdbb..596dce93 100644
--- a/src/mobile/mobileuihelpers.cpp
+++ b/src/mobile/mobileuihelpers.cpp
@@ -238,7 +238,7 @@ QCoro::Task> MobileUIHelpers::getFileName(bool doSave, QS
fileName = QFileInfo(fileName).fileName();
if (auto fn = co_await getInputString(tr("Save File as"), fileName, false, title))
- co_return QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation) % u'/' % *fn;
+ co_return QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation) + u'/' + *fn;
co_return { };
}
#endif
diff --git a/src/utility/exception.cpp b/src/utility/exception.cpp
index 53743648..c3fef06f 100644
--- a/src/utility/exception.cpp
+++ b/src/utility/exception.cpp
@@ -11,11 +11,65 @@
**
** See http://fsf.org/licensing/licenses/gpl.html for GPL licensing information.
*/
+#include
+#include
#include "exception.h"
+Exception::Exception(const QString &message)
+ : QException()
+ , m_errorString(message)
+{ }
+
+Exception::Exception(const char *message)
+ : Exception(QString::fromLatin1(message))
+{ }
+
+Exception::Exception(QFileDevice *f, const QString &message)
+ : Exception(message + fileMessage(f))
+{ }
+
+Exception::Exception(QFileDevice *f, const char *message)
+ : Exception(QLatin1String(message) + fileMessage(f))
+{ }
+
+Exception::Exception(const Exception ©)
+ : m_errorString(copy.m_errorString)
+{ }
+
+Exception::Exception(Exception &&move)
+ : m_errorString(move.m_errorString)
+{
+ std::swap(m_whatBuffer, move.m_whatBuffer);
+}
+
const char *Exception::what() const noexcept
{
- whatBuffer = m_message.toLocal8Bit();
- return whatBuffer.constData();
+ if (!m_whatBuffer)
+ m_whatBuffer.reset(new QByteArray);
+ *m_whatBuffer = m_errorString.toLocal8Bit();
+ return m_whatBuffer->constData();
+}
+
+QString Exception::fileMessage(QFileDevice *f)
+{
+ return f ? QString(u" (" + f->fileName() + u"): " + f->errorString()) : QString();
+}
+
+
+
+ParseException::ParseException(const char *message)
+ : Exception(u"Parse error: "_qs + QLatin1String(message))
+{ }
+
+ParseException::ParseException(QIODevice *dev, const char *message)
+ : Exception(QString::fromLatin1("Parse error%1: %2")
+ .arg(fileName(dev)).arg(QLatin1String(message)))
+{ }
+
+QString ParseException::fileName(QIODevice *dev)
+{
+ if (auto file = qobject_cast(dev))
+ return u" in file " + file->fileName();
+ return { };
}
diff --git a/src/utility/exception.h b/src/utility/exception.h
index 97c686d3..c6b0cae3 100755
--- a/src/utility/exception.h
+++ b/src/utility/exception.h
@@ -14,78 +14,52 @@
#pragma once
+#include
+
#include
#include
-#include
-#include
-#include
+
+QT_FORWARD_DECLARE_CLASS(QIODevice);
+QT_FORWARD_DECLARE_CLASS(QFileDevice);
class Exception : public QException
{
public:
- Exception(const QString &message)
- : QException()
- , m_message(message)
- { }
+ explicit Exception(const QString &message = { });
+ explicit Exception(const char *message);
+ explicit Exception(QFileDevice *f, const QString &message);
+ explicit Exception(QFileDevice *f, const char *message);
- Exception(const char *message)
- : Exception(QString::fromLatin1(message))
- { }
+ Exception(const Exception ©);
+ Exception(Exception &&move);
- Exception(QFileDevice *f, const QString &message)
- : Exception(message % fileMessage(f))
- { }
+ virtual ~Exception() = default;
- Exception(QFileDevice *f, const char *message)
- : Exception(QLatin1String(message) % fileMessage(f))
- { }
-
- template Exception &arg(const T &t)
+ template inline Exception &arg(const Ts & ...ts)
{
- m_message = m_message.arg(t);
+ m_errorString = m_errorString.arg(ts...);
return *this;
}
- QString error() const
- {
- return m_message;
- }
-
+ inline QString errorString() const { return m_errorString; }
const char *what() const noexcept override;
protected:
- static QString fileMessage(QFileDevice *f)
- {
- return f ? QString(u" (" % f->fileName() % u"): " % f->errorString()) : QString();
- }
+ static QString fileMessage(QFileDevice *f);
- QString m_message;
+ QString m_errorString;
private:
- mutable QByteArray whatBuffer;
+ mutable std::unique_ptr m_whatBuffer;
};
class ParseException : public Exception
{
public:
- ParseException(const char *message)
- : Exception(u"Parse error: "_qs + QLatin1String(message))
- { }
-
- ParseException(QIODevice *dev, const char *message)
- : Exception(QString::fromLatin1("Parse error%1: %2")
- .arg(fileName(dev)).arg(QLatin1String(message)))
- { }
+ ParseException(const char *message);
+ ParseException(QIODevice *dev, const char *message);
private:
- static QString fileName(QIODevice *dev)
- {
- if (auto file = qobject_cast(dev))
- return u" in file " % file->fileName();
- return { };
- }
+ static QString fileName(QIODevice *dev);
};
-
-
-
diff --git a/src/utility/transfer.cpp b/src/utility/transfer.cpp
index c2c6ac56..8b3d3d09 100644
--- a/src/utility/transfer.cpp
+++ b/src/utility/transfer.cpp
@@ -11,7 +11,6 @@
**
** See http://fsf.org/licensing/licenses/gpl.html for GPL licensing information.
*/
-#include
#include
#include
#include
@@ -133,7 +132,7 @@ Transfer::Transfer(QObject *parent)
: QObject(parent)
{
if (s_default_user_agent.isEmpty())
- s_default_user_agent = qApp->applicationName() % u'/' % qApp->applicationVersion();
+ s_default_user_agent = qApp->applicationName() + u'/' + qApp->applicationVersion();
m_user_agent = s_default_user_agent;
m_retriever = new TransferRetriever(this);