less debug, element prefix in ctor

This commit is contained in:
Marco Martin 2012-11-16 15:57:35 +01:00
parent 110561fae7
commit fef6c3b7f5
3 changed files with 13 additions and 14 deletions

View File

@ -100,7 +100,7 @@ void DialogPrivate::themeChanged()
// WA_NoSystemBackground is going to fail combined with sliding popups, but is needed
// when we aren't compositing
q->setAttribute(Qt::WA_NoSystemBackground, !translucency);
WindowEffects::overrideShadow(q->winId(), !DialogShadows::self()->hasElement("shadow-left"));
WindowEffects::overrideShadow(q->winId(), !DialogShadows::self()->enabled());
updateMask();
q->update();
}
@ -400,7 +400,7 @@ Dialog::Dialog(QWidget *parent, Qt::WindowFlags f)
QPalette pal = palette();
pal.setColor(backgroundRole(), Qt::transparent);
setPalette(pal);
WindowEffects::overrideShadow(winId(), !DialogShadows::self()->hasElement("shadow-left"));
WindowEffects::overrideShadow(winId(), !DialogShadows::self()->enabled());
d->adjustViewTimer = new QTimer(this);
d->adjustViewTimer->setSingleShot(true);
@ -729,7 +729,7 @@ void Dialog::showEvent(QShowEvent * event)
}
emit dialogVisible(true);
// WindowEffects::overrideShadow(winId(), true);
WindowEffects::overrideShadow(winId(), !DialogShadows::self()->enabled());
DialogShadows::self()->addWindow(this, d->background->enabledBorders());
}

View File

@ -83,11 +83,11 @@ public:
K_GLOBAL_STATIC(DialogShadowsSingleton, privateDialogShadowsSelf)
DialogShadows::DialogShadows(QObject *parent)
DialogShadows::DialogShadows(QObject *parent, const QString &prefix)
: Plasma::Svg(parent),
d(new Private(this))
{
setImagePath("dialogs/background");
setImagePath(prefix);
connect(this, SIGNAL(repaintNeeded()), this, SLOT(updateShadows()));
}
@ -193,10 +193,6 @@ void DialogShadows::Private::setupPixmaps()
void DialogShadows::Private::setupData(Plasma::FrameSvg::EnabledBorders enabledBorders)
{
#ifdef Q_WS_X11
/*foreach (const QPixmap &pixmap, m_shadowPixmaps) {
data[enabledBorders] << pixmap.handle();
}*/
//shadow-top
if (enabledBorders & Plasma::FrameSvg::TopBorder) {
data[enabledBorders] << m_shadowPixmaps[0].handle();
@ -279,7 +275,6 @@ void DialogShadows::Private::setupData(Plasma::FrameSvg::EnabledBorders enabledB
QSize marginHint;
if (enabledBorders & Plasma::FrameSvg::TopBorder) {
marginHint = q->elementSize("shadow-hint-top-margin");
kDebug() << "top margin hint is:" << marginHint;
if (marginHint.isValid()) {
top = marginHint.height();
} else {
@ -291,7 +286,6 @@ void DialogShadows::Private::setupData(Plasma::FrameSvg::EnabledBorders enabledB
if (enabledBorders & Plasma::FrameSvg::RightBorder) {
marginHint = q->elementSize("shadow-hint-right-margin");
kDebug() << "right margin hint is:" << marginHint;
if (marginHint.isValid()) {
right = marginHint.width();
} else {
@ -352,7 +346,7 @@ void DialogShadows::Private::clearPixmaps()
void DialogShadows::Private::updateShadow(const QWidget *window, Plasma::FrameSvg::EnabledBorders enabledBorders)
{
#ifdef Q_WS_X11
if (m_shadowPixmaps.size() == 0) {
if (m_shadowPixmaps.isEmpty()) {
setupPixmaps();
}
@ -378,5 +372,10 @@ void DialogShadows::Private::clearShadow(const QWidget *window)
#endif
}
bool DialogShadows::enabled() const
{
return hasElement("shadow-left");
}
#include "dialogshadows_p.moc"

View File

@ -30,14 +30,14 @@ class DialogShadows : public Plasma::Svg
Q_OBJECT
public:
explicit DialogShadows(QObject *parent = 0);
explicit DialogShadows(QObject *parent = 0, const QString &prefix = "dialogs/background");
static DialogShadows *self();
void addWindow(const QWidget *window, Plasma::FrameSvg::EnabledBorders enabledBorders = Plasma::FrameSvg::AllBorders);
void removeWindow(const QWidget *window);
private Q_SLOTS:
bool enabled() const;
private:
class Private;