summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2014-10-07 14:30:24 +0200
committerAmaury Pouly <amaury.pouly@gmail.com>2014-12-15 22:53:49 +0100
commit7749c4d0e960b3e4f92194bd8f63ed70cc9bcb31 (patch)
treec07aa089a1da33c861ed6338f65f85918795ded6
parentcef5e1018e6e4c4d2aa8422e789bc0d79d310e52 (diff)
downloadrockbox-7749c4d0e960b3e4f92194bd8f63ed70cc9bcb31.tar.gz
rockbox-7749c4d0e960b3e4f92194bd8f63ed70cc9bcb31.zip
qeditor: message widget now supports IDs, useful to clear messages
Change-Id: Ibe0a8909128469a71a25415761860e06fc9f1e67 Reviewed-on: http://gerrit.rockbox.org/1006 Reviewed-by: Amaury Pouly <amaury.pouly@gmail.com>
-rw-r--r--utils/regtools/qeditor/regtab.cpp21
-rw-r--r--utils/regtools/qeditor/regtab.h5
-rw-r--r--utils/regtools/qeditor/utils.cpp11
-rw-r--r--utils/regtools/qeditor/utils.h6
4 files changed, 37 insertions, 6 deletions
diff --git a/utils/regtools/qeditor/regtab.cpp b/utils/regtools/qeditor/regtab.cpp
index b80ab57ecf..a82070e3f8 100644
--- a/utils/regtools/qeditor/regtab.cpp
+++ b/utils/regtools/qeditor/regtab.cpp
@@ -179,8 +179,9 @@ RegTab::RegTab(Backend *backend, QWidget *parent)
179 connect(m_data_sel_reload, SIGNAL(clicked(bool)), this, SLOT(OnBackendReload(bool))); 179 connect(m_data_sel_reload, SIGNAL(clicked(bool)), this, SLOT(OnBackendReload(bool)));
180 connect(m_type_selector, SIGNAL(currentChanged(int)), this, SLOT(OnTypeChanged(int))); 180 connect(m_type_selector, SIGNAL(currentChanged(int)), this, SLOT(OnTypeChanged(int)));
181 181
182 SetMessage(MessageWidget::Information, 182 m_msg_select_id = SetMessage(MessageWidget::Information,
183 "You can browse the registers. Select a data source to analyse the values."); 183 "You can browse the registers. Select a data source to analyse the values.");
184 m_msg_error_id = 0;
184 185
185 OnSocListChanged(); 186 OnSocListChanged();
186 SetDataSocName(""); 187 SetDataSocName("");
@@ -222,6 +223,12 @@ void RegTab::OnDataSocActivated(const QString& str)
222 int index = m_soc_selector->findText(str); 223 int index = m_soc_selector->findText(str);
223 if(index != -1) 224 if(index != -1)
224 m_soc_selector->setCurrentIndex(index); 225 m_soc_selector->setCurrentIndex(index);
226 else if(str.size() > 0)
227 {
228 m_msg_error_id = SetMessage(MessageWidget::Error,
229 "Description file for this SoC is not available.");
230 SetPanel(new EmptyRegTabPanel);
231 }
225} 232}
226 233
227void RegTab::UpdateTabName() 234void RegTab::UpdateTabName()
@@ -252,6 +259,9 @@ void RegTab::UpdateTabName()
252 259
253void RegTab::OnBackendSelect(IoBackend *backend) 260void RegTab::OnBackendSelect(IoBackend *backend)
254{ 261{
262 /* Hide "Please select two SoC" and errors message */
263 HideMessage(m_msg_select_id);
264 HideMessage(m_msg_error_id);
255 m_io_backend = backend; 265 m_io_backend = backend;
256 SetReadOnlyIndicator(); 266 SetReadOnlyIndicator();
257 SetDataSocName(m_io_backend->GetSocName()); 267 SetDataSocName(m_io_backend->GetSocName());
@@ -316,9 +326,14 @@ void RegTab::DisplaySoc(const SocRef& ref)
316 SetPanel(new SocDisplayPanel(this, ref)); 326 SetPanel(new SocDisplayPanel(this, ref));
317} 327}
318 328
319void RegTab::SetMessage(MessageWidget::MessageType type, const QString& msg) 329int RegTab::SetMessage(MessageWidget::MessageType type, const QString& msg)
330{
331 return m_msg->SetMessage(type, msg);
332}
333
334void RegTab::HideMessage(int id)
320{ 335{
321 m_msg->SetMessage(type, msg); 336 m_msg->HideMessage(id);
322} 337}
323 338
324void RegTab::SetPanel(RegTabPanel *panel) 339void RegTab::SetPanel(RegTabPanel *panel)
diff --git a/utils/regtools/qeditor/regtab.h b/utils/regtools/qeditor/regtab.h
index f088e7a8df..a0fd5f305a 100644
--- a/utils/regtools/qeditor/regtab.h
+++ b/utils/regtools/qeditor/regtab.h
@@ -78,7 +78,8 @@ protected:
78 void SetPanel(RegTabPanel *panel); 78 void SetPanel(RegTabPanel *panel);
79 void UpdateSocFilename(); 79 void UpdateSocFilename();
80 void UpdateTabName(); 80 void UpdateTabName();
81 void SetMessage(MessageWidget::MessageType type, const QString& msg); 81 int SetMessage(MessageWidget::MessageType type, const QString& msg);
82 void HideMessage(int id);
82 83
83 QComboBox *m_soc_selector; 84 QComboBox *m_soc_selector;
84 BackendSelector *m_backend_selector; 85 BackendSelector *m_backend_selector;
@@ -95,6 +96,8 @@ protected:
95 QTabWidget *m_type_selector; 96 QTabWidget *m_type_selector;
96 QListWidget *m_analysers_list; 97 QListWidget *m_analysers_list;
97 MessageWidget *m_msg; 98 MessageWidget *m_msg;
99 int m_msg_select_id;
100 int m_msg_error_id;
98 101
99private slots: 102private slots:
100 void SetReadOnlyIndicator(); 103 void SetReadOnlyIndicator();
diff --git a/utils/regtools/qeditor/utils.cpp b/utils/regtools/qeditor/utils.cpp
index 4f408b4765..effd79e0f6 100644
--- a/utils/regtools/qeditor/utils.cpp
+++ b/utils/regtools/qeditor/utils.cpp
@@ -998,6 +998,8 @@ MessageWidget::MessageWidget(QWidget *parent)
998 layout->addWidget(m_text, 1); 998 layout->addWidget(m_text, 1);
999 layout->addWidget(m_close, 0); 999 layout->addWidget(m_close, 0);
1000 1000
1001 m_id = 0;
1002
1001 connect(m_close, SIGNAL(clicked(bool)), this, SLOT(OnClose(bool))); 1003 connect(m_close, SIGNAL(clicked(bool)), this, SLOT(OnClose(bool)));
1002 1004
1003 hide(); 1005 hide();
@@ -1042,12 +1044,19 @@ void MessageWidget::UpdateType()
1042 .arg(border.name())); 1044 .arg(border.name()));
1043} 1045}
1044 1046
1045void MessageWidget::SetMessage(MessageType type, const QString& msg) 1047int MessageWidget::SetMessage(MessageType type, const QString& msg)
1046{ 1048{
1047 m_type = type; 1049 m_type = type;
1048 m_text->setText(msg); 1050 m_text->setText(msg);
1049 UpdateType(); 1051 UpdateType();
1050 show(); 1052 show();
1053 return ++m_id;
1054}
1055
1056void MessageWidget::HideMessage(int id)
1057{
1058 if(m_id == id)
1059 OnClose(true);
1051} 1060}
1052 1061
1053void MessageWidget::OnClose(bool clicked) 1062void MessageWidget::OnClose(bool clicked)
diff --git a/utils/regtools/qeditor/utils.h b/utils/regtools/qeditor/utils.h
index a2a95f1cac..529e40bde1 100644
--- a/utils/regtools/qeditor/utils.h
+++ b/utils/regtools/qeditor/utils.h
@@ -355,7 +355,10 @@ public:
355 355
356 MessageWidget(QWidget *parent = 0); 356 MessageWidget(QWidget *parent = 0);
357 virtual ~MessageWidget(); 357 virtual ~MessageWidget();
358 void SetMessage(MessageType type, const QString& msg); 358 /* returns message ID */
359 int SetMessage(MessageType type, const QString& msg);
360 /* clear message if ID match, nop otherwise */
361 void HideMessage(int id);
359 362
360protected: 363protected:
361 void UpdateType(); 364 void UpdateType();
@@ -364,6 +367,7 @@ protected:
364 QLabel *m_text; 367 QLabel *m_text;
365 QToolButton *m_close; 368 QToolButton *m_close;
366 MessageType m_type; 369 MessageType m_type;
370 int m_id;
367 371
368private slots: 372private slots:
369 void OnClose(bool clicked); 373 void OnClose(bool clicked);