move all the prive code into private/; makes it much clearer with the division lines are
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=839792
This commit is contained in:
parent
8febce6910
commit
63bce9d1b4
@ -27,7 +27,6 @@ set(plasma_LIB_SRCS
|
|||||||
appletbrowser/kcategorizeditemsviewmodels.cpp
|
appletbrowser/kcategorizeditemsviewmodels.cpp
|
||||||
appletbrowser/openwidgetassistant.cpp
|
appletbrowser/openwidgetassistant.cpp
|
||||||
appletbrowser/plasmaappletitemmodel.cpp
|
appletbrowser/plasmaappletitemmodel.cpp
|
||||||
applethandle.cpp
|
|
||||||
configxml.cpp
|
configxml.cpp
|
||||||
containment.cpp
|
containment.cpp
|
||||||
corona.cpp
|
corona.cpp
|
||||||
@ -35,16 +34,20 @@ set(plasma_LIB_SRCS
|
|||||||
dataengine.cpp
|
dataengine.cpp
|
||||||
dataenginemanager.cpp
|
dataenginemanager.cpp
|
||||||
delegate.cpp
|
delegate.cpp
|
||||||
desktoptoolbox.cpp
|
|
||||||
dialog.cpp
|
dialog.cpp
|
||||||
#FOR FUTURE
|
#FOR FUTURE
|
||||||
#layouts/borderlayout.cpp
|
#layouts/borderlayout.cpp
|
||||||
packages.cpp
|
|
||||||
paintutils.cpp
|
paintutils.cpp
|
||||||
panelsvg.cpp
|
panelsvg.cpp
|
||||||
paneltoolbox.cpp
|
|
||||||
plasma.cpp
|
plasma.cpp
|
||||||
popupapplet.cpp
|
popupapplet.cpp
|
||||||
|
private/applethandle.cpp
|
||||||
|
private/datacontainer_p.cpp
|
||||||
|
private/desktoptoolbox.cpp
|
||||||
|
private/packages.cpp
|
||||||
|
private/paneltoolbox.cpp
|
||||||
|
private/toolbox.cpp
|
||||||
|
private/tooltip.cpp
|
||||||
querymatch.cpp
|
querymatch.cpp
|
||||||
runnercontext.cpp
|
runnercontext.cpp
|
||||||
runnermanager.cpp
|
runnermanager.cpp
|
||||||
@ -56,9 +59,7 @@ set(plasma_LIB_SRCS
|
|||||||
servicejob.cpp
|
servicejob.cpp
|
||||||
svg.cpp
|
svg.cpp
|
||||||
theme.cpp
|
theme.cpp
|
||||||
toolbox.cpp
|
|
||||||
tooltipmanager.cpp
|
tooltipmanager.cpp
|
||||||
tooltip.cpp
|
|
||||||
uiloader.cpp
|
uiloader.cpp
|
||||||
version.cpp
|
version.cpp
|
||||||
view.cpp
|
view.cpp
|
||||||
|
37
applet.cpp
37
applet.cpp
@ -20,7 +20,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "applet.h"
|
#include "applet.h"
|
||||||
#include "applet_p.h"
|
#include "private/applet_p.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
@ -59,23 +59,24 @@
|
|||||||
|
|
||||||
#include <Solid/PowerManagement>
|
#include <Solid/PowerManagement>
|
||||||
|
|
||||||
#include "plasma/configxml.h"
|
#include "configxml.h"
|
||||||
#include "plasma/containment.h"
|
#include "containment.h"
|
||||||
#include "plasma/containment_p.h"
|
#include "corona.h"
|
||||||
#include "plasma/corona.h"
|
#include "dataenginemanager.h"
|
||||||
#include "plasma/dataenginemanager.h"
|
#include "package.h"
|
||||||
#include "plasma/package.h"
|
#include "plasma.h"
|
||||||
#include "plasma/packages_p.h"
|
#include "scripting/appletscript.h"
|
||||||
#include "plasma/plasma.h"
|
#include "svg.h"
|
||||||
#include "plasma/scripting/appletscript.h"
|
#include "panelsvg.h"
|
||||||
#include "plasma/svg.h"
|
#include "theme.h"
|
||||||
#include "plasma/panelsvg.h"
|
#include "view.h"
|
||||||
#include "plasma/theme.h"
|
#include "widgets/label.h"
|
||||||
#include "plasma/toolbox_p.h"
|
#include "widgets/pushbutton.h"
|
||||||
#include "plasma/view.h"
|
#include "tooltipmanager.h"
|
||||||
#include "plasma/widgets/label.h"
|
|
||||||
#include "plasma/widgets/pushbutton.h"
|
#include "private/containment_p.h"
|
||||||
#include "plasma/tooltipmanager.h"
|
#include "private/packages_p.h"
|
||||||
|
#include "private/toolbox_p.h"
|
||||||
|
|
||||||
//#define DYNAMIC_SHADOWS
|
//#define DYNAMIC_SHADOWS
|
||||||
namespace Plasma
|
namespace Plasma
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "containment.h"
|
#include "containment.h"
|
||||||
#include "containment_p.h"
|
#include "private/containment_p.h"
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
@ -44,14 +44,15 @@
|
|||||||
#include <KStandardDirs>
|
#include <KStandardDirs>
|
||||||
#include <KWindowSystem>
|
#include <KWindowSystem>
|
||||||
|
|
||||||
#include "applet_p.h"
|
|
||||||
#include "applethandle_p.h"
|
|
||||||
#include "corona.h"
|
|
||||||
#include "animator.h"
|
#include "animator.h"
|
||||||
#include "desktoptoolbox_p.h"
|
#include "corona.h"
|
||||||
#include "paneltoolbox_p.h"
|
|
||||||
#include "svg.h"
|
#include "svg.h"
|
||||||
|
|
||||||
|
#include "private/applet_p.h"
|
||||||
|
#include "private/applethandle_p.h"
|
||||||
|
#include "private/desktoptoolbox_p.h"
|
||||||
|
#include "private/paneltoolbox_p.h"
|
||||||
|
|
||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "datacontainer.h"
|
#include "datacontainer.h"
|
||||||
#include "datacontainer_p.h"
|
#include "private/datacontainer_p.h"
|
||||||
|
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
|
||||||
@ -192,5 +192,4 @@ void DataContainer::checkUsage()
|
|||||||
} // Plasma namespace
|
} // Plasma namespace
|
||||||
|
|
||||||
#include "datacontainer.moc"
|
#include "datacontainer.moc"
|
||||||
#include "datacontainer_p.moc"
|
|
||||||
|
|
||||||
|
@ -1,194 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2006-2007 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 as
|
|
||||||
* published by the Free Software Foundation; either version 2, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* 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_DATACONTAINER_P_H
|
|
||||||
#define PLASMA_DATACONTAINER_P_H
|
|
||||||
|
|
||||||
#include <QtCore/QTimerEvent>
|
|
||||||
#include <QtCore/QTime>
|
|
||||||
|
|
||||||
namespace Plasma
|
|
||||||
{
|
|
||||||
|
|
||||||
class SignalRelay;
|
|
||||||
|
|
||||||
class DataContainerPrivate
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
DataContainerPrivate()
|
|
||||||
: dirty(false), cached(false)
|
|
||||||
{}
|
|
||||||
|
|
||||||
SignalRelay* signalRelay(const DataContainer* dc, QObject *visualization,
|
|
||||||
uint pollingInterval, Plasma::IntervalAlignment align);
|
|
||||||
|
|
||||||
bool hasUpdates();
|
|
||||||
|
|
||||||
DataEngine::Data data;
|
|
||||||
QMap<QObject *, SignalRelay *> relayObjects;
|
|
||||||
QMap<uint, SignalRelay *> relays;
|
|
||||||
QTime updateTs;
|
|
||||||
bool dirty : 1;
|
|
||||||
bool cached : 1;
|
|
||||||
};
|
|
||||||
|
|
||||||
class SignalRelay : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
SignalRelay(DataContainer* parent, DataContainerPrivate *data, uint ival, Plasma::IntervalAlignment align)
|
|
||||||
: QObject(parent),
|
|
||||||
dc(parent),
|
|
||||||
d(data),
|
|
||||||
m_interval(ival),
|
|
||||||
m_align(align),
|
|
||||||
m_resetTimer(true),
|
|
||||||
m_queued(false)
|
|
||||||
{
|
|
||||||
//kDebug() << "signal relay with time of" << m_timerId << "being set up";
|
|
||||||
m_timerId = startTimer(0);
|
|
||||||
if (m_align != Plasma::NoAlignment) {
|
|
||||||
checkAlignment();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int receiverCount() const
|
|
||||||
{
|
|
||||||
return receivers(SIGNAL(dataUpdated(QString,Plasma::DataEngine::Data)));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isUnused()
|
|
||||||
{
|
|
||||||
return receivers(SIGNAL(dataUpdated(QString,Plasma::DataEngine::Data))) < 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void checkAlignment()
|
|
||||||
{
|
|
||||||
int newTime = 0;
|
|
||||||
|
|
||||||
QTime t = QTime::currentTime();
|
|
||||||
if (m_align == Plasma::AlignToMinute) {
|
|
||||||
int seconds = t.second();
|
|
||||||
if (seconds > 2) {
|
|
||||||
newTime = ((60 - seconds) * 1000) + 500;
|
|
||||||
}
|
|
||||||
} else if (m_align == Plasma::AlignToHour) {
|
|
||||||
int minutes = t.minute();
|
|
||||||
int seconds = t.second();
|
|
||||||
if (minutes > 1 || seconds > 10) {
|
|
||||||
newTime = ((60 - minutes) * 1000 * 60) +
|
|
||||||
((60 - seconds) * 1000) + 500;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (newTime) {
|
|
||||||
killTimer(m_timerId);
|
|
||||||
m_timerId = startTimer(newTime);
|
|
||||||
m_resetTimer = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void checkQueueing() {
|
|
||||||
if (m_queued) {
|
|
||||||
emit dataUpdated(dc->objectName(), d->data);
|
|
||||||
m_queued = false;
|
|
||||||
//TODO: should we re-align our timer at this point, to avoid
|
|
||||||
// constant queueing due to more-or-less constant time
|
|
||||||
// async update time? this might make sense for
|
|
||||||
// staggered accesses to the same source by multiple
|
|
||||||
// visualizations causing a minimumPollingInterval violation.
|
|
||||||
// it may not make sense for purely async-and-takes-a-while
|
|
||||||
// type operations (e.g. network fetching).
|
|
||||||
// we need more real world data before making such a change
|
|
||||||
// change
|
|
||||||
//
|
|
||||||
// killTimer(m_timerId);
|
|
||||||
// m_timerId = startTime(m_interval);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DataContainer *dc;
|
|
||||||
DataContainerPrivate *d;
|
|
||||||
uint m_interval;
|
|
||||||
Plasma::IntervalAlignment m_align;
|
|
||||||
int m_timerId;
|
|
||||||
bool m_resetTimer;
|
|
||||||
bool m_queued;
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void dataUpdated(const QString&, const Plasma::DataEngine::Data&);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void timerEvent(QTimerEvent *event)
|
|
||||||
{
|
|
||||||
if (m_resetTimer) {
|
|
||||||
killTimer(m_timerId);
|
|
||||||
m_timerId = startTimer(m_interval);
|
|
||||||
m_resetTimer = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_align != Plasma::NoAlignment) {
|
|
||||||
checkAlignment();
|
|
||||||
}
|
|
||||||
|
|
||||||
emit dc->updateRequested(dc);
|
|
||||||
if (d->hasUpdates()) {
|
|
||||||
//kDebug() << "emitting data updated directly" << d->data;
|
|
||||||
emit dataUpdated(dc->objectName(), d->data);
|
|
||||||
} else {
|
|
||||||
// the source wasn't actually updated; so let's put ourselves in the queue
|
|
||||||
// so we get an dataUpdated() when the data does arrive
|
|
||||||
//kDebug() << "queued";
|
|
||||||
m_queued = true;
|
|
||||||
}
|
|
||||||
event->accept();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
SignalRelay* DataContainerPrivate::signalRelay(const DataContainer* dc, QObject *visualization, uint pollingInterval, Plasma::IntervalAlignment align)
|
|
||||||
{
|
|
||||||
QMap<uint, SignalRelay *>::const_iterator relayIt = relays.find(pollingInterval);
|
|
||||||
SignalRelay *relay = 0;
|
|
||||||
|
|
||||||
//FIXME what if we have two applets with the same interval and different alignment?
|
|
||||||
if (relayIt == relays.end()) {
|
|
||||||
relay = new SignalRelay(const_cast<DataContainer*>(dc), this, pollingInterval, align);
|
|
||||||
relays[pollingInterval] = relay;
|
|
||||||
} else {
|
|
||||||
relay = relayIt.value();
|
|
||||||
}
|
|
||||||
|
|
||||||
relayObjects[visualization] = relay;
|
|
||||||
return relay;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DataContainerPrivate::hasUpdates()
|
|
||||||
{
|
|
||||||
if (cached) {
|
|
||||||
//some signalrelay needs us to pretend we did an update
|
|
||||||
cached = false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return dirty;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // multiple inclusion guard
|
|
@ -18,7 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "dataengine.h"
|
#include "dataengine.h"
|
||||||
#include "dataengine_p.h"
|
#include "private/dataengine_p.h"
|
||||||
|
|
||||||
#include <QQueue>
|
#include <QQueue>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
@ -34,9 +34,10 @@
|
|||||||
#include "datacontainer.h"
|
#include "datacontainer.h"
|
||||||
#include "package.h"
|
#include "package.h"
|
||||||
#include "service.h"
|
#include "service.h"
|
||||||
#include "service_p.h"
|
|
||||||
#include "scripting/dataenginescript.h"
|
#include "scripting/dataenginescript.h"
|
||||||
|
|
||||||
|
#include "private/service_p.h"
|
||||||
|
|
||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include <KDebug>
|
#include <KDebug>
|
||||||
#include <KServiceTypeTrader>
|
#include <KServiceTypeTrader>
|
||||||
|
|
||||||
#include "dataengine_p.h"
|
#include "private/dataengine_p.h"
|
||||||
#include "scripting/scriptengine.h"
|
#include "scripting/scriptengine.h"
|
||||||
|
|
||||||
namespace Plasma
|
namespace Plasma
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "applethandle_p.h"
|
#include "private/applethandle_p.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QBitmap>
|
#include <QBitmap>
|
||||||
@ -892,3 +892,4 @@ void AppletHandle::calculateSize()
|
|||||||
} // Plasma Namespace
|
} // Plasma Namespace
|
||||||
|
|
||||||
#include "applethandle_p.moc"
|
#include "applethandle_p.moc"
|
||||||
|
|
128
private/datacontainer_p.cpp
Normal file
128
private/datacontainer_p.cpp
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2006-2007 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 as
|
||||||
|
* published by the Free Software Foundation; either version 2, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* 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 "datacontainer.h"
|
||||||
|
#include "datacontainer_p.h"
|
||||||
|
|
||||||
|
namespace Plasma
|
||||||
|
{
|
||||||
|
|
||||||
|
SignalRelay* DataContainerPrivate::signalRelay(const DataContainer* dc, QObject *visualization, uint pollingInterval, Plasma::IntervalAlignment align)
|
||||||
|
{
|
||||||
|
QMap<uint, SignalRelay *>::const_iterator relayIt = relays.find(pollingInterval);
|
||||||
|
SignalRelay *relay = 0;
|
||||||
|
|
||||||
|
//FIXME what if we have two applets with the same interval and different alignment?
|
||||||
|
if (relayIt == relays.end()) {
|
||||||
|
relay = new SignalRelay(const_cast<DataContainer*>(dc), this, pollingInterval, align);
|
||||||
|
relays[pollingInterval] = relay;
|
||||||
|
} else {
|
||||||
|
relay = relayIt.value();
|
||||||
|
}
|
||||||
|
|
||||||
|
relayObjects[visualization] = relay;
|
||||||
|
return relay;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DataContainerPrivate::hasUpdates()
|
||||||
|
{
|
||||||
|
if (cached) {
|
||||||
|
// SignalRelay needs us to pretend we did an update
|
||||||
|
cached = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return dirty;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SignalRelay::checkAlignment()
|
||||||
|
{
|
||||||
|
int newTime = 0;
|
||||||
|
|
||||||
|
QTime t = QTime::currentTime();
|
||||||
|
if (m_align == Plasma::AlignToMinute) {
|
||||||
|
int seconds = t.second();
|
||||||
|
if (seconds > 2) {
|
||||||
|
newTime = ((60 - seconds) * 1000) + 500;
|
||||||
|
}
|
||||||
|
} else if (m_align == Plasma::AlignToHour) {
|
||||||
|
int minutes = t.minute();
|
||||||
|
int seconds = t.second();
|
||||||
|
if (minutes > 1 || seconds > 10) {
|
||||||
|
newTime = ((60 - minutes) * 1000 * 60) +
|
||||||
|
((60 - seconds) * 1000) + 500;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newTime) {
|
||||||
|
killTimer(m_timerId);
|
||||||
|
m_timerId = startTimer(newTime);
|
||||||
|
m_resetTimer = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SignalRelay::checkQueueing()
|
||||||
|
{
|
||||||
|
if (m_queued) {
|
||||||
|
emit dataUpdated(dc->objectName(), d->data);
|
||||||
|
m_queued = false;
|
||||||
|
//TODO: should we re-align our timer at this point, to avoid
|
||||||
|
// constant queueing due to more-or-less constant time
|
||||||
|
// async update time? this might make sense for
|
||||||
|
// staggered accesses to the same source by multiple
|
||||||
|
// visualizations causing a minimumPollingInterval violation.
|
||||||
|
// it may not make sense for purely async-and-takes-a-while
|
||||||
|
// type operations (e.g. network fetching).
|
||||||
|
// we need more real world data before making such a change
|
||||||
|
// change
|
||||||
|
//
|
||||||
|
// killTimer(m_timerId);
|
||||||
|
// m_timerId = startTime(m_interval);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SignalRelay::timerEvent(QTimerEvent *event)
|
||||||
|
{
|
||||||
|
if (m_resetTimer) {
|
||||||
|
killTimer(m_timerId);
|
||||||
|
m_timerId = startTimer(m_interval);
|
||||||
|
m_resetTimer = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_align != Plasma::NoAlignment) {
|
||||||
|
checkAlignment();
|
||||||
|
}
|
||||||
|
|
||||||
|
emit dc->updateRequested(dc);
|
||||||
|
if (d->hasUpdates()) {
|
||||||
|
//kDebug() << "emitting data updated directly" << d->data;
|
||||||
|
emit dataUpdated(dc->objectName(), d->data);
|
||||||
|
} else {
|
||||||
|
// the source wasn't actually updated; so let's put ourselves in the queue
|
||||||
|
// so we get an dataUpdated() when the data does arrive
|
||||||
|
//kDebug() << "queued";
|
||||||
|
m_queued = true;
|
||||||
|
}
|
||||||
|
event->accept();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // Plasma namespace
|
||||||
|
|
||||||
|
#include "datacontainer_p.moc"
|
||||||
|
|
103
private/datacontainer_p.h
Normal file
103
private/datacontainer_p.h
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2006-2007 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 as
|
||||||
|
* published by the Free Software Foundation; either version 2, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* 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_DATACONTAINER_P_H
|
||||||
|
#define PLASMA_DATACONTAINER_P_H
|
||||||
|
|
||||||
|
#include <QtCore/QTimerEvent>
|
||||||
|
#include <QtCore/QTime>
|
||||||
|
|
||||||
|
namespace Plasma
|
||||||
|
{
|
||||||
|
|
||||||
|
class SignalRelay;
|
||||||
|
|
||||||
|
class DataContainerPrivate
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DataContainerPrivate()
|
||||||
|
: dirty(false), cached(false)
|
||||||
|
{}
|
||||||
|
|
||||||
|
SignalRelay* signalRelay(const DataContainer* dc, QObject *visualization,
|
||||||
|
uint pollingInterval, Plasma::IntervalAlignment align);
|
||||||
|
|
||||||
|
bool hasUpdates();
|
||||||
|
|
||||||
|
DataEngine::Data data;
|
||||||
|
QMap<QObject *, SignalRelay *> relayObjects;
|
||||||
|
QMap<uint, SignalRelay *> relays;
|
||||||
|
QTime updateTs;
|
||||||
|
bool dirty : 1;
|
||||||
|
bool cached : 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
class SignalRelay : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
SignalRelay(DataContainer* parent, DataContainerPrivate *data, uint ival, Plasma::IntervalAlignment align)
|
||||||
|
: QObject(parent),
|
||||||
|
dc(parent),
|
||||||
|
d(data),
|
||||||
|
m_interval(ival),
|
||||||
|
m_align(align),
|
||||||
|
m_resetTimer(true),
|
||||||
|
m_queued(false)
|
||||||
|
{
|
||||||
|
//kDebug() << "signal relay with time of" << m_timerId << "being set up";
|
||||||
|
m_timerId = startTimer(0);
|
||||||
|
if (m_align != Plasma::NoAlignment) {
|
||||||
|
checkAlignment();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int receiverCount() const
|
||||||
|
{
|
||||||
|
return receivers(SIGNAL(dataUpdated(QString,Plasma::DataEngine::Data)));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isUnused()
|
||||||
|
{
|
||||||
|
return receivers(SIGNAL(dataUpdated(QString,Plasma::DataEngine::Data))) < 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void checkAlignment();
|
||||||
|
void checkQueueing();
|
||||||
|
|
||||||
|
DataContainer *dc;
|
||||||
|
DataContainerPrivate *d;
|
||||||
|
uint m_interval;
|
||||||
|
Plasma::IntervalAlignment m_align;
|
||||||
|
int m_timerId;
|
||||||
|
bool m_resetTimer;
|
||||||
|
bool m_queued;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void dataUpdated(const QString&, const Plasma::DataEngine::Data&);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void timerEvent(QTimerEvent *event);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // Plasma namespace
|
||||||
|
|
||||||
|
#endif // multiple inclusion guard
|
||||||
|
|
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
#include <KIcon>
|
#include <KIcon>
|
||||||
|
|
||||||
#include <plasma/toolbox_p.h>
|
#include <private/toolbox_p.h>
|
||||||
|
|
||||||
#include "animator.h"
|
#include "animator.h"
|
||||||
|
|
@ -17,7 +17,7 @@
|
|||||||
* Boston, MA 02110-1301, USA. *
|
* Boston, MA 02110-1301, USA. *
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
#include "packages_p.h"
|
#include "private/packages_p.h"
|
||||||
|
|
||||||
#include <KConfigGroup>
|
#include <KConfigGroup>
|
||||||
#include <KDesktopFile>
|
#include <KDesktopFile>
|
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
#include <KIcon>
|
#include <KIcon>
|
||||||
|
|
||||||
#include <plasma/toolbox_p.h>
|
#include <private/toolbox_p.h>
|
||||||
|
|
||||||
#include "animator.h"
|
#include "animator.h"
|
||||||
|
|
@ -17,9 +17,13 @@
|
|||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef SERVICE_P_H
|
||||||
|
#define SERVICE_P_H
|
||||||
|
|
||||||
#include "servicejob.h"
|
#include "servicejob.h"
|
||||||
|
|
||||||
#include <KTemporaryFile>
|
#include <KTemporaryFile>
|
||||||
|
|
||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -83,4 +87,5 @@ public:
|
|||||||
|
|
||||||
} // namespace Plasma
|
} // namespace Plasma
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -19,7 +19,7 @@
|
|||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "toolbox_p.h"
|
#include "private/toolbox_p.h"
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QGraphicsSceneHoverEvent>
|
#include <QGraphicsSceneHoverEvent>
|
||||||
@ -76,7 +76,10 @@ void ToolBox::addTool(QAction *action)
|
|||||||
tool->setAction(action);
|
tool->setAction(action);
|
||||||
tool->setDrawBackground(true);
|
tool->setDrawBackground(true);
|
||||||
tool->setOrientation(Qt::Horizontal);
|
tool->setOrientation(Qt::Horizontal);
|
||||||
tool->resize(tool->sizeFromIconSize(22));
|
QSizeF iconSize = tool->sizeFromIconSize(22);
|
||||||
|
tool->setMinimumSize(iconSize);
|
||||||
|
tool->setMaximumSize(iconSize);
|
||||||
|
tool->resize(tool->size());
|
||||||
|
|
||||||
tool->hide();
|
tool->hide();
|
||||||
const int height = static_cast<int>(tool->boundingRect().height());
|
const int height = static_cast<int>(tool->boundingRect().height());
|
@ -18,7 +18,8 @@
|
|||||||
* Free Software Foundation, Inc.,
|
* Free Software Foundation, Inc.,
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
#include "tooltip_p.h"
|
|
||||||
|
#include "private/tooltip_p.h"
|
||||||
|
|
||||||
#include <QBitmap>
|
#include <QBitmap>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
@ -27,11 +27,12 @@
|
|||||||
#include "applet.h"
|
#include "applet.h"
|
||||||
#include "dataengine.h"
|
#include "dataengine.h"
|
||||||
#include "package.h"
|
#include "package.h"
|
||||||
#include "packages_p.h"
|
|
||||||
#include "scripting/appletscript.h"
|
#include "scripting/appletscript.h"
|
||||||
#include "scripting/dataenginescript.h"
|
#include "scripting/dataenginescript.h"
|
||||||
#include "scripting/runnerscript.h"
|
#include "scripting/runnerscript.h"
|
||||||
|
|
||||||
|
#include "private/packages_p.h"
|
||||||
|
|
||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "service.h"
|
#include "service.h"
|
||||||
#include "service_p.h"
|
#include "private/service_p.h"
|
||||||
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
#include <KStandardDirs>
|
#include <KStandardDirs>
|
||||||
#include <KGlobalSettings>
|
#include <KGlobalSettings>
|
||||||
|
|
||||||
#include "plasma/packages_p.h"
|
#include "private/packages_p.h"
|
||||||
|
|
||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
|
@ -40,12 +40,12 @@
|
|||||||
|
|
||||||
|
|
||||||
//Plasma
|
//Plasma
|
||||||
#include <plasma/applet.h>
|
#include <applet.h>
|
||||||
#include <plasma/containment.h>
|
#include <containment.h>
|
||||||
#include <plasma/panelsvg.h>
|
#include <panelsvg.h>
|
||||||
#include <plasma/theme.h>
|
#include <theme.h>
|
||||||
#include <plasma/tooltip_p.h>
|
#include <view.h>
|
||||||
#include <plasma/view.h>
|
#include <private/tooltip_p.h>
|
||||||
|
|
||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user