Gui: Use QStringLiteral

This commit is contained in:
Benjamin Bræstrup Sayoc
2025-02-09 18:33:01 +01:00
parent 24ac19e261
commit 8d2d0a47f4
83 changed files with 519 additions and 520 deletions

View File

@@ -366,7 +366,7 @@ MainWindow::MainWindow(QWidget * parent, Qt::WindowFlags f)
tab->setTabsClosable(true);
// The tabs might be very wide
tab->setExpanding(false);
tab->setObjectName(QString::fromLatin1("mdiAreaTabBar"));
tab->setObjectName(QStringLiteral("mdiAreaTabBar"));
}
d->mdiArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
d->mdiArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
@@ -377,7 +377,7 @@ MainWindow::MainWindow(QWidget * parent, Qt::WindowFlags f)
d->mdiArea->setBackground(QBrush(QColor(160,160,160)));
setCentralWidget(d->mdiArea);
statusBar()->setObjectName(QString::fromLatin1("statusBar"));
statusBar()->setObjectName(QStringLiteral("statusBar"));
connect(statusBar(), &QStatusBar::messageChanged, this, &MainWindow::statusMessageChanged);
// labels and progressbar
@@ -401,24 +401,24 @@ MainWindow::MainWindow(QWidget * parent, Qt::WindowFlags f)
if(notificationAreaEnabled) {
NotificationArea* notificationArea = new NotificationArea(statusBar());
notificationArea->setObjectName(QString::fromLatin1("notificationArea"));
notificationArea->setObjectName(QStringLiteral("notificationArea"));
notificationArea->setStyleSheet(QStringLiteral("text-align:left;"));
statusBar()->addPermanentWidget(notificationArea);
}
// clears the action label
d->actionTimer = new QTimer( this );
d->actionTimer->setObjectName(QString::fromLatin1("actionTimer"));
d->actionTimer->setObjectName(QStringLiteral("actionTimer"));
connect(d->actionTimer, &QTimer::timeout, d->actionLabel, &QLabel::clear);
// clear status type
d->statusTimer = new QTimer( this );
d->statusTimer->setObjectName(QString::fromLatin1("statusTimer"));
d->statusTimer->setObjectName(QStringLiteral("statusTimer"));
connect(d->statusTimer, &QTimer::timeout, this, &MainWindow::clearStatus);
// update gui timer
d->activityTimer = new QTimer(this);
d->activityTimer->setObjectName(QString::fromLatin1("activityTimer"));
d->activityTimer->setObjectName(QStringLiteral("activityTimer"));
connect(d->activityTimer, &QTimer::timeout, this, &MainWindow::_updateActions);
d->activityTimer->setSingleShot(false);
d->activityTimer->start(150);
@@ -1317,16 +1317,16 @@ void MainWindow::onWindowsMenuAboutToShow()
QAction* action = actions.at(index);
QString text;
QString title = child->windowTitle();
int lastIndex = title.lastIndexOf(QString::fromLatin1("[*]"));
int lastIndex = title.lastIndexOf(QStringLiteral("[*]"));
if (lastIndex > 0) {
title = title.left(lastIndex);
if (child->isWindowModified())
title = QString::fromLatin1("%1*").arg(title);
title = QStringLiteral("%1*").arg(title);
}
if (index < 9)
text = QString::fromLatin1("&%1 %2").arg(index+1).arg(title);
text = QStringLiteral("&%1 %2").arg(index+1).arg(title);
else
text = QString::fromLatin1("%1 %2").arg(index+1).arg(title);
text = QStringLiteral("%1 %2").arg(index+1).arg(title);
action->setText(text);
action->setVisible(true);
action->setChecked(child == active);
@@ -1591,7 +1591,7 @@ void MainWindow::delayedStartup()
void MainWindow::appendRecentFile(const QString& filename)
{
auto recent = this->findChild<RecentFilesAction *>
(QString::fromLatin1("recentFiles"));
(QStringLiteral("recentFiles"));
if (recent) {
recent->appendFile(filename);
}
@@ -1600,7 +1600,7 @@ void MainWindow::appendRecentFile(const QString& filename)
void MainWindow::appendRecentMacro(const QString& filename)
{
auto recent = this->findChild<RecentMacrosAction *>
(QString::fromLatin1("recentMacros"));
(QStringLiteral("recentMacros"));
if (recent) {
recent->appendFile(filename);
}
@@ -2155,7 +2155,7 @@ void MainWindow::changeEvent(QEvent *e)
void MainWindow::clearStatus() {
d->currentStatusType = 100;
statusBar()->setStyleSheet(QString::fromLatin1("#statusBar{}"));
statusBar()->setStyleSheet(QStringLiteral("#statusBar{}"));
}
void MainWindow::statusMessageChanged() {
@@ -2214,7 +2214,7 @@ void MainWindow::showStatus(int type, const QString& message)
statusBar()->setStyleSheet(d->status->wrn);
break;
case MainWindow::Pane:
statusBar()->setStyleSheet(QString::fromLatin1("#statusBar{}"));
statusBar()->setStyleSheet(QStringLiteral("#statusBar{}"));
break;
default:
statusBar()->setStyleSheet(d->status->msg);
@@ -2313,11 +2313,11 @@ void MainWindow::setWindowTitle(const QString& string)
}
if (SafeMode::SafeModeEnabled()) {
title = QString::fromUtf8("%1 (%2)").arg(title, tr("Safe Mode"));
title = QStringLiteral("%1 (%2)").arg(title, tr("Safe Mode"));
}
if (!string.isEmpty()) {
title = QString::fromUtf8("[*] %1 - %2").arg(string, title);
title = QStringLiteral("[*] %1 - %2").arg(string, title);
}
QMainWindow::setWindowTitle(title);
@@ -2328,9 +2328,9 @@ void MainWindow::setWindowTitle(const QString& string)
StatusBarObserver::StatusBarObserver()
: WindowParameter("OutputWindow")
{
msg = QString::fromLatin1("#statusBar{color: #000000}"); // black
wrn = QString::fromLatin1("#statusBar{color: #ffaa00}"); // orange
err = QString::fromLatin1("#statusBar{color: #ff0000}"); // red
msg = QStringLiteral("#statusBar{color: #000000}"); // black
wrn = QStringLiteral("#statusBar{color: #ffaa00}"); // orange
err = QStringLiteral("#statusBar{color: #ff0000}"); // red
Base::Console().AttachObserver(this);
getWindowParameter()->Attach(this);
getWindowParameter()->NotifyAll();
@@ -2345,7 +2345,7 @@ void MainWindow::setWindowTitle(const QString& string)
void StatusBarObserver::OnChange(Base::Subject<const char*> & rCaller, const char* sReason)
{
ParameterGrp& rclGrp = ((ParameterGrp&)rCaller);
auto format = QString::fromLatin1("#statusBar{color: %1}");
auto format = QStringLiteral("#statusBar{color: %1}");
if (strcmp(sReason, "colorText") == 0) {
unsigned long col = rclGrp.GetUnsigned(sReason);
this->msg = format.arg(App::Color::fromPackedRGB<QColor>(col).name());