SVN commit 759478 by whiting: add new mode "None" to use just color, thanks to Cody Tracy M +5 -16 BackgroundDialog.ui M +28 -4 backgrounddialog.cpp M +3 -1 backgrounddialog.h M +3 -2 desktop.cpp M +7 -3 renderthread.cpp --- trunk/KDE/kdebase/workspace/plasma/containments/desktop/BackgroundDialog.ui #759477:759478 @@ -51,6 +51,11 @@ Slideshow + + + None + + @@ -487,22 +492,6 @@ - m_mode - currentIndexChanged(int) - stackedWidget - setCurrentIndex(int) - - - 234 - 69 - - - 204 - 218 - - - - m_showIcons toggled(bool) m_alignToGrid --- trunk/KDE/kdebase/workspace/plasma/containments/desktop/backgrounddialog.cpp #759477:759478 @@ -341,7 +341,7 @@ QWidget * main = new QWidget(this); setupUi(main); - // static or slideshow? + // static, slideshow or none? connect(m_mode, SIGNAL(currentIndexChanged(int)), this, SLOT(changeBackgroundMode(int))); @@ -370,7 +370,7 @@ // color m_color->setColor(palette().color(QPalette::Window)); - connect(m_color, SIGNAL(changed(QColor)), main, SLOT(update())); + connect(m_color, SIGNAL(changed(QColor)), this, SLOT(update())); // slideshow m_addDir->setIcon(KIcon("list-add")); @@ -468,8 +468,10 @@ config.writeEntry("wallpaperposition", m_resizeMethod->itemData(m_resizeMethod->currentIndex()).toInt()); config.writeEntry("selected", m_selected); - } - else { + } else if (mode == kNoBackground) { + config.writeEntry("wallpaper", QString()); + config.writeEntry("wallpapercolor", m_color->color()); + } else { QStringList dirs; for (int i = 0; i < m_dirlist->count(); i++) { dirs << m_dirlist->item(i)->text(); @@ -549,6 +551,11 @@ void BackgroundDialog::update() { + if (m_mode->currentIndex() == kNoBackground) { + m_img.clear(); + setPreview(m_img, Background::Scale); + return; + } int index = m_view->currentIndex(); if (index == -1) { return; @@ -648,14 +655,31 @@ { case kStaticBackground: m_preview_timer.stop(); + stackedWidget->setCurrentIndex(0); + enableButtons(true); update(); break; + case kNoBackground: + m_preview_timer.stop(); + stackedWidget->setCurrentIndex(0); + enableButtons(false); + update(); + break; case kSlideshowBackground: + stackedWidget->setCurrentIndex(1); updateSlideshow(); + enableButtons(true); break; } } +void BackgroundDialog::enableButtons(bool enabled) +{ + m_view->setEnabled(enabled); + m_resizeMethod->setEnabled(enabled); + m_pictureUrlButton->setEnabled(enabled); +} + bool BackgroundDialog::contains(const QString &path) const { foreach (Background *bg, m_slideshowBackgrounds) --- trunk/KDE/kdebase/workspace/plasma/containments/desktop/backgrounddialog.h #759477:759478 @@ -37,7 +37,8 @@ public: enum BackgroundMode { kStaticBackground, - kSlideshowBackground + kSlideshowBackground, + kNoBackground }; // FIXME seems that we're leaking, make a distructor @@ -100,6 +101,7 @@ void getNewStuff(); void browse(); void showFileDialog(); + void enableButtons(bool enabled); void slotAddDir(); void slotRemoveDir(); --- trunk/KDE/kdebase/workspace/plasma/containments/desktop/desktop.cpp #759477:759478 @@ -187,7 +187,8 @@ m_wallpaperPosition = cg.readEntry("wallpaperposition", 0); m_wallpaperColor = cg.readEntry("wallpapercolor", QColor(Qt::black)); - if (m_backgroundMode == BackgroundDialog::kStaticBackground) { + if (m_backgroundMode == BackgroundDialog::kStaticBackground || + m_backgroundMode == BackgroundDialog::kNoBackground) { m_slideshowTimer.stop(); // Only set the wallpaper if constraints have been loaded if (!skipUpdates) { @@ -233,7 +234,7 @@ void DefaultDesktop::updateBackground() { - if (m_wallpaperPath.isEmpty()) { + if (m_wallpaperPath.isEmpty() && m_backgroundMode != BackgroundDialog::kNoBackground) { QString defaultPath = QString("EOS/contents/images/%1x%2.jpg"); QString testPath = defaultPath.arg(geometry().width()).arg(geometry().height()); --- trunk/KDE/kdebase/workspace/plasma/containments/desktop/renderthread.cpp #759477:759478 @@ -97,6 +97,13 @@ mode = m_mode; } + QImage result(size, QImage::Format_ARGB32_Premultiplied); + result.fill(color.rgb()); + + if (file.isEmpty()) { + emit done(token, result); + } + QPoint pos(0, 0); bool tiled = false; bool scalable = file.endsWith("svg") || file.endsWith("svgz"); @@ -163,9 +170,6 @@ break; } - QImage result(size, QImage::Format_ARGB32_Premultiplied); - result.fill(color.rgb()); - QPainter p(&result); if (scalable) { // tiling is ignored for scalable wallpapers