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

View File

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

View File

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