Skip to content

Commit

Permalink
v9.28.13
Browse files Browse the repository at this point in the history
[VNC]选项卡菜单增加智能拉伸入口。
[许可证]兑换码潜在旧许可证时长没有累计BUG修改。
[会话修改]会话属性重构,支持多个平台下的属性同时存在。不管何处修改,均可设置为影响全局。
[会话管理]会话增加复制并编辑的特性,最终并定位目标的功能。
[会话导入]增加Securecrt的备份文件导入。
[SSH会话]SSH右键菜单增加SFTP独立选项卡入口。
[文本终端]优化右键和拖动的文件复制和粘贴,使其直接影响系统剪贴板。
[文本终端]修复查找内容时,向上/下搜索时,内容不存在时而崩溃的缺陷。
[文本终端]修复中文字选框不正确的缺陷。
[云备份]优化云备份文件按时间新旧排序。
  • Loading branch information
getwingm committed Sep 28, 2023
1 parent 8de476f commit 781f34d
Show file tree
Hide file tree
Showing 64 changed files with 1,597 additions and 706 deletions.
13 changes: 13 additions & 0 deletions kxterm/qkxsearch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "ui_qkxsearch.h"

#include "qkxtermitem.h"
#include <QTimer>

QKxSearch::QKxSearch(QKxTermItem *term, QWidget *parent) :
QWidget(parent),
Expand Down Expand Up @@ -60,3 +61,15 @@ void QKxSearch::onTextChanged(const QString &txt)
{
m_term->find(txt, ui->ascase->isChecked(), ui->regular->isChecked());
}

void QKxSearch::showEvent(QShowEvent *ev)
{
QWidget::showEvent(ev);
QPointer<QKxSearch> that(this);
QTimer::singleShot(100, this, [=](){
if(that == nullptr) {
return ;
}
ui->key->setFocus();
});
}
2 changes: 2 additions & 0 deletions kxterm/qkxsearch.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ private slots:
void onFindAll();
void onTextChanged(const QString& txt);

private:
virtual void showEvent(QShowEvent *ev);
private:
Ui::QKxSearch *ui;
QPointer<QKxTermItem> m_term;
Expand Down
2 changes: 2 additions & 0 deletions kxterm/qkxtermitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1404,6 +1404,8 @@ void QKxTermItem::mouseMoveEvent(QMouseEvent *ev)
drag.setMimeData(mimeData);
drag.exec(Qt::CopyAction|Qt::MoveAction);
if(!txtSel.isEmpty()) {
QClipboard *clip = QGuiApplication::clipboard();
clip->setText(txtSel);
handleSendData(txtSel.toUtf8());
}
m_ptDraged = QPoint(-1,-1);
Expand Down
13 changes: 13 additions & 0 deletions kxterm/qkxtermwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <QDebug>
#include <QLabel>
#include <QHBoxLayout>
#include <QClipboard>

const QString scrollbar_valid = \
"QScrollBar::vertical \
Expand Down Expand Up @@ -229,6 +230,18 @@ void QKxTermWidget::pastePlainText(const QString &txt)
m_term->pastePlainText(txt);
}

bool QKxTermWidget::pasteWhenOverSelectionText(const QPoint& pt)
{
if(m_term->isOverSelection(pt)) {
QString txtSel = m_term->selectedText();
QClipboard *clip = QGuiApplication::clipboard();
clip->setText(txtSel);
m_term->directSendData(txtSel.toUtf8());
return true;
}
return false;
}

QString QKxTermWidget::selectedText() const
{
return m_term->selectedText();
Expand Down
1 change: 1 addition & 0 deletions kxterm/qkxtermwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class QTERM_EXPORT QKxTermWidget : public QWidget
Q_INVOKABLE void tryToCopy();
Q_INVOKABLE void tryToPaste();
Q_INVOKABLE void pastePlainText(const QString& txt);
Q_INVOKABLE bool pasteWhenOverSelectionText(const QPoint& pt);

QString selectedText() const;
void selectAllText();
Expand Down
101 changes: 64 additions & 37 deletions kxterm/qkxview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,13 +243,11 @@ QString QKxView::plainText(const QPoint &start, const QPoint &end, SelectionMode
}
if(pt1.y() == pt2.y()) {
TermLine line = lineAt(pt1.y());
int rx = 0;
for(int x = 0; x < line.cs.length(); x++) {
const TermChar& c = line.cs.at(x);
rx += c.count;
if(rx - 1 >= pt1.x() && rx - 1 <= pt2.x() && c.c != 0) {
const TermChar& c = line.cs.at(x);
if(x >= pt1.x() && x <= pt2.x() && c.c != 0) {
out.append(c.c);
}
}
}
}else {
for(int y = pt1.y(); y <= pt2.y(); y++) {
Expand All @@ -273,20 +271,16 @@ QString QKxView::plainText(const QPoint &start, const QPoint &end, SelectionMode
continue;
}
if(y == pt1.y()) {
int rx = 0;
for(int x = 0; x < line.cs.length(); x++) {
const TermChar& c = line.cs.at(x);
rx += c.count;
if(rx - 1 >= pt1.x() && c.c != 0) {
const TermChar& c = line.cs.at(x);
if(x >= pt1.x() && c.c != 0) {
out.append(c.c);
}
}
}else if(y == pt2.y()) {
int rx = 0;
for(int x = 0; x < line.cs.length(); x++) {
const TermChar& c = line.cs.at(x);
rx += c.count;
if(rx - 1 <= pt2.x() && c.c != 0) {
const TermChar& c = line.cs.at(x);
if(x <= pt2.x() && c.c != 0) {
out.append(c.c);
}
}
Expand Down Expand Up @@ -336,7 +330,7 @@ QList<TermLine> QKxView::selectedLines()

bool QKxView::find(const QString &key, bool match, bool regular)
{
QList<int> pos;
QList<QPoint> pos;
pos.reserve(m_screen->columens());
m_findText = key;
m_findLength = 0;
Expand All @@ -351,33 +345,36 @@ bool QKxView::find(const QString &key, bool match, bool regular)
for(int y = pt1.y(); y < lineCount(); y++) {
pos.clear();
QString line;
if(!lineText(y, line, pos)) {
if(!lineText(y, line, pos, true)) {
continue;
}
int idx = 0;
if(y == pt1.y()) {
idx = pt1.x();
idx = pos.indexOf(pt1);
}
idx = rgx.indexIn(line, idx);
if(idx >= 0) {
const QStringList& caps = rgx.capturedTexts();
int cnt = caps.at(0).length();
QPoint pt1 = QPoint(pos.at(idx), y);
QPoint pt2 = QPoint(cnt - 1 + idx, y);
QPoint pt1 = pos.at(idx);
QPoint pt2 = pos.at(cnt - 1 + idx);
m_findKey = intFromPoint(pt1);
m_findLength = cnt;
setSelection(pt1, pt2);
return true;
}
}
if(m_findKey == 0) {
clearSelection();
return false;
}
m_findKey = 0;
clearSelection();
return false;
return find(key, match, regular);
}

bool QKxView::findPrev(bool match, bool regular)
{
QList<int> pos;
QList<QPoint> pos;
pos.reserve(m_screen->columens());
if(m_findText.isEmpty()) {
return true;
Expand All @@ -389,33 +386,37 @@ bool QKxView::findPrev(bool match, bool regular)
for(int y = pt1.y(); y >= 0; y--) {
pos.clear();
QString line;
if(!lineText(y, line, pos)) {
if(!lineText(y, line, pos, false)) {
continue;
}
int idx = line.length();
if(y == pt1.y()) {
idx = qMin(pt1.x(), line.length());
idx = qMin(pos.indexOf(pt1), line.length());
line.resize(idx);
}
idx = rgx.lastIndexIn(line, idx);
if(idx >= 0){
const QStringList& caps = rgx.capturedTexts();
int cnt = caps.at(0).length();
QPoint pt1 = QPoint(pos.at(idx), y);
QPoint pt2 = QPoint(cnt - 1 + idx, y);
QPoint pt1 = pos.at(idx);
QPoint pt2 = pos.at(cnt - 1 + idx);
m_findKey = intFromPoint(pt1);
m_findLength = cnt;
setSelection(pt1, pt2);
return true;
}
}
m_findKey = intFromPoint(QPoint(10000,lineCount()));
int findKey = intFromPoint(QPoint(10000,lineCount()));
if(m_findKey == findKey) {
return false;
}
m_findKey = findKey;
return findPrev(match, regular);
}

bool QKxView::findNext(bool match, bool regular)
{
QList<int> pos;
QList<QPoint> pos;
pos.reserve(m_screen->columens());
if(m_findText.isEmpty()) {
return true;
Expand All @@ -424,36 +425,39 @@ bool QKxView::findNext(bool match, bool regular)
Qt::CaseSensitivity sensitive = match ? Qt::CaseSensitive : Qt::CaseInsensitive;
QRegExp::PatternSyntax syntax = regular ? QRegExp::RegExp : QRegExp::FixedString;
QRegExp rgx(m_findText, sensitive, syntax);
QPoint pt1 = intToPoint(m_findKey);
QPoint pt1 = intToPoint(m_findKey);
for(int y = pt1.y(); y < lineCount(); y++) {
pos.clear();
QString line;
if(!lineText(y, line, pos)) {
if(!lineText(y, line, pos, true)) {
continue;
}
int idx = 0;
if(y == pt1.y()) {
idx = pt1.x() + m_findLength;
idx = pos.indexOf(pt1) + m_findLength;
}
idx = rgx.indexIn(line, idx);
if(idx >= 0) {
const QStringList& caps = rgx.capturedTexts();
int cnt = caps.at(0).length();
QPoint pt1 = QPoint(pos.at(idx), y);
QPoint pt2 = QPoint(cnt - 1 + idx, y);
QPoint pt1 = pos.at(idx);
QPoint pt2 = pos.at(cnt - 1 + idx);
m_findKey = intFromPoint(pt1);
m_findLength = cnt;
setSelection(pt1, pt2);
return true;
}
}
if(m_findKey == 0) {
return false;
}
m_findKey = 0;
return findNext(match, regular);
}

void QKxView::findAll(bool match, bool regular)
{
QList<int> pos;
QList<QPoint> pos;
pos.reserve(m_screen->columens());
clearSelection();
if(m_findText.isEmpty()) {
Expand All @@ -466,15 +470,15 @@ void QKxView::findAll(bool match, bool regular)
for(int y = 0; y < lineCount(); y++) {
pos.clear();
QString line;
if(!lineText(y, line, pos)) {
if(!lineText(y, line, pos, true)) {
continue;
}
int idx = 0;
while ((idx = rgx.indexIn(line, idx)) != -1) {
const QStringList& caps = rgx.capturedTexts();
for(int i = 0; i < caps.length(); i++) {
int cnt = caps.at(i).length();
sels.insert(QPoint(pos.at(idx), y), QPoint(cnt - 1 + idx, y));
sels.insert(pos.at(idx), pos.at(cnt - 1 + idx));
idx += cnt;
}
}
Expand Down Expand Up @@ -602,20 +606,43 @@ QChar QKxView::typeCheck(QChar c)
return c;
}

bool QKxView::lineText(int y, QString& out, QList<int> &pos)
bool QKxView::lineText(int y, QString& out, QList<QPoint> &pos, bool forward)
{
const TermLine& line = lineAt(y);
if(line.cs.isEmpty()) {
pos.clear();
out.clear();
return false;
}
if(!forward){
if(line.cs.at(0).wrap) {
const TermLine& prev = lineAt(y-1);
for(int x = 0; x < prev.cs.length(); x++) {
const TermChar& c = prev.cs.at(x);
if(c.c != 0) {
pos.append(QPoint(x, y-1));
out.push_back(c.c);
}
}
}
}
for(int x = 0; x < line.cs.length(); x++) {
const TermChar& c = line.cs.at(x);
if(c.c != 0) {
pos.append(x);
pos.append(QPoint(x, y));
out.push_back(c.c);
}
}
if(forward) {
const TermLine& next = lineAt(y+1);
for(int x = 0; x < next.cs.length(); x++) {
const TermChar& c = next.cs.at(x);
if(c.c != 0) {
pos.append(QPoint(x, y+1));
out.push_back(c.c);
}
}
}

return true;
}
2 changes: 1 addition & 1 deletion kxterm/qkxview.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class QKxView : public QObject
QList<TermLine> copyImage(int y, int rows, int cols);
void markSelection(QList<TermLine>& img, int y, int rows, int cols, SelectionMode m);
QChar typeCheck(QChar c);
bool lineText(int y, QString& out, QList<int> &pos);
bool lineText(int y, QString& out, QList<QPoint> &pos, bool forward);
void cleanFind();
private:
QPointer<QKxScreen> m_screen;
Expand Down
6 changes: 6 additions & 0 deletions kxvnc/qkxvncwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ class QKXVNC_EXPORT QKxVncWidget : public QWidget
void setInputResult(const QString& passwd);
bool scrollEnabled();
void setScrollEnabled(bool on);
bool smartResize() {
return !scrollEnabled();
};
void setSmartResize(bool on) {
setScrollEnabled(!on);
}
void setNextRatio();
void setNextScreen();
void setAudioEnabled(bool on);
Expand Down
Loading

0 comments on commit 781f34d

Please sign in to comment.