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

Modernize code (with clang-tidy)

parent 5b4ef625
......@@ -102,7 +102,7 @@ QSize AligningSpacer::sizeHint() const
newWidth = sideBarWidth - window()->width() + mapTo(window(), QPoint(width(), 0)).x();
}
const float separatorWidth = static_cast<float>(
const auto separatorWidth = static_cast<float>(
style()->pixelMetric(QStyle::PM_ToolBarSeparatorExtent, nullptr, this));
if (!mWasSeparatorRemoved) {
// Make it so a potentially following separator looks aligned with the sidebar.
......
......@@ -109,7 +109,7 @@ struct BrowseMainPagePrivate : public Ui_BrowseMainPage
mUrlNavigator = new KUrlNavigator(mFilePlacesModel, QUrl(), mUrlNavigatorContainer);
mUrlNavigatorContainer->setAutoFillBackground(true);
mUrlNavigatorContainer->setBackgroundRole(QPalette::Mid);
QVBoxLayout* 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*)),
......@@ -138,7 +138,7 @@ struct BrowseMainPagePrivate : public Ui_BrowseMainPage
QAction *thumbnailDetailAction(const QString &text, PreviewItemDelegate::ThumbnailDetail detail)
{
QAction *action = new QAction(q);
auto *action = new QAction(q);
action->setText(text);
action->setCheckable(true);
action->setChecked(GwenviewConfig::thumbnailDetails() & detail);
......@@ -151,12 +151,12 @@ struct BrowseMainPagePrivate : public Ui_BrowseMainPage
void setupActions(KActionCollection* actionCollection)
{
KActionCategory* 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);
KActionMenu* 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")));
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
......@@ -196,7 +196,7 @@ struct BrowseMainPagePrivate : public Ui_BrowseMainPage
mThumbnailDetailsActionGroup = new QActionGroup(q);
mThumbnailDetailsActionGroup->setExclusive(false);
KActionMenu* 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));
......@@ -206,7 +206,7 @@ struct BrowseMainPagePrivate : public Ui_BrowseMainPage
thumbnailDetailsAction->addAction(thumbnailDetailAction(i18nc("@action:inmenu", "Rating"), PreviewItemDelegate::RatingDetail));
#endif
KActionCategory* 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")));
......@@ -214,7 +214,7 @@ struct BrowseMainPagePrivate : public Ui_BrowseMainPage
void setupFilterController()
{
QMenu* menu = new QMenu(mAddFilterButton);
auto* menu = new QMenu(mAddFilterButton);
mFilterController = new FilterController(mFilterFrame, mDirModel);
const auto actionList = mFilterController->actionList();
for (QAction * action : actionList) {
......
......@@ -36,7 +36,7 @@ namespace Gwenview
template <class Ui>
QWidget* setupPage(Ui& ui)
{
QWidget* widget = new QWidget;
auto* widget = new QWidget;
ui.setupUi(widget);
widget->layout()->setContentsMargins(0, 0, 0, 0);
return widget;
......
......@@ -120,7 +120,7 @@ QUrl FileOpsContextManagerItem::pasteTargetUrl() const
static QAction* createSeparator(QObject* parent)
{
QAction* action = new QAction(parent);
auto* action = new QAction(parent);
action->setSeparator(true);
return action;
}
......@@ -142,8 +142,8 @@ FileOpsContextManagerItem::FileOpsContextManagerItem(ContextManager* manager, QL
connect(contextManager(), &ContextManager::currentDirUrlChanged,
this, &FileOpsContextManagerItem::updateActions);
KActionCategory* file = new KActionCategory(i18nc("@title actions category", "File"), actionCollection);
KActionCategory* 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()));
......@@ -191,7 +191,7 @@ FileOpsContextManagerItem::FileOpsContextManagerItem(ContextManager* manager, QL
mOpenWithAction = file->addAction(QStringLiteral("file_open_with"));
mOpenWithAction->setText(i18n("Open With"));
QMenu* menu = new QMenu;
auto* menu = new QMenu;
mOpenWithAction->setMenu(menu);
connect(menu, &QMenu::aboutToShow, this, &FileOpsContextManagerItem::populateOpenMenu);
connect(menu, &QMenu::triggered, this, &FileOpsContextManagerItem::openWith);
......
......@@ -60,13 +60,13 @@ NameFilterWidget::NameFilterWidget(SortedDirModel* model)
mLineEdit = new QLineEdit;
QHBoxLayout* layout = new QHBoxLayout(this);
auto* layout = new QHBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(2);
layout->addWidget(mModeComboBox);
layout->addWidget(mLineEdit);
QTimer* timer = new QTimer(this);
auto* timer = new QTimer(this);
timer->setInterval(350);
timer->setSingleShot(true);
connect(timer, &QTimer::timeout, this, &NameFilterWidget::applyNameFilter);
......@@ -103,7 +103,7 @@ DateFilterWidget::DateFilterWidget(SortedDirModel* model)
mDateWidget = new DateWidget;
QHBoxLayout* layout = new QHBoxLayout(this);
auto* layout = new QHBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(mModeComboBox);
layout->addWidget(mDateWidget);
......@@ -140,7 +140,7 @@ RatingFilterWidget::RatingFilterWidget(SortedDirModel* model)
mRatingWidget->setHalfStepsEnabled(true);
mRatingWidget->setMaxRating(10);
QHBoxLayout* layout = new QHBoxLayout(this);
auto* layout = new QHBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(mModeComboBox);
layout->addWidget(mRatingWidget);
......@@ -183,7 +183,7 @@ TagFilterWidget::TagFilterWidget(SortedDirModel* model)
mTagComboBox = new QComboBox;
QHBoxLayout* layout = new QHBoxLayout(this);
auto* layout = new QHBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(mModeComboBox);
layout->addWidget(mTagComboBox);
......@@ -192,7 +192,7 @@ TagFilterWidget::TagFilterWidget(SortedDirModel* model)
backEnd->refreshAllTags();
TagModel* tagModel = TagModel::createAllTagsModel(this, backEnd);
QCompleter* completer = new QCompleter(mTagComboBox);
auto* completer = new QCompleter(mTagComboBox);
completer->setCaseSensitivity(Qt::CaseInsensitive);
completer->setModel(tagModel);
mTagComboBox->setCompleter(completer);
......@@ -243,14 +243,14 @@ public:
void setFilterWidget(QWidget* widget)
{
QToolButton* 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 = IconSize(KIconLoader::Small);
closeButton->setIconSize(QSize(size, size));
connect(closeButton, &QAbstractButton::clicked, this, &QObject::deleteLater);
QHBoxLayout* layout = new QHBoxLayout(this);
auto* layout = new QHBoxLayout(this);
layout->setContentsMargins(2, 2, 2, 2);
layout->setSpacing(2);
layout->addWidget(widget);
......@@ -281,7 +281,7 @@ FilterController::FilterController(QFrame* frame, SortedDirModel* dirModel)
mFilterWidgetCount = 0;
mFrame->hide();
FlowLayout* layout = new FlowLayout(mFrame);
auto* layout = new FlowLayout(mFrame);
layout->setSpacing(2);
addAction(i18nc("@action:inmenu", "Filter by Name"),
......@@ -341,7 +341,7 @@ void FilterController::slotFilterWidgetClosed()
void FilterController::addAction(const QString& text, const char* slot, const QKeySequence &shortcut)
{
QAction* action = new QAction(text, q);
auto* action = new QAction(text, q);
action->setShortcut(shortcut);
QObject::connect(action, SIGNAL(triggered()), q, slot);
mActionList << action;
......@@ -353,7 +353,7 @@ void FilterController::addFilter(QWidget* widget)
if (mFrame->isHidden()) {
mFrame->show();
}
FilterWidgetContainer* container = new FilterWidgetContainer;
auto* container = new FilterWidgetContainer;
container->setFilterWidget(widget);
mFrame->layout()->addWidget(container);
......
......@@ -73,7 +73,7 @@ public:
void addAction(QAction* action, Qt::ToolButtonStyle style = Qt::ToolButtonIconOnly)
{
QToolButton* button = new QToolButton;
auto* button = new QToolButton;
button->setDefaultAction(action);
button->setToolButtonStyle(style);
button->setAutoRaise(true);
......@@ -119,7 +119,7 @@ void FullScreenContent::init(KActionCollection* actionCollection, QWidget* autoH
// mAutoHideContainer
mAutoHideContainer = new FullScreenBar(autoHideParentWidget);
mAutoHideContainer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
QVBoxLayout* layout = new QVBoxLayout(mAutoHideContainer);
auto* layout = new QVBoxLayout(mAutoHideContainer);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
......@@ -167,7 +167,7 @@ void FullScreenContent::init(KActionCollection* actionCollection, QWidget* autoH
mInformationContainer->setAutoFillBackground(true);
mInformationContainer->setBackgroundRole(QPalette::Mid);
mInformationContainerShadow = new ShadowFilter(mInformationContainer);
QHBoxLayout* hLayout = new QHBoxLayout(mInformationContainer);
auto* hLayout = new QHBoxLayout(mInformationContainer);
hLayout->setContentsMargins(0, 0, 0, 0);
hLayout->addWidget(mInformationLabel);
hLayout->addWidget(mDocumentCountLabel);
......@@ -175,7 +175,7 @@ void FullScreenContent::init(KActionCollection* actionCollection, QWidget* autoH
// Thumbnail bar
mThumbnailBar = new ThumbnailBarView(mContent);
mThumbnailBar->setThumbnailScaleMode(ThumbnailView::ScaleToSquare);
ThumbnailBarItemDelegate* 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
......@@ -305,7 +305,7 @@ void FullScreenContent::updateLayout()
if (GwenviewConfig::showFullScreenThumbnails()) {
mRightToolBar->setDirection(QBoxLayout::TopToBottom);
QHBoxLayout* layout = new QHBoxLayout(mContent);
auto* layout = new QHBoxLayout(mContent);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
QVBoxLayout* vLayout;
......@@ -349,7 +349,7 @@ void FullScreenContent::updateLayout()
} else {
mRightToolBar->setDirection(QBoxLayout::RightToLeft);
QHBoxLayout* layout = new QHBoxLayout(mContent);
auto* layout = new QHBoxLayout(mContent);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
layout->addWidget(mToolBar);
......@@ -437,7 +437,7 @@ void FullScreenContent::showOptionsMenu()
// Put widget in a menu
QMenu menu;
QWidgetAction* action = new QWidgetAction(&menu);
auto* action = new QWidgetAction(&menu);
action->setDefaultWidget(widget);
menu.addAction(action);
......
......@@ -75,14 +75,14 @@ struct GvCorePrivate
bool showSaveAsDialog(const QUrl &url, QUrl* outUrl, QByteArray* format)
{
// Build the JPEG quality chooser custom widget
QWidget* JPEGQualityChooserWidget = new QWidget;
auto* JPEGQualityChooserWidget = new QWidget;
JPEGQualityChooserWidget->setVisible(false); // shown only for JPEGs
QLabel* JPEGQualityChooserLabel = new QLabel;
auto* JPEGQualityChooserLabel = new QLabel;
JPEGQualityChooserLabel->setText(i18n("Image quality:"));
JPEGQualityChooserLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
QSpinBox* JPEGQualityChooserSpinBox = new QSpinBox;
auto* JPEGQualityChooserSpinBox = new QSpinBox;
JPEGQualityChooserSpinBox->setMinimum(1);
JPEGQualityChooserSpinBox->setMaximum(100);
JPEGQualityChooserSpinBox->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
......@@ -96,9 +96,9 @@ struct GvCorePrivate
GwenviewConfig::setJPEGQuality(value);
});
QSpacerItem* horizontalSpacer = new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Fixed);
auto* horizontalSpacer = new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Fixed);
QHBoxLayout* JPEGQualityChooserLayout = new QHBoxLayout(JPEGQualityChooserWidget);
auto* JPEGQualityChooserLayout = new QHBoxLayout(JPEGQualityChooserWidget);
JPEGQualityChooserLayout->setContentsMargins(0,0,0,0);
JPEGQualityChooserLayout->addWidget(JPEGQualityChooserLabel);
JPEGQualityChooserLayout->addWidget(JPEGQualityChooserSpinBox);
......@@ -445,14 +445,14 @@ void GvCore::saveAs(const QUrl &url)
static void applyTransform(const QUrl &url, Orientation orientation)
{
TransformImageOperation* op = new TransformImageOperation(orientation);
auto* op = new TransformImageOperation(orientation);
Document::Ptr doc = DocumentFactory::instance()->load(url);
op->applyToDocument(doc);
}
void GvCore::slotSaveResult(KJob* _job)
{
SaveJob* job = static_cast<SaveJob*>(_job);
auto* job = static_cast<SaveJob*>(_job);
QUrl oldUrl = job->oldUrl();
QUrl newUrl = job->newUrl();
......@@ -477,7 +477,7 @@ void GvCore::slotSaveResult(KJob* _job)
ViewMainPage* page = d->mMainWindow->viewMainPage();
if (page->isVisible()) {
HudMessageBubble* 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);
QDialogButtonBox *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);
......@@ -145,7 +145,7 @@ ImageMetaInfoDialog::~ImageMetaInfoDialog()
void ImageMetaInfoDialog::setMetaInfo(ImageMetaInfoModel* model, const QStringList& list)
{
if (model) {
d->mModel.reset(new PreferredImageMetaInfoModel(model, list));
d->mModel = std::make_unique<PreferredImageMetaInfoModel>(model, list);
connect(d->mModel.get(), &PreferredImageMetaInfoModel::preferredMetaInfoKeyListChanged,
this, &ImageMetaInfoDialog::preferredMetaInfoKeyListChanged);
} else {
......
......@@ -81,7 +81,7 @@ struct ImageOpsContextManagerItem::Private
void setupActions()
{
KActionCollection* actionCollection = mMainWindow->actionCollection();
KActionCategory* 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"));
......@@ -212,25 +212,25 @@ void ImageOpsContextManagerItem::updateActions()
void ImageOpsContextManagerItem::rotateLeft()
{
TransformImageOperation* op = new TransformImageOperation(ROT_270);
auto* op = new TransformImageOperation(ROT_270);
applyImageOperation(op);
}
void ImageOpsContextManagerItem::rotateRight()
{
TransformImageOperation* op = new TransformImageOperation(ROT_90);
auto* op = new TransformImageOperation(ROT_90);
applyImageOperation(op);
}
void ImageOpsContextManagerItem::mirror()
{
TransformImageOperation* op = new TransformImageOperation(HFLIP);
auto* op = new TransformImageOperation(HFLIP);
applyImageOperation(op);
}
void ImageOpsContextManagerItem::flip()
{
TransformImageOperation* op = new TransformImageOperation(VFLIP);
auto* op = new TransformImageOperation(VFLIP);
applyImageOperation(op);
}
......@@ -246,7 +246,7 @@ void ImageOpsContextManagerItem::resizeImage()
if (!dialog->exec()) {
return;
}
ResizeImageOperation* op = new ResizeImageOperation(dialog->size());
auto* op = new ResizeImageOperation(dialog->size());
applyImageOperation(op);
}
......@@ -261,7 +261,7 @@ void ImageOpsContextManagerItem::crop()
return;
}
CropTool* 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());
......@@ -300,7 +300,7 @@ void ImageOpsContextManagerItem::startRedEyeReduction()
qCCritical(GWENVIEW_APP_LOG) << "No RasterImageView available!";
return;
}
RedEyeReductionTool* tool = new RedEyeReductionTool(view);
auto* tool = new RedEyeReductionTool(view);
connect(tool, &RedEyeReductionTool::imageOperationRequested, this, &ImageOpsContextManagerItem::applyImageOperation);
connect(tool, &RedEyeReductionTool::done, this, &ImageOpsContextManagerItem::restoreDefaultImageViewTool);
......
......@@ -228,13 +228,13 @@ struct InfoContextManagerItemPrivate
mKeyValueWidget = new KeyValueWidget;
QLabel* 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);
QWidget* content = new QWidget;
QVBoxLayout* 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);
......
......@@ -43,7 +43,7 @@ struct KIPIExportActionPrivate
void updateMenu()
{
QMenu* menu = static_cast<QMenu*>(q->menu());
auto* menu = static_cast<QMenu*>(q->menu());
menu->clear();
if (mDefaultAction && mExportActionList.contains(mDefaultAction)) {
......
......@@ -48,7 +48,7 @@ KIPIImageCollectionSelector::KIPIImageCollectionSelector(KIPIInterface* interfac
d->mListWidget = new QListWidget;
const QList<KIPI::ImageCollection> list = interface->allAlbums();
for (const KIPI::ImageCollection & collection : list) {
QListWidgetItem* item = new QListWidgetItem(d->mListWidget);
auto* item = new QListWidgetItem(d->mListWidget);
QString name = collection.name();
int imageCount = collection.images().size();
QString title = i18ncp("%1 is collection name, %2 is image count in collection",
......@@ -60,7 +60,7 @@ KIPIImageCollectionSelector::KIPIImageCollectionSelector(KIPIInterface* interfac
connect(d->mListWidget, &QListWidget::currentRowChanged, this, &KIPIImageCollectionSelector::selectionChanged);
QVBoxLayout* layout = new QVBoxLayout(this);
auto* layout = new QVBoxLayout(this);
layout->addWidget(d->mListWidget);
layout->setContentsMargins(0, 0, 0, 0);
}
......
......@@ -195,7 +195,7 @@ struct MenuInfo
, mIconName(iconName)
{}
};
typedef QMap<KIPI::Category, MenuInfo> MenuInfoMap;
using MenuInfoMap = QMap<KIPI::Category, MenuInfo>;
struct KIPIInterfacePrivate
{
......@@ -220,7 +220,7 @@ struct KIPIInterfacePrivate
QAction * createDummyPluginAction(const QString& text)
{
QAction * action = new QAction(q);
auto * action = new QAction(q);
action->setText(text);
//PORT QT5 action->setShortcutConfigurable(false);
action->setEnabled(false);
......
......@@ -38,12 +38,12 @@ KIPIUploadWidget::KIPIUploadWidget(KIPIInterface* interface, QWidget* parent)
: KIPI::UploadWidget(parent)
, mInterface(interface)
{
QLabel* label = new QLabel(this);
auto* label = new QLabel(this);
QUrl url = mInterface->currentAlbum().uploadUrl();
label->setText(i18n("Images will be uploaded here:\n%1", url.toDisplayString()));
label->setWordWrap(true);
QVBoxLayout* layout = new QVBoxLayout(this);
auto* layout = new QVBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(label);
}
......
......@@ -268,7 +268,7 @@ struct MainWindow::Private
mSaveBar = new SaveBar(mContentWidget, q->actionCollection());
connect(mContextManager, &ContextManager::currentUrlChanged, mSaveBar, &SaveBar::setCurrentUrl);
mViewStackedWidget = new QStackedWidget(mContentWidget);
QVBoxLayout* layout = new QVBoxLayout(mContentWidget);
auto* layout = new QVBoxLayout(mContentWidget);
layout->addWidget(mSharedMessage);
layout->addWidget(mSaveBar);
layout->addWidget(mViewStackedWidget);
......@@ -391,15 +391,15 @@ struct MainWindow::Private
void installDisabledActionShortcutMonitor(QAction* action, const char* slot)
{
DisabledActionShortcutMonitor* monitor = new DisabledActionShortcutMonitor(action, q);
auto* monitor = new DisabledActionShortcutMonitor(action, q);
connect(monitor, SIGNAL(activated()), q, slot);
}
void setupActions()
{
KActionCollection* actionCollection = q->actionCollection();
KActionCategory* file = new KActionCategory(i18nc("@title actions category", "File"), actionCollection);
KActionCategory* 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()));
......@@ -407,7 +407,7 @@ struct MainWindow::Private
mFileOpenRecentAction = KStandardAction::openRecent(q, SLOT(openUrl(QUrl)), q);
connect(mFileOpenRecentAction, &KRecentFilesAction::recentListCleared,
mGvCore, &GvCore::clearRecentFilesAndFolders);
QAction * 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"));
}
......@@ -594,7 +594,7 @@ struct MainWindow::Private
void updateHamburgerMenu()
{
KActionCollection* actionCollection = q->actionCollection();
QMenu *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)));
......@@ -619,7 +619,7 @@ struct MainWindow::Private
menu->addMenu(pluginsMenu);
}
#endif
QMenu *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")));
......@@ -634,7 +634,7 @@ struct MainWindow::Private
QUndoGroup* undoGroup = DocumentFactory::instance()->undoGroup();
QAction* action;
KActionCollection* actionCollection = q->actionCollection();
KActionCategory* 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));
......@@ -658,21 +658,21 @@ struct MainWindow::Private
KActionCollection* actionCollection = q->actionCollection();
// Create context manager items
FolderViewContextManagerItem* folderViewItem = new FolderViewContextManagerItem(mContextManager);
auto* folderViewItem = new FolderViewContextManagerItem(mContextManager);
connect(folderViewItem, &FolderViewContextManagerItem::urlChanged,
q, &MainWindow::folderViewUrlChanged);
InfoContextManagerItem* infoItem = new InfoContextManagerItem(mContextManager);
auto* infoItem = new InfoContextManagerItem(mContextManager);
#ifndef GWENVIEW_SEMANTICINFO_BACKEND_NONE
SemanticInfoContextManagerItem* semanticInfoItem = nullptr;
semanticInfoItem = new SemanticInfoContextManagerItem(mContextManager, actionCollection, mViewMainPage);
#endif
ImageOpsContextManagerItem* imageOpsItem =
auto* imageOpsItem =
new ImageOpsContextManagerItem(mContextManager, q);
FileOpsContextManagerItem* fileOpsItem = new FileOpsContextManagerItem(mContextManager, mThumbnailView, actionCollection, q);
auto* fileOpsItem = new FileOpsContextManagerItem(mContextManager, mThumbnailView, actionCollection, q);
// Fill sidebar
SideBarPage* page;
......@@ -687,7 +687,7 @@ struct MainWindow::Private
page->addWidget(infoItem->widget());
#ifndef GWENVIEW_SEMANTICINFO_BACKEND_NONE
if (semanticInfoItem) {
QFrame *separator = new QFrame;
auto *separator = new QFrame;
separator->setFrameShape(QFrame::HLine);
separator->setLineWidth(1);
page->addWidget(separator);
......@@ -699,7 +699,7 @@ struct MainWindow::Private
page = new SideBarPage(QIcon::fromTheme("document-edit"), i18n("Operations"));
page->setObjectName(QLatin1String("operations"));
page->addWidget(imageOpsItem->widget());
QFrame *separator = new QFrame;
auto *separator = new QFrame;
separator->setFrameShape(QFrame::HLine);
separator->setLineWidth(1);
page->addWidget(separator);
......@@ -1092,7 +1092,7 @@ void MainWindow::setInitialUrl(const QUrl &_url)
message << dirUrl.toString();
QDBusPendingCall call = QDBusConnection::sessionBus().asyncCall(message);
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(call, this);
auto *watcher = new QDBusPendingCallWatcher(call, this);
connect(watcher, &QDBusPendingCallWatcher::finished,
this, [this](QDBusPendingCallWatcher *call) {
......
......@@ -100,7 +100,7 @@ void SaveAllHelper::slotCanceled()
void SaveAllHelper::slotResult(KJob* _job)
{
DocumentJob* job = static_cast<DocumentJob*>(_job);