From 9408303fad1efd3b889f7677dd255b9437276cfc Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Tue, 13 Sep 2011 16:38:23 +0000 Subject: fixed general plugin api git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@2351 90c681e8-e032-0410-971d-27865f9a5e38 --- src/qmmpui/general.cpp | 20 +++++--------------- src/qmmpui/general.h | 21 ++++----------------- src/qmmpui/generalfactory.h | 6 +++--- 3 files changed, 12 insertions(+), 35 deletions(-) (limited to 'src/qmmpui') diff --git a/src/qmmpui/general.cpp b/src/qmmpui/general.cpp index 8b2b36f22..2ae7b7199 100644 --- a/src/qmmpui/general.cpp +++ b/src/qmmpui/general.cpp @@ -27,7 +27,7 @@ QList *General::m_factories = 0; QStringList General::m_files; -QMap *General::m_generals = 0; +QMap *General::m_generals = 0; QObject *General::m_parent = 0; void General::checkFactories() @@ -61,28 +61,18 @@ void General::checkFactories() } } -General::General(QObject *parent) - : QObject(parent) -{ - Q_UNUSED(parent); -} - - -General::~General() -{} - void General::create(QObject *parent) { if(m_generals) return; - m_generals = new QMap (); + m_generals = new QMap (); m_parent = parent; checkFactories(); foreach(GeneralFactory* factory, *General::factories()) { if (General::isEnabled(factory)) { - General *general = factory->create(parent); + QObject *general = factory->create(parent); m_generals->insert(factory, general); } } @@ -126,7 +116,7 @@ void General::setEnabled(GeneralFactory* factory, bool enable) return; if (enable) { - General *general = factory->create(m_parent); + QObject *general = factory->create(m_parent); m_generals->insert(factory, general); } else @@ -145,7 +135,7 @@ void General::showSettings(GeneralFactory* factory, QWidget* parentWidget) if (m_generals && dialog->exec() == QDialog::Accepted && m_generals->keys().contains(factory)) { delete m_generals->value(factory); - General *general = factory->create(m_parent); + QObject *general = factory->create(m_parent); m_generals->insert(factory, general); } dialog->deleteLater(); diff --git a/src/qmmpui/general.h b/src/qmmpui/general.h index 6afd75517..502867957 100644 --- a/src/qmmpui/general.h +++ b/src/qmmpui/general.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2008-2010 by Ilya Kotov * + * Copyright (C) 2008-2011 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -25,22 +25,12 @@ #include #include "generalfactory.h" -/*! @brief The General class provides the basic functionality for the general plugin objects +/*! @brief The General class provides simple access to general plugins * @author Ilya Kotov */ -class General : public QObject +class General { - Q_OBJECT public: - /*! - * Object constructor, - * @param parent Parent object - */ - General(QObject *parent = 0); - /*! - * Destructor - */ - ~General(); /*! * Prepares general plugins for usage. * @param parent Parent object. @@ -72,14 +62,11 @@ public: */ static bool isEnabled(GeneralFactory* factory); - private: - QMap m_strValues; - QMap m_numValues; static QList *m_factories; static QStringList m_files; static void checkFactories(); - static QMap *m_generals; + static QMap *m_generals; static QObject *m_parent; }; diff --git a/src/qmmpui/generalfactory.h b/src/qmmpui/generalfactory.h index 41a4eb488..7670f6bae 100644 --- a/src/qmmpui/generalfactory.h +++ b/src/qmmpui/generalfactory.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2008-2009 by Ilya Kotov * + * Copyright (C) 2008-2011 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -66,7 +66,7 @@ public: /*! * Creates object of the General class. */ - virtual General *create(QObject *parent) = 0; + virtual QObject *create(QObject *parent) = 0; /*! * Creates configuration dialog. * @param parent Parent widget. @@ -85,5 +85,5 @@ public: virtual QTranslator *createTranslator(QObject *parent) = 0; }; -Q_DECLARE_INTERFACE(GeneralFactory, "GeneralFactory/1.0"); +Q_DECLARE_INTERFACE(GeneralFactory, "GeneralFactory/1.0") #endif -- cgit v1.2.3-13-gbd6f