1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-02-08 21:04:26 +00:00

Merge pull request #10934 from Chocobo1/delete

Rely on Qt ownership to delete class members
This commit is contained in:
Mike Tzou 2019-07-17 12:02:30 +08:00 committed by GitHub
commit 1e70c52e7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 275 additions and 306 deletions

View File

@ -129,266 +129,263 @@ QString GeoIPManager::lookup(const QHostAddress &hostAddr) const
QString GeoIPManager::CountryName(const QString &countryISOCode) QString GeoIPManager::CountryName(const QString &countryISOCode)
{ {
static QHash<QString, QString> countries; static const QHash<QString, QString> countries = {
static bool initialized = false; // ISO 3166-1 alpha-2 codes
// http://www.iso.org/iso/home/standards/country_codes/country_names_and_code_elements_txt-temp.htm
// ISO 3166-1 alpha-2 codes
// http://www.iso.org/iso/home/standards/country_codes/country_names_and_code_elements_txt-temp.htm
if (!initialized) {
// Officially assigned // Officially assigned
countries["AD"] = tr("Andorra"); {"AD", tr("Andorra")},
countries["AE"] = tr("United Arab Emirates"); {"AE", tr("United Arab Emirates")},
countries["AF"] = tr("Afghanistan"); {"AF", tr("Afghanistan")},
countries["AG"] = tr("Antigua and Barbuda"); {"AG", tr("Antigua and Barbuda")},
countries["AI"] = tr("Anguilla"); {"AI", tr("Anguilla")},
countries["AL"] = tr("Albania"); {"AL", tr("Albania")},
countries["AM"] = tr("Armenia"); {"AM", tr("Armenia")},
countries["AO"] = tr("Angola"); {"AO", tr("Angola")},
countries["AQ"] = tr("Antarctica"); {"AQ", tr("Antarctica")},
countries["AR"] = tr("Argentina"); {"AR", tr("Argentina")},
countries["AS"] = tr("American Samoa"); {"AS", tr("American Samoa")},
countries["AT"] = tr("Austria"); {"AT", tr("Austria")},
countries["AU"] = tr("Australia"); {"AU", tr("Australia")},
countries["AW"] = tr("Aruba"); {"AW", tr("Aruba")},
countries["AX"] = tr("Aland Islands"); {"AX", tr("Aland Islands")},
countries["AZ"] = tr("Azerbaijan"); {"AZ", tr("Azerbaijan")},
countries["BA"] = tr("Bosnia and Herzegovina"); {"BA", tr("Bosnia and Herzegovina")},
countries["BB"] = tr("Barbados"); {"BB", tr("Barbados")},
countries["BD"] = tr("Bangladesh"); {"BD", tr("Bangladesh")},
countries["BE"] = tr("Belgium"); {"BE", tr("Belgium")},
countries["BF"] = tr("Burkina Faso"); {"BF", tr("Burkina Faso")},
countries["BG"] = tr("Bulgaria"); {"BG", tr("Bulgaria")},
countries["BH"] = tr("Bahrain"); {"BH", tr("Bahrain")},
countries["BI"] = tr("Burundi"); {"BI", tr("Burundi")},
countries["BJ"] = tr("Benin"); {"BJ", tr("Benin")},
countries["BL"] = tr("Saint Barthelemy"); {"BL", tr("Saint Barthelemy")},
countries["BM"] = tr("Bermuda"); {"BM", tr("Bermuda")},
countries["BN"] = tr("Brunei Darussalam"); {"BN", tr("Brunei Darussalam")},
countries["BO"] = tr("Bolivia, Plurinational State of"); {"BO", tr("Bolivia, Plurinational State of")},
countries["BQ"] = tr("Bonaire, Sint Eustatius and Saba"); {"BQ", tr("Bonaire, Sint Eustatius and Saba")},
countries["BR"] = tr("Brazil"); {"BR", tr("Brazil")},
countries["BS"] = tr("Bahamas"); {"BS", tr("Bahamas")},
countries["BT"] = tr("Bhutan"); {"BT", tr("Bhutan")},
countries["BV"] = tr("Bouvet Island"); {"BV", tr("Bouvet Island")},
countries["BW"] = tr("Botswana"); {"BW", tr("Botswana")},
countries["BY"] = tr("Belarus"); {"BY", tr("Belarus")},
countries["BZ"] = tr("Belize"); {"BZ", tr("Belize")},
countries["CA"] = tr("Canada"); {"CA", tr("Canada")},
countries["CC"] = tr("Cocos (Keeling) Islands"); {"CC", tr("Cocos (Keeling) Islands")},
countries["CD"] = tr("Congo, The Democratic Republic of the"); {"CD", tr("Congo, The Democratic Republic of the")},
countries["CF"] = tr("Central African Republic"); {"CF", tr("Central African Republic")},
countries["CG"] = tr("Congo"); {"CG", tr("Congo")},
countries["CH"] = tr("Switzerland"); {"CH", tr("Switzerland")},
countries["CI"] = tr("Cote d'Ivoire"); {"CI", tr("Cote d'Ivoire")},
countries["CK"] = tr("Cook Islands"); {"CK", tr("Cook Islands")},
countries["CL"] = tr("Chile"); {"CL", tr("Chile")},
countries["CM"] = tr("Cameroon"); {"CM", tr("Cameroon")},
countries["CN"] = tr("China"); {"CN", tr("China")},
countries["CO"] = tr("Colombia"); {"CO", tr("Colombia")},
countries["CR"] = tr("Costa Rica"); {"CR", tr("Costa Rica")},
countries["CU"] = tr("Cuba"); {"CU", tr("Cuba")},
countries["CV"] = tr("Cape Verde"); {"CV", tr("Cape Verde")},
countries["CW"] = tr("Curacao"); {"CW", tr("Curacao")},
countries["CX"] = tr("Christmas Island"); {"CX", tr("Christmas Island")},
countries["CY"] = tr("Cyprus"); {"CY", tr("Cyprus")},
countries["CZ"] = tr("Czech Republic"); {"CZ", tr("Czech Republic")},
countries["DE"] = tr("Germany"); {"DE", tr("Germany")},
countries["DJ"] = tr("Djibouti"); {"DJ", tr("Djibouti")},
countries["DK"] = tr("Denmark"); {"DK", tr("Denmark")},
countries["DM"] = tr("Dominica"); {"DM", tr("Dominica")},
countries["DO"] = tr("Dominican Republic"); {"DO", tr("Dominican Republic")},
countries["DZ"] = tr("Algeria"); {"DZ", tr("Algeria")},
countries["EC"] = tr("Ecuador"); {"EC", tr("Ecuador")},
countries["EE"] = tr("Estonia"); {"EE", tr("Estonia")},
countries["EG"] = tr("Egypt"); {"EG", tr("Egypt")},
countries["EH"] = tr("Western Sahara"); {"EH", tr("Western Sahara")},
countries["ER"] = tr("Eritrea"); {"ER", tr("Eritrea")},
countries["ES"] = tr("Spain"); {"ES", tr("Spain")},
countries["ET"] = tr("Ethiopia"); {"ET", tr("Ethiopia")},
countries["FI"] = tr("Finland"); {"FI", tr("Finland")},
countries["FJ"] = tr("Fiji"); {"FJ", tr("Fiji")},
countries["FK"] = tr("Falkland Islands (Malvinas)"); {"FK", tr("Falkland Islands (Malvinas)")},
countries["FM"] = tr("Micronesia, Federated States of"); {"FM", tr("Micronesia, Federated States of")},
countries["FO"] = tr("Faroe Islands"); {"FO", tr("Faroe Islands")},
countries["FR"] = tr("France"); {"FR", tr("France")},
countries["GA"] = tr("Gabon"); {"GA", tr("Gabon")},
countries["GB"] = tr("United Kingdom"); {"GB", tr("United Kingdom")},
countries["GD"] = tr("Grenada"); {"GD", tr("Grenada")},
countries["GE"] = tr("Georgia"); {"GE", tr("Georgia")},
countries["GF"] = tr("French Guiana"); {"GF", tr("French Guiana")},
countries["GG"] = tr("Guernsey"); {"GG", tr("Guernsey")},
countries["GH"] = tr("Ghana"); {"GH", tr("Ghana")},
countries["GI"] = tr("Gibraltar"); {"GI", tr("Gibraltar")},
countries["GL"] = tr("Greenland"); {"GL", tr("Greenland")},
countries["GM"] = tr("Gambia"); {"GM", tr("Gambia")},
countries["GN"] = tr("Guinea"); {"GN", tr("Guinea")},
countries["GP"] = tr("Guadeloupe"); {"GP", tr("Guadeloupe")},
countries["GQ"] = tr("Equatorial Guinea"); {"GQ", tr("Equatorial Guinea")},
countries["GR"] = tr("Greece"); {"GR", tr("Greece")},
countries["GS"] = tr("South Georgia and the South Sandwich Islands"); {"GS", tr("South Georgia and the South Sandwich Islands")},
countries["GT"] = tr("Guatemala"); {"GT", tr("Guatemala")},
countries["GU"] = tr("Guam"); {"GU", tr("Guam")},
countries["GW"] = tr("Guinea-Bissau"); {"GW", tr("Guinea-Bissau")},
countries["GY"] = tr("Guyana"); {"GY", tr("Guyana")},
countries["HK"] = tr("Hong Kong"); {"HK", tr("Hong Kong")},
countries["HM"] = tr("Heard Island and McDonald Islands"); {"HM", tr("Heard Island and McDonald Islands")},
countries["HN"] = tr("Honduras"); {"HN", tr("Honduras")},
countries["HR"] = tr("Croatia"); {"HR", tr("Croatia")},
countries["HT"] = tr("Haiti"); {"HT", tr("Haiti")},
countries["HU"] = tr("Hungary"); {"HU", tr("Hungary")},
countries["ID"] = tr("Indonesia"); {"ID", tr("Indonesia")},
countries["IE"] = tr("Ireland"); {"IE", tr("Ireland")},
countries["IL"] = tr("Israel"); {"IL", tr("Israel")},
countries["IM"] = tr("Isle of Man"); {"IM", tr("Isle of Man")},
countries["IN"] = tr("India"); {"IN", tr("India")},
countries["IO"] = tr("British Indian Ocean Territory"); {"IO", tr("British Indian Ocean Territory")},
countries["IQ"] = tr("Iraq"); {"IQ", tr("Iraq")},
countries["IR"] = tr("Iran, Islamic Republic of"); {"IR", tr("Iran, Islamic Republic of")},
countries["IS"] = tr("Iceland"); {"IS", tr("Iceland")},
countries["IT"] = tr("Italy"); {"IT", tr("Italy")},
countries["JE"] = tr("Jersey"); {"JE", tr("Jersey")},
countries["JM"] = tr("Jamaica"); {"JM", tr("Jamaica")},
countries["JO"] = tr("Jordan"); {"JO", tr("Jordan")},
countries["JP"] = tr("Japan"); {"JP", tr("Japan")},
countries["KE"] = tr("Kenya"); {"KE", tr("Kenya")},
countries["KG"] = tr("Kyrgyzstan"); {"KG", tr("Kyrgyzstan")},
countries["KH"] = tr("Cambodia"); {"KH", tr("Cambodia")},
countries["KI"] = tr("Kiribati"); {"KI", tr("Kiribati")},
countries["KM"] = tr("Comoros"); {"KM", tr("Comoros")},
countries["KN"] = tr("Saint Kitts and Nevis"); {"KN", tr("Saint Kitts and Nevis")},
countries["KP"] = tr("Korea, Democratic People's Republic of"); {"KP", tr("Korea, Democratic People's Republic of")},
countries["KR"] = tr("Korea, Republic of"); {"KR", tr("Korea, Republic of")},
countries["KW"] = tr("Kuwait"); {"KW", tr("Kuwait")},
countries["KY"] = tr("Cayman Islands"); {"KY", tr("Cayman Islands")},
countries["KZ"] = tr("Kazakhstan"); {"KZ", tr("Kazakhstan")},
countries["LA"] = tr("Lao People's Democratic Republic"); {"LA", tr("Lao People's Democratic Republic")},
countries["LB"] = tr("Lebanon"); {"LB", tr("Lebanon")},
countries["LC"] = tr("Saint Lucia"); {"LC", tr("Saint Lucia")},
countries["LI"] = tr("Liechtenstein"); {"LI", tr("Liechtenstein")},
countries["LK"] = tr("Sri Lanka"); {"LK", tr("Sri Lanka")},
countries["LR"] = tr("Liberia"); {"LR", tr("Liberia")},
countries["LS"] = tr("Lesotho"); {"LS", tr("Lesotho")},
countries["LT"] = tr("Lithuania"); {"LT", tr("Lithuania")},
countries["LU"] = tr("Luxembourg"); {"LU", tr("Luxembourg")},
countries["LV"] = tr("Latvia"); {"LV", tr("Latvia")},
countries["LY"] = tr("Libya"); {"LY", tr("Libya")},
countries["MA"] = tr("Morocco"); {"MA", tr("Morocco")},
countries["MC"] = tr("Monaco"); {"MC", tr("Monaco")},
countries["MD"] = tr("Moldova, Republic of"); {"MD", tr("Moldova, Republic of")},
countries["ME"] = tr("Montenegro"); {"ME", tr("Montenegro")},
countries["MF"] = tr("Saint Martin (French part)"); {"MF", tr("Saint Martin (French part)")},
countries["MG"] = tr("Madagascar"); {"MG", tr("Madagascar")},
countries["MH"] = tr("Marshall Islands"); {"MH", tr("Marshall Islands")},
countries["MK"] = tr("Macedonia, The Former Yugoslav Republic of"); {"MK", tr("Macedonia, The Former Yugoslav Republic of")},
countries["ML"] = tr("Mali"); {"ML", tr("Mali")},
countries["MM"] = tr("Myanmar"); {"MM", tr("Myanmar")},
countries["MN"] = tr("Mongolia"); {"MN", tr("Mongolia")},
countries["MO"] = tr("Macao"); {"MO", tr("Macao")},
countries["MP"] = tr("Northern Mariana Islands"); {"MP", tr("Northern Mariana Islands")},
countries["MQ"] = tr("Martinique"); {"MQ", tr("Martinique")},
countries["MR"] = tr("Mauritania"); {"MR", tr("Mauritania")},
countries["MS"] = tr("Montserrat"); {"MS", tr("Montserrat")},
countries["MT"] = tr("Malta"); {"MT", tr("Malta")},
countries["MU"] = tr("Mauritius"); {"MU", tr("Mauritius")},
countries["MV"] = tr("Maldives"); {"MV", tr("Maldives")},
countries["MW"] = tr("Malawi"); {"MW", tr("Malawi")},
countries["MX"] = tr("Mexico"); {"MX", tr("Mexico")},
countries["MY"] = tr("Malaysia"); {"MY", tr("Malaysia")},
countries["MZ"] = tr("Mozambique"); {"MZ", tr("Mozambique")},
countries["NA"] = tr("Namibia"); {"NA", tr("Namibia")},
countries["NC"] = tr("New Caledonia"); {"NC", tr("New Caledonia")},
countries["NE"] = tr("Niger"); {"NE", tr("Niger")},
countries["NF"] = tr("Norfolk Island"); {"NF", tr("Norfolk Island")},
countries["NG"] = tr("Nigeria"); {"NG", tr("Nigeria")},
countries["NI"] = tr("Nicaragua"); {"NI", tr("Nicaragua")},
countries["NL"] = tr("Netherlands"); {"NL", tr("Netherlands")},
countries["NO"] = tr("Norway"); {"NO", tr("Norway")},
countries["NP"] = tr("Nepal"); {"NP", tr("Nepal")},
countries["NR"] = tr("Nauru"); {"NR", tr("Nauru")},
countries["NU"] = tr("Niue"); {"NU", tr("Niue")},
countries["NZ"] = tr("New Zealand"); {"NZ", tr("New Zealand")},
countries["OM"] = tr("Oman"); {"OM", tr("Oman")},
countries["PA"] = tr("Panama"); {"PA", tr("Panama")},
countries["PE"] = tr("Peru"); {"PE", tr("Peru")},
countries["PF"] = tr("French Polynesia"); {"PF", tr("French Polynesia")},
countries["PG"] = tr("Papua New Guinea"); {"PG", tr("Papua New Guinea")},
countries["PH"] = tr("Philippines"); {"PH", tr("Philippines")},
countries["PK"] = tr("Pakistan"); {"PK", tr("Pakistan")},
countries["PL"] = tr("Poland"); {"PL", tr("Poland")},
countries["PM"] = tr("Saint Pierre and Miquelon"); {"PM", tr("Saint Pierre and Miquelon")},
countries["PN"] = tr("Pitcairn"); {"PN", tr("Pitcairn")},
countries["PR"] = tr("Puerto Rico"); {"PR", tr("Puerto Rico")},
countries["PS"] = tr("Palestine, State of"); {"PS", tr("Palestine, State of")},
countries["PT"] = tr("Portugal"); {"PT", tr("Portugal")},
countries["PW"] = tr("Palau"); {"PW", tr("Palau")},
countries["PY"] = tr("Paraguay"); {"PY", tr("Paraguay")},
countries["QA"] = tr("Qatar"); {"QA", tr("Qatar")},
countries["RE"] = tr("Reunion"); {"RE", tr("Reunion")},
countries["RO"] = tr("Romania"); {"RO", tr("Romania")},
countries["RS"] = tr("Serbia"); {"RS", tr("Serbia")},
countries["RU"] = tr("Russian Federation"); {"RU", tr("Russian Federation")},
countries["RW"] = tr("Rwanda"); {"RW", tr("Rwanda")},
countries["SA"] = tr("Saudi Arabia"); {"SA", tr("Saudi Arabia")},
countries["SB"] = tr("Solomon Islands"); {"SB", tr("Solomon Islands")},
countries["SC"] = tr("Seychelles"); {"SC", tr("Seychelles")},
countries["SD"] = tr("Sudan"); {"SD", tr("Sudan")},
countries["SE"] = tr("Sweden"); {"SE", tr("Sweden")},
countries["SG"] = tr("Singapore"); {"SG", tr("Singapore")},
countries["SH"] = tr("Saint Helena, Ascension and Tristan da Cunha"); {"SH", tr("Saint Helena, Ascension and Tristan da Cunha")},
countries["SI"] = tr("Slovenia"); {"SI", tr("Slovenia")},
countries["SJ"] = tr("Svalbard and Jan Mayen"); {"SJ", tr("Svalbard and Jan Mayen")},
countries["SK"] = tr("Slovakia"); {"SK", tr("Slovakia")},
countries["SL"] = tr("Sierra Leone"); {"SL", tr("Sierra Leone")},
countries["SM"] = tr("San Marino"); {"SM", tr("San Marino")},
countries["SN"] = tr("Senegal"); {"SN", tr("Senegal")},
countries["SO"] = tr("Somalia"); {"SO", tr("Somalia")},
countries["SR"] = tr("Suriname"); {"SR", tr("Suriname")},
countries["SS"] = tr("South Sudan"); {"SS", tr("South Sudan")},
countries["ST"] = tr("Sao Tome and Principe"); {"ST", tr("Sao Tome and Principe")},
countries["SV"] = tr("El Salvador"); {"SV", tr("El Salvador")},
countries["SX"] = tr("Sint Maarten (Dutch part)"); {"SX", tr("Sint Maarten (Dutch part)")},
countries["SY"] = tr("Syrian Arab Republic"); {"SY", tr("Syrian Arab Republic")},
countries["SZ"] = tr("Swaziland"); {"SZ", tr("Swaziland")},
countries["TC"] = tr("Turks and Caicos Islands"); {"TC", tr("Turks and Caicos Islands")},
countries["TD"] = tr("Chad"); {"TD", tr("Chad")},
countries["TF"] = tr("French Southern Territories"); {"TF", tr("French Southern Territories")},
countries["TG"] = tr("Togo"); {"TG", tr("Togo")},
countries["TH"] = tr("Thailand"); {"TH", tr("Thailand")},
countries["TJ"] = tr("Tajikistan"); {"TJ", tr("Tajikistan")},
countries["TK"] = tr("Tokelau"); {"TK", tr("Tokelau")},
countries["TL"] = tr("Timor-Leste"); {"TL", tr("Timor-Leste")},
countries["TM"] = tr("Turkmenistan"); {"TM", tr("Turkmenistan")},
countries["TN"] = tr("Tunisia"); {"TN", tr("Tunisia")},
countries["TO"] = tr("Tonga"); {"TO", tr("Tonga")},
countries["TR"] = tr("Turkey"); {"TR", tr("Turkey")},
countries["TT"] = tr("Trinidad and Tobago"); {"TT", tr("Trinidad and Tobago")},
countries["TV"] = tr("Tuvalu"); {"TV", tr("Tuvalu")},
countries["TW"] = tr("Taiwan"); {"TW", tr("Taiwan")},
countries["TZ"] = tr("Tanzania, United Republic of"); {"TZ", tr("Tanzania, United Republic of")},
countries["UA"] = tr("Ukraine"); {"UA", tr("Ukraine")},
countries["UG"] = tr("Uganda"); {"UG", tr("Uganda")},
countries["UM"] = tr("United States Minor Outlying Islands"); {"UM", tr("United States Minor Outlying Islands")},
countries["US"] = tr("United States"); {"US", tr("United States")},
countries["UY"] = tr("Uruguay"); {"UY", tr("Uruguay")},
countries["UZ"] = tr("Uzbekistan"); {"UZ", tr("Uzbekistan")},
countries["VA"] = tr("Holy See (Vatican City State)"); {"VA", tr("Holy See (Vatican City State)")},
countries["VC"] = tr("Saint Vincent and the Grenadines"); {"VC", tr("Saint Vincent and the Grenadines")},
countries["VE"] = tr("Venezuela, Bolivarian Republic of"); {"VE", tr("Venezuela, Bolivarian Republic of")},
countries["VG"] = tr("Virgin Islands, British"); {"VG", tr("Virgin Islands, British")},
countries["VI"] = tr("Virgin Islands, U.S."); {"VI", tr("Virgin Islands, U.S.")},
countries["VN"] = tr("Viet Nam"); {"VN", tr("Viet Nam")},
countries["VU"] = tr("Vanuatu"); {"VU", tr("Vanuatu")},
countries["WF"] = tr("Wallis and Futuna"); {"WF", tr("Wallis and Futuna")},
countries["WS"] = tr("Samoa"); {"WS", tr("Samoa")},
countries["YE"] = tr("Yemen"); {"YE", tr("Yemen")},
countries["YT"] = tr("Mayotte"); {"YT", tr("Mayotte")},
countries["ZA"] = tr("South Africa"); {"ZA", tr("South Africa")},
countries["ZM"] = tr("Zambia"); {"ZM", tr("Zambia")},
countries["ZW"] = tr("Zimbabwe"); {"ZW", tr("Zimbabwe")},
countries[QString()] = tr("N/A"); {{}, tr("N/A")}
initialized = true; };
}
return countries.value(countryISOCode, tr("N/A")); return countries.value(countryISOCode, tr("N/A"));
} }

View File

@ -36,9 +36,12 @@ const int CACHE_SIZE = 500;
using namespace Net; using namespace Net;
static inline bool isUsefulHostName(const QString &hostname, const QString &ip) namespace
{ {
return (!hostname.isEmpty() && (hostname != ip)); bool isUsefulHostName(const QString &hostname, const QString &ip)
{
return (!hostname.isEmpty() && (hostname != ip));
}
} }
ReverseResolution::ReverseResolution(QObject *parent) ReverseResolution::ReverseResolution(QObject *parent)

View File

@ -112,3 +112,8 @@ QString Profile::fromPortablePath(const QString &portablePath) const
{ {
return m_pathConverterImpl->fromPortablePath(portablePath); return m_pathConverterImpl->fromPortablePath(portablePath);
} }
QString specialFolderLocation(const SpecialFolder folder)
{
return Profile::instance().location(folder);
}

View File

@ -83,9 +83,6 @@ private:
static Profile *m_instance; static Profile *m_instance;
}; };
inline QString specialFolderLocation(SpecialFolder folder) QString specialFolderLocation(SpecialFolder folder);
{
return Profile::instance().location(folder);
}
#endif // QBT_PROFILE_H #endif // QBT_PROFILE_H

View File

@ -61,7 +61,7 @@ PreviewSelectDialog::PreviewSelectDialog(QWidget *parent, BitTorrent::TorrentHan
Preferences *const pref = Preferences::instance(); Preferences *const pref = Preferences::instance();
// Preview list // Preview list
m_previewListModel = new QStandardItemModel(0, NB_COLUMNS); m_previewListModel = new QStandardItemModel(0, NB_COLUMNS, this);
m_previewListModel->setHeaderData(NAME, Qt::Horizontal, tr("Name")); m_previewListModel->setHeaderData(NAME, Qt::Horizontal, tr("Name"));
m_previewListModel->setHeaderData(SIZE, Qt::Horizontal, tr("Size")); m_previewListModel->setHeaderData(SIZE, Qt::Horizontal, tr("Size"));
m_previewListModel->setHeaderData(PROGRESS, Qt::Horizontal, tr("Progress")); m_previewListModel->setHeaderData(PROGRESS, Qt::Horizontal, tr("Progress"));
@ -118,8 +118,6 @@ PreviewSelectDialog::~PreviewSelectDialog()
{ {
saveWindowState(); saveWindowState();
delete m_previewListModel;
delete m_listDelegate;
delete m_ui; delete m_ui;
} }

View File

@ -82,7 +82,7 @@ PropertiesWidget::PropertiesWidget(QWidget *parent)
m_state = VISIBLE; m_state = VISIBLE;
// Set Properties list model // Set Properties list model
m_propListModel = new TorrentContentFilterModel(); m_propListModel = new TorrentContentFilterModel(this);
m_ui->filesList->setModel(m_propListModel); m_ui->filesList->setModel(m_propListModel);
m_propListDelegate = new PropListDelegate(this); m_propListDelegate = new PropListDelegate(this);
m_ui->filesList->setItemDelegate(m_propListDelegate); m_ui->filesList->setItemDelegate(m_propListDelegate);
@ -142,7 +142,7 @@ PropertiesWidget::PropertiesWidget(QWidget *parent)
m_peerList = new PeerListWidget(this); m_peerList = new PeerListWidget(this);
m_ui->vBoxLayoutPeerPage->addWidget(m_peerList); m_ui->vBoxLayoutPeerPage->addWidget(m_peerList);
// Tab bar // Tab bar
m_tabBar = new PropTabBar(); m_tabBar = new PropTabBar(nullptr);
m_tabBar->setContentsMargins(0, 5, 0, 0); m_tabBar->setContentsMargins(0, 5, 0, 0);
m_ui->verticalLayout->addLayout(m_tabBar); m_ui->verticalLayout->addLayout(m_tabBar);
connect(m_tabBar, &PropTabBar::tabChanged, m_ui->stackedProperties, &QStackedWidget::setCurrentIndex); connect(m_tabBar, &PropTabBar::tabChanged, m_ui->stackedProperties, &QStackedWidget::setCurrentIndex);
@ -168,17 +168,8 @@ PropertiesWidget::PropertiesWidget(QWidget *parent)
PropertiesWidget::~PropertiesWidget() PropertiesWidget::~PropertiesWidget()
{ {
qDebug() << Q_FUNC_INFO << "ENTER";
delete m_trackerList;
delete m_peerList;
delete m_speedWidget;
delete m_downloadedPieces;
delete m_piecesAvailability;
delete m_propListModel;
delete m_propListDelegate;
delete m_tabBar; delete m_tabBar;
delete m_ui; delete m_ui;
qDebug() << Q_FUNC_INFO << "EXIT";
} }
void PropertiesWidget::showPiecesAvailability(bool show) void PropertiesWidget::showPiecesAvailability(bool show)

View File

@ -107,11 +107,6 @@ PropTabBar::PropTabBar(QWidget *parent)
btn->setFocusPolicy(Qt::NoFocus); btn->setFocusPolicy(Qt::NoFocus);
} }
PropTabBar::~PropTabBar()
{
delete m_btnGroup;
}
int PropTabBar::currentIndex() const int PropTabBar::currentIndex() const
{ {
return m_currentIndex; return m_currentIndex;

View File

@ -50,7 +50,7 @@ public:
}; };
explicit PropTabBar(QWidget *parent = nullptr); explicit PropTabBar(QWidget *parent = nullptr);
~PropTabBar();
int currentIndex() const; int currentIndex() const;
signals: signals:

View File

@ -71,11 +71,6 @@ FeedListWidget::FeedListWidget(QWidget *parent)
// setCurrentItem(m_unreadStickyItem); // setCurrentItem(m_unreadStickyItem);
} }
FeedListWidget::~FeedListWidget()
{
delete m_unreadStickyItem;
}
void FeedListWidget::handleItemAdded(RSS::Item *rssItem) void FeedListWidget::handleItemAdded(RSS::Item *rssItem)
{ {
auto parentItem = m_rssToTreeItemMapping.value( auto parentItem = m_rssToTreeItemMapping.value(

View File

@ -47,7 +47,6 @@ class FeedListWidget : public QTreeWidget
public: public:
explicit FeedListWidget(QWidget *parent); explicit FeedListWidget(QWidget *parent);
~FeedListWidget();
QTreeWidgetItem *stickyUnreadItem() const; QTreeWidgetItem *stickyUnreadItem() const;
QList<QTreeWidgetItem *> getAllOpenedFolders(QTreeWidgetItem *parent = nullptr) const; QList<QTreeWidgetItem *> getAllOpenedFolders(QTreeWidgetItem *parent = nullptr) const;

View File

@ -44,11 +44,6 @@ TorrentContentFilterModel::TorrentContentFilterModel(QObject *parent)
setSortCaseSensitivity(Qt::CaseInsensitive); setSortCaseSensitivity(Qt::CaseInsensitive);
} }
TorrentContentFilterModel::~TorrentContentFilterModel()
{
delete m_model;
}
TorrentContentModel *TorrentContentFilterModel::model() const TorrentContentModel *TorrentContentFilterModel::model() const
{ {
return m_model; return m_model;

View File

@ -41,7 +41,6 @@ class TorrentContentFilterModel : public QSortFilterProxyModel
public: public:
TorrentContentFilterModel(QObject *parent = nullptr); TorrentContentFilterModel(QObject *parent = nullptr);
~TorrentContentFilterModel() override;
TorrentContentModel *model() const; TorrentContentModel *model() const;
TorrentContentModelItem::ItemType itemType(const QModelIndex &index) const; TorrentContentModelItem::ItemType itemType(const QModelIndex &index) const;
@ -60,8 +59,9 @@ protected:
bool lessThan(const QModelIndex &left, const QModelIndex &right) const override; bool lessThan(const QModelIndex &left, const QModelIndex &right) const override;
private: private:
TorrentContentModel *m_model;
bool hasFiltered(const QModelIndex &folder) const; bool hasFiltered(const QModelIndex &folder) const;
TorrentContentModel *m_model;
}; };
#endif // TORRENTCONTENTFILTERMODEL_H #endif // TORRENTCONTENTFILTERMODEL_H

View File

@ -114,7 +114,7 @@ TransferListWidget::TransferListWidget(QWidget *parent, MainWindow *mainWindow)
// Create transfer list model // Create transfer list model
m_listModel = new TransferListModel(this); m_listModel = new TransferListModel(this);
m_sortFilterModel = new TransferListSortModel(); m_sortFilterModel = new TransferListSortModel(this);
m_sortFilterModel->setDynamicSortFilter(true); m_sortFilterModel->setDynamicSortFilter(true);
m_sortFilterModel->setSourceModel(m_listModel); m_sortFilterModel->setSourceModel(m_listModel);
m_sortFilterModel->setFilterKeyColumn(TransferListModel::TR_NAME); m_sortFilterModel->setFilterKeyColumn(TransferListModel::TR_NAME);
@ -207,14 +207,8 @@ TransferListWidget::TransferListWidget(QWidget *parent, MainWindow *mainWindow)
TransferListWidget::~TransferListWidget() TransferListWidget::~TransferListWidget()
{ {
qDebug() << Q_FUNC_INFO << "ENTER";
// Save settings // Save settings
saveSettings(); saveSettings();
// Clean up
delete m_sortFilterModel;
delete m_listModel;
delete m_listDelegate;
qDebug() << Q_FUNC_INFO << "EXIT";
} }
TransferListModel *TransferListWidget::getSourceModel() const TransferListModel *TransferListWidget::getSourceModel() const
@ -227,7 +221,7 @@ void TransferListWidget::previewFile(const QString &filePath)
Utils::Gui::openPath(filePath); Utils::Gui::openPath(filePath);
} }
inline QModelIndex TransferListWidget::mapToSource(const QModelIndex &index) const QModelIndex TransferListWidget::mapToSource(const QModelIndex &index) const
{ {
Q_ASSERT(index.isValid()); Q_ASSERT(index.isValid());
if (index.model() == m_sortFilterModel) if (index.model() == m_sortFilterModel)
@ -235,7 +229,7 @@ inline QModelIndex TransferListWidget::mapToSource(const QModelIndex &index) con
return index; return index;
} }
inline QModelIndex TransferListWidget::mapFromSource(const QModelIndex &index) const QModelIndex TransferListWidget::mapFromSource(const QModelIndex &index) const
{ {
Q_ASSERT(index.isValid()); Q_ASSERT(index.isValid());
Q_ASSERT(index.model() == m_sortFilterModel); Q_ASSERT(index.model() == m_sortFilterModel);

View File

@ -88,7 +88,7 @@ namespace
return ret; return ret;
} }
inline QUrl urlFromHostHeader(const QString &hostHeader) QUrl urlFromHostHeader(const QString &hostHeader)
{ {
if (!hostHeader.contains(QLatin1String("://"))) if (!hostHeader.contains(QLatin1String("://")))
return {QLatin1String("http://") + hostHeader}; return {QLatin1String("http://") + hostHeader};