aboutsummaryrefslogtreecommitdiff
path: root/src/qmmpui
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2011-09-13 16:38:23 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2011-09-13 16:38:23 +0000
commit9408303fad1efd3b889f7677dd255b9437276cfc (patch)
tree0657a5fd272ab0eb8469626d059e9d1f9f560238 /src/qmmpui
parentd0e1f9e4e1e44dbe3372a6cdb621bf0ee9baa668 (diff)
downloadqmmp-9408303fad1efd3b889f7677dd255b9437276cfc.tar.gz
qmmp-9408303fad1efd3b889f7677dd255b9437276cfc.tar.bz2
qmmp-9408303fad1efd3b889f7677dd255b9437276cfc.zip
fixed general plugin api
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@2351 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/qmmpui')
-rw-r--r--src/qmmpui/general.cpp20
-rw-r--r--src/qmmpui/general.h21
-rw-r--r--src/qmmpui/generalfactory.h6
3 files changed, 12 insertions, 35 deletions
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<GeneralFactory*> *General::m_factories = 0;
QStringList General::m_files;
-QMap <GeneralFactory*, General*> *General::m_generals = 0;
+QMap <GeneralFactory*, QObject*> *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 <GeneralFactory*, General*>();
+ m_generals = new QMap <GeneralFactory*, QObject*>();
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,23 +25,13 @@
#include <QMap>
#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 <forkotov02@hotmail.ru>
*/
-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 <uint, QString> m_strValues;
- QMap <uint, uint> m_numValues;
static QList<GeneralFactory*> *m_factories;
static QStringList m_files;
static void checkFactories();
- static QMap <GeneralFactory*, General*> *m_generals;
+ static QMap <GeneralFactory*, QObject*> *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