aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorConfuSomu2024-01-26 13:52:47 -0500
committerConfuSomu2024-01-26 13:52:47 -0500
commitfa9b2130f43547be7e4698b8d95a23155c5d3ee1 (patch)
tree4d97cee4f744ae7de55fc25e24786411deb4f706
parentd561873e43de73b5ed48367bed6b6fcdfdefc174 (diff)
downloadActorViewer-fa9b2130f43547be7e4698b8d95a23155c5d3ee1.tar
ActorViewer-fa9b2130f43547be7e4698b8d95a23155c5d3ee1.tar.gz
ActorViewer-fa9b2130f43547be7e4698b8d95a23155c5d3ee1.zip
Use QStringLiteral in some places
This should provide a light performance improvement as the QString is built at compile time, with the generated data being stored in the read-only segment of the built object file.
-rw-r--r--src/activitypub/apactivity.cpp2
-rw-r--r--src/activitypub/apattachment.cpp4
-rw-r--r--src/activitypub/appost.cpp2
-rw-r--r--src/activitypub/apquestion.cpp4
-rw-r--r--src/mainwindow.cpp2
-rw-r--r--src/widgets/tab_activity_list.cpp2
-rw-r--r--src/widgets/tab_actor_info.cpp2
7 files changed, 9 insertions, 9 deletions
diff --git a/src/activitypub/apactivity.cpp b/src/activitypub/apactivity.cpp
index 6717731..b44f87a 100644
--- a/src/activitypub/apactivity.cpp
+++ b/src/activitypub/apactivity.cpp
@@ -27,7 +27,7 @@ APActivity::~APActivity() {
}
QString APActivity::get_html_render(HtmlRenderDetails render_info) {
- QString html(get_html_template("apactivity"));
+ QString html(get_html_template(QStringLiteral("apactivity")));
switch (type) {
case APActivityType::CREATE:
diff --git a/src/activitypub/apattachment.cpp b/src/activitypub/apattachment.cpp
index 342ea21..b5c82ce 100644
--- a/src/activitypub/apattachment.cpp
+++ b/src/activitypub/apattachment.cpp
@@ -11,7 +11,7 @@ APAttachment::APAttachment(APAttachmentFields fields) {
}
QString APAttachment::get_html_render(HtmlRenderDetails info) {
- QString html(get_html_template("apattachment"));
+ QString html(get_html_template(QStringLiteral("apattachment")));
if (not path_url.isEmpty()) {
html.replace("{{path}}", path_url);
@@ -59,7 +59,7 @@ QString APAttachmentList::get_html_render(HtmlRenderDetails render_info) {
int i = 1;
for (APAttachment attachment : *this) {
- QString item_html(get_html_template("apattachmentlist_item"));
+ QString item_html(get_html_template(QStringLiteral("apattachmentlist_item")));
item_html.replace("{{id}}", QString::number(i));
item_html.replace("{{attachment}}", attachment.get_html_render(render_info));
diff --git a/src/activitypub/appost.cpp b/src/activitypub/appost.cpp
index 87d6f08..c1f78d4 100644
--- a/src/activitypub/appost.cpp
+++ b/src/activitypub/appost.cpp
@@ -42,7 +42,7 @@ QString APPost::get_html_status_languages() {
}
QString APPost::get_html_render(HtmlRenderDetails render_info) {
- QString html(get_html_template("appost"));
+ QString html(get_html_template(QStringLiteral("appost")));
if (published.isValid()) {
// Using QLocale::toString() is forward compatible with Qt 6 as QDateTime::toString() will not return anymore a string in the system locale.
diff --git a/src/activitypub/apquestion.cpp b/src/activitypub/apquestion.cpp
index 9cdffd0..3796174 100644
--- a/src/activitypub/apquestion.cpp
+++ b/src/activitypub/apquestion.cpp
@@ -16,7 +16,7 @@ APQuestion::APQuestion(APObjectFields fields) : APPost(fields) {
QString APQuestion::get_html_render(HtmlRenderDetails render_info) {
QString html(APPost::get_html_render(render_info));
- html.append(get_html_template("appoll"));
+ html.append(get_html_template(QStringLiteral("appoll")));
if (end_time.isValid()) {
html.replace("{{end-time}}", render_info.locale->toString(
@@ -39,7 +39,7 @@ QString APQuestion::get_html_poll_options(HtmlRenderDetails render_info) {
QString full;
for (PollOption option : options) {
- QString html(get_html_template("appoll_item"));
+ QString html(get_html_template(QStringLiteral("appoll_item")));
html.replace("{{name}}", option.name);
html.replace("{{votes}}", render_info.locale->toString(option.votes));
html.replace("{{votes-percent}}", render_info.locale->toString((int)((float)option.votes/(float)total_votes * 100)));
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 16686c4..7789cf4 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -70,7 +70,7 @@ void MainWindow::act_command_line(CommandLineParsedOptions &options, QCommandLin
QMessageBox::critical(this, tr("Command line"), tr("The passed command line is incorrect and will be ignored.\nMore information: %1").arg(options.error_message)); exit(EXIT_FAILURE);
break;
case CommandLineHelpRequested:
- QMessageBox::information(this, QGuiApplication::applicationDisplayName(), "<pre>" + parser.helpText() + "</pre>"); exit(EXIT_SUCCESS);
+ QMessageBox::information(this, QGuiApplication::applicationDisplayName(), QStringLiteral("<pre>%1</pre>").arg(parser.helpText())); exit(EXIT_SUCCESS);
break;
case CommandLineVersionRequested:
on_actionAbout_triggered(true); exit(EXIT_SUCCESS);
diff --git a/src/widgets/tab_activity_list.cpp b/src/widgets/tab_activity_list.cpp
index dd40de7..bd396c5 100644
--- a/src/widgets/tab_activity_list.cpp
+++ b/src/widgets/tab_activity_list.cpp
@@ -85,7 +85,7 @@ void TabActivityList::set_search_text(const QString &text) {
void TabActivityList::actionOpen_URL_triggered(bool checked) {
bool ok;
- QString url = QInputDialog::getText(this, tr("Open status from URL"), tr("Status URL:"), QLineEdit::Normal, "https://…", &ok);
+ QString url = QInputDialog::getText(this, tr("Open status from URL"), tr("Status URL:"), QLineEdit::Normal, QStringLiteral("https://…"), &ok);
// TODO: Move all of this to another thread
// TODO: Reuse the Instance object
diff --git a/src/widgets/tab_actor_info.cpp b/src/widgets/tab_actor_info.cpp
index f991366..9d35b29 100644
--- a/src/widgets/tab_actor_info.cpp
+++ b/src/widgets/tab_actor_info.cpp
@@ -32,7 +32,7 @@ TabActorInfo::~TabActorInfo() {
// TODO: do this in another thread, like for status_info
void TabActorInfo::update_ui() {
if (not actor) {
- ui->displayNameText->setText(QString("<html><head/><body><p><span style=\"font-size:14pt; font-weight:600;\">%1</span></p></body></html>").arg(tr("Failed to display Actor")));
+ ui->displayNameText->setText(QStringLiteral("<html><head/><body><p><span style=\"font-size:14pt; font-weight:600;\">%1</span></p></body></html>").arg(tr("Failed to display Actor")));
ui->avatarImage->setText("");
return;
}