Skip to content

Commit

Permalink
Fix Zmodem issue
Browse files Browse the repository at this point in the history
Signed-off-by: xiaoming <[email protected]>
  • Loading branch information
QQxiaoming committed Mar 18, 2024
1 parent 0b6adcd commit 5dea12e
Show file tree
Hide file tree
Showing 34 changed files with 149 additions and 94 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ Protocol selection interface:
- HEX display
- Terminal background image configuration
- Terminal scroll line configuration
- Support x\y\zmodem protocol
- Support dark/light theme
- Support multiple languages (Simple Chinese/Traditional Chinese/English/Japanese/Korean/Spanish/French/Russian/German/Portuguese (Brazil)/Czech/Arabic)

Expand Down Expand Up @@ -91,14 +92,12 @@ Protocol selection interface:

## Planned features

- [x] Support xyzmodem protocol
- [ ] Support operation script recording/loading
- [ ] Support screen recording
- [ ] session status query
- [ ] Terminal style customization
- [ ] Independent session set terminal appearance
- [ ] GitHub Copilot plugin support
- [x] CI support Appimage package
- [ ] CI support windows on arm64

## Translation
Expand Down
3 changes: 1 addition & 2 deletions README_ja_JP.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ quardCRT は、複数のバックエンド プロトコルをサポートし、
- HEX 表示
- ターミナル背景画像の構成
- ターミナル スクロール行の構成
- x\y\zmodemプロトコルをサポート
- ダーク/ライト テーマのサポート
- 複数言語のサポート (簡体字中国語/繁体字中国語/英語/日本語/韓国語/スペイン語/フランス語/ロシア語/ドイツ語/ポルトガル語(ブラジル)/チェコ語/アラビア語)

Expand Down Expand Up @@ -90,14 +91,12 @@ quardCRT は、複数のバックエンド プロトコルをサポートし、

## 計画された機能

- [x] xyzmodemプロトコルをサポート
- [ ] 操作スクリプトの記録/ロードをサポート
- [ ] スクリーン録画をサポート
- [ ] セッション状態のクエリ
- [ ] ターミナル スタイルのカスタマイズ
- [ ] 独立したセッションはターミナルの外観を設定します
- [ ] GitHub Copilot プラグインのサポート
- [x] CI サポート Appimage パッケージ
- [ ] CI サポート windows on arm64

## 翻訳
Expand Down
3 changes: 1 addition & 2 deletions README_zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ quardCRT一款多功能终端仿真/图形桌面软件,支持多种后端协
- HEX显示
- 终端背景图片配置
- 终端滚动行数设置
- x\y\zmodem协议支持
- 支持深色/浅色主题
- UI支持多语言(简体中文/繁体中文/英语/日语/韩语/西班牙语/法语/俄语/德语/葡萄牙语(巴西)/捷克语/阿拉伯语)

Expand Down Expand Up @@ -90,14 +91,12 @@ quardCRT一款多功能终端仿真/图形桌面软件,支持多种后端协

## 计划中特性

- [x] xyzmodem协议支持
- [ ] 支持操作脚本录制/加载
- [ ] 支持终端显示录制
- [ ] 会话状态查询
- [ ] 终端样式自定义
- [ ] 独立会话设置终端外观
- [ ] GitHub Copilot插件支持
- [x] CI支持Appimage包
- [ ] CI支持windows on arm64

## 翻译
Expand Down
3 changes: 1 addition & 2 deletions README_zh_HK.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ quardCRT一款多功能終端模擬/圖形桌面軟體,支援多種後端協
- HEX顯示
- 終端背景圖片配置
- 終端滾動行數設置
- x\y\zmodem協議支持
- 支持深色/淺色主題
- UI支持多語言(簡體中文/繁體中文/英語/日語/韓語/西班牙語/法語/俄語/德語/葡萄牙語(巴西)/捷克語/阿拉伯語)

Expand Down Expand Up @@ -90,14 +91,12 @@ quardCRT一款多功能終端模擬/圖形桌面軟體,支援多種後端協

## 計劃中特性

- [x] xyzmodem協議支持
- [ ] 支持操作腳本錄制/加載
- [ ] 支持終端顯示錄制
- [ ] 會話狀態查詢
- [ ] 終端樣式自定義
- [ ] 獨立會話設置終端外觀
- [ ] GitHub Copilot插件支持
- [x] CI支持Appimage包
- [ ] CI支持windows on arm64

## 翻譯
Expand Down
18 changes: 18 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,24 @@ Window configuration includes the window settings of QuardCRT.

The transparency of the entire application window, the value range is 0-100, 0 means completely transparent, 100 means completely opaque.

### Transfer

- Upload Directory

The default upload directory of the file transfer function, which is the directory where the file is uploaded by default when the user uses the file transfer function.

- Download Directory

The default download directory of the file transfer function, which is the directory where the file is downloaded by default when the user uses the file transfer function.

- X/Ymodem Send Packet Size

The size of the data packet sent by X/Ymodem, the default value is 128.

- Zmodem Online

Check to indicate that Zmodem is online, and the file transfer function will use Zmodem to transfer files.

### Advanced

Advanced configuration includes some advanced settings of QuardCRT.
Expand Down
2 changes: 1 addition & 1 deletion docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

If you have suggestions or ideas for this project, please submit issues and pull requests on GitHub or Gitee.

If you want to improve/fix the known issues, you can check [TODO](./TODO.md).
If you want to improve/fix the known issues, you can check [TODO](https://github.com/QQxiaoming/quardCRT/blob/main/TODO.md).

The current project is recommended to use version Qt6.5.0 and above.
3 changes: 2 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,14 @@ Features
----------------------------------

- **Cross-platform**: Windows, MacOS, Linux
- **Multiple protocols**: SSH, Telnet, SFTP, Serial, VNC, LocalShell, RawSocket, NamedPipe
- **Multiple protocols**: SSH, Telnet, Serial, LocalShell, RawSocket, NamedPipe, VNC
- **Multiple sessions**: Multi-tab, multi-window, multi-monitor, floating window
- **Multiple languages**: English, Simple Chinese, Traditional Chinese, Japanese, Korean, Spanish, French, Russian, German, Portuguese (Brazil), Czech, Arabic
- **Multiple themes**: Light, Dark
- **Session history management**: Session history management, session history search
- **Session management**: Session management, session import and export
- **HEX display**: HEX display
- **File transfer**: SFTP, Xmodem, Ymodem, Zmodem, Kermit
- **Script**: Script recording, script playback
- **Terminal customization**: Terminal font, color, size, cursor, scrollback, background, etc.

Expand Down
2 changes: 2 additions & 0 deletions lib/qtermwidget/Emulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,11 @@ void Emulation::receiveData(const char* text, int length)
{
if (text[i] == '\030')
{
// ZRQINIT 0 Request receive init
if ((length-i-1 > 3) && (strncmp(text+i+1, "B00", 3) == 0)) {
emit zmodemSendDetected();
}
// ZRINIT 1 Receive init
if ((length-i-1 > 5) && (strncmp(text+i+1, "B0100", 5) == 0)) {
emit zmodemRecvDetected();
}
Expand Down
12 changes: 6 additions & 6 deletions lib/qtssh/sshclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ void SshClient::_ssh_processEvent()
setSshState(SshState::WaitingSocketConnection);
}

FALLTHROUGH; case SshState::WaitingSocketConnection:
SSH2FALLTHROUGH(); case SshState::WaitingSocketConnection:
{
return;
}
Expand Down Expand Up @@ -401,7 +401,7 @@ void SshClient::_ssh_processEvent()
setSshState(SshState::HandShake);
}

FALLTHROUGH; case SshState::HandShake:
SSH2FALLTHROUGH(); case SshState::HandShake:
{
int ret = libssh2_session_handshake(m_session, static_cast<int>(m_socket.socketDescriptor()));
if(ret == LIBSSH2_ERROR_EAGAIN)
Expand Down Expand Up @@ -447,7 +447,7 @@ void SshClient::_ssh_processEvent()
setSshState(SshState::GetAuthenticationMethodes);
}

FALLTHROUGH; case SshState::GetAuthenticationMethodes:
SSH2FALLTHROUGH(); case SshState::GetAuthenticationMethodes:
{
if(m_authenticationMethodes.length() == 0)
{
Expand All @@ -474,7 +474,7 @@ void SshClient::_ssh_processEvent()
setSshState(SshState::Authentication);
}

FALLTHROUGH; case SshState::Authentication:
SSH2FALLTHROUGH(); case SshState::Authentication:
{
while(m_authenticationMethodes.length() != 0)
{
Expand Down Expand Up @@ -555,7 +555,7 @@ void SshClient::_ssh_processEvent()
setSshState(SshState::Error);
return;
}
FALLTHROUGH;
SSH2FALLTHROUGH();
}

case SshState::Ready:
Expand Down Expand Up @@ -617,7 +617,7 @@ void SshClient::_ssh_processEvent()
}
}

FALLTHROUGH; case SshState::FreeSession:
SSH2FALLTHROUGH(); case SshState::FreeSession:
{
m_keepalive.stop();
if (m_knownHosts)
Expand Down
20 changes: 14 additions & 6 deletions lib/qtssh/sshclient.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,22 @@
#include "sshkey.h"
#include <QSharedPointer>

#ifndef FALLTHROUGH
#if __has_cpp_attribute(fallthrough)
#define FALLTHROUGH [[fallthrough]]
#elif __has_cpp_attribute(clang::fallthrough)
#define FALLTHROUGH [[clang::fallthrough]]
#ifdef __has_cpp_attribute
# define SSH2_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x)
#else
#define FALLTHROUGH
# define SSH2_HAS_CPP_ATTRIBUTE(x) 0
#endif
#if defined(__cplusplus)
#if SSH2_HAS_CPP_ATTRIBUTE(clang::fallthrough)
# define SSH2FALLTHROUGH() [[clang::fallthrough]]
#elif SSH2_HAS_CPP_ATTRIBUTE(gnu::fallthrough)
# define SSH2FALLTHROUGH() [[gnu::fallthrough]]
#elif SSH2_HAS_CPP_ATTRIBUTE(fallthrough)
# define SSH2FALLTHROUGH() [[fallthrough]]
#endif
#endif
#ifndef SSH2FALLTHROUGH
# define SSH2FALLTHROUGH() (void)0
#endif

Q_DECLARE_LOGGING_CATEGORY(sshclient)
Expand Down
10 changes: 5 additions & 5 deletions lib/qtssh/sshprocess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void SshProcess::sshDataReceived()
setChannelState(ChannelState::Exec);
}

FALLTHROUGH; case Exec:
SSH2FALLTHROUGH(); case Exec:
{
if(m_cmd.size() == 0)
{
Expand Down Expand Up @@ -106,7 +106,7 @@ void SshProcess::sshDataReceived()
/* OK, next step */
}

FALLTHROUGH; case Ready:
SSH2FALLTHROUGH(); case Ready:
{
ssize_t retsz;
char buffer[16*1024];
Expand Down Expand Up @@ -170,7 +170,7 @@ void SshProcess::sshDataReceived()
}
}

FALLTHROUGH; case Close:
SSH2FALLTHROUGH(); case Close:
{
qCDebug(logsshprocess) << "closeChannel:" << m_name;
int ret = libssh2_channel_close(m_sshChannel);
Expand All @@ -191,7 +191,7 @@ void SshProcess::sshDataReceived()
setChannelState(ChannelState::WaitClose);
}

FALLTHROUGH; case WaitClose:
SSH2FALLTHROUGH(); case WaitClose:
{
qCDebug(logsshprocess) << "Wait close channel:" << m_name;
int ret = libssh2_channel_wait_closed(m_sshChannel);
Expand All @@ -212,7 +212,7 @@ void SshProcess::sshDataReceived()
setChannelState(ChannelState::Freeing);
}

FALLTHROUGH; case Freeing:
SSH2FALLTHROUGH(); case Freeing:
{
qCDebug(logsshprocess) << "free Channel:" << m_name;

Expand Down
10 changes: 5 additions & 5 deletions lib/qtssh/sshscpget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void SshScpGet::sshDataReceived()
setChannelState(ChannelState::Exec);
}

FALLTHROUGH; case Exec:
SSH2FALLTHROUGH(); case Exec:
{
m_file.setFileName(m_dest);
if(!m_file.open(QIODevice::WriteOnly))
Expand All @@ -88,7 +88,7 @@ void SshScpGet::sshDataReceived()
/* OK, next step */
}

FALLTHROUGH; case Ready:
SSH2FALLTHROUGH(); case Ready:
{
while(m_got < m_fileinfo.st_size)
{
Expand Down Expand Up @@ -126,7 +126,7 @@ void SshScpGet::sshDataReceived()
setChannelState(ChannelState::Close);
}

FALLTHROUGH; case Close:
SSH2FALLTHROUGH(); case Close:
{
m_file.close();
if(m_got != m_fileinfo.st_size)
Expand Down Expand Up @@ -158,7 +158,7 @@ void SshScpGet::sshDataReceived()
setChannelState(ChannelState::WaitClose);
}

FALLTHROUGH; case WaitClose:
SSH2FALLTHROUGH(); case WaitClose:
{
qCDebug(logscpget) << "Wait close channel:" << m_name;
int ret = libssh2_channel_wait_closed(m_sshChannel);
Expand All @@ -178,7 +178,7 @@ void SshScpGet::sshDataReceived()
setChannelState(ChannelState::Freeing);
}

FALLTHROUGH; case Freeing:
SSH2FALLTHROUGH(); case Freeing:
{
qCDebug(logscpget) << "free Channel:" << m_name;

Expand Down
10 changes: 5 additions & 5 deletions lib/qtssh/sshscpsend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void SshScpSend::sshDataReceived()
setChannelState(ChannelState::Exec);
}

FALLTHROUGH; case Exec:
SSH2FALLTHROUGH(); case Exec:
{
m_file.setFileName(m_source);
if(!m_file.open(QIODevice::ReadOnly))
Expand All @@ -85,7 +85,7 @@ void SshScpSend::sshDataReceived()
/* OK, next step */
}

FALLTHROUGH; case Ready:
SSH2FALLTHROUGH(); case Ready:
{
while(!m_file.atEnd())
{
Expand Down Expand Up @@ -125,7 +125,7 @@ void SshScpSend::sshDataReceived()
setChannelState(ChannelState::Close);
}

FALLTHROUGH; case Close:
SSH2FALLTHROUGH(); case Close:
{
m_file.close();
if(m_sent != m_file.size())
Expand Down Expand Up @@ -156,7 +156,7 @@ void SshScpSend::sshDataReceived()
setChannelState(ChannelState::WaitClose);
}

FALLTHROUGH; case WaitClose:
SSH2FALLTHROUGH(); case WaitClose:
{
qCDebug(logscpsend) << "Wait close channel:" << m_name;
int ret = libssh2_channel_wait_closed(m_sshChannel);
Expand All @@ -176,7 +176,7 @@ void SshScpSend::sshDataReceived()
setChannelState(ChannelState::Freeing);
}

FALLTHROUGH; case Freeing:
SSH2FALLTHROUGH(); case Freeing:
{
qCDebug(logscpsend) << "free Channel:" << m_name;

Expand Down
Loading

0 comments on commit 5dea12e

Please sign in to comment.