Initialize pointer to a default value

This commit is contained in:
Chocobo1
2022-06-23 12:28:00 +08:00
parent 6de72ecc77
commit 02d906d3ae
77 changed files with 178 additions and 202 deletions

View File

@@ -53,6 +53,6 @@ protected slots:
void validateInput();
private:
Ui::PeersAdditionDialog *m_ui;
Ui::PeersAdditionDialog *m_ui = nullptr;
QVector<BitTorrent::PeerAddress> m_peersList;
};

View File

@@ -73,8 +73,6 @@
PropertiesWidget::PropertiesWidget(QWidget *parent)
: QWidget(parent)
, m_ui(new Ui::PropertiesWidget())
, m_torrent(nullptr)
, m_handleWidth(-1)
{
m_ui->setupUi(this);
setAutoFillBackground(true);

View File

@@ -112,18 +112,18 @@ private:
void openParentFolder(const QModelIndex &index) const;
Path getFullPath(const QModelIndex &index) const;
Ui::PropertiesWidget *m_ui;
BitTorrent::Torrent *m_torrent;
Ui::PropertiesWidget *m_ui = nullptr;
BitTorrent::Torrent *m_torrent = nullptr;
SlideState m_state;
TorrentContentFilterModel *m_propListModel;
PropListDelegate *m_propListDelegate;
PeerListWidget *m_peerList;
TrackerListWidget *m_trackerList;
TorrentContentFilterModel *m_propListModel = nullptr;
PropListDelegate *m_propListDelegate = nullptr;
PeerListWidget *m_peerList = nullptr;
TrackerListWidget *m_trackerList = nullptr;
QWidget *m_speedWidget = nullptr;
QList<int> m_slideSizes;
DownloadedPiecesBar *m_downloadedPieces;
PieceAvailabilityBar *m_piecesAvailability;
PropTabBar *m_tabBar;
LineEdit *m_contentFilterLine;
int m_handleWidth;
DownloadedPiecesBar *m_downloadedPieces = nullptr;
PieceAvailabilityBar *m_piecesAvailability = nullptr;
PropTabBar *m_tabBar = nullptr;
LineEdit *m_contentFilterLine = nullptr;
int m_handleWidth = -1;
};

View File

@@ -69,6 +69,6 @@ signals:
void filteredFilesChanged() const;
private:
PropertiesWidget *m_properties;
PropertiesWidget *m_properties = nullptr;
ProgressBarPainter m_progressBarPainter;
};

View File

@@ -38,7 +38,6 @@
PropTabBar::PropTabBar(QWidget *parent)
: QHBoxLayout(parent)
, m_currentIndex(-1)
{
setAlignment(Qt::AlignLeft | Qt::AlignCenter);
setSpacing(3);

View File

@@ -60,6 +60,6 @@ public slots:
void setCurrentIndex(int index);
private:
QButtonGroup *m_btnGroup;
int m_currentIndex;
QButtonGroup *m_btnGroup = nullptr;
int m_currentIndex = -1;
};

View File

@@ -49,7 +49,7 @@ public:
void showPopup() override;
private:
QMenu *m_menu;
QMenu *m_menu = nullptr;
};
@@ -71,13 +71,13 @@ private:
void loadSettings();
void saveSettings() const;
QVBoxLayout *m_layout;
QHBoxLayout *m_hlayout;
QLabel *m_periodLabel;
QComboBox *m_periodCombobox;
SpeedPlotView *m_plot;
QVBoxLayout *m_layout = nullptr;
QHBoxLayout *m_hlayout = nullptr;
QLabel *m_periodLabel = nullptr;
QComboBox *m_periodCombobox = nullptr;
SpeedPlotView *m_plot = nullptr;
ComboBoxMenuButton *m_graphsButton;
QMenu *m_graphsMenu;
ComboBoxMenuButton *m_graphsButton = nullptr;
QMenu *m_graphsMenu = nullptr;
QList<QAction *> m_graphsMenuActions;
};

View File

@@ -91,9 +91,9 @@ private:
static QStringList headerLabels();
PropertiesWidget *m_properties;
PropertiesWidget *m_properties = nullptr;
QHash<QString, QTreeWidgetItem *> m_trackerItems;
QTreeWidgetItem *m_DHTItem;
QTreeWidgetItem *m_PEXItem;
QTreeWidgetItem *m_LSDItem;
QTreeWidgetItem *m_DHTItem = nullptr;
QTreeWidgetItem *m_PEXItem = nullptr;
QTreeWidgetItem *m_LSDItem = nullptr;
};

View File

@@ -65,6 +65,6 @@ public slots:
void torrentListDownloadFinished(const Net::DownloadResult &result);
private:
Ui::TrackersAdditionDialog *m_ui;
BitTorrent::Torrent *const m_torrent;
Ui::TrackersAdditionDialog *m_ui = nullptr;
BitTorrent::Torrent *const m_torrent = nullptr;
};