Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 77 lines (58 sloc) 2.344 kb
728d3f7 merge markit
xunxin authored
1 #include "viwiedialog.h"
2
3
4 ViwieDialog::ViwieDialog(QWidget *parent)
5 :QDialog(parent)
6 {
7
8 QVBoxLayout *mainLayout = new QVBoxLayout;
9 formGroupBox = new QGroupBox(tr("Page"));
10
11 QFormLayout *formLayout = new QFormLayout();
12 urlEditor = new QLineEdit();
13 urlEditor->setText("http://www.google.com");
14 urlEditor->setReadOnly(true);
15 formLayout->addRow(new QLabel(tr("Url: ")), urlEditor);
16
17 catCombo = new QComboBox();
18 catCombo->addItem("cat1");
19 catCombo->addItem("cat2");
20 formLayout->addRow(new QLabel(tr("Category: ")), catCombo);
21 fieldsTable = new QTableWidget(0, 3);
22 QStringList list;
23 list << tr("Field Name") << tr("Field Type") << tr("Detail");
24 fieldsTable->setHorizontalHeaderLabels (list);
25 formLayout->addRow(new QLabel(tr("Fields: ")), fieldsTable);
26
27 formGroupBox->setLayout(formLayout);
28 mainLayout->addWidget(formGroupBox);
29
30 buttonsGroupBox = new QGroupBox(tr("Process: "));
31 QHBoxLayout *hboxLayout = new QHBoxLayout;
32 QPushButton *tmpSaveBtn = new QPushButton(tr("Temp Save"));
33 QPushButton *permSaveBtn = new QPushButton(tr("Permanent Save"));
34 QPushButton *cancelBtn = new QPushButton(tr("Cancel"));
35 connect(cancelBtn, SIGNAL(clicked()), this, SLOT(reject()));
36
37 hboxLayout->addWidget(tmpSaveBtn);
38 hboxLayout->addWidget(permSaveBtn);
39 hboxLayout->addWidget(cancelBtn);
40
41 buttonsGroupBox->setLayout(hboxLayout);
42
43 mainLayout->addWidget(buttonsGroupBox);
44 setLayout(mainLayout);
45 setWindowTitle(tr("Vision-based Web Information Extraction "));
46 }
47
48 QVariant ViwieDialog::getValue()
49 {
50
51 return viwieJson;
52 }
53
54 bool ViwieDialog::refresh(const QVariant& viwieTags)
55 {
56 QVariantMap viwieMap = viwieTags.toMap();
57
58 QString url = viwieMap["url"].toString();
59 urlEditor->setText(url);
60
61 fieldsTable->clear();
62 QVariantList fieldsList = viwieMap["fields"].toList();
63 int len = fieldsList.length();
64 for (int i = 0; i < len; i++) {
65 QVariantMap fieldMap = fieldsList.at(i).toMap();
66
67 QString name = fieldMap["name"].toString();
68 QString type = fieldMap["type"].toString();
69 fieldsTable->setRowCount(fieldsTable->rowCount() + 1);
70
71 fieldsTable->setItem(i, 0, new QTableWidgetItem(name));
72 fieldsTable->setItem(i, 1, new QTableWidgetItem(type));
73 }
74
75 return true;
76 }
Something went wrong with that request. Please try again.