Verified Commit ee5ec9c5 authored by Jonah Brüchert's avatar Jonah Brüchert 🌳

Use QStringLiteral everywhere

parent 787c2289
...@@ -14,6 +14,7 @@ set(angelfish_webapp_SRCS ...@@ -14,6 +14,7 @@ set(angelfish_webapp_SRCS
add_executable(angelfish-webapp ${angelfish_webapp_SRCS} ${RESOURCES} ${WEBAPP_RESOURCES}) add_executable(angelfish-webapp ${angelfish_webapp_SRCS} ${RESOURCES} ${WEBAPP_RESOURCES})
target_include_directories(angelfish-webapp PRIVATE ../src/) target_include_directories(angelfish-webapp PRIVATE ../src/)
target_compile_definitions(angelfish-webapp PRIVATE -DQT_NO_CAST_FROM_ASCII)
target_link_libraries(angelfish-webapp target_link_libraries(angelfish-webapp
Qt5::Core Qt5::Core
Qt5::Qml Qt5::Qml
......
...@@ -57,7 +57,7 @@ Q_DECL_EXPORT int main(int argc, char *argv[]) ...@@ -57,7 +57,7 @@ Q_DECL_EXPORT int main(int argc, char *argv[])
// Command line parser // Command line parser
QCommandLineParser parser; QCommandLineParser parser;
parser.addPositionalArgument("desktopfile", i18n("desktop file to open"), "[file]"); parser.addPositionalArgument(QStringLiteral("desktopfile"), i18n("desktop file to open"), QStringLiteral("[file]"));
parser.addHelpOption(); parser.addHelpOption();
parser.process(app); parser.process(app);
...@@ -85,7 +85,7 @@ Q_DECL_EXPORT int main(int argc, char *argv[]) ...@@ -85,7 +85,7 @@ Q_DECL_EXPORT int main(int argc, char *argv[])
KAboutLicense::GPL, KAboutLicense::GPL,
i18n("Copyright 2020 Angelfish developers")); i18n("Copyright 2020 Angelfish developers"));
QApplication::setWindowIcon(QIcon::fromTheme(desktopFile.readIcon())); QApplication::setWindowIcon(QIcon::fromTheme(desktopFile.readIcon()));
aboutData.addAuthor(i18n("Marco Martin"), QString(), "mart@kde.org"); aboutData.addAuthor(i18n("Marco Martin"), QString(), QStringLiteral("mart@kde.org"));
KAboutData::setApplicationData(aboutData); KAboutData::setApplicationData(aboutData);
......
...@@ -14,6 +14,7 @@ set(angelfish_SRCS ...@@ -14,6 +14,7 @@ set(angelfish_SRCS
qt5_add_resources(RESOURCES resources.qrc) qt5_add_resources(RESOURCES resources.qrc)
add_executable(angelfish ${angelfish_SRCS} ${RESOURCES}) add_executable(angelfish ${angelfish_SRCS} ${RESOURCES})
target_compile_definitions(angelfish PRIVATE -DQT_NO_CAST_FROM_ASCII)
target_link_libraries(angelfish target_link_libraries(angelfish
Qt5::Core Qt5::Core
Qt5::Qml Qt5::Qml
......
...@@ -78,20 +78,20 @@ void BrowserManager::setHomepage(const QString &homepage) ...@@ -78,20 +78,20 @@ void BrowserManager::setHomepage(const QString &homepage)
{ {
if (this->homepage() == homepage) if (this->homepage() == homepage)
return; return;
m_settings->setValue("browser/homepage", homepage); m_settings->setValue(QStringLiteral("browser/homepage"), homepage);
emit homepageChanged(); emit homepageChanged();
} }
QString BrowserManager::homepage() QString BrowserManager::homepage()
{ {
return m_settings->value("browser/homepage", "https://start.duckduckgo.com").toString(); return m_settings->value(QStringLiteral("browser/homepage"), QStringLiteral("https://start.duckduckgo.com")).toString();
} }
void BrowserManager::setSearchBaseUrl(const QString &searchBaseUrl) void BrowserManager::setSearchBaseUrl(const QString &searchBaseUrl)
{ {
if (this->searchBaseUrl() == searchBaseUrl) if (this->searchBaseUrl() == searchBaseUrl)
return; return;
m_settings->setValue("browser/searchBaseUrl", searchBaseUrl); m_settings->setValue(QStringLiteral("browser/searchBaseUrl"), searchBaseUrl);
emit searchBaseUrlChanged(); emit searchBaseUrlChanged();
} }
...@@ -112,7 +112,7 @@ QSettings *BrowserManager::settings() const ...@@ -112,7 +112,7 @@ QSettings *BrowserManager::settings() const
QString BrowserManager::searchBaseUrl() QString BrowserManager::searchBaseUrl()
{ {
return m_settings->value("browser/searchBaseUrl", "https://start.duckduckgo.com/?q=").toString(); return m_settings->value(QStringLiteral("browser/searchBaseUrl"), QStringLiteral("https://start.duckduckgo.com/?q=")).toString();
} }
BrowserManager *BrowserManager::instance() BrowserManager *BrowserManager::instance()
......
...@@ -155,12 +155,12 @@ void DBManager::trimIcons() ...@@ -155,12 +155,12 @@ void DBManager::trimIcons()
void DBManager::addRecord(const QString &table, const QVariantMap &pagedata) void DBManager::addRecord(const QString &table, const QVariantMap &pagedata)
{ {
QString url = pagedata.value("url").toString(); QString url = pagedata.value(QStringLiteral("url")).toString();
QString title = pagedata.value("title").toString(); QString title = pagedata.value(QStringLiteral("title")).toString();
QString icon = pagedata.value("icon").toString(); QString icon = pagedata.value(QStringLiteral("icon")).toString();
qint64 lastVisited = QDateTime::currentSecsSinceEpoch(); qint64 lastVisited = QDateTime::currentSecsSinceEpoch();
if (url.isEmpty() || url == "about:blank") if (url.isEmpty() || url == QStringLiteral("about:blank"))
return; return;
QSqlQuery query; QSqlQuery query;
......
...@@ -42,7 +42,7 @@ void DesktopFileGenerator::createDesktopFile(const QString &name, const QString ...@@ -42,7 +42,7 @@ void DesktopFileGenerator::createDesktopFile(const QString &name, const QString
{ {
QString location = QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation); QString location = QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation);
QString filename = name.toLower(); QString filename = name.toLower();
filename.replace(" ", "_"); filename.replace(QStringLiteral(" "), QStringLiteral("_"));
QString path = QStringLiteral("%1/%2.desktop").arg(location, filename); QString path = QStringLiteral("%1/%2.desktop").arg(location, filename);
KConfig desktopFile(path, KConfig::SimpleConfig); KConfig desktopFile(path, KConfig::SimpleConfig);
...@@ -59,7 +59,7 @@ void DesktopFileGenerator::createDesktopFile(const QString &name, const QString ...@@ -59,7 +59,7 @@ void DesktopFileGenerator::createDesktopFile(const QString &name, const QString
void DesktopFileGenerator::storeIcon(const QString &url, const QString &fileName) void DesktopFileGenerator::storeIcon(const QString &url, const QString &fileName)
{ {
auto *provider = static_cast<QQuickImageProvider *>(m_engine->imageProvider("favicon")); auto *provider = static_cast<QQuickImageProvider *>(m_engine->imageProvider(QStringLiteral("favicon")));
QLatin1String prefix_favicon = QLatin1String("image://favicon/"); QLatin1String prefix_favicon = QLatin1String("image://favicon/");
QString providerIconName = url.mid(prefix_favicon.size()); QString providerIconName = url.mid(prefix_favicon.size());
...@@ -68,11 +68,11 @@ void DesktopFileGenerator::storeIcon(const QString &url, const QString &fileName ...@@ -68,11 +68,11 @@ void DesktopFileGenerator::storeIcon(const QString &url, const QString &fileName
QSize szObtained; QSize szObtained;
QString iconLocation = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) QString iconLocation = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)
+ "/icons/hicolor/16x16/apps/"; + QStringLiteral("/icons/hicolor/16x16/apps/");
QDir().mkpath(iconLocation); QDir().mkpath(iconLocation);
auto imageFile = new QFile(iconLocation + fileName + ".png"); auto imageFile = new QFile(iconLocation + fileName + QStringLiteral(".png"));
if (!imageFile->open(QIODevice::WriteOnly)) { if (!imageFile->open(QIODevice::WriteOnly)) {
qDebug() << Q_FUNC_INFO << "Failed to open image file"; qDebug() << Q_FUNC_INFO << "Failed to open image file";
......
...@@ -45,7 +45,7 @@ IconImageProvider::IconImageProvider(QQmlApplicationEngine *engine) ...@@ -45,7 +45,7 @@ IconImageProvider::IconImageProvider(QQmlApplicationEngine *engine)
QString IconImageProvider::providerId() QString IconImageProvider::providerId()
{ {
return "angelfish-favicon"; return QStringLiteral("angelfish-favicon");
} }
QString IconImageProvider::storeImage(const QString &iconSource) QString IconImageProvider::storeImage(const QString &iconSource)
...@@ -79,7 +79,7 @@ QString IconImageProvider::storeImage(const QString &iconSource) ...@@ -79,7 +79,7 @@ QString IconImageProvider::storeImage(const QString &iconSource)
query_check.finish(); query_check.finish();
// Store new icon // Store new icon
QQuickImageProvider *provider = static_cast<QQuickImageProvider *>(s_engine->imageProvider("favicon")); QQuickImageProvider *provider = static_cast<QQuickImageProvider *>(s_engine->imageProvider(QStringLiteral("favicon")));
if (provider == nullptr) { if (provider == nullptr) {
qWarning() << Q_FUNC_INFO << "Failed to load image provider" << url; qWarning() << Q_FUNC_INFO << "Failed to load image provider" << url;
return iconSource; // as something is wrong return iconSource; // as something is wrong
......
...@@ -46,9 +46,9 @@ Q_DECL_EXPORT int main(int argc, char *argv[]) ...@@ -46,9 +46,9 @@ Q_DECL_EXPORT int main(int argc, char *argv[])
#endif #endif
QApplication app(argc, argv); QApplication app(argc, argv);
QCoreApplication::setOrganizationName("KDE"); QCoreApplication::setOrganizationName(QStringLiteral("KDE"));
QCoreApplication::setOrganizationDomain("mobile.kde.org"); QCoreApplication::setOrganizationDomain(QStringLiteral("mobile.kde.org"));
QCoreApplication::setApplicationName("angelfish"); QCoreApplication::setApplicationName(QStringLiteral("angelfish"));
#if QT_VERSION <= QT_VERSION_CHECK(5, 14, 0) #if QT_VERSION <= QT_VERSION_CHECK(5, 14, 0)
QtWebEngine::initialize(); QtWebEngine::initialize();
...@@ -56,7 +56,7 @@ Q_DECL_EXPORT int main(int argc, char *argv[]) ...@@ -56,7 +56,7 @@ Q_DECL_EXPORT int main(int argc, char *argv[])
// Command line parser // Command line parser
QCommandLineParser parser; QCommandLineParser parser;
parser.addPositionalArgument("url", i18n("URL to open"), "[url]"); parser.addPositionalArgument(QStringLiteral("url"), i18n("URL to open"), QStringLiteral("[url]"));
parser.addHelpOption(); parser.addHelpOption();
parser.process(app); parser.process(app);
......
...@@ -189,7 +189,7 @@ bool TabsModel::saveTabs() const ...@@ -189,7 +189,7 @@ bool TabsModel::saveTabs() const
QString outputDir = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QStringLiteral("/angelfish/"); QString outputDir = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QStringLiteral("/angelfish/");
QFile outputFile(outputDir + QStringLiteral("tabs.json")); QFile outputFile(outputDir + QStringLiteral("tabs.json"));
if (!QDir(outputDir).mkpath(".")) { if (!QDir(outputDir).mkpath(QStringLiteral("."))) {
qDebug() << "Destdir doesn't exist and I can't create it: " << outputDir; qDebug() << "Destdir doesn't exist and I can't create it: " << outputDir;
return false; return false;
} }
......
...@@ -14,7 +14,7 @@ QString UserAgent::userAgent() const ...@@ -14,7 +14,7 @@ QString UserAgent::userAgent() const
"Mozilla/5.0 (%1) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/%2 " "Mozilla/5.0 (%1) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/%2 "
"Chrome/75.0.3770.116 %3 Safari/537.36") "Chrome/75.0.3770.116 %3 Safari/537.36")
.arg(m_isMobile ? QStringLiteral("Linux; Plasma Mobile, like Android 9.0") : QStringLiteral("X11; Linux x86_64")) .arg(m_isMobile ? QStringLiteral("Linux; Plasma Mobile, like Android 9.0") : QStringLiteral("X11; Linux x86_64"))
.arg(QTWEBENGINE_VERSION_STR) .arg(QStringLiteral(QTWEBENGINE_VERSION_STR))
.arg(m_isMobile ? QStringLiteral("Mobile") : QStringLiteral("Desktop")); .arg(m_isMobile ? QStringLiteral("Mobile") : QStringLiteral("Desktop"));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment