|
@@ -96,7 +96,25 @@ void RoastColorEdit::readFinished()
|
96
|
96
|
QByteArray response = networkReply->readAll();
|
97
|
97
|
networkReply->deleteLater();
|
98
|
98
|
networkReply = 0;
|
99
|
|
- edit->setText(response.split('\n').last().split(',').at(2));
|
|
99
|
+ if(response.size() == 0)
|
|
100
|
+ {
|
|
101
|
+ return;
|
|
102
|
+ }
|
|
103
|
+ QList<QByteArray> lines = response.split('\n');
|
|
104
|
+ if(lines.last().size() == 0)
|
|
105
|
+ {
|
|
106
|
+ lines.removeLast();
|
|
107
|
+ }
|
|
108
|
+ if(lines.size() == 0)
|
|
109
|
+ {
|
|
110
|
+ return;
|
|
111
|
+ }
|
|
112
|
+ QList<QByteArray> fields = lines.last().split(',');
|
|
113
|
+ if(fields.size() < 3)
|
|
114
|
+ {
|
|
115
|
+ return;
|
|
116
|
+ }
|
|
117
|
+ edit->setText(QString(fields.at(2)));
|
100
|
118
|
}
|
101
|
119
|
|
102
|
120
|
@ Two methods provide access to the |QLineEdit|.
|
|
@@ -119,6 +137,10 @@ else if(currentElement.tagName() == "roastcoloredit")
|
119
|
137
|
{
|
120
|
138
|
QBoxLayout *layout = qobject_cast<QBoxLayout *>(layoutStack->top());
|
121
|
139
|
RoastColorEdit *edit = new RoastColorEdit;
|
|
140
|
+ if(element.hasAttribute("id"))
|
|
141
|
+ {
|
|
142
|
+ edit->setObjectName(element.attribute("id"));
|
|
143
|
+ }
|
122
|
144
|
layout->addWidget(edit);
|
123
|
145
|
}
|
124
|
146
|
|