mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-22 08:27:24 -06:00
Replace QScopedPointer with std::unqiue_ptr
These 2 types are very similar and we should prefer the one from C++ standard library, this reduces the number of types in our code base. Also see: https://stackoverflow.com/questions/40346393/should-i-use-qscopedpointer-or-stdunique-ptr#comment67966940_40346991
This commit is contained in:
@@ -29,8 +29,9 @@
|
||||
#ifndef ADDNEWTORRENTDIALOG_H
|
||||
#define ADDNEWTORRENTDIALOG_H
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <QDialog>
|
||||
#include <QScopedPointer>
|
||||
#include <QShortcut>
|
||||
|
||||
#include "base/bittorrent/addtorrentparams.h"
|
||||
@@ -113,7 +114,7 @@ private:
|
||||
BitTorrent::TorrentInfo m_torrentInfo;
|
||||
QByteArray m_headerState;
|
||||
int m_oldIndex;
|
||||
QScopedPointer<TorrentFileGuard> m_torrentGuard;
|
||||
std::unique_ptr<TorrentFileGuard> m_torrentGuard;
|
||||
BitTorrent::AddTorrentParams m_torrentParams;
|
||||
};
|
||||
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
|
||||
#include "fspathedit.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <QAction>
|
||||
#include <QApplication>
|
||||
#include <QCoreApplication>
|
||||
@@ -74,7 +76,7 @@ class FileSystemPathEdit::FileSystemPathEditPrivate
|
||||
QString dialogCaptionOrDefault() const;
|
||||
|
||||
FileSystemPathEdit *q_ptr;
|
||||
QScopedPointer<Private::FileEditorWithCompletion> m_editor;
|
||||
std::unique_ptr<Private::FileEditorWithCompletion> m_editor;
|
||||
QAction *m_browseAction;
|
||||
QToolButton *m_browseBtn;
|
||||
QString m_fileNameFilter;
|
||||
@@ -192,7 +194,10 @@ FileSystemPathEdit::FileSystemPathEdit(Private::FileEditorWithCompletion *editor
|
||||
connect(d->m_browseAction, &QAction::triggered, this, [this]() { this->d_func()->browseActionTriggered(); });
|
||||
}
|
||||
|
||||
FileSystemPathEdit::~FileSystemPathEdit() = default;
|
||||
FileSystemPathEdit::~FileSystemPathEdit()
|
||||
{
|
||||
delete d_ptr;
|
||||
}
|
||||
|
||||
QString FileSystemPathEdit::selectedPath() const
|
||||
{
|
||||
|
||||
@@ -105,7 +105,7 @@ private:
|
||||
Q_DISABLE_COPY(FileSystemPathEdit)
|
||||
class FileSystemPathEditPrivate;
|
||||
Q_DECLARE_PRIVATE(FileSystemPathEdit)
|
||||
QScopedPointer<FileSystemPathEditPrivate> const d_ptr;
|
||||
FileSystemPathEditPrivate *d_ptr;
|
||||
};
|
||||
|
||||
/// Widget which uses QLineEdit for path editing
|
||||
|
||||
Reference in New Issue
Block a user