diff --git a/src/app/main.cpp b/src/app/main.cpp index 629560e71..96887b4b7 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -31,13 +31,13 @@ #include #include +#include #if !defined Q_OS_WIN && !defined Q_OS_HAIKU #include #endif #include -#include #include #ifndef DISABLE_GUI @@ -117,7 +117,7 @@ int main(int argc, char *argv[]) try { // Create Application const QString appId = QLatin1String("qBittorrent-") + Utils::Misc::getUserIDString(); - QScopedPointer app(new Application(appId, argc, argv)); + std::unique_ptr app(new Application(appId, argc, argv)); const QBtCommandLineParameters params = app->commandLineArgs(); diff --git a/src/base/profile.cpp b/src/base/profile.cpp index 2b272239b..6facc409e 100644 --- a/src/base/profile.cpp +++ b/src/base/profile.cpp @@ -29,8 +29,6 @@ #include "profile.h" -#include - #include "private/profile_p.h" Profile *Profile::m_instance = nullptr; @@ -50,14 +48,14 @@ Profile::~Profile() = default; void Profile::initialize(const QString &rootProfilePath, const QString &configurationName, bool convertPathsToProfileRelative) { - QScopedPointer profile(rootProfilePath.isEmpty() + std::unique_ptr profile(rootProfilePath.isEmpty() ? static_cast(new Private::DefaultProfile(configurationName)) : static_cast(new Private::CustomProfile(rootProfilePath, configurationName))); - QScopedPointer converter(convertPathsToProfileRelative + std::unique_ptr converter(convertPathsToProfileRelative ? static_cast(new Private::Converter(profile->baseDirectory())) : static_cast(new Private::NoConvertConverter())); - m_instance = new Profile(profile.take(), converter.take()); + m_instance = new Profile(profile.release(), converter.release()); } const Profile &Profile::instance() diff --git a/src/base/profile.h b/src/base/profile.h index 599a20427..34b627a10 100644 --- a/src/base/profile.h +++ b/src/base/profile.h @@ -32,7 +32,6 @@ #include -#include #include #include @@ -78,8 +77,8 @@ private: bool convertPathsToProfileRelative); void ensureDirectoryExists(SpecialFolder folder); - QScopedPointer m_profileImpl; - QScopedPointer m_pathConverterImpl; + const std::unique_ptr m_profileImpl; + const std::unique_ptr m_pathConverterImpl; static Profile *m_instance; }; diff --git a/src/base/rss/rss_feed.cpp b/src/base/rss/rss_feed.cpp index 21e7bba11..d2c785522 100644 --- a/src/base/rss/rss_feed.cpp +++ b/src/base/rss/rss_feed.cpp @@ -39,7 +39,6 @@ #include #include #include -#include #include #include "../asyncfilestorage.h" diff --git a/src/gui/addnewtorrentdialog.h b/src/gui/addnewtorrentdialog.h index a3e3f2197..dd9268f0b 100644 --- a/src/gui/addnewtorrentdialog.h +++ b/src/gui/addnewtorrentdialog.h @@ -29,8 +29,9 @@ #ifndef ADDNEWTORRENTDIALOG_H #define ADDNEWTORRENTDIALOG_H +#include + #include -#include #include #include "base/bittorrent/addtorrentparams.h" @@ -113,7 +114,7 @@ private: BitTorrent::TorrentInfo m_torrentInfo; QByteArray m_headerState; int m_oldIndex; - QScopedPointer m_torrentGuard; + std::unique_ptr m_torrentGuard; BitTorrent::AddTorrentParams m_torrentParams; }; diff --git a/src/gui/fspathedit.cpp b/src/gui/fspathedit.cpp index fcec70cfe..934deb247 100644 --- a/src/gui/fspathedit.cpp +++ b/src/gui/fspathedit.cpp @@ -28,6 +28,8 @@ #include "fspathedit.h" +#include + #include #include #include @@ -74,7 +76,7 @@ class FileSystemPathEdit::FileSystemPathEditPrivate QString dialogCaptionOrDefault() const; FileSystemPathEdit *q_ptr; - QScopedPointer m_editor; + std::unique_ptr 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 { diff --git a/src/gui/fspathedit.h b/src/gui/fspathedit.h index d7f075f4d..87359a9c3 100644 --- a/src/gui/fspathedit.h +++ b/src/gui/fspathedit.h @@ -105,7 +105,7 @@ private: Q_DISABLE_COPY(FileSystemPathEdit) class FileSystemPathEditPrivate; Q_DECLARE_PRIVATE(FileSystemPathEdit) - QScopedPointer const d_ptr; + FileSystemPathEditPrivate *d_ptr; }; /// Widget which uses QLineEdit for path editing