get this to compile at least so i can start to exercise it with krunner

and other such bits. no point on having this just sit on my disk i
suppose =)

svn path=/trunk/KDE/kdebase/workspace/plasma/lib/; revision=614239
This commit is contained in:
Aaron J. Seigo 2006-12-16 23:04:44 +00:00
parent 337f506370
commit 3de9c853b7
10 changed files with 212 additions and 70 deletions

View File

@ -3,12 +3,13 @@
########### next target ###############
set(plasma_LIB_SRCS
plasma.cpp
applet.cpp
appletChain.cpp
appletLayout.cpp
appletCompositor.cpp )
set(plasma_LIB_SRCS
plasma.cpp
applet.cpp
appletChain.cpp
interface.cpp
theme.cpp
)
kde4_automoc(${plasma_LIB_SRCS})
@ -22,5 +23,5 @@ install(TARGETS plasma DESTINATION ${LIB_INSTALL_DIR} )
########### install files ###############
install( FILES applet.h plasma.h appletCompositor.h appletLayout.h DESTINATION ${INCLUDE_INSTALL_DIR}/plasma )
install( FILES applet.h plasma.h theme.h interface.h DESTINATION ${INCLUDE_INSTALL_DIR}/plasma )

View File

@ -22,11 +22,10 @@
#include <QStringList>
#include <QTimer>
#include <kstandarddirs.h>
#include <KStandardDirs>
#include "applet.h"
#include "interface.h"
namespace Plasma
{
@ -79,20 +78,20 @@ KSharedConfig::Ptr Applet::appletConfig() const
{
if (!d->appletConfig)
{
QString file = locateLocal("appdata",
"applets/" + instanceName() + "rc",
true);
QString file = KStandardDirs::locateLocal("appdata",
"applets/" + instanceName() + "rc",
true);
d->appletConfig = KSharedConfig::openConfig(file, false, true);
}
return d->appletConfig;
}
KSharedConfig::Ptr Applet::AppletConfig() const
KSharedConfig::Ptr Applet::globalAppletConfig() const
{
if (!d->globalConfig)
{
QString file = locateLocal("config", "plasma_" + globalName() + "rc");
QString file = KStandardDirs::locateLocal("config", "plasma_" + globalName() + "rc");
d->globalConfig = KSharedConfig::openConfig(file, false, true);
}
@ -106,7 +105,7 @@ bool Applet::loadDataEngine(const QString& name)
return true;
}
if (PlasmaAppInterface::self()->loadDataEngine(name))
if (Plasma::Interface::self()->loadDataEngine(name))
{
d->loadedEngines.append(name);
return true;

View File

@ -1,18 +0,0 @@
#include "appletCompositor.h"
namespace Plasma
{
AppletCompositor::AppletCompositor(QWidget *parent)
: QWidget(parent)
{
}
void AppletCompositor::mergeTwoApplets()
{
}
} // Plasma namespace
#include "appletCompositor.moc"

View File

@ -1,33 +0,0 @@
#ifndef APPLETCOMPOSITOR_H
#define APPLETCOMPOSITOR_H
#include <kdelibs_export.h>
#include <QWidget>
namespace Plasma
{
/**
* This is the visual representation of our applet container.
* Together with AppletLayout handles all GUI aspect of displaying
* applets. AppletCompositor is responsible for all the effects
* and animations that happen between applets.
*/
class KDE_EXPORT AppletCompositor : public QWidget
{
Q_OBJECT
public:
AppletCompositor(QWidget *parent);
protected Q_SLOTS:
virtual void mergeTwoApplets();
private:
class Private;
Private *d;
};
}
#endif

42
dataengine.cpp Normal file
View File

@ -0,0 +1,42 @@
/*
* Copyright (C) 2006 Aaron Seigo <aseigo@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License version 2 as
* published by the Free Software Foundation
*
* 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 Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "dataengine.h"
class DataSource::Private
{
public:
Private();
};
DataSource(QObject* parent)
: QObject(parent)
{
d = new Private();
}
virtual ~DataSource()
{
delete d;
}
QString name()
{
}

View File

@ -38,7 +38,7 @@ class DataSource : public QObject
typedef QHash<QString, DataSource*> Dict;
typedef QHash<QString, QVariant> Data;
DataSource(QObject* parent);
explicit DataSource(QObject* parent = 0);
virtual ~DataSource();
QString name();
@ -67,11 +67,16 @@ class DataEngine : public QObject
void ref();
void deref();
bool used();
bool isUsed();
protected:
virtual void init();
virtual void cleanup();
void setDataSource(const QString& source, const QVariant& value);
void createDataSource(const QString& source,
const QString& domain = QString());
void removeDataSource(const QString& source);
void clearAllDataSources();
private:
QAtomic ref;

29
interface.cpp Normal file
View File

@ -0,0 +1,29 @@
/*
* Copyright (C) 2006 Aaron Seigo <aseigo@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License version 2 as
* published by the Free Software Foundation
*
* 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 Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "interface.h"
namespace Plasma
{
Interface* Interface::m_interface;
Interface::Interface() {}
Interface::~Interface() {}
} // Plasma namespace

View File

@ -19,6 +19,8 @@
#ifndef PLASMA_INTERFACE_H
#define PLASMA_INTERFACE_H
#include <QString>
namespace Plasma
{
@ -31,10 +33,12 @@ class Interface
virtual void unloadDataEngine(const QString& name) = 0;
protected:
Interface() : m_interface(0) {}
Interface();
virtual ~Interface();
static Interface* m_interface;
};
} // Plasma namespace
#endif // multiple inclusion guard

64
theme.cpp Normal file
View File

@ -0,0 +1,64 @@
/*
* Copyright (C) 2006 Aaron Seigo <aseigo@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License version 2 as
* published by the Free Software Foundation
*
* 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 Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <KSharedConfig>
#include <KStandardDirs>
#include "theme.h"
namespace Plasma
{
class Theme::Private
{
public:
Private()
: themeName("default")
{
}
QString themeName;
};
Theme::Theme(QObject* parent)
: QObject(parent),
d(new Private)
{
KConfig config("plasma");
KConfigGroup group(&config, "Theme");
d->themeName = group.readEntry("name", d->themeName);
}
Theme::~Theme()
{
}
QString Theme::themeName() const
{
return d->themeName;
}
QString Theme::imagePath(const QString& name)
{
return KStandardDirs::locate("data", "desktoptheme/" + d->themeName
+ "/" + name + ".svg");
}
}
#include <theme.moc>

49
theme.h Normal file
View File

@ -0,0 +1,49 @@
/*
* Copyright (C) 2006 Aaron Seigo <aseigo@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License version 2 as
* published by the Free Software Foundation
*
* 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 Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef PLASMA_THEME_H
#define PLASMA_THEME_H
#include <QtCore/QObject>
namespace Plasma
{
class Theme : public QObject
{
Q_OBJECT
public:
explicit Theme(QObject* parent = 0);
~Theme();
QString themeName() const;
QString imagePath(const QString& name);
signals:
void changed();
private:
class Private;
Private* d;
};
} // Plasma namespace
#endif // multiple inclusion guard