QPointer -> QWeakPointer
svn path=/trunk/KDE/kdelibs/; revision=1034904
This commit is contained in:
parent
2ce5b457e3
commit
c27ddab67e
24
applet.cpp
24
applet.cpp
@ -584,9 +584,9 @@ void AppletPrivate::positionMessageOverlay()
|
|||||||
void AppletPrivate::destroyMessageOverlay()
|
void AppletPrivate::destroyMessageOverlay()
|
||||||
{
|
{
|
||||||
if (messageDialog) {
|
if (messageDialog) {
|
||||||
messageDialog->animatedHide(Plasma::locationToInverseDirection(q->location()));
|
messageDialog.data()->animatedHide(Plasma::locationToInverseDirection(q->location()));
|
||||||
//messageDialog->deleteLater();
|
//messageDialog.data()->deleteLater();
|
||||||
messageDialog = 0;
|
messageDialog.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!messageOverlay) {
|
if (!messageOverlay) {
|
||||||
@ -1088,18 +1088,18 @@ void Applet::showMessage(const QIcon &icon, const QString &message, const Messag
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (d->messageDialog) {
|
if (d->messageDialog) {
|
||||||
delete d->messageDialog->graphicsWidget();
|
delete d->messageDialog.data()->graphicsWidget();
|
||||||
} else {
|
} else {
|
||||||
d->messageDialog = new Plasma::Dialog;
|
d->messageDialog = new Plasma::Dialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
ToolTipManager::self()->hide(this);
|
ToolTipManager::self()->hide(this);
|
||||||
KWindowSystem::setOnAllDesktops(d->messageDialog->winId(), true);
|
KWindowSystem::setOnAllDesktops(d->messageDialog.data()->winId(), true);
|
||||||
KWindowSystem::setState(d->messageDialog->winId(), NET::SkipTaskbar | NET::SkipPager);
|
KWindowSystem::setState(d->messageDialog.data()->winId(), NET::SkipTaskbar | NET::SkipPager);
|
||||||
d->messageDialog->setGraphicsWidget(mainWidget);
|
d->messageDialog.data()->setGraphicsWidget(mainWidget);
|
||||||
connect(d->messageDialog, SIGNAL(destroyed(QObject*)), mainWidget, SLOT(deleteLater()));
|
connect(d->messageDialog.data(), SIGNAL(destroyed(QObject*)), mainWidget, SLOT(deleteLater()));
|
||||||
} else {
|
} else {
|
||||||
delete d->messageDialog;
|
delete d->messageDialog.data();
|
||||||
d->createMessageOverlay();
|
d->createMessageOverlay();
|
||||||
d->messageOverlay->opacity = 0.8;
|
d->messageOverlay->opacity = 0.8;
|
||||||
QGraphicsLinearLayout *l = new QGraphicsLinearLayout(d->messageOverlay);
|
QGraphicsLinearLayout *l = new QGraphicsLinearLayout(d->messageOverlay);
|
||||||
@ -1109,11 +1109,11 @@ void Applet::showMessage(const QIcon &icon, const QString &message, const Messag
|
|||||||
if (d->messageDialog) {
|
if (d->messageDialog) {
|
||||||
QPoint pos = geometry().topLeft().toPoint();
|
QPoint pos = geometry().topLeft().toPoint();
|
||||||
if (corona) {
|
if (corona) {
|
||||||
pos = corona->popupPosition(this, d->messageDialog->size());
|
pos = corona->popupPosition(this, d->messageDialog.data()->size());
|
||||||
}
|
}
|
||||||
|
|
||||||
d->messageDialog->move(pos);
|
d->messageDialog.data()->move(pos);
|
||||||
d->messageDialog->animatedShow(locationToDirection(location()));
|
d->messageDialog.data()->animatedShow(locationToDirection(location()));
|
||||||
} else {
|
} else {
|
||||||
d->messageOverlay->show();
|
d->messageOverlay->show();
|
||||||
}
|
}
|
||||||
|
118
popupapplet.cpp
118
popupapplet.cpp
@ -120,10 +120,10 @@ void PopupApplet::setWidget(QWidget *widget)
|
|||||||
{
|
{
|
||||||
if (d->widget) {
|
if (d->widget) {
|
||||||
if (d->dialog) {
|
if (d->dialog) {
|
||||||
d->dialog->setGraphicsWidget(0);
|
d->dialog.data()->setGraphicsWidget(0);
|
||||||
QVBoxLayout *lay = 0;
|
QVBoxLayout *lay = 0;
|
||||||
|
|
||||||
QLayout *existingLayout = d->dialog->layout();
|
QLayout *existingLayout = d->dialog.data()->layout();
|
||||||
if (existingLayout) {
|
if (existingLayout) {
|
||||||
lay = dynamic_cast<QVBoxLayout *>(existingLayout);
|
lay = dynamic_cast<QVBoxLayout *>(existingLayout);
|
||||||
if (!lay) {
|
if (!lay) {
|
||||||
@ -133,7 +133,7 @@ void PopupApplet::setWidget(QWidget *widget)
|
|||||||
|
|
||||||
if (!lay) {
|
if (!lay) {
|
||||||
lay = new QVBoxLayout;
|
lay = new QVBoxLayout;
|
||||||
d->dialog->setLayout(lay);
|
d->dialog.data()->setLayout(lay);
|
||||||
}
|
}
|
||||||
|
|
||||||
lay->removeWidget(d->widget);
|
lay->removeWidget(d->widget);
|
||||||
@ -159,7 +159,7 @@ void PopupApplet::setGraphicsWidget(QGraphicsWidget *graphicsWidget)
|
|||||||
{
|
{
|
||||||
if (d->graphicsWidget) {
|
if (d->graphicsWidget) {
|
||||||
if (d->dialog) {
|
if (d->dialog) {
|
||||||
d->dialog->setGraphicsWidget(graphicsWidget);
|
d->dialog.data()->setGraphicsWidget(graphicsWidget);
|
||||||
} else {
|
} else {
|
||||||
QGraphicsLinearLayout *lay = static_cast<QGraphicsLinearLayout *>(layout());
|
QGraphicsLinearLayout *lay = static_cast<QGraphicsLinearLayout *>(layout());
|
||||||
lay->removeAt(0);
|
lay->removeAt(0);
|
||||||
@ -183,7 +183,7 @@ void PopupAppletPrivate::checkExtenderAppearance(Plasma::FormFactor f)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (dialog) {
|
if (dialog) {
|
||||||
dialog->setGraphicsWidget(extender);
|
dialog.data()->setGraphicsWidget(extender);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -250,17 +250,16 @@ void PopupAppletPrivate::popupConstraintsEvent(Plasma::Constraints constraints)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (dialog) {
|
if (dialog) {
|
||||||
if (dialog->layout() && qWidget) {
|
if (dialog.data()->layout() && qWidget) {
|
||||||
//we don't want to delete Widget inside the dialog layout
|
//we don't want to delete Widget inside the dialog layout
|
||||||
dialog->layout()->removeWidget(qWidget);
|
dialog.data()->layout()->removeWidget(qWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qWidget) {
|
if (qWidget) {
|
||||||
qWidget->setParent(0);
|
qWidget->setParent(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete dialog;
|
delete dialog.data();
|
||||||
dialog = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!lay) {
|
if (!lay) {
|
||||||
@ -348,27 +347,27 @@ void PopupAppletPrivate::popupConstraintsEvent(Plasma::Constraints constraints)
|
|||||||
//could that cast ever fail??
|
//could that cast ever fail??
|
||||||
if (corona) {
|
if (corona) {
|
||||||
corona->addOffscreenWidget(gWidget);
|
corona->addOffscreenWidget(gWidget);
|
||||||
dialog->setGraphicsWidget(gWidget);
|
dialog.data()->setGraphicsWidget(gWidget);
|
||||||
gWidget->resize(gWidget->preferredSize());
|
gWidget->resize(gWidget->preferredSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | (gWidget->windowFlags() & Qt::X11BypassWindowManagerHint));
|
dialog.data()->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | (gWidget->windowFlags() & Qt::X11BypassWindowManagerHint));
|
||||||
} else if (qWidget) {
|
} else if (qWidget) {
|
||||||
QVBoxLayout *l_layout = new QVBoxLayout(dialog);
|
QVBoxLayout *l_layout = new QVBoxLayout(dialog.data());
|
||||||
l_layout->setSpacing(0);
|
l_layout->setSpacing(0);
|
||||||
l_layout->setMargin(0);
|
l_layout->setMargin(0);
|
||||||
l_layout->addWidget(qWidget);
|
l_layout->addWidget(qWidget);
|
||||||
dialog->adjustSize();
|
dialog.data()->adjustSize();
|
||||||
dialog->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | (qWidget->windowFlags() & Qt::X11BypassWindowManagerHint));
|
dialog.data()->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | (qWidget->windowFlags() & Qt::X11BypassWindowManagerHint));
|
||||||
} else {
|
} else {
|
||||||
dialog->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
|
dialog.data()->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
|
||||||
}
|
}
|
||||||
|
|
||||||
KWindowSystem::setState(dialog->winId(), NET::SkipTaskbar | NET::SkipPager);
|
KWindowSystem::setState(dialog.data()->winId(), NET::SkipTaskbar | NET::SkipPager);
|
||||||
dialog->installEventFilter(q);
|
dialog.data()->installEventFilter(q);
|
||||||
|
|
||||||
QObject::connect(dialog, SIGNAL(dialogResized()), q, SLOT(dialogSizeChanged()));
|
QObject::connect(dialog.data(), SIGNAL(dialogResized()), q, SLOT(dialogSizeChanged()));
|
||||||
QObject::connect(dialog, SIGNAL(dialogVisible(bool)), q, SLOT(dialogStatusChanged(bool)));
|
QObject::connect(dialog.data(), SIGNAL(dialogVisible(bool)), q, SLOT(dialogStatusChanged(bool)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (icon && lay) {
|
if (icon && lay) {
|
||||||
@ -410,7 +409,7 @@ void PopupApplet::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|||||||
|
|
||||||
bool PopupApplet::eventFilter(QObject *watched, QEvent *event)
|
bool PopupApplet::eventFilter(QObject *watched, QEvent *event)
|
||||||
{
|
{
|
||||||
if (!d->passive && watched == d->dialog && (event->type() == QEvent::WindowDeactivate)) {
|
if (!d->passive && watched == d->dialog.data() && (event->type() == QEvent::WindowDeactivate)) {
|
||||||
d->popupLostFocus = true;
|
d->popupLostFocus = true;
|
||||||
hidePopup();
|
hidePopup();
|
||||||
QTimer::singleShot(100, this, SLOT(clearPopupLostFocus()));
|
QTimer::singleShot(100, this, SLOT(clearPopupLostFocus()));
|
||||||
@ -428,7 +427,7 @@ bool PopupApplet::eventFilter(QObject *watched, QEvent *event)
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (watched == d->dialog && event->type() == QEvent::ContextMenu) {
|
if (watched == d->dialog.data() && event->type() == QEvent::ContextMenu) {
|
||||||
//pass it up to the applet
|
//pass it up to the applet
|
||||||
//well, actually we have to pass it to the *containment*
|
//well, actually we have to pass it to the *containment*
|
||||||
//because all the code for showing an applet's contextmenu is actually in Containment.
|
//because all the code for showing an applet's contextmenu is actually in Containment.
|
||||||
@ -462,7 +461,7 @@ void PopupApplet::dragLeaveEvent(QGraphicsSceneDragDropEvent *event)
|
|||||||
if (mimeData && qobject_cast<Extender*>(graphicsWidget())) {
|
if (mimeData && qobject_cast<Extender*>(graphicsWidget())) {
|
||||||
//We want to hide the popup if we're not moving onto the popup AND it is not the popup
|
//We want to hide the popup if we're not moving onto the popup AND it is not the popup
|
||||||
//we started.
|
//we started.
|
||||||
if (d->dialog && !d->dialog->geometry().contains(event->screenPos()) &&
|
if (d->dialog && !d->dialog.data()->geometry().contains(event->screenPos()) &&
|
||||||
mimeData->extenderItem()->extender() != qobject_cast<Extender*>(graphicsWidget())) {
|
mimeData->extenderItem()->extender() != qobject_cast<Extender*>(graphicsWidget())) {
|
||||||
//We actually try to hide the popup, with a call to showPopup, with a smal timeout,
|
//We actually try to hide the popup, with a call to showPopup, with a smal timeout,
|
||||||
//so if the user moves into the popup fast enough, it remains open (the extender
|
//so if the user moves into the popup fast enough, it remains open (the extender
|
||||||
@ -490,7 +489,7 @@ void PopupApplet::showPopup(uint popupDuration)
|
|||||||
if (d->dialog) {
|
if (d->dialog) {
|
||||||
// move the popup before its fist show, even if the show isn't triggered by
|
// move the popup before its fist show, even if the show isn't triggered by
|
||||||
// a click, this should fix the first random position seen in some widgets
|
// a click, this should fix the first random position seen in some widgets
|
||||||
if (!d->dialog->isVisible()) {
|
if (!d->dialog.data()->isVisible()) {
|
||||||
d->internalTogglePopup();
|
d->internalTogglePopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -513,9 +512,9 @@ void PopupApplet::hidePopup()
|
|||||||
{
|
{
|
||||||
if (d->dialog) {
|
if (d->dialog) {
|
||||||
if (location() != Floating) {
|
if (location() != Floating) {
|
||||||
d->dialog->animatedHide(locationToInverseDirection(location()));
|
d->dialog.data()->animatedHide(locationToInverseDirection(location()));
|
||||||
} else {
|
} else {
|
||||||
d->dialog->hide();
|
d->dialog.data()->hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -546,13 +545,12 @@ bool PopupApplet::isPassivePopup() const
|
|||||||
|
|
||||||
bool PopupApplet::isPopupShowing() const
|
bool PopupApplet::isPopupShowing() const
|
||||||
{
|
{
|
||||||
return d->dialog && d->dialog->isVisible();
|
return d->dialog && d->dialog.data()->isVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
PopupAppletPrivate::PopupAppletPrivate(PopupApplet *applet)
|
PopupAppletPrivate::PopupAppletPrivate(PopupApplet *applet)
|
||||||
: q(applet),
|
: q(applet),
|
||||||
icon(0),
|
icon(0),
|
||||||
dialog(0),
|
|
||||||
proxy(0),
|
proxy(0),
|
||||||
widget(0),
|
widget(0),
|
||||||
graphicsWidget(0),
|
graphicsWidget(0),
|
||||||
@ -570,7 +568,7 @@ PopupAppletPrivate::~PopupAppletPrivate()
|
|||||||
proxy->setWidget(0);
|
proxy->setWidget(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete dialog;
|
delete dialog.data();
|
||||||
delete icon;
|
delete icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -589,14 +587,14 @@ void PopupAppletPrivate::internalTogglePopup()
|
|||||||
timer->stop();
|
timer->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dialog->isVisible()) {
|
if (dialog.data()->isVisible()) {
|
||||||
if (q->location() != Floating) {
|
if (q->location() != Floating) {
|
||||||
dialog->animatedHide(locationToInverseDirection(q->location()));
|
dialog.data()->animatedHide(locationToInverseDirection(q->location()));
|
||||||
} else {
|
} else {
|
||||||
dialog->hide();
|
dialog.data()->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog->clearFocus();
|
dialog.data()->clearFocus();
|
||||||
} else {
|
} else {
|
||||||
if (q->graphicsWidget() &&
|
if (q->graphicsWidget() &&
|
||||||
q->graphicsWidget() == static_cast<Applet*>(q)->d->extender &&
|
q->graphicsWidget() == static_cast<Applet*>(q)->d->extender &&
|
||||||
@ -608,17 +606,17 @@ void PopupAppletPrivate::internalTogglePopup()
|
|||||||
ToolTipManager::self()->hide(q);
|
ToolTipManager::self()->hide(q);
|
||||||
updateDialogPosition();
|
updateDialogPosition();
|
||||||
|
|
||||||
KWindowSystem::setOnAllDesktops(dialog->winId(), true);
|
KWindowSystem::setOnAllDesktops(dialog.data()->winId(), true);
|
||||||
KWindowSystem::setState(dialog->winId(), NET::SkipTaskbar | NET::SkipPager);
|
KWindowSystem::setState(dialog.data()->winId(), NET::SkipTaskbar | NET::SkipPager);
|
||||||
|
|
||||||
if (q->location() != Floating) {
|
if (q->location() != Floating) {
|
||||||
dialog->animatedShow(locationToDirection(q->location()));
|
dialog.data()->animatedShow(locationToDirection(q->location()));
|
||||||
} else {
|
} else {
|
||||||
dialog->show();
|
dialog.data()->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(dialog->windowFlags() & Qt::X11BypassWindowManagerHint)) {
|
if (!(dialog.data()->windowFlags() & Qt::X11BypassWindowManagerHint)) {
|
||||||
KWindowSystem::activateWindow(dialog->winId());
|
KWindowSystem::activateWindow(dialog.data()->winId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -640,8 +638,8 @@ void PopupAppletPrivate::dialogSizeChanged()
|
|||||||
if (dialog) {
|
if (dialog) {
|
||||||
KConfigGroup *mainGroup = static_cast<Applet*>(q)->d->mainConfigGroup();
|
KConfigGroup *mainGroup = static_cast<Applet*>(q)->d->mainConfigGroup();
|
||||||
KConfigGroup sizeGroup(mainGroup, "PopupApplet");
|
KConfigGroup sizeGroup(mainGroup, "PopupApplet");
|
||||||
sizeGroup.writeEntry("DialogHeight", dialog->height());
|
sizeGroup.writeEntry("DialogHeight", dialog.data()->height());
|
||||||
sizeGroup.writeEntry("DialogWidth", dialog->width());
|
sizeGroup.writeEntry("DialogWidth", dialog.data()->width());
|
||||||
|
|
||||||
updateDialogPosition();
|
updateDialogPosition();
|
||||||
|
|
||||||
@ -674,9 +672,9 @@ void PopupAppletPrivate::updateDialogPosition()
|
|||||||
|
|
||||||
int preferredWidth = 0;
|
int preferredWidth = 0;
|
||||||
int preferredHeight = 0;
|
int preferredHeight = 0;
|
||||||
if (dialog->graphicsWidget()) {
|
if (dialog.data()->graphicsWidget()) {
|
||||||
preferredWidth = dialog->graphicsWidget()->preferredSize().width();
|
preferredWidth = dialog.data()->graphicsWidget()->preferredSize().width();
|
||||||
preferredHeight = dialog->graphicsWidget()->preferredSize().height();
|
preferredHeight = dialog.data()->graphicsWidget()->preferredSize().height();
|
||||||
}
|
}
|
||||||
|
|
||||||
const int width = qMin(sizeGroup.readEntry("DialogWidth", preferredWidth),
|
const int width = qMin(sizeGroup.readEntry("DialogWidth", preferredWidth),
|
||||||
@ -687,27 +685,27 @@ void PopupAppletPrivate::updateDialogPosition()
|
|||||||
QSize saved(width, height);
|
QSize saved(width, height);
|
||||||
|
|
||||||
if (saved.isNull()) {
|
if (saved.isNull()) {
|
||||||
saved = dialog->sizeHint();
|
saved = dialog.data()->sizeHint();
|
||||||
} else {
|
} else {
|
||||||
saved = saved.expandedTo(dialog->minimumSizeHint());
|
saved = saved.expandedTo(dialog.data()->minimumSizeHint());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (saved.width() != dialog->width() || saved.height() != dialog->height()) {
|
if (saved.width() != dialog.data()->width() || saved.height() != dialog.data()->height()) {
|
||||||
dialog->resize(saved);
|
dialog.data()->resize(saved);
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize s = dialog->size();
|
QSize s = dialog.data()->size();
|
||||||
QPoint pos = view->mapFromScene(q->scenePos());
|
QPoint pos = view->mapFromScene(q->scenePos());
|
||||||
|
|
||||||
pos = corona->popupPosition(q, s);
|
pos = corona->popupPosition(q, s);
|
||||||
|
|
||||||
bool reverse = false;
|
bool reverse = false;
|
||||||
if (q->formFactor() == Plasma::Vertical) {
|
if (q->formFactor() == Plasma::Vertical) {
|
||||||
if (view->mapToGlobal(view->mapFromScene(q->scenePos())).y() + q->size().height()/2 < pos.y() + dialog->size().width()/2) {
|
if (view->mapToGlobal(view->mapFromScene(q->scenePos())).y() + q->size().height()/2 < pos.y() + dialog.data()->size().width()/2) {
|
||||||
reverse = true;
|
reverse = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (view->mapToGlobal(view->mapFromScene(q->scenePos())).x() + q->size().width()/2 < pos.x() + dialog->size().width()/2) {
|
if (view->mapToGlobal(view->mapFromScene(q->scenePos())).x() + q->size().width()/2 < pos.x() + dialog.data()->size().width()/2) {
|
||||||
reverse = true;
|
reverse = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -715,9 +713,9 @@ void PopupAppletPrivate::updateDialogPosition()
|
|||||||
switch (q->location()) {
|
switch (q->location()) {
|
||||||
case BottomEdge:
|
case BottomEdge:
|
||||||
if (pos.x() >= q->pos().x()) {
|
if (pos.x() >= q->pos().x()) {
|
||||||
dialog->setResizeHandleCorners(Dialog::NorthEast);
|
dialog.data()->setResizeHandleCorners(Dialog::NorthEast);
|
||||||
} else {
|
} else {
|
||||||
dialog->setResizeHandleCorners(Dialog::NorthWest);
|
dialog.data()->setResizeHandleCorners(Dialog::NorthWest);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reverse) {
|
if (reverse) {
|
||||||
@ -728,9 +726,9 @@ void PopupAppletPrivate::updateDialogPosition()
|
|||||||
break;
|
break;
|
||||||
case TopEdge:
|
case TopEdge:
|
||||||
if (pos.x() >= q->pos().x()) {
|
if (pos.x() >= q->pos().x()) {
|
||||||
dialog->setResizeHandleCorners(Dialog::SouthEast);
|
dialog.data()->setResizeHandleCorners(Dialog::SouthEast);
|
||||||
} else {
|
} else {
|
||||||
dialog->setResizeHandleCorners(Dialog::SouthWest);
|
dialog.data()->setResizeHandleCorners(Dialog::SouthWest);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reverse) {
|
if (reverse) {
|
||||||
@ -741,9 +739,9 @@ void PopupAppletPrivate::updateDialogPosition()
|
|||||||
break;
|
break;
|
||||||
case LeftEdge:
|
case LeftEdge:
|
||||||
if (pos.y() >= q->pos().y()) {
|
if (pos.y() >= q->pos().y()) {
|
||||||
dialog->setResizeHandleCorners(Dialog::SouthEast);
|
dialog.data()->setResizeHandleCorners(Dialog::SouthEast);
|
||||||
} else {
|
} else {
|
||||||
dialog->setResizeHandleCorners(Dialog::NorthEast);
|
dialog.data()->setResizeHandleCorners(Dialog::NorthEast);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reverse) {
|
if (reverse) {
|
||||||
@ -755,9 +753,9 @@ void PopupAppletPrivate::updateDialogPosition()
|
|||||||
|
|
||||||
case RightEdge:
|
case RightEdge:
|
||||||
if (pos.y() >= q->pos().y()) {
|
if (pos.y() >= q->pos().y()) {
|
||||||
dialog->setResizeHandleCorners(Dialog::SouthWest);
|
dialog.data()->setResizeHandleCorners(Dialog::SouthWest);
|
||||||
} else {
|
} else {
|
||||||
dialog->setResizeHandleCorners(Dialog::NorthWest);
|
dialog.data()->setResizeHandleCorners(Dialog::NorthWest);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reverse) {
|
if (reverse) {
|
||||||
@ -767,10 +765,10 @@ void PopupAppletPrivate::updateDialogPosition()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
dialog->setResizeHandleCorners(Dialog::NorthEast);
|
dialog.data()->setResizeHandleCorners(Dialog::NorthEast);
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog->move(pos);
|
dialog.data()->move(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // Plasma namespace
|
} // Plasma namespace
|
||||||
|
@ -140,7 +140,7 @@ public:
|
|||||||
Plasma::Constraints pendingConstraints;
|
Plasma::Constraints pendingConstraints;
|
||||||
|
|
||||||
// overlays and messages
|
// overlays and messages
|
||||||
QPointer<Plasma::Dialog> messageDialog;
|
QWeakPointer<Plasma::Dialog> messageDialog;
|
||||||
AppletOverlayWidget *messageOverlay;
|
AppletOverlayWidget *messageOverlay;
|
||||||
QGraphicsProxyWidget *messageOverlayProxy;
|
QGraphicsProxyWidget *messageOverlayProxy;
|
||||||
Plasma::BusyWidget *busyWidget;
|
Plasma::BusyWidget *busyWidget;
|
||||||
|
@ -42,7 +42,7 @@ public:
|
|||||||
|
|
||||||
PopupApplet *q;
|
PopupApplet *q;
|
||||||
Plasma::IconWidget *icon;
|
Plasma::IconWidget *icon;
|
||||||
QPointer<Plasma::Dialog> dialog;
|
QWeakPointer<Plasma::Dialog> dialog;
|
||||||
QGraphicsProxyWidget *proxy;
|
QGraphicsProxyWidget *proxy;
|
||||||
QWidget *widget;
|
QWidget *widget;
|
||||||
QGraphicsWidget *graphicsWidget;
|
QGraphicsWidget *graphicsWidget;
|
||||||
|
@ -134,7 +134,6 @@ class ToolTipPrivate
|
|||||||
: text(0),
|
: text(0),
|
||||||
imageLabel(0),
|
imageLabel(0),
|
||||||
preview(0),
|
preview(0),
|
||||||
source(0),
|
|
||||||
timeline(0),
|
timeline(0),
|
||||||
direction(Plasma::Up),
|
direction(Plasma::Up),
|
||||||
autohide(true)
|
autohide(true)
|
||||||
@ -144,7 +143,7 @@ class ToolTipPrivate
|
|||||||
QLabel *imageLabel;
|
QLabel *imageLabel;
|
||||||
WindowPreview *preview;
|
WindowPreview *preview;
|
||||||
FrameSvg *background;
|
FrameSvg *background;
|
||||||
QPointer<QObject> source;
|
QWeakPointer<QObject> source;
|
||||||
QTimeLine *timeline;
|
QTimeLine *timeline;
|
||||||
QPoint to;
|
QPoint to;
|
||||||
QPoint from;
|
QPoint from;
|
||||||
@ -204,7 +203,7 @@ void ToolTip::hideEvent(QHideEvent *e)
|
|||||||
{
|
{
|
||||||
QWidget::hideEvent(e);
|
QWidget::hideEvent(e);
|
||||||
if (d->source) {
|
if (d->source) {
|
||||||
QMetaObject::invokeMethod(d->source, "toolTipHidden");
|
QMetaObject::invokeMethod(d->source.data(), "toolTipHidden");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
11
svg.cpp
11
svg.cpp
@ -67,7 +67,6 @@ class SvgPrivate
|
|||||||
public:
|
public:
|
||||||
SvgPrivate(Svg *svg)
|
SvgPrivate(Svg *svg)
|
||||||
: q(svg),
|
: q(svg),
|
||||||
theme(0),
|
|
||||||
renderer(0),
|
renderer(0),
|
||||||
lastModified(0),
|
lastModified(0),
|
||||||
multipleImages(false),
|
multipleImages(false),
|
||||||
@ -181,7 +180,7 @@ class SvgPrivate
|
|||||||
theme = Plasma::Theme::defaultTheme();
|
theme = Plasma::Theme::defaultTheme();
|
||||||
}
|
}
|
||||||
|
|
||||||
return theme;
|
return theme.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
QPixmap findInCache(const QString &elementId, const QSizeF &s = QSizeF())
|
QPixmap findInCache(const QString &elementId, const QSizeF &s = QSizeF())
|
||||||
@ -303,7 +302,7 @@ class SvgPrivate
|
|||||||
s_renderers.erase(s_renderers.find(path));
|
s_renderers.erase(s_renderers.find(path));
|
||||||
|
|
||||||
if (theme) {
|
if (theme) {
|
||||||
theme->releaseRectsCache(path);
|
theme.data()->releaseRectsCache(path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -412,7 +411,7 @@ class SvgPrivate
|
|||||||
static QHash<QString, SharedSvgRenderer::Ptr> s_renderers;
|
static QHash<QString, SharedSvgRenderer::Ptr> s_renderers;
|
||||||
|
|
||||||
Svg *q;
|
Svg *q;
|
||||||
QPointer<Theme> theme;
|
QWeakPointer<Theme> theme;
|
||||||
QHash<QString, QRectF> localRectCache;
|
QHash<QString, QRectF> localRectCache;
|
||||||
SharedSvgRenderer::Ptr renderer;
|
SharedSvgRenderer::Ptr renderer;
|
||||||
QString themePath;
|
QString themePath;
|
||||||
@ -597,7 +596,7 @@ bool Svg::isUsingRenderingCache() const
|
|||||||
void Svg::setTheme(Plasma::Theme *theme)
|
void Svg::setTheme(Plasma::Theme *theme)
|
||||||
{
|
{
|
||||||
if (d->theme) {
|
if (d->theme) {
|
||||||
disconnect(d->theme, 0, this, 0);
|
disconnect(d->theme.data(), 0, this, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
d->theme = theme;
|
d->theme = theme;
|
||||||
@ -610,7 +609,7 @@ void Svg::setTheme(Plasma::Theme *theme)
|
|||||||
|
|
||||||
Theme *Svg::theme() const
|
Theme *Svg::theme() const
|
||||||
{
|
{
|
||||||
return d->theme;
|
return d->theme ? d->theme.data() : Theme::defaultTheme();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // Plasma namespace
|
} // Plasma namespace
|
||||||
|
Loading…
Reference in New Issue
Block a user