Permalink
Browse files

delete viwie code

  • Loading branch information...
xunxin
xunxin committed Aug 12, 2009
1 parent d0679af commit 335c3ea89c3b2fd6a733fa4757a3a40ea2b42589
Showing with 0 additions and 158 deletions.
  1. +0 −135 mainwindow.cpp
  2. +0 −23 mainwindow.h
View
@@ -153,7 +153,6 @@ void MainWindow::setupUI() {
createUrlEdit();
createToolBar();
createMenus();
- createViwieUI();
//m_hunterConfig->hide();
}
@@ -407,140 +406,6 @@ void MainWindow::createHelpMenu() {
this, SLOT(aboutMe()));
}
-void MainWindow::createViwieUI() {
- Q_ASSERT(m_view != NULL);
-
- m_webSelected = new QWebSelected(m_view->page());
-
- m_fieldDialog = new FieldDialog(this);
- m_viwieDialog = new ViwieDialog(this);
- connect(m_view, SIGNAL(showTextFieldDialog()), this, SLOT(showTextFieldDialog()));
- connect(m_view, SIGNAL(showImageFieldDialog()), this, SLOT(showImageFieldDialog()));
-
- connect(m_view, SIGNAL(showViwieDialog()), this, SLOT(showViwieDialog()));
-
- connect(m_fieldDialog, SIGNAL(addField()), this, SLOT(addField()));
- connect(m_fieldDialog, SIGNAL(overrideField()), this, SLOT(overrideField()));
- connect(m_fieldDialog, SIGNAL(deleteField()), this, SLOT(deleteField()));
-
- connect(m_viwieDialog, SIGNAL(permanentSave()), this, SLOT(permanentSaveViwie()));
- connect(m_viwieDialog, SIGNAL(tmpSave()), this, SLOT(tmpSaveViwie()));
-
-}
-
-void MainWindow::showTextFieldDialog() {
- QVariantMap fieldMap;
-
- fieldMap.insert("type", QVariant("text"));
- fieldMap.insert("text", QVariant(m_view->page()->selectedText()));
- QVariant selectedNodes = m_webSelected->getSelectedNodes();
- fieldMap.insert("xpaths", selectedNodes);
-
- m_fieldDialog->refresh(fieldMap);
-
- m_fieldDialog->exec();
-}
-
-void MainWindow::showImageFieldDialog() {
- QVariantMap fieldMap;
- QPoint pos = m_view->hitPos;
- fieldMap.insert("type", QVariant("image"));
- QVariant hitNode = m_webSelected->getClickedNode(pos);
- fieldMap.insert("xpaths", hitNode);
-
- m_fieldDialog->refresh(fieldMap);
-
- m_fieldDialog->exec();
-}
-
-
-void MainWindow::showViwieDialog() {
- if (viwieTags.isNull()) {
- QVariantMap map;
- QString url = m_view->url().toString();
-
- map.insert("url", QVariant(url));
- viwieTags = QVariant(map);
- }
-
- m_viwieDialog->refresh(viwieTags);
- m_viwieDialog->exec();
-}
-
-void MainWindow::hideViwieDialog() {
- m_viwieDialog->hide();
-}
-
-
-void MainWindow::addField() {
- if (viwieTags.isNull()) {
- QMessageBox::warning(this, tr("Add Field"),
- "No url and category selected!", QMessageBox::NoButton);
- return;
- }
-
- QVariantMap viwieMap = viwieTags.toMap();
- QString cat = viwieMap["category"].toString();
- if (cat.isNull()) {
- QMessageBox::warning(this, tr("Add Field"),
- "No category selected on Viwie panel", QMessageBox::NoButton);
- return;
- }
- QVariant fieldsVar = viwieMap["fields"];
- if (fieldsVar.isNull()) {
- QVariantList fieldList;
- fieldList.push_back(m_fieldDialog->getValue());
- viwieMap.insert("fields", QVariant(fieldList));
- } else {
- QVariantList fieldList = fieldsVar.toList();
- QVariantMap fieldMap = m_fieldDialog->getValue().toMap();
- QString name = fieldMap["name"].toString();
- if (name.isEmpty()) {
- QMessageBox::warning(this, tr("Add Field"),
- "No name selected!", QMessageBox::NoButton);
- return;
- }
- int len = fieldList.count();
- for (int i = 0; i < len; i++) {
- QString n = fieldList.at(i).toMap().value("name").toString();
- if (n == name) {
- QMessageBox::warning(this, tr("Add Field"),
- "The name has already existed!", QMessageBox::NoButton);
- return;
- }
- }
- fieldList.push_back(m_fieldDialog->getValue());
- viwieMap.insert("fields", QVariant(fieldList));
- }
- viwieTags = QVariant(viwieMap);
-
- m_fieldDialog->accept();
-}
-
-void MainWindow::overrideField() {
- m_fieldDialog->accept();
-}
-
-void MainWindow::deleteField() {
- m_fieldDialog->accept();
-}
-
-void MainWindow::tmpSaveViwie() {
- QVariant newViwie = m_viwieDialog->getValue();
- viwieTags = newViwie;
-
- m_viwieDialog->accept();
-}
-
-void MainWindow::permanentSaveViwie() {
- tmpSaveViwie();
- qDebug() << "Permanent Save: " << viwieTags;
- m_viwieDialog->accept();
-}
-
-
-void MainWindow::showDetailField(const QVariant& /* detail */) {
-}
void MainWindow::writeSettings() {
m_settings->beginGroup("MainWindow");
View
@@ -16,8 +16,6 @@
#include "iterator.h"
#include <qwebselected.h>
-#include "fielddialog.h"
-#include "viwiedialog.h"
#include "webview.h"
#include "webpage.h"
@@ -64,20 +62,6 @@ protected slots:
void loadUrl(const QUrl& url);
- // viwie slots
- void showTextFieldDialog();
- void showImageFieldDialog();
- void showViwieDialog();
- void hideViwieDialog();
-
- void addField();
- void overrideField();
- void deleteField();
-
- void tmpSaveViwie();
- void permanentSaveViwie();
- void showDetailField(const QVariant& detail);
-
void updateUrl(const QUrl& url) {
m_urlEdit->setText(url.toEncoded());
}
@@ -232,13 +216,6 @@ protected slots:
IteratorConfigDialog* m_iteratorConfig;
- bool m_viwieEnabled;
- void createViwieUI();
- QWebSelected* m_webSelected;
- ViwieDialog *m_viwieDialog;
- FieldDialog *m_fieldDialog;
- QVariant viwieTags;
-
QStringList m_urlList;
QStringListModel m_urlCompleterModel;
QSettings* m_settings;

0 comments on commit 335c3ea

Please sign in to comment.