comparison widgets/SearchWidget.cpp @ 228:a6b881972a62

add FileProperty to browse file on local system for query by humming
author lbajardsilogic
date Fri, 29 Feb 2008 11:08:09 +0000
parents faafebcf67a2
children 60e84bb658bc
comparison
equal deleted inserted replaced
227:59d84a8bb76c 228:a6b881972a62
24 #include <QKeyEvent> 24 #include <QKeyEvent>
25 25
26 #include <iostream> 26 #include <iostream>
27 27
28 #include "sv/main/MainWindow.h" 28 #include "sv/main/MainWindow.h"
29 #include "BrowseLineEdit.h"
29 30
30 SearchWidget::SearchWidget() : QWidget(), 31 SearchWidget::SearchWidget() : QWidget(),
31 m_curThemeWidget(0), 32 m_curThemeWidget(0),
32 m_curBoxLayout(0), 33 m_curBoxLayout(0),
33 m_curBoxRow(0) 34 m_curBoxRow(0)
173 174
174 m_curBoxLayout->addWidget(metadata, m_curBoxRow, 0); 175 m_curBoxLayout->addWidget(metadata, m_curBoxRow, 0);
175 176
176 PropertyContainer::PropertyType type = curTheme->getPropertyType(name); 177 PropertyContainer::PropertyType type = curTheme->getPropertyType(name);
177 178
179 QString unit = curTheme->getPropertyUnit(name);
180
178 switch (type) //draw a different widget according to the datatype 181 switch (type) //draw a different widget according to the datatype
179 { 182 {
180 case PropertyContainer::StringProperty: 183 case PropertyContainer::StringProperty:
181 { 184 {
182 QLineEdit * lineEdit = new QLineEdit(); 185 QLineEdit * lineEdit = new QLineEdit();
222 225
223 field = box; 226 field = box;
224 227
225 break; 228 break;
226 } 229 }
230 case PropertyContainer::FileProperty:
231 {
232 BrowseLineEdit * browseLineEdit = new BrowseLineEdit();
233
234 connect(browseLineEdit, SIGNAL(textChanged(const QString &)), curTheme, SLOT(setProperty(QString)));
235
236 m_curBoxLayout->addWidget(browseLineEdit, m_curBoxRow, 2);
237
238 field = browseLineEdit;
239
240 break;
241 }
227 242
228 default: break; 243 default: break;
229 244
230 } 245 }
231 246
232 if (field) 247 if (field)
233 { 248 {
234 field->setObjectName(name); 249 field->setObjectName(name);
235 m_curBoxLayout->addWidget(field, m_curBoxRow, 1); 250 m_curBoxLayout->addWidget(field, m_curBoxRow, 1);
236 } 251 }
237 252
238 QString unit = curTheme->getPropertyUnit(name);
239
240 if (unit != "") 253 if (unit != "")
241 { 254 {
242 m_curBoxLayout->addWidget(new QLabel(unit), m_curBoxRow, 2); 255 m_curBoxLayout->addWidget(new QLabel(unit), m_curBoxRow, 2);
243 } 256 }
244 257