git-svn-id: svn://192.168.0.12/source@1 8346c931-da38-4b9b-9d4c-e48b93cbd075
This commit is contained in:
20
GroupManager/GroupManager.pro
Normal file
20
GroupManager/GroupManager.pro
Normal file
@@ -0,0 +1,20 @@
|
||||
#-------------------------------------------------
|
||||
#
|
||||
# Project created by QtCreator 2014-12-17T17:55:35
|
||||
#
|
||||
#-------------------------------------------------
|
||||
|
||||
QT += core gui sql
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
TARGET = GroupManager
|
||||
TEMPLATE = app
|
||||
|
||||
|
||||
SOURCES += main.cpp\
|
||||
widget.cpp \
|
||||
stable.cpp
|
||||
|
||||
HEADERS += widget.h \
|
||||
stable.h
|
||||
11
GroupManager/main.cpp
Normal file
11
GroupManager/main.cpp
Normal file
@@ -0,0 +1,11 @@
|
||||
#include "widget.h"
|
||||
#include <QApplication>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
Widget w;
|
||||
w.show();
|
||||
|
||||
return a.exec();
|
||||
}
|
||||
12
GroupManager/stable.cpp
Normal file
12
GroupManager/stable.cpp
Normal file
@@ -0,0 +1,12 @@
|
||||
#include "stable.h"
|
||||
|
||||
STable::STable()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
STable::~STable()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
14
GroupManager/stable.h
Normal file
14
GroupManager/stable.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#ifndef STABLE_H
|
||||
#define STABLE_H
|
||||
|
||||
#include <QTableView>
|
||||
|
||||
|
||||
class STable : public QTableView
|
||||
{
|
||||
public:
|
||||
STable();
|
||||
~STable();
|
||||
};
|
||||
|
||||
#endif // STABLE_H
|
||||
443
GroupManager/widget.cpp
Normal file
443
GroupManager/widget.cpp
Normal file
@@ -0,0 +1,443 @@
|
||||
#include "widget.h"
|
||||
#include <QSqlError>
|
||||
#include <QSqlQuery>
|
||||
#include <QSqlTableModel>
|
||||
#include <QDebug>
|
||||
#include <QHBoxLayout>
|
||||
#include <QPushButton>
|
||||
#include <QLabel>
|
||||
#include <QCalendarWidget>
|
||||
#include <QVBoxLayout>
|
||||
#include <QSqlRecord>
|
||||
#include <QFile>
|
||||
|
||||
Widget::Widget(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
|
||||
db.setHostName("bigbird.iptime.org");
|
||||
db.setUserName("admin");
|
||||
db.setPassword("admin123");
|
||||
db.setDatabaseName("concepters");
|
||||
if (db.open() == false)
|
||||
{
|
||||
qDebug() << db.lastError().text();
|
||||
return;
|
||||
}
|
||||
m_pmodelKeyword = new QSqlQueryModel;
|
||||
m_pmodelGroup = new QSqlQueryModel;
|
||||
m_pmodelCrawling = new QSqlQueryModel;
|
||||
|
||||
m_pmodelKeyword->setQuery("SELECT * FROM keyword where state is null");
|
||||
m_pmodelGroup->setQuery("SELECT * FROM datagroup");
|
||||
m_pmodelCrawling->setQuery("SELECT _crawling.id,_keyword.searches,_keyword.start,_keyword.end, _datagroup.name ,_crawling.state "
|
||||
"FROM crawling _crawling INNER JOIN keyword _keyword ON _crawling.keyword_id = _keyword.id "
|
||||
"inner join datagroup _datagroup on _crawling.datagroup_id = _datagroup.id");
|
||||
|
||||
QVBoxLayout *vlayout = new QVBoxLayout();
|
||||
{
|
||||
QHBoxLayout *hlayout = new QHBoxLayout();
|
||||
hlayout->addWidget(setKeywordWidgets());
|
||||
hlayout->addWidget(setGroupWidgets());
|
||||
vlayout->addLayout(hlayout);
|
||||
vlayout->addWidget(setCrawlingWidgets());
|
||||
}
|
||||
setLayout(vlayout);
|
||||
}
|
||||
|
||||
Widget::~Widget()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QGroupBox *Widget::setKeywordWidgets()
|
||||
{
|
||||
QVBoxLayout *vlayout = new QVBoxLayout();
|
||||
{
|
||||
m_ptableKeyword = new QTableView;
|
||||
m_ptableKeyword->setModel(m_pmodelKeyword);
|
||||
m_ptableKeyword->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
m_ptableKeyword->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
vlayout->addWidget(m_ptableKeyword);
|
||||
|
||||
connect(m_ptableKeyword->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
|
||||
this, SLOT(on_keyword_currentRowChanged(QModelIndex)));
|
||||
|
||||
}
|
||||
{
|
||||
m_pdeStart = new QDateEdit(QDate::currentDate());
|
||||
m_pdeEnd = new QDateEdit(QDate::currentDate());
|
||||
|
||||
m_pdeStart->setDateRange(QDate(2003, 5, 20),QDate::currentDate());
|
||||
m_pdeEnd->setDateRange(QDate(2003, 5, 20),QDate::currentDate());
|
||||
|
||||
QCalendarWidget *pCalender = new QCalendarWidget();
|
||||
m_pdeStart->setCalendarWidget(pCalender);
|
||||
m_pdeStart->setCalendarPopup(true);
|
||||
|
||||
m_pdeEnd->setCalendarWidget(pCalender);
|
||||
m_pdeEnd->setCalendarPopup(true);
|
||||
|
||||
m_pcbRealTime = new QComboBox;
|
||||
m_pcbRealTime->addItems(QStringList() << "false" << "true");
|
||||
|
||||
m_pleKeyword = new QLineEdit;
|
||||
}
|
||||
{
|
||||
QHBoxLayout *hlayout = new QHBoxLayout();
|
||||
hlayout->setAlignment(Qt::AlignLeft|Qt::AlignTop);
|
||||
hlayout->addWidget(new QLabel("Real Time:"));
|
||||
hlayout->addWidget(m_pcbRealTime);
|
||||
hlayout->addWidget(new QLabel("Start:"));
|
||||
hlayout->addWidget(m_pdeStart);
|
||||
hlayout->addWidget(new QLabel("End:"));
|
||||
hlayout->addWidget(m_pdeEnd);
|
||||
vlayout->addLayout(hlayout);
|
||||
}
|
||||
{
|
||||
QHBoxLayout *hlayout = new QHBoxLayout();
|
||||
hlayout->setAlignment(Qt::AlignLeft|Qt::AlignTop);
|
||||
hlayout->addWidget(new QLabel("Keyword:"));
|
||||
hlayout->addWidget(m_pleKeyword);
|
||||
vlayout->addLayout(hlayout);
|
||||
}
|
||||
{
|
||||
QHBoxLayout *hlayout = new QHBoxLayout();
|
||||
QPushButton *pInsert = new QPushButton("Insert");
|
||||
QPushButton *pDelete = new QPushButton("Delete");
|
||||
QPushButton *pModify = new QPushButton("Modify");
|
||||
hlayout->addWidget(pInsert);
|
||||
hlayout->addWidget(pDelete);
|
||||
hlayout->addWidget(pModify);
|
||||
vlayout->addLayout(hlayout);
|
||||
|
||||
connect(pInsert, SIGNAL(released()),this, SLOT(on_keyword_button_insert()));
|
||||
connect(pDelete, SIGNAL(released()),this, SLOT(on_keyword_button_delete()));
|
||||
connect(pModify, SIGNAL(released()),this, SLOT(on_keyword_button_modify()));
|
||||
}
|
||||
QGroupBox *groupBox = new QGroupBox("Keyword");
|
||||
groupBox->setAlignment(Qt::AlignLeft|Qt::AlignTop);
|
||||
groupBox->setLayout(vlayout);
|
||||
return groupBox;
|
||||
}
|
||||
|
||||
QGroupBox *Widget::setGroupWidgets()
|
||||
{
|
||||
QVBoxLayout *vlayout = new QVBoxLayout();
|
||||
{
|
||||
m_ptableGroup = new QTableView;
|
||||
m_ptableGroup->setModel(m_pmodelGroup);
|
||||
m_ptableGroup->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
m_ptableGroup->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
vlayout->addWidget(m_ptableGroup);
|
||||
|
||||
connect(m_ptableGroup->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
|
||||
this, SLOT(on_group_currentRowChanged(QModelIndex)));
|
||||
}
|
||||
{
|
||||
m_pleGroup = new QLineEdit;
|
||||
}
|
||||
|
||||
{
|
||||
QHBoxLayout *hlayout = new QHBoxLayout();
|
||||
hlayout->setAlignment(Qt::AlignLeft|Qt::AlignTop);
|
||||
hlayout->addWidget(new QLabel("Group Name:"));
|
||||
hlayout->addWidget(m_pleGroup);
|
||||
vlayout->addLayout(hlayout);
|
||||
}
|
||||
{
|
||||
QHBoxLayout *hlayout = new QHBoxLayout();
|
||||
QPushButton *pInsert = new QPushButton("Insert");
|
||||
QPushButton *pDelete = new QPushButton("Delete");
|
||||
QPushButton *pClear = new QPushButton("Clear");
|
||||
QPushButton *pModify = new QPushButton("Modify");
|
||||
QPushButton *pExport = new QPushButton("Export");
|
||||
hlayout->addWidget(pInsert);
|
||||
hlayout->addWidget(pDelete);
|
||||
hlayout->addWidget(pClear);
|
||||
hlayout->addWidget(pModify);
|
||||
hlayout->addWidget(pExport);
|
||||
|
||||
connect(pInsert, SIGNAL(released()),this, SLOT(on_group_button_insert()));
|
||||
connect(pDelete, SIGNAL(released()),this, SLOT(on_group_button_delete()));
|
||||
connect(pClear, SIGNAL(released()),this, SLOT(on_group_button_clear()));
|
||||
connect(pModify, SIGNAL(released()),this, SLOT(on_group_button_modify()));
|
||||
connect(pExport, SIGNAL(released()),this, SLOT(on_group_button_export()));
|
||||
vlayout->addLayout(hlayout);
|
||||
}
|
||||
QGroupBox *groupBox = new QGroupBox("Group");
|
||||
groupBox->setAlignment(Qt::AlignLeft|Qt::AlignTop);
|
||||
groupBox->setLayout(vlayout);
|
||||
return groupBox;
|
||||
}
|
||||
|
||||
QGroupBox *Widget::setCrawlingWidgets()
|
||||
{
|
||||
QVBoxLayout *vlayout = new QVBoxLayout();
|
||||
|
||||
{
|
||||
QHBoxLayout *hlayout = new QHBoxLayout();
|
||||
QPushButton *pInsert = new QPushButton("Insert");
|
||||
QPushButton *pDelete = new QPushButton("Delete");
|
||||
|
||||
connect(pInsert, SIGNAL(released()),this, SLOT(on_crawling_button_insert()));
|
||||
connect(pDelete, SIGNAL(released()),this, SLOT(on_crawling_button_delete()));
|
||||
|
||||
hlayout->setAlignment(Qt::AlignCenter);
|
||||
hlayout->addWidget(pInsert);
|
||||
hlayout->addWidget(pDelete);
|
||||
vlayout->addLayout(hlayout);
|
||||
}
|
||||
|
||||
{
|
||||
m_ptableCrawling = new QTableView;
|
||||
m_ptableCrawling->setModel(m_pmodelCrawling);
|
||||
m_ptableCrawling->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
m_ptableCrawling->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
vlayout->addWidget(m_ptableCrawling);
|
||||
}
|
||||
|
||||
|
||||
QGroupBox *groupBox = new QGroupBox("Crawling");
|
||||
groupBox->setAlignment(Qt::AlignLeft|Qt::AlignTop);
|
||||
groupBox->setLayout(vlayout);
|
||||
return groupBox;
|
||||
}
|
||||
|
||||
|
||||
void Widget::on_keyword_currentRowChanged(QModelIndex _index)
|
||||
{
|
||||
if (_index.isValid())
|
||||
{
|
||||
QSqlRecord rec = m_pmodelKeyword->record(_index.row());
|
||||
m_pdeStart->setDate(QDate::fromString(rec.value("start").toString(),"yyyy-MM-dd"));
|
||||
m_pdeEnd->setDate(QDate::fromString(rec.value("end").toString(),"yyyy-MM-dd"));
|
||||
m_pcbRealTime->setCurrentIndex(rec.value("realtime").toInt());
|
||||
m_pleKeyword->setText(rec.value("searches").toString());
|
||||
}
|
||||
}
|
||||
|
||||
void Widget::on_keyword_button_insert()
|
||||
{
|
||||
QString strQuery = QString("insert into keyword set "
|
||||
"start = STR_TO_DATE('%1', '%Y-%m-%d'),"
|
||||
"end = STR_TO_DATE('%2', '%Y-%m-%d'),"
|
||||
"searches = '%3',"
|
||||
"realtime = %4")
|
||||
.arg(m_pdeStart->date().toString("yyyy-MM-dd"))
|
||||
.arg(m_pdeEnd->date().toString("yyyy-MM-dd"))
|
||||
.arg(m_pleKeyword->text())
|
||||
.arg(m_pcbRealTime->currentIndex());
|
||||
|
||||
m_pmodelKeyword->setQuery(QString(strQuery.toUtf8()));
|
||||
m_pmodelKeyword->setQuery("SELECT * FROM keyword where state is null");
|
||||
}
|
||||
|
||||
void Widget::on_keyword_button_delete()
|
||||
{
|
||||
foreach (QModelIndex index,m_ptableKeyword->selectionModel()->selectedIndexes())
|
||||
{
|
||||
QSqlRecord rec = m_pmodelKeyword->record(index.row());
|
||||
QString strQuery = QString("UPDATE keyword set state = '1' where id = '" + rec.value("id").toString() + "'");
|
||||
m_pmodelKeyword->setQuery(QString(strQuery.toUtf8()));
|
||||
}
|
||||
m_pmodelKeyword->setQuery("SELECT * FROM keyword where state is null");
|
||||
}
|
||||
|
||||
void Widget::on_keyword_button_modify()
|
||||
{
|
||||
foreach (QModelIndex index,m_ptableKeyword->selectionModel()->selectedIndexes())
|
||||
{
|
||||
QSqlRecord rec = m_pmodelKeyword->record(index.row());
|
||||
QString strQuery = QString("update keyword set "
|
||||
"start = STR_TO_DATE('%1', '%Y-%m-%d'),"
|
||||
"end = STR_TO_DATE('%2', '%Y-%m-%d'),"
|
||||
"searches = '%3',"
|
||||
"realtime = %4 "
|
||||
"where id = '%5'")
|
||||
.arg(m_pdeStart->date().toString("yyyy-MM-dd"))
|
||||
.arg(m_pdeEnd->date().toString("yyyy-MM-dd"))
|
||||
.arg(m_pleKeyword->text())
|
||||
.arg(m_pcbRealTime->currentIndex())
|
||||
.arg(rec.value("id").toString());
|
||||
m_pmodelKeyword->setQuery(QString(strQuery.toUtf8()));
|
||||
}
|
||||
m_pmodelKeyword->setQuery("SELECT * FROM keyword where state is null");
|
||||
}
|
||||
|
||||
void Widget::on_group_currentRowChanged(QModelIndex _index)
|
||||
{
|
||||
if (_index.isValid())
|
||||
{
|
||||
QSqlRecord rec = m_pmodelGroup->record(_index.row());
|
||||
m_pleGroup->setText(rec.value("name").toString());
|
||||
}
|
||||
}
|
||||
|
||||
void Widget::on_group_button_insert()
|
||||
{
|
||||
QSqlQuery sql;
|
||||
sql.exec("SELECT AUTO_INCREMENT FROM information_schema.TABLES WHERE TABLE_SCHEMA = \"concepters\" AND TABLE_NAME = \"datagroup\"");
|
||||
sql.next();
|
||||
QString strQuery = QString("insert into datagroup set "
|
||||
"name = '" + m_pleGroup->text() + "'");
|
||||
m_pmodelGroup->setQuery(strQuery.toUtf8());
|
||||
strQuery = "CREATE TABLE data_";
|
||||
strQuery += sql.value(0).toString();
|
||||
strQuery += " ("
|
||||
"url CHAR(128),"
|
||||
"keyword_id INT,"
|
||||
"platformname CHAR(32),"
|
||||
"platformform CHAR(16),"
|
||||
"articleform CHAR(16),"
|
||||
"body_platformtitle CHAR(128),"
|
||||
"body_platformid CHAR(64),"
|
||||
"body_articletitle VARCHAR(128),"
|
||||
"body_articleid VARCHAR(32),"
|
||||
"body_date DATETIME,"
|
||||
"body_nickname CHAR(32),"
|
||||
"body_data VARCHAR(18432),"
|
||||
"reply_nickname CHAR(32),"
|
||||
"reply_data VARCHAR(1024),"
|
||||
"reply_parent CHAR(32),"
|
||||
"reply_date DATETIME,"
|
||||
"reply_urlreply VARCHAR(512),"
|
||||
"reply_rownum INT) CHARSET=utf8";
|
||||
sql.exec(strQuery);
|
||||
m_pmodelGroup->setQuery("SELECT * FROM datagroup");
|
||||
}
|
||||
|
||||
void Widget::on_group_button_delete()
|
||||
{
|
||||
foreach (QModelIndex index,m_ptableGroup->selectionModel()->selectedIndexes())
|
||||
{
|
||||
QSqlRecord rec = m_pmodelGroup->record(index.row());
|
||||
QString strQuery = QString("delete from datagroup where id = '" + rec.value("id").toString() + "'");
|
||||
m_pmodelGroup->setQuery(QString(strQuery.toUtf8()));
|
||||
QSqlQuery sql;
|
||||
strQuery = "drop table data_" + rec.value("id").toString();
|
||||
sql.exec(strQuery);
|
||||
}
|
||||
m_pmodelGroup->setQuery("SELECT * FROM datagroup");
|
||||
}
|
||||
|
||||
void Widget::on_group_button_clear()
|
||||
{
|
||||
foreach (QModelIndex index,m_ptableGroup->selectionModel()->selectedIndexes())
|
||||
{
|
||||
QSqlRecord rec = m_pmodelGroup->record(index.row());
|
||||
QSqlQuery sql;
|
||||
sql.exec("delete from data_" + rec.value("id").toString());
|
||||
}
|
||||
m_pmodelGroup->setQuery("SELECT * FROM datagroup");
|
||||
}
|
||||
|
||||
void Widget::on_group_button_modify()
|
||||
{
|
||||
foreach (QModelIndex index,m_ptableGroup->selectionModel()->selectedIndexes())
|
||||
{
|
||||
QSqlRecord rec = m_pmodelGroup->record(index.row());
|
||||
m_pmodelGroup->setQuery(QString("update datagroup set name = '" +
|
||||
m_pleGroup->text() + "' where id = '" +
|
||||
rec.value("id").toString() + "'" ).toUtf8());
|
||||
}
|
||||
m_pmodelGroup->setQuery("SELECT * FROM datagroup");
|
||||
}
|
||||
|
||||
void Widget::on_group_button_export()
|
||||
{
|
||||
foreach (QModelIndex index,m_ptableGroup->selectionModel()->selectedIndexes())
|
||||
{
|
||||
SaveCsv("data_" + m_pmodelGroup->record(index.row()).value("id").toString());
|
||||
}
|
||||
}
|
||||
|
||||
void Widget::SaveCsv(QString _strName)
|
||||
{
|
||||
QFile file(_strName + ".csv" );
|
||||
if(!file.open(QFile::WriteOnly | QFile::Text))
|
||||
{
|
||||
return;
|
||||
}
|
||||
QTextStream out(&file);
|
||||
//out << QString("\"ID\",\"NICK\",\"DATE\",\"TITLE\",\"DATA\",\"CAFE ID\",\"CAFE NAME\",\"CAFE URL\",\"COMMENT NICK\",\"UPPER COMMENT NICK\",\"COMMENT DATE\",\"COMMENT\"\n");
|
||||
QSqlQuery query;
|
||||
QString strSelect;
|
||||
strSelect = "select ";
|
||||
strSelect += "CONVERT(body_articleid USING utf8),";
|
||||
strSelect += "CONVERT(body_nickname USING utf8),";
|
||||
strSelect += "CONVERT(body_date USING utf8),";
|
||||
strSelect += "CONVERT(body_articletitle USING utf8),";
|
||||
strSelect += "CONVERT(body_data USING utf8),";
|
||||
strSelect += "CONVERT(body_platformid USING utf8),";
|
||||
strSelect += "CONVERT(body_platformtitle USING utf8),";
|
||||
strSelect += "CONVERT(url USING utf8),";
|
||||
strSelect += "CONVERT(reply_nickname USING utf8),";
|
||||
strSelect += "CONVERT(reply_parent USING utf8),";
|
||||
strSelect += "CONVERT(reply_date USING utf8),";
|
||||
strSelect += "CONVERT(reply_data USING utf8),";
|
||||
strSelect += "CONVERT(reply_urlreply USING utf8),";
|
||||
strSelect += "CONVERT(keyword_id USING utf8),";
|
||||
strSelect += "CONVERT(platformname USING utf8),";
|
||||
strSelect += "CONVERT(platformform USING utf8),";
|
||||
strSelect += "CONVERT(articleform USING utf8),";
|
||||
strSelect += "CONVERT(reply_rownum USING utf8)";
|
||||
strSelect += " from ";
|
||||
strSelect += _strName;
|
||||
strSelect += " Order by body_date";
|
||||
|
||||
if (query.exec(strSelect) == false)
|
||||
{
|
||||
out << query.lastError().text();
|
||||
return ;
|
||||
}
|
||||
|
||||
while (query.next())
|
||||
{
|
||||
for (int i = 0; i < 18; i++)
|
||||
{
|
||||
QString str = query.value(i).toString();
|
||||
str = str.replace(",","");
|
||||
str = str.replace("\n","");
|
||||
out << "\"" <<str << "\"" << "," ;
|
||||
}
|
||||
out << "\"\"" << endl;
|
||||
}
|
||||
file.close();
|
||||
}
|
||||
|
||||
void Widget::on_crawling_button_insert()
|
||||
{
|
||||
QString strGroupId;
|
||||
foreach (QModelIndex index , m_ptableGroup->selectionModel()->selectedIndexes())
|
||||
strGroupId = m_pmodelGroup->record(index.row()).value("id").toString();
|
||||
if (strGroupId.isEmpty()) return;
|
||||
|
||||
QString strKeywordId;
|
||||
foreach (QModelIndex index,m_ptableKeyword->selectionModel()->selectedIndexes())
|
||||
strKeywordId = m_pmodelKeyword->record(index.row()).value("id").toString();
|
||||
|
||||
if (strKeywordId.isEmpty()) return;
|
||||
|
||||
QString strQuery = "insert into crawling set ";
|
||||
strQuery += "Keyword_id = '" + strKeywordId + "',";
|
||||
strQuery += "DataGroup_id = '" + strGroupId + "'";
|
||||
|
||||
m_pmodelCrawling->setQuery(strQuery.toUtf8());
|
||||
m_pmodelCrawling->setQuery("SELECT _crawling.id,_keyword.searches,_keyword.start,_keyword.end, _datagroup.name ,_crawling.state "
|
||||
"FROM crawling _crawling INNER JOIN keyword _keyword ON _crawling.keyword_id = _keyword.id "
|
||||
"inner join datagroup _datagroup on _crawling.datagroup_id = _datagroup.id");
|
||||
}
|
||||
|
||||
void Widget::on_crawling_button_delete()
|
||||
{
|
||||
foreach (QModelIndex index,m_ptableCrawling->selectionModel()->selectedIndexes())
|
||||
{
|
||||
QSqlRecord rec = m_pmodelCrawling->record(index.row());
|
||||
QString strQuery = QString("delete from crawling where id = '" + rec.value("id").toString() + "'");
|
||||
m_pmodelCrawling->setQuery(QString(strQuery.toUtf8()));
|
||||
}
|
||||
m_pmodelCrawling->setQuery("SELECT _crawling.id,_keyword.searches,_keyword.start,_keyword.end, _datagroup.name ,_crawling.state "
|
||||
"FROM crawling _crawling INNER JOIN keyword _keyword ON _crawling.keyword_id = _keyword.id "
|
||||
"inner join datagroup _datagroup on _crawling.datagroup_id = _datagroup.id");
|
||||
}
|
||||
47
GroupManager/widget.h
Normal file
47
GroupManager/widget.h
Normal file
@@ -0,0 +1,47 @@
|
||||
#ifndef WIDGET_H
|
||||
#define WIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QTableView>
|
||||
#include <QSqlQueryModel>
|
||||
#include <QComboBox>
|
||||
#include <QDateEdit>
|
||||
#include <QDate>
|
||||
#include <QGroupBox>
|
||||
#include <QLineEdit>
|
||||
|
||||
class Widget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Widget(QWidget *parent = 0);
|
||||
~Widget();
|
||||
private:
|
||||
QTableView *m_ptableKeyword,*m_ptableGroup,*m_ptableCrawling;
|
||||
QSqlQueryModel *m_pmodelKeyword,*m_pmodelGroup,*m_pmodelCrawling;
|
||||
QDateEdit *m_pdeStart,*m_pdeEnd;
|
||||
QComboBox *m_pcbRealTime;
|
||||
QLineEdit *m_pleKeyword,*m_pleGroup;
|
||||
private:
|
||||
QGroupBox *setKeywordWidgets();
|
||||
QGroupBox *setGroupWidgets();
|
||||
QGroupBox *setCrawlingWidgets();
|
||||
void SaveCsv(QString);
|
||||
private slots:
|
||||
void on_keyword_currentRowChanged(QModelIndex);
|
||||
void on_keyword_button_insert();
|
||||
void on_keyword_button_delete();
|
||||
void on_keyword_button_modify();
|
||||
|
||||
void on_group_currentRowChanged(QModelIndex);
|
||||
void on_group_button_insert();
|
||||
void on_group_button_delete();
|
||||
void on_group_button_clear();
|
||||
void on_group_button_modify();
|
||||
void on_group_button_export();
|
||||
|
||||
void on_crawling_button_insert();
|
||||
void on_crawling_button_delete();
|
||||
};
|
||||
|
||||
#endif // WIDGET_H
|
||||
Reference in New Issue
Block a user