Merge lp:~bzoltan/qtcreator-plugin-ubuntu/hook_up_reviewing into lp:qtcreator-plugin-ubuntu

Proposed by Zoltan Balogh
Status: Merged
Approved by: Zoltan Balogh
Approved revision: 71
Merged at revision: 69
Proposed branch: lp:~bzoltan/qtcreator-plugin-ubuntu/hook_up_reviewing
Merge into: lp:qtcreator-plugin-ubuntu
Diff against target: 244 lines (+58/-12)
8 files modified
src/ubuntu/ubuntuconstants.h (+1/-0)
src/ubuntu/ubuntumenu.cpp (+9/-0)
src/ubuntu/ubuntumenu.h (+7/-0)
src/ubuntu/ubuntupackagingwidget.cpp (+34/-7)
src/ubuntu/ubuntupackagingwidget.h (+2/-0)
src/ubuntu/ubuntupackagingwidget.ui (+1/-1)
src/ubuntu/ubuntuplugin.cpp (+3/-3)
src/ubuntu/ubuntushared.h (+1/-1)
To merge this branch: bzr merge lp:~bzoltan/qtcreator-plugin-ubuntu/hook_up_reviewing
Reviewer Review Type Date Requested Status
Benjamin Zeller Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+203557@code.launchpad.net

Commit message

The click package reviewing tool is executed on the click package created in the Packaging tab.

Description of the change

The click package reviewing tool is executed on the click package created in the Packaging tab.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
69. By Zoltan Balogh

disconnect from the UbunuMenu signal when not needed

70. By Zoltan Balogh

Change the name of the review button

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
71. By Zoltan Balogh

do not attempt reviewing when the tools are not installed

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Benjamin Zeller (zeller-benjamin) wrote :

Looks good to me, ready to merge!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/ubuntu/ubuntuconstants.h'
2--- src/ubuntu/ubuntuconstants.h 2014-01-21 16:12:34 +0000
3+++ src/ubuntu/ubuntuconstants.h 2014-01-28 18:39:52 +0000
4@@ -158,6 +158,7 @@
5 const char UBUNTU_INITIAL_EMULATOR_NAME[] = "<emulator>";
6
7 const char UBUNTUBZR_INITIALIZE[] ="%0/qtc_bzr_info";
8+const char UBUNTUPACKAGINGWIDGET_ONFINISHED_ACTION_CLICK_CREATE[] = "%0/qtc_project_click_create";
9 const char UBUNTUPACKAGINGWIDGET_OPENMANIFEST[] ="%0/manifest.json";
10 const char UBUNTUPACKAGINGWIDGET_APPARMOR[] ="%0/%1.json";
11 const char UBUNTUPACKAGINGWIDGET_EXCLUDES[] ="%0/.excludes";
12
13=== modified file 'src/ubuntu/ubuntumenu.cpp'
14--- src/ubuntu/ubuntumenu.cpp 2013-12-10 13:29:27 +0000
15+++ src/ubuntu/ubuntumenu.cpp 2014-01-28 18:39:52 +0000
16@@ -49,9 +49,17 @@
17 using namespace Ubuntu;
18 using namespace Ubuntu::Internal;
19
20+UbuntuMenu *UbuntuMenu::m_instance = 0;
21+
22+UbuntuMenu *UbuntuMenu::instance()
23+{
24+ return m_instance;
25+}
26+
27 UbuntuMenu::UbuntuMenu(QObject *parent) :
28 QObject(parent)
29 {
30+ m_instance = this;
31 m_obj = getMenuJSON();
32
33 connect(&m_ubuntuProcess,SIGNAL(message(QString)),this,SLOT(onMessage(QString)));
34@@ -115,6 +123,7 @@
35 }
36
37 void UbuntuMenu::onFinished(QString cmd, int code) {
38+ emit finished_action(cmd);
39 printToOutputPane(QString::fromLatin1(Constants::UBUNTUMENU_ONFINISHED).arg(cmd).arg(code));
40 }
41
42
43=== modified file 'src/ubuntu/ubuntumenu.h'
44--- src/ubuntu/ubuntumenu.h 2013-12-10 11:52:08 +0000
45+++ src/ubuntu/ubuntumenu.h 2014-01-28 18:39:52 +0000
46@@ -46,6 +46,8 @@
47
48 void initialize();
49
50+ static UbuntuMenu* instance();
51+
52 void parseMenu(QJsonObject obj, Core::ActionContainer*& parent, const Core::Id &group = Core::Id());
53
54 QString menuPath(QString fileName);
55@@ -53,6 +55,9 @@
56
57 public slots:
58 void slotUpdateActions();
59+
60+signals:
61+ void finished_action(QString);
62
63 protected slots:
64 void menuItemTriggered();
65@@ -73,6 +78,8 @@
66
67 private:
68 bool isProperUbuntuHtmlProject(ProjectExplorer::Project *project) const;
69+ static UbuntuMenu *m_instance;
70+
71 };
72
73
74
75=== modified file 'src/ubuntu/ubuntupackagingwidget.cpp'
76--- src/ubuntu/ubuntupackagingwidget.cpp 2014-01-21 16:37:24 +0000
77+++ src/ubuntu/ubuntupackagingwidget.cpp 2014-01-28 18:39:52 +0000
78@@ -20,6 +20,7 @@
79 #include "ubuntusecuritypolicypickerdialog.h"
80 #include "ui_ubuntupackagingwidget.h"
81 #include "ubuntuconstants.h"
82+#include "ubuntumenu.h"
83
84 using namespace Ubuntu;
85
86@@ -36,6 +37,7 @@
87 #include <QMenu>
88 #include <QMessageBox>
89 #include <QScriptEngine>
90+#include <QRegularExpression>
91
92 using namespace Ubuntu::Internal;
93
94@@ -58,10 +60,34 @@
95 connect(&m_ubuntuProcess,SIGNAL(message(QString)),this,SLOT(onMessage(QString)));
96 connect(&m_ubuntuProcess,SIGNAL(finished(QString,int)),this,SLOT(onFinished(QString, int)));
97 connect(&m_ubuntuProcess,SIGNAL(error(QString)),this,SLOT(onError(QString)));
98+
99 m_bzr.initialize();
100 checkClickReviewerTool();
101 }
102
103+void UbuntuPackagingWidget::onFinishedAction(QString cmd) {
104+ if ((cmd == QString::fromLatin1(Constants::UBUNTUPACKAGINGWIDGET_ONFINISHED_ACTION_CLICK_CREATE).arg(Ubuntu::Constants::UBUNTU_SCRIPTPATH)) && (ui->pushButtonReviewersTools->isVisible()) ) {
105+ QString sClickPackageName = QString::fromLatin1("%0_%1_all.click").arg(ui->lineEdit_name->text()).arg(ui->lineEdit_version->text());
106+ ProjectExplorer::ProjectExplorerPlugin* projectExplorerInstance = ProjectExplorer::ProjectExplorerPlugin::instance();
107+ ProjectExplorer::Project* startupProject = projectExplorerInstance->startupProject();
108+ QString sClickPackagePath = startupProject->projectDirectory();
109+ QRegularExpression re(QLatin1String("\\/\\w+$")); // search for the project name in the path
110+ QRegularExpressionMatch match = re.match(sClickPackagePath);
111+ if (match.hasMatch()) {
112+ QString matched = match.captured(0);
113+ sClickPackagePath.chop(matched.length()-1); //leave the slash
114+ }
115+ sClickPackagePath.append(sClickPackageName);
116+ m_ubuntuProcess.stop();
117+ if (sClickPackagePath.isEmpty()) return;
118+ m_ubuntuProcess.append(QStringList() << QString::fromLatin1(Constants::SETTINGS_DEFAULT_CLICK_REVIEWERSTOOLS_LOCATION).arg(sClickPackagePath));
119+ ui->stackedWidget->setCurrentIndex(2);
120+ m_ubuntuProcess.start(QString(QLatin1String(Constants::UBUNTUPACKAGINGWIDGET_CLICK_REVIEWER_TOOLS_AGAINST_PACKAGE)).arg(sClickPackagePath));
121+ disconnect(m_UbuntuMenu_connection);
122+ }
123+}
124+
125+
126 void UbuntuPackagingWidget::on_pushButtonClosePackageReviewTools_clicked() {
127 ui->stackedWidget->setCurrentIndex(0);
128 }
129@@ -73,6 +99,7 @@
130 }
131
132 void UbuntuPackagingWidget::onFinished(QString cmd, int code) {
133+ Q_UNUSED(code);
134 ui->plainTextEditPackageReview->appendPlainText(QLatin1String("*** DONE ***"));
135 if (cmd == QString::fromLatin1(Constants::UBUNTUWIDGETS_ONFINISHED_SCRIPT_LOCAL_PACKAGE_INSTALLED).arg(Ubuntu::Constants::UBUNTU_SCRIPTPATH)) {
136 QStringList lines = m_reply.trimmed().split(QLatin1String(Constants::LINEFEED));
137@@ -90,10 +117,10 @@
138 settings.setValue(QLatin1String(Constants::SETTINGS_KEY_CLICK_REVIEWERSTOOLS), Constants::SETTINGS_DEFAULT_CLICK_REVIEWERSTOOLS);
139 } else {
140 QStringList lineData = line.split(QLatin1String(Constants::SPACE));
141- QString sEmulatorPackageStatus = lineData.takeFirst();
142- QString sEmulatorPackageName = lineData.takeFirst();
143- QString sEmulatorPackageVersion = lineData.takeFirst();
144- if (sEmulatorPackageStatus.startsWith(QLatin1String(Constants::INSTALLED))) {
145+ QString sReviewerToolPackageStatus = lineData.takeFirst();
146+ QString sReviewerToolPackageName = lineData.takeFirst();
147+ QString sReviewerToolPackageVersion = lineData.takeFirst();
148+ if (sReviewerToolPackageStatus.startsWith(QLatin1String(Constants::INSTALLED))) {
149 // There is click reviewer tool installed
150 ui->pushButtonReviewersTools->show();
151 settings.setValue(QLatin1String(Constants::SETTINGS_KEY_CLICK_REVIEWERSTOOLS_LOCATION), QLatin1String(Constants::SETTINGS_DEFAULT_CLICK_REVIEWERSTOOLS_LOCATION));
152@@ -210,6 +237,7 @@
153 }
154
155 void UbuntuPackagingWidget::save(bool bSaveSimple) {
156+ Q_UNUSED(bSaveSimple);
157 switch (m_previous_tab) {
158 case 0: {
159 // set package name to lower, bug #1219877
160@@ -340,12 +368,11 @@
161 }
162
163 void UbuntuPackagingWidget::on_pushButtonClickPackage_clicked() {
164-
165+ m_UbuntuMenu_connection = QObject::connect(UbuntuMenu::instance(),SIGNAL(finished_action(QString)),this,SLOT(onFinishedAction(QString)));
166 save((ui->tabWidget->currentWidget() == ui->tabSimple));
167-
168 Core::Command *cmd = Core::ActionManager::instance()->command(Core::Id(Constants::UBUNTUPACKAGINGWIDGET_BUILDPACKAGE_ID));
169 if (cmd) {
170- cmd->action()->trigger();
171+ cmd->action()->trigger(); // build the click package
172 }
173 }
174
175
176=== modified file 'src/ubuntu/ubuntupackagingwidget.h'
177--- src/ubuntu/ubuntupackagingwidget.h 2014-01-21 16:12:34 +0000
178+++ src/ubuntu/ubuntupackagingwidget.h 2014-01-28 18:39:52 +0000
179@@ -37,6 +37,7 @@
180 void onFinished(QString cmd, int code);
181 void onError(QString msg);
182 void onStarted(QString cmd);
183+ void onFinishedAction(QString cmd);
184
185 void on_pushButtonClosePackageReviewTools_clicked();
186 void on_pushButton_addpolicy_clicked();
187@@ -55,6 +56,7 @@
188 private:
189 UbuntuClickManifest m_manifest;
190 UbuntuClickManifest m_apparmor;
191+ QMetaObject::Connection m_UbuntuMenu_connection;
192 QProcess m_click;
193 UbuntuBzr m_bzr;
194 QString m_projectName;
195
196=== modified file 'src/ubuntu/ubuntupackagingwidget.ui'
197--- src/ubuntu/ubuntupackagingwidget.ui 2013-11-20 13:47:14 +0000
198+++ src/ubuntu/ubuntupackagingwidget.ui 2014-01-28 18:39:52 +0000
199@@ -362,7 +362,7 @@
200 <item row="12" column="0">
201 <widget class="QPushButton" name="pushButtonReviewersTools">
202 <property name="text">
203- <string>Execute tests against a click package</string>
204+ <string>Validate Click package</string>
205 </property>
206 </widget>
207 </item>
208
209=== modified file 'src/ubuntu/ubuntuplugin.cpp'
210--- src/ubuntu/ubuntuplugin.cpp 2013-12-10 10:54:15 +0000
211+++ src/ubuntu/ubuntuplugin.cpp 2014-01-28 18:39:52 +0000
212@@ -82,9 +82,6 @@
213 m_ubuntuWelcomeMode = new UbuntuWelcomeMode;
214 addAutoReleasedObject(m_ubuntuWelcomeMode);
215
216- m_ubuntuPackagingMode = new UbuntuPackagingMode();
217- addAutoReleasedObject(m_ubuntuPackagingMode);
218-
219 QSettings settings(QLatin1String(Constants::SETTINGS_COMPANY),QLatin1String(Constants::SETTINGS_PRODUCT));
220 settings.beginGroup(QLatin1String(Constants::SETTINGS_GROUP_MODE));
221 if (settings.value(QLatin1String(Constants::SETTINGS_KEY_API),Constants::SETTINGS_DEFAULT_API_VISIBILITY).toBool()) {
222@@ -114,6 +111,9 @@
223 m_ubuntuMenu = new UbuntuMenu;
224 addAutoReleasedObject(m_ubuntuMenu);
225
226+ m_ubuntuPackagingMode = new UbuntuPackagingMode();
227+ addAutoReleasedObject(m_ubuntuPackagingMode);
228+
229 addAutoReleasedObject(new UbuntuSettingsClickPage);
230 addAutoReleasedObject(new UbuntuSettingsDeviceConnectivityPage);
231 addAutoReleasedObject(new UbuntuSettingsPage);
232
233=== modified file 'src/ubuntu/ubuntushared.h'
234--- src/ubuntu/ubuntushared.h 2013-09-09 15:05:55 +0000
235+++ src/ubuntu/ubuntushared.h 2014-01-28 18:39:52 +0000
236@@ -34,7 +34,7 @@
237
238 static void printToOutputPane(QString msg) {
239 QString timestamp = QDateTime::currentDateTime().toString(QString::fromLatin1("HH:mm:ss"));
240- Core::ICore::instance()->messageManager()->printToOutputPane(QString(QLatin1String("[%0] %1")).arg(timestamp).arg(msg),Core::MessageManager::ModeSwitch);
241+ Core::ICore::instance()->messageManager()->printToOutputPane(QString(QLatin1String("[%0] %1")).arg(timestamp).arg(msg),Core::MessageManager::NoModeSwitch);
242 }
243
244 #endif // UBUNTUSHARED_H

Subscribers

People subscribed via source and target branches

to all changes: