a bunch more coding style fixes. still some lines longer than 100 chars.

this is definitely helping me find false positives in the Krazy style checker.

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=870161
This commit is contained in:
Allen Winter 2008-10-11 22:48:38 +00:00
parent 254d4c7107
commit a7aebfa60a
27 changed files with 666 additions and 597 deletions

View File

@ -56,7 +56,8 @@ public:
if (!api.isEmpty()) {
const QString path = KStandardDirs::locate("data",
"plasma/runners/" + runnerDescription.pluginName() + '/');
PackageStructure::Ptr structure = Plasma::packageStructure(api, Plasma::RunnerComponent);
PackageStructure::Ptr structure =
Plasma::packageStructure(api, Plasma::RunnerComponent);
structure->setPath(path);
package = new Package(path, structure);

View File

@ -199,7 +199,6 @@ Animator* Animator::self()
return &privateSelf->self;
}
Animator::Animator(QObject *parent)
: QObject(parent),
d(new AnimatorPrivate)
@ -298,8 +297,10 @@ int Animator::animateItem(QGraphicsItem* item, Animation animation)
if (state->qobj) {
//kDebug() << "!!!!!!!!!!!!!!!!!!!!!!!!! got us an object!";
disconnect(state->qobj, SIGNAL(destroyed(QObject*)), this, SLOT(animatedItemDestroyed(QObject*)));
connect(state->qobj, SIGNAL(destroyed(QObject*)), this, SLOT(animatedItemDestroyed(QObject*)));
disconnect(state->qobj, SIGNAL(destroyed(QObject*)),
this, SLOT(animatedItemDestroyed(QObject*)));
connect(state->qobj, SIGNAL(destroyed(QObject*)),
this, SLOT(animatedItemDestroyed(QObject*)));
}
d->animatedItems[item] = state;
@ -458,11 +459,14 @@ int Animator::animateElement(QGraphicsItem *item, Animation animation)
state->qobj = dynamic_cast<QObject*>(item);
if (state->qobj) {
disconnect(state->qobj, SIGNAL(destroyed(QObject*)), this, SLOT(animatedElementDestroyed(QObject*)));
connect(state->qobj, SIGNAL(destroyed(QObject*)), this, SLOT(animatedElementDestroyed(QObject*)));
disconnect(state->qobj, SIGNAL(destroyed(QObject*)),
this, SLOT(animatedElementDestroyed(QObject*)));
connect(state->qobj, SIGNAL(destroyed(QObject*)),
this, SLOT(animatedElementDestroyed(QObject*)));
}
//kDebug() << "animateElement " << animation << ", interval: " << state->interval << ", frames: " << state->frames;
//kDebug() << "animateElement " << animation << ", interval: "
// << state->interval << ", frames: " << state->frames;
bool needTimer = true;
if (state->frames < 1) {
state->frames = 1;
@ -555,7 +559,8 @@ void Animator::timerEvent(QTimerEvent *event)
foreach (AnimationState *state, d->animatedItems) {
if (state->currentInterval <= elapsed) {
// we need to step forward!
state->currentFrame += (KGlobalSettings::graphicEffectsLevel() & KGlobalSettings::SimpleAnimationEffects) ?
state->currentFrame +=
(KGlobalSettings::graphicEffectsLevel() & KGlobalSettings::SimpleAnimationEffects) ?
qMax(1, elapsed / state->interval) : state->frames - state->currentFrame;
if (state->currentFrame < state->frames) {
@ -580,7 +585,8 @@ void Animator::timerEvent(QTimerEvent *event)
foreach (MovementState *state, d->movingItems) {
if (state->currentInterval <= elapsed) {
// we need to step forward!
state->currentFrame += (KGlobalSettings::graphicEffectsLevel() & KGlobalSettings::SimpleAnimationEffects) ?
state->currentFrame +=
(KGlobalSettings::graphicEffectsLevel() & KGlobalSettings::SimpleAnimationEffects) ?
qMax(1, elapsed / state->interval) : state->frames - state->currentFrame;
if (state->currentFrame < state->frames) {
@ -605,7 +611,8 @@ void Animator::timerEvent(QTimerEvent *event)
foreach (ElementAnimationState *state, d->animatedElements) {
if (state->currentFrame == state->frames) {
//kDebug() << "skipping" << state->id << "as its already at frame" << state->currentFrame << "of" << state->frames;
//kDebug() << "skipping" << state->id << "as its already at frame"
// << state->currentFrame << "of" << state->frames;
// since we keep element animations around until they are
// removed, we will end up with finished animations in the queue;
// just skip them
@ -615,10 +622,12 @@ void Animator::timerEvent(QTimerEvent *event)
if (state->currentInterval <= elapsed) {
// we need to step forward!
/*kDebug() << "stepping forwards element anim " << state->id << " from " << state->currentFrame
/*kDebug() << "stepping forwards element anim " << state->id
<< " from " << state->currentFrame
<< " by " << qMax(1, elapsed / state->interval) << " to "
<< state->currentFrame + qMax(1, elapsed / state->interval) << endl;*/
state->currentFrame += (KGlobalSettings::graphicEffectsLevel() & KGlobalSettings::SimpleAnimationEffects) ?
state->currentFrame +=
(KGlobalSettings::graphicEffectsLevel() & KGlobalSettings::SimpleAnimationEffects) ?
qMax(1, elapsed / state->interval) : state->frames - state->currentFrame;
state->item->update();
@ -639,10 +648,13 @@ void Animator::timerEvent(QTimerEvent *event)
foreach (CustomAnimationState *state, d->customAnims) {
if (state->currentInterval <= elapsed) {
// advance the frame
state->currentFrame += (KGlobalSettings::graphicEffectsLevel() & KGlobalSettings::SimpleAnimationEffects) ?
state->currentFrame +=
(KGlobalSettings::graphicEffectsLevel() & KGlobalSettings::SimpleAnimationEffects) ?
qMax(1, elapsed / state->interval) : state->frames - state->currentFrame;
/*kDebug() << "custom anim for" << state->receiver << "to slot" << state->slot
<< "with interval of" << state->interval << "at frame" << state->currentFrame;*/
/*kDebug() << "custom anim for" << state->receiver
<< "to slot" << state->slot
<< "with interval of" << state->interval
<< "at frame" << state->currentFrame;*/
if (state->currentFrame < state->frames) {
//kDebug () << "not the final frame";
@ -696,11 +708,13 @@ void AnimatorPrivate::init(Animator *q)
KPluginLoader plugin(*offers.first());
if (Plasma::isPluginVersionCompatible(plugin.pluginVersion()))
if (Plasma::isPluginVersionCompatible(plugin.pluginVersion())) {
driver = offers.first()->createInstance<Plasma::AnimationDriver>(0, QVariantList(), &error);
}
if (!driver) {
kDebug() << "Could not load requested animator " << offers.first() << ". Error given: " << error;
kDebug() << "Could not load requested animator "
<< offers.first() << ". Error given: " << error;
}
}
}

View File

@ -100,7 +100,8 @@ Applet::Applet(QGraphicsItem *parent,
Applet::Applet(QObject *parentObject, const QVariantList &args)
: QGraphicsWidget(0),
d(new AppletPrivate(KService::serviceByStorageId(args.count() > 0 ? args[0].toString() : QString()),
d(new AppletPrivate(
KService::serviceByStorageId(args.count() > 0 ? args[0].toString() : QString()),
args.count() > 1 ? args[1].toInt() : 0, this))
{
// now remove those first two items since those are managed by Applet and subclasses shouldn't
@ -185,7 +186,8 @@ void Applet::save(KConfigGroup &g) const
group.writeEntry("plugin", pluginName());
//FIXME: for containments, we need to have some special values here w/regards to
// screen affinity (e.g. "bottom of screen 0")
//kDebug() << pluginName() << "geometry is" << geometry() << "pos is" << pos() << "bounding rect is" << boundingRect();
//kDebug() << pluginName() << "geometry is" << geometry()
// << "pos is" << pos() << "bounding rect is" << boundingRect();
group.writeEntry("geometry", geometry());
group.writeEntry("zvalue", zValue());
@ -210,7 +212,6 @@ void Applet::save(KConfigGroup &g) const
}
}
void Applet::restore(KConfigGroup &group)
{
QList<qreal> m = group.readEntry("transform", QList<qreal>());
@ -412,7 +413,8 @@ void AppletPrivate::cleanUpAndDelete()
//it probably won't matter, but right now if there are applethandles, *they* are the parent.
//not the containment.
//is the applet in a containment and is the containment have a layout? if yes, we remove the applet in the layout
//is the applet in a containment and is the containment have a layout?
//if yes, we remove the applet in the layout
if (parent && parent->layout()) {
QGraphicsLayout *l = parent->layout();
for (int i = 0; i < l->count(); ++i) {
@ -469,7 +471,8 @@ QGraphicsView *Applet::view() const
QGraphicsView *possibleFind = 0;
//kDebug() << "looking through" << scene()->views().count() << "views";
foreach (QGraphicsView *view, scene()->views()) {
//kDebug() << " checking" << view << view->sceneRect() << "against" << sceneBoundingRect() << scenePos();
//kDebug() << " checking" << view << view->sceneRect()
// << "against" << sceneBoundingRect() << scenePos();
if (view->sceneRect().intersects(sceneBoundingRect()) ||
view->sceneRect().contains(scenePos())) {
//kDebug() << " found something!" << view->isActiveWindow();
@ -487,13 +490,13 @@ QGraphicsView *Applet::view() const
QRectF Applet::mapFromView(const QGraphicsView *view, const QRect &rect) const
{
// Why is this adjustment needed? Qt calculation error?
return mapFromScene(view->mapToScene(rect)).boundingRect().adjusted(0, 0, 1, 1);;
return mapFromScene(view->mapToScene(rect)).boundingRect().adjusted(0, 0, 1, 1);
}
QRect Applet::mapToView(const QGraphicsView *view, const QRectF &rect) const
{
// Why is this adjustment needed? Qt calculation error?
return view->mapFromScene(mapToScene(rect)).boundingRect().adjusted(0, 0, -1, -1);;
return view->mapFromScene(mapToScene(rect)).boundingRect().adjusted(0, 0, -1, -1);
}
QPoint Applet::popupPosition(const QSize &s) const
@ -513,7 +516,8 @@ void Applet::constraintsEvent(Plasma::Constraints constraints)
// without calling the Applet:: version as well, which it shouldn't need to.
// INSTEAD put such code into flushPendingConstraintsEvents
Q_UNUSED(constraints)
//kDebug() << constraints << "constraints are FormFactor: " << formFactor() << ", Location: " << location();
//kDebug() << constraints << "constraints are FormFactor: " << formFactor()
// << ", Location: " << location();
if (d->script) {
d->script->constraintsEvent(constraints);
}
@ -688,7 +692,8 @@ bool Applet::hasFailedToLaunch() const
return d->failed;
}
void Applet::paintWindowFrame(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget)
void Applet::paintWindowFrame(QPainter *painter,
const QStyleOptionGraphicsItem *option, QWidget *widget)
{
Q_UNUSED(painter)
Q_UNUSED(option)
@ -770,7 +775,7 @@ void Applet::flushPendingConstraintsEvents()
d->constraintsTimerId = 0;
}
//kDebug() << "fushing constraints: " << d->pendingConstraints << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!";
//kDebug() << "fushing constraints: " << d->pendingConstraints << "!!!!!!!!!!!!!!!!!!!!!!!!!!!";
Plasma::Constraints c = d->pendingConstraints;
d->pendingConstraints = NoConstraint;
@ -872,7 +877,6 @@ void Applet::flushPendingConstraintsEvents()
updateGeometry();
}
Containment* containment = qobject_cast<Plasma::Containment*>(this);
if (isContainment() && containment) {
containment->d->containmentConstraintsEvent(c);
@ -948,9 +952,9 @@ void Applet::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QW
if (!d->failed) {
qreal left, top, right, bottom;
getContentsMargins(&left, &top, &right, &bottom);
QRect contentsRect = QRectF(QPointF(0,0), boundingRect().size())
.adjusted(left, top, -right, -bottom).toRect();
QRect contentsRect =
QRectF(QPointF(0, 0),
boundingRect().size()).adjusted(left, top, -right, -bottom).toRect();
if (widget && isContainment()) {
// note that the widget we get is actually the viewport of the view, not the view itself
@ -1046,7 +1050,8 @@ void Applet::setGlobalShortcut(const KShortcut &shortcut)
}
//kDebug() << "before" << shortcut.primary() << d->activationAction->globalShortcut().primary();
d->activationAction->setGlobalShortcut(shortcut,
d->activationAction->setGlobalShortcut(
shortcut,
KAction::ShortcutTypes(KAction::ActiveShortcut | KAction::DefaultShortcut),
KAction::NoAutoloading);
//kDebug() << "after" << shortcut.primary() << d->activationAction->globalShortcut().primary();
@ -1170,7 +1175,8 @@ bool Applet::eventFilter( QObject *o, QEvent * e )
bool Applet::sceneEventFilter(QGraphicsItem *watched, QEvent *event)
{
switch (event->type()) {
case QEvent::GraphicsSceneMouseMove: {
case QEvent::GraphicsSceneMouseMove:
{
// don't move when the containment is not mutable,
// in the rare case the containment doesn't exists consider it as mutable
if ((!containment() || containment()->immutability() == Mutable) &&
@ -1202,7 +1208,8 @@ void Applet::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
moveBy(delta.x(), delta.y());
} else if (parent) {
//don't move the icon as well because our parent (usually an appletHandle) will do it for us
//don't move the icon as well because our parent
//(usually an appletHandle) will do it for us
//parent->moveBy(delta.x(),delta.y());
QPointF curPos = parent->transform().map(event->pos());
QPointF lastPos = parent->transform().map(event->lastPos());
@ -1355,7 +1362,8 @@ KPluginInfo::List Applet::listAppletInfo(const QString &category,
}
KService::List offers = KServiceTypeTrader::self()->query("Plasma/Applet", constraint);
//kDebug() << "Applet::listAppletInfo constraint was '" << constraint << "' which got us " << offers.count() << " matches";
//kDebug() << "Applet::listAppletInfo constraint was '" << constraint
// << "' which got us " << offers.count() << " matches";
return KPluginInfo::fromServices(offers);
}
@ -1406,7 +1414,6 @@ Applet* Applet::load(const QString& appletName, uint appletId, const QVariantLis
return 0;
}
QString constraint = QString("[X-KDE-PluginInfo-Name] == '%1'").arg(appletName);
KService::List offers = KServiceTypeTrader::self()->query("Plasma/Applet", constraint);
@ -1431,7 +1438,8 @@ Applet* Applet::load(const QString& appletName, uint appletId, const QVariantLis
}
if (!offer->property("X-Plasma-API").toString().isEmpty()) {
kDebug() << "we have a script using the" << offer->property("X-Plasma-API").toString() << "API";
kDebug() << "we have a script using the"
<< offer->property("X-Plasma-API").toString() << "API";
if (isContainment) {
return new Containment(0, offer->storageId(), appletId);
}
@ -1440,7 +1448,8 @@ Applet* Applet::load(const QString& appletName, uint appletId, const QVariantLis
KPluginLoader plugin(*offer);
if (!Plasma::isPluginVersionCompatible(plugin.pluginVersion()) && (appletName != "internal:extender")) {
if (!Plasma::isPluginVersionCompatible(plugin.pluginVersion()) &&
(appletName != "internal:extender")) {
return 0;
}
@ -1477,7 +1486,8 @@ QVariant Applet::itemChange(GraphicsItemChange change, const QVariant &value)
//kDebug() << change;
switch (change) {
case ItemSceneHasChanged: {
case ItemSceneHasChanged:
{
QGraphicsScene *newScene = qvariant_cast<QGraphicsScene*>(value);
if (newScene) {
d->checkImmutability();
@ -1487,7 +1497,8 @@ QVariant Applet::itemChange(GraphicsItemChange change, const QVariant &value)
case ItemPositionHasChanged:
emit geometryChanged();
// fall through!
case ItemTransformHasChanged: {
case ItemTransformHasChanged:
{
if (d->modificationsTimerId != -1) {
if (d->modificationsTimerId) {
killTimer(d->modificationsTimerId);
@ -1532,10 +1543,12 @@ QSizeF Applet::sizeHint(Qt::SizeHint which, const QSizeF & constraint) const
}
} else if (d->aspectRatioMode == Plasma::ConstrainedSquare) {
//enforce a size not wider than tall
if (formFactor() == Horizontal && (which == Qt::MaximumSize || size().height() <= KIconLoader::SizeLarge)) {
if (formFactor() == Horizontal &&
(which == Qt::MaximumSize || size().height() <= KIconLoader::SizeLarge)) {
hint.setWidth(size().height());
//enforce a size not taller than wide
} else if (formFactor() == Vertical && (which == Qt::MaximumSize || size().width() <= KIconLoader::SizeLarge)) {
} else if (formFactor() == Vertical &&
(which == Qt::MaximumSize || size().width() <= KIconLoader::SizeLarge)) {
hint.setHeight(size().width());
}
}
@ -1629,7 +1642,6 @@ bool Applet::isContainment() const
return d->isContainment;
}
// PRIVATE CLASS IMPLEMENTATION
AppletPrivate::AppletPrivate(KService::Ptr service, int uniqueID, Applet *applet)

View File

@ -112,7 +112,8 @@ void AppletBrowserWidgetPrivate::initFilters()
appletList->addEmblem(i18n("Recommended by %1", caption), KIcon(icon),
KCategorizedItemsViewModels::Filter("recommended." + id, true));
filterModel.addFilter(i18n("Recommended by %1", caption),
KCategorizedItemsViewModels::Filter("recommended." + id, true), KIcon(icon));
KCategorizedItemsViewModels::Filter("recommended." + id, true),
KIcon(icon));
}
// Filters: Special
@ -331,7 +332,8 @@ void AppletBrowserWidget::downloadWidgets()
void AppletBrowserWidget::openWidgetFile()
{
// TODO: if we already have one of these showing and the user clicks to add it again, show the same window?
// TODO: if we already have one of these showing and the user clicks to
// add it again, show the same window?
OpenWidgetAssistant *assistant = new OpenWidgetAssistant(topLevelWidget());
assistant->setAttribute(Qt::WA_DeleteOnClose, true);
assistant->show();

View File

@ -203,8 +203,10 @@ class ConfigXmlHandler : public QXmlDefaultHandler
{
public:
ConfigXmlHandler(ConfigXml *config, ConfigXmlPrivate *d);
bool startElement(const QString &namespaceURI, const QString & localName, const QString &qName, const QXmlAttributes &atts);
bool endElement(const QString &namespaceURI, const QString &localName, const QString &qName);
bool startElement(const QString &namespaceURI, const QString &localName,
const QString &qName, const QXmlAttributes &atts);
bool endElement(const QString &namespaceURI, const QString &localName,
const QString &qName);
bool characters(const QString &ch);
private:
@ -306,7 +308,8 @@ bool ConfigXmlHandler::characters(const QString &ch)
return true;
}
bool ConfigXmlHandler::endElement(const QString &namespaceURI, const QString &localName, const QString &qName)
bool ConfigXmlHandler::endElement(const QString &namespaceURI,
const QString &localName, const QString &qName)
{
Q_UNUSED(namespaceURI)
Q_UNUSED(qName)
@ -391,12 +394,11 @@ void ConfigXmlHandler::addItem()
item = m_config->addItemString(m_name, *d->newString(), m_default, m_key);
} else if (m_type == "stringlist") {
//FIXME: the split() is naive and will break on lists with ,'s in them
item = m_config->addItemStringList(m_name, *d->newStringList(), m_default.split(","), m_key);
item = m_config->addItemStringList(m_name, *d->newStringList(),
m_default.split(","), m_key);
} else if (m_type == "uint") {
KConfigSkeleton::ItemUInt* uintItem = m_config->addItemUInt(m_name,
*d->newUint(),
m_default.toUInt(),
m_key);
KConfigSkeleton::ItemUInt *uintItem =
m_config->addItemUInt(m_name, *d->newUint(), m_default.toUInt(), m_key);
if (m_haveMin) {
uintItem->setMinValue(m_min);
}
@ -442,7 +444,8 @@ void ConfigXmlHandler::addItem()
/* No addItemPathList in KConfigSkeleton ?
} else if (m_type == "PathList") {
//FIXME: the split() is naive and will break on lists with ,'s in them
item = m_config->addItemPathList(m_name, *d->newStringList(), m_default.split(","), m_key); */
item = m_config->addItemPathList(m_name, *d->newStringList(), m_default.split(","), m_key);
*/
} else if (m_type == "point") {
QPoint defaultPoint;
QStringList tmpList = m_default.split(",");
@ -468,8 +471,8 @@ void ConfigXmlHandler::addItem()
}
item = m_config->addItemSize(m_name, *d->newSize(), defaultSize, m_key);
} else if (m_type == "ulonglong") {
KConfigSkeleton::ItemULongLong* ulonglongItem = m_config->addItemULongLong(m_name,
*d->newULongLong(), m_default.toULongLong(), m_key);
KConfigSkeleton::ItemULongLong *ulonglongItem =
m_config->addItemULongLong(m_name, *d->newULongLong(), m_default.toULongLong(), m_key);
if (m_haveMin) {
ulonglongItem->setMinValue(m_min);
}

View File

@ -163,9 +163,11 @@ void Containment::init()
if (immutability() != SystemImmutable) {
//FIXME I'm not certain this belongs in Containment
//but it sure is nice to have the keyboard shortcut in every containment by default
QAction *lockDesktopAction = new QAction(unlocked ? i18n("Lock Widgets") : i18n("Unlock Widgets"), this);
QAction *lockDesktopAction =
new QAction(unlocked ? i18n("Lock Widgets") : i18n("Unlock Widgets"), this);
lockDesktopAction->setIcon(KIcon(unlocked ? "object-locked" : "object-unlocked"));
connect(lockDesktopAction, SIGNAL(triggered(bool)), this, SLOT(toggleDesktopImmutability()));
connect(lockDesktopAction, SIGNAL(triggered(bool)),
this, SLOT(toggleDesktopImmutability()));
lockDesktopAction->setShortcutContext(Qt::WidgetShortcut);
lockDesktopAction->setShortcut(QKeySequence("ctrl+l"));
d->actions().addAction("lock widgets", lockDesktopAction);
@ -338,7 +340,9 @@ void Containment::restoreContents(KConfigGroup &group)
continue;
}
Applet *applet = d->addApplet(plugin, QVariantList(), appletConfig.readEntry("geometry", QRectF()), appId, true);
Applet *applet =
d->addApplet(plugin, QVariantList(),
appletConfig.readEntry("geometry", QRectF()), appId, true);
applet->restore(appletConfig);
}
}
@ -442,7 +446,8 @@ void Containment::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
}
}
bool ContainmentPrivate::showContextMenu(const QPointF &point, const QPoint &screenPos, bool includeApplet)
bool ContainmentPrivate::showContextMenu(const QPointF &point,
const QPoint &screenPos, bool includeApplet)
{
Applet *applet = 0;
@ -631,7 +636,8 @@ void Containment::clearApplets()
d->applets.clear();
}
Applet* Containment::addApplet(const QString& name, const QVariantList& args, const QRectF &appletGeometry)
Applet *Containment::addApplet(const QString &name, const QVariantList &args,
const QRectF &appletGeometry)
{
return d->addApplet(name, args, appletGeometry);
}
@ -721,16 +727,20 @@ void Containment::setScreen(int screen)
#ifndef Q_OS_WIN
// we want to listen to changes in work area if our screen changes
if (d->screen < 0 && screen > -1) {
connect(KWindowSystem::self(), SIGNAL(workAreaChanged()), this, SLOT(positionToolBox()));
connect(KWindowSystem::self(), SIGNAL(workAreaChanged()),
this, SLOT(positionToolBox()));
} else if (screen < 0) {
disconnect(KWindowSystem::self(), SIGNAL(workAreaChanged()), this, SLOT(positionToolBox()));
disconnect(KWindowSystem::self(), SIGNAL(workAreaChanged()),
this, SLOT(positionToolBox()));
}
#endif
if (screen > -1 && corona()) {
// sanity check to make sure someone else doesn't have this screen already!
Containment *currently = corona()->containmentForScreen(screen);
if (currently && currently != this) {
//kDebug() << "currently is on screen" << currently->screen() << "and is" << currently->name() << (QObject*)currently << (QObject*)this;
//kDebug() << "currently is on screen" << currently->screen()
// << "and is" << currently->name()
// << (QObject*)currently << (QObject*)this;
currently->setScreen(-1);
}
}
@ -790,7 +800,8 @@ QPoint Containment::effectiveScreenPos() const
return QPoint(r.left(), r.top() + (p.bottom() + INTER_CONTAINMENT_MARGIN));
break;
case RightEdge:
return QPoint(r.right() - p.width(), r.top() + (p.bottom() + INTER_CONTAINMENT_MARGIN));
return QPoint(r.right() - p.width(),
r.top() + (p.bottom() + INTER_CONTAINMENT_MARGIN));
break;
default:
//FIXME: implement properly for Floating!
@ -985,7 +996,6 @@ void Containment::dropEvent(QGraphicsSceneDragDropEvent *event)
stream.writeRawData(data, data.size());
}
QRectF geom(event->pos(), QSize());
QVariantList args;
args << tempFile.fileName();
@ -1008,7 +1018,8 @@ void Containment::resizeEvent(QGraphicsSceneResizeEvent *event)
void Containment::keyPressEvent(QKeyEvent *event)
{
//kDebug() << "keyPressEvent with" << event->key() << "and hoping and wishing for a" << Qt::Key_Tab;
//kDebug() << "keyPressEvent with" << event->key()
// << "and hoping and wishing for a" << Qt::Key_Tab;
if (event->key() == Qt::Key_Tab) { // && event->modifiers() == 0) {
if (!d->applets.isEmpty()) {
kDebug() << "let's give focus to...." << (QObject*)d->applets.first();
@ -1093,8 +1104,8 @@ QVariant Containment::itemChange(GraphicsItemChange change, const QVariant &valu
//FIXME if the applet is moved to another containment we need to unfocus it
if (isContainment() &&
(change == QGraphicsItem::ItemSceneHasChanged || change == QGraphicsItem::ItemPositionHasChanged) &&
!d->positioning) {
(change == QGraphicsItem::ItemSceneHasChanged ||
change == QGraphicsItem::ItemPositionHasChanged) && !d->positioning) {
switch (containmentType()) {
case PanelContainment:
case CustomPanelContainment:
@ -1379,7 +1390,9 @@ void Containment::destroy(bool confirm)
//FIXME maybe that %1 should be the containment type not the name
if (!confirm ||
KMessageBox::warningContinueCancel(view(), i18n("Do you really want to remove this %1?", name()),
KMessageBox::warningContinueCancel(
view(),
i18n("Do you really want to remove this %1?", name()),
i18n("Remove %1", name()), KStandardGuiItem::remove()) == KMessageBox::Continue) {
//clearApplets();
Applet::destroy();
@ -1479,14 +1492,17 @@ void ContainmentPrivate::positionToolBox()
if (type == Containment::PanelContainment) {
if (q->formFactor() == Vertical) {
toolBox->setCorner(ToolBox::Bottom);
toolBox->setPos(q->geometry().width()/2 - toolBox->boundingRect().width()/2, q->geometry().height());
toolBox->setPos(q->geometry().width() / 2 - toolBox->boundingRect().width() / 2,
q->geometry().height());
//defaulting to Horizontal right now
} else {
if (QApplication::layoutDirection() == Qt::RightToLeft) {
toolBox->setPos(q->geometry().left(), q->geometry().height()/2 - toolBox->boundingRect().height()/2);
toolBox->setPos(q->geometry().left(),
q->geometry().height() / 2 - toolBox->boundingRect().height() / 2);
toolBox->setCorner(ToolBox::Left);
} else {
toolBox->setPos(q->geometry().width(), q->geometry().height()/2 - toolBox->boundingRect().height()/2);
toolBox->setPos(q->geometry().width(),
q->geometry().height() / 2 - toolBox->boundingRect().height() / 2);
toolBox->setCorner(ToolBox::Right);
}
}
@ -1892,7 +1908,6 @@ void ContainmentPrivate::positionPanel(bool force)
positioning = false;
}
} // Plasma namespace
#include "containment.moc"

View File

@ -112,7 +112,8 @@ public:
emit q->configSynced();
}
Containment* addContainment(const QString& name, const QVariantList& args, uint id, bool delayedInit)
Containment *addContainment(const QString &name, const QVariantList &args,
uint id, bool delayedInit)
{
QString pluginName = name;
Containment *containment = 0;
@ -133,7 +134,8 @@ public:
if (!containment) {
kDebug() << "loading of containment" << name << "failed.";
// in case we got a non-Containment from Applet::loadApplet or a null containment was requested
// in case we got a non-Containment from Applet::loadApplet or
// a null containment was requested
delete applet;
containment = new Containment(0, 0, id);
@ -158,9 +160,12 @@ public:
}
containments.append(containment);
QObject::connect(containment, SIGNAL(destroyed(QObject*)), q, SLOT(containmentDestroyed(QObject*)));
QObject::connect(containment, SIGNAL(configNeedsSaving()), q, SLOT(requestConfigSync()));
QObject::connect(containment, SIGNAL(releaseVisualFocus()), q, SIGNAL(releaseVisualFocus()));
QObject::connect(containment, SIGNAL(destroyed(QObject*)),
q, SLOT(containmentDestroyed(QObject*)));
QObject::connect(containment, SIGNAL(configNeedsSaving()),
q, SLOT(requestConfigSync()));
QObject::connect(containment, SIGNAL(releaseVisualFocus()),
q, SIGNAL(releaseVisualFocus()));
QObject::connect(containment, SIGNAL(screenChanged(int,int,Plasma::Containment*)),
q, SIGNAL(screenOwnerChanged(int,int,Plasma::Containment*)));

View File

@ -41,7 +41,6 @@
namespace Plasma
{
DataEngine::DataEngine(QObject *parent, KService::Ptr service)
: QObject(parent),
d(new DataEnginePrivate(this, service))
@ -73,17 +72,20 @@ Service* DataEngine::serviceForSource(const QString &source)
}
void DataEngine::connectSource(const QString &source, QObject *visualization,
uint pollingInterval, Plasma::IntervalAlignment intervalAlignment) const
uint pollingInterval,
Plasma::IntervalAlignment intervalAlignment) const
{
//kDebug() << "connectSource" << source;
bool newSource;
DataContainer *s = d->requestSource(source, &newSource);
if (s) {
// we suppress the immediate invocation of dataUpdated here if the source was prexisting and they
// don't request delayed updates (we want to do an immediate update in that case so they
// don't have to wait for the first time out)
d->connectSource(s, visualization, pollingInterval, intervalAlignment, !newSource || pollingInterval > 0);
// we suppress the immediate invocation of dataUpdated here if the
// source was prexisting and they don't request delayed updates
// (we want to do an immediate update in that case so they don't
// have to wait for the first time out)
d->connectSource(s, visualization, pollingInterval, intervalAlignment,
!newSource || pollingInterval > 0);
//kDebug() << " ==> source connected";
}
}
@ -446,9 +448,11 @@ DataEnginePrivate::DataEnginePrivate(DataEngine* e, KService::Ptr service)
QString api = dataEngineDescription.property("X-Plasma-API").toString();
if (!api.isEmpty()) {
const QString path = KStandardDirs::locate("data",
const QString path =
KStandardDirs::locate("data",
"plasma/engines/" + dataEngineDescription.pluginName() + '/');
PackageStructure::Ptr structure = Plasma::packageStructure(api, Plasma::RunnerComponent);
PackageStructure::Ptr structure =
Plasma::packageStructure(api, Plasma::RunnerComponent);
structure->setPath(path);
package = new Package(path, structure);
@ -546,8 +550,10 @@ DataContainer* DataEnginePrivate::source(const QString& sourceName, bool createW
return s;
}
void DataEnginePrivate::connectSource(DataContainer* s, QObject* visualization, uint pollingInterval,
Plasma::IntervalAlignment align, bool immediateCall)
void DataEnginePrivate::connectSource(DataContainer *s, QObject *visualization,
uint pollingInterval,
Plasma::IntervalAlignment align,
bool immediateCall)
{
//kDebug() << "connect source called" << s->objectName() << "with interval" << pollingInterval;
if (pollingInterval > 0) {

View File

@ -132,9 +132,10 @@ Plasma::DataEngine* DataEngineManager::loadEngine(const QString& name)
if (api.isEmpty()) {
if (offers.first()) {
KPluginLoader plugin(*offers.first());
if (Plasma::isPluginVersionCompatible(plugin.pluginVersion()))
if (Plasma::isPluginVersionCompatible(plugin.pluginVersion())) {
engine = offers.first()->createInstance<Plasma::DataEngine>(0, allArgs, &error);
}
}
} else {
engine = new DataEngine(0, offers.first());
}

View File

@ -69,7 +69,6 @@ class DelegatePrivate
static const int ITEM_BOTTOM_MARGIN = 5;
};
QFont DelegatePrivate::fontForSubTitle(const QFont &titleFont) const
{
QFont subTitleFont = titleFont;
@ -84,13 +83,18 @@ QRect DelegatePrivate::titleRect(const QStyleOptionViewItem& option, const QMode
font.setBold(true);
QFontMetrics fm(font);
Qt::Alignment textAlignment = option.decorationAlignment & Qt::AlignRight ? Qt::AlignRight : Qt::AlignLeft;
Qt::Alignment textAlignment =
option.decorationAlignment & Qt::AlignRight ? Qt::AlignRight : Qt::AlignLeft;
QRect emptyRect;
if (option.direction == Qt::LeftToRight) {
emptyRect = option.rect.adjusted(option.decorationSize.width()+ICON_TEXT_MARGIN+ITEM_LEFT_MARGIN, ITEM_TOP_MARGIN, -ITEM_RIGHT_MARGIN, -ITEM_BOTTOM_MARGIN);
emptyRect = option.rect.adjusted(
option.decorationSize.width() + ICON_TEXT_MARGIN + ITEM_LEFT_MARGIN,
ITEM_TOP_MARGIN, -ITEM_RIGHT_MARGIN, -ITEM_BOTTOM_MARGIN);
} else {
emptyRect = option.rect.adjusted(ITEM_LEFT_MARGIN, ITEM_TOP_MARGIN, -ITEM_RIGHT_MARGIN-option.decorationSize.width()-ICON_TEXT_MARGIN, -ITEM_BOTTOM_MARGIN);
emptyRect = option.rect.adjusted(
ITEM_LEFT_MARGIN, ITEM_TOP_MARGIN,
-ITEM_RIGHT_MARGIN - option.decorationSize.width() - ICON_TEXT_MARGIN, -ITEM_BOTTOM_MARGIN);
}
if (emptyRect.width() < 0) {
@ -98,7 +102,8 @@ QRect DelegatePrivate::titleRect(const QStyleOptionViewItem& option, const QMode
return emptyRect;
}
QRect textRect = QStyle::alignedRect(option.direction,
QRect textRect = QStyle::alignedRect(
option.direction,
textAlignment,
fm.boundingRect(index.data(Qt::DisplayRole).toString()).size(),
emptyRect);
@ -108,7 +113,8 @@ QRect DelegatePrivate::titleRect(const QStyleOptionViewItem& option, const QMode
return textRect;
}
QRect DelegatePrivate::subTitleRect(const QStyleOptionViewItem& option, const QModelIndex& index) const
QRect DelegatePrivate::subTitleRect(const QStyleOptionViewItem &option,
const QModelIndex &index) const
{
QString subTitle = index.data(roles[Delegate::SubTitleRole]).toString();
@ -202,15 +208,16 @@ QRect Delegate::emptyRect(const QStyleOptionViewItem& option, const QModelIndex&
return afterTitleRect.intersected(afterSubTitleRect);
}
void Delegate::paint(QPainter *painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
void Delegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
const QModelIndex &index) const
{
const bool hover = option.state & (QStyle::State_MouseOver | QStyle::State_Selected);
QRect contentRect = option.rect;
contentRect.setBottom(contentRect.bottom() - 1);
QRect decorationRect = QStyle::alignedRect(option.direction,
QRect decorationRect =
QStyle::alignedRect(option.direction,
option.decorationPosition == QStyleOptionViewItem::Left ?
Qt::AlignLeft : Qt::AlignRight,
option.decorationSize,
@ -223,7 +230,6 @@ void Delegate::paint(QPainter *painter, const QStyleOptionViewItem& option, cons
QRect titleRect = d->titleRect(option, index);
QRect subTitleRect = d->subTitleRect(option, index);
bool uniqueTitle = !index.data(d->roles[SubTitleMandatoryRole]).value<bool>();// true;
if (uniqueTitle) {
QModelIndex sib = index.sibling(index.row() + 1, index.column());
@ -377,5 +383,3 @@ QSize Delegate::sizeHint(const QStyleOptionViewItem& option, const QModelIndex&
}
}

View File

@ -160,7 +160,8 @@ class ExtenderItemPrivate
returnToSource->setMaximumSize(iconSize);
toolboxLayout->addItem(returnToSource);
QObject::connect(returnToSource, SIGNAL(clicked()), q, SLOT(moveBackToSource()));
QObject::connect(returnToSource, SIGNAL(clicked()),
q, SLOT(moveBackToSource()));
}
toolboxLayout->updateGeometry();
@ -178,8 +179,9 @@ class ExtenderItemPrivate
//TODO: something like this as static function in corona might be a good idea.
QPointF scenePosFromScreenPos(const QPoint &pos) const
{
//get the stacking order of the toplevel windows and remove the toplevel view that's
//only here while dragging, since we're not interested in finding that.
//get the stacking order of the toplevel windows and remove the
//toplevel view that's only here while dragging, since we're not
//interested in finding that.
QList<WId> order = KWindowSystem::stackingOrder();
if (toplevel) {
order.removeOne(toplevel->winId());
@ -345,8 +347,7 @@ ExtenderItem::ExtenderItem(Extender *hostExtender, uint extenderItemId)
d->collapseIcon = new Icon(KIcon(hostExtender->d->applet->icon()), "", this);
d->collapseIcon->resize(d->collapseIcon->sizeFromIconSize(iconSize.height()));
d->collapseIcon->setPos(d->bgLeft + d->dragLeft,
(d->dragger->size().height() + d->dragTop + d->dragBottom)/2 -
d->collapseIcon->size().height()/2 + d->bgTop);
(d->dragger->size().height() + d->dragTop + d->dragBottom) / 2 - d->collapseIcon->size().height() / 2 + d->bgTop);
connect(d->collapseIcon, SIGNAL(clicked()), this, SLOT(toggleCollapse()));
//set the extender we want to move to.
@ -703,8 +704,7 @@ void ExtenderItem::resizeEvent(QGraphicsSceneResizeEvent *event)
//resize the widget
if (d->widget && d->widget->isWidget()) {
QSizeF newWidgetSize(width - d->bgLeft - d->bgRight - d->dragLeft - d->dragRight,
height - d->dragger->size().height() - d->bgTop - d->bgBottom
- 2*d->dragTop - 2*d->dragBottom);
height - d->dragger->size().height() - d->bgTop - d->bgBottom - 2 * d->dragTop - 2 * d->dragBottom);
QGraphicsWidget *graphicsWidget = static_cast<QGraphicsWidget*>(d->widget);
graphicsWidget->resize(newWidgetSize);
@ -769,8 +769,8 @@ void ExtenderItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
corona->addOffscreenWidget(this);
d->toplevel->setWindowFlags(Qt::ToolTip | Qt::FramelessWindowHint
| Qt::WindowStaysOnTopHint);
d->toplevel->setWindowFlags(
Qt::ToolTip | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
d->toplevel->setFrameShape(QFrame::NoFrame);
d->toplevel->resize(screenRect.size());
d->toplevel->setSceneRect(sceneBoundingRect());

View File

@ -140,8 +140,9 @@ static inline QPainterPath headerPath(const QRectF &r, int roundness,
QRectF rect = r.normalized();
if (rect.isNull())
if (rect.isNull()) {
return path;
}
qreal x = rect.x();
qreal y = rect.y();
@ -206,10 +207,10 @@ void GLApplet::paintInterface(QPainter *painter,
void GLApplet::makeCurrent()
{
if (!d->dummy->isValid() ||
!d->pbuf->isValid())
if (!d->dummy->isValid() || !d->pbuf->isValid()) {
d->dummy->makeCurrent();
}
}
} // Plasma namespace

View File

@ -69,7 +69,8 @@ public:
PackageMetadata *metadata;
};
Package::Package(const QString& packageRoot, const QString& package, PackageStructure::Ptr structure)
Package::Package(const QString &packageRoot, const QString &package,
PackageStructure::Ptr structure)
: d(new PackagePrivate(structure, packageRoot + '/' + package))
{
structure->setPath(d->basePath);
@ -449,5 +450,4 @@ bool Package::createPackage(const PackageMetadata &metadata,
return true;
}
} // Namespace

View File

@ -35,8 +35,9 @@ namespace PaintUtils
void shadowBlur(QImage &image, int radius, const QColor &color)
{
if (radius < 1)
if (radius < 1) {
return;
}
expblur<16, 7>(image, radius);

View File

@ -49,8 +49,7 @@ qreal scalingFactor(ZoomLevel level)
Direction locationToDirection(Location location)
{
switch (location)
{
switch (location) {
case Floating:
case Desktop:
case TopEdge:
@ -109,7 +108,8 @@ QPoint popupPosition(const QGraphicsItem * item, const QSize &s)
}
//are we out of screen?
QRect screenRect = QApplication::desktop()->screenGeometry(pv ? pv->containment()->screen() : -1);
QRect screenRect =
QApplication::desktop()->screenGeometry(pv ? pv->containment()->screen() : -1);
//kDebug() << "==> rect for" << (pv ? pv->containment()->screen() : -1) << "is" << screenRect;
if (pos.rx() + s.width() > screenRect.right()) {

View File

@ -115,7 +115,8 @@ void PopupAppletPrivate::popupConstraintsEvent(Plasma::Constraints constraints)
Plasma::FormFactor f = q->formFactor();
if (constraints & Plasma::FormFactorConstraint ||
(constraints & Plasma::SizeConstraint && (f == Plasma::Vertical || f == Plasma::Horizontal))) {
(constraints & Plasma::SizeConstraint &&
(f == Plasma::Vertical || f == Plasma::Horizontal))) {
QGraphicsLinearLayout *lay = dynamic_cast<QGraphicsLinearLayout *>(q->layout());
if (icon && lay) {
@ -219,8 +220,10 @@ void PopupAppletPrivate::popupConstraintsEvent(Plasma::Constraints constraints)
KWindowSystem::setState(dialog->winId(), NET::SkipTaskbar | NET::SkipPager);
dialog->installEventFilter(q);
QObject::connect(dialog, SIGNAL(dialogResized()), q, SLOT(dialogSizeChanged()));
QObject::connect(dialog, SIGNAL(dialogVisible(bool)), q, SLOT(dialogStatusChanged(bool)));
QObject::connect(dialog, SIGNAL(dialogResized()),
q, SLOT(dialogSizeChanged()));
QObject::connect(dialog, SIGNAL(dialogVisible(bool)),
q, SLOT(dialogStatusChanged(bool)));
q->setMinimumSize(QSize(0, 0));
if (gWidget) {
Corona *corona = qobject_cast<Corona *>(gWidget->scene());
@ -263,7 +266,8 @@ void PopupApplet::mousePressEvent(QGraphicsSceneMouseEvent *event)
void PopupApplet::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
if (!d->icon && (d->clicked - scenePos().toPoint()).manhattanLength() < KGlobalSettings::dndEventDelay()) {
if (!d->icon &&
(d->clicked - scenePos().toPoint()).manhattanLength() < KGlobalSettings::dndEventDelay()) {
d->togglePopup();
} else {
Applet::mouseReleaseEvent(event);
@ -411,8 +415,10 @@ void PopupAppletPrivate::updateDialogPosition()
{
KConfigGroup sizeGroup = q->config();
sizeGroup = KConfigGroup(&sizeGroup, "PopupApplet");
const int width = qMin(sizeGroup.readEntry("DialogWidth", 0), QApplication::desktop()->screen()->width() - 50);
const int height = qMin(sizeGroup.readEntry("DialogHeight", 0), QApplication::desktop()->screen()->height() - 50);
const int width = qMin(sizeGroup.readEntry("DialogWidth", 0),
QApplication::desktop()->screen()->width() - 50);
const int height = qMin(sizeGroup.readEntry("DialogHeight", 0),
QApplication::desktop()->screen()->height() - 50);
QSize saved(width, height);
@ -464,8 +470,11 @@ void PopupAppletPrivate::updateDialogPosition()
}
//are we out of screen?
QRect screenRect = QApplication::desktop()->screenGeometry(q->containment() ? q->containment()->screen() : -1);
//kDebug() << "==> rect for" << (containment() ? containment()->screen() : -1) << "is" << screenRect;
QRect screenRect =
QApplication::desktop()->screenGeometry(q->containment() ? q->containment()->screen() : -1);
//kDebug() << "==> rect for"
// << (containment() ? containment()->screen() : -1)
// << "is" << screenRect;
if (pos.rx() + s.width() > screenRect.right()) {
pos.rx() += (int)q->boundingRect().size().width() - s.width();

View File

@ -55,7 +55,6 @@ class QueryMatchPrivate : public QSharedData
qreal relevance;
};
QueryMatch::QueryMatch(AbstractRunner *runner)
: d(new QueryMatchPrivate(runner))
{
@ -131,7 +130,6 @@ void QueryMatch::setId(const QString &id)
d->id = d->runner->id();
}
if (!id.isEmpty()) {
d->id.append('_').append(id);
}

View File

@ -120,7 +120,6 @@ class RunnerContextPrivate : public QSharedData
RunnerContext * q;
};
RunnerContext::RunnerContext(QObject *parent)
: QObject(parent),
d(new RunnerContextPrivate(this))
@ -174,7 +173,6 @@ void RunnerContext::setQuery(const QString &term)
d->determineType();
}
QString RunnerContext::query() const
{
// the query term should never be set after

View File

@ -44,11 +44,9 @@
using ThreadWeaver::Weaver;
using ThreadWeaver::Job;
namespace Plasma
{
/*****************************************************
* RunnerRestrictionPolicy class
* Restricts simultaneous jobs of the same type
@ -135,7 +133,8 @@ void RunnerRestrictionPolicy::destructed(Job *job)
class FindMatchesJob : public Job
{
public:
FindMatchesJob(Plasma::AbstractRunner *runner, Plasma::RunnerContext *context, QObject *parent = 0);
FindMatchesJob(Plasma::AbstractRunner *runner,
Plasma::RunnerContext *context, QObject *parent = 0);
int priority() const;
Plasma::AbstractRunner *runner() const;
@ -160,7 +159,8 @@ FindMatchesJob::FindMatchesJob(Plasma::AbstractRunner *runner,
void FindMatchesJob::run()
{
// kDebug() << "Running match for " << m_runner->objectName() << " in Thread " << thread()->id() << endl;
// kDebug() << "Running match for " << m_runner->objectName()
// << " in Thread " << thread()->id() << endl;
m_runner->performMatch(*m_context);
}
@ -206,7 +206,8 @@ public:
config = conf;
//The number of threads used scales with the number of processors.
const int numProcs = qMax(Solid::Device::listFromType(Solid::DeviceInterface::Processor).count(), 1);
const int numProcs =
qMax(Solid::Device::listFromType(Solid::DeviceInterface::Processor).count(), 1);
//This entry allows to define a hard upper limit independent of the number of processors.
const int maxThreads = config.readEntry("maxThreads", 16);
const int numThreads = qMin(maxThreads, 2 + ((numProcs - 1) * 2));
@ -264,7 +265,8 @@ public:
kDebug() << "loading runner:" << service->name();
runners.insert(runnerName, runner);
} else {
kDebug() << "failed to load runner:" << service->name() << ". error reported:" << error;
kDebug() << "failed to load runner:" << service->name()
<< ". error reported:" << error;
}
}
} else if (loaded) {
@ -301,8 +303,6 @@ public:
KConfigGroup config;
};
/*****************************************************
* RunnerManager::Public class
*
@ -316,7 +316,6 @@ RunnerManager::RunnerManager(QObject *parent)
//ThreadWeaver::setDebugLevel(true, 4);
}
RunnerManager::RunnerManager(KConfigGroup &c, QObject *parent)
: QObject(parent),
d(new RunnerManagerPrivate(this))

View File

@ -127,7 +127,8 @@ KConfigGroup Service::operationDescription(const QString &operationName)
d->config->writeConfig();
KConfigGroup params(d->config->config(), operationName);
//kDebug() << "operation" << operationName << "requested, has keys" << params.keyList() << "from"
//kDebug() << "operation" << operationName
// << "requested, has keys" << params.keyList() << "from"
// << d->config->config()->name();
return params;
}
@ -178,7 +179,8 @@ void Service::associateWidget(QWidget *widget, const QString &operation)
void Service::disassociateWidget(QWidget *widget)
{
disconnect(widget, SIGNAL(destroyed(QObject*)), this, SLOT(associatedWidgetDestroyed(QObject*)));
disconnect(widget, SIGNAL(destroyed(QObject*)),
this, SLOT(associatedWidgetDestroyed(QObject*)));
d->associatedWidgets.remove(widget);
}
@ -186,14 +188,16 @@ void Service::associateWidget(QGraphicsWidget *widget, const QString &operation)
{
disassociateWidget(widget);
d->associatedGraphicsWidgets.insert(widget, operation);
connect(widget, SIGNAL(destroyed(QObject*)), this, SLOT(associatedGraphicsWidgetDestroyed(QObject*)));
connect(widget, SIGNAL(destroyed(QObject*)),
this, SLOT(associatedGraphicsWidgetDestroyed(QObject*)));
widget->setEnabled(!d->disabledOperations.contains(operation));
}
void Service::disassociateWidget(QGraphicsWidget *widget)
{
disconnect(widget, SIGNAL(destroyed(QObject*)), this, SLOT(associatedGraphicsWidgetDestroyed(QObject*)));
disconnect(widget, SIGNAL(destroyed(QObject*)),
this, SLOT(associatedGraphicsWidgetDestroyed(QObject*)));
d->associatedGraphicsWidgets.remove(widget);
}

32
svg.cpp
View File

@ -80,8 +80,10 @@ class SvgPrivate
void setImagePath(const QString &imagePath, Svg *q)
{
if (themed) {
QObject::disconnect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), q, SLOT(themeChanged()));
QObject::disconnect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()), q, SLOT(colorsChanged()));
QObject::disconnect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()),
q, SLOT(themeChanged()));
QObject::disconnect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()),
q, SLOT(colorsChanged()));
}
themed = !QDir::isAbsolutePath(imagePath);
@ -89,13 +91,15 @@ class SvgPrivate
if (themed) {
themePath = imagePath;
QObject::connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), q, SLOT(themeChanged()));
QObject::connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()),
q, SLOT(themeChanged()));
// check if svg wants colorscheme applied
createRenderer();
applyColors = renderer->elementExists("hint-apply-color-scheme");
if (applyColors && !Theme::defaultTheme()->colorScheme()) {
QObject::connect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()), q, SLOT(colorsChanged()));
QObject::connect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()),
q, SLOT(colorsChanged()));
}
} else {
@ -134,9 +138,8 @@ class SvgPrivate
return QPixmap();
}
QString id = QString::fromLatin1("%3_%2_%1_").arg(size.width())
.arg(size.height())
.arg(path);
QString id = QString::fromLatin1("%3_%2_%1_").
arg(size.width()).arg(size.height()).arg(path);
if (!elementId.isEmpty()) {
id.append(elementId);
@ -175,7 +178,8 @@ class SvgPrivate
// Apply current color scheme if the svg asks for it
if (applyColors) {
QImage itmp = p.toImage();
KIconEffect::colorize(itmp, Theme::defaultTheme()->color(Theme::BackgroundColor), 1.0);
KIconEffect::colorize(
itmp, Theme::defaultTheme()->color(Theme::BackgroundColor), 1.0);
p = p.fromImage(itmp);
}
@ -231,7 +235,8 @@ class SvgPrivate
QSizeF naturalSize = renderer->defaultSize();
qreal dx = size.width() / naturalSize.width();
qreal dy = size.height() / naturalSize.height();
elementSize.scale(elementSize.width() * dx, elementSize.height() * dy, Qt::IgnoreAspectRatio);
elementSize.scale(elementSize.width() * dx, elementSize.height() * dy,
Qt::IgnoreAspectRatio);
return elementSize.toSize();
}
@ -275,9 +280,11 @@ class SvgPrivate
createRenderer();
applyColors = renderer->elementExists("hint-apply-color-scheme");
if (applyColors && !Theme::defaultTheme()->colorScheme()) {
QObject::connect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()), q, SLOT(colorsChanged()));
QObject::connect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()),
q, SLOT(colorsChanged()));
} else {
QObject::disconnect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()), q, SLOT(colorsChanged()));
QObject::disconnect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()),
q, SLOT(colorsChanged()));
}
emit q->repaintNeeded();
@ -398,7 +405,8 @@ FIXME: implement when Qt can support us!
QSizeF naturalSize = d->renderer->defaultSize();
qreal dx = d->size.width() / naturalSize.width();
qreal dy = d->size.height() / naturalSize.height();
//kDebug() << point << "is really" << QPoint(point.x() *dx, naturalSize.height() - point.y() * dy);
//kDebug() << point << "is really"
// << QPoint(point.x() *dx, naturalSize.height() - point.y() * dy);
return QString(); // d->renderer->elementAtPoint(QPoint(point.x() *dx, naturalSize.height() - point.y() * dy));
*/

View File

@ -256,17 +256,20 @@ void Theme::setThemeName(const QString &themeName)
d->defaultWallpaperWidth = cg.readEntry("defaultWidth", DEFAULT_WALLPAPER_WIDTH);
d->defaultWallpaperHeight = cg.readEntry("defaultHeight", DEFAULT_WALLPAPER_HEIGHT);
disconnect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()), this, SIGNAL(themeChanged()));
disconnect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()),
this, SIGNAL(themeChanged()));
if (colorsFile.isEmpty()) {
d->colors = 0;
connect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()), this, SIGNAL(themeChanged()));
connect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()),
this, SIGNAL(themeChanged()));
} else {
d->colors = KSharedConfig::openConfig(colorsFile);
}
d->colorScheme = KColorScheme(QPalette::Active, KColorScheme::Window, d->colors);
d->buttonColorScheme = KColorScheme(QPalette::Active, KColorScheme::Button, d->colors);
d->hasWallpapers = !KStandardDirs::locate("data", "desktoptheme/" + theme + "/wallpapers").isEmpty();
d->hasWallpapers =
!KStandardDirs::locate("data", "desktoptheme/" + theme + "/wallpapers").isEmpty();
if (d->isDefault) {
// we're the default theme, let's save our state
@ -422,7 +425,8 @@ QFont Theme::font(FontRole role) const
{
Q_UNUSED(role)
switch (role) {
case DesktopFont: {
case DesktopFont:
{
KConfigGroup cg(KGlobal::config(), "General");
return cg.readEntry("desktopFont", QFont("Sans Serif", 10));
}

View File

@ -38,7 +38,6 @@
#include <fixx11h.h>
#endif
//Plasma
#include <applet.h>
#include <containment.h>
@ -79,7 +78,6 @@ public :
*/
void onWidgetDestroyed(QObject * object);
QGraphicsWidget *currentWidget;
QTimer *showTimer;
QTimer *hideTimer;

View File

@ -78,41 +78,29 @@ QGraphicsWidget *UiLoader::createWidget(const QString &className, QGraphicsWidge
{
if (className == QString("CheckBox")) {
return new CheckBox(parent);
}
else if (className == QString("ComboBox")) {
} else if (className == QString("ComboBox")) {
return new ComboBox(parent);
}
else if (className == QString("Flash")) {
} else if (className == QString("Flash")) {
return new Flash(parent);
}
else if (className == QString("Frame")) {
} else if (className == QString("Frame")) {
return new Frame(parent);
}
else if (className == QString("GroupBox")) {
} else if (className == QString("GroupBox")) {
return new GroupBox(parent);
}
else if (className == QString("Icon")) {
} else if (className == QString("Icon")) {
return new Icon(parent);
}
else if (className == QString("Label")) {
} else if (className == QString("Label")) {
return new Label(parent);
}
else if (className == QString("LineEdit")) {
} else if (className == QString("LineEdit")) {
return new LineEdit(parent);
}
else if (className == QString("PushButton")) {
} else if (className == QString("PushButton")) {
return new PushButton(parent);
}
else if (className == QString("RadioButton")) {
} else if (className == QString("RadioButton")) {
return new RadioButton(parent);
}
else if (className == QString("Slider")) {
} else if (className == QString("Slider")) {
return new Slider(parent);
}
else if (className == QString("TabBar")) {
} else if (className == QString("TabBar")) {
return new TabBar(parent);
}
else if (className == QString("TextEdit")) {
} else if (className == QString("TextEdit")) {
return new TextEdit(parent);
}
@ -129,11 +117,9 @@ Layout *UiLoader::createLayout( const QString &className, LayoutItem *parent )
#ifdef RICHARD_WORK
if (className == QString("HBoxLayout")) {
return new HBoxLayout(parent);
}
else if (className == QString("VBoxLayout")) {
} else if (className == QString("VBoxLayout")) {
return new VBoxLayout(parent);
}
else if (className == QString("FlowLayout")) {
} else if (className == QString("FlowLayout")) {
return new FlowLayout(parent);
}
#endif