Commit 80f26fa5 authored by Rafał Malinowski's avatar Rafał Malinowski

sound: use unique_ptr in SoundThemeManager

Signed-off-by: Rafał Malinowski's avatarRafał Malinowski <rafal.przemyslaw.malinowski@gmail.com>
parent 8cf948c5
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
*/ */
#include "configuration/configuration-file.h" #include "configuration/configuration-file.h"
#include "misc/memory.h"
#include "themes.h" #include "themes.h"
#include "sound-theme-manager.h" #include "sound-theme-manager.h"
...@@ -44,7 +45,7 @@ SoundThemeManager * SoundThemeManager::instance() ...@@ -44,7 +45,7 @@ SoundThemeManager * SoundThemeManager::instance()
} }
SoundThemeManager::SoundThemeManager() : SoundThemeManager::SoundThemeManager() :
MyThemes(new Themes("sounds", "sound.conf")) MyThemes{make_unique<Themes>("sounds", "sound.conf")}
{ {
MyThemes->setPaths(config_file->readEntry("Sounds", "SoundPaths").split('&', QString::SkipEmptyParts)); MyThemes->setPaths(config_file->readEntry("Sounds", "SoundPaths").split('&', QString::SkipEmptyParts));
...@@ -62,8 +63,6 @@ SoundThemeManager::SoundThemeManager() : ...@@ -62,8 +63,6 @@ SoundThemeManager::SoundThemeManager() :
SoundThemeManager::~SoundThemeManager() SoundThemeManager::~SoundThemeManager()
{ {
delete MyThemes;
MyThemes = 0;
} }
void SoundThemeManager::applyTheme(const QString &themeName) void SoundThemeManager::applyTheme(const QString &themeName)
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#define SOUND_THEME_MANAGER_H #define SOUND_THEME_MANAGER_H
#include <QtCore/QString> #include <QtCore/QString>
#include <memory>
class Themes; class Themes;
...@@ -31,7 +32,7 @@ class SoundThemeManager ...@@ -31,7 +32,7 @@ class SoundThemeManager
{ {
static SoundThemeManager * Instance; static SoundThemeManager * Instance;
Themes *MyThemes; std::unique_ptr<Themes> MyThemes;
SoundThemeManager(); SoundThemeManager();
~SoundThemeManager(); ~SoundThemeManager();
...@@ -43,7 +44,7 @@ public: ...@@ -43,7 +44,7 @@ public:
void applyTheme(const QString &themeName); void applyTheme(const QString &themeName);
Themes * themes() { return MyThemes; } Themes * themes() { return MyThemes.get(); }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment