Merge lp:~zeller-benjamin/ubuntu-sdk-ide/snapcraft-devmode into lp:ubuntu-sdk-ide

Proposed by Benjamin Zeller on 2016-11-08
Status: Merged
Approved by: Zoltan Balogh on 2016-11-08
Approved revision: 168
Merged at revision: 166
Proposed branch: lp:~zeller-benjamin/ubuntu-sdk-ide/snapcraft-devmode
Merge into: lp:ubuntu-sdk-ide
Diff against target: 177 lines (+46/-1)
3 files modified
dist/qtcreator/src/plugins/ubuntu/share/qtcreator/ubuntu/scripts/qtc_desktop_snaprunner.py (+7/-1)
dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfiguration.cpp (+32/-0)
dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfiguration.h (+7/-0)
To merge this branch: bzr merge lp:~zeller-benjamin/ubuntu-sdk-ide/snapcraft-devmode
Reviewer Review Type Date Requested Status
ubuntu-sdk-build-bot continuous-integration Approve on 2016-11-08
Zoltan Balogh (community) 2016-11-08 Approve on 2016-11-08
Review via email: mp+310279@code.launchpad.net

Commit message

add a devmode switch

Description of the change

add a devmode switch

To post a comment you must log in.
review: Approve (continuous-integration)
Zoltan Balogh (bzoltan) :
review: Approve
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'dist/qtcreator/src/plugins/ubuntu/share/qtcreator/ubuntu/scripts/qtc_desktop_snaprunner.py'
2--- dist/qtcreator/src/plugins/ubuntu/share/qtcreator/ubuntu/scripts/qtc_desktop_snaprunner.py 2016-11-07 10:48:52 +0000
3+++ dist/qtcreator/src/plugins/ubuntu/share/qtcreator/ubuntu/scripts/qtc_desktop_snaprunner.py 2016-11-08 12:28:00 +0000
4@@ -30,6 +30,7 @@
5 parser = argparse.ArgumentParser(description="SDK snap launcher")
6 parser.add_argument('snap_package',action="store")
7 parser.add_argument('snap_command',action='store')
8+parser.add_argument('--devmode' ,action='store_true')
9
10 options, args = parser.parse_known_args()
11
12@@ -48,7 +49,11 @@
13 sys.stderr.flush()
14
15 #ok lets install the snap package
16-ret = subprocess.call(["snap", "install", options.snap_package, "--dangerous"], stdout=sys.stdout, stderr=sys.stderr)
17+snaparg = ["snap", "install", options.snap_package, "--dangerous"]
18+if options.devmode:
19+ print("Enabling devmode\n")
20+ snaparg += ["--devmode"]
21+ret = subprocess.call(snaparg, stdout=sys.stdout, stderr=sys.stderr)
22 if ret != 0:
23 sys.exit(ret)
24
25@@ -71,6 +76,7 @@
26 signal.signal(signal.SIGHUP, signalHandler)
27
28 #start the actual app
29+print("Command args are: "+str(args)+"\n")
30 if not stopped:
31 proc = subprocess.Popen(["snap", "run", app_info[0]+"."+options.snap_command]+args, stdout=sys.stdout, stderr=sys.stderr)
32 ret = proc.wait()
33
34=== modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfiguration.cpp'
35--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfiguration.cpp 2016-11-07 10:48:52 +0000
36+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfiguration.cpp 2016-11-08 12:28:00 +0000
37@@ -18,17 +18,20 @@
38 #include <QFileInfo>
39 #include <QFormLayout>
40 #include <QComboBox>
41+#include <QCheckBox>
42
43 namespace Ubuntu {
44 namespace Internal {
45
46 const QString COMMAND_KEY = QStringLiteral("SnapProjectManager.SnapRunConfiguration.SnapCommand");
47+const QString DEVMODE_KEY = QStringLiteral("SnapProjectManager.SnapRunConfiguration.SnapDevMode");
48 const QString WORKINGDIRECTORYASPECT_ID = QStringLiteral("SnapProjectManager.SnapRunConfiguration.WorkingDirectoryAspect");
49 const QString ARGUMENTASPECT_ID = QStringLiteral("SnapProjectManager.SnapRunConfiguration.ArgumentAspect");
50 const QString TERMINALASPECT_ID = QStringLiteral("SnapProjectManager.SnapRunConfiguration.TerminalAspect");
51
52 SnapRunConfiguration::SnapRunConfiguration(ProjectExplorer::Target *parent)
53 : ProjectExplorer::RunConfiguration(parent, Constants::SNAP_RUNCONFIGURATION_ID)
54+ , m_useDevMode(true)
55 , m_workingDirectoryAspect(new ProjectExplorer::WorkingDirectoryAspect(this, WORKINGDIRECTORYASPECT_ID))
56 , m_argumentAspect(new ProjectExplorer::ArgumentsAspect(this, ARGUMENTASPECT_ID))
57 , m_terminalAspect(new ProjectExplorer::TerminalAspect(this, TERMINALASPECT_ID))
58@@ -87,6 +90,7 @@
59 return false;
60
61 m_command = map.value(COMMAND_KEY, QString()).toString();
62+ m_useDevMode = map.value(DEVMODE_KEY, true).toBool();
63 return true;
64 }
65
66@@ -94,6 +98,7 @@
67 {
68 QVariantMap map = ProjectExplorer::RunConfiguration::toMap();
69 map.insert(COMMAND_KEY, m_command);
70+ map.insert(DEVMODE_KEY, m_useDevMode);
71 return map;
72 }
73
74@@ -131,6 +136,9 @@
75 m_command
76 };
77
78+ if (m_useDevMode)
79+ args.prepend(QStringLiteral("--devmode"));
80+
81 ProjectExplorer::StandardRunnable r;
82 r.executable = Utils::FileName::fromString(Constants::UBUNTU_SCRIPTPATH).appendPath(QStringLiteral("qtc_desktop_snaprunner.py")).toString();;
83 r.workingDirectory = m_workingDirectoryAspect->workingDirectory().toString();
84@@ -167,6 +175,16 @@
85
86 }
87
88+bool SnapRunConfiguration::useDevMode() const
89+{
90+ return m_useDevMode;
91+}
92+
93+void SnapRunConfiguration::setUseDevMode(bool useDevMode)
94+{
95+ m_useDevMode = useDevMode;
96+}
97+
98 SnapRunConfigurationWidget::SnapRunConfigurationWidget(SnapRunConfiguration *config)
99 : QWidget (nullptr),
100 m_rc(config),
101@@ -188,10 +206,16 @@
102 if (idx >= 0)
103 m_commandsBox->setCurrentIndex(idx);
104
105+ m_devmodeCheckBox = new QCheckBox(tr("Use devmode"), this);
106+ m_devmodeCheckBox->setChecked(config->useDevMode());
107+ connect(m_devmodeCheckBox, &QCheckBox::stateChanged,
108+ this, &SnapRunConfigurationWidget::devModeStateChanged);
109+
110 layout->addRow(tr("Command:"), m_commandsBox);
111 config->extraAspect<ProjectExplorer::ArgumentsAspect>()->addToMainConfigurationWidget(this, layout);
112 config->extraAspect<ProjectExplorer::WorkingDirectoryAspect>()->addToMainConfigurationWidget(this,layout);
113 config->extraAspect<ProjectExplorer::TerminalAspect>()->addToMainConfigurationWidget(this,layout);
114+ layout->addRow(QStringLiteral(""), m_devmodeCheckBox);
115
116 if(config->target()) {
117 connect(qobject_cast<SnapcraftProject*>(config->target()->project()), &SnapcraftProject::commandListChanged,
118@@ -226,6 +250,14 @@
119 m_commandsBox->setCurrentIndex(0);
120 }
121
122+void SnapRunConfigurationWidget::devModeStateChanged(int state)
123+{
124+ if (state == Qt::Checked)
125+ m_rc->setUseDevMode(true);
126+ else
127+ m_rc->setUseDevMode(false);
128+}
129+
130 void SnapRunConfigurationWidget::commandSelected(const int index)
131 {
132 if(m_updating)
133
134=== modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfiguration.h'
135--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfiguration.h 2016-11-07 10:48:52 +0000
136+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfiguration.h 2016-11-08 12:28:00 +0000
137@@ -9,6 +9,7 @@
138 #include <QStringList>
139
140 class QComboBox;
141+class QCheckBox;
142
143 namespace Utils {
144 class PathChooser;
145@@ -49,6 +50,9 @@
146 virtual QWidget *createConfigurationWidget() override;
147 virtual ProjectExplorer::Runnable runnable() const override;
148
149+ bool useDevMode() const;
150+ void setUseDevMode(bool useDevMode);
151+
152 private:
153 SnapcraftStep *activeSnapcraftStep() const;
154 void updateCommandList(const QStringList &commands);
155@@ -56,6 +60,7 @@
156
157 private:
158 QString m_command;
159+ bool m_useDevMode;
160 QMetaObject::Connection m_currBuildConfConn;
161 ProjectExplorer::WorkingDirectoryAspect* m_workingDirectoryAspect;
162 ProjectExplorer::ArgumentsAspect* m_argumentAspect;
163@@ -71,6 +76,7 @@
164
165 protected:
166 void updateComboBox ();
167+ void devModeStateChanged (int state);
168
169 protected slots:
170 void commandSelected (const int index);
171@@ -78,6 +84,7 @@
172 private:
173 SnapRunConfiguration *m_rc;
174 QComboBox *m_commandsBox;
175+ QCheckBox *m_devmodeCheckBox;
176 bool m_updating;
177 };
178

Subscribers

People subscribed via source and target branches