mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-19 21:03:30 -07:00
Coding style of whole trackerlist.h and a little in trackerlist.cpp
This commit is contained in:
parent
692e4a986a
commit
ce77ebdfe1
2 changed files with 75 additions and 58 deletions
|
@ -30,31 +30,34 @@
|
|||
|
||||
#include "trackerlist.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QTreeWidgetItem>
|
||||
#include <QStringList>
|
||||
#include <QMenu>
|
||||
#include <QHash>
|
||||
#include <QAction>
|
||||
#include <QApplication>
|
||||
#include <QColor>
|
||||
#include <QDebug>
|
||||
#include <QUrl>
|
||||
#include <QMessageBox>
|
||||
#include <QTableView>
|
||||
#include <QHash>
|
||||
#include <QHeaderView>
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
#include <QStringList>
|
||||
#include <QTableView>
|
||||
#include <QTreeWidgetItem>
|
||||
#include <QUrl>
|
||||
|
||||
#include "base/bittorrent/peerinfo.h"
|
||||
#include "base/bittorrent/session.h"
|
||||
#include "base/bittorrent/torrenthandle.h"
|
||||
#include "base/bittorrent/peerinfo.h"
|
||||
#include "base/bittorrent/trackerentry.h"
|
||||
#include "base/preferences.h"
|
||||
#include "base/utils/misc.h"
|
||||
#include "autoexpandabledialog.h"
|
||||
#include "guiiconprovider.h"
|
||||
#include "propertieswidget.h"
|
||||
#include "trackersadditiondlg.h"
|
||||
#include "guiiconprovider.h"
|
||||
#include "autoexpandabledialog.h"
|
||||
|
||||
TrackerList::TrackerList(PropertiesWidget *properties): QTreeWidget(), properties(properties) {
|
||||
TrackerList::TrackerList(PropertiesWidget *properties)
|
||||
: QTreeWidget()
|
||||
, properties(properties)
|
||||
{
|
||||
// Graphical settings
|
||||
setRootIsDecorated(false);
|
||||
setAllColumnsShowFocus(true);
|
||||
|
@ -98,7 +101,8 @@ TrackerList::TrackerList(PropertiesWidget *properties): QTreeWidget(), propertie
|
|||
loadSettings();
|
||||
}
|
||||
|
||||
TrackerList::~TrackerList() {
|
||||
TrackerList::~TrackerList()
|
||||
{
|
||||
delete editHotkey;
|
||||
delete deleteHotkey;
|
||||
delete copyHotkey;
|
||||
|
@ -524,13 +528,15 @@ void TrackerList::showTrackerListMenu(QPoint) {
|
|||
}
|
||||
}
|
||||
|
||||
void TrackerList::loadSettings() {
|
||||
void TrackerList::loadSettings()
|
||||
{
|
||||
if (!header()->restoreState(Preferences::instance()->getPropTrackerListState())) {
|
||||
setColumnWidth(0, 30);
|
||||
setColumnWidth(1, 300);
|
||||
}
|
||||
}
|
||||
|
||||
void TrackerList::saveSettings() const {
|
||||
void TrackerList::saveSettings() const
|
||||
{
|
||||
Preferences::instance()->setPropTrackerListState(header()->saveState());
|
||||
}
|
||||
|
|
|
@ -31,14 +31,13 @@
|
|||
#ifndef TRACKERLIST_H
|
||||
#define TRACKERLIST_H
|
||||
|
||||
#include <QClipboard>
|
||||
#include <QList>
|
||||
#include <QShortcut>
|
||||
#include <QTreeWidget>
|
||||
#include <QList>
|
||||
#include <QClipboard>
|
||||
|
||||
#include "propertieswidget.h"
|
||||
|
||||
enum TrackerListColumn {COL_TIER, COL_URL, COL_STATUS, COL_RECEIVED, COL_SEEDS, COL_PEERS, COL_DOWNLOADED, COL_MSG};
|
||||
#define NB_STICKY_ITEM 3
|
||||
|
||||
namespace BitTorrent
|
||||
|
@ -46,27 +45,27 @@ namespace BitTorrent
|
|||
class TorrentHandle;
|
||||
}
|
||||
|
||||
class TrackerList: public QTreeWidget {
|
||||
class TrackerList: public QTreeWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(TrackerList)
|
||||
|
||||
private:
|
||||
PropertiesWidget *properties;
|
||||
QHash<QString, QTreeWidgetItem*> tracker_items;
|
||||
QTreeWidgetItem* dht_item;
|
||||
QTreeWidgetItem* pex_item;
|
||||
QTreeWidgetItem* lsd_item;
|
||||
QShortcut *editHotkey;
|
||||
QShortcut *deleteHotkey;
|
||||
QShortcut *copyHotkey;
|
||||
|
||||
public:
|
||||
enum TrackerListColumn
|
||||
{
|
||||
COL_TIER,
|
||||
COL_URL,
|
||||
COL_STATUS,
|
||||
COL_RECEIVED,
|
||||
COL_SEEDS,
|
||||
COL_PEERS,
|
||||
COL_DOWNLOADED,
|
||||
COL_MSG
|
||||
};
|
||||
|
||||
TrackerList(PropertiesWidget *properties);
|
||||
~TrackerList();
|
||||
|
||||
protected:
|
||||
QList<QTreeWidgetItem*> getSelectedTrackerItems() const;
|
||||
|
||||
public slots:
|
||||
void setRowColor(int row, QColor color);
|
||||
|
||||
|
@ -85,6 +84,18 @@ public slots:
|
|||
void loadSettings();
|
||||
void saveSettings() const;
|
||||
|
||||
protected:
|
||||
QList<QTreeWidgetItem *> getSelectedTrackerItems() const;
|
||||
|
||||
private:
|
||||
PropertiesWidget *properties;
|
||||
QHash<QString, QTreeWidgetItem *> tracker_items;
|
||||
QTreeWidgetItem *dht_item;
|
||||
QTreeWidgetItem *pex_item;
|
||||
QTreeWidgetItem *lsd_item;
|
||||
QShortcut *editHotkey;
|
||||
QShortcut *deleteHotkey;
|
||||
QShortcut *copyHotkey;
|
||||
};
|
||||
|
||||
#endif // TRACKERLIST_H
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue