Filter 연동시 Json 형식으로 변경
git-svn-id: svn://192.168.0.12/source@65 8346c931-da38-4b9b-9d4c-e48b93cbd075
This commit is contained in:
@@ -14,9 +14,11 @@ TEMPLATE = app
|
||||
SOURCES += main.cpp\
|
||||
widget.cpp \
|
||||
stable.cpp \
|
||||
../Json/sjson.cpp
|
||||
../Json/sjson.cpp \
|
||||
graphwidget.cpp
|
||||
|
||||
HEADERS += widget.h \
|
||||
stable.h \
|
||||
../Json/sjson.h \
|
||||
../common.h
|
||||
../common.h \
|
||||
graphwidget.h
|
||||
|
||||
12
DataAnalyzer/graphwidget.cpp
Normal file
12
DataAnalyzer/graphwidget.cpp
Normal file
@@ -0,0 +1,12 @@
|
||||
#include "graphwidget.h"
|
||||
|
||||
GraphWidget::GraphWidget(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
GraphWidget::~GraphWidget()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
18
DataAnalyzer/graphwidget.h
Normal file
18
DataAnalyzer/graphwidget.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifndef GRAPHWIDGET_H
|
||||
#define GRAPHWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class GraphWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit GraphWidget(QWidget *parent = 0);
|
||||
~GraphWidget();
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
};
|
||||
|
||||
#endif // GRAPHWIDGET_H
|
||||
@@ -154,3 +154,24 @@ void STable::Delete()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void STable::setArticleSelect(int _nArticle)
|
||||
{
|
||||
m_nArticle = _nArticle;
|
||||
}
|
||||
|
||||
QString STable::GetArticleType(int _nSelect)
|
||||
{
|
||||
switch(_nSelect)
|
||||
{
|
||||
case E_ARTICLE_NONE:
|
||||
return QString("{None} ");
|
||||
case E_ARTICLE_BODY:
|
||||
return QString("{Body} ");
|
||||
case E_ARTICLE_REPLY:
|
||||
return QString("{Relpy} ");
|
||||
case E_ARTICLE_ALL:
|
||||
return QString("{All} ");
|
||||
}
|
||||
return QString("{Other} ");
|
||||
}
|
||||
|
||||
@@ -18,15 +18,16 @@ public:
|
||||
explicit STable(QWidget *parent = 0);
|
||||
void keyPressEvent(QKeyEvent* event);
|
||||
void SetHeaderList(QVector <QStringList> *_vecColumn,int _nColumn);
|
||||
void setArticleSelect(int _nArticle){m_nArticle = _nArticle;}
|
||||
void setArticleSelect(int _nArticle);
|
||||
int getArticleSelect(){return m_nArticle;}
|
||||
void Copy();
|
||||
void Paste();
|
||||
void Delete();
|
||||
static QString GetArticleType(int _nSelect);
|
||||
private:
|
||||
int m_nArticle;
|
||||
public:
|
||||
QStringList m_strListHeader;
|
||||
QStringList m_strListHeader;
|
||||
signals:
|
||||
public slots:
|
||||
void HeaderContextMenuShow(const QPoint& pos);
|
||||
|
||||
@@ -72,7 +72,7 @@ Widget::Widget(QWidget *parent)
|
||||
setLayout(vMainLayout);
|
||||
DataGroupRefresh();
|
||||
FilterGroupRefresh();
|
||||
AddTable("1");
|
||||
AddTable("Start");
|
||||
}
|
||||
|
||||
Widget::~Widget()
|
||||
@@ -357,11 +357,13 @@ QGroupBox *Widget::setFilterWidgets()
|
||||
connect(pbDelete, SIGNAL(released()),this, SLOT(FilterDelete()));
|
||||
hMainlayout->addLayout(vlayout);
|
||||
}
|
||||
QGroupBox *groupBox = new QGroupBox(tr("Filter"));
|
||||
groupBox->setLayout(hMainlayout);
|
||||
m_pgbFilter = new QGroupBox(tr("Filter"));
|
||||
m_pgbFilter->setCheckable(true);
|
||||
m_pgbFilter->setChecked(false);
|
||||
m_pgbFilter->setLayout(hMainlayout);
|
||||
|
||||
connect(m_plwFilterGroup,SIGNAL(currentItemChanged(QListWidgetItem *,QListWidgetItem *)),this,SLOT(currentGroupItemChanged(QListWidgetItem *, QListWidgetItem *)));
|
||||
return groupBox;
|
||||
return m_pgbFilter;
|
||||
}
|
||||
|
||||
|
||||
@@ -403,11 +405,16 @@ void Widget::SearchDate()
|
||||
pNew->setArticleSelect(pCurrent->getArticleSelect());
|
||||
pNew->SetHeaderList(&m_vecColumn,E_COLUMN_NAME);
|
||||
m_pProgress->setRange(0,pCurrent->rowCount()-1);
|
||||
|
||||
int nCurrentFilterGroupID = D_NOT_SELECT;
|
||||
foreach (QListWidgetItem *item,m_plwFilterGroup->selectedItems())
|
||||
|
||||
if (m_pgbFilter->isChecked())
|
||||
{
|
||||
nCurrentFilterGroupID = item->data(Qt::UserRole).toInt();
|
||||
InsertTimeFilter(pNew->getArticleSelect(),m_pdeStart->date(),m_pdeEnd->date(),nCurrentFilterGroupID);
|
||||
foreach (QListWidgetItem *item,m_plwFilterGroup->selectedItems())
|
||||
{
|
||||
nCurrentFilterGroupID = item->data(Qt::UserRole).toInt();
|
||||
InsertTimeFilter(pNew->getArticleSelect(),m_pdeStart->date(),m_pdeEnd->date(),nCurrentFilterGroupID);
|
||||
}
|
||||
}
|
||||
|
||||
for (int nCount = 0 ; nCount < pCurrent->rowCount(); nCount++ )
|
||||
@@ -427,7 +434,8 @@ void Widget::SearchDate()
|
||||
m_pProgress->setValue(nCount);
|
||||
m_pProgress->repaint();
|
||||
}
|
||||
m_ptwData->addTab(pNew,m_ptwData->tabText(m_ptwData->currentIndex())+" d");
|
||||
//m_ptwData->addTab(pNew,m_ptwData->tabText(m_ptwData->currentIndex())+" d");
|
||||
m_ptwData->addTab(pNew,STable::GetArticleType(pCurrent->getArticleSelect()));
|
||||
m_ptwData->setCurrentIndex(m_ptwData->count()-1);
|
||||
if (nCurrentFilterGroupID != D_NOT_SELECT)
|
||||
RefreshFilter(nCurrentFilterGroupID);
|
||||
@@ -440,17 +448,37 @@ void Widget::SearchKeyword()
|
||||
pNew->setArticleSelect(pCurrent->getArticleSelect());
|
||||
pNew->SetHeaderList(&m_vecColumn,E_COLUMN_NAME);
|
||||
int nCurrentFilterGroupID = D_NOT_SELECT;
|
||||
foreach (QListWidgetItem *item,m_plwFilterGroup->selectedItems())
|
||||
|
||||
QString strKey = m_pleString->text().replace("\r\n"," ");
|
||||
|
||||
strKey = strKey.replace("\n"," ");
|
||||
strKey = strKey.replace("\t"," ");
|
||||
|
||||
QString strTemp;
|
||||
foreach(QString str, strKey.split(" "))
|
||||
{
|
||||
nCurrentFilterGroupID = item->data(Qt::UserRole).toInt();
|
||||
InsertSearchFilter(pNew->getArticleSelect(),m_pcbCatalog->currentIndex(),m_pcbMethod->currentIndex(),m_pcbKeyword->currentIndex(),m_pleString->text(),nCurrentFilterGroupID);
|
||||
if (str.trimmed().isEmpty() == false)
|
||||
strTemp += str.trimmed() + " ";
|
||||
}
|
||||
|
||||
QStringList strListKeyword = m_pleString->text().split(" ");
|
||||
strTemp = strTemp.trimmed();
|
||||
m_pleString->setText(strTemp);
|
||||
strKey = strTemp;
|
||||
|
||||
if (m_pgbFilter->isChecked())
|
||||
{
|
||||
foreach (QListWidgetItem *item,m_plwFilterGroup->selectedItems())
|
||||
{
|
||||
nCurrentFilterGroupID = item->data(Qt::UserRole).toInt();
|
||||
InsertSearchFilter(pNew->getArticleSelect(),m_pcbCatalog->currentIndex(),m_pcbMethod->currentIndex(),m_pcbKeyword->currentIndex(),strKey,nCurrentFilterGroupID);
|
||||
}
|
||||
}
|
||||
|
||||
QStringList strListKeyword = strKey.split(" ");
|
||||
if (m_pcbMethod->currentIndex() == 1)
|
||||
{
|
||||
for (int i = 0 ; i < strListKeyword.size(); i++ )
|
||||
{
|
||||
{
|
||||
strListKeyword[i] = " " + strListKeyword[i] + " ";
|
||||
}
|
||||
}
|
||||
@@ -498,7 +526,8 @@ void Widget::SearchKeyword()
|
||||
m_pProgress->setValue(nCount);
|
||||
m_pProgress->repaint();
|
||||
}
|
||||
m_ptwData->addTab(pNew,m_ptwData->tabText(m_ptwData->currentIndex())+" k");
|
||||
//m_ptwData->addTab(pNew,m_ptwData->tabText(m_ptwData->currentIndex())+" k");
|
||||
m_ptwData->addTab(pNew,STable::GetArticleType(pCurrent->getArticleSelect()));
|
||||
m_ptwData->setCurrentIndex(m_ptwData->count()-1);
|
||||
|
||||
if (nCurrentFilterGroupID != D_NOT_SELECT)
|
||||
@@ -518,10 +547,14 @@ void Widget::SearchLengthInsert()
|
||||
int nLength = m_pleLength->text().toInt();
|
||||
|
||||
int nCurrentFilterGroupID = D_NOT_SELECT;
|
||||
foreach (QListWidgetItem *item,m_plwFilterGroup->selectedItems())
|
||||
|
||||
if (m_pgbFilter->isChecked())
|
||||
{
|
||||
nCurrentFilterGroupID = item->data(Qt::UserRole).toInt();
|
||||
InsertLengthFilter(pCurrent->getArticleSelect(),nCatalog,nComp,nFlag,m_pleLength->text(),nCurrentFilterGroupID);
|
||||
foreach (QListWidgetItem *item,m_plwFilterGroup->selectedItems())
|
||||
{
|
||||
nCurrentFilterGroupID = item->data(Qt::UserRole).toInt();
|
||||
InsertLengthFilter(pCurrent->getArticleSelect(),nCatalog,nComp,nFlag,m_pleLength->text(),nCurrentFilterGroupID);
|
||||
}
|
||||
}
|
||||
|
||||
for (int nCount = 0 ; nCount < pCurrent->rowCount(); nCount++ )
|
||||
@@ -548,7 +581,8 @@ void Widget::SearchLengthInsert()
|
||||
m_pProgress->setValue(nCount);
|
||||
m_pProgress->repaint();
|
||||
}
|
||||
m_ptwData->addTab(pNew,m_ptwData->tabText(m_ptwData->currentIndex())+" c");
|
||||
//m_ptwData->addTab(pNew,m_ptwData->tabText(m_ptwData->currentIndex())+" c");
|
||||
m_ptwData->addTab(pNew,STable::GetArticleType(pCurrent->getArticleSelect()));
|
||||
m_ptwData->setCurrentIndex(m_ptwData->count()-1);
|
||||
if (nCurrentFilterGroupID != D_NOT_SELECT)
|
||||
RefreshFilter(nCurrentFilterGroupID);
|
||||
@@ -571,15 +605,18 @@ void Widget::SearchReplaceInsert()
|
||||
strListKeyword = m_pleReplaceFind->text().split(" ");
|
||||
}
|
||||
int nCurrentFilterGroupID = D_NOT_SELECT;
|
||||
foreach (QListWidgetItem *item,m_plwFilterGroup->selectedItems())
|
||||
{
|
||||
nCurrentFilterGroupID = item->data(Qt::UserRole).toInt();
|
||||
InsertReplaceFilter(pNew->getArticleSelect(),nCatalog,
|
||||
m_pcbReplaceFind->currentData().toInt(),
|
||||
m_pleReplaceFind->text(),m_pleReplace->text(),
|
||||
nCurrentFilterGroupID);
|
||||
}
|
||||
|
||||
if (m_pgbFilter->isChecked())
|
||||
{
|
||||
foreach (QListWidgetItem *item,m_plwFilterGroup->selectedItems())
|
||||
{
|
||||
nCurrentFilterGroupID = item->data(Qt::UserRole).toInt();
|
||||
InsertReplaceFilter(pNew->getArticleSelect(),nCatalog,
|
||||
m_pcbReplaceFind->currentData().toInt(),
|
||||
m_pleReplaceFind->text(),m_pleReplace->text(),
|
||||
nCurrentFilterGroupID);
|
||||
}
|
||||
}
|
||||
pNew->setRowCount(pCurrent->rowCount());
|
||||
for (int nCount = 0 ; nCount < pCurrent->rowCount(); nCount++ )
|
||||
{
|
||||
@@ -604,7 +641,8 @@ void Widget::SearchReplaceInsert()
|
||||
m_pProgress->setValue(nCount);
|
||||
m_pProgress->repaint();
|
||||
}
|
||||
m_ptwData->addTab(pNew,m_ptwData->tabText(m_ptwData->currentIndex())+" r");
|
||||
//m_ptwData->addTab(pNew,m_ptwData->tabText(m_ptwData->currentIndex())+" r");
|
||||
m_ptwData->addTab(pNew,STable::GetArticleType(pCurrent->getArticleSelect()));
|
||||
m_ptwData->setCurrentIndex(m_ptwData->count()-1);
|
||||
|
||||
if (nCurrentFilterGroupID != D_NOT_SELECT)
|
||||
@@ -626,7 +664,7 @@ void Widget::DataGroupItemChanged( QListWidgetItem *item)
|
||||
}
|
||||
|
||||
void Widget::DataReload(QString _strTableName,int _nSelect)
|
||||
{
|
||||
{
|
||||
QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
|
||||
db.setHostName("bigbird.iptime.org");
|
||||
db.setUserName("admin");
|
||||
@@ -669,7 +707,7 @@ void Widget::DataReload(QString _strTableName,int _nSelect)
|
||||
m_pProgress->setValue(nCount);
|
||||
m_pProgress->repaint();
|
||||
}
|
||||
db.close();
|
||||
db.close();
|
||||
}
|
||||
|
||||
void Widget::FilterGroupInsert()
|
||||
@@ -825,7 +863,6 @@ void Widget::InsertReplaceFilter(int _nArticle,int _nCategory,int _nFind,QString
|
||||
InsertFilter(E_FILTER_TYPE_REPLACE,json.Sql(strJson),_nGroup);
|
||||
}
|
||||
|
||||
|
||||
void Widget::RefreshFilter(int _nGroup)
|
||||
{
|
||||
QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
|
||||
@@ -846,30 +883,31 @@ void Widget::RefreshFilter(int _nGroup)
|
||||
{
|
||||
QString str;
|
||||
QString strJson = query.value(2).toString();
|
||||
str = STable::GetArticleType(json.Get(strJson,"Article").toInt());
|
||||
switch(query.value(1).toInt())
|
||||
{
|
||||
case E_FILTER_TYPE_DATE:
|
||||
str = "<Date> Start : ";
|
||||
str += "<Date> Start : ";
|
||||
str += json.Get(strJson,"Start");
|
||||
str += " End : ";
|
||||
str += json.Get(strJson,"End");
|
||||
break;
|
||||
case E_FILTER_TYPE_SEARCH:
|
||||
str = "<Search> ";
|
||||
str += "<Search> ";
|
||||
str += m_pcbCatalog->itemText(json.GetNumber(strJson,"Category")) + " , ";
|
||||
str += m_pcbMethod->itemText(json.GetNumber(strJson,"Method")) + " , ";
|
||||
str += m_pcbKeyword->itemText(json.GetNumber(strJson,"Keyword")) + " , ";
|
||||
str += json.Get(strJson,"String");
|
||||
break;
|
||||
case E_FILTER_TYPE_LENGTH:
|
||||
str = "<Length> ";
|
||||
str += "<Length> ";
|
||||
str += m_pcbLengthCatalog->itemText(json.GetNumber(strJson,"Category")) + " ";
|
||||
str += m_pcbLengthComp->itemText(json.GetNumber(strJson,"Comp")) + " ";
|
||||
str += json.Get(strJson,"String") + " , ";
|
||||
str += m_pcbLengthInsDel->itemText(json.GetNumber(strJson,"InsDel"));
|
||||
break;
|
||||
case E_FILTER_TYPE_REPLACE:
|
||||
str = "<Replace> ";
|
||||
str += "<Replace> ";
|
||||
str += m_pcbReplaceCatalog->itemText(json.GetNumber(strJson,"Category")) + " , ";
|
||||
str += m_pcbReplaceFind->itemText(json.GetNumber(strJson,"Find")) + " ";
|
||||
str += json.Get(strJson,"String_Find") + " --> ";
|
||||
@@ -1052,7 +1090,7 @@ void Widget::FileImport()
|
||||
}
|
||||
pNew->setRowCount(pNew->rowCount()-1);
|
||||
file.close();
|
||||
m_ptwData->addTab(pNew," i");
|
||||
m_ptwData->addTab(pNew,"import");
|
||||
m_ptwData->setCurrentIndex(m_ptwData->count()-1);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <QTableWidget>
|
||||
#include <QProgressBar>
|
||||
#include <QMenuBar>
|
||||
#include <QSqlDatabase>
|
||||
#include "stable.h"
|
||||
|
||||
class Widget : public QWidget
|
||||
@@ -62,7 +63,8 @@ private:
|
||||
// Filter
|
||||
QListWidget *m_plwFilterGroup;
|
||||
QListWidget *m_plwFilter;
|
||||
QLineEdit *m_pleFilterGroup;
|
||||
QLineEdit *m_pleFilterGroup;
|
||||
QGroupBox *m_pgbFilter;
|
||||
// Replace
|
||||
QComboBox *m_pcbReplaceCatalog;
|
||||
QComboBox *m_pcbReplaceFind;
|
||||
@@ -77,7 +79,7 @@ private:
|
||||
//
|
||||
QProgressBar *m_pProgress;
|
||||
// Column
|
||||
QVector <QStringList> m_vecColumn;
|
||||
QVector <QStringList> m_vecColumn;
|
||||
private:
|
||||
QMenuBar *setMenuWidget();
|
||||
QGroupBox *setDataWidgets();
|
||||
@@ -100,6 +102,7 @@ private:
|
||||
void RefreshFilter(int _nGroup);
|
||||
|
||||
bool ReloadColumn();
|
||||
QString GetArticleType(int _nSelect);
|
||||
public slots:
|
||||
void CloseTab(int index);
|
||||
void DoubleClickTab(int index);
|
||||
|
||||
Reference in New Issue
Block a user