기능 추가
git-svn-id: svn://192.168.0.12/source@97 8346c931-da38-4b9b-9d4c-e48b93cbd075
This commit is contained in:
@@ -173,7 +173,11 @@ QGroupBox *Widget::setDateWidgets()
|
||||
{
|
||||
QPushButton *pbInsert = new QPushButton("Insert");
|
||||
connect(pbInsert , SIGNAL(released()),this, SLOT(SearchDate()));
|
||||
QPushButton *pbModify = new QPushButton("Modify");
|
||||
connect(pbModify , SIGNAL(released()),this, SLOT(SearchDateUpdate()));
|
||||
|
||||
hlayout->addWidget(pbInsert);
|
||||
hlayout->addWidget(pbModify);
|
||||
}
|
||||
|
||||
hlayout->setAlignment(Qt::AlignLeft|Qt::AlignTop);
|
||||
@@ -246,9 +250,15 @@ QGroupBox *Widget::setSearchWidgets()
|
||||
hlayout->addLayout(vlayout);
|
||||
|
||||
{
|
||||
QVBoxLayout *vsublayout = new QVBoxLayout();
|
||||
QPushButton *pbInsert = new QPushButton("Insert");
|
||||
hlayout->addWidget(pbInsert);
|
||||
vsublayout->addWidget(pbInsert);
|
||||
connect(pbInsert, SIGNAL(released()),this, SLOT(SearchKeyword()));
|
||||
|
||||
QPushButton *pbModify = new QPushButton("Modify");
|
||||
connect(pbModify , SIGNAL(released()),this, SLOT(SearchKeywordUpdate()));
|
||||
vsublayout->addWidget(pbModify);
|
||||
hlayout->addLayout(vsublayout);
|
||||
}
|
||||
|
||||
QGroupBox *groupBox = new QGroupBox(tr("Search"));
|
||||
@@ -283,7 +293,10 @@ QGroupBox *Widget::setLengthWidgets()
|
||||
{
|
||||
QPushButton *pbInsert = new QPushButton("Insert");
|
||||
connect(pbInsert , SIGNAL(released()),this, SLOT(SearchLengthInsert()));
|
||||
QPushButton *pbModify = new QPushButton("Modify");
|
||||
connect(pbModify , SIGNAL(released()),this, SLOT(SearchLengthUpdate()));
|
||||
hlayout->addWidget(pbInsert);
|
||||
hlayout->addWidget(pbModify);
|
||||
}
|
||||
QGroupBox *groupBox = new QGroupBox(tr("Length"));
|
||||
groupBox->setLayout(hlayout);
|
||||
@@ -317,9 +330,14 @@ QGroupBox *Widget::setReplaceWidgets()
|
||||
hlayout->addWidget(m_pcbReplace);
|
||||
hlayout->addWidget(m_pleReplace);
|
||||
{
|
||||
QVBoxLayout *vlayout = new QVBoxLayout();
|
||||
QPushButton *pbInsert = new QPushButton("Insert");
|
||||
connect(pbInsert , SIGNAL(released()),this, SLOT(SearchReplaceInsert()));
|
||||
hlayout->addWidget(pbInsert);
|
||||
vlayout->addWidget(pbInsert);
|
||||
QPushButton *pbModify = new QPushButton("Modify");
|
||||
connect(pbModify , SIGNAL(released()),this, SLOT(SearchReplaceUpdate()));
|
||||
vlayout->addWidget(pbModify);
|
||||
hlayout->addLayout(vlayout);
|
||||
}
|
||||
QGroupBox *groupBox = new QGroupBox(tr("Replace"));
|
||||
groupBox->setLayout(hlayout);
|
||||
@@ -429,7 +447,7 @@ void Widget::SearchDate()
|
||||
foreach (QListWidgetItem *item,m_plwFilterGroup->selectedItems())
|
||||
{
|
||||
nCurrentFilterGroupID = item->data(Qt::UserRole).toInt();
|
||||
InsertTimeFilter(pNew->getArticleSelect(),m_pdeStart->date(),m_pdeEnd->date(),nCurrentFilterGroupID);
|
||||
DataBaseTimeFilter(pNew->getArticleSelect(),m_pdeStart->date(),m_pdeEnd->date(),nCurrentFilterGroupID,E_DATABASE_COMMAND_INSERT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -486,7 +504,7 @@ void Widget::SearchKeyword()
|
||||
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);
|
||||
DataBaseSearchFilter(pNew->getArticleSelect(),m_pcbCatalog->currentIndex(),m_pcbMethod->currentIndex(),m_pcbKeyword->currentIndex(),strKey,nCurrentFilterGroupID,E_DATABASE_COMMAND_INSERT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -569,7 +587,7 @@ void Widget::SearchLengthInsert()
|
||||
foreach (QListWidgetItem *item,m_plwFilterGroup->selectedItems())
|
||||
{
|
||||
nCurrentFilterGroupID = item->data(Qt::UserRole).toInt();
|
||||
InsertLengthFilter(pCurrent->getArticleSelect(),nCatalog,nComp,nFlag,m_pleLength->text(),nCurrentFilterGroupID);
|
||||
DataBaseLengthFilter(pCurrent->getArticleSelect(),nCatalog,nComp,nFlag,m_pleLength->text(),nCurrentFilterGroupID,E_DATABASE_COMMAND_INSERT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -625,10 +643,10 @@ void Widget::SearchReplaceInsert()
|
||||
foreach (QListWidgetItem *item,m_plwFilterGroup->selectedItems())
|
||||
{
|
||||
nCurrentFilterGroupID = item->data(Qt::UserRole).toInt();
|
||||
InsertReplaceFilter(pNew->getArticleSelect(),nCatalog,
|
||||
DataBaseReplaceFilter(pNew->getArticleSelect(),nCatalog,
|
||||
m_pcbReplaceFind->currentData().toInt(),
|
||||
m_pleReplaceFind->text(),m_pleReplace->text(),
|
||||
nCurrentFilterGroupID);
|
||||
nCurrentFilterGroupID,E_DATABASE_COMMAND_INSERT);
|
||||
}
|
||||
}
|
||||
pNew->setRowCount(pCurrent->rowCount());
|
||||
@@ -712,6 +730,94 @@ void Widget::SearchReplaceInsert()
|
||||
RefreshFilter(nCurrentFilterGroupID);
|
||||
}
|
||||
|
||||
void Widget::SearchDateUpdate()
|
||||
{
|
||||
if (m_pgbFilter->isChecked())
|
||||
{
|
||||
int nCurrentFilterGroupID = D_NOT_SELECT;
|
||||
foreach (QListWidgetItem *item,m_plwFilterGroup->selectedItems())
|
||||
nCurrentFilterGroupID = item->data(Qt::UserRole).toInt();
|
||||
|
||||
if (nCurrentFilterGroupID == D_NOT_SELECT) return;
|
||||
|
||||
foreach (QListWidgetItem *item,m_plwFilter->selectedItems())
|
||||
DataBaseTimeFilter(((STable *)m_ptwData->currentWidget())->getArticleSelect(),m_pdeStart->date(),m_pdeEnd->date(),nCurrentFilterGroupID,E_DATABASE_COMMAND_UPDATE,item->data(Qt::UserRole).toString());
|
||||
RefreshFilter(nCurrentFilterGroupID);
|
||||
}
|
||||
}
|
||||
|
||||
void Widget::SearchKeywordUpdate()
|
||||
{
|
||||
if (m_pgbFilter->isChecked())
|
||||
{
|
||||
int nCurrentFilterGroupID = D_NOT_SELECT;
|
||||
foreach (QListWidgetItem *item,m_plwFilterGroup->selectedItems())
|
||||
nCurrentFilterGroupID = item->data(Qt::UserRole).toInt();
|
||||
if (nCurrentFilterGroupID == D_NOT_SELECT) return;
|
||||
QString strKey = m_pleString->text().replace("\r\n"," ");
|
||||
strKey = strKey.replace("\n"," ");
|
||||
strKey = strKey.replace("\t"," ");
|
||||
QString strTemp;
|
||||
foreach(QString str, strKey.split(" "))
|
||||
{
|
||||
if (str.trimmed().isEmpty() == false)
|
||||
strTemp += str.trimmed() + " ";
|
||||
}
|
||||
strTemp = strTemp.trimmed();
|
||||
m_pleString->setText(strTemp);
|
||||
strKey = strTemp;
|
||||
foreach (QListWidgetItem *item,m_plwFilter->selectedItems())
|
||||
DataBaseSearchFilter(((STable *)m_ptwData->currentWidget())->getArticleSelect(),m_pcbCatalog->currentIndex(),m_pcbMethod->currentIndex(),m_pcbKeyword->currentIndex(),strKey,nCurrentFilterGroupID,E_DATABASE_COMMAND_UPDATE,item->data(Qt::UserRole).toString());
|
||||
RefreshFilter(nCurrentFilterGroupID);
|
||||
}
|
||||
}
|
||||
|
||||
void Widget::SearchLengthUpdate()
|
||||
{
|
||||
if (m_pgbFilter->isChecked())
|
||||
{
|
||||
int nCurrentFilterGroupID = D_NOT_SELECT;
|
||||
foreach (QListWidgetItem *item,m_plwFilterGroup->selectedItems())
|
||||
nCurrentFilterGroupID = item->data(Qt::UserRole).toInt();
|
||||
|
||||
if (nCurrentFilterGroupID == D_NOT_SELECT) return;
|
||||
|
||||
int nCatalog = m_pcbLengthCatalog->currentIndex();
|
||||
int nComp = m_pcbLengthComp->currentData().toInt();
|
||||
int nFlag = m_pcbLengthInsDel->currentData().toInt();
|
||||
foreach (QListWidgetItem *item,m_plwFilter->selectedItems())
|
||||
DataBaseLengthFilter(((STable *)m_ptwData->currentWidget())->getArticleSelect(),nCatalog,nComp,nFlag,m_pleLength->text(),nCurrentFilterGroupID,E_DATABASE_COMMAND_UPDATE,item->data(Qt::UserRole).toString());
|
||||
RefreshFilter(nCurrentFilterGroupID);
|
||||
}
|
||||
}
|
||||
|
||||
void Widget::SearchReplaceUpdate()
|
||||
{
|
||||
if (m_pgbFilter->isChecked())
|
||||
{
|
||||
int nCurrentFilterGroupID = D_NOT_SELECT;
|
||||
foreach (QListWidgetItem *item,m_plwFilterGroup->selectedItems())
|
||||
nCurrentFilterGroupID = item->data(Qt::UserRole).toInt();
|
||||
|
||||
if (nCurrentFilterGroupID == D_NOT_SELECT) return;
|
||||
|
||||
int nCatalog = m_pcbReplaceCatalog->currentIndex();
|
||||
QStringList strListKeyword;
|
||||
if (m_pcbReplaceFind->currentData().toInt() == E_REPLACE_SPACE)
|
||||
strListKeyword = m_pleReplaceFind->text().split(" ");
|
||||
else
|
||||
strListKeyword.push_back(m_pleReplaceFind->text());
|
||||
|
||||
foreach (QListWidgetItem *item,m_plwFilter->selectedItems())
|
||||
DataBaseReplaceFilter(((STable *)m_ptwData->currentWidget())->getArticleSelect(),nCatalog,
|
||||
m_pcbReplaceFind->currentData().toInt(),
|
||||
m_pleReplaceFind->text(),m_pleReplace->text(),
|
||||
nCurrentFilterGroupID,E_DATABASE_COMMAND_UPDATE,item->data(Qt::UserRole).toString());
|
||||
RefreshFilter(nCurrentFilterGroupID);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Widget::DataGroupItemChanged( QListWidgetItem *item)
|
||||
{
|
||||
QMessageBox msg;
|
||||
@@ -894,7 +1000,7 @@ void Widget::FilterGroupRefresh()
|
||||
db.close();
|
||||
}
|
||||
|
||||
void Widget::InsertFilter(int _nType,QString _strJson,int _nGroup)
|
||||
void Widget::DataBaseFilter(int _nType,QString _strJson,int _nGroup,int _nCommand,QString _strFilterId)
|
||||
{
|
||||
QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
|
||||
db.setHostName("bigbird.iptime.org");
|
||||
@@ -907,10 +1013,21 @@ void Widget::InsertFilter(int _nType,QString _strJson,int _nGroup)
|
||||
return;
|
||||
}
|
||||
|
||||
QString sql = "insert into filter (type,data,filtergroup_id) value (";
|
||||
sql += QString::number(_nType);
|
||||
sql += ",'" + _strJson + "',";
|
||||
sql += QString::number(_nGroup) + ")";
|
||||
QString sql;
|
||||
switch(_nCommand)
|
||||
{
|
||||
case E_DATABASE_COMMAND_INSERT:
|
||||
sql = "INSERT INTO filter SET ";
|
||||
sql += QString("type=") + QString::number(_nType) + ",";
|
||||
break;
|
||||
case E_DATABASE_COMMAND_UPDATE:
|
||||
sql = "UPDATE filter SET ";
|
||||
break;
|
||||
}
|
||||
sql += QString("data='") + _strJson + "',";
|
||||
sql += QString("filtergroup_id=" ) + QString::number(_nGroup);
|
||||
if (_nCommand == E_DATABASE_COMMAND_UPDATE)
|
||||
sql += QString(" where id=") + _strFilterId;
|
||||
QSqlQuery query;
|
||||
if (query.exec(sql.toUtf8()) == false)
|
||||
{
|
||||
@@ -920,17 +1037,17 @@ void Widget::InsertFilter(int _nType,QString _strJson,int _nGroup)
|
||||
db.close();
|
||||
}
|
||||
|
||||
void Widget::InsertTimeFilter(int _nArticle ,QDate _dateStart ,QDate _dateEnd ,int _nGroup)
|
||||
void Widget::DataBaseTimeFilter(int _nArticle ,QDate _dateStart ,QDate _dateEnd ,int _nGroup,int _nCommand,QString _strFilterId )
|
||||
{
|
||||
QString strJson;
|
||||
SJson json;
|
||||
strJson = json.Set(strJson,"Article",QString::number(_nArticle));
|
||||
strJson = json.Set(strJson,"Start",_dateStart.toString("yyyy-MM-dd"));
|
||||
strJson = json.Set(strJson,"End",_dateEnd.toString("yyyy-MM-dd"));
|
||||
InsertFilter(E_FILTER_TYPE_DATE,json.Sql(strJson),_nGroup);
|
||||
DataBaseFilter(E_FILTER_TYPE_DATE,json.Sql(strJson),_nGroup,_nCommand,_strFilterId);
|
||||
}
|
||||
|
||||
void Widget::InsertSearchFilter(int _nArticle,int _nCategory,int _nMethod,int _nKeyword, QString _str,int _nGroup)
|
||||
void Widget::DataBaseSearchFilter(int _nArticle,int _nCategory,int _nMethod,int _nKeyword, QString _str,int _nGroup,int _nCommand,QString _strFilterId)
|
||||
{
|
||||
QString strJson;
|
||||
SJson json;
|
||||
@@ -939,10 +1056,10 @@ void Widget::InsertSearchFilter(int _nArticle,int _nCategory,int _nMethod,int _n
|
||||
strJson = json.Set(strJson,"Method",_nMethod);
|
||||
strJson = json.Set(strJson,"Keyword",_nKeyword);
|
||||
strJson = json.Set(strJson,"String",_str);
|
||||
InsertFilter(E_FILTER_TYPE_SEARCH,json.Sql(strJson),_nGroup);
|
||||
DataBaseFilter(E_FILTER_TYPE_SEARCH,json.Sql(strJson),_nGroup,_nCommand,_strFilterId);
|
||||
}
|
||||
|
||||
void Widget::InsertLengthFilter(int _nArticle,int _nCategory,int _nComp,int _nInsDel,QString _str,int _nGroup)
|
||||
void Widget::DataBaseLengthFilter(int _nArticle,int _nCategory,int _nComp,int _nInsDel,QString _str,int _nGroup,int _nCommand,QString _strFilterId)
|
||||
{
|
||||
QString strJson;
|
||||
SJson json;
|
||||
@@ -951,10 +1068,10 @@ void Widget::InsertLengthFilter(int _nArticle,int _nCategory,int _nComp,int _nIn
|
||||
strJson = json.Set(strJson,"Comp",_nComp);
|
||||
strJson = json.Set(strJson,"InsDel",_nInsDel);
|
||||
strJson = json.Set(strJson,"String",_str);
|
||||
InsertFilter(E_FILTER_TYPE_LENGTH,json.Sql(strJson),_nGroup);
|
||||
DataBaseFilter(E_FILTER_TYPE_LENGTH,json.Sql(strJson),_nGroup,_nCommand,_strFilterId);
|
||||
}
|
||||
|
||||
void Widget::InsertReplaceFilter(int _nArticle,int _nCategory,int _nFind,QString _strFind,QString _strReplace,int _nGroup)
|
||||
void Widget::DataBaseReplaceFilter(int _nArticle,int _nCategory,int _nFind,QString _strFind,QString _strReplace,int _nGroup,int _nCommand,QString _strFilterId)
|
||||
{
|
||||
QString strJson;
|
||||
SJson json;
|
||||
@@ -963,7 +1080,7 @@ void Widget::InsertReplaceFilter(int _nArticle,int _nCategory,int _nFind,QString
|
||||
strJson = json.Set(strJson,"Find",_nFind);
|
||||
strJson = json.Set(strJson,"String_Find",_strFind);
|
||||
strJson = json.Set(strJson,"String_Replace",_strReplace);
|
||||
InsertFilter(E_FILTER_TYPE_REPLACE,json.Sql(strJson),_nGroup);
|
||||
DataBaseFilter(E_FILTER_TYPE_REPLACE,json.Sql(strJson),_nGroup,_nCommand,_strFilterId);
|
||||
}
|
||||
|
||||
void Widget::RefreshFilter(int _nGroup)
|
||||
@@ -1090,7 +1207,6 @@ void Widget::currentFilterItemChanged(QListWidgetItem *_pCurrent, QListWidgetIte
|
||||
m_pleLength->setText("");
|
||||
m_pleReplaceFind->setText("");
|
||||
m_pleReplace->setText("");
|
||||
|
||||
break;
|
||||
case E_FILTER_TYPE_LENGTH:
|
||||
m_pcbLengthCatalog->setCurrentIndex(json.GetNumber(strJson,"Category"));
|
||||
|
||||
@@ -35,6 +35,13 @@ class Widget : public QWidget
|
||||
E_LENGTH_COMP_LESS,
|
||||
E_LENGTH_COMP_EQUAL,
|
||||
};
|
||||
|
||||
enum E_DATABASE_COMMAND
|
||||
{
|
||||
E_DATABASE_COMMAND_INSERT = 0,
|
||||
E_DATABASE_COMMAND_UPDATE,
|
||||
};
|
||||
|
||||
Q_OBJECT
|
||||
public:
|
||||
Widget(QWidget *parent = 0);
|
||||
@@ -95,21 +102,29 @@ private:
|
||||
void SetTableHead();
|
||||
void InsertCopyRow(int _nRow,QTableWidget *_pCurrent,QTableWidget *_pNew);
|
||||
void DataReload(QString _strTableName,int _nSelect);
|
||||
void InsertFilter(int _nType,QString _strJson,int _nGroup);
|
||||
void InsertTimeFilter(int _nTimeCategory ,QDate _dateStart ,QDate _dateEnd ,int _nGroup);
|
||||
void InsertSearchFilter(int _nArticle,int _nCategory,int _nMethod,int _nKeyword, QString _str,int _nGroup);
|
||||
void InsertLengthFilter(int _nArticle,int _nCategory,int _nComp,int _nInsDel,QString _str,int _nGroup);
|
||||
void InsertReplaceFilter(int _nArticle,int _nCategory,int _nFind,QString _strFind,QString _strReplace,int _nGroup);
|
||||
void DataBaseFilter(int _nType,QString _strJson,int _nGroup,int _nCommand,QString _strFilterId ="");
|
||||
void DataBaseTimeFilter(int _nTimeCategory ,QDate _dateStart ,QDate _dateEnd ,int _nGroup,int _nCommand,QString _strFilterId="");
|
||||
void DataBaseSearchFilter(int _nArticle,int _nCategory,int _nMethod,int _nKeyword, QString _str,int _nGroup,int _nCommand,QString _strFilterId ="");
|
||||
void DataBaseLengthFilter(int _nArticle,int _nCategory,int _nComp,int _nInsDel,QString _str,int _nGroup,int _nCommand,QString _strFilterId ="");
|
||||
void DataBaseReplaceFilter(int _nArticle,int _nCategory,int _nFind,QString _strFind,QString _strReplace,int _nGroup,int _nCommand,QString _strFilterId ="");
|
||||
void RefreshFilter(int _nGroup);
|
||||
|
||||
bool ReloadColumn();
|
||||
QString GetArticleType(int _nSelect);
|
||||
public slots:
|
||||
void CloseTab(int index);
|
||||
void DoubleClickTab(int index);
|
||||
void SearchDate();
|
||||
void DoubleClickTab(int index);
|
||||
void CountSave();
|
||||
void SearchDate();
|
||||
void SearchKeyword();
|
||||
void SearchLengthInsert();
|
||||
void SearchReplaceInsert();
|
||||
|
||||
void SearchDateUpdate();
|
||||
void SearchKeywordUpdate();
|
||||
void SearchLengthUpdate();
|
||||
void SearchReplaceUpdate();
|
||||
|
||||
void DataGroupRefresh();
|
||||
void DataGroupItemChanged ( QListWidgetItem * item );
|
||||
void FilterGroupInsert();
|
||||
@@ -120,8 +135,6 @@ public slots:
|
||||
void currentGroupItemChanged(QListWidgetItem *_pCurrent, QListWidgetItem *_pPrev=0);
|
||||
void FilterDelete();
|
||||
void currentFilterItemChanged(QListWidgetItem *_pCurrent, QListWidgetItem *_pPrev=0);
|
||||
void SearchLengthInsert();
|
||||
void SearchReplaceInsert();
|
||||
void FileNew();
|
||||
void FileImport();
|
||||
void FileExport();
|
||||
|
||||
Reference in New Issue
Block a user