Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace QLatin1String with QStringLiteral #769

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion liblxqt-config-cursor/cfgfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ const QString findDefaultTheme()
if (!s.startsWith(QLatin1String("Xcursor.theme:"))) continue;
s.remove(0, 14);
s = s.trimmed();
if (s.isEmpty()) s = QLatin1String("default");
if (s.isEmpty()) s = QStringLiteral("default");
res = s;
}
fl.close();
Expand Down
4 changes: 2 additions & 2 deletions liblxqt-config-cursor/crtheme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ XCursorThemeData::XCursorThemeData(const QDir &aDir)
mPath = aDir.path();
setName(aDir.dirName());
if (aDir.exists(QStringLiteral("index.theme"))) parseIndexFile();
if (mDescription.isEmpty()) mDescription = QLatin1String("no description");
if (mDescription.isEmpty()) mDescription = QStringLiteral("no description");
if (mTitle.isEmpty()) mTitle = mName;
}

void XCursorThemeData::parseIndexFile()
{
QMultiMap<QString, QString> cfg = loadCfgFile(mPath + QString::fromUtf8("/index.theme"), true);
QMultiMap<QString, QString> cfg = loadCfgFile(mPath + QLatin1String("/index.theme"), true);
if (cfg.contains(QStringLiteral("icon theme/name"))) mTitle = cfg.values(QStringLiteral("icon theme/name")).at(0).trimmed();
if (cfg.contains(QStringLiteral("icon theme/comment"))) mDescription = cfg.values(QStringLiteral("icon theme/comment")).at(0).trimmed();
if (cfg.contains(QStringLiteral("icon theme/example"))) mSample = cfg.values(QStringLiteral("icon theme/example")).at(0).trimmed();
Expand Down
2 changes: 1 addition & 1 deletion liblxqt-config-cursor/thememodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ bool XCursorThemeModel::handleDefault(const QDir &themeDir)
}
return true;
}
mDefaultName = QLatin1String("default");
mDefaultName = QStringLiteral("default");
return false;
}

Expand Down
4 changes: 2 additions & 2 deletions liblxqt-config-cursor/xcr/xcrtheme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ void XCursorTheme::parseThemeIndex (const QDir &dir) {
fl.close();
}
if (mDescr.isEmpty() && !cmt.isEmpty()) mDescr = cmt;
if (mSample.isEmpty()) mSample = QLatin1String("left_ptr");
if (mSample.isEmpty()) mSample = QStringLiteral("left_ptr");
mInherits.removeDuplicates();
}

Expand Down Expand Up @@ -542,7 +542,7 @@ Inherits=core
if (url.isEmpty()) url = mSite;
if (dscr.isEmpty()) dscr = mDescr;
if (cmt.isEmpty()) cmt = dscr;
/*if (sample.isEmpty())*/ sample = QLatin1String("left_ptr");
/*if (sample.isEmpty())*/ sample = QStringLiteral("left_ptr");
if (inhs.size() == 0) inhs << QStringLiteral("core");
inhs.removeDuplicates();
dumpInfo();
Expand Down
2 changes: 1 addition & 1 deletion liblxqt-config-cursor/xcr/xcrxcur.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ XCursorImagesXCur::XCursorImagesXCur (const QString &aFileName) : XCursorImages(
if (name.isEmpty() || name.endsWith(QLatin1Char('/'))) return;
int i = name.lastIndexOf(QLatin1Char('/'));
QString dir;
if (i < 0) dir = QLatin1String("./"); else dir = name.left(i);
if (i < 0) dir = QStringLiteral("./"); else dir = name.left(i);
name = name.mid(i+1);
setName(name); setPath(dir);
parseCursorFile(aFileName);
Expand Down
10 changes: 5 additions & 5 deletions lxqt-config-appearance/configothertoolkits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ QString ConfigOtherToolKits::getDefaultGTKTheme()

void ConfigOtherToolKits::updateConfigFromSettings()
{
mSettings->beginGroup(QLatin1String("Qt"));
mSettings->beginGroup(QStringLiteral("Qt"));
QFont font;
font.fromString(mSettings->value(QStringLiteral("font")).toString());
// Font name from: https://developer.gnome.org/pango/stable/pango-Fonts.html#pango-font-description-from-string
Expand All @@ -427,17 +427,17 @@ void ConfigOtherToolKits::updateConfigFromSettings()
mConfig.buttonStyle = 1;
switch(val) {
case Qt::ToolButtonIconOnly:
mConfig.toolButtonStyle = QLatin1String("GTK_TOOLBAR_ICONS");
mConfig.toolButtonStyle = QStringLiteral("GTK_TOOLBAR_ICONS");
break;
case Qt::ToolButtonTextOnly:
mConfig.toolButtonStyle = QLatin1String("GTK_TOOLBAR_TEXT");
mConfig.toolButtonStyle = QStringLiteral("GTK_TOOLBAR_TEXT");
mConfig.buttonStyle = 0;
break;
case Qt::ToolButtonTextUnderIcon:
mConfig.toolButtonStyle = QLatin1String("GTK_TOOLBAR_BOTH");
mConfig.toolButtonStyle = QStringLiteral("GTK_TOOLBAR_BOTH");
break;
default:
mConfig.toolButtonStyle = QLatin1String("GTK_TOOLBAR_BOTH_HORIZ");
mConfig.toolButtonStyle = QStringLiteral("GTK_TOOLBAR_BOTH_HORIZ");
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions lxqt-config-appearance/fontsconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ FontsConfig::~FontsConfig()
void FontsConfig::initControls()
{
// read Qt style settings from Qt Trolltech.conf config
mQtSettings->beginGroup(QLatin1String("Qt"));
mQtSettings->beginGroup(QStringLiteral("Qt"));

QString fontName = mQtSettings->value(QStringLiteral("font")).toString();
QFont font;
Expand Down Expand Up @@ -179,8 +179,8 @@ void FontsConfig::updateQtFont()
font.setItalic(italic);

const QString fontStr = font.toString();
if(mQtSettings->value(QLatin1String("Qt/font")).toString() != fontStr) {
mQtSettings->beginGroup(QLatin1String("Qt"));
if(mQtSettings->value(QStringLiteral("Qt/font")).toString() != fontStr) {
mQtSettings->beginGroup(QStringLiteral("Qt"));
mQtSettings->setValue(QStringLiteral("font"), fontStr);
mQtSettings->endGroup();
mQtSettings->sync();
Expand Down
8 changes: 4 additions & 4 deletions lxqt-config-appearance/styleconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,12 @@ void StyleConfig::initControls()
ui->gtk3ComboBox->setCurrentText(mConfigOtherToolKits->getGTKThemeFromRCFile(QStringLiteral("3.0")));

// Qt style
mSettings->beginGroup(QLatin1String("Qt"));
mSettings->beginGroup(QStringLiteral("Qt"));
ui->qtComboBox->setCurrentText(mSettings->value(QStringLiteral("style")).toString());
mSettings->endGroup();

// palette
mSettings->beginGroup(QLatin1String("Palette"));
mSettings->beginGroup(QStringLiteral("Palette"));
QColor color;
color.setNamedColor(mSettings->value(QStringLiteral("window_color")).toString());
if (!color.isValid())
Expand Down Expand Up @@ -190,13 +190,13 @@ void StyleConfig::applyStyle()
{
// Qt style
QString themeName = ui->qtComboBox->currentText();;
mQtSettings->beginGroup(QLatin1String("Qt"));
mQtSettings->beginGroup(QStringLiteral("Qt"));
if(mQtSettings->value(QStringLiteral("style")).toString() != themeName)
mQtSettings->setValue(QStringLiteral("style"), themeName);
mQtSettings->endGroup();

// palette
mSettings->beginGroup(QLatin1String("Palette"));
mSettings->beginGroup(QStringLiteral("Palette"));
QColor color = ui->winColorLabel->getColor();
QColor oldColor;
oldColor.setNamedColor(mQtSettings->value(QStringLiteral("window_color")).toString());
Expand Down
8 changes: 4 additions & 4 deletions lxqt-config-input/keyboardconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ void KeyboardConfig::loadSettings() {
oldNumlock = numlock = settings->value(QStringLiteral("numlock"), false).toBool();
settings->endGroup();

qtSettings->beginGroup(QLatin1String("Qt"));
oldFlashTime = flashTime = qtSettings->value(QLatin1String("cursorFlashTime"), 1000).toInt();
qtSettings->beginGroup(QStringLiteral("Qt"));
oldFlashTime = flashTime = qtSettings->value(QStringLiteral("cursorFlashTime"), 1000).toInt();
qtSettings->endGroup();
}

Expand All @@ -154,8 +154,8 @@ void KeyboardConfig::accept() {
settings->setValue(QStringLiteral("numlock"), numlock);
settings->endGroup();

qtSettings->beginGroup(QLatin1String("Qt"));
qtSettings->setValue(QLatin1String("cursorFlashTime"), flashTime);
qtSettings->beginGroup(QStringLiteral("Qt"));
qtSettings->setValue(QStringLiteral("cursorFlashTime"), flashTime);
qtSettings->endGroup();
}

Expand Down
16 changes: 8 additions & 8 deletions lxqt-config-input/keyboardlayoutconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ KeyboardLayoutConfig::~KeyboardLayoutConfig() {
void KeyboardLayoutConfig::loadSettings() {
// load current settings from the output of setxkbmap command
QProcess setxkbmap;
setxkbmap.start(QLatin1String("setxkbmap"), QStringList() << QLatin1String("-query")
<< QLatin1String("-verbose") << QLatin1String("5"));
setxkbmap.start(QStringLiteral("setxkbmap"), QStringList() << QStringLiteral("-query")
<< QStringLiteral("-verbose") << QStringLiteral("5"));
setxkbmap.waitForFinished();
if(setxkbmap.exitStatus() == QProcess::NormalExit) {
QList<QByteArray> layouts, variants;
Expand Down Expand Up @@ -103,7 +103,7 @@ enum ListSection{
void KeyboardLayoutConfig::loadLists() {
// load known lists from xkb data files
// XKBD_BASELIST_PATH is os dependent see keyboardlayoutconfig.h
QFile file(QLatin1String(XKBD_BASELIST_PATH));
QFile file(QStringLiteral(XKBD_BASELIST_PATH));
if(file.open(QIODevice::ReadOnly)) {
ListSection section = NoSection;
while(!file.atEnd()) {
Expand Down Expand Up @@ -230,7 +230,7 @@ void KeyboardLayoutConfig::applyConfig() {
int cur_model = ui.keyboardModel->currentIndex();
if(cur_model >= 0) {
model = ui.keyboardModel->itemData(cur_model, Qt::UserRole).toString();
args += QLatin1String("-model");
args += QStringLiteral("-model");
args += model;
}

Expand All @@ -247,18 +247,18 @@ void KeyboardLayoutConfig::applyConfig() {
variants += QLatin1Char(',');
}
}
args += QLatin1String("-layout");
args += QStringLiteral("-layout");
args += layouts;

if (variants.indexOf(QLatin1Char(',')) > -1 || !variants.isEmpty()) {
args += QLatin1String("-variant");
args += QStringLiteral("-variant");
args += variants;
}
}

for(const QString& option : qAsConst(currentOptions_)) {
if (!option.startsWith(QLatin1String("grp:"))) {
args += QLatin1String("-option");
args += QStringLiteral("-option");
args += option;
}
}
Expand All @@ -267,7 +267,7 @@ void KeyboardLayoutConfig::applyConfig() {
int cur_switch_key = ui.switchKey->currentIndex();
if(cur_switch_key > 0) { // index 0 is "None"
switchKey = ui.switchKey->itemData(cur_switch_key, Qt::UserRole).toString();
args += QLatin1String("-option");
args += QStringLiteral("-option");
args += switchKey;
}

Expand Down
22 changes: 11 additions & 11 deletions lxqt-config-input/mouseconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,26 +165,26 @@ void MouseConfig::applyConfig()
}

void MouseConfig::loadSettings() {
oldSingleClick = singleClick = qtSettings->value(QLatin1String("single_click_activate"), false).toBool();
oldSingleClick = singleClick = qtSettings->value(QStringLiteral("single_click_activate"), false).toBool();

qtSettings->beginGroup(QLatin1String("Qt"));
oldDoubleClickInterval = doubleClickInterval = qtSettings->value(QLatin1String("doubleClickInterval"), 400).toInt();
oldWheelScrollLines = wheelScrollLines = qtSettings->value(QLatin1String("wheelScrollLines"), 3).toInt();
qtSettings->beginGroup(QStringLiteral("Qt"));
oldDoubleClickInterval = doubleClickInterval = qtSettings->value(QStringLiteral("doubleClickInterval"), 400).toInt();
oldWheelScrollLines = wheelScrollLines = qtSettings->value(QStringLiteral("wheelScrollLines"), 3).toInt();
qtSettings->endGroup();

settings->beginGroup(QLatin1String("Mouse"));
oldAccel = accel = settings->value(QLatin1String("accel_factor"), 20).toInt();
oldThreshold = threshold = settings->value(QLatin1String("accel_threshold"), 10).toInt();
oldLeftHanded = leftHanded = settings->value(QLatin1String("left_handed"), false).toBool();
settings->beginGroup(QStringLiteral("Mouse"));
oldAccel = accel = settings->value(QStringLiteral("accel_factor"), 20).toInt();
oldThreshold = threshold = settings->value(QStringLiteral("accel_threshold"), 10).toInt();
oldLeftHanded = leftHanded = settings->value(QStringLiteral("left_handed"), false).toBool();
settings->endGroup();
}

void MouseConfig::accept() {
qtSettings->setValue(QStringLiteral("single_click_activate"), singleClick);

qtSettings->beginGroup(QLatin1String("Qt"));
qtSettings->setValue(QLatin1String("doubleClickInterval"), doubleClickInterval);
qtSettings->setValue(QLatin1String("wheelScrollLines"), wheelScrollLines);
qtSettings->beginGroup(QStringLiteral("Qt"));
qtSettings->setValue(QStringLiteral("doubleClickInterval"), doubleClickInterval);
qtSettings->setValue(QStringLiteral("wheelScrollLines"), wheelScrollLines);
qtSettings->endGroup();

settings->beginGroup(QStringLiteral("Mouse"));
Expand Down
2 changes: 1 addition & 1 deletion lxqt-config-monitor/monitorpicture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ MonitorPicture::MonitorPicture(QGraphicsItem * parent,
// textItem->setY(y);
// textItem->setParentItem(this);

QSvgRenderer *renderer = new QSvgRenderer(QLatin1String(ICON_PATH "monitor.svg"));
QSvgRenderer *renderer = new QSvgRenderer(QStringLiteral(ICON_PATH "monitor.svg"));
svgItem = new QGraphicsSvgItem();
svgItem->setSharedRenderer(renderer);
svgItem->setX(x);
Expand Down