more coding style fixes
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=870169
This commit is contained in:
parent
a7aebfa60a
commit
3674a94a99
@ -70,7 +70,8 @@ AppletHandle::AppletHandle(Containment *parent, Applet *applet, const QPointF &h
|
|||||||
m_buttonsOnRight(false),
|
m_buttonsOnRight(false),
|
||||||
m_pendingFade(false)
|
m_pendingFade(false)
|
||||||
{
|
{
|
||||||
KColorScheme colorScheme(QPalette::Active, KColorScheme::View, Theme::defaultTheme()->colorScheme());
|
KColorScheme colorScheme(QPalette::Active, KColorScheme::View,
|
||||||
|
Theme::defaultTheme()->colorScheme());
|
||||||
m_gradientColor = colorScheme.background(KColorScheme::NormalBackground).color();
|
m_gradientColor = colorScheme.background(KColorScheme::NormalBackground).color();
|
||||||
|
|
||||||
QTransform originalMatrix = m_applet->transform();
|
QTransform originalMatrix = m_applet->transform();
|
||||||
@ -201,18 +202,22 @@ QPainterPath handleRect(const QRectF &rect, int radius, bool onRight)
|
|||||||
// make the left side straight
|
// make the left side straight
|
||||||
path.moveTo(rect.left(), rect.top()); // Top left
|
path.moveTo(rect.left(), rect.top()); // Top left
|
||||||
path.lineTo(rect.right() - radius, rect.top()); // Top side
|
path.lineTo(rect.right() - radius, rect.top()); // Top side
|
||||||
path.quadTo(rect.right(), rect.top(), rect.right(), rect.top() + radius); // Top right corner
|
path.quadTo(rect.right(), rect.top(),
|
||||||
|
rect.right(), rect.top() + radius); // Top right corner
|
||||||
path.lineTo(rect.right(), rect.bottom() - radius); // Right side
|
path.lineTo(rect.right(), rect.bottom() - radius); // Right side
|
||||||
path.quadTo(rect.right(), rect.bottom(), rect.right() - radius, rect.bottom()); // Bottom right corner
|
path.quadTo(rect.right(), rect.bottom(),
|
||||||
|
rect.right() - radius, rect.bottom()); // Bottom right corner
|
||||||
path.lineTo(rect.left(), rect.bottom()); // Bottom side
|
path.lineTo(rect.left(), rect.bottom()); // Bottom side
|
||||||
} else {
|
} else {
|
||||||
// make the right side straight
|
// make the right side straight
|
||||||
path.moveTo(QPointF(rect.left(), rect.top() + radius));
|
path.moveTo(QPointF(rect.left(), rect.top() + radius));
|
||||||
path.quadTo(rect.left(), rect.top(), rect.left() + radius, rect.top()); // Top left corner
|
path.quadTo(rect.left(), rect.top(),
|
||||||
|
rect.left() + radius, rect.top()); // Top left corner
|
||||||
path.lineTo(rect.right(), rect.top()); // Top side
|
path.lineTo(rect.right(), rect.top()); // Top side
|
||||||
path.lineTo(rect.right(), rect.bottom()); // Right side
|
path.lineTo(rect.right(), rect.bottom()); // Right side
|
||||||
path.lineTo(rect.left() + radius, rect.bottom()); // Bottom side
|
path.lineTo(rect.left() + radius, rect.bottom()); // Bottom side
|
||||||
path.quadTo(rect.left(), rect.bottom(), rect.left(), rect.bottom() - radius); // Bottom left corner
|
path.quadTo(rect.left(), rect.bottom(),
|
||||||
|
rect.left(), rect.bottom() - radius); // Bottom left corner
|
||||||
}
|
}
|
||||||
|
|
||||||
path.closeSubpath();
|
path.closeSubpath();
|
||||||
@ -236,7 +241,8 @@ void AppletHandle::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
|
|||||||
qreal translation;
|
qreal translation;
|
||||||
|
|
||||||
if (m_buttonsOnRight) {
|
if (m_buttonsOnRight) {
|
||||||
//kDebug() << "translating by" << m_opacity << (-(1 - m_opacity) * m_rect.width()) << m_rect.width();
|
//kDebug() << "translating by" << m_opacity
|
||||||
|
// << (-(1 - m_opacity) * m_rect.width()) << m_rect.width();
|
||||||
translation = -(1 - m_opacity) * m_rect.width();
|
translation = -(1 - m_opacity) * m_rect.width();
|
||||||
} else {
|
} else {
|
||||||
translation = (1 - m_opacity) * m_rect.width();
|
translation = (1 - m_opacity) * m_rect.width();
|
||||||
@ -247,10 +253,10 @@ void AppletHandle::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
|
|||||||
painter->setPen(Qt::NoPen);
|
painter->setPen(Qt::NoPen);
|
||||||
painter->setRenderHints(QPainter::Antialiasing);
|
painter->setRenderHints(QPainter::Antialiasing);
|
||||||
|
|
||||||
|
|
||||||
int iconMargin = m_iconSize / 2;
|
int iconMargin = m_iconSize / 2;
|
||||||
|
|
||||||
const QSize pixmapSize(int(m_decorationRect.width()), int(m_decorationRect.height()) + m_iconSize*4 + 1);
|
const QSize pixmapSize(int(m_decorationRect.width()),
|
||||||
|
int(m_decorationRect.height()) + m_iconSize * 4 + 1);
|
||||||
const QSize iconSize(KIconLoader::SizeSmall, KIconLoader::SizeSmall);
|
const QSize iconSize(KIconLoader::SizeSmall, KIconLoader::SizeSmall);
|
||||||
|
|
||||||
//regenerate our buffer?
|
//regenerate our buffer?
|
||||||
@ -262,7 +268,8 @@ void AppletHandle::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
|
|||||||
//fading out panel
|
//fading out panel
|
||||||
if (m_rect.height() > qreal(minimumHeight()) * 1.25) {
|
if (m_rect.height() > qreal(minimumHeight()) * 1.25) {
|
||||||
if (m_buttonsOnRight) {
|
if (m_buttonsOnRight) {
|
||||||
qreal opaquePoint = (m_background->marginSize(LeftMargin) - translation) / m_decorationRect.width();
|
qreal opaquePoint =
|
||||||
|
(m_background->marginSize(LeftMargin) - translation) / m_decorationRect.width();
|
||||||
//kDebug() << "opaquePoint" << opaquePoint
|
//kDebug() << "opaquePoint" << opaquePoint
|
||||||
// << m_background->marginSize(LeftMargin) << m_decorationRect.width();
|
// << m_background->marginSize(LeftMargin) << m_decorationRect.width();
|
||||||
g.setColorAt(0.0, Qt::transparent);
|
g.setColorAt(0.0, Qt::transparent);
|
||||||
@ -270,7 +277,8 @@ void AppletHandle::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
|
|||||||
g.setColorAt(opaquePoint, transparencyColor);
|
g.setColorAt(opaquePoint, transparencyColor);
|
||||||
g.setColorAt(1.0, transparencyColor);
|
g.setColorAt(1.0, transparencyColor);
|
||||||
} else {
|
} else {
|
||||||
qreal opaquePoint = 1 - ((m_background->marginSize(RightMargin) + translation) / m_decorationRect.width());
|
qreal opaquePoint =
|
||||||
|
1 - ((m_background->marginSize(RightMargin) + translation) / m_decorationRect.width());
|
||||||
g.setColorAt(1.0, Qt::transparent);
|
g.setColorAt(1.0, Qt::transparent);
|
||||||
g.setColorAt(opaquePoint, Qt::transparent);
|
g.setColorAt(opaquePoint, Qt::transparent);
|
||||||
g.setColorAt(qMax(0.0, opaquePoint - 0.05), transparencyColor);
|
g.setColorAt(qMax(0.0, opaquePoint - 0.05), transparencyColor);
|
||||||
@ -297,7 +305,8 @@ void AppletHandle::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
|
|||||||
//QRectF iconRect(QPointF(pixmapSize.width() - m_iconSize + 1, m_iconSize), iconSize);
|
//QRectF iconRect(QPointF(pixmapSize.width() - m_iconSize + 1, m_iconSize), iconSize);
|
||||||
QRectF iconRect(QPointF(0, m_decorationRect.height() + 1), iconSize);
|
QRectF iconRect(QPointF(0, m_decorationRect.height() + 1), iconSize);
|
||||||
if (m_buttonsOnRight) {
|
if (m_buttonsOnRight) {
|
||||||
iconRect.moveLeft(pixmapSize.width() - m_iconSize - m_background->marginSize(LeftMargin));
|
iconRect.moveLeft(
|
||||||
|
pixmapSize.width() - m_iconSize - m_background->marginSize(LeftMargin));
|
||||||
m_configureIcons->paint(&buffPainter, iconRect, "size-diagonal-tr2bl");
|
m_configureIcons->paint(&buffPainter, iconRect, "size-diagonal-tr2bl");
|
||||||
} else {
|
} else {
|
||||||
iconRect.moveLeft(m_background->marginSize(RightMargin));
|
iconRect.moveLeft(m_background->marginSize(RightMargin));
|
||||||
@ -318,10 +327,12 @@ void AppletHandle::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
|
|||||||
//blend the background
|
//blend the background
|
||||||
buffPainter.fillRect(m_backgroundBuffer->rect(), g);
|
buffPainter.fillRect(m_backgroundBuffer->rect(), g);
|
||||||
//blend the icons
|
//blend the icons
|
||||||
//buffPainter.fillRect(QRect(QPoint((int)m_decorationRect.width(), 0), QSize(m_iconSize + 1, (int)m_decorationRect.height())), transparencyColor);
|
//buffPainter.fillRect(QRect(QPoint((int)m_decorationRect.width(), 0), QSize(m_iconSize + 1,
|
||||||
|
// (int)m_decorationRect.height())), transparencyColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
painter->drawPixmap(m_decorationRect.toRect(), *m_backgroundBuffer, QRect(QPoint(0,0), m_decorationRect.size().toSize()));
|
painter->drawPixmap(m_decorationRect.toRect(), *m_backgroundBuffer,
|
||||||
|
QRect(QPoint(0, 0), m_decorationRect.size().toSize()));
|
||||||
|
|
||||||
//XXX this code is duplicated in the next function
|
//XXX this code is duplicated in the next function
|
||||||
QPointF basePoint = m_rect.topLeft() + QPointF(HANDLE_MARGIN, iconMargin);
|
QPointF basePoint = m_rect.topLeft() + QPointF(HANDLE_MARGIN, iconMargin);
|
||||||
@ -354,14 +365,16 @@ void AppletHandle::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
|
|||||||
|
|
||||||
QRectF sourceIconRect(QPointF(0, m_decorationRect.height() + 1), iconSize);
|
QRectF sourceIconRect(QPointF(0, m_decorationRect.height() + 1), iconSize);
|
||||||
if (m_buttonsOnRight) {
|
if (m_buttonsOnRight) {
|
||||||
sourceIconRect.moveLeft(pixmapSize.width() - m_iconSize - m_background->marginSize(LeftMargin));
|
sourceIconRect.moveLeft(
|
||||||
|
pixmapSize.width() - m_iconSize - m_background->marginSize(LeftMargin));
|
||||||
} else {
|
} else {
|
||||||
sourceIconRect.moveLeft(m_background->marginSize(RightMargin));
|
sourceIconRect.moveLeft(m_background->marginSize(RightMargin));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_applet && m_applet->aspectRatioMode() != FixedSize) {
|
if (m_applet && m_applet->aspectRatioMode() != FixedSize) {
|
||||||
//resize
|
//resize
|
||||||
painter->drawPixmap(QRectF(basePoint + shiftM, iconSize), *m_backgroundBuffer, sourceIconRect);
|
painter->drawPixmap(
|
||||||
|
QRectF(basePoint + shiftM, iconSize), *m_backgroundBuffer, sourceIconRect);
|
||||||
basePoint += step;
|
basePoint += step;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -372,7 +385,8 @@ void AppletHandle::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
|
|||||||
if (m_applet && m_applet->hasConfigurationInterface()) {
|
if (m_applet && m_applet->hasConfigurationInterface()) {
|
||||||
basePoint += step;
|
basePoint += step;
|
||||||
sourceIconRect.translate(0, m_iconSize);
|
sourceIconRect.translate(0, m_iconSize);
|
||||||
painter->drawPixmap(QRectF(basePoint + shiftC, iconSize), *m_backgroundBuffer, sourceIconRect);
|
painter->drawPixmap(
|
||||||
|
QRectF(basePoint + shiftC, iconSize), *m_backgroundBuffer, sourceIconRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
//close
|
//close
|
||||||
@ -426,7 +440,6 @@ AppletHandle::ButtonType AppletHandle::mapToButton(const QPointF &point) const
|
|||||||
//return m_applet->mapToParent(m_applet->shape()).contains(point) ? NoButton : MoveButton;
|
//return m_applet->mapToParent(m_applet->shape()).contains(point) ? NoButton : MoveButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AppletHandle::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
void AppletHandle::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
//containment recently switched?
|
//containment recently switched?
|
||||||
@ -474,9 +487,10 @@ bool AppletHandle::leaveCurrentView(const QPoint &pos) const
|
|||||||
//is this widget a plasma view, a different view then our current one,
|
//is this widget a plasma view, a different view then our current one,
|
||||||
//AND not a dashboardview?
|
//AND not a dashboardview?
|
||||||
Plasma::View *v = qobject_cast<Plasma::View *>(widget);
|
Plasma::View *v = qobject_cast<Plasma::View *>(widget);
|
||||||
if (v && v != m_currentView
|
if (v &&
|
||||||
&& v != m_topview
|
v != m_currentView &&
|
||||||
&& v->containment() != m_containment) {
|
v != m_topview &&
|
||||||
|
v->containment() != m_containment) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -484,7 +498,6 @@ bool AppletHandle::leaveCurrentView(const QPoint &pos) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AppletHandle::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
void AppletHandle::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
//kDebug() << "button pressed:" << m_pressedButton << ", fade pending?" << m_pendingFade;
|
//kDebug() << "button pressed:" << m_pressedButton << ", fade pending?" << m_pendingFade;
|
||||||
@ -499,7 +512,8 @@ void AppletHandle::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|||||||
if (m_applet && event->button() == Qt::LeftButton) {
|
if (m_applet && event->button() == Qt::LeftButton) {
|
||||||
switch (m_pressedButton) {
|
switch (m_pressedButton) {
|
||||||
case ResizeButton:
|
case ResizeButton:
|
||||||
case RotateButton: {
|
case RotateButton:
|
||||||
|
{
|
||||||
if (m_scaleWidth > 0 && m_scaleHeight > 0) {
|
if (m_scaleWidth > 0 && m_scaleHeight > 0) {
|
||||||
QRectF rect(m_applet->boundingRect());
|
QRectF rect(m_applet->boundingRect());
|
||||||
const qreal newWidth = rect.width() * m_scaleWidth;
|
const qreal newWidth = rect.width() * m_scaleWidth;
|
||||||
@ -537,7 +551,8 @@ void AppletHandle::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|||||||
m_applet->destroy();
|
m_applet->destroy();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MoveButton: {
|
case MoveButton:
|
||||||
|
{
|
||||||
if (m_topview) {
|
if (m_topview) {
|
||||||
m_topview->hide();
|
m_topview->hide();
|
||||||
delete m_topview;
|
delete m_topview;
|
||||||
@ -560,7 +575,8 @@ void AppletHandle::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// test for containment change
|
// test for containment change
|
||||||
//kDebug() << "testing for containment change, sceneBoundingRect = " << m_containment->sceneBoundingRect();
|
//kDebug() << "testing for containment change, sceneBoundingRect = "
|
||||||
|
// << m_containment->sceneBoundingRect();
|
||||||
if (!m_containment->sceneBoundingRect().contains(m_applet->scenePos())) {
|
if (!m_containment->sceneBoundingRect().contains(m_applet->scenePos())) {
|
||||||
// see which containment it belongs to
|
// see which containment it belongs to
|
||||||
Corona * corona = qobject_cast<Corona*>(scene());
|
Corona * corona = qobject_cast<Corona*>(scene());
|
||||||
@ -571,7 +587,8 @@ void AppletHandle::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|||||||
QGraphicsView *v;
|
QGraphicsView *v;
|
||||||
v = containments[i]->view();
|
v = containments[i]->view();
|
||||||
if (v) {
|
if (v) {
|
||||||
pos = v->mapToScene(v->mapFromGlobal(event->screenPos() - m_mousePos));
|
pos = v->mapToScene(
|
||||||
|
v->mapFromGlobal(event->screenPos() - m_mousePos));
|
||||||
|
|
||||||
if (containments[i]->sceneBoundingRect().contains(pos)) {
|
if (containments[i]->sceneBoundingRect().contains(pos)) {
|
||||||
//kDebug() << "new containment = " << containments[i];
|
//kDebug() << "new containment = " << containments[i];
|
||||||
@ -653,8 +670,8 @@ void AppletHandle::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
|||||||
m_topview = new View(m_containment, -1, 0);
|
m_topview = new View(m_containment, -1, 0);
|
||||||
|
|
||||||
m_topview->setTrackContainmentChanges(false);
|
m_topview->setTrackContainmentChanges(false);
|
||||||
m_topview->setWindowFlags(Qt::ToolTip | Qt::FramelessWindowHint
|
m_topview->setWindowFlags(
|
||||||
| Qt::WindowStaysOnTopHint);
|
Qt::ToolTip | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
|
||||||
m_topview->setWallpaperEnabled(false);
|
m_topview->setWallpaperEnabled(false);
|
||||||
m_topview->resize(screenRect.size());
|
m_topview->resize(screenRect.size());
|
||||||
m_topview->setSceneRect(m_applet->sceneBoundingRect());
|
m_topview->setSceneRect(m_applet->sceneBoundingRect());
|
||||||
@ -769,7 +786,9 @@ void AppletHandle::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
|||||||
// maintain aspect ratio
|
// maintain aspect ratio
|
||||||
qreal newScale = 0;
|
qreal newScale = 0;
|
||||||
|
|
||||||
newScale = _k_distanceForPoint(event->pos()-center) / _k_distanceForPoint(pressPos-center);
|
newScale =
|
||||||
|
_k_distanceForPoint(event->pos()-center) /
|
||||||
|
_k_distanceForPoint(pressPos - center);
|
||||||
if (qAbs(h - (newScale * h)) <= KGlobalSettings::dndEventDelay()) {
|
if (qAbs(h - (newScale * h)) <= KGlobalSettings::dndEventDelay()) {
|
||||||
newScale = 1.0;
|
newScale = 1.0;
|
||||||
}
|
}
|
||||||
@ -795,7 +814,6 @@ void AppletHandle::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//pos relative to scene
|
//pos relative to scene
|
||||||
void AppletHandle::switchContainment(Containment *containment, const QPointF &pos)
|
void AppletHandle::switchContainment(Containment *containment, const QPointF &pos)
|
||||||
{
|
{
|
||||||
@ -944,7 +962,8 @@ void AppletHandle::startFading(FadeType anim, const QPointF &hoverPos)
|
|||||||
// ok, both sides failed to be perfect... which one is more perfect?
|
// ok, both sides failed to be perfect... which one is more perfect?
|
||||||
QRectF f1 = region.boundingRect();
|
QRectF f1 = region.boundingRect();
|
||||||
QRectF f2 = region2.boundingRect();
|
QRectF f2 = region2.boundingRect();
|
||||||
//kDebug() << "still not a perfect world" << f2.width() << f2.height() << f1.width() << f1.height();
|
//kDebug() << "still not a perfect world"
|
||||||
|
// << f2.width() << f2.height() << f1.width() << f1.height();
|
||||||
if ((f2.width() * f2.height()) < (f1.width() * f1.height())) {
|
if ((f2.width() * f2.height()) < (f1.width() * f1.height())) {
|
||||||
//kDebug() << "we did better the first time";
|
//kDebug() << "we did better the first time";
|
||||||
m_buttonsOnRight = !m_buttonsOnRight;
|
m_buttonsOnRight = !m_buttonsOnRight;
|
||||||
@ -953,7 +972,10 @@ void AppletHandle::startFading(FadeType anim, const QPointF &hoverPos)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wasOnRight != m_buttonsOnRight && m_anim == FadeIn && anim == FadeIn && m_opacity <= 1) {
|
if (wasOnRight != m_buttonsOnRight &&
|
||||||
|
m_anim == FadeIn &&
|
||||||
|
anim == FadeIn &&
|
||||||
|
m_opacity <= 1) {
|
||||||
m_opacity = 0.0;
|
m_opacity = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -964,7 +986,8 @@ void AppletHandle::startFading(FadeType anim, const QPointF &hoverPos)
|
|||||||
|
|
||||||
m_anim = anim;
|
m_anim = anim;
|
||||||
//kDebug() << "animating for " << time << "ms";
|
//kDebug() << "animating for " << time << "ms";
|
||||||
m_animId = Animator::self()->customAnimation(80*(time/1000.0), (int)time, Animator::EaseInCurve, this, "fadeAnimation");
|
m_animId = Animator::self()->customAnimation(
|
||||||
|
80 * (time / 1000.0), (int)time, Animator::EaseInCurve, this, "fadeAnimation");
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppletHandle::forceDisappear()
|
void AppletHandle::forceDisappear()
|
||||||
@ -995,7 +1018,8 @@ void AppletHandle::calculateSize()
|
|||||||
|
|
||||||
int handleHeight = qMax(minimumHeight(), int(m_applet->contentsRect().height() * 0.8));
|
int handleHeight = qMax(minimumHeight(), int(m_applet->contentsRect().height() * 0.8));
|
||||||
int handleWidth = m_iconSize + 2 * HANDLE_MARGIN;
|
int handleWidth = m_iconSize + 2 * HANDLE_MARGIN;
|
||||||
int top = m_applet->contentsRect().top() + (m_applet->contentsRect().height() - handleHeight) / 2.0;
|
int top =
|
||||||
|
m_applet->contentsRect().top() + (m_applet->contentsRect().height() - handleHeight) / 2.0;
|
||||||
|
|
||||||
qreal marginLeft, marginTop, marginRight, marginBottom;
|
qreal marginLeft, marginTop, marginRight, marginBottom;
|
||||||
m_background->getMargins(marginLeft, marginTop, marginRight, marginBottom);
|
m_background->getMargins(marginLeft, marginTop, marginRight, marginBottom);
|
||||||
@ -1008,7 +1032,6 @@ void AppletHandle::calculateSize()
|
|||||||
m_rect = QRectF(-handleWidth, top, handleWidth, handleHeight);
|
m_rect = QRectF(-handleWidth, top, handleWidth, handleHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (m_applet->contentsRect().height() > qreal(minimumHeight()) * 1.25) {
|
if (m_applet->contentsRect().height() > qreal(minimumHeight()) * 1.25) {
|
||||||
int addedMargin = marginLeft / 2;
|
int addedMargin = marginLeft / 2;
|
||||||
|
|
||||||
|
@ -40,8 +40,18 @@ class AppletHandle : public QObject, public QGraphicsItem
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
enum FadeType { FadeIn, FadeOut };
|
enum FadeType {
|
||||||
enum ButtonType { NoButton, MoveButton, RotateButton, ConfigureButton, RemoveButton, ResizeButton };
|
FadeIn,
|
||||||
|
FadeOut
|
||||||
|
};
|
||||||
|
enum ButtonType {
|
||||||
|
NoButton,
|
||||||
|
MoveButton,
|
||||||
|
RotateButton,
|
||||||
|
ConfigureButton,
|
||||||
|
RemoveButton,
|
||||||
|
ResizeButton
|
||||||
|
};
|
||||||
|
|
||||||
AppletHandle(Containment *parent, Applet *applet, const QPointF &hoverPos);
|
AppletHandle(Containment *parent, Applet *applet, const QPointF &hoverPos);
|
||||||
virtual ~AppletHandle();
|
virtual ~AppletHandle();
|
||||||
|
@ -24,7 +24,8 @@ namespace Plasma
|
|||||||
{
|
{
|
||||||
|
|
||||||
SignalRelay *DataContainerPrivate::signalRelay(const DataContainer *dc, QObject *visualization,
|
SignalRelay *DataContainerPrivate::signalRelay(const DataContainer *dc, QObject *visualization,
|
||||||
uint pollingInterval, Plasma::IntervalAlignment align,
|
uint pollingInterval,
|
||||||
|
Plasma::IntervalAlignment align,
|
||||||
bool immediateUpdate)
|
bool immediateUpdate)
|
||||||
{
|
{
|
||||||
QMap<uint, SignalRelay *>::const_iterator relayIt = relays.find(pollingInterval);
|
QMap<uint, SignalRelay *>::const_iterator relayIt = relays.find(pollingInterval);
|
||||||
@ -32,7 +33,8 @@ SignalRelay* DataContainerPrivate::signalRelay(const DataContainer* dc, QObject
|
|||||||
|
|
||||||
//FIXME what if we have two applets with the same interval and different alignment?
|
//FIXME what if we have two applets with the same interval and different alignment?
|
||||||
if (relayIt == relays.end()) {
|
if (relayIt == relays.end()) {
|
||||||
relay = new SignalRelay(const_cast<DataContainer*>(dc), this, pollingInterval, align, immediateUpdate);
|
relay = new SignalRelay(const_cast<DataContainer*>(dc), this,
|
||||||
|
pollingInterval, align, immediateUpdate);
|
||||||
relays[pollingInterval] = relay;
|
relays[pollingInterval] = relay;
|
||||||
} else {
|
} else {
|
||||||
relay = relayIt.value();
|
relay = relayIt.value();
|
||||||
|
@ -60,7 +60,6 @@ class DataEnginePrivate
|
|||||||
**/
|
**/
|
||||||
bool isUsed() const;
|
bool isUsed() const;
|
||||||
|
|
||||||
|
|
||||||
DataEngine *q;
|
DataEngine *q;
|
||||||
int refCount;
|
int refCount;
|
||||||
int updateTimerId;
|
int updateTimerId;
|
||||||
|
@ -33,7 +33,6 @@
|
|||||||
|
|
||||||
#include <plasma/applet.h>
|
#include <plasma/applet.h>
|
||||||
|
|
||||||
|
|
||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -105,7 +104,8 @@ DesktopToolBox::DesktopToolBox(QGraphicsItem *parent)
|
|||||||
: ToolBox(parent),
|
: ToolBox(parent),
|
||||||
d(new DesktopToolBoxPrivate)
|
d(new DesktopToolBoxPrivate)
|
||||||
{
|
{
|
||||||
connect(Plasma::Animator::self(), SIGNAL(movementFinished(QGraphicsItem*)), this, SLOT(toolMoved(QGraphicsItem*)));
|
connect(Plasma::Animator::self(), SIGNAL(movementFinished(QGraphicsItem*)),
|
||||||
|
this, SLOT(toolMoved(QGraphicsItem*)));
|
||||||
connect(this, SIGNAL(toggled()), this, SLOT(toggle()));
|
connect(this, SIGNAL(toggled()), this, SLOT(toggle()));
|
||||||
|
|
||||||
setZValue(10000000);
|
setZValue(10000000);
|
||||||
@ -148,7 +148,8 @@ QRectF DesktopToolBox::boundingRect() const
|
|||||||
return QRectF(0, 0, width, height);
|
return QRectF(0, 0, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DesktopToolBox::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
void DesktopToolBox::paint(QPainter *painter,
|
||||||
|
const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||||
{
|
{
|
||||||
Q_UNUSED(option)
|
Q_UNUSED(option)
|
||||||
Q_UNUSED(widget)
|
Q_UNUSED(widget)
|
||||||
@ -186,7 +187,8 @@ void DesktopToolBox::paint(QPainter *painter, const QStyleOptionGraphicsItem *op
|
|||||||
gradientCenter = QPointF(boundingRect().left(), boundingRect().center().y());
|
gradientCenter = QPointF(boundingRect().left(), boundingRect().center().y());
|
||||||
break;
|
break;
|
||||||
case Right:
|
case Right:
|
||||||
iconPos = QPoint((int)boundingRect().left() - iconSize().width() + 2, boundingRect().center().y() - iconSize().height() / 2);
|
iconPos = QPoint((int)boundingRect().left() - iconSize().width() + 2,
|
||||||
|
boundingRect().center().y() - iconSize().height() / 2);
|
||||||
gradientCenter = QPointF(boundingRect().left(), boundingRect().center().y());
|
gradientCenter = QPointF(boundingRect().left(), boundingRect().center().y());
|
||||||
break;
|
break;
|
||||||
case BottomLeft:
|
case BottomLeft:
|
||||||
@ -194,12 +196,14 @@ void DesktopToolBox::paint(QPainter *painter, const QStyleOptionGraphicsItem *op
|
|||||||
gradientCenter = boundingRect().topLeft();
|
gradientCenter = boundingRect().topLeft();
|
||||||
break;
|
break;
|
||||||
case Bottom:
|
case Bottom:
|
||||||
iconPos = QPoint(boundingRect().center().x() - iconSize().width() / 2, boundingRect().top() - iconSize().height() - 2);
|
iconPos = QPoint(boundingRect().center().x() - iconSize().width() / 2,
|
||||||
|
boundingRect().top() - iconSize().height() - 2);
|
||||||
gradientCenter = QPointF(boundingRect().center().x(), boundingRect().top());
|
gradientCenter = QPointF(boundingRect().center().x(), boundingRect().top());
|
||||||
break;
|
break;
|
||||||
case BottomRight:
|
case BottomRight:
|
||||||
default:
|
default:
|
||||||
iconPos = QPoint((int)boundingRect().left() - iconSize().width() - 2, (int)boundingRect().top() - iconSize().height() - 2);
|
iconPos = QPoint((int)boundingRect().left() - iconSize().width() - 2,
|
||||||
|
(int)boundingRect().top() - iconSize().height() - 2);
|
||||||
gradientCenter = boundingRect().topLeft();
|
gradientCenter = boundingRect().topLeft();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -223,11 +227,14 @@ void DesktopToolBox::paint(QPainter *painter, const QStyleOptionGraphicsItem *op
|
|||||||
if (qFuzzyCompare(qreal(1.0), progress)) {
|
if (qFuzzyCompare(qreal(1.0), progress)) {
|
||||||
d->icon.paint(painter, QRect(iconPos, iconSize()));
|
d->icon.paint(painter, QRect(iconPos, iconSize()));
|
||||||
} else if (qFuzzyCompare(qreal(1.0), 1 + progress)) {
|
} else if (qFuzzyCompare(qreal(1.0), 1 + progress)) {
|
||||||
d->icon.paint(painter, QRect(iconPos, iconSize()), Qt::AlignCenter, QIcon::Disabled, QIcon::Off);
|
d->icon.paint(painter, QRect(iconPos, iconSize()),
|
||||||
|
Qt::AlignCenter, QIcon::Disabled, QIcon::Off);
|
||||||
} else {
|
} else {
|
||||||
QPixmap disabled = d->icon.pixmap(iconSize(), QIcon::Disabled, QIcon::Off);
|
QPixmap disabled = d->icon.pixmap(iconSize(), QIcon::Disabled, QIcon::Off);
|
||||||
QPixmap enabled = d->icon.pixmap(iconSize());
|
QPixmap enabled = d->icon.pixmap(iconSize());
|
||||||
QPixmap result = PaintUtils::transition(d->icon.pixmap(iconSize(), QIcon::Disabled, QIcon::Off), d->icon.pixmap(iconSize()), progress);
|
QPixmap result = PaintUtils::transition(
|
||||||
|
d->icon.pixmap(iconSize(), QIcon::Disabled, QIcon::Off),
|
||||||
|
d->icon.pixmap(iconSize()), progress);
|
||||||
painter->drawPixmap(QRect(iconPos, iconSize()), result);
|
painter->drawPixmap(QRect(iconPos, iconSize()), result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,29 +248,44 @@ QPainterPath DesktopToolBox::shape() const
|
|||||||
|
|
||||||
switch (corner()) {
|
switch (corner()) {
|
||||||
case TopRight:
|
case TopRight:
|
||||||
path.arcTo(QRectF(boundingRect().left() - toolSize, boundingRect().top() - toolSize, toolSize*2, toolSize*2), 180, 90);
|
path.arcTo(QRectF(boundingRect().left() - toolSize, boundingRect().top() - toolSize,
|
||||||
|
toolSize * 2, toolSize * 2), 180, 90);
|
||||||
break;
|
break;
|
||||||
case Top:
|
case Top:
|
||||||
path.arcTo(QRectF(boundingRect().center().x() - toolSize, boundingRect().top() - toolSize, toolSize*2, toolSize*2), 180, 180);
|
path.arcTo(QRectF(boundingRect().center().x() - toolSize,
|
||||||
|
boundingRect().top() - toolSize,
|
||||||
|
toolSize * 2, toolSize * 2), 180, 180);
|
||||||
break;
|
break;
|
||||||
case TopLeft:
|
case TopLeft:
|
||||||
path.arcTo(QRectF(boundingRect().left() - toolSize, boundingRect().top() - toolSize, toolSize*2, toolSize*2), 270, 90);
|
path.arcTo(QRectF(boundingRect().left() - toolSize,
|
||||||
|
boundingRect().top() - toolSize,
|
||||||
|
toolSize * 2, toolSize * 2), 270, 90);
|
||||||
break;
|
break;
|
||||||
case Left:
|
case Left:
|
||||||
path.arcTo(QRectF(boundingRect().left() - toolSize, boundingRect().center().y() - toolSize, toolSize*2, toolSize*2), 270, 180);
|
path.arcTo(QRectF(boundingRect().left() - toolSize,
|
||||||
|
boundingRect().center().y() - toolSize,
|
||||||
|
toolSize * 2, toolSize * 2), 270, 180);
|
||||||
break;
|
break;
|
||||||
case Right:
|
case Right:
|
||||||
path.arcTo(QRectF(boundingRect().left() - toolSize, boundingRect().center().y() - toolSize, toolSize*2, toolSize*2), 90, 180);
|
path.arcTo(QRectF(boundingRect().left() - toolSize,
|
||||||
|
boundingRect().center().y() - toolSize,
|
||||||
|
toolSize * 2, toolSize * 2), 90, 180);
|
||||||
break;
|
break;
|
||||||
case BottomLeft:
|
case BottomLeft:
|
||||||
path.arcTo(QRectF(boundingRect().left() - toolSize, boundingRect().top() - toolSize, toolSize*2, toolSize*2), 0, 90);
|
path.arcTo(QRectF(boundingRect().left() - toolSize,
|
||||||
|
boundingRect().top() - toolSize,
|
||||||
|
toolSize * 2, toolSize * 2), 0, 90);
|
||||||
break;
|
break;
|
||||||
case Bottom:
|
case Bottom:
|
||||||
path.arcTo(QRectF(boundingRect().center().x() - toolSize, boundingRect().top() - toolSize, toolSize*2, toolSize*2), 0, 180);
|
path.arcTo(QRectF(boundingRect().center().x() - toolSize,
|
||||||
|
boundingRect().top() - toolSize,
|
||||||
|
toolSize * 2, toolSize * 2), 0, 180);
|
||||||
break;
|
break;
|
||||||
case BottomRight:
|
case BottomRight:
|
||||||
default:
|
default:
|
||||||
path.arcTo(QRectF(boundingRect().left() - toolSize, boundingRect().top() - toolSize, toolSize*2, toolSize*2), 90, 90);
|
path.arcTo(QRectF(boundingRect().left() - toolSize,
|
||||||
|
boundingRect().top() - toolSize,
|
||||||
|
toolSize * 2, toolSize * 2), 90, 90);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -281,7 +303,9 @@ void DesktopToolBox::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
|||||||
animdriver->stopCustomAnimation(d->animHighlightId);
|
animdriver->stopCustomAnimation(d->animHighlightId);
|
||||||
}
|
}
|
||||||
d->hovering = true;
|
d->hovering = true;
|
||||||
d->animHighlightId = animdriver->customAnimation(10, 240, Plasma::Animator::EaseInCurve, this, "animateHighlight");
|
d->animHighlightId =
|
||||||
|
animdriver->customAnimation(
|
||||||
|
10, 240, Plasma::Animator::EaseInCurve, this, "animateHighlight");
|
||||||
|
|
||||||
QGraphicsItem::hoverEnterEvent(event);
|
QGraphicsItem::hoverEnterEvent(event);
|
||||||
}
|
}
|
||||||
@ -348,7 +372,8 @@ void DesktopToolBox::showToolBox()
|
|||||||
if (!tool->isEnabled()) {
|
if (!tool->isEnabled()) {
|
||||||
if (tool->isVisible()) {
|
if (tool->isVisible()) {
|
||||||
const int height = static_cast<int>(tool->boundingRect().height());
|
const int height = static_cast<int>(tool->boundingRect().height());
|
||||||
animdriver->moveItem(tool, Plasma::Animator::SlideOutMovement, toolPosition(height));
|
animdriver->moveItem(tool, Plasma::Animator::SlideOutMovement,
|
||||||
|
toolPosition(height));
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -373,12 +398,14 @@ void DesktopToolBox::showToolBox()
|
|||||||
setShowing(true);
|
setShowing(true);
|
||||||
// TODO: 10 and 200 shouldn't be hardcoded here. There needs to be a way to
|
// TODO: 10 and 200 shouldn't be hardcoded here. There needs to be a way to
|
||||||
// match whatever the time is that moveItem() takes. Same in hoverLeaveEvent().
|
// match whatever the time is that moveItem() takes. Same in hoverLeaveEvent().
|
||||||
d->animCircleId = animdriver->customAnimation(10, 240, Plasma::Animator::EaseInCurve, this, "animateCircle");
|
d->animCircleId =
|
||||||
|
animdriver->customAnimation(10, 240, Plasma::Animator::EaseInCurve, this, "animateCircle");
|
||||||
}
|
}
|
||||||
|
|
||||||
void DesktopToolBox::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
void DesktopToolBox::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
//kDebug() << event->pos() << event->scenePos() << d->toolBacker->rect().contains(event->scenePos().toPoint());
|
//kDebug() << event->pos() << event->scenePos()
|
||||||
|
// << d->toolBacker->rect().contains(event->scenePos().toPoint());
|
||||||
if (! d->hovering) {
|
if (! d->hovering) {
|
||||||
QGraphicsItem::hoverLeaveEvent(event);
|
QGraphicsItem::hoverLeaveEvent(event);
|
||||||
return;
|
return;
|
||||||
@ -390,7 +417,9 @@ void DesktopToolBox::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
|||||||
animdriver->stopCustomAnimation(d->animHighlightId);
|
animdriver->stopCustomAnimation(d->animHighlightId);
|
||||||
}
|
}
|
||||||
d->hovering = false;
|
d->hovering = false;
|
||||||
d->animHighlightId = animdriver->customAnimation(10, 240, Plasma::Animator::EaseOutCurve, this, "animateHighlight");
|
d->animHighlightId =
|
||||||
|
animdriver->customAnimation(
|
||||||
|
10, 240, Plasma::Animator::EaseOutCurve, this, "animateHighlight");
|
||||||
|
|
||||||
QGraphicsItem::hoverLeaveEvent(event);
|
QGraphicsItem::hoverLeaveEvent(event);
|
||||||
}
|
}
|
||||||
@ -416,7 +445,8 @@ void DesktopToolBox::hideToolBox()
|
|||||||
}
|
}
|
||||||
|
|
||||||
setShowing(false);
|
setShowing(false);
|
||||||
d->animCircleId = animdriver->customAnimation(10, 240, Plasma::Animator::EaseOutCurve, this, "animateCircle");
|
d->animCircleId =
|
||||||
|
animdriver->customAnimation(10, 240, Plasma::Animator::EaseOutCurve, this, "animateCircle");
|
||||||
|
|
||||||
if (d->toolBacker) {
|
if (d->toolBacker) {
|
||||||
d->toolBacker->hide();
|
d->toolBacker->hide();
|
||||||
@ -474,4 +504,3 @@ void DesktopToolBox::toggle()
|
|||||||
} // plasma namespace
|
} // plasma namespace
|
||||||
|
|
||||||
#include "desktoptoolbox_p.moc"
|
#include "desktoptoolbox_p.moc"
|
||||||
|
|
||||||
|
@ -80,6 +80,5 @@ void ExtenderApplet::itemDetached(Plasma::ExtenderItem*)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#include "extenderapplet_p.moc"
|
#include "extenderapplet_p.moc"
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#ifndef WIDGETS_EXTENDERITEM_P_H
|
#ifndef WIDGETS_EXTENDERITEM_P_H
|
||||||
#define WIDGETS_EXTENDERITEM_P_H
|
#define WIDGETS_EXTENDERITEM_P_H
|
||||||
|
|
||||||
|
|
||||||
#endif // WIDGETS_EXTENDERITEM_P_H
|
#endif // WIDGETS_EXTENDERITEM_P_H
|
||||||
|
@ -44,7 +44,6 @@
|
|||||||
|
|
||||||
#include "private/style.h"
|
#include "private/style.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -98,8 +97,6 @@ void NativeTabBarPrivate::storeLastIndex()
|
|||||||
lastIndex[1] = q->currentIndex();
|
lastIndex[1] = q->currentIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
NativeTabBar::NativeTabBar(QWidget *parent)
|
NativeTabBar::NativeTabBar(QWidget *parent)
|
||||||
: QTabBar(parent),
|
: QTabBar(parent),
|
||||||
d(new NativeTabBarPrivate(this))
|
d(new NativeTabBarPrivate(this))
|
||||||
@ -238,7 +235,6 @@ void NativeTabBar::paintEvent(QPaintEvent *event)
|
|||||||
d->buttonSvg->resizePanel(movingRect.size());
|
d->buttonSvg->resizePanel(movingRect.size());
|
||||||
d->buttonSvg->paintPanel(&painter, movingRect.topLeft());
|
d->buttonSvg->paintPanel(&painter, movingRect.topLeft());
|
||||||
|
|
||||||
|
|
||||||
QFontMetrics metrics(painter.font());
|
QFontMetrics metrics(painter.font());
|
||||||
|
|
||||||
for (int i = 0; i < count(); i++) {
|
for (int i = 0; i < count(); i++) {
|
||||||
@ -300,7 +296,8 @@ void NativeTabBar::paintEvent(QPaintEvent *event)
|
|||||||
|
|
||||||
QStyleOption so;
|
QStyleOption so;
|
||||||
so.initFrom(this);
|
so.initFrom(this);
|
||||||
so.palette.setColor(QPalette::ButtonText, Plasma::Theme::defaultTheme()->color(Theme::TextColor));
|
so.palette.setColor(QPalette::ButtonText,
|
||||||
|
Plasma::Theme::defaultTheme()->color(Theme::TextColor));
|
||||||
|
|
||||||
so.rect = scrollButtonsRect.adjusted(0, 0, -scrollButtonsRect.width() / 2, 0);
|
so.rect = scrollButtonsRect.adjusted(0, 0, -scrollButtonsRect.width() / 2, 0);
|
||||||
style()->drawPrimitive(QStyle::PE_IndicatorArrowLeft, &so, &painter, this);
|
style()->drawPrimitive(QStyle::PE_IndicatorArrowLeft, &so, &painter, this);
|
||||||
@ -344,7 +341,8 @@ void NativeTabBar::tabLayoutChange()
|
|||||||
void NativeTabBar::startAnimation()
|
void NativeTabBar::startAnimation()
|
||||||
{
|
{
|
||||||
d->storeLastIndex();
|
d->storeLastIndex();
|
||||||
Plasma::Animator::self()->customAnimation(10, 150, Plasma::Animator::EaseInOutCurve, this, "onValueChanged");
|
Plasma::Animator::self()->customAnimation(
|
||||||
|
10, 150, Plasma::Animator::EaseInOutCurve, this, "onValueChanged");
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeTabBar::onValueChanged(qreal value)
|
void NativeTabBar::onValueChanged(qreal value)
|
||||||
|
@ -100,7 +100,8 @@ ThemePackage::ThemePackage(QObject *parent)
|
|||||||
addFileDefinition("opaque/widgets/tooltip", "opaque/widgets/tooltip.svg",
|
addFileDefinition("opaque/widgets/tooltip", "opaque/widgets/tooltip.svg",
|
||||||
i18n("Opaque background image for tooltips"));
|
i18n("Opaque background image for tooltips"));
|
||||||
|
|
||||||
addDirectoryDefinition("locolor/dialogs", "locolor/dialogs/", i18n("Low color images for dialogs"));
|
addDirectoryDefinition("locolor/dialogs", "locolor/dialogs/",
|
||||||
|
i18n("Low color images for dialogs"));
|
||||||
addFileDefinition("locolor/dialogs/background", "locolor/dialogs/background.svg",
|
addFileDefinition("locolor/dialogs/background", "locolor/dialogs/background.svg",
|
||||||
i18n("Low color generic dialog background"));
|
i18n("Low color generic dialog background"));
|
||||||
addFileDefinition("locolor/dialogs/shutdowndialog", "locolor/dialogs/shutdowndialog.svg",
|
addFileDefinition("locolor/dialogs/shutdowndialog", "locolor/dialogs/shutdowndialog.svg",
|
||||||
|
@ -100,7 +100,8 @@ PanelToolBox::PanelToolBox(QGraphicsItem *parent)
|
|||||||
: ToolBox(parent),
|
: ToolBox(parent),
|
||||||
d(new PanelToolBoxPrivate)
|
d(new PanelToolBoxPrivate)
|
||||||
{
|
{
|
||||||
connect(Plasma::Animator::self(), SIGNAL(movementFinished(QGraphicsItem*)), this, SLOT(toolMoved(QGraphicsItem*)));
|
connect(Plasma::Animator::self(), SIGNAL(movementFinished(QGraphicsItem*)),
|
||||||
|
this, SLOT(toolMoved(QGraphicsItem*)));
|
||||||
connect(this, SIGNAL(toggled()), this, SLOT(toggle()));
|
connect(this, SIGNAL(toggled()), this, SLOT(toggle()));
|
||||||
|
|
||||||
setZValue(10000000);
|
setZValue(10000000);
|
||||||
@ -173,12 +174,14 @@ void PanelToolBox::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
|
|||||||
QRect iconRect;
|
QRect iconRect;
|
||||||
|
|
||||||
if (corner() == ToolBox::Bottom) {
|
if (corner() == ToolBox::Bottom) {
|
||||||
iconRect = QRect(QPoint(gradientCenter.x() - iconSize().width()/2, (int)boundingRect().top() - iconSize().height() - 2), iconSize());
|
iconRect = QRect(QPoint(gradientCenter.x() - iconSize().width() / 2,
|
||||||
|
(int)boundingRect().top() - iconSize().height() - 2), iconSize());
|
||||||
} else if (corner() == ToolBox::Left) {
|
} else if (corner() == ToolBox::Left) {
|
||||||
iconRect = QRect(QPoint(2, gradientCenter.y() - iconSize().height() / 2), iconSize());
|
iconRect = QRect(QPoint(2, gradientCenter.y() - iconSize().height() / 2), iconSize());
|
||||||
//Only Left,Right and Bottom supported, default to Right
|
//Only Left,Right and Bottom supported, default to Right
|
||||||
} else {
|
} else {
|
||||||
iconRect = QRect(QPoint((int)boundingRect().left() - iconSize().width() + 1, gradientCenter.y() - iconSize().height()/2), iconSize());
|
iconRect = QRect(QPoint((int)boundingRect().left() - iconSize().width() + 1,
|
||||||
|
gradientCenter.y() - iconSize().height() / 2), iconSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qFuzzyCompare(qreal(1.0), progress)) {
|
if (qFuzzyCompare(qreal(1.0), progress)) {
|
||||||
@ -188,7 +191,9 @@ void PanelToolBox::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
|
|||||||
} else {
|
} else {
|
||||||
QPixmap disabled = d->icon.pixmap(iconSize(), QIcon::Disabled, QIcon::Off);
|
QPixmap disabled = d->icon.pixmap(iconSize(), QIcon::Disabled, QIcon::Off);
|
||||||
QPixmap enabled = d->icon.pixmap(iconSize());
|
QPixmap enabled = d->icon.pixmap(iconSize());
|
||||||
QPixmap result = PaintUtils::transition(d->icon.pixmap(iconSize(), QIcon::Disabled, QIcon::Off), d->icon.pixmap(iconSize()), progress);
|
QPixmap result = PaintUtils::transition(
|
||||||
|
d->icon.pixmap(iconSize(), QIcon::Disabled, QIcon::Off),
|
||||||
|
d->icon.pixmap(iconSize()), progress);
|
||||||
painter->drawPixmap(iconRect, result);
|
painter->drawPixmap(iconRect, result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -199,12 +204,21 @@ QPainterPath PanelToolBox::shape() const
|
|||||||
int toolSize = size();// + (int)d->animFrame;
|
int toolSize = size();// + (int)d->animFrame;
|
||||||
|
|
||||||
if (corner() == ToolBox::Bottom) {
|
if (corner() == ToolBox::Bottom) {
|
||||||
path.arcTo(QRectF(boundingRect().center().x() - toolSize, boundingRect().top() - toolSize, toolSize*2, toolSize*2), 0, 180);
|
path.arcTo(QRectF(boundingRect().center().x() - toolSize,
|
||||||
|
boundingRect().top() - toolSize,
|
||||||
|
toolSize * 2,
|
||||||
|
toolSize * 2), 0, 180);
|
||||||
} else if (corner() == ToolBox::Left) {
|
} else if (corner() == ToolBox::Left) {
|
||||||
path.arcTo(QRectF(boundingRect().left() - toolSize, boundingRect().center().y() - toolSize, toolSize*2, toolSize*2), 90, -180);
|
path.arcTo(QRectF(boundingRect().left() - toolSize,
|
||||||
|
boundingRect().center().y() - toolSize,
|
||||||
|
toolSize * 2,
|
||||||
|
toolSize * 2), 90, -180);
|
||||||
//Only Left,Right and Bottom supported, default to Right
|
//Only Left,Right and Bottom supported, default to Right
|
||||||
} else {
|
} else {
|
||||||
path.arcTo(QRectF(boundingRect().left() - toolSize, boundingRect().center().y() - toolSize, toolSize*2, toolSize*2), 90, 180);
|
path.arcTo(QRectF(boundingRect().left() - toolSize,
|
||||||
|
boundingRect().center().y() - toolSize,
|
||||||
|
toolSize * 2,
|
||||||
|
toolSize * 2), 90, 180);
|
||||||
}
|
}
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
@ -248,7 +262,8 @@ void PanelToolBox::showToolBox()
|
|||||||
if (!tool->isEnabled()) {
|
if (!tool->isEnabled()) {
|
||||||
if (tool->isVisible()) {
|
if (tool->isVisible()) {
|
||||||
const int height = static_cast<int>(tool->boundingRect().height());
|
const int height = static_cast<int>(tool->boundingRect().height());
|
||||||
animdriver->moveItem(tool, Plasma::Animator::SlideOutMovement, QPoint(size() * 2, -height));
|
animdriver->moveItem(tool, Plasma::Animator::SlideOutMovement,
|
||||||
|
QPoint(size() * 2, -height));
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -273,13 +288,15 @@ void PanelToolBox::showToolBox()
|
|||||||
setShowing(true);
|
setShowing(true);
|
||||||
// TODO: 10 and 200 shouldn't be hardcoded here. There needs to be a way to
|
// TODO: 10 and 200 shouldn't be hardcoded here. There needs to be a way to
|
||||||
// match whatever the time is that moveItem() takes. Same in hoverLeaveEvent().
|
// match whatever the time is that moveItem() takes. Same in hoverLeaveEvent().
|
||||||
d->animId = animdriver->customAnimation(10, 240, Plasma::Animator::EaseInCurve, this, "animate");
|
d->animId = animdriver->customAnimation(
|
||||||
|
10, 240, Plasma::Animator::EaseInCurve, this, "animate");
|
||||||
d->stopwatch.restart();
|
d->stopwatch.restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PanelToolBox::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
void PanelToolBox::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
//kDebug() << event->pos() << event->scenePos() << d->toolBacker->rect().contains(event->scenePos().toPoint());
|
//kDebug() << event->pos() << event->scenePos()
|
||||||
|
// << d->toolBacker->rect().contains(event->scenePos().toPoint());
|
||||||
if ((d->toolBacker && d->toolBacker->rect().contains(event->scenePos().toPoint())) ||
|
if ((d->toolBacker && d->toolBacker->rect().contains(event->scenePos().toPoint())) ||
|
||||||
d->stopwatch.elapsed() < 100 || d->toggled) {
|
d->stopwatch.elapsed() < 100 || d->toggled) {
|
||||||
QGraphicsItem::hoverLeaveEvent(event);
|
QGraphicsItem::hoverLeaveEvent(event);
|
||||||
@ -314,7 +331,8 @@ void PanelToolBox::hideToolBox()
|
|||||||
}
|
}
|
||||||
|
|
||||||
setShowing(false);
|
setShowing(false);
|
||||||
d->animId = animdriver->customAnimation(10, 240, Plasma::Animator::EaseOutCurve, this, "animate");
|
d->animId = animdriver->customAnimation(
|
||||||
|
10, 240, Plasma::Animator::EaseOutCurve, this, "animate");
|
||||||
|
|
||||||
if (d->toolBacker) {
|
if (d->toolBacker) {
|
||||||
d->toolBacker->hide();
|
d->toolBacker->hide();
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef PLASMA_SHAREDTIMER_P_H
|
#ifndef PLASMA_SHAREDTIMER_P_H
|
||||||
#define PLASMA_SHAREDTIMER_P_H
|
#define PLASMA_SHAREDTIMER_P_H
|
||||||
|
|
||||||
|
@ -29,7 +29,8 @@
|
|||||||
|
|
||||||
namespace Plasma {
|
namespace Plasma {
|
||||||
|
|
||||||
class StylePrivate {
|
class StylePrivate
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
StylePrivate()
|
StylePrivate()
|
||||||
: scrollbar(0)
|
: scrollbar(0)
|
||||||
@ -91,7 +92,8 @@ void Style::drawComplexControl(ComplexControl control,
|
|||||||
subLine.moveCenter(subControlRect(control, option, SC_ScrollBarSubLine, widget).center());
|
subLine.moveCenter(subControlRect(control, option, SC_ScrollBarSubLine, widget).center());
|
||||||
addLine.moveCenter(subControlRect(control, option, SC_ScrollBarAddLine, widget).center());
|
addLine.moveCenter(subControlRect(control, option, SC_ScrollBarAddLine, widget).center());
|
||||||
|
|
||||||
const QRect slider = subControlRect(control, option, SC_ScrollBarSlider, widget).adjusted(1, 0, -1, 0);
|
const QRect slider =
|
||||||
|
subControlRect(control, option, SC_ScrollBarSlider, widget).adjusted(1, 0, -1, 0);
|
||||||
|
|
||||||
d->scrollbar->setElementPrefix("background");
|
d->scrollbar->setElementPrefix("background");
|
||||||
d->scrollbar->resizePanel(option->rect.size());
|
d->scrollbar->resizePanel(option->rect.size());
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef PLASMA_STYLE_H
|
#ifndef PLASMA_STYLE_H
|
||||||
#define PLASMA_STYLE_H
|
#define PLASMA_STYLE_H
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2007 by Aaron Seigo <aseigo@kde.org>
|
* Copyright 2007 by Aaron Seigo <aseigo@kde.org>
|
||||||
* Copyright 2008 by Marco Martin <notmart@gmail.com>
|
* Copyright 2008 by Marco Martin <notmart@gmail.com>
|
||||||
|
@ -43,7 +43,8 @@ public:
|
|||||||
/**
|
/**
|
||||||
* These flags represents what borders should be drawn
|
* These flags represents what borders should be drawn
|
||||||
*/
|
*/
|
||||||
enum Corner { Top = 0,
|
enum Corner {
|
||||||
|
Top = 0,
|
||||||
TopRight,
|
TopRight,
|
||||||
TopLeft,
|
TopLeft,
|
||||||
Left,
|
Left,
|
||||||
|
@ -41,12 +41,12 @@ class ToolTipPrivate
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ToolTipPrivate(QObject *s)
|
ToolTipPrivate(QObject *s)
|
||||||
: label(0)
|
: label(0),
|
||||||
, imageLabel(0)
|
imageLabel(0),
|
||||||
, preview(0)
|
preview(0),
|
||||||
, windowToPreview(0)
|
windowToPreview(0),
|
||||||
, source(s)
|
source(s),
|
||||||
, isActivated(true)
|
isActivated(true)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
QLabel *label;
|
QLabel *label;
|
||||||
@ -80,8 +80,8 @@ void ToolTip::mouseReleaseEvent(QMouseEvent* event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ToolTip::ToolTip(QObject *source)
|
ToolTip::ToolTip(QObject *source)
|
||||||
: QWidget(0)
|
: QWidget(0),
|
||||||
, d(new ToolTipPrivate(source))
|
d(new ToolTipPrivate(source))
|
||||||
{
|
{
|
||||||
if (source) {
|
if (source) {
|
||||||
connect(source, SIGNAL(destroyed(QObject*)), this, SLOT(sourceDestroyed()));
|
connect(source, SIGNAL(destroyed(QObject*)), this, SLOT(sourceDestroyed()));
|
||||||
@ -187,13 +187,14 @@ void ToolTip::updateTheme()
|
|||||||
|
|
||||||
// Make the tooltip use Plasma's colorscheme
|
// Make the tooltip use Plasma's colorscheme
|
||||||
QPalette plasmaPalette = QPalette();
|
QPalette plasmaPalette = QPalette();
|
||||||
plasmaPalette.setColor(QPalette::Window, Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor));
|
plasmaPalette.setColor(QPalette::Window,
|
||||||
plasmaPalette.setColor(QPalette::WindowText, Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor));
|
Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor));
|
||||||
|
plasmaPalette.setColor(QPalette::WindowText,
|
||||||
|
Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor));
|
||||||
setAutoFillBackground(true);
|
setAutoFillBackground(true);
|
||||||
setPalette(plasmaPalette);
|
setPalette(plasmaPalette);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace Plasma
|
} // namespace Plasma
|
||||||
|
|
||||||
#include "tooltip_p.moc"
|
#include "tooltip_p.moc"
|
||||||
|
@ -29,7 +29,6 @@
|
|||||||
#include <fixx11h.h>
|
#include <fixx11h.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
namespace Plasma {
|
namespace Plasma {
|
||||||
|
|
||||||
bool WindowPreview::previewsAvailable() // static
|
bool WindowPreview::previewsAvailable() // static
|
||||||
@ -53,7 +52,6 @@ bool WindowPreview::previewsAvailable() // static
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WindowPreview::WindowPreview(QWidget *parent)
|
WindowPreview::WindowPreview(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user