From 5aeb4cff766b92ffe7ff20e38f4170d905bccb05 Mon Sep 17 00:00:00 2001 From: ip-mba Date: Thu, 20 Feb 2014 17:31:44 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E5=A2=9E=E5=8A=A0host=E8=BF=87=E6=BB=A4?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=202.=20=E4=BF=AE=E5=A4=8D=E6=9D=A1=E7=9B=AE?= =?UTF-8?q?=E8=83=8C=E6=99=AF=E8=89=B2=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.cpp | 1 + mainwindow.cpp | 6 +++ mainwindow.h | 1 + mainwindow.ui | 50 +++++++++++++++++--- rytablemodel.cpp | 6 ++- rytablesortfilterproxymodel.cpp | 19 ++++++++ rytablesortfilterproxymodel.h | 2 + rythem_zh_CN.ts | 82 ++++++++++++++++++--------------- ryupdatechecker.h | 4 +- 9 files changed, 125 insertions(+), 46 deletions(-) diff --git a/main.cpp b/main.cpp index 823d6eb..219f846 100644 --- a/main.cpp +++ b/main.cpp @@ -109,6 +109,7 @@ int main(int argc, char *argv[]) server->connect(server,SIGNAL(pipeComplete(RyPipeData_ptr)),&w,SLOT(onPipeUpdate(RyPipeData_ptr))); server->connect(server,SIGNAL(pipeError(RyPipeData_ptr)),&w,SLOT(onPipeUpdate(RyPipeData_ptr))); bool isListenSuccess = server->listen(QHostAddress::Any,8889); + if(!isListenSuccess){ exit(1); } diff --git a/mainwindow.cpp b/mainwindow.cpp index bb1cad7..e2fae00 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -518,7 +518,13 @@ MainWindow::MainWindow(QWidget *parent) : statusBarStr = statusBarStr.append(address.toString()+" "); } statusBarStr = statusBarStr.append(tr(" --By AlloyTeam::iptton")); + statusBarStr = statusBarStr.append(tr(" version:")).append(CURRENT_VERSION); ui->statusBar->showMessage(statusBarStr); + connect(ui->edit_filter,SIGNAL(textChanged(QString)),this,SLOT(onFilterTextChanged(QString))); +} + +void MainWindow::onFilterTextChanged(QString filterText){ + sortFilterProxyModel->setFilterText(filterText); } MainWindow::~MainWindow() diff --git a/mainwindow.h b/mainwindow.h index 50f615e..80697c0 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -103,6 +103,7 @@ private slots: void on_actionDebug_triggered(); void on_actionCheckNew_triggered(); void loadConfigPage(); + void onFilterTextChanged(QString); }; #endif // MAINWINDOW_H diff --git a/mainwindow.ui b/mainwindow.ui index 04e894e..9dc8c38 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -6,10 +6,16 @@ 0 0 - 818 - 625 + 810 + 559 + + + 0 + 0 + + Rythem @@ -19,13 +25,45 @@ background:#dddfe2; } + + + 0 + 0 + + + + + 0 + 1 + + Qt::Horizontal - + + + + + + + 0 + 0 + + + + + + + + [host filter]: qq.com|alloyteam + + + + + @@ -101,8 +139,8 @@ background:#dddfe2; 0 0 - 523 - 164 + 516 + 131 @@ -165,7 +203,7 @@ background:#dddfe2; 0 0 - 818 + 810 22 diff --git a/rytablemodel.cpp b/rytablemodel.cpp index 44ece07..546ce9a 100644 --- a/rytablemodel.cpp +++ b/rytablemodel.cpp @@ -90,9 +90,11 @@ QVariant RyTableModel::data(const QModelIndex &index, int role) const{ RyPipeData_ptr d = pipesVector.at(index.row()); if(d->isMatchingRule){ - return QVariant((int)Qt::cyan); + return Qt::cyan; + //return QVariant((int)Qt::cyan); }else if(d->responseStatus.startsWith('4') || d->responseStatus.startsWith('5')){ - return QVariant((int)Qt::darkCyan); + return Qt::darkGray; + //return QVariant((int)Qt::darkCyan); } }else{ return QVariant(); diff --git a/rytablesortfilterproxymodel.cpp b/rytablesortfilterproxymodel.cpp index c3b24d7..2e2b637 100644 --- a/rytablesortfilterproxymodel.cpp +++ b/rytablesortfilterproxymodel.cpp @@ -20,6 +20,20 @@ bool RyTableSortFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIn qDebug()<<"filterAcceptsRow got null"; return true; } + + //先处理文本过滤 + if(!_filterText.isEmpty()){ + QStringList hostFilterList = _filterText.split("|"); + bool matchHost = false; + foreach(QString hostFilter,hostFilterList){ + if(p->host.indexOf(hostFilter) != -1){ + matchHost = true; + } + } + if(!matchHost){ + return matchHost; + } + } //qDebug()<<"filterAcceptsRow comparing"<responseStatus; if(_filterFlags & NoImageFilter){ if(p->getResponseHeader("Content-Type").toLower().indexOf("image")!=-1){ @@ -63,6 +77,11 @@ RyPipeData_ptr RyTableSortFilterProxyModel::getItem(const QModelIndex& proxyInde return getItem(mapToSource(proxyIndex).row()); } +void RyTableSortFilterProxyModel::setFilterText(QString filterText){ + _filterText = filterText; + invalidateFilter(); +} + void RyTableSortFilterProxyModel::setFilter(int flag){ int oldFlags = _filterFlags; _filterFlags = flag; diff --git a/rytablesortfilterproxymodel.h b/rytablesortfilterproxymodel.h index 916c807..7a311c1 100644 --- a/rytablesortfilterproxymodel.h +++ b/rytablesortfilterproxymodel.h @@ -25,6 +25,7 @@ class RyTableSortFilterProxyModel : public QSortFilterProxyModel RyPipeData_ptr getItem(int sourceRow); RyPipeData_ptr getItem(const QModelIndex& proxyIndex); + void setFilterText(QString filterText); void setFilter(int filter); int filter()const; void setCustomeFilter(FilterCallBack); @@ -43,6 +44,7 @@ public slots: private: RyTableModel *_sourceModel; + QString _filterText; int _filterFlags; FilterCallBack _filterCallback; diff --git a/rythem_zh_CN.ts b/rythem_zh_CN.ts index 4fd792b..509ee20 100644 --- a/rythem_zh_CN.ts +++ b/rythem_zh_CN.ts @@ -48,101 +48,106 @@ Host: www.alloyteam.com MainWindow - + Rythem - + + [host filter]: qq.com|alloyteam + + + + Inspector 查看器 - - + + TextView 文本 - + FormView 表单 - + ImageView 图片 - + HexView 十六进制 - + Rules 替换规则 - + about:blank - + Composer 发送器 - - + + Clear All 清除 - - + + Begein Capture 开始抓包 - - + + water fall 瀑布图 - + long cache 长缓存 - + set sessions matching rule with long cache 符合替换规则的请求,返回内容设置长时间缓存 - + Debug - + debug - + CheckNew 检查更新 - + liveLoad - + toggle live load @@ -184,51 +189,56 @@ Host: www.alloyteam.com --AlloyTeam::iptton - + + version: + + + + &File 文件(&F) - + &import session... 导入会话(&i)... - + hide image requests 隐藏图片请求 - + hide 304s 隐藏304 - + show matching sessions only 只显示匹配规则的请求 - + hide connect tunnels 隐藏Connect遂道 - + select file to open 选择文件 - - - + + + start capture 开始抓包 - - - + + + stop capture 停止抓包 diff --git a/ryupdatechecker.h b/ryupdatechecker.h index c31d95e..0d44494 100644 --- a/ryupdatechecker.h +++ b/ryupdatechecker.h @@ -5,13 +5,13 @@ #include #ifdef Q_OS_MAC -#define CURRENT_VERSION "0.13.11.15" +#define CURRENT_VERSION "1.0.140220" #endif #ifdef Q_OS_LINUX #define CURRENT_VERSION "0.5.09.21" #endif #ifdef Q_OS_WIN -#define CURRENT_VERSION "0.13.11.15" +#define CURRENT_VERSION "1.0.140220" #endif #define RYTHEM_UPDATE_PREFIX "http://rythem.alloyteam.com/update.php?"