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:
parent
337f506370
commit
3de9c853b7
@ -7,8 +7,9 @@ set(plasma_LIB_SRCS
|
|||||||
plasma.cpp
|
plasma.cpp
|
||||||
applet.cpp
|
applet.cpp
|
||||||
appletChain.cpp
|
appletChain.cpp
|
||||||
appletLayout.cpp
|
interface.cpp
|
||||||
appletCompositor.cpp )
|
theme.cpp
|
||||||
|
)
|
||||||
|
|
||||||
kde4_automoc(${plasma_LIB_SRCS})
|
kde4_automoc(${plasma_LIB_SRCS})
|
||||||
|
|
||||||
@ -22,5 +23,5 @@ install(TARGETS plasma DESTINATION ${LIB_INSTALL_DIR} )
|
|||||||
|
|
||||||
########### install files ###############
|
########### 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 )
|
||||||
|
|
||||||
|
13
applet.cpp
13
applet.cpp
@ -22,11 +22,10 @@
|
|||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
#include <kstandarddirs.h>
|
#include <KStandardDirs>
|
||||||
|
|
||||||
#include "applet.h"
|
#include "applet.h"
|
||||||
|
#include "interface.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
@ -79,7 +78,7 @@ KSharedConfig::Ptr Applet::appletConfig() const
|
|||||||
{
|
{
|
||||||
if (!d->appletConfig)
|
if (!d->appletConfig)
|
||||||
{
|
{
|
||||||
QString file = locateLocal("appdata",
|
QString file = KStandardDirs::locateLocal("appdata",
|
||||||
"applets/" + instanceName() + "rc",
|
"applets/" + instanceName() + "rc",
|
||||||
true);
|
true);
|
||||||
d->appletConfig = KSharedConfig::openConfig(file, false, true);
|
d->appletConfig = KSharedConfig::openConfig(file, false, true);
|
||||||
@ -88,11 +87,11 @@ KSharedConfig::Ptr Applet::appletConfig() const
|
|||||||
return d->appletConfig;
|
return d->appletConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
KSharedConfig::Ptr Applet::AppletConfig() const
|
KSharedConfig::Ptr Applet::globalAppletConfig() const
|
||||||
{
|
{
|
||||||
if (!d->globalConfig)
|
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);
|
d->globalConfig = KSharedConfig::openConfig(file, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,7 +105,7 @@ bool Applet::loadDataEngine(const QString& name)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PlasmaAppInterface::self()->loadDataEngine(name))
|
if (Plasma::Interface::self()->loadDataEngine(name))
|
||||||
{
|
{
|
||||||
d->loadedEngines.append(name);
|
d->loadedEngines.append(name);
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
#include "appletCompositor.h"
|
|
||||||
|
|
||||||
namespace Plasma
|
|
||||||
{
|
|
||||||
|
|
||||||
AppletCompositor::AppletCompositor(QWidget *parent)
|
|
||||||
: QWidget(parent)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void AppletCompositor::mergeTwoApplets()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
} // Plasma namespace
|
|
||||||
|
|
||||||
#include "appletCompositor.moc"
|
|
@ -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
42
dataengine.cpp
Normal 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()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -38,7 +38,7 @@ class DataSource : public QObject
|
|||||||
typedef QHash<QString, DataSource*> Dict;
|
typedef QHash<QString, DataSource*> Dict;
|
||||||
typedef QHash<QString, QVariant> Data;
|
typedef QHash<QString, QVariant> Data;
|
||||||
|
|
||||||
DataSource(QObject* parent);
|
explicit DataSource(QObject* parent = 0);
|
||||||
virtual ~DataSource();
|
virtual ~DataSource();
|
||||||
|
|
||||||
QString name();
|
QString name();
|
||||||
@ -67,11 +67,16 @@ class DataEngine : public QObject
|
|||||||
|
|
||||||
void ref();
|
void ref();
|
||||||
void deref();
|
void deref();
|
||||||
bool used();
|
bool isUsed();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void init();
|
virtual void init();
|
||||||
virtual void cleanup();
|
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:
|
private:
|
||||||
QAtomic ref;
|
QAtomic ref;
|
||||||
|
29
interface.cpp
Normal file
29
interface.cpp
Normal 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
|
||||||
|
|
@ -19,6 +19,8 @@
|
|||||||
#ifndef PLASMA_INTERFACE_H
|
#ifndef PLASMA_INTERFACE_H
|
||||||
#define PLASMA_INTERFACE_H
|
#define PLASMA_INTERFACE_H
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -31,10 +33,12 @@ class Interface
|
|||||||
virtual void unloadDataEngine(const QString& name) = 0;
|
virtual void unloadDataEngine(const QString& name) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Interface() : m_interface(0) {}
|
Interface();
|
||||||
|
virtual ~Interface();
|
||||||
static Interface* m_interface;
|
static Interface* m_interface;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // Plasma namespace
|
} // Plasma namespace
|
||||||
|
|
||||||
#endif // multiple inclusion guard
|
#endif // multiple inclusion guard
|
||||||
|
|
||||||
|
64
theme.cpp
Normal file
64
theme.cpp
Normal 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
49
theme.h
Normal 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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user