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

Use nullptr

parent 01df5336
......@@ -40,7 +40,7 @@ class SettingsBase : public KXmlGuiWindow
Q_OBJECT
public:
explicit SettingsBase(QWidget * parent = 0);
explicit SettingsBase(QWidget * parent = nullptr);
~SettingsBase();
bool queryClose() Q_DECL_OVERRIDE;
......@@ -66,31 +66,31 @@ private:
// The plugins
QMap<QString, BaseMode *> possibleViews;
QList<ToolTipManager*> tooltipManagers;
BaseMode * activeView;
BaseMode * activeView = nullptr;
// The search bar
KLineEdit * searchText;
QWidget * spacerWidget;
KLineEdit * searchText = nullptr;
QWidget * spacerWidget = nullptr;
// The toolbar
QWidgetAction * searchAction;
QWidgetAction * spacerAction;
QAction * configureAction;
QAction * quitAction;
QWidgetAction * searchAction = nullptr;
QWidgetAction * spacerAction = nullptr;
QAction * configureAction = nullptr;
QAction * quitAction = nullptr;
// The help menu
QAction * aboutViewAction;
QAction * aboutModuleAction;
KActionMenu * helpActionMenu;
QAction * aboutViewAction = nullptr;
QAction * aboutModuleAction = nullptr;
KActionMenu * helpActionMenu = nullptr;
// The configuration
KConfigDialog * configDialog;
KConfigDialog * configDialog = nullptr;
Ui::ConfigDialog configWidget;
QButtonGroup viewSelection;
// The control module
QStackedWidget * stackedWidget;
QStackedWidget * stackedWidget = nullptr;
// The module list
MenuItem * rootModule;
MenuItem * lostFound;
MenuItem * rootModule = nullptr;
MenuItem * lostFound = nullptr;
KService::List categories;
KService::List modules;
// The about dialog
KAboutApplicationDialog * aboutDialog;
KAboutApplicationDialog * aboutDialog = nullptr;
};
#endif
......@@ -23,7 +23,6 @@
SystemSettingsApp::SystemSettingsApp(int& argc, char* argv[])
: QApplication(argc, argv)
, window(nullptr)
{
setOrganizationDomain(QStringLiteral("kde.org"));
KDBusService* service = new KDBusService(KDBusService::Unique, this);
......
......@@ -43,7 +43,7 @@ public Q_SLOTS:
Q_SCRIPTABLE void quit();
private:
SettingsBase * window;
SettingsBase * window = nullptr;
};
#endif
......@@ -42,22 +42,22 @@ K_PLUGIN_FACTORY(ClassicModeFactory, registerPlugin<ClassicMode>();)
class ClassicMode::Private {
public:
Private() : moduleView( 0 ) {}
Private() {}
virtual ~Private() {
delete aboutClassic;
}
QSplitter * classicWidget;
QTreeView * classicTree;
QSplitter * classicWidget = nullptr;
QTreeView * classicTree = nullptr;
Ui::ConfigClassic classicConfig;
CategoryList * classicCategory;
QStackedWidget * stackedWidget;
ModuleView * moduleView;
CategoryList * classicCategory = nullptr;
QStackedWidget * stackedWidget = nullptr;
ModuleView * moduleView = nullptr;
QModelIndex currentItem;
MenuProxyModel * proxyModel;
MenuModel * model;
KAboutData * aboutClassic;
MenuProxyModel * proxyModel = nullptr;
MenuModel * model = nullptr;
KAboutData * aboutClassic = nullptr;
};
ClassicMode::ClassicMode( QObject * parent, const QVariantList& )
......@@ -97,7 +97,7 @@ void ClassicMode::initEvent()
d->classicWidget = new QSplitter( Qt::Horizontal, 0 );
d->classicWidget->setChildrenCollapsible( false );
d->moduleView = new ModuleView( d->classicWidget );
d->classicTree = 0;
d->classicTree = nullptr;
}
QWidget * ClassicMode::mainWidget()
......
......@@ -32,13 +32,13 @@
class BaseMode::Private {
public:
Private() : showToolTips(true) {}
Private() {}
QList<QAction*> actionsList;
KService::Ptr service;
MenuItem *rootItem;
MenuItem *rootItem = nullptr;
KConfigGroup config;
bool showToolTips;
bool showToolTips = true;
};
BaseMode::BaseMode( QObject* parent )
......@@ -67,17 +67,17 @@ void BaseMode::initEvent()
QWidget * BaseMode::mainWidget()
{
return 0;
return nullptr;
}
KAboutData * BaseMode::aboutData()
{
return 0;
return nullptr;
}
ModuleView * BaseMode::moduleView() const
{
return 0;
return nullptr;
}
QList<QAction*>& BaseMode::actionsList() const
......
......@@ -32,7 +32,7 @@ class MenuModel::Private {
public:
Private() {}
MenuItem *rootItem;
MenuItem *rootItem = nullptr;
QList<MenuItem*> exceptions;
};
......@@ -69,7 +69,7 @@ int MenuModel::rowCount( const QModelIndex &parent ) const
QVariant MenuModel::data( const QModelIndex &index, int role ) const
{
MenuItem * mi = 0;
MenuItem * mi = nullptr;
QVariant theData;
if ( !index.isValid() ) {
return QVariant();
......
......@@ -52,14 +52,14 @@ public:
Private() {}
QMap<KPageWidgetItem*, KCModuleProxy*> mPages;
QMap<KPageWidgetItem*, KCModuleInfo*> mModules;
KPageWidget* mPageWidget;
QVBoxLayout* mLayout;
QDialogButtonBox* mButtons;
KAuth::ObjectDecorator* mApplyAuthorize;
QPushButton* mApply;
QPushButton* mReset;
QPushButton* mDefault;
QPushButton* mHelp;
KPageWidget* mPageWidget = nullptr;
QVBoxLayout* mLayout = nullptr;
QDialogButtonBox* mButtons = nullptr;
KAuth::ObjectDecorator* mApplyAuthorize = nullptr;
QPushButton* mApply = nullptr;
QPushButton* mReset = nullptr;
QPushButton* mDefault = nullptr;
QPushButton* mHelp = nullptr;
bool pageChangeSupressed;
};
......@@ -124,7 +124,7 @@ KCModuleInfo * ModuleView::activeModule() const
const KAboutData * ModuleView::aboutData() const
{
KCModuleProxy * activeModule = d->mPages.value( d->mPageWidget->currentPage() );
KAboutData * aboutData = 0;
KAboutData * aboutData = nullptr;
if( activeModule ) {
aboutData = const_cast<KAboutData*>( activeModule->aboutData() );
}
......@@ -132,10 +132,10 @@ const KAboutData * ModuleView::aboutData() const
aboutData->setProgramIconName( activeModule->moduleInfo().service()->icon() );
return aboutData;
}
return 0;
return nullptr;
}
void ModuleView::loadModule( QModelIndex menuItem )
void ModuleView::loadModule( const QModelIndex &menuItem )
{
if ( !menuItem.isValid() ) {
return;
......@@ -149,9 +149,9 @@ void ModuleView::loadModule( QModelIndex menuItem )
indexes << menuItem;
}
foreach ( QModelIndex module, indexes ) {
MenuItem *menuItem = module.data( Qt::UserRole ).value<MenuItem*>();
addModule( &menuItem->item() );
foreach ( const QModelIndex &module, indexes ) {
MenuItem *newMenuItem = module.data( Qt::UserRole ).value<MenuItem*>();
addModule( &newMenuItem->item() );
}
// changing state is not needed here as the adding / changing of pages does it
}
......
......@@ -102,7 +102,7 @@ public Q_SLOTS:
*
* @param menuItem the QModelIndex that you want to load. Must be sourced from either MenuModel or MenuProxyModel
*/
void loadModule( QModelIndex menuItem );
void loadModule(const QModelIndex &menuItem );
/**
* Will open KHelpCenter, and load the help for the active module.
......
......@@ -24,7 +24,6 @@
#include <QPainter>
#include <QApplication>
#include <QStyleOption>
#include <QDebug>
CategoryDrawer::CategoryDrawer(KCategorizedView *view)
: KCategoryDrawer(view)
......
......@@ -176,5 +176,5 @@ void SidebarDelegate::initStyleOption(QStyleOptionViewItem *option,
option->backgroundBrush = qvariant_cast<QBrush>(index.data(Qt::BackgroundRole));
// disable style animations for checkboxes etc. within itemviews (QTBUG-30146)
option->styleObject = 0;
option->styleObject = nullptr;
}
......@@ -27,7 +27,7 @@ class SidebarDelegate : public QAbstractItemDelegate
Q_OBJECT
public:
SidebarDelegate(QObject *parent = nullptr);
explicit SidebarDelegate(QObject *parent = nullptr);
~SidebarDelegate();
......
......@@ -82,7 +82,7 @@ void FocusHackWidget::focusPrevious()
class SubcategoryModel : public QStandardItemModel
{
public:
SubcategoryModel(QAbstractItemModel *parentModel, QObject *parent = 0)
explicit SubcategoryModel(QAbstractItemModel *parentModel, QObject *parent = nullptr)
: QStandardItemModel(parent),
m_parentModel(parentModel)
{}
......@@ -115,7 +115,7 @@ private:
class MostUsedModel : public QSortFilterProxyModel
{
public:
MostUsedModel(QObject *parent = 0)
explicit MostUsedModel(QObject *parent = nullptr)
: QSortFilterProxyModel (parent)
{
sort(0, Qt::DescendingOrder);
......@@ -232,20 +232,20 @@ public:
delete aboutIcon;
}
ToolTipManager *toolTipManager;
QQuickWidget * quickWidget;
ToolTipManager *toolTipManager = nullptr;
QQuickWidget * quickWidget = nullptr;
KPackage::Package package;
SubcategoryModel * subCategoryModel;
MostUsedModel * mostUsedModel;
FocusHackWidget * mainWidget;
QQuickWidget * placeHolderWidget;
QHBoxLayout * mainLayout;
SubcategoryModel * subCategoryModel = nullptr;
MostUsedModel * mostUsedModel = nullptr;
FocusHackWidget * mainWidget = nullptr;
QQuickWidget * placeHolderWidget = nullptr;
QHBoxLayout * mainLayout = nullptr;
KDeclarative::KDeclarative kdeclarative;
MenuProxyModel * categorizedModel;
MenuProxyModel * searchModel;
KAboutData * aboutIcon;
ModuleView * moduleView;
KActionCollection *collection;
MenuProxyModel * categorizedModel = nullptr;
MenuProxyModel * searchModel = nullptr;
KAboutData * aboutIcon = nullptr;
ModuleView * moduleView = nullptr;
KActionCollection *collection = nullptr;
QPersistentModelIndex activeCategoryIndex;
int activeCategory;
int activeSubCategory;
......@@ -378,7 +378,7 @@ void SidebarMode::hideToolTip()
d->toolTipManager->hideToolTip();
}
Q_INVOKABLE void SidebarMode::loadMostUsed(int index)
void SidebarMode::loadMostUsed(int index)
{
const QModelIndex idx = d->mostUsedModel->index(index, 0);
d->moduleView->closeModules();
......
Supports Markdown
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