Merge lp:~mterry/ubuntu-system-settings/default-wallpaper into lp:ubuntu-system-settings

Proposed by Michael Terry
Status: Merged
Approved by: Michael Terry
Approved revision: 1669
Merged at revision: 1721
Proposed branch: lp:~mterry/ubuntu-system-settings/default-wallpaper
Merge into: lp:ubuntu-system-settings
Diff against target: 322 lines (+100/-42)
6 files modified
debian/control (+1/-0)
plugins/background/MainPage.qml (+2/-19)
plugins/background/Preview.qml (+1/-2)
plugins/background/background.cpp (+90/-20)
plugins/background/background.h (+6/-0)
plugins/cellular/Components/SimEditor.qml (+0/-1)
To merge this branch: bzr merge lp:~mterry/ubuntu-system-settings/default-wallpaper
Reviewer Review Type Date Requested Status
system-apps-ci-bot continuous-integration Approve
Jonas G. Drange (community) Approve
PS Jenkins bot continuous-integration Pending
Review via email: mp+297632@code.launchpad.net

Commit message

Use standard default wallpaper instead of unity8's custom one.
Depend on ubuntu-wallpapers, pulling in typical alternate wallpapers too.

And handle such system wallpapers better, by making a copy in case they go away.

Description of the change

And in addition to the above changes, I fixed a couple grey button gradients that I noticed still remained. I couldn't resist.

Regarding making copies of the system wallpapers... I felt this was necessary on Touch because when we upgrade to xenial, for example, the read-only system image will switch from ubuntu-wallpapers-vivid to ubuntu-wallpapers-xenial.

Thus, unlike a normal system upgrade situation on classic Desktop, your system wallpaper can actually disappear. We *could* solve this by growing the installed set of wallpapers every release (i.e. have touch's xenial seed include ubuntu-wallpapers-vivid). But that will quickly become gross.

Instead, I've opted for making a personal copy whenever a system wallpaper is chosen. We delete any copies that are unnecessary (i.e. still on the system) when they are switched away from. And we expose them as custom wallpapers that can be removed once they are no longer on the system (i.e. the user upgraded from vivid to xenial).

Related branches:
- https://code.launchpad.net/~mterry/unity8/default-wallpaper/+merge/297636
- https://code.launchpad.net/~mterry/unity-system-compositor/default-wallpaper/+merge/297791

Silo 23 has all three branches for easier testing.

To post a comment you must log in.
Revision history for this message
Michael Terry (mterry) wrote :

Oooh, had a thought regarding the system-wallpaper-copy issue. What about this:

- When switching wallpapers, if the old wallpaper is still on the system and we also keep a copy, delete the copy. This keeps us from keeping copies of all the wallpapers, if the user tries them all out.
- If we have a copy of a system wallpaper, but it is no longer on the system, treat that wallpaper as a custom wallpaper. That way, the user can delete it.

Thus we have at most one undeleteable wallpaper copy per user. The disadvantage is that it is harder to get back a wallpaper you used to like after we upgrade distros. But that's always true in that case.

Unless I hear otherwise, I'll work on this approach.

1666. By Michael Terry

Merge from trunk

1667. By Michael Terry

Only keep around copies of system wallpapers that we need to

Revision history for this message
Michael Terry (mterry) wrote :

OK, done. The steps in my comment above are implemented.

1668. By Michael Terry

Guard against double-entries in grid list

1669. By Michael Terry

Fix typo

Revision history for this message
Jonas G. Drange (jonas-drange) wrote :

Looks good, works well. Thank you

review: Approve
Revision history for this message
Jonas G. Drange (jonas-drange) wrote :

I've confirmed autopilot tests pass, but I still like a CI run, so I've started one.

Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :

PASSED: Continuous integration, rev:1669
https://jenkins.canonical.com/system-apps/job/lp-ubuntu-system-settings-ci/131/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build/1308
    SUCCESS: https://jenkins.canonical.com/system-apps/job/test-0-autopkgtest/label=phone-armhf,release=vivid+overlay,testname=default/292
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/1308
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=vivid+overlay/1174
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=xenial+overlay/1174
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=yakkety/1174
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1154
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1154/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1154
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1154/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/1154
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/1154/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1154
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1154/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1154
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1154/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/1154
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/1154/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/1154
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/1154/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial+overlay/1154
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial+overlay/1154/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=yakkety/1154
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=yakkety/1154/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-ubuntu-system-settings-ci/131/rebuild

review: Approve (continuous-integration)
1670. By Michael Terry

Fix blurriness in wallpaper preview

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/control'
--- debian/control 2016-08-24 13:50:53 +0000
+++ debian/control 2016-09-12 15:33:02 +0000
@@ -104,6 +104,7 @@
104 libsystemsettings1 (= ${binary:Version}),104 libsystemsettings1 (= ${binary:Version}),
105 system-image-dbus (>= 3.1),105 system-image-dbus (>= 3.1),
106 ubuntu-keyboard-data (>= 0.99.trunk.phablet2+15.04.20150421),106 ubuntu-keyboard-data (>= 0.99.trunk.phablet2+15.04.20150421),
107 ubuntu-wallpapers,
107 urfkill,108 urfkill,
108# for the session-migration script (python3 itself also for the push helper)109# for the session-migration script (python3 itself also for the push helper)
109 python3,110 python3,
110111
=== modified file 'plugins/background/MainPage.qml'
--- plugins/background/MainPage.qml 2015-11-13 21:14:07 +0000
+++ plugins/background/MainPage.qml 2016-09-12 15:33:02 +0000
@@ -36,18 +36,7 @@
3636
37 signal save (string uri)37 signal save (string uri)
3838
39 /* TODO: For now hardcoded paths, later we'll use GSettings */39 readonly property string welcomeBackground: backgroundPanel.backgroundFile
40 /* TODO: fix bug where rotating in uss will change default
41 background to tablet_back… thus losing track of phone_back… */
42 property string defaultBackground:
43 mainPage.width >= units.gu(60) ?
44 "/usr/share/unity8/graphics/tablet_background.jpg" :
45 "/usr/share/unity8/graphics/phone_background.jpg"
46
47 /* If there is no uri then use the default */
48 property string welcomeBackground: (backgroundPanel.backgroundFile === "file:") ?
49 "file:///usr/share/unity8/graphics/phone_background.jpg" :
50 backgroundPanel.backgroundFile
5140
52 property var activeTransfer41 property var activeTransfer
5342
@@ -88,13 +77,7 @@
88 anchors.left: parent.left77 anchors.left: parent.left
89 anchors.right: parent.right78 anchors.right: parent.right
90 columns: 379 columns: 3
91 bgmodel: {80 bgmodel: backgroundPanel.ubuntuArt
92 // Make a shallow copy
93 var backgrounds = backgroundPanel.ubuntuArt.slice(0)
94 if (backgroundPanel.fileExists(defaultBackground))
95 backgrounds.push(Qt.resolvedUrl(defaultBackground))
96 return backgrounds
97 }
98 backgroundPanel: backgroundPanel81 backgroundPanel: backgroundPanel
99 title: i18n.tr("Ubuntu Art")82 title: i18n.tr("Ubuntu Art")
100 current: welcomeBackground83 current: welcomeBackground
10184
=== modified file 'plugins/background/Preview.qml'
--- plugins/background/Preview.qml 2015-08-10 13:31:45 +0000
+++ plugins/background/Preview.qml 2016-09-12 15:33:02 +0000
@@ -73,7 +73,7 @@
73 anchors.fill: parent73 anchors.fill: parent
74 source: uri74 source: uri
75 sourceSize.height: height75 sourceSize.height: height
76 sourceSize.width: width76 sourceSize.width: 0
77 fillMode: Image.PreserveAspectCrop77 fillMode: Image.PreserveAspectCrop
78 }78 }
7979
@@ -100,7 +100,6 @@
100 text: preview.imported ?100 text: preview.imported ?
101 i18n.tr("Remove image") : i18n.tr("Cancel")101 i18n.tr("Remove image") : i18n.tr("Cancel")
102 width: (previewButtons.width-units.gu(2)*4)/2102 width: (previewButtons.width-units.gu(2)*4)/2
103 gradient: UbuntuColors.greyGradient
104 onClicked: preview.state = "cancelled"103 onClicked: preview.state = "cancelled"
105 }104 }
106 Button {105 Button {
107106
=== modified file 'plugins/background/background.cpp'
--- plugins/background/background.cpp 2014-07-08 09:18:09 +0000
+++ plugins/background/background.cpp 2016-09-12 15:33:02 +0000
@@ -27,6 +27,8 @@
27#include <unistd.h>27#include <unistd.h>
28#include <QDebug>28#include <QDebug>
2929
30#define SYSTEM_BACKGROUND_DIR "/usr/share/backgrounds"
31
30Background::Background(QObject *parent) :32Background::Background(QObject *parent) :
31 QObject(parent)33 QObject(parent)
32{34{
@@ -43,11 +45,12 @@
43 QVariant answer = m_accountsService.getUserProperty(45 QVariant answer = m_accountsService.getUserProperty(
44 "org.freedesktop.Accounts.User",46 "org.freedesktop.Accounts.User",
45 "BackgroundFile");47 "BackgroundFile");
4648 QString filename = answer.toString();
47 if (answer.isValid())49
48 return answer.toString();50 if (filename.isEmpty() || !QFile::exists(filename))
4951 return defaultBackgroundFile();
50 return QString();52 else
53 return filename;
51}54}
5255
53void Background::setBackgroundFile(QUrl backgroundFile)56void Background::setBackgroundFile(QUrl backgroundFile)
@@ -58,10 +61,21 @@
58 if (backgroundFile.url() == m_backgroundFile)61 if (backgroundFile.url() == m_backgroundFile)
59 return;62 return;
6063
64 QString oldBackgroundFile = m_backgroundFile;
65
61 m_backgroundFile = backgroundFile.url();66 m_backgroundFile = backgroundFile.url();
62 m_accountsService.customSetUserProperty("SetBackgroundFile",67 m_accountsService.customSetUserProperty("SetBackgroundFile",
63 backgroundFile.path());68 backgroundFile.path());
64 Q_EMIT backgroundFileChanged();69 Q_EMIT backgroundFileChanged();
70
71 // If old background was a system copy that we still have on the system,
72 // delete our copy. We don't need it anymore.
73 if (oldBackgroundFile.contains(getCopiedSystemBackgroundFolder().path())) {
74 QString fileName = QUrl(oldBackgroundFile).fileName();
75 if (QFile::exists(SYSTEM_BACKGROUND_DIR "/" + fileName)) {
76 rmFile(oldBackgroundFile);
77 }
78 }
65}79}
6680
67void Background::slotChanged()81void Background::slotChanged()
@@ -91,8 +105,23 @@
91 m_customBackgrounds.clear();105 m_customBackgrounds.clear();
92 QFileInfoList tmpList;106 QFileInfoList tmpList;
93 tmpList << getCustomBackgroundFolder().entryInfoList(QDir::Files | QDir::NoSymLinks);107 tmpList << getCustomBackgroundFolder().entryInfoList(QDir::Files | QDir::NoSymLinks);
94 if (getCustomBackgroundFolder() != getContentHubFolder())108 if (getCustomBackgroundFolder() != getContentHubFolder()) {
95 tmpList << getContentHubFolder().entryInfoList(QDir::Files | QDir::NoSymLinks);109 tmpList << getContentHubFolder().entryInfoList(QDir::Files | QDir::NoSymLinks);
110
111 // If any of our copied system backgrounds are no longer on the system,
112 // treat them as custom backgrounds. This would only likely happen if
113 // a user was using a background from vivid-wallpapers and we upgraded
114 // to xenial-wallpapers. In this case, we want the old paper to show
115 // as a custom background, so that the user can delete it when done
116 // with it.
117 // So scan the copied backgrounds.
118 QFileInfoList copyList = getCopiedSystemBackgroundFolder().entryInfoList(QDir::Files | QDir::NoSymLinks);
119 QDir systemDir = QDir(SYSTEM_BACKGROUND_DIR);
120 foreach (QFileInfo f, copyList) {
121 if (!systemDir.exists(f.fileName()))
122 tmpList << f;
123 }
124 }
96 if (!tmpList.isEmpty())125 if (!tmpList.isEmpty())
97 {126 {
98 foreach (QFileInfo f, tmpList)127 foreach (QFileInfo f, tmpList)
@@ -106,9 +135,18 @@
106 QUrl prepared = url;135 QUrl prepared = url;
107136
108 if (getCustomBackgroundFolder() != getContentHubFolder() &&137 if (getCustomBackgroundFolder() != getContentHubFolder() &&
109 url.path().startsWith(getContentHubFolder().path()))138 !url.path().startsWith(getCustomBackgroundFolder().path()) &&
139 url != QUrl::fromLocalFile(defaultBackgroundFile()))
110 {140 {
111 QDir backgroundFolder = getCustomBackgroundFolder();141 QDir backgroundFolder;
142 bool moveFile = false;
143 if (url.path().startsWith(getContentHubFolder().path())) {
144 backgroundFolder = getCustomBackgroundFolder();
145 moveFile = true;
146 } else {
147 backgroundFolder = getCopiedSystemBackgroundFolder();
148 }
149
112 QUrl newPath = QUrl::fromLocalFile(backgroundFolder.path() + "/" + url.fileName());150 QUrl newPath = QUrl::fromLocalFile(backgroundFolder.path() + "/" + url.fileName());
113151
114 if (QFile(newPath.path()).exists())152 if (QFile(newPath.path()).exists())
@@ -123,11 +161,17 @@
123161
124 // Move file from local ContentHub dump to shared greeter data folder162 // Move file from local ContentHub dump to shared greeter data folder
125 if (shareWithGreeter &&163 if (shareWithGreeter &&
126 QDir::root().mkpath(backgroundFolder.path()) &&164 QDir::root().mkpath(backgroundFolder.path()))
127 QFile::rename(url.path(), newPath.path()))
128 {165 {
129 updateCustomBackgrounds();166 if ((moveFile && QFile::rename(url.path(), newPath.path())) ||
130 prepared = newPath;167 (!moveFile && (link(url.path().toUtf8().data(),
168 newPath.path().toUtf8().data()) == 0 ||
169 QFile::copy(url.path(), newPath.path()))))
170 {
171 updateUbuntuArt();
172 updateCustomBackgrounds();
173 prepared = newPath;
174 }
131 }175 }
132 }176 }
133177
@@ -144,6 +188,11 @@
144 return dataDir + "/ubuntu-system-settings/Pictures";188 return dataDir + "/ubuntu-system-settings/Pictures";
145}189}
146190
191QDir Background::getCopiedSystemBackgroundFolder()
192{
193 return getCustomBackgroundFolder().path() + "/System";
194}
195
147QDir Background::getContentHubFolder()196QDir Background::getContentHubFolder()
148{197{
149 return QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/Pictures";198 return QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/Pictures";
@@ -153,26 +202,37 @@
153{202{
154 return m_ubuntuArt;203 return m_ubuntuArt;
155}204}
205
156void Background::updateUbuntuArt()206void Background::updateUbuntuArt()
157{207{
158
159 QString envDir(qgetenv("SYSTEM_SETTINGS_UBUNTU_ART_DIR"));208 QString envDir(qgetenv("SYSTEM_SETTINGS_UBUNTU_ART_DIR"));
160 QDir dir;209 QDir dir;
210 QDir copiedBackgroundDir;
161211
162 if (envDir != "")212 if (envDir != "") {
163 dir = QDir(envDir);213 dir = QDir(envDir);
164 else214 copiedBackgroundDir = dir;
165 dir = QDir("/usr/share/backgrounds/");215 } else {
216 dir = QDir(SYSTEM_BACKGROUND_DIR);
217 copiedBackgroundDir = getCopiedSystemBackgroundFolder();
218 }
166219
220 m_ubuntuArt.clear();
167221
168 dir.setFilter(QDir::Files | QDir::NoSymLinks);222 dir.setFilter(QDir::Files | QDir::NoSymLinks);
169 dir.setSorting(QDir::Name);223 dir.setSorting(QDir::Name);
170 QFileInfoList tmpList = dir.entryInfoList();224 QFileInfoList tmpList = dir.entryInfoList();
171 foreach (QFileInfo f, tmpList)225 foreach (QFileInfo f, tmpList)
172 {226 {
173 if (f.fileName() != "warty-final-ubuntu.png")227 QString absPath = f.absoluteFilePath();
174 m_ubuntuArt.append(QUrl::fromLocalFile(f.absoluteFilePath()).toString());228
229 // Prefer copied versions.
230 if (copiedBackgroundDir.exists(f.fileName()))
231 absPath = copiedBackgroundDir.absoluteFilePath(f.fileName());
232
233 m_ubuntuArt.append(QUrl::fromLocalFile(absPath).toString());
175 }234 }
235
176 Q_EMIT ubuntuArtChanged();236 Q_EMIT ubuntuArtChanged();
177}237}
178238
@@ -189,7 +249,9 @@
189 if (file.isEmpty() || file.isNull())249 if (file.isEmpty() || file.isNull())
190 return;250 return;
191251
192 if (!file.contains(getCustomBackgroundFolder().path()) && !file.contains(getContentHubFolder().path()))252 if (!file.contains(getCustomBackgroundFolder().path()) &&
253 !file.contains(getCopiedSystemBackgroundFolder().path()) &&
254 !file.contains(getContentHubFolder().path()))
193 return;255 return;
194256
195 QUrl fileUri(file);257 QUrl fileUri(file);
@@ -199,10 +261,18 @@
199 QFile filePath(fileUri.path());261 QFile filePath(fileUri.path());
200 if (filePath.exists())262 if (filePath.exists())
201 {263 {
202 if (filePath.remove())264 if (filePath.remove()) {
265 updateUbuntuArt();
203 updateCustomBackgrounds();266 updateCustomBackgrounds();
267 }
204 }268 }
205}269}
206270
271QString Background::defaultBackgroundFile() const
272{
273 /* TODO: For now hardcoded path, later we'll use GSettings */
274 return SYSTEM_BACKGROUND_DIR "/warty-final-ubuntu.png";
275}
276
207Background::~Background() {277Background::~Background() {
208}278}
209279
=== modified file 'plugins/background/background.h'
--- plugins/background/background.h 2015-03-16 13:51:36 +0000
+++ plugins/background/background.h 2016-09-12 15:33:02 +0000
@@ -45,6 +45,10 @@
45 READ ubuntuArt45 READ ubuntuArt
46 NOTIFY ubuntuArtChanged )46 NOTIFY ubuntuArtChanged )
4747
48 Q_PROPERTY( QString defaultBackgroundFile
49 READ defaultBackgroundFile
50 CONSTANT )
51
48public:52public:
49 explicit Background(QObject *parent = 0);53 explicit Background(QObject *parent = 0);
50 ~Background();54 ~Background();
@@ -55,6 +59,7 @@
55 Q_INVOKABLE void rmFile(const QString &file);59 Q_INVOKABLE void rmFile(const QString &file);
56 QStringList customBackgrounds();60 QStringList customBackgrounds();
57 QStringList ubuntuArt();61 QStringList ubuntuArt();
62 QString defaultBackgroundFile() const;
5863
59public Q_SLOTS:64public Q_SLOTS:
60 void slotChanged();65 void slotChanged();
@@ -73,6 +78,7 @@
73 QString m_backgroundFile;78 QString m_backgroundFile;
74 QString getBackgroundFile();79 QString getBackgroundFile();
75 QDir getCustomBackgroundFolder();80 QDir getCustomBackgroundFolder();
81 QDir getCopiedSystemBackgroundFolder();
76 QDir getContentHubFolder();82 QDir getContentHubFolder();
77};83};
7884
7985
=== modified file 'plugins/cellular/Components/SimEditor.qml'
--- plugins/cellular/Components/SimEditor.qml 2015-08-10 13:31:45 +0000
+++ plugins/cellular/Components/SimEditor.qml 2016-09-12 15:33:02 +0000
@@ -200,7 +200,6 @@
200 Button {200 Button {
201 id: cancel201 id: cancel
202 objectName: "cancelRename"202 objectName: "cancelRename"
203 gradient: UbuntuColors.greyGradient
204 text: i18n.tr("Cancel")203 text: i18n.tr("Cancel")
205 width: (editor.width / 2) - units.gu(1)204 width: (editor.width / 2) - units.gu(1)
206 onClicked: {205 onClicked: {

Subscribers

People subscribed via source and target branches