diff --git a/CMakeLists.txt b/CMakeLists.txt index 5c6100e67..a670982ea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 ) diff --git a/applet.cpp b/applet.cpp index 340d2c1ed..f6ae2dbc6 100644 --- a/applet.cpp +++ b/applet.cpp @@ -22,11 +22,10 @@ #include #include -#include +#include #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; diff --git a/appletCompositor.cpp b/appletCompositor.cpp deleted file mode 100644 index dcb0b4531..000000000 --- a/appletCompositor.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include "appletCompositor.h" - -namespace Plasma -{ - -AppletCompositor::AppletCompositor(QWidget *parent) - : QWidget(parent) -{ -} - - -void AppletCompositor::mergeTwoApplets() -{ -} - -} // Plasma namespace - -#include "appletCompositor.moc" diff --git a/appletCompositor.h b/appletCompositor.h deleted file mode 100644 index 539baa350..000000000 --- a/appletCompositor.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef APPLETCOMPOSITOR_H -#define APPLETCOMPOSITOR_H - -#include - -#include - -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 diff --git a/dataengine.cpp b/dataengine.cpp new file mode 100644 index 000000000..03c2936d2 --- /dev/null +++ b/dataengine.cpp @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2006 Aaron Seigo + * + * 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() +{ +} + + diff --git a/dataengine.h b/dataengine.h index 4dd09ad81..d6ca7a103 100644 --- a/dataengine.h +++ b/dataengine.h @@ -38,7 +38,7 @@ class DataSource : public QObject typedef QHash Dict; typedef QHash 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; diff --git a/interface.cpp b/interface.cpp new file mode 100644 index 000000000..0bd200267 --- /dev/null +++ b/interface.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2006 Aaron Seigo + * + * 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 + diff --git a/interface.h b/interface.h index 0da758260..0a876dfaf 100644 --- a/interface.h +++ b/interface.h @@ -19,6 +19,8 @@ #ifndef PLASMA_INTERFACE_H #define PLASMA_INTERFACE_H +#include + 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 + diff --git a/theme.cpp b/theme.cpp new file mode 100644 index 000000000..f96888b14 --- /dev/null +++ b/theme.cpp @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2006 Aaron Seigo + * + * 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 +#include + +#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 diff --git a/theme.h b/theme.h new file mode 100644 index 000000000..eeb9977c7 --- /dev/null +++ b/theme.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2006 Aaron Seigo + * + * 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 + +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 +