diff --git a/src/command_local.cc b/src/command_local.cc index 74f05eae..c2bba678 100644 --- a/src/command_local.cc +++ b/src/command_local.cc @@ -8,7 +8,6 @@ #include #include #include -#include #include #include #include diff --git a/src/ui/download.cc b/src/ui/download.cc index c17479d0..9f8de921 100644 --- a/src/ui/download.cc +++ b/src/ui/download.cc @@ -3,7 +3,6 @@ #include #include -#include #include #include #include @@ -31,10 +30,10 @@ namespace ui { -Download::Download(core::Download* d) : - m_download(d) { +Download::Download(core::Download* d) + : m_download(d) { - m_windowDownloadStatus = new WDownloadStatus(d); + m_windowDownloadStatus = std::make_unique(d); m_windowDownloadStatus->set_bottom(true); m_uiArray[DISPLAY_MENU] = create_menu(); @@ -60,8 +59,6 @@ Download::~Download() { assert(!is_active() && "ui::Download::~Download() called on an active object."); std::for_each(m_uiArray, m_uiArray + DISPLAY_MAX_SIZE, [](ElementBase* eb) { delete eb; }); - - delete m_windowDownloadStatus; } inline ElementBase* @@ -171,7 +168,7 @@ Download::activate(display::Frame* frame, [[maybe_unused]] bool focus) { m_frame = frame; m_frame->initialize_row(2); - m_frame->frame(1)->initialize_window(m_windowDownloadStatus); + m_frame->frame(1)->initialize_window(m_windowDownloadStatus.get()); m_windowDownloadStatus->set_active(true); activate_display_menu(DISPLAY_PEER_LIST); diff --git a/src/ui/download.h b/src/ui/download.h index 25c41777..2654a410 100644 --- a/src/ui/download.h +++ b/src/ui/download.h @@ -1,37 +1,3 @@ -// rTorrent - BitTorrent client -// Copyright (C) 2005-2011, Jari Sundell -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// In addition, as a special exception, the copyright holders give -// permission to link the code of portions of this program with the -// OpenSSL library under certain conditions as described in each -// individual source file, and distribute linked combinations -// including the two. -// -// You must obey the GNU General Public License in all respects for -// all of the code used other than OpenSSL. If you modify file(s) -// with this exception, 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. -// If you delete this exception statement from all source files in the -// program, then also delete it here. -// -// Contact: Jari Sundell - - #ifndef RTORRENT_UI_DOWNLOAD_H #define RTORRENT_UI_DOWNLOAD_H @@ -113,7 +79,7 @@ private: bool m_focusDisplay{}; - WDownloadStatus* m_windowDownloadStatus; + std::unique_ptr m_windowDownloadStatus; }; } diff --git a/src/ui/element_log_complete.h b/src/ui/element_log_complete.h index 47b75256..316e2368 100644 --- a/src/ui/element_log_complete.h +++ b/src/ui/element_log_complete.h @@ -15,13 +15,13 @@ namespace ui { class ElementLogComplete : public ElementBase { public: - typedef display::WindowLogComplete WLogComplete; + using WLogComplete = display::WindowLogComplete; ElementLogComplete(torrent::log_buffer* l); ~ElementLogComplete() override; - void activate(display::Frame* frame, bool focus = true); - void disable(); + void activate(display::Frame* frame, bool focus = true) override; + void disable() override; display::Window* window(); @@ -32,7 +32,9 @@ private: torrent::log_buffer* m_log; - align_cacheline std::atomic m_log_updating{}; + align_cacheline + + std::atomic m_log_updating{}; }; }