Commit 02ce8d79 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

change auto * => auto (when possible) + const'ify variable + use nullptr

parent 868d3d31
......@@ -105,7 +105,7 @@ struct BrowseMainPagePrivate : public Ui_BrowseMainPage {
mUrlNavigator = new KUrlNavigator(mFilePlacesModel, QUrl(), mUrlNavigatorContainer);
mUrlNavigatorContainer->setAutoFillBackground(true);
mUrlNavigatorContainer->setBackgroundRole(QPalette::Mid);
auto *layout = new QVBoxLayout(mUrlNavigatorContainer);
auto layout = new QVBoxLayout(mUrlNavigatorContainer);
layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(mUrlNavigator);
QObject::connect(mUrlNavigator, SIGNAL(urlsDropped(QUrl, QDropEvent *)), q, SLOT(slotUrlsDropped(QUrl, QDropEvent *)));
......@@ -131,7 +131,7 @@ struct BrowseMainPagePrivate : public Ui_BrowseMainPage {
QAction *thumbnailDetailAction(const QString &text, PreviewItemDelegate::ThumbnailDetail detail)
{
auto *action = new QAction(q);
auto action = new QAction(q);
action->setText(text);
action->setCheckable(true);
action->setChecked(GwenviewConfig::thumbnailDetails() & detail);
......@@ -143,12 +143,12 @@ struct BrowseMainPagePrivate : public Ui_BrowseMainPage {
void setupActions(KActionCollection *actionCollection)
{
auto *view = new KActionCategory(i18nc("@title actions category - means actions changing smth in interface", "View"), actionCollection);
auto view = new KActionCategory(i18nc("@title actions category - means actions changing smth in interface", "View"), actionCollection);
QAction *action = view->addAction("edit_location", q, SLOT(editLocation()));
action->setText(i18nc("@action:inmenu Navigation Bar", "Edit Location"));
actionCollection->setDefaultShortcut(action, Qt::Key_F6);
auto *sortActionMenu = view->add<KActionMenu>("sort_by");
auto sortActionMenu = view->add<KActionMenu>("sort_by");
sortActionMenu->setText(i18nc("@action:inmenu", "Sort By"));
sortActionMenu->setIcon(QIcon::fromTheme(QStringLiteral("view-sort")));
sortActionMenu->setPopupMode(QToolButton::InstantPopup);
......@@ -182,7 +182,7 @@ struct BrowseMainPagePrivate : public Ui_BrowseMainPage {
mThumbnailDetailsActionGroup = new QActionGroup(q);
mThumbnailDetailsActionGroup->setExclusive(false);
auto *thumbnailDetailsAction = view->add<KActionMenu>("thumbnail_details");
auto thumbnailDetailsAction = view->add<KActionMenu>("thumbnail_details");
thumbnailDetailsAction->setText(i18nc("@action:inmenu", "Thumbnail Details"));
thumbnailDetailsAction->addAction(thumbnailDetailAction(i18nc("@action:inmenu", "Filename"), PreviewItemDelegate::FileNameDetail));
thumbnailDetailsAction->addAction(thumbnailDetailAction(i18nc("@action:inmenu", "Date"), PreviewItemDelegate::DateDetail));
......@@ -192,7 +192,7 @@ struct BrowseMainPagePrivate : public Ui_BrowseMainPage {
thumbnailDetailsAction->addAction(thumbnailDetailAction(i18nc("@action:inmenu", "Rating"), PreviewItemDelegate::RatingDetail));
#endif
auto *file = new KActionCategory(i18nc("@title actions category", "File"), actionCollection);
auto file = new KActionCategory(i18nc("@title actions category", "File"), actionCollection);
action = file->addAction(QStringLiteral("add_folder_to_places"), q, SLOT(addFolderToPlaces()));
action->setText(i18nc("@action:inmenu", "Add Folder to Places"));
action->setIcon(QIcon::fromTheme(QStringLiteral("bookmark-new")));
......@@ -200,7 +200,7 @@ struct BrowseMainPagePrivate : public Ui_BrowseMainPage {
void setupFilterController()
{
auto *menu = new QMenu(mAddFilterButton);
auto menu = new QMenu(mAddFilterButton);
mFilterController = new FilterController(mFilterFrame, mDirModel);
const auto actionList = mFilterController->actionList();
for (QAction *action : actionList) {
......
......@@ -35,7 +35,7 @@ namespace Gwenview
template<class Ui>
QWidget *setupPage(Ui &ui)
{
auto *widget = new QWidget;
auto widget = new QWidget;
ui.setupUi(widget);
widget->layout()->setContentsMargins(0, 0, 0, 0);
return widget;
......
......@@ -51,7 +51,7 @@ static void copyMoveOrLink(Operation operation, const QList<QUrl> &urlList, QWid
Q_ASSERT(!urlList.isEmpty());
const int numberOfImages = urlList.count();
auto *dialog = new QFileDialog(parent->nativeParentWidget(), QString());
auto dialog = new QFileDialog(parent->nativeParentWidget(), QString());
dialog->setAcceptMode(QFileDialog::AcceptSave);
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->setModal(true);
......@@ -220,7 +220,7 @@ void showMenuForDroppedUrls(QWidget *parent, const QList<QUrl> &urlList, const Q
void rename(const QUrl &oldUrl, QWidget *parent, ContextManager *contextManager)
{
auto *dialog = new RenameDialog(parent);
auto dialog = new RenameDialog(parent);
dialog->setFilename(oldUrl.fileName());
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->setModal(true);
......
......@@ -112,7 +112,7 @@ QUrl FileOpsContextManagerItem::pasteTargetUrl() const
static QAction *createSeparator(QObject *parent)
{
auto *action = new QAction(parent);
auto action = new QAction(parent);
action->setSeparator(true);
return action;
}
......@@ -135,8 +135,8 @@ FileOpsContextManagerItem::FileOpsContextManagerItem(ContextManager *manager,
connect(contextManager(), &ContextManager::selectionChanged, this, &FileOpsContextManagerItem::updateActions);
connect(contextManager(), &ContextManager::currentDirUrlChanged, this, &FileOpsContextManagerItem::updateActions);
auto *file = new KActionCategory(i18nc("@title actions category", "File"), actionCollection);
auto *edit = new KActionCategory(i18nc("@title actions category", "Edit"), actionCollection);
auto file = new KActionCategory(i18nc("@title actions category", "File"), actionCollection);
auto edit = new KActionCategory(i18nc("@title actions category", "Edit"), actionCollection);
mCutAction = edit->addAction(KStandardAction::Cut, this, SLOT(cut()));
mCopyAction = edit->addAction(KStandardAction::Copy, this, SLOT(copy()));
......@@ -184,7 +184,7 @@ FileOpsContextManagerItem::FileOpsContextManagerItem(ContextManager *manager,
mOpenWithAction = file->addAction(QStringLiteral("file_open_with"));
mOpenWithAction->setText(i18n("Open With"));
auto *menu = new QMenu;
auto menu = new QMenu;
mOpenWithAction->setMenu(menu);
connect(menu, &QMenu::aboutToShow, this, &FileOpsContextManagerItem::populateOpenMenu);
connect(menu, &QMenu::triggered, this, &FileOpsContextManagerItem::openWith);
......@@ -385,7 +385,7 @@ void FileOpsContextManagerItem::openWith(QAction *action)
service = mServiceList.at(idx);
}
// If service is null, ApplicationLauncherJob will invoke the open-with dialog
auto *job = new KIO::ApplicationLauncherJob(service);
auto job = new KIO::ApplicationLauncherJob(service);
job->setUrls(list);
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, mGroup));
job->start();
......
......@@ -62,13 +62,13 @@ NameFilterWidget::NameFilterWidget(SortedDirModel *model)
mLineEdit = new QLineEdit;
auto *layout = new QHBoxLayout(this);
auto layout = new QHBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(2);
layout->addWidget(mModeComboBox);
layout->addWidget(mLineEdit);
auto *timer = new QTimer(this);
auto timer = new QTimer(this);
timer->setInterval(350ms);
timer->setSingleShot(true);
connect(timer, &QTimer::timeout, this, &NameFilterWidget::applyNameFilter);
......@@ -103,7 +103,7 @@ DateFilterWidget::DateFilterWidget(SortedDirModel *model)
mDateWidget = new DateWidget;
auto *layout = new QHBoxLayout(this);
auto layout = new QHBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(mModeComboBox);
layout->addWidget(mDateWidget);
......@@ -138,7 +138,7 @@ RatingFilterWidget::RatingFilterWidget(SortedDirModel *model)
mRatingWidget->setHalfStepsEnabled(true);
mRatingWidget->setMaxRating(10);
auto *layout = new QHBoxLayout(this);
auto layout = new QHBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(mModeComboBox);
layout->addWidget(mRatingWidget);
......@@ -178,7 +178,7 @@ TagFilterWidget::TagFilterWidget(SortedDirModel *model)
mTagComboBox = new QComboBox;
auto *layout = new QHBoxLayout(this);
auto layout = new QHBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(mModeComboBox);
layout->addWidget(mTagComboBox);
......@@ -187,7 +187,7 @@ TagFilterWidget::TagFilterWidget(SortedDirModel *model)
backEnd->refreshAllTags();
TagModel *tagModel = TagModel::createAllTagsModel(this, backEnd);
auto *completer = new QCompleter(mTagComboBox);
auto completer = new QCompleter(mTagComboBox);
completer->setCaseSensitivity(Qt::CaseInsensitive);
completer->setModel(tagModel);
mTagComboBox->setCompleter(completer);
......@@ -238,14 +238,14 @@ public:
void setFilterWidget(QWidget *widget)
{
auto *closeButton = new QToolButton;
auto closeButton = new QToolButton;
closeButton->setIcon(QIcon::fromTheme(QStringLiteral("window-close")));
closeButton->setAutoRaise(true);
closeButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
int size = style()->pixelMetric(QStyle::PM_SmallIconSize);
closeButton->setIconSize(QSize(size, size));
connect(closeButton, &QAbstractButton::clicked, this, &QObject::deleteLater);
auto *layout = new QHBoxLayout(this);
auto layout = new QHBoxLayout(this);
layout->setContentsMargins(2, 2, 2, 2);
layout->setSpacing(2);
layout->addWidget(widget);
......@@ -275,7 +275,7 @@ FilterController::FilterController(QFrame *frame, SortedDirModel *dirModel)
mFilterWidgetCount = 0;
mFrame->hide();
auto *layout = new FlowLayout(mFrame);
auto layout = new FlowLayout(mFrame);
layout->setSpacing(2);
addAction(i18nc("@action:inmenu", "Filter by Name"), SLOT(addFilterByName()), QKeySequence(Qt::CTRL | Qt::Key_I));
......@@ -326,7 +326,7 @@ void FilterController::slotFilterWidgetClosed()
void FilterController::addAction(const QString &text, const char *slot, const QKeySequence &shortcut)
{
auto *action = new QAction(text, q);
auto action = new QAction(text, q);
action->setShortcut(shortcut);
QObject::connect(action, SIGNAL(triggered()), q, slot);
mActionList << action;
......@@ -337,7 +337,7 @@ void FilterController::addFilter(QWidget *widget)
if (mFrame->isHidden()) {
mFrame->show();
}
auto *container = new FilterWidgetContainer;
auto container = new FilterWidgetContainer;
container->setFilterWidget(widget);
mFrame->layout()->addWidget(container);
......
......@@ -72,7 +72,7 @@ public:
void addAction(QAction *action, Qt::ToolButtonStyle style = Qt::ToolButtonIconOnly)
{
auto *button = new QToolButton;
auto button = new QToolButton;
button->setDefaultAction(action);
button->setToolButtonStyle(style);
button->setAutoRaise(true);
......@@ -116,7 +116,7 @@ void FullScreenContent::init(KActionCollection *actionCollection, QWidget *autoH
// mAutoHideContainer
mAutoHideContainer = new FullScreenBar(autoHideParentWidget);
mAutoHideContainer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
auto *layout = new QVBoxLayout(mAutoHideContainer);
auto layout = new QVBoxLayout(mAutoHideContainer);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
......@@ -164,7 +164,7 @@ void FullScreenContent::init(KActionCollection *actionCollection, QWidget *autoH
mInformationContainer->setAutoFillBackground(true);
mInformationContainer->setBackgroundRole(QPalette::Mid);
mInformationContainerShadow = new ShadowFilter(mInformationContainer);
auto *hLayout = new QHBoxLayout(mInformationContainer);
auto hLayout = new QHBoxLayout(mInformationContainer);
hLayout->setContentsMargins(0, 0, 0, 0);
hLayout->addWidget(mInformationLabel);
hLayout->addWidget(mDocumentCountLabel);
......@@ -172,7 +172,7 @@ void FullScreenContent::init(KActionCollection *actionCollection, QWidget *autoH
// Thumbnail bar
mThumbnailBar = new ThumbnailBarView(mContent);
mThumbnailBar->setThumbnailScaleMode(ThumbnailView::ScaleToSquare);
auto *delegate = new ThumbnailBarItemDelegate(mThumbnailBar);
auto delegate = new ThumbnailBarItemDelegate(mThumbnailBar);
mThumbnailBar->setItemDelegate(delegate);
mThumbnailBar->setSelectionMode(QAbstractItemView::ExtendedSelection);
// Calculate minimum bar height to give mInformationLabel exactly two lines height
......@@ -296,7 +296,7 @@ void FullScreenContent::updateLayout()
if (GwenviewConfig::showFullScreenThumbnails()) {
mRightToolBar->setDirection(QBoxLayout::TopToBottom);
auto *layout = new QHBoxLayout(mContent);
auto layout = new QHBoxLayout(mContent);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
QVBoxLayout *vLayout;
......@@ -340,7 +340,7 @@ void FullScreenContent::updateLayout()
} else {
mRightToolBar->setDirection(QBoxLayout::RightToLeft);
auto *layout = new QHBoxLayout(mContent);
auto layout = new QHBoxLayout(mContent);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
layout->addWidget(mToolBar);
......@@ -426,7 +426,7 @@ void FullScreenContent::showOptionsMenu()
// Put widget in a menu
QMenu menu;
auto *action = new QWidgetAction(&menu);
auto action = new QWidgetAction(&menu);
action->setDefaultWidget(widget);
menu.addAction(action);
......
......@@ -73,14 +73,14 @@ struct GvCorePrivate {
KFileCustomDialog *createSaveAsDialog(const QUrl &url)
{
// Build the JPEG quality chooser custom widget
auto *JPEGQualityChooserWidget = new QWidget;
auto JPEGQualityChooserWidget = new QWidget;
JPEGQualityChooserWidget->setVisible(false); // shown only for JPEGs
auto *JPEGQualityChooserLabel = new QLabel;
auto JPEGQualityChooserLabel = new QLabel;
JPEGQualityChooserLabel->setText(i18n("Image quality:"));
JPEGQualityChooserLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
auto *JPEGQualityChooserSpinBox = new QSpinBox;
auto JPEGQualityChooserSpinBox = new QSpinBox;
JPEGQualityChooserSpinBox->setMinimum(1);
JPEGQualityChooserSpinBox->setMaximum(100);
JPEGQualityChooserSpinBox->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
......@@ -93,16 +93,16 @@ struct GvCorePrivate {
GwenviewConfig::setJPEGQuality(value);
});
auto *horizontalSpacer = new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Fixed);
auto horizontalSpacer = new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Fixed);
auto *JPEGQualityChooserLayout = new QHBoxLayout(JPEGQualityChooserWidget);
auto JPEGQualityChooserLayout = new QHBoxLayout(JPEGQualityChooserWidget);
JPEGQualityChooserLayout->setContentsMargins(0, 0, 0, 0);
JPEGQualityChooserLayout->addWidget(JPEGQualityChooserLabel);
JPEGQualityChooserLayout->addWidget(JPEGQualityChooserSpinBox);
JPEGQualityChooserLayout->addItem(horizontalSpacer);
// Set up the dialog
auto *dialog = new KFileCustomDialog(mMainWindow);
auto dialog = new KFileCustomDialog(mMainWindow);
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->setModal(true);
KFileWidget *fileWidget = dialog->fileWidget();
......@@ -475,14 +475,14 @@ void GvCore::saveAs(const QUrl &url)
static void applyTransform(const QUrl &url, Orientation orientation)
{
auto *op = new TransformImageOperation(orientation);
auto op = new TransformImageOperation(orientation);
Document::Ptr doc = DocumentFactory::instance()->load(url);
op->applyToDocument(doc);
}
void GvCore::slotSaveResult(KJob *_job)
{
auto *job = static_cast<SaveJob *>(_job);
auto job = static_cast<SaveJob *>(_job);
QUrl oldUrl = job->oldUrl();
QUrl newUrl = job->newUrl();
......@@ -504,7 +504,7 @@ void GvCore::slotSaveResult(KJob *_job)
ViewMainPage *page = d->mMainWindow->viewMainPage();
if (page->isVisible()) {
auto *bubble = new HudMessageBubble();
auto bubble = new HudMessageBubble();
bubble->setText(i18n("You are now viewing the new document."));
KGuiItem item = KStandardGuiItem::back();
item.setText(i18n("Go back to the original"));
......
......@@ -131,7 +131,7 @@ ImageMetaInfoDialog::ImageMetaInfoDialog(QWidget *parent)
setLayout(new QVBoxLayout);
layout()->addWidget(d->mTreeView);
auto *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
layout()->addWidget(buttonBox);
connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
......
......@@ -80,7 +80,7 @@ struct ImageOpsContextManagerItem::Private {
void setupActions()
{
KActionCollection *actionCollection = mMainWindow->actionCollection();
auto *edit = new KActionCategory(i18nc("@title actions category - means actions changing image", "Edit"), actionCollection);
auto edit = new KActionCategory(i18nc("@title actions category - means actions changing image", "Edit"), actionCollection);
mRotateLeftAction = edit->addAction(QStringLiteral("rotate_left"), q, SLOT(rotateLeft()));
mRotateLeftAction->setText(i18n("Rotate Left"));
......@@ -197,25 +197,25 @@ void ImageOpsContextManagerItem::updateActions()
void ImageOpsContextManagerItem::rotateLeft()
{
auto *op = new TransformImageOperation(ROT_270);
auto op = new TransformImageOperation(ROT_270);
applyImageOperation(op);
}
void ImageOpsContextManagerItem::rotateRight()
{
auto *op = new TransformImageOperation(ROT_90);
auto op = new TransformImageOperation(ROT_90);
applyImageOperation(op);
}
void ImageOpsContextManagerItem::mirror()
{
auto *op = new TransformImageOperation(HFLIP);
auto op = new TransformImageOperation(HFLIP);
applyImageOperation(op);
}
void ImageOpsContextManagerItem::flip()
{
auto *op = new TransformImageOperation(VFLIP);
auto op = new TransformImageOperation(VFLIP);
applyImageOperation(op);
}
......@@ -227,7 +227,7 @@ void ImageOpsContextManagerItem::resizeImage()
Document::Ptr doc = DocumentFactory::instance()->load(contextManager()->currentUrl());
doc->startLoadingFullImage();
auto *dialog = new ResizeImageDialog(d->mMainWindow);
auto dialog = new ResizeImageDialog(d->mMainWindow);
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->setModal(true);
dialog->setOriginalSize(doc->size());
......@@ -250,7 +250,7 @@ void ImageOpsContextManagerItem::crop()
return;
}
auto *tool = new CropTool(imageView);
auto tool = new CropTool(imageView);
Document::Ptr doc = DocumentFactory::instance()->load(contextManager()->currentUrl());
QSize size = doc->size();
QRect sizeAsRect = QRect(0, 0, size.width(), size.height());
......@@ -289,7 +289,7 @@ void ImageOpsContextManagerItem::startRedEyeReduction()
qCCritical(GWENVIEW_APP_LOG) << "No RasterImageView available!";
return;
}
auto *tool = new RedEyeReductionTool(view);
auto tool = new RedEyeReductionTool(view);
connect(tool, &RedEyeReductionTool::imageOperationRequested, this, &ImageOpsContextManagerItem::applyImageOperation);
connect(tool, &RedEyeReductionTool::done, this, &ImageOpsContextManagerItem::restoreDefaultImageViewTool);
......
......@@ -224,13 +224,13 @@ struct InfoContextManagerItemPrivate {
mKeyValueWidget = new KeyValueWidget;
auto *moreLabel = new QLabel(mOneFileWidget);
auto moreLabel = new QLabel(mOneFileWidget);
moreLabel->setText(QStringLiteral("<a href='#'>%1</a>").arg(i18nc("@action show more image meta info", "Show more details...")));
// for some reason, this label appears much further down the page without the following line
moreLabel->setAlignment(Qt::AlignLeft);
auto *content = new QWidget;
auto *layout = new QVBoxLayout(content);
auto content = new QWidget;
auto layout = new QVBoxLayout(content);
layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(mKeyValueWidget);
layout->addWidget(moreLabel);
......
......@@ -256,7 +256,7 @@ struct MainWindow::Private {
mSaveBar = new SaveBar(mContentWidget, q->actionCollection());
connect(mContextManager, &ContextManager::currentUrlChanged, mSaveBar, &SaveBar::setCurrentUrl);
mViewStackedWidget = new QStackedWidget(mContentWidget);
auto *layout = new QVBoxLayout(mContentWidget);
auto layout = new QVBoxLayout(mContentWidget);
layout->addWidget(mSharedMessage);
layout->addWidget(mSaveBar);
layout->addWidget(mViewStackedWidget);
......@@ -361,22 +361,22 @@ struct MainWindow::Private {
void installDisabledActionShortcutMonitor(QAction *action, const char *slot)
{
auto *monitor = new DisabledActionShortcutMonitor(action, q);
auto monitor = new DisabledActionShortcutMonitor(action, q);
connect(monitor, SIGNAL(activated()), q, slot);
}
void setupActions()
{
KActionCollection *actionCollection = q->actionCollection();
auto *file = new KActionCategory(i18nc("@title actions category", "File"), actionCollection);
auto *view = new KActionCategory(i18nc("@title actions category - means actions changing smth in interface", "View"), actionCollection);
auto file = new KActionCategory(i18nc("@title actions category", "File"), actionCollection);
auto view = new KActionCategory(i18nc("@title actions category - means actions changing smth in interface", "View"), actionCollection);
file->addAction(KStandardAction::Save, q, SLOT(saveCurrent()));
file->addAction(KStandardAction::SaveAs, q, SLOT(saveCurrentAs()));
file->addAction(KStandardAction::Open, q, SLOT(openFile()));
mFileOpenRecentAction = KStandardAction::openRecent(q, SLOT(openUrl(QUrl)), q);
connect(mFileOpenRecentAction, &KRecentFilesAction::recentListCleared, mGvCore, &GvCore::clearRecentFilesAndFolders);
auto *clearAction = mFileOpenRecentAction->menu()->findChild<QAction *>("clear_action");
auto clearAction = mFileOpenRecentAction->menu()->findChild<QAction *>("clear_action");
if (clearAction) {
clearAction->setText(i18nc("@action Open Recent menu", "Clear List"));
}
......@@ -549,7 +549,7 @@ struct MainWindow::Private {
void updateHamburgerMenu()
{
KActionCollection *actionCollection = q->actionCollection();
auto *menu = new QMenu;
auto menu = new QMenu;
menu->addAction(actionCollection->action(KStandardAction::name(KStandardAction::Open)));
menu->addAction(actionCollection->action(KStandardAction::name(KStandardAction::OpenRecent)));
menu->addAction(actionCollection->action(KStandardAction::name(KStandardAction::Save)));
......@@ -569,7 +569,7 @@ struct MainWindow::Private {
#ifdef KF5Purpose_FOUND
menu->addMenu(mShareMenu);
#endif
auto *configureMenu = new QMenu(i18nc("@title:menu submenu for actions that open configuration dialogs", "Configure"));
auto configureMenu = new QMenu(i18nc("@title:menu submenu for actions that open configuration dialogs", "Configure"));
configureMenu->addAction(actionCollection->action(QStringLiteral("options_configure_keybinding")));
configureMenu->addAction(actionCollection->action(QStringLiteral("options_configure_toolbars")));
configureMenu->addAction(actionCollection->action(QStringLiteral("options_configure")));
......@@ -584,7 +584,7 @@ struct MainWindow::Private {
QUndoGroup *undoGroup = DocumentFactory::instance()->undoGroup();
QAction *action;
KActionCollection *actionCollection = q->actionCollection();
auto *edit = new KActionCategory(i18nc("@title actions category - means actions changing smth in interface", "Edit"), actionCollection);
auto edit = new KActionCategory(i18nc("@title actions category - means actions changing smth in interface", "Edit"), actionCollection);
action = undoGroup->createRedoAction(actionCollection);
action->setObjectName(KStandardAction::name(KStandardAction::Redo));
......@@ -608,19 +608,19 @@ struct MainWindow::Private {
KActionCollection *actionCollection = q->actionCollection();
// Create context manager items
auto *folderViewItem = new FolderViewContextManagerItem(mContextManager);
auto folderViewItem = new FolderViewContextManagerItem(mContextManager);
connect(folderViewItem, &FolderViewContextManagerItem::urlChanged, q, &MainWindow::folderViewUrlChanged);
auto *infoItem = new InfoContextManagerItem(mContextManager);
auto infoItem = new InfoContextManagerItem(mContextManager);
#ifndef GWENVIEW_SEMANTICINFO_BACKEND_NONE
SemanticInfoContextManagerItem *semanticInfoItem = nullptr;
semanticInfoItem = new SemanticInfoContextManagerItem(mContextManager, actionCollection, mViewMainPage);
#endif
auto *imageOpsItem = new ImageOpsContextManagerItem(mContextManager, q);
auto imageOpsItem = new ImageOpsContextManagerItem(mContextManager, q);
auto *fileOpsItem = new FileOpsContextManagerItem(mContextManager, mThumbnailView, actionCollection, q);
auto fileOpsItem = new FileOpsContextManagerItem(mContextManager, mThumbnailView, actionCollection, q);
// Fill sidebar
SideBarPage *page;
......@@ -635,7 +635,7 @@ struct MainWindow::Private {
page->addWidget(infoItem->widget());
#ifndef GWENVIEW_SEMANTICINFO_BACKEND_NONE
if (semanticInfoItem) {
auto *separator = new QFrame;
auto separator = new QFrame;
separator->setFrameShape(QFrame::HLine);
separator->setLineWidth(1);
page->addWidget(separator);
......@@ -647,7 +647,7 @@ struct MainWindow::Private {
page = new SideBarPage(QIcon::fromTheme("document-edit"), i18n("Operations"));
page->setObjectName(QLatin1String("operations"));
page->addWidget(imageOpsItem->widget());
auto *separator = new QFrame;
auto separator = new QFrame;
separator->setFrameShape(QFrame::HLine);
separator->setLineWidth(1);
page->addWidget(separator);
......@@ -955,7 +955,7 @@ MainWindow::MainWindow()
new Mpris2Service(d->mSlideShow, d->mContextManager, d->mToggleSlideShowAction, d->mFullScreenAction, d->mGoToPreviousAction, d->mGoToNextAction, this);
#endif
auto *ratingMenu = static_cast<QMenu *>(guiFactory()->container("rating", this));
auto ratingMenu = static_cast<QMenu *>(guiFactory()->container("rating", this));
ratingMenu->setIcon(QIcon::fromTheme(QStringLiteral("rating-unrated")));
#ifdef GWENVIEW_SEMANTICINFO_BACKEND_NONE
if (ratingMenu) {
......@@ -1025,7 +1025,7 @@ void MainWindow::setInitialUrl(const QUrl &_url)
message << dirUrl.toString();
QDBusPendingCall call = QDBusConnection::sessionBus().asyncCall(message);
auto *watcher = new QDBusPendingCallWatcher(call, this);
auto watcher = new QDBusPendingCallWatcher(call, this);
connect(watcher, &QDBusPendingCallWatcher::finished, this, [this](QDBusPendingCallWatcher *call) {
QDBusPendingReply<QString, QString> reply = *call;
......@@ -1576,7 +1576,7 @@ void MainWindow::openFile()
{
const QUrl dirUrl = d->mContextManager->currentDirUrl();
auto *dialog = new QFileDialog(this);
auto dialog = new QFileDialog(this);
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->setModal(true);
dialog->setDirectoryUrl(dirUrl);
......@@ -1683,7 +1683,7 @@ void MainWindow::showConfigDialog()
// Save first so changes like thumbnail zoom level are not lost when reloading config
saveConfig();
auto *dialog = new ConfigDialog(this);
auto dialog = new ConfigDialog(this);
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->setModal(true);
connect(dialog, &KConfigDialog::settingsChanged, this, &MainWindow::loadConfig);
......
......@@ -98,7 +98,7 @@ void SaveAllHelper::slotCanceled()
void SaveAllHelper::slotResult(KJob *_job)
{
auto *job = static_cast<DocumentJob *>(_job);
auto job = static_cast<DocumentJob *>(_job);
if (job->error()) {
QUrl url = job->document()->url();
QString name = url.fileName().isEmpty() ? url.toDisplayString() : url.fileName();
......
......@@ -46,7 +46,7 @@ namespace Gwenview
{
QToolButton *createToolButton()
{
auto *button = new QToolButton;
auto button = new QToolButton;
button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
button->hide();
return button;
......@@ -73,18 +73,18 @@ struct SaveBarPrivate {
mTooManyChangesFrame = new QFrame;
// Icon
auto *iconLabel = new QLabel;
auto iconLabel = new QLabel;
QPixmap pix = QIcon::fromTheme(QStringLiteral("dialog-warning")).pixmap(KIconLoader::SizeSmall);
iconLabel->setPixmap(pix);
// Text label