최신 analyzer + 형태소 분석기 합쳐놓음
git-svn-id: svn://192.168.0.12/source@245 8346c931-da38-4b9b-9d4c-e48b93cbd075
This commit is contained in:
388
MorphereAnalyzer/subwindow.cpp
Normal file
388
MorphereAnalyzer/subwindow.cpp
Normal file
@@ -0,0 +1,388 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the examples of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:BSD$
|
||||
** You may use this file under the terms of the BSD license as follows:
|
||||
**
|
||||
** "Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in
|
||||
** the documentation and/or other materials provided with the
|
||||
** distribution.
|
||||
** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
|
||||
** of its contributors may be used to endorse or promote products derived
|
||||
** from this software without specific prior written permission.
|
||||
**
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <QtWidgets>
|
||||
#include "mainwindow.h"
|
||||
#include "subwindow.h"
|
||||
//#include "widget.h"
|
||||
#include "stable.h"
|
||||
#include "sdictionary.h"
|
||||
#include "tablealgorithm_interface.h"
|
||||
#include "yalgorithm.h"
|
||||
#include "ymbasicwidget.h"
|
||||
#include "ymonedepthwidget.h"
|
||||
#include "ymnxnmatrixwidget.h"
|
||||
#include <QSqlQuery>
|
||||
#include <QSqlDatabase>
|
||||
#include <QSqlError>
|
||||
#include "ymtwodepthwidget.h"
|
||||
#include "ymplatformwidget.h"
|
||||
#include "ymtwodepthawidget.h"
|
||||
#include <QShortcut>
|
||||
#include <QKeySequence>
|
||||
#include <QUrl>
|
||||
//! [0]
|
||||
SubWindow::SubWindow()
|
||||
{
|
||||
QWidget *widget = new QWidget;
|
||||
setCentralWidget(widget);
|
||||
//p_qwDB = new Widget;
|
||||
//p_qwFile = new QWidget;
|
||||
//p_qwAnalyzed1 = new QWidget;
|
||||
//p_qwText = new QWidget;
|
||||
//p_qwAnalyzer1 = new SAnaly1;
|
||||
//p_qwAnalyzer2 = new SAnaly2;
|
||||
m_pYMBasicWidget = new YMBasicWidget;
|
||||
m_pYMOneDepthWidget = new YMOneDepthWidget;
|
||||
m_pYMTwoDepthWidget = new YMTwoDepthWidget;
|
||||
m_pYMTwoDepthAWidget = new YMTwoDepthAWidget;
|
||||
|
||||
m_pYMNxNMatrixWidget = new YMNxNMatrixWidget;
|
||||
m_pYMPlatformWidget = new YMPlatformWidget;
|
||||
p_qwDict = new SDictionary;
|
||||
|
||||
//p_qwAnalyzer1->setWidget(p_qwDB);
|
||||
//p_qwAnalyzer2->setWidget(p_qwDB);
|
||||
m_ptwSource = new QTabWidget;
|
||||
m_ptwSource->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
//m_ptwSource->addTab(p_qwDB,"DB");
|
||||
//m_ptwSource->addTab(p_qwFile,"File");
|
||||
//m_ptwSource->addTab(p_qwText,"Text");
|
||||
//m_ptwSource->addTab(p_qwAnalyzed1,"Analyzed1");
|
||||
m_pTAInterface = new TableAlgorithmInterface;
|
||||
m_pTAInterface->ReloadColumn();
|
||||
m_pUploadWidget = new YMUploadWidget();
|
||||
|
||||
|
||||
m_ptwResult = new QTabWidget;
|
||||
m_ptwResult->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
//m_ptwResult->addTab(p_qwAnalyzer1, "Analysis1");
|
||||
//m_ptwResult->addTab(p_qwAnalyzer2, "Analysis2");
|
||||
m_ptwResult->addTab(m_pYMBasicWidget, "Basic");
|
||||
m_ptwResult->addTab(m_pYMOneDepthWidget, "OneDepth");
|
||||
m_ptwResult->addTab(m_pYMTwoDepthWidget, "TwoDepth");
|
||||
m_ptwResult->addTab(m_pYMTwoDepthAWidget, "TwoDepthAdv");
|
||||
m_ptwResult->addTab(m_pYMNxNMatrixWidget, "NxNMatrix");
|
||||
m_ptwResult->addTab(m_pYMPlatformWidget, "Platform");
|
||||
|
||||
|
||||
m_pYMBasicWidget->setTabWidget(GetMainWindow()->m_pDataDlg->GetCurrentTab());
|
||||
m_pYMOneDepthWidget->setTabWidget(GetMainWindow()->m_pDataDlg->GetCurrentTab());
|
||||
m_pYMTwoDepthWidget->setTabWidget(GetMainWindow()->m_pDataDlg->GetCurrentTab());
|
||||
m_pYMNxNMatrixWidget->setTabWidget(GetMainWindow()->m_pDataDlg->GetCurrentTab());
|
||||
m_pYMPlatformWidget->setTabWidget(GetMainWindow()->m_pDataDlg->GetCurrentTab());
|
||||
m_pYMTwoDepthAWidget->setTabWidget(GetMainWindow()->m_pDataDlg->GetCurrentTab());
|
||||
|
||||
m_pUploadWidget->setResultTabWidget(m_ptwResult);
|
||||
m_pUploadWidget->setSourceTabWidget(GetMainWindow()->m_pDataDlg->GetCurrentTab());
|
||||
QHBoxLayout *layout = new QHBoxLayout;
|
||||
|
||||
layout->setMargin(5);
|
||||
//layout->addWidget(m_ptwSource);
|
||||
layout->addWidget(m_ptwResult);
|
||||
|
||||
widget->setLayout(layout);
|
||||
//! [1]
|
||||
|
||||
actD3View = new QAction(tr("D3View"), this);
|
||||
actD3View->setShortcut(Qt::Key_0 | Qt::CTRL);
|
||||
connect(actD3View, SIGNAL(triggered()), this, SLOT(slotD3View()));
|
||||
this->addAction(actD3View);
|
||||
|
||||
//! [2]
|
||||
createActions();
|
||||
createMenus();
|
||||
|
||||
QString message = tr("A context menu is available by right-clicking");
|
||||
statusBar()->showMessage(message);
|
||||
//test = new QWebView(this);
|
||||
setWindowFlags(Qt::Window | Qt::WindowTitleHint | Qt::CustomizeWindowHint);
|
||||
setWindowTitle(tr("Morphere Analyzer"));
|
||||
setMinimumSize(800, 600);
|
||||
resize(800, 600);
|
||||
}
|
||||
void SubWindow::createActions()
|
||||
{
|
||||
//! [5]
|
||||
//!
|
||||
actDBNew = new QAction(tr("&New DB "), this);
|
||||
actDBNew->setStatusTip(tr("Create a new DB"));
|
||||
connect(actDBNew, SIGNAL(triggered()), this, SLOT(newDB()));
|
||||
|
||||
actDBCsvImport = new QAction(tr("DB - CSV Import"), this);
|
||||
actDBCsvImport->setStatusTip(tr("Import DB as a csv file"));
|
||||
connect(actDBCsvImport, SIGNAL(triggered()), this, SLOT(importDB()));
|
||||
|
||||
actDBCsvExport = new QAction(tr("DB - CSV Export"), this);
|
||||
actDBCsvExport->setStatusTip(tr("Export DB as a csv file"));
|
||||
connect(actDBCsvExport, SIGNAL(triggered()), this, SLOT(exportDB()));
|
||||
|
||||
actMorphereOriginalExport = new QAction(tr("Morphere - CSV Export(OtherType Result)"), this);
|
||||
actMorphereOriginalExport->setStatusTip(tr("Export Morphere as a csv file"));
|
||||
connect(actMorphereOriginalExport, SIGNAL(triggered()), this, SLOT(exportOriginalMorphere()));
|
||||
|
||||
actMorphereExport = new QAction(tr("Morphere - CSV Export"), this);
|
||||
actMorphereExport->setStatusTip(tr("Export Morphere as a csv file"));
|
||||
connect(actMorphereExport, SIGNAL(triggered()), this, SLOT(exportMorphere()));
|
||||
|
||||
actMorphereImport = new QAction(tr("Morphere - CSV Import"), this);
|
||||
actMorphereImport->setStatusTip(tr("Import Morphere as a csv file"));
|
||||
connect(actMorphereImport, SIGNAL(triggered()), this, SLOT(importMorphere()));
|
||||
|
||||
actExit = new QAction(tr("Exit"), this);
|
||||
actExit->setStatusTip(tr("Exit the application"));
|
||||
connect(actExit, SIGNAL(triggered()), this, SLOT(close()));
|
||||
|
||||
actAnalyze = new QAction(tr("Analyze"), this);
|
||||
actAnalyze->setStatusTip(tr("Analyze"));
|
||||
connect(actAnalyze, SIGNAL(triggered()), this, SLOT(slotAnalyze()));
|
||||
|
||||
actDictionary = new QAction(tr("Dictionary"), this);
|
||||
actAnalyze->setStatusTip(tr("Execute Dictionary Widget"));
|
||||
connect(actDictionary, SIGNAL(triggered()), this, SLOT(slotDictionary()));
|
||||
|
||||
actTestUpload = new QAction(tr("Test Upload"), this);
|
||||
connect(actTestUpload, SIGNAL(triggered()), this, SLOT(slotTestUpload()));
|
||||
actShowUpload = new QAction(tr("Show Upload"), this);
|
||||
connect(actShowUpload, SIGNAL(triggered()), this, SLOT(slotShowUpload()));
|
||||
actD3ViewTree = new QAction(tr("D3View Tree"), this);
|
||||
connect(actD3ViewTree, SIGNAL(triggered()), this, SLOT(slotD3ViewTree()));
|
||||
|
||||
actD3ViewTreeFile = new QAction(tr("D3ViewTree From File"), this);
|
||||
connect(actD3ViewTreeFile, SIGNAL(triggered()), this, SLOT(slotD3ViewTreeFile()));
|
||||
|
||||
actD3ViewFile = new QAction(tr("D3View From File"), this);
|
||||
connect(actD3ViewFile, SIGNAL(triggered()), this, SLOT(slotD3ViewFile()));
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void SubWindow::slotShowUpload()
|
||||
{
|
||||
m_pUploadWidget->show();
|
||||
|
||||
}
|
||||
|
||||
void SubWindow::slotD3View()
|
||||
{
|
||||
((YMorphereWidget*)(m_ptwResult->currentWidget()))->D3View();
|
||||
//qDebug() << "hide the D3View";
|
||||
}
|
||||
|
||||
void SubWindow::slotD3ViewTree()
|
||||
{
|
||||
((YMorphereWidget*)(m_ptwResult->currentWidget()))->D3ViewTree();
|
||||
//qDebug() << "hide the D3View";
|
||||
}
|
||||
|
||||
void SubWindow::slotD3ViewFile()
|
||||
{
|
||||
((YMorphereWidget*)(m_ptwResult->currentWidget()))->D3ViewFile();
|
||||
//qDebug() << "hide the D3View";
|
||||
}
|
||||
|
||||
void SubWindow::slotD3ViewTreeFile()
|
||||
{
|
||||
((YMorphereWidget*)(m_ptwResult->currentWidget()))->D3ViewTreeFile();
|
||||
//qDebug() << "hide the D3View";
|
||||
}
|
||||
|
||||
|
||||
void SubWindow::createMenus()
|
||||
{
|
||||
//! [9] //! [10]
|
||||
menuFile = menuBar()->addMenu(tr("File"));
|
||||
|
||||
menuFile->addAction(actDBNew);
|
||||
menuFile->addSeparator();
|
||||
//! [9]
|
||||
menuFile->addAction(actDBCsvImport);
|
||||
//! [10]
|
||||
menuFile->addAction(actDBCsvExport);
|
||||
menuFile->addSeparator();
|
||||
menuFile->addAction(actMorphereImport);
|
||||
menuFile->addAction(actMorphereExport);
|
||||
menuFile->addAction(actMorphereOriginalExport);
|
||||
|
||||
menuFile->addSeparator();
|
||||
menuFile->addAction(actExit);
|
||||
//! [11]
|
||||
|
||||
//! [11]
|
||||
menuDictionary = menuBar()->addMenu(tr("Dictionary"));
|
||||
menuDictionary->addAction(actDictionary);
|
||||
|
||||
menuAnalyze = menuBar()->addMenu(tr("Analyze"));
|
||||
menuAnalyze->addAction(actAnalyze);
|
||||
|
||||
menuTestUpload = menuBar()->addMenu(tr("TestUpload"));
|
||||
menuTestUpload->addAction(actTestUpload);
|
||||
|
||||
menuShowUpload = menuBar()->addMenu(tr("ShowUpload"));
|
||||
menuShowUpload->addAction(actShowUpload);
|
||||
|
||||
menuD3View = menuBar()->addMenu(tr("D3View"));
|
||||
menuD3View->addAction(actD3View);
|
||||
menuD3View->addAction(actD3ViewFile);
|
||||
menuD3View->addAction(actD3ViewTree);
|
||||
menuD3View->addAction(actD3ViewTreeFile);
|
||||
|
||||
}
|
||||
//! [12]
|
||||
|
||||
|
||||
void SubWindow::newDB()
|
||||
{
|
||||
//p_qwDB->FileNew();
|
||||
}
|
||||
|
||||
void SubWindow::importDB()
|
||||
{
|
||||
//p_qwDB->FileImport();
|
||||
}
|
||||
|
||||
void SubWindow::exportDB()
|
||||
{
|
||||
//p_qwDB->FileExport();
|
||||
}
|
||||
|
||||
void SubWindow::importMorphere()
|
||||
{
|
||||
// p_qwAnalyzer1->FileImport();
|
||||
}
|
||||
|
||||
void SubWindow::exportMorphere()
|
||||
{
|
||||
((YMorphereWidget*)(m_ptwResult->currentWidget()))->SaveFile();
|
||||
// p_qwAnalyzer1->FileExport();
|
||||
}
|
||||
|
||||
void SubWindow::exportOriginalMorphere()
|
||||
{
|
||||
((YMorphereWidget*)(m_ptwResult->currentWidget()))->SaveFileSimple();
|
||||
// p_qwAnalyzer1->RawFileExport();
|
||||
}
|
||||
|
||||
void SubWindow::slotAnalyze()
|
||||
{
|
||||
QMessageBox msg;
|
||||
msg.setText("Please choose...");
|
||||
msg.setModal(true);
|
||||
|
||||
QPushButton *pbTitle = msg.addButton("Title",QMessageBox::ActionRole);
|
||||
QPushButton *pbBody = msg.addButton("Body",QMessageBox::ActionRole);
|
||||
QPushButton *pbAll = msg.addButton("ALL",QMessageBox::ActionRole);
|
||||
QPushButton *pbPlatformTitle = msg.addButton("Platform Title",QMessageBox::ActionRole);
|
||||
/*
|
||||
int setbody;
|
||||
msg.exec();
|
||||
if (msg.clickedButton() == pbTitle) { setbody = 0; }
|
||||
else if (msg.clickedButton() == pbBody) { setbody = 1; }
|
||||
else if (msg.clickedButton() == pbAll) { setbody = 2; }
|
||||
else if (msg.clickedButton() == pbPlatformTitle) { setbody = 3; }
|
||||
*/
|
||||
|
||||
QMessageBox msg2;
|
||||
msg2.setWindowFlags(msg2.windowFlags() | Qt::WindowCloseButtonHint);
|
||||
msg2.setText("Please wait...");
|
||||
msg2.setVisible(true);
|
||||
//qDebug() << p_qwDB->GetTabWidget()->currentIndex();
|
||||
m_pTAInterface->setSource(GetMainWindow()->m_pDataDlg->GetCurrentWidget());
|
||||
YAFactory::getInstance()->getYAlgorithm(((YMorphereWidget*)(m_ptwResult->currentWidget()))->convertToParam())->setDataAlgorithmInterface(m_pTAInterface);
|
||||
m_ptwResult->currentWidget();
|
||||
//qDebug() << m_ptwResult->currentIndex();
|
||||
|
||||
/*
|
||||
if(m_ptwResult->currentIndex() == 0)
|
||||
{
|
||||
p_qwAnalyzer1->Exec(setbody);
|
||||
}
|
||||
else if(m_ptwResult->currentIndex() == 1)
|
||||
{
|
||||
p_qwAnalyzer2->Exec(setbody);
|
||||
}
|
||||
else if(m_ptwResult->currentIndex() == 2)
|
||||
{
|
||||
m_pYMBasicWidget->Exec(setbody);
|
||||
}
|
||||
else if(m_ptwResult->currentIndex() == 3)
|
||||
{
|
||||
m_pYMOneDepthWidget->Exec(setbody);
|
||||
}
|
||||
else if(m_ptwResult->currentIndex() == 4)
|
||||
{
|
||||
m_pYMNxNMatrixWidget->Exec(setbody);
|
||||
}
|
||||
*/
|
||||
/*
|
||||
if(m_ptwResult->currentIndex() == 0)
|
||||
{
|
||||
m_pYMBasicWidget->Exec(setbody);
|
||||
}
|
||||
else if(m_ptwResult->currentIndex() == 1)
|
||||
{
|
||||
m_pYMOneDepthWidget->Exec(setbody);
|
||||
}
|
||||
else if(m_ptwResult->currentIndex() == 2)
|
||||
{
|
||||
m_pYMNxNMatrixWidget->Exec(setbody);
|
||||
}
|
||||
*/
|
||||
((YMorphereWidget*)(m_ptwResult->currentWidget()))->Exec();
|
||||
|
||||
msg2.setVisible(false);
|
||||
}
|
||||
|
||||
void SubWindow::slotTestUpload()
|
||||
{
|
||||
((YMorphereWidget*)(m_ptwResult->currentWidget()))->TestUpload();
|
||||
}
|
||||
|
||||
void SubWindow::slotDictionary()
|
||||
{
|
||||
p_qwDict->show();
|
||||
p_qwDict->repaint();
|
||||
}
|
||||
|
||||
void SubWindow::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
QApplication::quit();
|
||||
}
|
||||
Reference in New Issue
Block a user