Commit 7c9a2e0b authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau
Browse files

Use more nullptr

parent 4363bf9a
......@@ -60,7 +60,7 @@ class AutoPasteModel : public QAbstractTableModel
RegExp
};
explicit AutoPasteModel(QObject *parent = 0);
explicit AutoPasteModel(QObject *parent = nullptr);
~AutoPasteModel() override;
int rowCount(const QModelIndex &index = QModelIndex()) const override;
......
......@@ -38,7 +38,7 @@ const int SPEEDTIMER = 1000;//1 second...
DataSourceFactory::DataSourceFactory(QObject *parent, const QUrl &dest, KIO::filesize_t size, KIO::fileoffset_t segSize)
: QObject(parent),
m_capabilities(0),
m_capabilities(),
m_dest(dest),
m_size(size),
m_downloadedSize(0),
......@@ -46,8 +46,8 @@ DataSourceFactory::DataSourceFactory(QObject *parent, const QUrl &dest, KIO::fil
m_speed(0),
m_percent(0),
m_tempOffset(0),
m_startedChunks(0),
m_finishedChunks(0),
m_startedChunks(nullptr),
m_finishedChunks(nullptr),
m_putJob(nullptr),
m_doDownload(true),
m_open(false),
......@@ -61,7 +61,7 @@ DataSourceFactory::DataSourceFactory(QObject *parent, const QUrl &dest, KIO::fil
m_sizeInitiallyDefined(m_size),
m_sizeFoundOnFinish(false),
m_maxMirrorsUsed(3),
m_speedTimer(0),
m_speedTimer(nullptr),
m_status(Job::Stopped),
m_statusBeforeMove(m_status),
m_verifier(nullptr),
......
......@@ -54,7 +54,7 @@ void Download::slotResult(KJob * job)
torrentFile.write(m_data);
torrentFile.close();
emit finishedSuccessfully(m_destUrl, m_data);
m_data = 0;
m_data = nullptr;
break;
}
case KIO::ERR_FILE_ALREADY_EXIST:
......@@ -62,12 +62,12 @@ void Download::slotResult(KJob * job)
qCDebug(KGET_DEBUG) << "ERROR - File already exists";
QFile file(m_destUrl.toLocalFile());
emit finishedSuccessfully(m_destUrl, file.readAll());
m_data = 0;
m_data = nullptr;
break;
}
default:
qCDebug(KGET_DEBUG) << "We are sorry to say you, that there were errors while downloading :(";
m_data = 0;
m_data = nullptr;
emit finishedWithError();
break;
}
......
......@@ -609,7 +609,7 @@ FileItem *FileModel::getItem(const QUrl &file)
if (item == m_rootItem)
{
item = 0;
item = nullptr;
}
else
{
......
......@@ -90,7 +90,7 @@ void KeyDownloader::downloadKey(QString fingerprint, Signature *sig, bool mirror
}
if (mirror.isEmpty()) {
KMessageBox::error(0,
KMessageBox::error(nullptr,
i18n("No useful key server found, key not downloaded. Add more servers to the settings or restart KGet and retry downloading."),
i18n("No key server"));
return;
......@@ -126,7 +126,7 @@ void KeyDownloader::slotDownloaded(KJob *job)
if (transferJob->isErrorPage()) {
qCDebug(KGET_DEBUG) << "Mirror did not work, try another one.";
downloadKey(fingerprint, 0, true);
downloadKey(fingerprint, nullptr, true);
return;
}
......@@ -134,7 +134,7 @@ void KeyDownloader::slotDownloaded(KJob *job)
QByteArray data = transferJob->data();
if (data.isEmpty()) {
qCDebug(KGET_DEBUG) << "Downloaded data is empty.";
downloadKey(fingerprint, 0, true);
downloadKey(fingerprint, nullptr, true);
return;
}
......@@ -142,7 +142,7 @@ void KeyDownloader::slotDownloaded(KJob *job)
const int indexEnd = data.indexOf("</pre>", indexStart);
if ((indexStart == -1) || (indexEnd == -1)) {
qCDebug(KGET_DEBUG) << "Could not find a key.";
downloadKey(fingerprint, 0, true);
downloadKey(fingerprint, nullptr, true);
return;
}
......
......@@ -32,7 +32,7 @@ Transfer * TransferFactory::createTransfer(const QUrl &srcUrl, const QUrl &destU
Q_UNUSED(parent)
Q_UNUSED(scheduler)
Q_UNUSED(n)
return 0;
return nullptr;
}
TransferHandler * TransferFactory::createTransferHandler(Transfer * transfer, Scheduler * scheduler)
......@@ -43,7 +43,7 @@ TransferHandler * TransferFactory::createTransferHandler(Transfer * transfer, Sc
QWidget * TransferFactory::createDetailsWidget(TransferHandler * transfer)
{
Q_UNUSED(transfer)
return 0;
return nullptr;
}
QDialog * TransferFactory::createNewTransferDialog(const QUrl &srcUrl, const QString &suggestedFileName, TransferGroupHandler * defaultGroup)
......@@ -51,7 +51,7 @@ QDialog * TransferFactory::createNewTransferDialog(const QUrl &srcUrl, const QSt
Q_UNUSED(srcUrl)
Q_UNUSED(suggestedFileName)
Q_UNUSED(defaultGroup)
return 0;
return nullptr;
}
const QList<QAction *> TransferFactory::actions(TransferHandler *handler)
......@@ -65,7 +65,7 @@ TransferDataSource * TransferFactory::createTransferDataSource(const QUrl &srcUr
Q_UNUSED(srcUrl)
Q_UNUSED(type)
Q_UNUSED(parent)
return 0;
return nullptr;
}
bool TransferFactory::isSupported(const QUrl &url) const
......
......@@ -59,16 +59,16 @@ class KGET_EXPORT TransferFactory : public KGetPlugin
virtual Transfer * createTransfer( const QUrl &srcUrl, const QUrl &destUrl,
TransferGroup * parent,
Scheduler * scheduler,
const QDomElement * n = 0 );
const QDomElement * n = nullptr );
virtual TransferHandler * createTransferHandler(Transfer * transfer,
Scheduler * scheduler);
virtual QWidget * createDetailsWidget(TransferHandler * transfer);
virtual QDialog * createNewTransferDialog(const QUrl &srcUrl, const QString &suggestedFileName = QString(), TransferGroupHandler * defaultGroup = 0);
virtual QDialog * createNewTransferDialog(const QUrl &srcUrl, const QString &suggestedFileName = QString(), TransferGroupHandler * defaultGroup = nullptr);
virtual const QList<QAction *> actions(TransferHandler *handler = 0);
virtual const QList<QAction *> actions(TransferHandler *handler = nullptr);
virtual void settingsChanged() {}
......
......@@ -48,7 +48,7 @@ Transfer::Transfer(TransferGroup * parent, TransferFactory * factory,
m_totalSize(0), m_downloadedSize(0), m_uploadedSize(0),
m_percent(0), m_downloadSpeed(0), m_uploadSpeed(0),
m_uploadLimit(0), m_downloadLimit(0), m_isSelected(false),
m_capabilities(0), m_visibleUploadLimit(0), m_visibleDownloadLimit(0),
m_capabilities(), m_visibleUploadLimit(0), m_visibleDownloadLimit(0),
m_ratio(0), m_handler(nullptr), m_factory(factory)
{
Q_UNUSED(e)
......
......@@ -20,7 +20,7 @@ TransferDataSource::TransferDataSource(const QUrl &srcUrl, QObject *parent)
m_supposedSize(0),
m_parallelSegments(1),
m_currentSegments(0),
m_capabilities(0)
m_capabilities()
{
qCDebug(KGET_DEBUG) ;
}
......
......@@ -83,7 +83,7 @@ void BTAdvancedDetailsWidget::hideEvent(QHideEvent * event)
Q_UNUSED(event)
if (tc)
tc->setMonitor(0);
tc->setMonitor(nullptr);
emit aboutToClose();
deleteLater();
}
......
......@@ -48,7 +48,7 @@ using namespace bt;
namespace kt
{
FileView::FileView(QWidget *parent) : QTreeView(parent),curr_tc(0),model(0)
FileView::FileView(QWidget *parent) : QTreeView(parent),curr_tc(nullptr),model(nullptr)
{
setContextMenuPolicy(Qt::CustomContextMenu);
setRootIsDecorated(false);
......@@ -102,7 +102,7 @@ namespace kt
if (curr_tc)
expanded_state_map[curr_tc] = model->saveExpandedState(proxy_model,this);
}
proxy_model->setSourceModel(0);
proxy_model->setSourceModel(nullptr);
delete model;
model = nullptr;
curr_tc = tc;
......@@ -128,7 +128,7 @@ namespace kt
}
else
{
proxy_model->setSourceModel(0);
proxy_model->setSourceModel(nullptr);
model = nullptr;
}
}
......@@ -415,7 +415,7 @@ namespace kt
saveState(cfg);
expanded_state_map[curr_tc] = model->saveExpandedState(proxy_model,this);
proxy_model->setSourceModel(0);
proxy_model->setSourceModel(nullptr);
delete model;
model = nullptr;
......
......@@ -43,7 +43,7 @@ namespace kt
Monitor::~Monitor()
{
if (tc)
tc->setMonitor(0);
tc->setMonitor(nullptr);
}
......
......@@ -384,7 +384,7 @@ namespace kt
bt::PeerInterface* PeerViewModel::indexToPeer(const QModelIndex & index)
{
if (!index.isValid() || index.row() >= items.count() || index.row() < 0)
return 0;
return nullptr;
else
return ((Item*)index.internalPointer())->peer;
}
......
......@@ -264,11 +264,11 @@ namespace kt
bt::TorrentFileInterface* TorrentFileListModel::indexToFile(const QModelIndex & idx)
{
if (!idx.isValid())
return 0;
return nullptr;
int r = idx.row();
if (r < 0 || r >= rowCount(QModelIndex()))
return 0;
return nullptr;
else
return &tc->getTorrentFile(r);
}
......
......@@ -673,11 +673,11 @@ namespace kt
bt::TorrentFileInterface* TorrentFileTreeModel::indexToFile(const QModelIndex & idx)
{
if (!idx.isValid())
return 0;
return nullptr;
Node* n = (Node*)idx.internalPointer();
if (!n)
return 0;
return nullptr;
return n->file;
}
......
......@@ -229,7 +229,7 @@ namespace kt
bt::TrackerInterface* TrackerModel::tracker(const QModelIndex & index)
{
if (!tc || !index.isValid() || index.row() < 0 || index.row() >= trackers.count())
return 0;
return nullptr;
return ((Item*)index.internalPointer())->trk;
}
......
......@@ -85,7 +85,7 @@ namespace kt
return;
QUrl url(m_webseed->text());
if (curr_tc != 0 && url.isValid() && url.scheme() == "http")
if (curr_tc != nullptr && url.isValid() && url.scheme() == "http")
{
if (curr_tc->addWebSeed(url))
{
......
......@@ -748,7 +748,7 @@ FileModel *BTTransfer::fileModel()//TODO correct file model for one-file-torrent
{
if (!torrent)
{
return 0;
return nullptr;
}
//multiple files
......
......@@ -52,7 +52,7 @@ class BTTransfer : public Transfer, public bt::MonitorInterface
BTTransfer(TransferGroup* parent, TransferFactory* factory,
Scheduler* scheduler, const QUrl &src, const QUrl& dest,
const QDomElement * e = 0);
const QDomElement * e = nullptr);
~BTTransfer();
void deinit(Transfer::DeleteOptions options) override;
......
......@@ -49,7 +49,7 @@ Transfer * BTTransferFactory::createTransfer(const QUrl &srcUrl, const QUrl &des
{
return new BTTransfer(parent, this, scheduler, srcUrl, destUrl, e);
}
return 0;
return nullptr;
}
TransferHandler * BTTransferFactory::createTransferHandler(Transfer * transfer, Scheduler * scheduler)
......@@ -59,7 +59,7 @@ TransferHandler * BTTransferFactory::createTransferHandler(Transfer * transfer,
if (!bttransfer)
{
qCCritical(KGET_DEBUG) << "WARNING! passing a non-BTTransfer pointer!!";
return 0;
return nullptr;
}
return new BTTransferHandler(bttransfer, scheduler);
......@@ -105,7 +105,7 @@ TransferDataSource * BTTransferFactory::createTransferDataSource(const QUrl &src
Q_UNUSED(parent)
/*if (srcUrl.fileName().endsWith(".torrent"))
return new BTDataSource();*/
return 0;
return nullptr;
}
bool BTTransferFactory::isSupported(const QUrl &url) const
......
Markdown is supported
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