Merge lp:~verzegnassi-stefano/ubuntu-terminal-app/layouts-q-argument into lp:~ubuntu-terminal-dev/ubuntu-terminal-app/reboot

Proposed by Stefano Verzegnassi
Status: Merged
Approved by: Nicholas Skaggs
Approved revision: 158
Merged at revision: 162
Proposed branch: lp:~verzegnassi-stefano/ubuntu-terminal-app/layouts-q-argument
Merge into: lp:~ubuntu-terminal-dev/ubuntu-terminal-app/reboot
Diff against target: 45 lines (+21/-2)
1 file modified
src/app/main.cpp (+21/-2)
To merge this branch: bzr merge lp:~verzegnassi-stefano/ubuntu-terminal-app/layouts-q-argument
Reviewer Review Type Date Requested Status
Evan McIntire Approve
Jenkins Bot continuous-integration Approve
Review via email: mp+283786@code.launchpad.net

Commit message

Fixed layouts not found when terminal-app is launched with '-q' argument

Description of the change

Fixed layouts not found when terminal-app is launched with '-q' argument

To post a comment you must log in.
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Andrea Bernabei (faenil) wrote :

small comment

157. By Stefano Verzegnassi

added debug output as per MP review

Revision history for this message
Stefano Verzegnassi (verzegnassi-stefano) wrote :

Done!

Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Andrea Bernabei (faenil) wrote :

another comment :)

158. By Stefano Verzegnassi

Added output in case the default layouts folder doesn't exist, or no default layout has been found

Revision history for this message
Andrea Bernabei (faenil) wrote :

lgtm! thanks :)

Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Evan McIntire (mcintire-evan) wrote :

Works well, code all looks good to me - Thanks for the change!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/app/main.cpp'
--- src/app/main.cpp 2015-03-23 17:46:34 +0000
+++ src/app/main.cpp 2016-01-25 12:37:28 +0000
@@ -40,7 +40,7 @@
40 QDir layoutDir(path);40 QDir layoutDir(path);
41 layoutDir.setNameFilters(QStringList("*.json"));41 layoutDir.setNameFilters(QStringList("*.json"));
4242
43 QStringList jsonFiles = layoutDir.entryList();43 QStringList jsonFiles = layoutDir.entryList();
4444
45 QStringList result;45 QStringList result;
46 foreach (QString s, jsonFiles) {46 foreach (QString s, jsonFiles) {
@@ -174,12 +174,31 @@
174 qDebug() << "Trying to load QML from:" << path + "/qml/ubuntu-terminal-app.qml";174 qDebug() << "Trying to load QML from:" << path + "/qml/ubuntu-terminal-app.qml";
175 if (fi.exists()) {175 if (fi.exists()) {
176 qmlfile = path + "/qml/ubuntu-terminal-app.qml";176 qmlfile = path + "/qml/ubuntu-terminal-app.qml";
177 keyboardLayouts << getProfileFromDir(path + "/qml/KeyboardRows/Layouts/");
178 break;177 break;
179 }178 }
180 }179 }
181 }180 }
182181
182 // Look for default layouts
183 QDir keybLayoutDir = QFileInfo(qmlfile).dir();
184 const QString &layoutsDir("KeyboardRows/Layouts");
185
186 if (keybLayoutDir.cd(layoutsDir)) {
187 QString keybLayoutPath = keybLayoutDir.canonicalPath() + "/";
188 qDebug() << "Retrieving default keyboard profiles from folder: " << keybLayoutPath;
189
190 QStringList kLayouts = getProfileFromDir(keybLayoutPath);
191
192 if (kLayouts.isEmpty()) {
193 qDebug() << "No default keyboard profile found.";
194 } else {
195 keyboardLayouts << kLayouts;
196 }
197 } else {
198 qDebug() << "Not able to locate default keyboard profiles folder:" << keybLayoutDir.canonicalPath() + "/" + layoutsDir;
199 }
200
201 // Look for user-defined layouts
183 QStringList configLocations = QStandardPaths::standardLocations(QStandardPaths::ConfigLocation);202 QStringList configLocations = QStandardPaths::standardLocations(QStandardPaths::ConfigLocation);
184 foreach (const QString &path, configLocations) {203 foreach (const QString &path, configLocations) {
185 QString fullPath = path + "/com.ubuntu.terminal/Layouts/";204 QString fullPath = path + "/com.ubuntu.terminal/Layouts/";

Subscribers

People subscribed via source and target branches