Commit a9ea71c2 authored by Friedemann Kleint's avatar Friedemann Kleint Committed by hjk
Browse files

Use switch in showEditValue().



Change-Id: I37c628ea18663eb8fec5351e3b2d580617ff7c35
Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent 224eaa81
...@@ -1649,12 +1649,13 @@ void WatchHandler::showEditValue(const WatchData &data) ...@@ -1649,12 +1649,13 @@ void WatchHandler::showEditValue(const WatchData &data)
{ {
const QByteArray key = data.address ? data.hexAddress() : data.iname; const QByteArray key = data.address ? data.hexAddress() : data.iname;
QObject *w = m_model->m_editHandlers.value(key); QObject *w = m_model->m_editHandlers.value(key);
if (data.editformat == 0x0) { switch (data.editformat) {
case StopDisplay:
m_model->m_editHandlers.remove(data.iname); m_model->m_editHandlers.remove(data.iname);
delete w; delete w;
} else if (data.editformat == DisplayImageData break;
|| data.editformat == DisplayImageFile) { case DisplayImageData:
// QImage case DisplayImageFile: { // QImage
QLabel *l = qobject_cast<QLabel *>(w); QLabel *l = qobject_cast<QLabel *>(w);
if (!l) { if (!l) {
removeSeparateWidget(w); removeSeparateWidget(w);
...@@ -1692,10 +1693,11 @@ void WatchHandler::showEditValue(const WatchData &data) ...@@ -1692,10 +1693,11 @@ void WatchHandler::showEditValue(const WatchData &data)
l->setPixmap(QPixmap::fromImage(im)); l->setPixmap(QPixmap::fromImage(im));
l->resize(width, height); l->resize(width, height);
showSeparateWidget(l); showSeparateWidget(l);
} else if (data.editformat == DisplayUtf16String }
|| data.editformat == DisplayLatin1String break;
|| data.editformat == DisplayUtf8String) { case DisplayUtf16String:
// String data. case DisplayLatin1String:
case DisplayUtf8String: { // String data.
QTextEdit *t = qobject_cast<QTextEdit *>(w); QTextEdit *t = qobject_cast<QTextEdit *>(w);
if (!t) { if (!t) {
removeSeparateWidget(w); removeSeparateWidget(w);
...@@ -1716,7 +1718,9 @@ void WatchHandler::showEditValue(const WatchData &data) ...@@ -1716,7 +1718,9 @@ void WatchHandler::showEditValue(const WatchData &data)
QLatin1String(data.type) : data.displayedType)); QLatin1String(data.type) : data.displayedType));
t->setText(str); t->setText(str);
showSeparateWidget(t); showSeparateWidget(t);
} else if (data.editformat == 4) { }
break;
case DisplayProcess: {
// Generic Process. // Generic Process.
int pos = data.editvalue.indexOf('|'); int pos = data.editvalue.indexOf('|');
QByteArray cmd = data.editvalue.left(pos); QByteArray cmd = data.editvalue.left(pos);
...@@ -1729,8 +1733,11 @@ void WatchHandler::showEditValue(const WatchData &data) ...@@ -1729,8 +1733,11 @@ void WatchHandler::showEditValue(const WatchData &data)
m_model->m_editHandlers[key] = p; m_model->m_editHandlers[key] = p;
} }
p->write(input + '\n'); p->write(input + '\n');
} else { }
break;
default:
QTC_ASSERT(false, qDebug() << "Display format: " << data.editformat); QTC_ASSERT(false, qDebug() << "Display format: " << data.editformat);
break;
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment