From 9d04a7e128d2f234e7cb981e4a17299c5f9f00f5 Mon Sep 17 00:00:00 2001 From: admin Date: Fri, 8 Jul 2016 08:20:08 +0000 Subject: [PATCH] =?UTF-8?q?=ED=95=84=ED=84=B0=20=EC=97=85=EB=8D=B0?= =?UTF-8?q?=EC=9D=B4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 애널저 숫자 정렬 추가 git-svn-id: svn://192.168.0.12/source@280 8346c931-da38-4b9b-9d4c-e48b93cbd075 --- Analyzer/mainwindow.cpp | 3 ++- Analyzer/sbatchrun.cpp | 8 ++++---- Analyzer/scountdlg.cpp | 8 ++++---- Analyzer/sdatadlg.cpp | 14 ++++++++------ Analyzer/stable.cpp | 10 +++++----- Analyzer/stable.h | 25 +++++++++++++++++++++++++ Filter/widget.cpp | 2 ++ MorphereAnalyzer/sbatchrun.cpp | 8 ++++---- MorphereAnalyzer/scountdlg.cpp | 9 +++++---- MorphereAnalyzer/sdatadlg.cpp | 14 ++++++++------ MorphereAnalyzer/stable.cpp | 10 +++++----- MorphereAnalyzer/stable.h | 25 +++++++++++++++++++++++++ sfilterprocess/sfilterprocess.pro.user | 4 ++-- 13 files changed, 99 insertions(+), 41 deletions(-) diff --git a/Analyzer/mainwindow.cpp b/Analyzer/mainwindow.cpp index b0443b5..8b57087 100644 --- a/Analyzer/mainwindow.cpp +++ b/Analyzer/mainwindow.cpp @@ -4,6 +4,7 @@ #include #include #include +#include "stable.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { @@ -141,7 +142,7 @@ void MainWindow::FileNew() { for(int j = 0; j < column.size(); j++) { - pTable->setItem(i, j, new QTableWidgetItem(QString(" "))); + pTable->setItem(i, j, new STableWidgetItem(QString(" "))); } } } diff --git a/Analyzer/sbatchrun.cpp b/Analyzer/sbatchrun.cpp index 2a31f13..3e9a2d1 100644 --- a/Analyzer/sbatchrun.cpp +++ b/Analyzer/sbatchrun.cpp @@ -251,7 +251,7 @@ void SBatchRun::ViewResult() for (int k = 0; k < pTable->columnCount() ; k++) { QString str = m_vecData[i][j][k].replace("\n"," "); - pTable->setItem(nCount,k,new QTableWidgetItem(" "+str.replace("\t"," ")+" ")); + pTable->setItem(nCount,k,new STableWidgetItem(" "+str.replace("\t"," ")+" ")); } nCount++; GetMainWindow()->m_progress.setValue(nCount); @@ -319,7 +319,7 @@ void SBatchRun::ViewRawResult() for (int k = 0; k < pTable->columnCount() ; k++) { QString str = m_vecData[i][j][k].replace("\n"," "); - pTable->setItem(nCount,k,new QTableWidgetItem(" "+str.replace("\t"," ")+" ")); + pTable->setItem(nCount,k,new STableWidgetItem(" "+str.replace("\t"," ")+" ")); } nCount++; GetMainWindow()->m_progress.setValue(nCount); @@ -503,13 +503,13 @@ bool SBatchRun::loadData() for(int j = 0; j < GetColumn().data().size(); j++) //strList << " " + query.value(j).toString() + " "; strList.append(query.value(j).toString()); - + /* if(strList[m_anData[E_DATA_platform_form]].trimmed() == "post" || strList[m_anData[E_DATA_platform_form]].trimmed() == "story" || strList[m_anData[E_DATA_platform_form]].trimmed() == "channel") strList[m_anData[E_DATA_platform_form]] = "sns"; if(strList[m_anData[E_DATA_platform_form]].trimmed() == "group") strList[m_anData[E_DATA_platform_form]] = "community"; - + */ if(i == E_ARTICLE_BODY) { diff --git a/Analyzer/scountdlg.cpp b/Analyzer/scountdlg.cpp index 9ad6edd..b2eb1e1 100644 --- a/Analyzer/scountdlg.cpp +++ b/Analyzer/scountdlg.cpp @@ -104,7 +104,7 @@ void SCountDlg::choose_1() { int nCol = 0; QString str = now.toString("yyyy-MM-dd").trimmed(); - m_pTable->setItem(nCount,nCol++,new QTableWidgetItem(str)); + m_pTable->setItem(nCount,nCol++,new STableWidgetItem(str)); if (mapCount.contains(now)) m_pTable->setItem(nCount,nCol,new STableNumberItem(QString::number(mapCount[now]))); else @@ -131,7 +131,7 @@ void SCountDlg::choose_1() for (QMap ::iterator i = mapCount.begin(); i != mapCount.end(); ++i) { int nCol = 0; - m_pTable->setItem(nCount,nCol++,new QTableWidgetItem(i.key())); + m_pTable->setItem(nCount,nCol++,new STableWidgetItem(i.key())); m_pTable->setItem(nCount,nCol++,new STableNumberItem(QString::number(i.value()))); nCount++; } @@ -200,7 +200,7 @@ void SCountDlg::choose_2() { int nCol = 0; QString str = now.toString("yyyy-MM-dd").trimmed(); - m_pTable->setItem(nCount,nCol++,new QTableWidgetItem(str)); + m_pTable->setItem(nCount,nCol++,new STableWidgetItem(str)); if (mapCount.contains(str)) { for (QSet::iterator j = setList.begin(); j != setList.end(); ++j) @@ -225,7 +225,7 @@ void SCountDlg::choose_2() for (QMap >::iterator i = mapCount.begin(); i != mapCount.end(); ++i) { int nCol = 0; - m_pTable->setItem(nCount,nCol++,new QTableWidgetItem(i.key())); + m_pTable->setItem(nCount,nCol++,new STableWidgetItem(i.key())); for (QSet::iterator j = setList.begin(); j != setList.end(); ++j) { if (i->contains(*j)) diff --git a/Analyzer/sdatadlg.cpp b/Analyzer/sdatadlg.cpp index e97b3ea..c66a726 100644 --- a/Analyzer/sdatadlg.cpp +++ b/Analyzer/sdatadlg.cpp @@ -86,11 +86,13 @@ void SDataDlg::DataReload(QString _strTableName,int _nSelect) for (int i = 0; i < pTable->columnCount() ; i++) { QString str = query.value(i).toString().replace("\n"," "); + /* if((i == GetColumn().getColumnIndex("platform_form")) && (str.trimmed() == "post" || str.trimmed() == "channel" || str.trimmed() == "story")) str = "sns"; if((i == GetColumn().getColumnIndex("platform_form")) && (str.trimmed() == "group")) str = "community"; - pTable->setItem(nCount,i,new QTableWidgetItem(" "+str.replace("\t"," ")+" ")); + */ + pTable->setItem(nCount,i,new STableWidgetItem(" "+str.replace("\t"," ")+" ")); } nCount++; GetMainWindow()->m_progress.setValue(nCount); @@ -102,7 +104,7 @@ void SDataDlg::InsertCopyRow(int _nRow,QTableWidget *_pCurrent,QTableWidget *_pN { _pNew->setRowCount(_pNew->rowCount()+1); for (int nCount = 0;nCount < _pCurrent->columnCount() ;nCount++ ) - _pNew->setItem(_pNew->rowCount()-1,nCount,new QTableWidgetItem(*_pCurrent->item(_nRow,nCount))); + _pNew->setItem(_pNew->rowCount()-1,nCount,new STableWidgetItem(*_pCurrent->item(_nRow,nCount))); } void SDataDlg::SearchDate(QDate _dtStart,QDate _dtEnd) @@ -327,10 +329,10 @@ void SDataDlg::SearchReplace(int _nCatalogIndex,int _nReplaceFindIndex,int _nRep strOut = strMiddle; break; } - pNew->setItem(nCount,nColumnCount,new QTableWidgetItem(strOut)); + pNew->setItem(nCount,nColumnCount,new STableWidgetItem(strOut)); } else - pNew->setItem(nCount,nColumnCount,new QTableWidgetItem(*pCurrent->item(nCount,nColumnCount))); + pNew->setItem(nCount,nColumnCount,new STableWidgetItem(*pCurrent->item(nCount,nColumnCount))); } GetMainWindow()->m_progress.setValue(nCount); GetMainWindow()->m_progress.repaint(); @@ -432,7 +434,7 @@ void SDataDlg::Import(QVector _vecImport ) if(column.at(j).at(SColumn::E_DATABASE).compare(strings.at(i)) == 0) strings[i] = column.at(j).at(SColumn::E_NAME); } - pNew->setHorizontalHeaderItem(i-1,new QTableWidgetItem(strings.at(i))); + pNew->setHorizontalHeaderItem(i-1,new STableWidgetItem(strings.at(i))); } bFirst = false; pNew->setRowCount(_vecImport.size()-1); @@ -446,7 +448,7 @@ void SDataDlg::Import(QVector _vecImport ) QStringList strings = strLine.split(","); int ncCol=0; foreach(QString str,strings) - pNew->setItem(ncRow,ncCol++,new QTableWidgetItem(QString(" " + str + " "))); + pNew->setItem(ncRow,ncCol++,new STableWidgetItem(QString(" " + str + " "))); GetMainWindow()->m_progress.setValue(ncRow++); GetMainWindow()->m_progress.repaint(); } diff --git a/Analyzer/stable.cpp b/Analyzer/stable.cpp index 0f85435..3165a37 100644 --- a/Analyzer/stable.cpp +++ b/Analyzer/stable.cpp @@ -22,7 +22,7 @@ void STable::SetHeaderList(QVector * _pvecHead,int _nColumn) setColumnCount(_pvecHead->size()); int i = 0; foreach(QStringList strList, *_pvecHead ) - setHorizontalHeaderItem(i++,new QTableWidgetItem(strList.at(_nColumn))); + setHorizontalHeaderItem(i++,new STableWidgetItem(strList.at(_nColumn))); } void STable::SetHeaderList(QStringList _Head) @@ -30,7 +30,7 @@ void STable::SetHeaderList(QStringList _Head) setColumnCount(_Head.size()); int i = 0; foreach(QString str,_Head ) - setHorizontalHeaderItem(i++,new QTableWidgetItem(str)); + setHorizontalHeaderItem(i++,new STableWidgetItem(str)); } @@ -50,7 +50,7 @@ void STable::menuInsert() int nRow = currentRow(); insertRow(nRow); for (int i = 0; i < columnCount() ; i++) - setItem(nRow,i,new QTableWidgetItem(" ")); + setItem(nRow,i,new STableWidgetItem(" ")); } @@ -132,7 +132,7 @@ void STable::Paste() { for(int j = 0; j < columnCount(); j++) { - setItem(i, j, new QTableWidgetItem(QString(" "))); + setItem(i, j, new STableWidgetItem(QString(" "))); } } } @@ -147,7 +147,7 @@ void STable::Paste() if (nCol >= columnCount()) continue; QTableWidgetItem *pItem; if (nRows >= nRows) - pItem = new QTableWidgetItem; + pItem = new STableWidgetItem; else pItem = item(nRow,nCol); pItem->setText(" "+strCol.trimmed()+" "); diff --git a/Analyzer/stable.h b/Analyzer/stable.h index c552ebe..c42a51c 100644 --- a/Analyzer/stable.h +++ b/Analyzer/stable.h @@ -23,6 +23,31 @@ public: } }; + +class STableWidgetItem : public QTableWidgetItem +{ +public: + STableWidgetItem(int type=Type):QTableWidgetItem(type){} + STableWidgetItem(const QString& text, int type=Type):QTableWidgetItem(text, type){} + STableWidgetItem(const QIcon& icon, const QString& text, int type = Type):QTableWidgetItem(icon, text, type){} + STableWidgetItem(const QTableWidgetItem& other):QTableWidgetItem(other){} + + bool operator <(const QTableWidgetItem &other) const + { + bool tok = false; + bool ook = false; + int nThis = text().toInt(&tok); + int nOther = other.text().toInt(&ook); + + if (!(tok && ook)) + return text() < other.text(); + else + return nThis < nOther; + } +}; + + + class STable : public QTableWidget { Q_OBJECT diff --git a/Filter/widget.cpp b/Filter/widget.cpp index 69ae2b5..fda5cf6 100644 --- a/Filter/widget.cpp +++ b/Filter/widget.cpp @@ -333,8 +333,10 @@ void Widget::CompanyItemChanged(QListWidgetItem* _current,QListWidgetItem*) { case E_SERVICE_INFLUENCER: { + /* if (0 == nServiceCnt[E_SERVICE_INFLUENCER]++) continue; + */ strService = "[Influencer]"; break; } diff --git a/MorphereAnalyzer/sbatchrun.cpp b/MorphereAnalyzer/sbatchrun.cpp index 2a31f13..3e9a2d1 100644 --- a/MorphereAnalyzer/sbatchrun.cpp +++ b/MorphereAnalyzer/sbatchrun.cpp @@ -251,7 +251,7 @@ void SBatchRun::ViewResult() for (int k = 0; k < pTable->columnCount() ; k++) { QString str = m_vecData[i][j][k].replace("\n"," "); - pTable->setItem(nCount,k,new QTableWidgetItem(" "+str.replace("\t"," ")+" ")); + pTable->setItem(nCount,k,new STableWidgetItem(" "+str.replace("\t"," ")+" ")); } nCount++; GetMainWindow()->m_progress.setValue(nCount); @@ -319,7 +319,7 @@ void SBatchRun::ViewRawResult() for (int k = 0; k < pTable->columnCount() ; k++) { QString str = m_vecData[i][j][k].replace("\n"," "); - pTable->setItem(nCount,k,new QTableWidgetItem(" "+str.replace("\t"," ")+" ")); + pTable->setItem(nCount,k,new STableWidgetItem(" "+str.replace("\t"," ")+" ")); } nCount++; GetMainWindow()->m_progress.setValue(nCount); @@ -503,13 +503,13 @@ bool SBatchRun::loadData() for(int j = 0; j < GetColumn().data().size(); j++) //strList << " " + query.value(j).toString() + " "; strList.append(query.value(j).toString()); - + /* if(strList[m_anData[E_DATA_platform_form]].trimmed() == "post" || strList[m_anData[E_DATA_platform_form]].trimmed() == "story" || strList[m_anData[E_DATA_platform_form]].trimmed() == "channel") strList[m_anData[E_DATA_platform_form]] = "sns"; if(strList[m_anData[E_DATA_platform_form]].trimmed() == "group") strList[m_anData[E_DATA_platform_form]] = "community"; - + */ if(i == E_ARTICLE_BODY) { diff --git a/MorphereAnalyzer/scountdlg.cpp b/MorphereAnalyzer/scountdlg.cpp index e777438..b2eb1e1 100644 --- a/MorphereAnalyzer/scountdlg.cpp +++ b/MorphereAnalyzer/scountdlg.cpp @@ -75,6 +75,7 @@ void SCountDlg::choose_1() } } if (nCatalog == D_NOT_SELECT) return; + m_pTable->clear(); m_pTable->SetHeaderList(QStringList() << GetColumn().data().at(nCatalog).at(SColumn::E_NAME) << "Count"); QTableWidget *pCurrent = (QTableWidget *)GetMainWindow()->m_pDataDlg->GetCurrentWidget(); GetMainWindow()->m_progress.setRange(0,pCurrent->rowCount()); @@ -103,7 +104,7 @@ void SCountDlg::choose_1() { int nCol = 0; QString str = now.toString("yyyy-MM-dd").trimmed(); - m_pTable->setItem(nCount,nCol++,new QTableWidgetItem(str)); + m_pTable->setItem(nCount,nCol++,new STableWidgetItem(str)); if (mapCount.contains(now)) m_pTable->setItem(nCount,nCol,new STableNumberItem(QString::number(mapCount[now]))); else @@ -130,7 +131,7 @@ void SCountDlg::choose_1() for (QMap ::iterator i = mapCount.begin(); i != mapCount.end(); ++i) { int nCol = 0; - m_pTable->setItem(nCount,nCol++,new QTableWidgetItem(i.key())); + m_pTable->setItem(nCount,nCol++,new STableWidgetItem(i.key())); m_pTable->setItem(nCount,nCol++,new STableNumberItem(QString::number(i.value()))); nCount++; } @@ -199,7 +200,7 @@ void SCountDlg::choose_2() { int nCol = 0; QString str = now.toString("yyyy-MM-dd").trimmed(); - m_pTable->setItem(nCount,nCol++,new QTableWidgetItem(str)); + m_pTable->setItem(nCount,nCol++,new STableWidgetItem(str)); if (mapCount.contains(str)) { for (QSet::iterator j = setList.begin(); j != setList.end(); ++j) @@ -224,7 +225,7 @@ void SCountDlg::choose_2() for (QMap >::iterator i = mapCount.begin(); i != mapCount.end(); ++i) { int nCol = 0; - m_pTable->setItem(nCount,nCol++,new QTableWidgetItem(i.key())); + m_pTable->setItem(nCount,nCol++,new STableWidgetItem(i.key())); for (QSet::iterator j = setList.begin(); j != setList.end(); ++j) { if (i->contains(*j)) diff --git a/MorphereAnalyzer/sdatadlg.cpp b/MorphereAnalyzer/sdatadlg.cpp index e97b3ea..c66a726 100644 --- a/MorphereAnalyzer/sdatadlg.cpp +++ b/MorphereAnalyzer/sdatadlg.cpp @@ -86,11 +86,13 @@ void SDataDlg::DataReload(QString _strTableName,int _nSelect) for (int i = 0; i < pTable->columnCount() ; i++) { QString str = query.value(i).toString().replace("\n"," "); + /* if((i == GetColumn().getColumnIndex("platform_form")) && (str.trimmed() == "post" || str.trimmed() == "channel" || str.trimmed() == "story")) str = "sns"; if((i == GetColumn().getColumnIndex("platform_form")) && (str.trimmed() == "group")) str = "community"; - pTable->setItem(nCount,i,new QTableWidgetItem(" "+str.replace("\t"," ")+" ")); + */ + pTable->setItem(nCount,i,new STableWidgetItem(" "+str.replace("\t"," ")+" ")); } nCount++; GetMainWindow()->m_progress.setValue(nCount); @@ -102,7 +104,7 @@ void SDataDlg::InsertCopyRow(int _nRow,QTableWidget *_pCurrent,QTableWidget *_pN { _pNew->setRowCount(_pNew->rowCount()+1); for (int nCount = 0;nCount < _pCurrent->columnCount() ;nCount++ ) - _pNew->setItem(_pNew->rowCount()-1,nCount,new QTableWidgetItem(*_pCurrent->item(_nRow,nCount))); + _pNew->setItem(_pNew->rowCount()-1,nCount,new STableWidgetItem(*_pCurrent->item(_nRow,nCount))); } void SDataDlg::SearchDate(QDate _dtStart,QDate _dtEnd) @@ -327,10 +329,10 @@ void SDataDlg::SearchReplace(int _nCatalogIndex,int _nReplaceFindIndex,int _nRep strOut = strMiddle; break; } - pNew->setItem(nCount,nColumnCount,new QTableWidgetItem(strOut)); + pNew->setItem(nCount,nColumnCount,new STableWidgetItem(strOut)); } else - pNew->setItem(nCount,nColumnCount,new QTableWidgetItem(*pCurrent->item(nCount,nColumnCount))); + pNew->setItem(nCount,nColumnCount,new STableWidgetItem(*pCurrent->item(nCount,nColumnCount))); } GetMainWindow()->m_progress.setValue(nCount); GetMainWindow()->m_progress.repaint(); @@ -432,7 +434,7 @@ void SDataDlg::Import(QVector _vecImport ) if(column.at(j).at(SColumn::E_DATABASE).compare(strings.at(i)) == 0) strings[i] = column.at(j).at(SColumn::E_NAME); } - pNew->setHorizontalHeaderItem(i-1,new QTableWidgetItem(strings.at(i))); + pNew->setHorizontalHeaderItem(i-1,new STableWidgetItem(strings.at(i))); } bFirst = false; pNew->setRowCount(_vecImport.size()-1); @@ -446,7 +448,7 @@ void SDataDlg::Import(QVector _vecImport ) QStringList strings = strLine.split(","); int ncCol=0; foreach(QString str,strings) - pNew->setItem(ncRow,ncCol++,new QTableWidgetItem(QString(" " + str + " "))); + pNew->setItem(ncRow,ncCol++,new STableWidgetItem(QString(" " + str + " "))); GetMainWindow()->m_progress.setValue(ncRow++); GetMainWindow()->m_progress.repaint(); } diff --git a/MorphereAnalyzer/stable.cpp b/MorphereAnalyzer/stable.cpp index 0f85435..3165a37 100644 --- a/MorphereAnalyzer/stable.cpp +++ b/MorphereAnalyzer/stable.cpp @@ -22,7 +22,7 @@ void STable::SetHeaderList(QVector * _pvecHead,int _nColumn) setColumnCount(_pvecHead->size()); int i = 0; foreach(QStringList strList, *_pvecHead ) - setHorizontalHeaderItem(i++,new QTableWidgetItem(strList.at(_nColumn))); + setHorizontalHeaderItem(i++,new STableWidgetItem(strList.at(_nColumn))); } void STable::SetHeaderList(QStringList _Head) @@ -30,7 +30,7 @@ void STable::SetHeaderList(QStringList _Head) setColumnCount(_Head.size()); int i = 0; foreach(QString str,_Head ) - setHorizontalHeaderItem(i++,new QTableWidgetItem(str)); + setHorizontalHeaderItem(i++,new STableWidgetItem(str)); } @@ -50,7 +50,7 @@ void STable::menuInsert() int nRow = currentRow(); insertRow(nRow); for (int i = 0; i < columnCount() ; i++) - setItem(nRow,i,new QTableWidgetItem(" ")); + setItem(nRow,i,new STableWidgetItem(" ")); } @@ -132,7 +132,7 @@ void STable::Paste() { for(int j = 0; j < columnCount(); j++) { - setItem(i, j, new QTableWidgetItem(QString(" "))); + setItem(i, j, new STableWidgetItem(QString(" "))); } } } @@ -147,7 +147,7 @@ void STable::Paste() if (nCol >= columnCount()) continue; QTableWidgetItem *pItem; if (nRows >= nRows) - pItem = new QTableWidgetItem; + pItem = new STableWidgetItem; else pItem = item(nRow,nCol); pItem->setText(" "+strCol.trimmed()+" "); diff --git a/MorphereAnalyzer/stable.h b/MorphereAnalyzer/stable.h index c552ebe..c42a51c 100644 --- a/MorphereAnalyzer/stable.h +++ b/MorphereAnalyzer/stable.h @@ -23,6 +23,31 @@ public: } }; + +class STableWidgetItem : public QTableWidgetItem +{ +public: + STableWidgetItem(int type=Type):QTableWidgetItem(type){} + STableWidgetItem(const QString& text, int type=Type):QTableWidgetItem(text, type){} + STableWidgetItem(const QIcon& icon, const QString& text, int type = Type):QTableWidgetItem(icon, text, type){} + STableWidgetItem(const QTableWidgetItem& other):QTableWidgetItem(other){} + + bool operator <(const QTableWidgetItem &other) const + { + bool tok = false; + bool ook = false; + int nThis = text().toInt(&tok); + int nOther = other.text().toInt(&ook); + + if (!(tok && ook)) + return text() < other.text(); + else + return nThis < nOther; + } +}; + + + class STable : public QTableWidget { Q_OBJECT diff --git a/sfilterprocess/sfilterprocess.pro.user b/sfilterprocess/sfilterprocess.pro.user index 6a71ade..8c19990 100644 --- a/sfilterprocess/sfilterprocess.pro.user +++ b/sfilterprocess/sfilterprocess.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -787,7 +787,7 @@ sfilterprocess Qt4ProjectManager.Qt4RunConfiguration:C:/source/sfilterprocess/sfilterprocess.pro - "510" "testall" + "514" "testall" sfilterprocess.pro false true