Commit d8c75e32 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix some clazy warning

parent 3ec4efe7
......@@ -42,7 +42,7 @@ QWidget *setupPage(Ui &ui)
}
ConfigDialog::ConfigDialog(QWidget *parent)
: KConfigDialog(parent, "Settings", GwenviewConfig::self())
: KConfigDialog(parent, QStringLiteral("Settings"), GwenviewConfig::self())
{
setFaceType(KPageDialog::List);
......
......@@ -38,9 +38,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA
// Local
#include "gwenview_app_debug.h"
#include <chrono>
#include <lib/flowlayout.h>
#include <lib/paintutils.h>
using namespace std::chrono_literals;
#ifndef GWENVIEW_SEMANTICINFO_BACKEND_NONE
// KF
......@@ -66,7 +69,7 @@ NameFilterWidget::NameFilterWidget(SortedDirModel *model)
layout->addWidget(mLineEdit);
auto *timer = new QTimer(this);
timer->setInterval(350);
timer->setInterval(350ms);
timer->setSingleShot(true);
connect(timer, &QTimer::timeout, this, &NameFilterWidget::applyNameFilter);
......
......@@ -177,7 +177,7 @@ struct GvCorePrivate {
QString name = GwenviewConfig::fullScreenColorScheme();
if (name.isEmpty()) {
// Default color scheme
mFullScreenPaletteName = QStandardPaths::locate(QStandardPaths::AppDataLocation, "color-schemes/fullscreen.colors");
mFullScreenPaletteName = QStandardPaths::locate(QStandardPaths::AppDataLocation, QStringLiteral("color-schemes/fullscreen.colors"));
config = KSharedConfig::openConfig(mFullScreenPaletteName);
} else if (name.contains('/')) {
// Full path to a .colors file
......@@ -201,7 +201,7 @@ struct GvCorePrivate {
if (Gwenview::GwenviewConfig::fullScreenBackground() == Gwenview::FullScreenBackground::Black) {
bgTexture.fill(Qt::black);
} else {
QString path = QStandardPaths::locate(QStandardPaths::AppDataLocation, "images/background.png");
QString path = QStandardPaths::locate(QStandardPaths::AppDataLocation, QStringLiteral("images/background.png"));
bgTexture = path;
}
viewPalette.setBrush(QPalette::Base, bgTexture);
......
......@@ -102,17 +102,17 @@ struct ImageOpsContextManagerItem::Private {
mFlipAction->setText(i18n("Flip"));
mFlipAction->setIcon(QIcon::fromTheme(QStringLiteral("object-flip-vertical")));
mResizeAction = edit->addAction("resize", q, SLOT(resizeImage()));
mResizeAction = edit->addAction(QStringLiteral("resize"), q, SLOT(resizeImage()));
mResizeAction->setText(i18n("Resize"));
mResizeAction->setIcon(QIcon::fromTheme(QStringLiteral("transform-scale")));
actionCollection->setDefaultShortcut(mResizeAction, Qt::SHIFT | Qt::Key_R);
mCropAction = edit->addAction("crop", q, SLOT(crop()));
mCropAction = edit->addAction(QStringLiteral("crop"), q, SLOT(crop()));
mCropAction->setText(i18n("Crop"));
mCropAction->setIcon(QIcon::fromTheme(QStringLiteral("transform-crop-and-resize")));
actionCollection->setDefaultShortcut(mCropAction, Qt::SHIFT | Qt::Key_C);
mRedEyeReductionAction = edit->addAction("red_eye_reduction", q, SLOT(startRedEyeReduction()));
mRedEyeReductionAction = edit->addAction(QStringLiteral("red_eye_reduction"), q, SLOT(startRedEyeReduction()));
mRedEyeReductionAction->setText(i18n("Reduce Red Eye"));
mRedEyeReductionAction->setIcon(QIcon::fromTheme(QStringLiteral("redeyes")));
actionCollection->setDefaultShortcut(mRedEyeReductionAction, Qt::SHIFT | Qt::Key_E);
......
......@@ -128,7 +128,7 @@ public:
mMainWindow->show();
if (mFullScreen) {
mMainWindow->actionCollection()->action("fullscreen")->trigger();
mMainWindow->actionCollection()->action(QStringLiteral("fullscreen"))->trigger();
} else {
mMainWindow->show();
}
......
......@@ -45,7 +45,7 @@ RenameDialog::RenameDialog(QWidget *parent)
d->setupUi(this);
QPushButton *okButton = d->mButtonBox->button(QDialogButtonBox::Ok);
KGuiItem::assign(okButton, KGuiItem(i18nc("@action:button", "Rename"), "edit-rename"));
KGuiItem::assign(okButton, KGuiItem(i18nc("@action:button", "Rename"), QStringLiteral("edit-rename")));
connect(d->mFilename, &QLineEdit::textChanged, this, &RenameDialog::updateButtons);
}
......
......@@ -80,11 +80,11 @@ void SaveAllHelper::save()
// Done, show message if necessary
if (d->mErrorList.count() > 0) {
QString msg = i18ncp("@info", "One document could not be saved:", "%1 documents could not be saved:", d->mErrorList.count());
msg += "<ul>";
msg += QLatin1String("<ul>");
for (const QString &item : qAsConst(d->mErrorList)) {
msg += "<li>" + item + "</li>";
}
msg += "</ul>";
msg += QLatin1String("</ul>");
KMessageBox::sorry(d->mParent, msg);
}
}
......
......@@ -194,7 +194,7 @@ struct SaveBarPrivate {
mMessageLabel->setText(message);
mMessageLabel->setMaximumWidth(mMessageLabel->minimumSizeHint().width());
mActionsLabel->setText(links.join(" | "));
mActionsLabel->setText(links.join(QStringLiteral(" | ")));
}
void updateWidgetSizes()
......@@ -218,7 +218,7 @@ SaveBar::SaveBar(QWidget *parent, KActionCollection *actionCollection)
d->q = this;
d->mActionCollection = actionCollection;
d->mSaveBarWidget = new QWidget();
d->mSaveBarWidget->setObjectName(QLatin1String("saveBarWidget"));
d->mSaveBarWidget->setObjectName(QStringLiteral("saveBarWidget"));
d->applyNormalStyleSheet();
d->mMessageLabel = new QLabel;
......@@ -276,15 +276,15 @@ SaveBar::~SaveBar()
void SaveBar::initActionDependentWidgets()
{
d->mUndoButton->setDefaultAction(d->mActionCollection->action("edit_undo"));
d->mRedoButton->setDefaultAction(d->mActionCollection->action("edit_redo"));
d->mSaveCurrentUrlButton->setDefaultAction(d->mActionCollection->action("file_save"));
d->mSaveAsButton->setDefaultAction(d->mActionCollection->action("file_save_as"));
d->mUndoButton->setDefaultAction(d->mActionCollection->action(QStringLiteral("edit_undo")));
d->mRedoButton->setDefaultAction(d->mActionCollection->action(QStringLiteral("edit_redo")));
d->mSaveCurrentUrlButton->setDefaultAction(d->mActionCollection->action(QStringLiteral("file_save")));
d->mSaveAsButton->setDefaultAction(d->mActionCollection->action(QStringLiteral("file_save_as")));
// FIXME: Not using an action for now
d->mSaveAllButton->setText(i18n("Save All"));
d->mSaveAllButton->setToolTip(i18nc("@info:tooltip", "Save all modified images"));
d->mSaveAllButton->setIcon(QIcon::fromTheme("document-save-all"));
d->mSaveAllButton->setIcon(QIcon::fromTheme(QStringLiteral("document-save-all")));
connect(d->mSaveAllButton, &QToolButton::clicked, this, &SaveBar::requestSaveAll);
d->mSaveAllFullScreenButton->setText(i18n("Save All"));
......@@ -330,14 +330,14 @@ void SaveBar::updateContent()
void SaveBar::triggerAction(const QString &action)
{
QList<QUrl> lst = DocumentFactory::instance()->modifiedDocumentList();
if (action == "first") {
if (action == QLatin1String("first")) {
emit goToUrl(lst[0]);
} else if (action == "previous") {
} else if (action == QLatin1String("previous")) {
int pos = lst.indexOf(d->mCurrentUrl);
--pos;
Q_ASSERT(pos >= 0);
emit goToUrl(lst[pos]);
} else if (action == "next") {
} else if (action == QLatin1String("next")) {
int pos = lst.indexOf(d->mCurrentUrl);
++pos;
Q_ASSERT(pos < lst.size());
......
......@@ -202,9 +202,9 @@ struct SemanticInfoContextManagerItemPrivate : public Ui_SemanticInfoSideBarItem
{
auto *edit = new KActionCategory(i18nc("@title actions category", "Edit"), mActionCollection);
mEditTagsAction = edit->addAction("edit_tags");
mEditTagsAction = edit->addAction(QStringLiteral("edit_tags"));
mEditTagsAction->setText(i18nc("@action", "Edit Tags"));
mEditTagsAction->setIcon(QIcon::fromTheme("tag"));
mEditTagsAction->setIcon(QIcon::fromTheme(QStringLiteral("tag")));
mActionCollection->setDefaultShortcut(mEditTagsAction, Qt::CTRL | Qt::Key_T);
QObject::connect(mEditTagsAction, &QAction::triggered, q, &SemanticInfoContextManagerItem::showSemanticInfoDialog);
mActions << mEditTagsAction;
......@@ -251,7 +251,7 @@ struct SemanticInfoContextManagerItemPrivate : public Ui_SemanticInfoSideBarItem
}
labelMap[label.toLower()] = label;
}
QStringList labels(labelMap.values());
const QStringList labels(labelMap.values());
for (const QString &label : labels) {
DecoratedTag *decoratedTag = new DecoratedTag(label);
......
......@@ -75,7 +75,7 @@ void ThumbnailViewHelper::setCurrentDirUrl(const QUrl &url)
void ThumbnailViewHelper::showContextMenu(QWidget *parent)
{
QMenu popup(parent);
if (d->mCurrentDirUrl.scheme() == "trash") {
if (d->mCurrentDirUrl.scheme() == QLatin1String("trash")) {
d->addActionToMenu(popup, "file_restore");
d->addActionToMenu(popup, "deletefile");
popup.addSeparator();
......
......@@ -270,7 +270,7 @@ struct ViewMainPagePrivate {
QString css = itemCss + itemSelCss + itemHovCss;
if (orientation == Qt::Vertical) {
css.replace("left", "top").replace("right", "bottom");
css.replace(QLatin1String("left"), QLatin1String("top")).replace(QLatin1String("right"), QLatin1String("bottom"));
}
mThumbnailBar->setStyleSheet(css);
......@@ -428,7 +428,7 @@ ViewMainPage::ViewMainPage(QWidget *parent, SlideShow *slideShow, KActionCollect
connect(d->mToggleThumbnailBarAction, &KToggleAction::triggered, this, &ViewMainPage::setThumbnailBarVisibility);
d->mToggleThumbnailBarButton->setDefaultAction(d->mToggleThumbnailBarAction);
d->mSynchronizeAction = view->add<KToggleAction>("synchronize_views");
d->mSynchronizeAction = view->add<KToggleAction>(QStringLiteral("synchronize_views"));
d->mSynchronizeAction->setText(i18n("Synchronize"));
actionCollection->setDefaultShortcut(d->mSynchronizeAction, Qt::CTRL | Qt::Key_Y);
connect(d->mSynchronizeAction, &QAction::toggled, d->mSynchronizer, &DocumentViewSynchronizer::setActive);
......
......@@ -163,9 +163,9 @@ public:
mCentralWidget->setCurrentWidget(mDialogPage);
mDialogPage->setText(i18n("What do you want to do now?"));
mDialogPage->removeButtons();
int gwenview = mDialogPage->addButton(KGuiItem(i18n("View Imported Documents with Gwenview"), "gwenview"));
int gwenview = mDialogPage->addButton(KGuiItem(i18n("View Imported Documents with Gwenview"), QStringLiteral("gwenview")));
int importMore = mDialogPage->addButton(KGuiItem(i18n("Import more Documents")));
mDialogPage->addButton(KGuiItem(i18n("Quit"), "dialog-cancel"));
mDialogPage->addButton(KGuiItem(i18n("Quit"), QStringLiteral("dialog-cancel")));
int answer = mDialogPage->exec();
if (answer == gwenview) {
......
......@@ -42,16 +42,17 @@ struct ImporterConfigDialogPrivate : public Ui_ImporterConfigDialog {
void setupHelpText()
{
QString helpText = "<ul>";
QString helpText = QLatin1String("<ul>");
FileNameFormater::HelpMap map = FileNameFormater::helpMap();
FileNameFormater::HelpMap::ConstIterator it = map.constBegin(), end = map.constEnd();
for (; it != end; ++it) {
QString keyword = '{' + it.key() + '}';
QString explanation = it.value().toHtmlEscaped();
QString link = QStringLiteral("<a href='%1'>%1</a>").arg(keyword);
helpText += "<li>" + i18nc("%1 is the importer keyword, %2 is keyword explanation", "%1: %2", link, explanation) + "</li>";
helpText +=
QLatin1String("<li>") + i18nc("%1 is the importer keyword, %2 is keyword explanation", "%1: %2", link, explanation) + QLatin1String("</li>");
}
helpText += "</ul>";
helpText += QLatin1String("</ul>");
mRenameFormatHelpLabel->setText(helpText);
QObject::connect(mRenameFormatHelpLabel, SIGNAL(linkActivated(QString)), q, SLOT(slotHelpLinkActivated(QString)));
......
......@@ -51,7 +51,7 @@ int main(int argc, char *argv[])
aboutData.data()->setupCommandLine(&parser);
parser.addOption(
QCommandLineOption(QStringLiteral("udi"), i18n("The device UDI, used to retrieve information about the device (name, icon...)"), i18n("Device UDI")));
parser.addPositionalArgument("folder", i18n("Source folder"));
parser.addPositionalArgument(QStringLiteral("folder"), i18n("Source folder"));
parser.process(app);
aboutData.data()->processCommandLine(&parser);
......
......@@ -28,8 +28,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA
namespace Gwenview
{
struct ProgressPagePrivate : public Ui_ProgressPage {
ProgressPage *q;
Importer *mImporter;
ProgressPage *q = nullptr;
Importer *mImporter = nullptr;
};
ProgressPage::ProgressPage(Importer *importer)
......
......@@ -267,7 +267,7 @@ void ThumbnailPage::openUrl(const QUrl &url)
d->mSrcUrl = url;
QString path = QDir(d->mSrcBaseUrl.path()).relativeFilePath(d->mSrcUrl.path());
QString text;
if (path.isEmpty() || path == ".") {
if (path.isEmpty() || path == QLatin1String(".")) {
text = d->mSrcBaseName;
} else {
path = QUrl::fromPercentEncoding(path.toUtf8());
......
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