mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-06 15:42:32 -06:00
Coding style, use nullptr and other minor things
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Bittorrent Client using Qt4 and libtorrent.
|
||||
* Copyright (C) 2006 Christophe Dumez
|
||||
* Bittorrent Client using Qt and libtorrent.
|
||||
* Copyright (C) 2006 Christophe Dumez <chris@qbittorrent.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -24,8 +24,6 @@
|
||||
* modify file(s), you may extend this exception to your version of the file(s),
|
||||
* but you are not obligated to do so. If you do not wish to do so, delete this
|
||||
* exception statement from your version.
|
||||
*
|
||||
* Contact : chris@qbittorrent.org
|
||||
*/
|
||||
|
||||
#ifndef PEERLISTDELEGATE_H
|
||||
@@ -38,7 +36,7 @@
|
||||
#include "base/utils/misc.h"
|
||||
#include "base/utils/string.h"
|
||||
|
||||
class PeerListDelegate: public QItemDelegate
|
||||
class PeerListDelegate : public QItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -77,34 +75,33 @@ public:
|
||||
QItemDelegate::drawBackground(painter, opt, index);
|
||||
|
||||
switch (index.column()) {
|
||||
case PORT: {
|
||||
case PORT:
|
||||
opt.displayAlignment = Qt::AlignRight | Qt::AlignVCenter;
|
||||
QItemDelegate::drawDisplay(painter, opt, option.rect, index.data().toString());
|
||||
}
|
||||
break;
|
||||
case TOT_DOWN:
|
||||
case TOT_UP: {
|
||||
qlonglong size = index.data().toLongLong();
|
||||
if (hideValues && (size <= 0))
|
||||
break;
|
||||
opt.displayAlignment = Qt::AlignRight | Qt::AlignVCenter;
|
||||
QItemDelegate::drawDisplay(painter, opt, option.rect, Utils::Misc::friendlyUnit(size));
|
||||
qlonglong size = index.data().toLongLong();
|
||||
if (hideValues && (size <= 0))
|
||||
break;
|
||||
opt.displayAlignment = Qt::AlignRight | Qt::AlignVCenter;
|
||||
QItemDelegate::drawDisplay(painter, opt, option.rect, Utils::Misc::friendlyUnit(size));
|
||||
}
|
||||
break;
|
||||
case DOWN_SPEED:
|
||||
case UP_SPEED: {
|
||||
qreal speed = index.data().toDouble();
|
||||
if (speed <= 0.0)
|
||||
break;
|
||||
opt.displayAlignment = Qt::AlignRight | Qt::AlignVCenter;
|
||||
QItemDelegate::drawDisplay(painter, opt, opt.rect, Utils::Misc::friendlyUnit(speed, true));
|
||||
qreal speed = index.data().toDouble();
|
||||
if (speed <= 0.0)
|
||||
break;
|
||||
opt.displayAlignment = Qt::AlignRight | Qt::AlignVCenter;
|
||||
QItemDelegate::drawDisplay(painter, opt, opt.rect, Utils::Misc::friendlyUnit(speed, true));
|
||||
}
|
||||
break;
|
||||
case PROGRESS:
|
||||
case RELEVANCE: {
|
||||
qreal progress = index.data().toDouble();
|
||||
opt.displayAlignment = Qt::AlignRight | Qt::AlignVCenter;
|
||||
QItemDelegate::drawDisplay(painter, opt, opt.rect, Utils::String::fromDouble(progress * 100.0, 1) + "%");
|
||||
qreal progress = index.data().toDouble();
|
||||
opt.displayAlignment = Qt::AlignRight | Qt::AlignVCenter;
|
||||
QItemDelegate::drawDisplay(painter, opt, opt.rect, Utils::String::fromDouble(progress * 100.0, 1) + "%");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -34,12 +34,12 @@
|
||||
|
||||
#include "peerlistdelegate.h"
|
||||
|
||||
class PeerListSortModel: public QSortFilterProxyModel
|
||||
class PeerListSortModel : public QSortFilterProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PeerListSortModel(QObject *parent = 0)
|
||||
PeerListSortModel(QObject *parent = nullptr)
|
||||
: QSortFilterProxyModel(parent)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Bittorrent Client using Qt4 and libtorrent.
|
||||
* Copyright (C) 2006 Christophe Dumez
|
||||
* Bittorrent Client using Qt and libtorrent.
|
||||
* Copyright (C) 2006 Christophe Dumez <chris@qbittorrent.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -24,36 +24,34 @@
|
||||
* modify file(s), you may extend this exception to your version of the file(s),
|
||||
* but you are not obligated to do so. If you do not wish to do so, delete this
|
||||
* exception statement from your version.
|
||||
*
|
||||
* Contact : chris@qbittorrent.org
|
||||
*/
|
||||
|
||||
#include "peerlistwidget.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QStandardItemModel>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QSet>
|
||||
#include <QClipboard>
|
||||
#include <QHeaderView>
|
||||
#include <QMenu>
|
||||
#include <QClipboard>
|
||||
#include <QMessageBox>
|
||||
#include <QWheelEvent>
|
||||
#include <QSet>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QStandardItemModel>
|
||||
#include <QTableView>
|
||||
#include <QWheelEvent>
|
||||
|
||||
#include "base/net/reverseresolution.h"
|
||||
#include "base/bittorrent/torrenthandle.h"
|
||||
#include "base/bittorrent/peerinfo.h"
|
||||
#include "base/preferences.h"
|
||||
#include "base/bittorrent/torrenthandle.h"
|
||||
#include "base/logger.h"
|
||||
#include "base/unicodestrings.h"
|
||||
#include "propertieswidget.h"
|
||||
#include "base/net/geoipmanager.h"
|
||||
#include "peersadditiondlg.h"
|
||||
#include "speedlimitdlg.h"
|
||||
#include "base/net/reverseresolution.h"
|
||||
#include "base/preferences.h"
|
||||
#include "base/unicodestrings.h"
|
||||
#include "guiiconprovider.h"
|
||||
#include "peerlistdelegate.h"
|
||||
#include "peerlistsortmodel.h"
|
||||
#include "peersadditiondlg.h"
|
||||
#include "propertieswidget.h"
|
||||
#include "speedlimitdlg.h"
|
||||
|
||||
PeerListWidget::PeerListWidget(PropertiesWidget *parent)
|
||||
: QTreeView(parent)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Bittorrent Client using Qt4 and libtorrent.
|
||||
* Copyright (C) 2006 Christophe Dumez
|
||||
* Bittorrent Client using Qt and libtorrent.
|
||||
* Copyright (C) 2006 Christophe Dumez <chris@qbittorrent.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -24,18 +24,16 @@
|
||||
* modify file(s), you may extend this exception to your version of the file(s),
|
||||
* but you are not obligated to do so. If you do not wish to do so, delete this
|
||||
* exception statement from your version.
|
||||
*
|
||||
* Contact : chris@qbittorrent.org
|
||||
*/
|
||||
|
||||
#ifndef PEERLISTWIDGET_H
|
||||
#define PEERLISTWIDGET_H
|
||||
|
||||
#include <QTreeView>
|
||||
#include <QHash>
|
||||
#include <QPointer>
|
||||
#include <QSet>
|
||||
#include <QShortcut>
|
||||
#include <QTreeView>
|
||||
|
||||
namespace Net
|
||||
{
|
||||
@@ -46,11 +44,9 @@ class PeerListDelegate;
|
||||
class PeerListSortModel;
|
||||
class PropertiesWidget;
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QSortFilterProxyModel;
|
||||
class QStandardItem;
|
||||
class QStandardItemModel;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace BitTorrent
|
||||
{
|
||||
@@ -59,7 +55,7 @@ namespace BitTorrent
|
||||
struct PeerAddress;
|
||||
}
|
||||
|
||||
class PeerListWidget: public QTreeView
|
||||
class PeerListWidget : public QTreeView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
@@ -35,9 +35,10 @@
|
||||
|
||||
#include <QGraphicsView>
|
||||
#include <QMap>
|
||||
|
||||
class QPen;
|
||||
|
||||
class SpeedPlotView: public QGraphicsView
|
||||
class SpeedPlotView : public QGraphicsView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -71,7 +72,7 @@ public:
|
||||
int y[NB_GRAPHS];
|
||||
};
|
||||
|
||||
explicit SpeedPlotView(QWidget *parent = 0);
|
||||
explicit SpeedPlotView(QWidget *parent = nullptr);
|
||||
|
||||
void setGraphEnable(GraphID id, bool enable);
|
||||
void setViewableLastPoints(TimePeriod period);
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace BitTorrent
|
||||
class TorrentHandle;
|
||||
}
|
||||
|
||||
class TrackerList: public QTreeWidget
|
||||
class TrackerList : public QTreeWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(TrackerList)
|
||||
|
||||
Reference in New Issue
Block a user