diff --git a/dialog.cpp b/dialog.cpp index 2eedd99ec..a8ee8ba5b 100644 --- a/dialog.cpp +++ b/dialog.cpp @@ -306,8 +306,6 @@ void Dialog::syncToGraphicsWidget() QDesktopWidget *desktop = QApplication::desktop(); QSize maxSize = desktop->availableGeometry(desktop->screenNumber(this)).size(); - graphicsWidget->setMaximumSize(maxSize - QSize(left + right, top + bottom).boundedTo(graphicsWidget->effectiveSizeHint(Qt::MaximumSize).toSize())); - setMinimumSize(0, 0); setMaximumSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX); diff --git a/framesvg.cpp b/framesvg.cpp index 535e4e924..484f29dbb 100644 --- a/framesvg.cpp +++ b/framesvg.cpp @@ -844,22 +844,26 @@ void FrameSvgPrivate::generateFrameBackground(FrameData *frame) if (frame->stretchBorders) { if (frame->enabledBorders & FrameSvg::LeftBorder || frame->enabledBorders & FrameSvg::RightBorder) { if (q->hasElement(prefix % "left") && - frame->enabledBorders & FrameSvg::LeftBorder) { + frame->enabledBorders & FrameSvg::LeftBorder && + contentHeight > 0) { q->paint(&p, QRect(leftOffset, contentTop, frame->leftWidth, contentHeight), prefix % "left"); } if (q->hasElement(prefix % "right") && - frame->enabledBorders & FrameSvg::RightBorder) { + frame->enabledBorders & FrameSvg::RightBorder && + contentHeight > 0) { q->paint(&p, QRect(rightOffset, contentTop, frame->rightWidth, contentHeight), prefix % "right"); } } if (frame->enabledBorders & FrameSvg::TopBorder || frame->enabledBorders & FrameSvg::BottomBorder) { - if (frame->enabledBorders & FrameSvg::TopBorder && q->hasElement(prefix % "top")) { + if (frame->enabledBorders & FrameSvg::TopBorder && q->hasElement(prefix % "top") && + contentWidth > 0) { q->paint(&p, QRect(contentLeft, topOffset, contentWidth, frame->topHeight), prefix % "top"); } - if (frame->enabledBorders & FrameSvg::BottomBorder && q->hasElement(prefix % "bottom")) { + if (frame->enabledBorders & FrameSvg::BottomBorder && q->hasElement(prefix % "bottom") && + contentWidth > 0) { q->paint(&p, QRect(contentLeft, bottomOffset, contentWidth, frame->bottomHeight), prefix % "bottom"); } } diff --git a/private/packages.cpp b/private/packages.cpp index 15db22924..2519341ae 100644 --- a/private/packages.cpp +++ b/private/packages.cpp @@ -157,56 +157,110 @@ ThemePackage::ThemePackage(QObject *parent) : Plasma::PackageStructure(parent, QString("Plasma Theme")) { addDirectoryDefinition("dialogs", "dialogs/", i18n("Images for dialogs")); + addFileDefinition("dialogs/background", "dialogs/background.svg", i18n("Generic dialog background")); + addFileDefinition("dialogs/background", "dialogs/background.svgz", + i18n("Generic dialog background")); + addFileDefinition("dialogs/shutdowndialog", "dialogs/shutdowndialog.svg", i18n("Theme for the logout dialog")); + addFileDefinition("dialogs/shutdowndialog", "dialogs/shutdowndialog.svgz", + i18n("Theme for the logout dialog")); addDirectoryDefinition("wallpapers", "wallpapers/", i18n("Wallpaper packages")); addDirectoryDefinition("animations", "animations/", i18n("Animation scripts")); addDirectoryDefinition("widgets", "widgets/", i18n("Images for widgets")); + addFileDefinition("widgets/background", "widgets/background.svg", i18n("Background image for widgets")); + addFileDefinition("widgets/background", "widgets/background.svgz", + i18n("Background image for widgets")); + addFileDefinition("widgets/clock", "widgets/clock.svg", i18n("Analog clock face")); + addFileDefinition("widgets/clock", "widgets/clock.svgz", + i18n("Analog clock face")); + addFileDefinition("widgets/panel-background", "widgets/panel-background.svg", i18n("Background image for panels")); + addFileDefinition("widgets/panel-background", "widgets/panel-background.svgz", + i18n("Background image for panels")); + addFileDefinition("widgets/plot-background", "widgets/plot-background.svg", i18n("Background for graphing widgets")); + addFileDefinition("widgets/plot-background", "widgets/plot-background.svg", + i18n("Background for graphing widgets")); + addFileDefinition("widgets/tooltip", "widgets/tooltip.svg", i18n("Background image for tooltips")); + addFileDefinition("widgets/tooltip", "widgets/tooltip.svgz", + i18n("Background image for tooltips")); addDirectoryDefinition("opaque/dialogs", "opaque/dialogs/", i18n("Opaque images for dialogs")); + addFileDefinition("opaque/dialogs/background", "opaque/dialogs/background.svg", i18n("Opaque generic dialog background")); + addFileDefinition("opaque/dialogs/background", "opaque/dialogs/background.svgz", + i18n("Opaque generic dialog background")); + addFileDefinition("opaque/dialogs/shutdowndialog", "opaque/dialogs/shutdowndialog.svg", i18n("Opaque theme for the logout dialog")); + addFileDefinition("opaque/dialogs/shutdowndialog", "opaque/dialogs/shutdowndialog.svgz", + i18n("Opaque theme for the logout dialog")); addDirectoryDefinition("opaque/widgets", "opaque/widgets/", i18n("Opaque images for widgets")); + addFileDefinition("opaque/widgets/panel-background", "opaque/widgets/panel-background.svg", i18n("Opaque background image for panels")); + addFileDefinition("opaque/widgets/panel-background", "opaque/widgets/panel-background.svgz", + i18n("Opaque background image for panels")); + addFileDefinition("opaque/widgets/tooltip", "opaque/widgets/tooltip.svg", i18n("Opaque background image for tooltips")); + addFileDefinition("opaque/widgets/tooltip", "opaque/widgets/tooltip.svgz", + i18n("Opaque background image for tooltips")); addDirectoryDefinition("locolor/dialogs", "locolor/dialogs/", i18n("Low color images for dialogs")); + addFileDefinition("locolor/dialogs/background", "locolor/dialogs/background.svg", i18n("Low color generic dialog background")); + addFileDefinition("locolor/dialogs/background", "locolor/dialogs/background.svgz", + i18n("Low color generic dialog background")); + addFileDefinition("locolor/dialogs/shutdowndialog", "locolor/dialogs/shutdowndialog.svg", i18n("Low color theme for the logout dialog")); + addFileDefinition("locolor/dialogs/shutdowndialog", "locolor/dialogs/shutdowndialog.svgz", + i18n("Low color theme for the logout dialog")); addDirectoryDefinition("locolor/widgets", "locolor/widgets/", i18n("Images for widgets")); + addFileDefinition("locolor/widgets/background", "locolor/widgets/background.svg", i18n("Low color background image for widgets")); + addFileDefinition("locolor/widgets/background", "locolor/widgets/background.svgz", + i18n("Low color background image for widgets")); + addFileDefinition("locolor/widgets/clock", "locolor/widgets/clock.svg", i18n("Low color analog clock face")); + addFileDefinition("locolor/widgets/clock", "locolor/widgets/clock.svgz", + i18n("Low color analog clock face")); + addFileDefinition("locolor/widgets/panel-background", "locolor/widgets/panel-background.svg", i18n("Low color background image for panels")); + addFileDefinition("locolor/widgets/panel-background", "locolor/widgets/panel-background.svgz", + i18n("Low color background image for panels")); + addFileDefinition("locolor/widgets/plot-background", "locolor/widgets/plot-background.svg", i18n("Low color background for graphing widgets")); + addFileDefinition("locolor/widgets/plot-background", "locolor/widgets/plot-background.svgz", + i18n("Low color background for graphing widgets")); + addFileDefinition("locolor/widgets/tooltip", "locolor/widgets/tooltip.svg", i18n("Low color background image for tooltips")); + addFileDefinition("locolor/widgets/tooltip", "locolor/widgets/tooltip.svgz", + i18n("Low color background image for tooltips")); addFileDefinition("colors", "colors", i18n("KColorScheme configuration file")); diff --git a/widgets/declarativewidget.cpp b/widgets/declarativewidget.cpp index 878164efa..93d043898 100644 --- a/widgets/declarativewidget.cpp +++ b/widgets/declarativewidget.cpp @@ -62,6 +62,10 @@ public: void scheduleExecutionEnd(); void minimumWidthChanged(); void minimumHeightChanged(); + void maximumWidthChanged(); + void maximumHeightChanged(); + void preferredWidthChanged(); + void preferredHeightChanged(); DeclarativeWidget *q; @@ -157,13 +161,28 @@ void DeclarativeWidgetPrivate::finishExecute() q->setLayout(0); qreal minimumWidth = 0; qreal minimumHeight = 0; + qreal maximumWidth = 0; + qreal maximumHeight = 0; + qreal preferredWidth = 0; + qreal preferredHeight = 0; if (object) { - minimumWidth = object->property("minimumWidth").toReal(); - minimumHeight = object->property("minimumHeight").toReal(); object->setProperty("width", q->size().width()); object->setProperty("height", q->size().height()); + + minimumWidth = object->property("minimumWidth").toReal(); + minimumHeight = object->property("minimumHeight").toReal(); QObject::connect(object, SIGNAL(minimumWidthChanged()), q, SLOT(minimumWidthChanged())); QObject::connect(object, SIGNAL(minimumHeightChanged()), q, SLOT(minimumHeightChanged())); + + maximumWidth = object->property("maximumWidth").toReal(); + maximumHeight = object->property("maximumHeight").toReal(); + QObject::connect(object, SIGNAL(maximumWidthChanged()), q, SLOT(maximumWidthChanged())); + QObject::connect(object, SIGNAL(maximumHeightChanged()), q, SLOT(maximumHeightChanged())); + + preferredWidth = object->property("preferredWidth").toReal(); + preferredHeight = object->property("preferredHeight").toReal(); + QObject::connect(object, SIGNAL(preferredWidthChanged()), q, SLOT(preferredWidthChanged())); + QObject::connect(object, SIGNAL(preferredHeightChanged()), q, SLOT(preferredHeightChanged())); } if (minimumWidth > 0 && minimumHeight > 0) { @@ -171,6 +190,18 @@ void DeclarativeWidgetPrivate::finishExecute() } else { q->setMinimumSize(-1, -1); } + + if (maximumWidth > 0 && maximumHeight > 0) { + q->setMaximumSize(maximumWidth, maximumHeight); + } else { + q->setMaximumSize(-1, -1); + } + + if (preferredWidth > 0 && preferredHeight > 0) { + q->setPreferredSize(preferredWidth, preferredHeight); + } else { + q->setPreferredSize(-1, -1); + } } emit q->finished(); } @@ -187,6 +218,30 @@ void DeclarativeWidgetPrivate::minimumHeightChanged() q->setMinimumHeight(minimumHeight); } +void DeclarativeWidgetPrivate::maximumWidthChanged() +{ + qreal maximumWidth = root->property("maximumWidth").toReal(); + q->setMaximumWidth(maximumWidth); +} + +void DeclarativeWidgetPrivate::maximumHeightChanged() +{ + qreal maximumHeight = root->property("maximumHeight").toReal(); + q->setMaximumHeight(maximumHeight); +} + +void DeclarativeWidgetPrivate::preferredWidthChanged() +{ + qreal preferredWidth = root->property("preferredWidth").toReal(); + q->setPreferredWidth(preferredWidth); +} + +void DeclarativeWidgetPrivate::preferredHeightChanged() +{ + qreal preferredHeight = root->property("preferredHeight").toReal(); + q->setPreferredHeight(preferredHeight); +} + DeclarativeWidget::DeclarativeWidget(QGraphicsWidget *parent) : QGraphicsWidget(parent), d(new DeclarativeWidgetPrivate(this)) diff --git a/widgets/declarativewidget.h b/widgets/declarativewidget.h index 28270cb6e..b187e0f88 100644 --- a/widgets/declarativewidget.h +++ b/widgets/declarativewidget.h @@ -131,6 +131,10 @@ private: Q_PRIVATE_SLOT(d, void scheduleExecutionEnd()) Q_PRIVATE_SLOT(d, void minimumWidthChanged()) Q_PRIVATE_SLOT(d, void minimumHeightChanged()) + Q_PRIVATE_SLOT(d, void maximumWidthChanged()) + Q_PRIVATE_SLOT(d, void maximumHeightChanged()) + Q_PRIVATE_SLOT(d, void preferredWidthChanged()) + Q_PRIVATE_SLOT(d, void preferredHeightChanged()) }; } // namespace Plasma