305 lines
16 KiB
Diff
305 lines
16 KiB
Diff
diff --color -Naur a/3rdparty/terminalwidget/lib/Filter.cpp b/3rdparty/terminalwidget/lib/Filter.cpp
|
||
--- a/3rdparty/terminalwidget/lib/Filter.cpp 2022-02-08 16:21:57.110358654 +0800
|
||
+++ b/3rdparty/terminalwidget/lib/Filter.cpp 2022-02-09 09:50:21.961364713 +0800
|
||
@@ -139,7 +139,7 @@
|
||
bool isContainOtherPromptEnd(QString promptLine, QString currPromptEnd)
|
||
{
|
||
//四不同类型的提示符结尾字符
|
||
- QString promptEnds = QString("$#%>");
|
||
+ QString promptEnds = QString(QLatin1String("$#%>"));
|
||
promptEnds.remove(currPromptEnd);
|
||
|
||
for (int i=0; i<promptEnds.length(); i++)
|
||
@@ -178,7 +178,7 @@
|
||
QTextStream lineStream(_buffer);
|
||
decoder.begin(&lineStream);
|
||
|
||
- QString lastLine = "";
|
||
+ QString lastLine = QLatin1String("");
|
||
for (int i = 0 ; i < lines ; i++) {
|
||
_linePositions->append(_buffer->length());
|
||
decoder.decodeLine(image + i * columns, columns, LINE_DEFAULT);
|
||
@@ -208,7 +208,7 @@
|
||
if (lastLine.length() > 0) {
|
||
//优化了截取并保存当前shell提示符的判断,暂时没有考虑PS1被修改的情况(若考虑的话实现起来太复杂)
|
||
//目前针对sh/bash/csh/tcsh/ksh/zsh这几种类型的shell做了处理
|
||
- QString promptEnds = QString("$#%>");
|
||
+ QString promptEnds = QString(QLatin1String("$#%>"));
|
||
for (int i=0; i<promptEnds.length(); i++) {
|
||
QString promptEnd = promptEnds.at(i);
|
||
|
||
@@ -223,15 +223,15 @@
|
||
|
||
QString strShellPrompt = SessionManager::instance()->getCurrShellPrompt(_sessionId);
|
||
|
||
- bool isRootUser = strShellPrompt.endsWith("#");
|
||
+ bool isRootUser = strShellPrompt.endsWith(QLatin1String("#"));
|
||
|
||
QString strCurrBuffer = (*_buffer).trimmed();
|
||
if (strCurrBuffer.length() > 0) {
|
||
//获取并保存当前正在输入的命令
|
||
if (isRootUser) {
|
||
QString strCommand = strCurrBuffer.split(strShellPrompt).last();
|
||
- if (!strCommand.contains("sudo ")) {
|
||
- strCommand = QString("sudo %1").arg(strCommand);
|
||
+ if (!strCommand.contains(QLatin1String("sudo "))) {
|
||
+ strCommand = QString(QLatin1String("sudo %1")).arg(strCommand);
|
||
}
|
||
SessionManager::instance()->saveCurrShellCommand(_sessionId, strCommand);
|
||
} else {
|
||
diff --color -Naur a/3rdparty/terminalwidget/lib/HistorySearch.cpp b/3rdparty/terminalwidget/lib/HistorySearch.cpp
|
||
--- a/3rdparty/terminalwidget/lib/HistorySearch.cpp 2022-02-08 16:21:57.110358654 +0800
|
||
+++ b/3rdparty/terminalwidget/lib/HistorySearch.cpp 2022-02-09 10:43:27.025143314 +0800
|
||
@@ -144,11 +144,11 @@
|
||
存在特殊情况:一个完整的物理行显示在终端被分成多个逻辑行
|
||
*/
|
||
//中文字符正则表达式
|
||
- QRegExp regEx("[\u4E00-\u9FA5,《。》、?;:【】~!¥()]+");
|
||
+ QRegExp regEx(QLatin1String("[\u4E00-\u9FA5,《。》、?;:【】~!¥()]+"));
|
||
|
||
//未匹配的串-物理行开始和结束位置
|
||
int loseEnd = matchStart;
|
||
- int loseStart = string.lastIndexOf('\n', loseEnd) + 1;
|
||
+ int loseStart = string.lastIndexOf(QLatin1Char('\n'), loseEnd) + 1;
|
||
//qDebug() << "loseStart" << loseStart << "loseEnd" << loseEnd ;
|
||
|
||
// if (loseStart < 0 || loseStart > loseEnd) {
|
||
diff --color -Naur a/3rdparty/terminalwidget/lib/Pty.cpp b/3rdparty/terminalwidget/lib/Pty.cpp
|
||
--- a/3rdparty/terminalwidget/lib/Pty.cpp 2022-02-08 16:21:57.110358654 +0800
|
||
+++ b/3rdparty/terminalwidget/lib/Pty.cpp 2022-02-09 10:42:26.384994711 +0800
|
||
@@ -280,7 +280,7 @@
|
||
|
||
bool Pty::isTerminalRemoved()
|
||
{
|
||
- QFile terminalExecFile("/usr/bin/deepin-terminal");
|
||
+ QFile terminalExecFile(QLatin1String("/usr/bin/deepin-terminal"));
|
||
if (terminalExecFile.exists()) {
|
||
return false;
|
||
}
|
||
@@ -305,13 +305,13 @@
|
||
//判断当前命令是否是要删除终端
|
||
bool Pty::bWillRemoveTerminal(QString strCommand)
|
||
{
|
||
- QString packageName = "deepin-terminal";
|
||
+ QString packageName = QLatin1String("deepin-terminal");
|
||
|
||
QStringList strCommandList;
|
||
strCommandList.append(strCommand);
|
||
|
||
- if (strCommand.contains("&&")) {
|
||
- QStringList cmdList = strCommand.split("&&");
|
||
+ if (strCommand.contains(QLatin1String("&&"))) {
|
||
+ QStringList cmdList = strCommand.split(QLatin1String("&&"));
|
||
for (int i = 0; i < cmdList.size(); i++) {
|
||
QString currCmd = cmdList.at(i).trimmed();
|
||
if (currCmd.length() > 0 && currCmd.contains(packageName)) {
|
||
@@ -320,8 +320,8 @@
|
||
}
|
||
}
|
||
|
||
- if (strCommand.contains(";")) {
|
||
- QStringList cmdList = strCommand.split(";");
|
||
+ if (strCommand.contains(QLatin1String(";"))) {
|
||
+ QStringList cmdList = strCommand.split(QLatin1String(";"));
|
||
for (int i = 0; i < cmdList.size(); i++) {
|
||
QString currCmd = cmdList.at(i).trimmed();
|
||
if (currCmd.length() > 0 && currCmd.contains(packageName)) {
|
||
@@ -339,23 +339,23 @@
|
||
QString strCurrCommand = strCommandList.at(i);
|
||
for (int j = 0; j < packageNameList.size(); j++) {
|
||
QString packageName = packageNameList.at(j);
|
||
- QString removePattern = QString("sudo\\s+apt-get\\s+remove\\s+%1").arg(packageName);
|
||
+ QString removePattern = QString(QLatin1String("sudo\\s+apt-get\\s+remove\\s+%1")).arg(packageName);
|
||
acceptableList << isPatternAcceptable(strCurrCommand, removePattern);
|
||
|
||
- removePattern = QString("sudo\\s+apt\\s+remove\\s+%1").arg(packageName);
|
||
+ removePattern = QString(QLatin1String("sudo\\s+apt\\s+remove\\s+%1")).arg(packageName);
|
||
acceptableList << isPatternAcceptable(strCurrCommand, removePattern);
|
||
/******** Modify by nt001000 renfeixiang 2020-05-27:修改 放到bWillPurgeTerminal函数中 Begin***************/
|
||
// removePattern = QString("sudo\\s+dpkg\\s+-P\\s+%1").arg(packageName);
|
||
// acceptableList << isPatternAcceptable(strCurrCommand, removePattern);
|
||
/******** Modify by nt001000 renfeixiang 2020-05-27:修改 放到bWillPurgeTerminal函数中 End***************/
|
||
|
||
- removePattern = QString("sudo\\s+dpkg\\s+-r\\s+%1").arg(packageName);
|
||
+ removePattern = QString(QLatin1String("sudo\\s+dpkg\\s+-r\\s+%1")).arg(packageName);
|
||
acceptableList << isPatternAcceptable(strCurrCommand, removePattern);
|
||
|
||
- removePattern = QString("sudo\\s+rm\\s+.+\\s+/usr/bin/deepin-terminal");
|
||
+ removePattern = QString(QLatin1String("sudo\\s+rm\\s+.+\\s+/usr/bin/deepin-terminal"));
|
||
acceptableList << isPatternAcceptable(strCurrCommand, removePattern);
|
||
|
||
- removePattern = QString("sudo\\s+rm\\s+/usr/bin/deepin-terminal");
|
||
+ removePattern = QString(QLatin1String("sudo\\s+rm\\s+/usr/bin/deepin-terminal"));
|
||
acceptableList << isPatternAcceptable(strCurrCommand, removePattern);
|
||
}
|
||
}
|
||
@@ -366,13 +366,13 @@
|
||
/******** Add by nt001000 renfeixiang 2020-05-27:增加 Purge卸载命令的判断,显示不同的卸载提示框 Begin***************/
|
||
bool Pty::bWillPurgeTerminal(QString strCommand)
|
||
{
|
||
- QString packageName = "deepin-terminal";
|
||
+ QString packageName = QLatin1String("deepin-terminal");
|
||
|
||
QStringList strCommandList;
|
||
strCommandList.append(strCommand);
|
||
|
||
- if (strCommand.contains("&&")) {
|
||
- QStringList cmdList = strCommand.split("&&");
|
||
+ if (strCommand.contains(QLatin1String("&&"))) {
|
||
+ QStringList cmdList = strCommand.split(QLatin1String("&&"));
|
||
for (int i = 0; i < cmdList.size(); i++) {
|
||
QString currCmd = cmdList.at(i).trimmed();
|
||
if (currCmd.length() > 0 && currCmd.contains(packageName)) {
|
||
@@ -381,8 +381,8 @@
|
||
}
|
||
}
|
||
|
||
- if (strCommand.contains(";")) {
|
||
- QStringList cmdList = strCommand.split(";");
|
||
+ if (strCommand.contains(QLatin1String(";"))) {
|
||
+ QStringList cmdList = strCommand.split(QLatin1String(";"));
|
||
for (int i = 0; i < cmdList.size(); i++) {
|
||
QString currCmd = cmdList.at(i).trimmed();
|
||
if (currCmd.length() > 0 && currCmd.contains(packageName)) {
|
||
@@ -400,31 +400,31 @@
|
||
QString strCurrCommand = strCommandList.at(i);
|
||
for (int j = 0; j < packageNameList.size(); j++) {
|
||
QString packageName = packageNameList.at(j);
|
||
- QString removePattern = QString("sudo\\s+apt-get\\s+purge\\s+%1").arg(packageName);
|
||
+ QString removePattern = QString(QLatin1String("sudo\\s+apt-get\\s+purge\\s+%1")).arg(packageName);
|
||
acceptableList << isPatternAcceptable(strCurrCommand, removePattern);
|
||
|
||
- removePattern = QString("sudo\\s+apt-get\\s+purge\\s+-y\\s+%1").arg(packageName);
|
||
+ removePattern = QString(QLatin1String("sudo\\s+apt-get\\s+purge\\s+-y\\s+%1")).arg(packageName);
|
||
acceptableList << isPatternAcceptable(strCurrCommand, removePattern);
|
||
|
||
- removePattern = QString("sudo\\s+apt-get\\s+remove\\s+--purge\\s+%1").arg(packageName);
|
||
+ removePattern = QString(QLatin1String("sudo\\s+apt-get\\s+remove\\s+--purge\\s+%1")).arg(packageName);
|
||
acceptableList << isPatternAcceptable(strCurrCommand, removePattern);
|
||
|
||
- removePattern = QString("sudo\\s+apt-get\\s+--purge\\s+remove\\s+%1").arg(packageName);
|
||
+ removePattern = QString(QLatin1String("sudo\\s+apt-get\\s+--purge\\s+remove\\s+%1")).arg(packageName);
|
||
acceptableList << isPatternAcceptable(strCurrCommand, removePattern);
|
||
|
||
- removePattern = QString("sudo\\s+apt\\s+purge\\s+%1").arg(packageName);
|
||
+ removePattern = QString(QLatin1String("sudo\\s+apt\\s+purge\\s+%1")).arg(packageName);
|
||
acceptableList << isPatternAcceptable(strCurrCommand, removePattern);
|
||
|
||
- removePattern = QString("sudo\\s+apt\\s+purge\\s+-y\\s+%1").arg(packageName);
|
||
+ removePattern = QString(QLatin1String("sudo\\s+apt\\s+purge\\s+-y\\s+%1")).arg(packageName);
|
||
acceptableList << isPatternAcceptable(strCurrCommand, removePattern);
|
||
|
||
- removePattern = QString("sudo\\s+apt\\s+remove\\s+--purge\\s+%1").arg(packageName);
|
||
+ removePattern = QString(QLatin1String("sudo\\s+apt\\s+remove\\s+--purge\\s+%1")).arg(packageName);
|
||
acceptableList << isPatternAcceptable(strCurrCommand, removePattern);
|
||
|
||
- removePattern = QString("sudo\\s+apt\\s+--purge\\s+remove\\s+%1").arg(packageName);
|
||
+ removePattern = QString(QLatin1String("sudo\\s+apt\\s+--purge\\s+remove\\s+%1")).arg(packageName);
|
||
acceptableList << isPatternAcceptable(strCurrCommand, removePattern);
|
||
|
||
- removePattern = QString("sudo\\s+dpkg\\s+-P\\s+%1").arg(packageName);
|
||
+ removePattern = QString(QLatin1String("sudo\\s+dpkg\\s+-P\\s+%1")).arg(packageName);
|
||
acceptableList << isPatternAcceptable(strCurrCommand, removePattern);
|
||
}
|
||
}
|
||
@@ -441,7 +441,7 @@
|
||
|
||
bool isCustomCommand = false;
|
||
QString currCommand = QString::fromLatin1(data);
|
||
- if (currCommand.length() > 0 && currCommand.endsWith('\n')) {
|
||
+ if (currCommand.length() > 0 && currCommand.endsWith(QLatin1Char('\n'))) {
|
||
isCustomCommand = true;
|
||
}
|
||
|
||
@@ -457,9 +457,9 @@
|
||
bool bRemoveTerminal = bWillRemoveTerminal(strCurrCommand);
|
||
|
||
if (!isTerminalRemoved() && (bPurgeTerminal || bRemoveTerminal)) {
|
||
- QString strname = "remove";
|
||
+ QString strname = QLatin1String("remove");
|
||
if (bPurgeTerminal) {
|
||
- strname = "purge";
|
||
+ strname = QLatin1String("purge");
|
||
}
|
||
QMetaObject::invokeMethod(this, "ptyUninstallTerminal", Qt::AutoConnection, Q_RETURN_ARG(bool, _bUninstall), Q_ARG(QString, strname));
|
||
/******** Modify by nt001000 renfeixiang 2020-05-27:修改 根据remove和purge卸载命令,发送信号不同参数值 End***************/
|
||
@@ -494,25 +494,25 @@
|
||
{
|
||
QByteArray data = pty()->readAll();
|
||
|
||
- QString recvData = QString(data);
|
||
+ QString recvData = QString(QLatin1String(data));
|
||
|
||
/******** Modify by m000714 daizhengwen 2020-04-30: 处理上传下载时乱码显示命令不执行****************/
|
||
// 乱码提示信息不显示
|
||
- if (recvData.contains("bash: $'\\212")
|
||
- || recvData.contains("bash: **0800000000022d:")
|
||
- || recvData.contains("**^XB0800000000022d")
|
||
- || recvData.startsWith("**\u0018B0800000000022d\r\u008A")) {
|
||
+ if (recvData.contains(QLatin1String("bash: $'\\212"))
|
||
+ || recvData.contains(QLatin1String("bash: **0800000000022d:"))
|
||
+ || recvData.contains(QLatin1String("**^XB0800000000022d"))
|
||
+ || recvData.startsWith(QLatin1String("**\u0018B0800000000022d\r\u008A"))) {
|
||
return;
|
||
}
|
||
|
||
// "\u008A"这个乱码不替换调会导致显示时有\b的效果导致命令错乱bug#23741
|
||
- if (recvData.contains("\u008A")) {
|
||
- recvData.replace("\u008A", "\b \b #");
|
||
+ if (recvData.contains(QLatin1String("\u008A"))) {
|
||
+ recvData.replace(QLatin1String("\u008A"), QLatin1String("\b \b #"));
|
||
data = recvData.toUtf8();
|
||
}
|
||
|
||
- if (recvData == "rz waiting to receive.") {
|
||
- recvData += "\r\n";
|
||
+ if (recvData == QLatin1String("rz waiting to receive.")) {
|
||
+ recvData += QLatin1String("\r\n");
|
||
data = recvData.toUtf8();
|
||
}
|
||
/********************* Modify by m000714 daizhengwen End ************************/
|
||
diff --color -Naur a/3rdparty/terminalwidget/lib/Session.cpp b/3rdparty/terminalwidget/lib/Session.cpp
|
||
--- a/3rdparty/terminalwidget/lib/Session.cpp 2022-02-08 16:21:57.114358607 +0800
|
||
+++ b/3rdparty/terminalwidget/lib/Session.cpp 2022-02-09 10:09:17.013232912 +0800
|
||
@@ -320,8 +320,8 @@
|
||
|
||
if (result < 0) {
|
||
//qDebug() << "CRASHED! result: " << result<<arguments;
|
||
- QString infoText = QString("There was an error ctreating the child processfor this teminal. \n"
|
||
- "Faild to execute child process \"%1\"(No such file or directory)!").arg(exec);
|
||
+ QString infoText = QString(QLatin1String("There was an error ctreating the child processfor this teminal. \n"
|
||
+ "Faild to execute child process \"%1\"(No such file or directory)!")).arg(exec);
|
||
sendText(infoText);
|
||
_userTitle = QString::fromLatin1("Session crashed");
|
||
emit titleChanged();
|
||
@@ -468,7 +468,7 @@
|
||
void Session::activityStateSet(int state)
|
||
{
|
||
if (state==NOTIFYBELL) {
|
||
- emit bellRequest(QString("Bell in session '%1'").arg(_nameTitle));
|
||
+ emit bellRequest(QString(QLatin1String("Bell in session '%1'")).arg(_nameTitle));
|
||
} else if (state==NOTIFYACTIVITY) {
|
||
if (_monitorSilence) {
|
||
_monitorTimer->start(_silenceSeconds*1000);
|
||
@@ -642,7 +642,7 @@
|
||
if (exitStatus == -1){
|
||
infoText.sprintf("There was an error ctreating the child processfor this teminal. \n"
|
||
"Faild to execute child process \"%s\"(No such file or directory)!", _program.toUtf8().data());
|
||
- message = "Session crashed.";
|
||
+ message = QLatin1String("Session crashed.");
|
||
}
|
||
else {
|
||
infoText.sprintf("The child process exit normally with status %d.", exitStatus);
|
||
diff --color -Naur a/3rdparty/terminalwidget/lib/TerminalDisplay.cpp b/3rdparty/terminalwidget/lib/TerminalDisplay.cpp
|
||
--- a/3rdparty/terminalwidget/lib/TerminalDisplay.cpp 2022-02-08 16:21:57.114358607 +0800
|
||
+++ b/3rdparty/terminalwidget/lib/TerminalDisplay.cpp 2022-02-09 10:07:31.376887287 +0800
|
||
@@ -447,7 +447,7 @@
|
||
/******** Modify by ut000439 wangpeili 2020-06-24: 适应窗口特效圆角 ****************/
|
||
//qDebug()<<"_scrollBar->width()"<<_scrollBar->width();
|
||
// 设置15px宽度=6?
|
||
- _scrollBar->setStyleSheet("margin: 0px 0 15px 0;width: 15");
|
||
+ _scrollBar->setStyleSheet(QLatin1String("margin: 0px 0 15px 0;width: 15"));
|
||
//qDebug()<<"_scrollBar->width()"<<_scrollBar->width();
|
||
/********************* Modify by n014361 wangpeili End ************************/
|
||
|