Skip to content

Commit

Permalink
增加多语言支持
Browse files Browse the repository at this point in the history
  • Loading branch information
iptton committed May 23, 2012
1 parent 7e5b38b commit 28ab87f
Show file tree
Hide file tree
Showing 9 changed files with 326 additions and 27 deletions.
8 changes: 7 additions & 1 deletion Rythem.pro
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ OTHER_FILES += \
static/img2.png \
static/img1.png \
logo.rc \
remove.png
remove.png \
rythem_zh_CN.ts \
rythem_zh_CN.qm
CONFIG(release){
#DEFINES += DEBUGTOFILE
#message("debug")
Expand All @@ -151,3 +153,7 @@ RC_FILE = logo.rc

ICON = Rythem2.icns

TRANSLATIONS = rythem_zh_CN.ts
CODECFORTR = UTF-8


7 changes: 5 additions & 2 deletions composer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,13 @@ void Composer::onSendClicked(){
RyProxyServer::instance()->serverPort()
)
);
if(pipeData->method == "GET"){
ui->response->setPlainText(tr("sending"));
if(pipeData->method.toUpper() == "GET"){
manager->get(req);
}else if(pipeData->method == "POST"){
}else if(pipeData->method.toUpper() == "POST"){
manager->post(req,pipeData->requestBodyRawData());
}else{
ui->response->setPlainText(tr("no support this method:%1").arg(pipeData->method));
}
}
}
2 changes: 1 addition & 1 deletion composer.ui
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Host: www.alloyteam.com
<item row="0" column="2">
<widget class="QPushButton" name="sendbtn">
<property name="text">
<string>send</string>
<string>excuse</string>
</property>
</widget>
</item>
Expand Down
7 changes: 7 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

#include <QThread>

#include <QTranslator>

using namespace rule;


Expand Down Expand Up @@ -53,6 +55,11 @@ int main(int argc, char *argv[])
a.setQuitOnLastWindowClosed(false);
appPath = qApp->applicationDirPath();

QTranslator translator;
bool isLoadSuccess = translator.load("rythem_zh_CN");
if(!isLoadSuccess)qDebug()<<"error";
QTextCodec::setCodecForTr(QTextCodec::codecForName("utf8"));
a.installTranslator(&translator);

#ifdef DEBUGTOFILE
qInstallMsgHandler(myMessageHandler);
Expand Down
12 changes: 6 additions & 6 deletions mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,8 @@ MainWindow::MainWindow(QWidget *parent) :
#ifdef Q_WS_MAC
// TODO: mac下需手动设置代理
ui->ActionCapture->setEnabled(false);
ui->ActionCapture->setText(tr("请手动设置代理"));
ui->ActionCapture->setToolTip(tr("mac下需手动设置代理为127.0.0.1:8889"));
ui->ActionCapture->setText(tr("SetupProxyManually"));
ui->ActionCapture->setToolTip(tr("non-windows OS need to set proxy to:127.0.0.1:8889 manually"));
#endif

}
Expand Down Expand Up @@ -494,7 +494,7 @@ void MainWindow::toggleProxy(){
#ifdef Q_WS_WIN32
RyWinHttp::init();
if(_isUsingCapture){
ui->ActionCapture->setText(tr("开始抓包"));
ui->ActionCapture->setText(tr("start capture"));
proxySetting.setValue("ProxyEnable",_previousProxyInfo.enable);
if(_previousProxyInfo.enable != 0){
proxySetting.setValue("ProxyServer",_previousProxyInfo.proxyString);
Expand All @@ -512,7 +512,7 @@ void MainWindow::toggleProxy(){
//}
*/
}else{
ui->ActionCapture->setText(tr("停止抓包"));
ui->ActionCapture->setText(tr("stop capture"));
_previousProxyInfo.isUsingPac = proxySetting.value("AutoConfigURL","0").toString();
_previousProxyInfo.enable = proxySetting.value("ProxyEnable").toInt();
_previousProxyInfo.proxyString =proxySetting.value("ProxyServer").toString();
Expand Down Expand Up @@ -556,9 +556,9 @@ void MainWindow::toggleProxy(){
#endif
_isUsingCapture = !_isUsingCapture;
if(_isUsingCapture){
ui->ActionCapture->setText(tr("停止抓包"));
ui->ActionCapture->setText(tr("stop capture"));
}else{
ui->ActionCapture->setText(tr("开始抓包"));
ui->ActionCapture->setText(tr("start capture"));
}
}

Expand Down
35 changes: 19 additions & 16 deletions mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ background:#dddfe2;
<bool>true</bool>
</property>
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="inspectorTab">
<attribute name="title">
<string>查看器</string>
<string>Inspector</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
Expand All @@ -54,7 +54,7 @@ background:#dddfe2;
</property>
<widget class="QTabWidget" name="requestInspectorTabs">
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="requestInspectorTextview">
<attribute name="title">
Expand All @@ -68,13 +68,13 @@ background:#dddfe2;
</widget>
<widget class="QWidget" name="tab_7">
<attribute name="title">
<string>webForms</string>
<string>FormView</string>
</attribute>
</widget>
</widget>
<widget class="QTabWidget" name="responseInspectorTabs">
<property name="currentIndex">
<number>1</number>
<number>2</number>
</property>
<widget class="QWidget" name="responseInspectorTextView">
<attribute name="title">
Expand All @@ -101,8 +101,8 @@ background:#dddfe2;
<rect>
<x>0</x>
<y>0</y>
<width>523</width>
<height>164</height>
<width>43</width>
<height>40</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
Expand Down Expand Up @@ -131,7 +131,7 @@ background:#dddfe2;
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>替换规则</string>
<string>Rules</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
Expand All @@ -147,7 +147,7 @@ background:#dddfe2;
</widget>
<widget class="QWidget" name="tab_3">
<attribute name="title">
<string>composer</string>
<string>Composer</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
Expand Down Expand Up @@ -198,10 +198,10 @@ background:#dddfe2;
<normalon>:/remove.png</normalon>:/remove.png</iconset>
</property>
<property name="text">
<string>清除</string>
<string>Clear All</string>
</property>
<property name="toolTip">
<string>清除所有</string>
<string>Clear All</string>
</property>
<property name="iconVisibleInMenu">
<bool>true</bool>
Expand All @@ -217,7 +217,10 @@ background:#dddfe2;
<normalon>:/static/img16.png</normalon>:/static/img13.png</iconset>
</property>
<property name="text">
<string>开始抓包</string>
<string>Begein Capture</string>
</property>
<property name="toolTip">
<string>Begein Capture</string>
</property>
</action>
<action name="actionWaterfall">
Expand All @@ -229,10 +232,10 @@ background:#dddfe2;
<normaloff>:/static/img11.png</normaloff>:/static/img11.png</iconset>
</property>
<property name="text">
<string>瀑布图</string>
<string>water fall</string>
</property>
<property name="toolTip">
<string>瀑布图</string>
<string>water fall</string>
</property>
</action>
<action name="actionLongCache">
Expand All @@ -244,10 +247,10 @@ background:#dddfe2;
<normaloff>:/static/img10.png</normaloff>:/static/img10.png</iconset>
</property>
<property name="text">
<string>长缓存</string>
<string>long cache</string>
</property>
<property name="toolTip">
<string>被替换内容设置长时间缓存</string>
<string>set sessions matching rule with long cache</string>
</property>
<property name="visible">
<bool>true</bool>
Expand Down
2 changes: 1 addition & 1 deletion quazip/quazipfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ void QuaZipFilePrivate::setZipError(int zipError) const
if(zipError==UNZ_OK)
q->setErrorString(QString());
else
q->setErrorString(q->tr("ZIP/UNZIP API error %1").arg(zipError));
q->setErrorString(QString("ZIP/UNZIP API error %1").arg(zipError));
}

bool QuaZipFile::open(OpenMode mode)
Expand Down
Binary file added rythem_zh_CN.qm
Binary file not shown.
Loading

0 comments on commit 28ab87f

Please sign in to comment.