Replace NULL with nullptr in kcmkwin

Replacing all NULL to nullptr in all the files in kcmkwin folder
(also substituting some "0" used as nullptr with nullptr)

REVIEW: 114803
This commit is contained in:
Matteo De Carlo 2014-01-07 11:22:24 +01:00 committed by Martin Gräßlin
parent 6fce4c2b81
commit aad36da80b
18 changed files with 47 additions and 47 deletions

View file

@ -112,7 +112,7 @@ class ButtonSource : public QListWidget
Q_OBJECT
public:
explicit ButtonSource(QWidget *parent = 0);
explicit ButtonSource(QWidget *parent = nullptr);
virtual ~ButtonSource();
QSize sizeHint() const;
@ -143,7 +143,7 @@ class ButtonDropSite: public QFrame
Q_OBJECT
public:
explicit ButtonDropSite(QWidget* parent = 0);
explicit ButtonDropSite(QWidget* parent = nullptr);
~ButtonDropSite();
// Allow external classes access our buttons - ensure buttons are
@ -196,7 +196,7 @@ class ButtonPositionWidget : public QWidget
Q_OBJECT
public:
explicit ButtonPositionWidget(QWidget *parent = 0);
explicit ButtonPositionWidget(QWidget *parent = nullptr);
~ButtonPositionWidget();
QList<KDecorationDefines::DecorationButton> buttonsLeft() const;

View file

@ -43,7 +43,7 @@ class KWinDecorationButtonsConfigDialog : public QDialog
{
Q_OBJECT
public:
KWinDecorationButtonsConfigDialog(DecorationButtons const *buttons, bool showTooltips, QWidget* parent = 0, Qt::WFlags flags = 0);
KWinDecorationButtonsConfigDialog(DecorationButtons const *buttons, bool showTooltips, QWidget* parent = nullptr, Qt::WFlags flags = 0);
~KWinDecorationButtonsConfigDialog();
bool customPositions() const;

View file

@ -74,8 +74,8 @@ KWinDecorationConfigDialog::KWinDecorationConfigDialog(QString deco, const QList
: QDialog(parent, flags)
, m_borderSizes(borderSizes)
, m_kwinConfig(KSharedConfig::openConfig("kwinrc"))
, m_pluginObject(0)
, m_pluginConfigWidget(0)
, m_pluginObject(nullptr)
, m_pluginConfigWidget(nullptr)
{
m_ui = new KWinDecorationConfigForm(this);
setWindowTitle(i18n("Decoration Options"));
@ -92,7 +92,7 @@ KWinDecorationConfigDialog::KWinDecorationConfigDialog(QString deco, const QList
KLibrary library(styleToConfigLib(deco));
if (library.load()) {
KLibrary::void_function_ptr alloc_ptr = library.resolveFunction("allocate_config");
if (alloc_ptr != NULL) {
if (alloc_ptr != nullptr) {
allocatePlugin = (QObject * (*)(KConfigGroup & conf, QWidget * parent))alloc_ptr;
KConfigGroup config(m_kwinConfig, "Style");
m_pluginConfigWidget = new QWidget(this);

View file

@ -54,7 +54,7 @@ class KWinDecorationConfigDialog : public QDialog, public KDecorationDefines
Q_OBJECT
public:
KWinDecorationConfigDialog(QString decoLib, const QList<QVariant>& borderSizes,
KDecorationDefines::BorderSize size, QWidget* parent = 0,
KDecorationDefines::BorderSize size, QWidget* parent = nullptr,
Qt::WFlags flags = 0);
~KWinDecorationConfigDialog();

View file

@ -89,7 +89,7 @@ public:
QmlMainScriptRole = Qt::UserRole + 14,
CloseOnDblClickRole = Qt::UserRole + 15
};
explicit DecorationModel(KSharedConfigPtr config, QObject* parent = 0);
explicit DecorationModel(KSharedConfigPtr config, QObject* parent = nullptr);
~DecorationModel();
virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;

View file

@ -73,8 +73,8 @@ KWinDecorationModule::KWinDecorationModule(QWidget* parent, const QVariantList &
: KCModule(parent)
, kwinConfig(KSharedConfig::openConfig("kwinrc"))
, m_showTooltips(false)
, m_model(NULL)
, m_proxyModel(NULL)
, m_model(nullptr)
, m_proxyModel(nullptr)
, m_configLoaded(false)
, m_decorationButtons(new DecorationButtons(this))
, m_listView(new QQuickView())
@ -381,7 +381,7 @@ void KWinDecorationModule::slotConfigureDecoration()
form->buttonSizesCombo->setCurrentIndex(index.data(DecorationModel::ButtonSizeRole).toInt());
form->closeWindowsDoubleClick->setChecked(index.data(DecorationModel::CloseOnDblClickRole).toBool());
// in case of QmlDecoration look for a config.ui in the package structure
KConfigDialogManager *configManager = NULL;
KConfigDialogManager *configManager = nullptr;
if (index.data(DecorationModel::TypeRole).toInt() == DecorationModelData::QmlDecoration) {
const QString packageName = index.data(DecorationModel::AuroraeNameRole).toString();
const QString uiPath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kwin/decorations/" + packageName + "/contents/ui/config.ui");

View file

@ -58,7 +58,7 @@ class DecorationButtons : public QObject, public KDecorationDefines
Q_OBJECT
Q_PROPERTY(bool customButtonPositions READ customPositions WRITE setCustomPositions NOTIFY customPositionsChanged)
public:
explicit DecorationButtons(QObject *parent = 0);
explicit DecorationButtons(QObject *parent = nullptr);
virtual ~DecorationButtons();
bool customPositions() const;

View file

@ -84,7 +84,7 @@ public:
// and an inactive window.
enum Windows { Inactive = 0, Active, NumWindows };
explicit KDecorationPreview(QWidget* parent = NULL);
explicit KDecorationPreview(QWidget* parent = nullptr);
virtual ~KDecorationPreview();
void disablePreview();
KDecorationFactory *factory() const;

View file

@ -59,8 +59,8 @@ KWinDesktopConfigForm::KWinDesktopConfigForm(QWidget* parent)
KWinDesktopConfig::KWinDesktopConfig(QWidget* parent, const QVariantList& args)
: KCModule(KAboutData::pluginData(QStringLiteral("kcm_kwindesktop")), parent, args)
, m_config(KSharedConfig::openConfig("kwinrc"))
, m_actionCollection(NULL)
, m_switchDesktopCollection(NULL)
, m_actionCollection(nullptr)
, m_switchDesktopCollection(nullptr)
{
init();
}

View file

@ -176,7 +176,7 @@ void DetectDialog::selectWindow()
// use a dialog, so that all user input is blocked
// use WX11BypassWM and moving away so that it's not actually visible
// grab only mouse, so that keyboard can be used e.g. for switching windows
grabber.reset(new QDialog(0, Qt::X11BypassWindowManagerHint));
grabber.reset(new QDialog(nullptr, Qt::X11BypassWindowManagerHint));
grabber->move(-1000, -1000);
grabber->setModal(true);
grabber->show();
@ -233,7 +233,7 @@ WId DetectDialog::findWindow()
unsigned char* prop;
if (XGetWindowProperty(QX11Info::display(), child, wm_state, 0, 0, False, AnyPropertyType,
&type, &format, &nitems, &after, &prop) == Success) {
if (prop != NULL)
if (prop != nullptr)
XFree(prop);
if (type != None)
return child;

View file

@ -39,7 +39,7 @@ class DetectWidget
{
Q_OBJECT
public:
explicit DetectWidget(QWidget* parent = NULL);
explicit DetectWidget(QWidget* parent = nullptr);
};
class DetectDialog
@ -47,7 +47,7 @@ class DetectDialog
{
Q_OBJECT
public:
explicit DetectDialog(QWidget* parent = NULL, const char* name = NULL);
explicit DetectDialog(QWidget* parent = nullptr, const char* name = nullptr);
void detect(WId window, int secs = 0);
QByteArray selectedClass() const;
bool selectedWholeClass() const;

View file

@ -72,7 +72,7 @@ static Rules* findRule(const QList< Rules* >& rules, Window wid, bool whole_app)
NET::WMName | NET::WMWindowType,
NET::WM2WindowClass | NET::WM2WindowRole | NET::WM2ClientMachine);
if (!info.valid()) // shouldn't really happen
return NULL;
return nullptr;
ClientMachine clientMachine;
clientMachine.resolve(info.win(), info.groupLeader());
QByteArray wmclass_class = info.windowClassClass().toLower();
@ -83,7 +83,7 @@ static Rules* findRule(const QList< Rules* >& rules, Window wid, bool whole_app)
| NET::UtilityMask | NET::SplashMask);
QString title = info.name();
QByteArray machine = clientMachine.hostName();
Rules* best_match = NULL;
Rules* best_match = nullptr;
int match_quality = 0;
for (QList< Rules* >::ConstIterator it = rules.constBegin();
it != rules.constEnd();
@ -136,7 +136,7 @@ static Rules* findRule(const QList< Rules* >& rules, Window wid, bool whole_app)
match_quality = quality;
}
}
if (best_match != NULL)
if (best_match != nullptr)
return best_match;
Rules* ret = new Rules;
if (whole_app) {
@ -215,7 +215,7 @@ static int edit(Window wid, bool whole_app)
dlg.setWindowTitle(i18nc("Window caption for the application wide rules dialog", "Edit Application-Specific Settings"));
// dlg.edit() creates new Rules instance if edited
Rules* edited_rule = dlg.edit(orig_rule, wid, true);
if (edited_rule == NULL || edited_rule->isEmpty()) {
if (edited_rule == nullptr || edited_rule->isEmpty()) {
rules.removeAll(orig_rule);
delete orig_rule;
if (orig_rule != edited_rule)

View file

@ -72,20 +72,20 @@ void KCMRulesList::activeChanged()
QListWidgetItem *item = rules_listbox->currentItem();
int itemRow = rules_listbox->row(item);
if (item != NULL) // make current==selected
if (item != nullptr) // make current==selected
rules_listbox->setCurrentItem(item, QItemSelectionModel::ClearAndSelect);
modify_button->setEnabled(item != NULL);
delete_button->setEnabled(item != NULL);
export_button->setEnabled(item != NULL);
moveup_button->setEnabled(item != NULL && itemRow > 0);
movedown_button->setEnabled(item != NULL && itemRow < (rules_listbox->count() - 1));
modify_button->setEnabled(item != nullptr);
delete_button->setEnabled(item != nullptr);
export_button->setEnabled(item != nullptr);
moveup_button->setEnabled(item != nullptr && itemRow > 0);
movedown_button->setEnabled(item != nullptr && itemRow < (rules_listbox->count() - 1));
}
void KCMRulesList::newClicked()
{
RulesDialog dlg(this);
Rules* rule = dlg.edit(NULL, 0, false);
if (rule == NULL)
Rules* rule = dlg.edit(nullptr, 0, false);
if (rule == nullptr)
return;
int pos = rules_listbox->currentRow() + 1;
rules_listbox->insertItem(pos , rule->description);
@ -191,7 +191,7 @@ void KCMRulesList::importClicked()
}
else
rules[i] = new_rule;
new_rule = 0;
new_rule = nullptr;
break;
}
}
@ -199,7 +199,7 @@ void KCMRulesList::importClicked()
// don't add "to be deleted" if not present
if (remove) {
delete new_rule;
new_rule = 0;
new_rule = nullptr;
}
// plain insertion
@ -234,7 +234,7 @@ void KCMRulesList::load()
if (rules.count() > 0)
rules_listbox->setCurrentItem(rules_listbox->item(0));
else
rules_listbox->setCurrentItem(NULL);
rules_listbox->setCurrentItem(nullptr);
activeChanged();
}

View file

@ -32,7 +32,7 @@ class KCMRulesList
{
Q_OBJECT
public:
explicit KCMRulesList(QWidget* parent = NULL);
explicit KCMRulesList(QWidget* parent = nullptr);
virtual ~KCMRulesList();
void load();
void save();

View file

@ -54,7 +54,7 @@ namespace KWin
rule_##var->setWhatsThis( type##RuleDesc );
RulesWidget::RulesWidget(QWidget* parent)
: detect_dlg(NULL)
: detect_dlg(nullptr)
{
Q_UNUSED(parent);
QRegularExpressionValidator* validator = new QRegularExpressionValidator(QRegularExpression("[0-9\-+,xX:]*"), this);
@ -426,7 +426,7 @@ static NET::WindowType comboToType(int val)
void RulesWidget::setRules(Rules* rules)
{
Rules tmp;
if (rules == NULL)
if (rules == nullptr)
rules = &tmp; // empty
description->setText(rules->description);
wmclass->setText(rules->wmclass);
@ -634,7 +634,7 @@ STRING_MATCH_COMBO(machine)
void RulesWidget::detectClicked()
{
assert(detect_dlg == NULL);
assert(detect_dlg == nullptr);
detect_dlg = new DetectDialog;
connect(detect_dlg, SIGNAL(detectionDone(bool)), this, SLOT(detected(bool)));
detect_dlg->detect(0, Ui::RulesWidgetBase::detection_delay->value());
@ -675,7 +675,7 @@ void RulesWidget::detected(bool ok)
prefillUnusedValues(info);
}
delete detect_dlg;
detect_dlg = NULL;
detect_dlg = nullptr;
detect_dlg_ok = ok;
}

View file

@ -40,7 +40,7 @@ class RulesWidget
{
Q_OBJECT
public:
explicit RulesWidget(QWidget* parent = NULL);
explicit RulesWidget(QWidget* parent = nullptr);
void setRules(Rules* r);
Rules* rules() const;
bool finalCheck();
@ -116,7 +116,7 @@ class RulesDialog
{
Q_OBJECT
public:
explicit RulesDialog(QWidget* parent = NULL, const char* name = NULL);
explicit RulesDialog(QWidget* parent = nullptr, const char* name = nullptr);
Rules* edit(Rules* r, WId window, bool show_hints);
protected:
virtual void accept();
@ -132,7 +132,7 @@ class EditShortcut
{
Q_OBJECT
public:
explicit EditShortcut(QWidget* parent = NULL);
explicit EditShortcut(QWidget* parent = nullptr);
protected Q_SLOTS:
void editShortcut();
void clearShortcut();
@ -143,7 +143,7 @@ class EditShortcutDialog
{
Q_OBJECT
public:
explicit EditShortcutDialog(QWidget* parent = NULL, const char* name = NULL);
explicit EditShortcutDialog(QWidget* parent = nullptr, const char* name = nullptr);
void setShortcut(const QString& cut);
QString shortcut() const;
private:
@ -156,7 +156,7 @@ class ShortcutDialog
{
Q_OBJECT
public:
explicit ShortcutDialog(const QKeySequence& cut, QWidget* parent = NULL);
explicit ShortcutDialog(const QKeySequence& cut, QWidget* parent = nullptr);
virtual void accept();
QKeySequence shortcut() const;
private:

View file

@ -48,7 +48,7 @@ class ExampleClientModel : public QAbstractListModel
{
Q_OBJECT
public:
explicit ExampleClientModel(QObject *parent = NULL);
explicit ExampleClientModel(QObject *parent = nullptr);
virtual ~ExampleClientModel();
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;

View file

@ -461,7 +461,7 @@ void KWinTabBoxConfig::updateConfigFromUi(const KWin::KWinTabBoxConfigForm* ui,
#define CHECK_CURRENT_TABBOX_UI \
Q_ASSERT(sender());\
KWinTabBoxConfigForm *ui = 0;\
KWinTabBoxConfigForm *ui = nullptr;\
QObject *dad = sender();\
while (!ui && (dad = dad->parent()))\
ui = qobject_cast<KWinTabBoxConfigForm*>(dad);\