Everyone loves scoped_ptr.
This commit is contained in:
parent
864215cb23
commit
54a5bd2c8e
|
@ -34,7 +34,6 @@ const char* LastFMService::kSecret = "d3072b60ae626be12be69448f5c46e70";
|
|||
LastFMService::LastFMService(QObject* parent)
|
||||
: RadioService(kServiceName, parent),
|
||||
scrobbler_(NULL),
|
||||
config_(NULL),
|
||||
station_dialog_(new LastFMStationDialog),
|
||||
context_menu_(new QMenu),
|
||||
initial_tune_(false),
|
||||
|
@ -64,9 +63,6 @@ LastFMService::LastFMService(QObject* parent)
|
|||
}
|
||||
|
||||
LastFMService::~LastFMService() {
|
||||
delete config_;
|
||||
delete station_dialog_;
|
||||
delete context_menu_;
|
||||
}
|
||||
|
||||
void LastFMService::ReloadSettings() {
|
||||
|
@ -81,7 +77,7 @@ void LastFMService::ReloadSettings() {
|
|||
|
||||
void LastFMService::ShowConfig() {
|
||||
if (!config_) {
|
||||
config_ = new LastFMConfigDialog;
|
||||
config_.reset(new LastFMConfigDialog);
|
||||
}
|
||||
|
||||
config_->show();
|
||||
|
|
|
@ -14,16 +14,17 @@ uint qHash(const lastfm::Track& track);
|
|||
|
||||
#include "radioservice.h"
|
||||
#include "song.h"
|
||||
#include "lastfmconfigdialog.h"
|
||||
#include "lastfmstationdialog.h"
|
||||
|
||||
#include <QMap>
|
||||
#include <QMenu>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QQueue>
|
||||
|
||||
class QMenu;
|
||||
class QAction;
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
|
||||
class LastFMConfigDialog;
|
||||
class QAction;
|
||||
|
||||
class LastFMService : public RadioService {
|
||||
Q_OBJECT
|
||||
|
@ -135,10 +136,10 @@ class LastFMService : public RadioService {
|
|||
lastfm::Track next_metadata_;
|
||||
QQueue<lastfm::Track> playlist_;
|
||||
|
||||
LastFMConfigDialog* config_;
|
||||
LastFMStationDialog* station_dialog_;
|
||||
boost::scoped_ptr<LastFMConfigDialog> config_;
|
||||
boost::scoped_ptr<LastFMStationDialog> station_dialog_;
|
||||
|
||||
QMenu* context_menu_;
|
||||
boost::scoped_ptr<QMenu> context_menu_;
|
||||
QAction* play_action_;
|
||||
QAction* remove_action_;
|
||||
QAction* add_artist_action_;
|
||||
|
|
Loading…
Reference in New Issue