modernize: use nullptr

This commit is contained in:
Nicolas Werner 2020-02-04 04:58:43 +01:00
parent d330020fdd
commit 7ccc120f63
29 changed files with 43 additions and 43 deletions

View file

@ -65,7 +65,7 @@ class ChatPage : public QWidget
Q_OBJECT
public:
ChatPage(QSharedPointer<UserSettings> userSettings, QWidget *parent = 0);
ChatPage(QSharedPointer<UserSettings> userSettings, QWidget *parent = nullptr);
// Initialize all the components of the UI.
void bootstrap(QString userid, QString homeserver, QString token);

View file

@ -111,7 +111,7 @@ LoginPage::LoginPage(QWidget *parent)
form_layout_->addLayout(matrixidLayout_);
form_layout_->addWidget(password_input_);
form_layout_->addWidget(deviceName_, Qt::AlignHCenter, 0);
form_layout_->addWidget(deviceName_, Qt::AlignHCenter, nullptr);
form_layout_->addLayout(serverLayout_);
button_layout_ = new QHBoxLayout();

View file

@ -38,7 +38,7 @@ class LoginPage : public QWidget
Q_OBJECT
public:
LoginPage(QWidget *parent = 0);
LoginPage(QWidget *parent = nullptr);
void reset();

View file

@ -62,7 +62,7 @@ class MainWindow : public QMainWindow
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
explicit MainWindow(QWidget *parent = nullptr);
static MainWindow *instance() { return instance_; };
void saveCurrentWindowSize();

View file

@ -90,10 +90,10 @@ RegisterPage::RegisterPage(QWidget *parent)
server_input_ = new TextField();
server_input_->setLabel(tr("Home Server"));
form_layout_->addWidget(username_input_, Qt::AlignHCenter, 0);
form_layout_->addWidget(password_input_, Qt::AlignHCenter, 0);
form_layout_->addWidget(password_confirmation_, Qt::AlignHCenter, 0);
form_layout_->addWidget(server_input_, Qt::AlignHCenter, 0);
form_layout_->addWidget(username_input_, Qt::AlignHCenter, nullptr);
form_layout_->addWidget(password_input_, Qt::AlignHCenter, nullptr);
form_layout_->addWidget(password_confirmation_, Qt::AlignHCenter, nullptr);
form_layout_->addWidget(server_input_, Qt::AlignHCenter, nullptr);
button_layout_ = new QHBoxLayout();
button_layout_->setSpacing(0);

View file

@ -30,7 +30,7 @@ class RegisterPage : public QWidget
Q_OBJECT
public:
RegisterPage(QWidget *parent = 0);
RegisterPage(QWidget *parent = nullptr);
protected:
void paintEvent(QPaintEvent *event) override;

View file

@ -65,7 +65,7 @@ class RoomInfoListItem : public QWidget
Q_PROPERTY(QColor btnTextColor READ btnTextColor WRITE setBtnTextColor)
public:
RoomInfoListItem(QString room_id, const RoomInfo &info, QWidget *parent = 0);
RoomInfoListItem(QString room_id, const RoomInfo &info, QWidget *parent = nullptr);
void updateUnreadMessageCount(int count, int highlightedCount);
void clearUnreadMessageCount() { updateUnreadMessageCount(0, 0); };

View file

@ -35,7 +35,7 @@ class RoomList : public QWidget
Q_OBJECT
public:
explicit RoomList(QWidget *parent = 0);
explicit RoomList(QWidget *parent = nullptr);
void initialize(const QMap<QString, RoomInfo> &info);
void sync(const std::map<QString, RoomInfo> &info);

View file

@ -142,7 +142,7 @@ class TextInputWidget : public QWidget
Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor)
public:
TextInputWidget(QWidget *parent = 0);
TextInputWidget(QWidget *parent = nullptr);
void stopTyping();

View file

@ -40,7 +40,7 @@ class TopRoomBar : public QWidget
Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor)
public:
TopRoomBar(QWidget *parent = 0);
TopRoomBar(QWidget *parent = nullptr);
void updateRoomAvatar(const QString &avatar_image);
void updateRoomAvatar(const QIcon &icon);

View file

@ -31,7 +31,7 @@ class UserInfoWidget : public QWidget
Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor)
public:
UserInfoWidget(QWidget *parent = 0);
UserInfoWidget(QWidget *parent = nullptr);
void setDisplayName(const QString &name);
void setUserId(const QString &userid);

View file

@ -147,7 +147,7 @@ class UserSettingsPage : public QWidget
Q_OBJECT
public:
UserSettingsPage(QSharedPointer<UserSettings> settings, QWidget *parent = 0);
UserSettingsPage(QSharedPointer<UserSettings> settings, QWidget *parent = nullptr);
protected:
void showEvent(QShowEvent *event) override;

View file

@ -7,7 +7,7 @@ class WelcomePage : public QWidget
Q_OBJECT
public:
explicit WelcomePage(QWidget *parent = 0);
explicit WelcomePage(QWidget *parent = nullptr);
protected:
void paintEvent(QPaintEvent *) override;

View file

@ -32,7 +32,7 @@ ImageOverlay::ImageOverlay(QPixmap image, QWidget *parent)
, originalImage_{image}
{
setMouseTracking(true);
setParent(0);
setParent(nullptr);
setWindowFlags(windowFlags() | Qt::FramelessWindowHint);

View file

@ -13,9 +13,9 @@
ReplyPopup::ReplyPopup(QWidget *parent)
: QWidget(parent)
, userItem_{0}
, msgLabel_{0}
, eventLabel_{0}
, userItem_{nullptr}
, msgLabel_{nullptr}
, eventLabel_{nullptr}
{
setAttribute(Qt::WA_ShowWithoutActivating, true);
setWindowFlags(Qt::ToolTip | Qt::NoDropShadowWindowHint);

View file

@ -59,7 +59,7 @@ private:
size_t posToRemove = layout_->count() - 1;
QLayoutItem *item;
while (startingPos <= posToRemove && (item = layout_->takeAt(posToRemove)) != 0) {
while (startingPos <= posToRemove && (item = layout_->takeAt(posToRemove)) != nullptr) {
delete item->widget();
delete item;

View file

@ -126,7 +126,7 @@ class TimelineModel : public QAbstractListModel
typingUsersChanged)
public:
explicit TimelineModel(TimelineViewManager *manager, QString room_id, QObject *parent = 0);
explicit TimelineModel(TimelineViewManager *manager, QString room_id, QObject *parent = nullptr);
enum Roles
{

View file

@ -29,7 +29,7 @@ class TimelineViewManager : public QObject
replyingEventChanged)
public:
TimelineViewManager(QSharedPointer<UserSettings> userSettings, QWidget *parent = 0);
TimelineViewManager(QSharedPointer<UserSettings> userSettings, QWidget *parent = nullptr);
QWidget *getWidget() const { return container; }
void sync(const mtx::responses::Rooms &rooms);

View file

@ -15,7 +15,7 @@ class Avatar : public QWidget
Q_PROPERTY(QColor backgroundColor WRITE setBackgroundColor READ backgroundColor)
public:
explicit Avatar(QWidget *parent = 0, int size = ui::AvatarSize);
explicit Avatar(QWidget *parent = nullptr, int size = ui::AvatarSize);
void setBackgroundColor(const QColor &color);
void setIcon(const QIcon &icon);

View file

@ -16,9 +16,9 @@ class Badge : public OverlayWidget
Q_PROPERTY(QPointF relativePosition WRITE setRelativePosition READ relativePosition)
public:
explicit Badge(QWidget *parent = 0);
explicit Badge(const QIcon &icon, QWidget *parent = 0);
explicit Badge(const QString &text, QWidget *parent = 0);
explicit Badge(QWidget *parent = nullptr);
explicit Badge(const QIcon &icon, QWidget *parent = nullptr);
explicit Badge(const QString &text, QWidget *parent = nullptr);
void setBackgroundColor(const QColor &color);
void setTextColor(const QColor &color);

View file

@ -91,14 +91,14 @@ class FlatButton : public QPushButton
Q_PROPERTY(qreal fontSize WRITE setFontSize READ fontSize)
public:
explicit FlatButton(QWidget *parent = 0,
explicit FlatButton(QWidget *parent = nullptr,
ui::ButtonPreset preset = ui::ButtonPreset::FlatPreset);
explicit FlatButton(const QString &text,
QWidget *parent = 0,
QWidget *parent = nullptr,
ui::ButtonPreset preset = ui::ButtonPreset::FlatPreset);
FlatButton(const QString &text,
ui::Role role,
QWidget *parent = 0,
QWidget *parent = nullptr,
ui::ButtonPreset preset = ui::ButtonPreset::FlatPreset);
~FlatButton();

View file

@ -12,7 +12,7 @@ class LoadingIndicator : public QWidget
Q_PROPERTY(QColor color READ color WRITE setColor)
public:
LoadingIndicator(QWidget *parent = 0);
LoadingIndicator(QWidget *parent = nullptr);
void paintEvent(QPaintEvent *e);

View file

@ -11,8 +11,8 @@ class RaisedButton : public FlatButton
Q_OBJECT
public:
explicit RaisedButton(QWidget *parent = 0);
explicit RaisedButton(const QString &text, QWidget *parent = 0);
explicit RaisedButton(QWidget *parent = nullptr);
explicit RaisedButton(const QString &text, QWidget *parent = nullptr);
~RaisedButton();
protected:

View file

@ -3,7 +3,7 @@
Ripple::Ripple(const QPoint &center, QObject *parent)
: QParallelAnimationGroup(parent)
, overlay_(0)
, overlay_(nullptr)
, radius_anim_(animate("radius"))
, opacity_anim_(animate("opacity"))
, radius_(0)

View file

@ -16,8 +16,8 @@ class Ripple : public QParallelAnimationGroup
Q_PROPERTY(qreal opacity WRITE setOpacity READ opacity)
public:
explicit Ripple(const QPoint &center, QObject *parent = 0);
Ripple(const QPoint &center, RippleOverlay *overlay, QObject *parent = 0);
explicit Ripple(const QPoint &center, QObject *parent = nullptr);
Ripple(const QPoint &center, RippleOverlay *overlay, QObject *parent = nullptr);
inline void setOverlay(RippleOverlay *overlay);

View file

@ -11,7 +11,7 @@ class RippleOverlay : public OverlayWidget
Q_OBJECT
public:
explicit RippleOverlay(QWidget *parent = 0);
explicit RippleOverlay(QWidget *parent = nullptr);
void addRipple(Ripple *ripple);
void addRipple(const QPoint &position, qreal radius = 300);

View file

@ -16,7 +16,7 @@ TextField::TextField(QWidget *parent)
QPalette pal;
state_machine_ = new TextFieldStateMachine(this);
label_ = 0;
label_ = nullptr;
label_font_size_ = 15;
show_label_ = false;
background_color_ = pal.color(QPalette::Window);
@ -230,9 +230,9 @@ TextFieldStateMachine::TextFieldStateMachine(TextField *parent)
normal_state_ = new QState;
focused_state_ = new QState;
label_ = 0;
offset_anim_ = 0;
color_anim_ = 0;
label_ = nullptr;
offset_anim_ = nullptr;
color_anim_ = nullptr;
progress_ = 0.0;
addState(normal_state_);

View file

@ -22,7 +22,7 @@ class TextField : public QLineEdit
Q_PROPERTY(QColor backgroundColor WRITE setBackgroundColor READ backgroundColor)
public:
explicit TextField(QWidget *parent = 0);
explicit TextField(QWidget *parent = nullptr);
void setInkColor(const QColor &color);
void setBackgroundColor(const QColor &color);

View file

@ -78,7 +78,7 @@ class Theme : public QObject
{
Q_OBJECT
public:
explicit Theme(QObject *parent = 0);
explicit Theme(QObject *parent = nullptr);
QColor getColor(const QString &key) const;