Skip to content

Commit

Permalink
正式版发布,引入授权的相关功能。
Browse files Browse the repository at this point in the history
1.桌面端:选项卡增加新建同名会话功能.
2.桌面端:修复没有全局配置下造成鼠标右键默认粘贴缺陷.
3.桌面端:修复终端全局配置和私有配置同时不存在时,可能会导致的字体不佳问题。
4.桌面端:优化终端刷新模式,避免因非等宽字符造成的擦除不干净问题.
5.桌面端:选项卡增加会话属性编辑的入口。
6.桌面端:选项卡增加拖拽触发窗口浮动功能。
  • Loading branch information
getwingm committed May 9, 2023
1 parent c5bc503 commit 27e6bf9
Show file tree
Hide file tree
Showing 62 changed files with 3,204 additions and 551 deletions.
11 changes: 11 additions & 0 deletions kxterm/qkxtermitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include <QMimeData>
#include <QFontDatabase>
#include <QInputMethod>
#include <QDateTime>

#define REPAINT_TIMEOUT1 (20)
#define REPAINT_TIMEOUT2 (40)
Expand Down Expand Up @@ -964,6 +965,12 @@ void QKxTermItem::onBlinkTimeout()
}
}
}

qint64 now = QDateTime::currentMSecsSinceEpoch();
if(now - m_updateFullLast > 1000) {
m_updateFullLast = now;
update(QRect(0, 0, int(width()), int(height())));
}
}

void QKxTermItem::onSelectChanged()
Expand Down Expand Up @@ -1588,6 +1595,10 @@ void QKxTermItem::updateView(QKxTermItem::PaintFlag flags)
m_ticker2->setSingleShot(true);
m_ticker2->start(REPAINT_TIMEOUT2);
}

if(flags & PF_FullScreen) {
m_updateFullLast = QDateTime::currentMSecsSinceEpoch();
}
}

void QKxTermItem::updateScrollValue(int val)
Expand Down
1 change: 1 addition & 0 deletions kxterm/qkxtermitem.h
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ public slots:


int m_lineDragStart;
qint64 m_updateFullLast;
};

#endif // QTERM_H
35 changes: 15 additions & 20 deletions kxutil/qkxcipher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ QByteArray QKxCipher::makeBytes(const QByteArray &pass, int cnt)
QByteArray tmp = pass;
if(pass.length() < cnt) {
int left = cnt - pass.length();
tmp.append(left, 0);
tmp.append(left, '0');
}else if(pass.length() > cnt) {
tmp.resize(cnt);
}
Expand Down Expand Up @@ -273,7 +273,7 @@ static bool EvpEncrypt(EVP_CIPHER_CTX *ctx, const QByteArray &in, QByteArray &ou
}

int mlen = 0;
out.resize(in.size() + AES_BLOCK_SIZE);
out.fill(0, in.size() + AES_BLOCK_SIZE);
ret = EVP_EncryptUpdate(ctx, (unsigned char*)out.data(), &mlen, (const unsigned char*)in.data(), in.size());
if(ret != 1) {
return false;
Expand All @@ -292,15 +292,19 @@ static bool EvpEncrypt(EVP_CIPHER_CTX *ctx, const QByteArray &in, QByteArray &ou
return false;
}
int mlen = 0;
out.resize(in.size());
out.fill(0, in.size());
ret = EVP_DecryptUpdate(ctx, (unsigned char*)out.data(), &mlen, (const unsigned char*)in.data(), in.size());
if(ret != 1) {
return false;
}
int flen = 0;
ret = EVP_DecryptFinal_ex(ctx, (unsigned char *)out.data() + mlen, &flen);
if(ret != 1) {
return false;
// https://blog.csdn.net/anda0109/article/details/51281070
// This instruction only needs to be called when the bytes are not aligned to 16 bytes.
if((in.length() % AES_BLOCK_SIZE) != 0) {
ret = EVP_DecryptFinal_ex(ctx, (unsigned char *)out.data() + mlen, &flen);
if(ret != 1) {
return false;
}
}
out.resize(mlen + flen);
return true;
Expand Down Expand Up @@ -598,18 +602,6 @@ bool QKxCipher::blowfishEcbEncrypt(const QByteArray &in, QByteArray &out, const

void QKxCipher::test()
{
{
QByteArray in = "Text may be any length you wish, no padding is required.";
QByteArray out, out2;
uchar key[16] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};
uchar iv[16] = {21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36};

aesOfb128Encrypt(in, out, QByteArray((char*)key,16), QByteArray((char*)iv, 16), true);
QByteArray txt = out.toHex();
qDebug() << txt;
Q_ASSERT(in == out2);
}
return;
{
QByteArray in = "abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789";
QByteArray out, out2, key = "123";
Expand Down Expand Up @@ -670,6 +662,7 @@ void QKxCipher::test()
QByteArray in = "abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789";
QByteArray out, out2, key = "123";
key = makeBytes(key, 16);
in.resize(48);
aesGcmEncrypt(in, out, key, key, true);
aesGcmEncrypt(out, out2, key, key, false);
Q_ASSERT(in == out2);
Expand Down Expand Up @@ -742,13 +735,15 @@ void QKxCipher::test()
rc4Encrypt(out, out2, key, false);
Q_ASSERT(in == out2);
}
if(true)
{
QByteArray in = "abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz01234567";
QByteArray out, out2, key = "123", ivec="123";
key = makeBytes(key, 16);
ivec = makeBytes(ivec, 8);
blowfishEcbEncrypt(in, out, key, ivec, true);
blowfishEcbEncrypt(QKxCipher::pkcs7Padding(in, 8), out, key, ivec, true);
blowfishEcbEncrypt(out, out2, key, ivec, false);
Q_ASSERT(in == out2);
QByteArray my = QKxCipher::pkcs7UnPadding(out2);
Q_ASSERT(in == my);
}
}
27 changes: 22 additions & 5 deletions kxutil/qkxhttpclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ QKxHttpClient::QKxHttpClient(QObject *parent)

QKxHttpClient::~QKxHttpClient()
{
if(m_manager) {
delete m_manager;
}
qDebug() << "deleteLater";
}

Expand All @@ -53,12 +56,13 @@ bool QKxHttpClient::get(const QString &_url)
QObject::connect(reply, SIGNAL(downloadProgress(qint64,qint64)), this, SIGNAL(downloadProgress(qint64,qint64)));
QObject::connect(reply, SIGNAL(finished()), this, SLOT(onFinished()));
m_reply = reply;
m_lastError.clear();
return true;
}

bool QKxHttpClient::post(const QString &url, const QByteArray &data)
bool QKxHttpClient::post(const QString &url, const QByteArray &data, const QString& contentType)
{
if(m_reply != nullptr || !m_reply->isFinished()) {
if(m_reply != nullptr && !m_reply->isFinished()) {
return false;
}
if(m_file) {
Expand All @@ -68,13 +72,17 @@ bool QKxHttpClient::post(const QString &url, const QByteArray &data)
if(m_reply != nullptr) {
m_reply->deleteLater();
}
QNetworkReply *reply = m_manager->post(QNetworkRequest(QUrl(url)), data);

QNetworkRequest req = QNetworkRequest(QUrl(url));
req.setHeader(QNetworkRequest::ContentTypeHeader, contentType);
QNetworkReply *reply = m_manager->post(req, data);
QObject::connect(reply, SIGNAL(readyRead()), this, SLOT(onReadyRead()));
QObject::connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onError()));
QObject::connect(reply, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(onSslError()));
QObject::connect(reply, SIGNAL(downloadProgress(qint64,qint64)), this, SIGNAL(downloadProgress(qint64,qint64)));
QObject::connect(reply, SIGNAL(finished()), this, SLOT(onFinished()));
m_reply = reply;
m_lastError.clear();
return true;
}

Expand All @@ -99,6 +107,11 @@ QString QKxHttpClient::fileSavePath() const
return m_fileSave;
}

QString QKxHttpClient::lastErrorString() const
{
return m_lastError;
}

void QKxHttpClient::onReadyRead()
{
QByteArray all = m_reply->readAll();
Expand All @@ -117,7 +130,9 @@ void QKxHttpClient::onReadyRead()
void QKxHttpClient::onError()
{
QNetworkReply *reply = qobject_cast<QNetworkReply*>(sender());
qInfo() << reply->url() << reply->errorString();
m_lastError = reply->errorString();
qInfo() << reply->url() << m_lastError;

}

void QKxHttpClient::onSslError()
Expand All @@ -130,7 +145,9 @@ void QKxHttpClient::onFinished()
{
QNetworkReply *reply = qobject_cast<QNetworkReply*>(sender());
QVariant code = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute);
qInfo() << reply->url() << code;
if(!code.isValid()) {
m_lastError = reply->errorString();
}
if(m_file) {
m_file->close();
m_file->deleteLater();
Expand Down
6 changes: 4 additions & 2 deletions kxutil/qkxhttpclient.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*******************************************************************************************
/*******************************************************************************************
*
* Copyright (C) 2022 Guangzhou AoYiDuo Network Technology Co.,Ltd. All Rights Reserved.
*
Expand Down Expand Up @@ -27,10 +27,11 @@ class KXUTIL_EXPORT QKxHttpClient : public QObject
explicit QKxHttpClient(QObject *parent = nullptr);
virtual ~QKxHttpClient();
bool get(const QString& url);
bool post(const QString& url, const QByteArray& data);
bool post(const QString& url, const QByteArray& data, const QString& contentType = "application/text");
bool fileGet(const QString& url, const QString& fileSave);
bool filePost(const QString& url, const QByteArray& data, const QString& fileSave);
QString fileSavePath() const;
QString lastErrorString() const;
signals:
void result(int code, const QByteArray& body);
void downloadProgress(qint64 bytesReceived, qint64 bytesTotal);
Expand All @@ -43,6 +44,7 @@ private slots:
private:
QPointer<QNetworkAccessManager> m_manager;
QPointer<QNetworkReply> m_reply;
QString m_lastError;
QByteArray m_data;
QString m_fileSave;
QPointer<QFile> m_file;
Expand Down
2 changes: 1 addition & 1 deletion kxutil/qkxsetting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ QString QKxSetting::applicationFilePath()
if(path.isEmpty()) {
char buffer[1024] = {0};
::GetModuleFileNameA(0, buffer, 1023);
path = buffer;
path = buffer;// application
}
path = QDir::cleanPath(path);
return path;
Expand Down
23 changes: 17 additions & 6 deletions woterm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ set(SOURCE_FILES
qkxbuttonassist.cpp
qkxfilterbox.cpp
qkxfilterlineedit.cpp
qkxfilterlistview.cpp
qkxlicensedialog.cpp
qkxfilterlistview.cpp
qkxmessagebox.cpp
qkxtouchpoint.cpp
qkxloadingbarwidget.cpp
#window object
main.cpp
qwoapplication.cpp
Expand Down Expand Up @@ -118,6 +118,10 @@ set(SOURCE_FILES
qwogroupinputdialog.cpp
qwofontlistmodel.cpp
qworecenthistory.cpp
qwolicensedialog.cpp
qwolicenseactivatedialog.cpp
qwoversionupgradetipdialog.cpp
qwolicensetrialapplydialog.cpp
qwotelnet.cpp
qwoutils.cpp
qwowidget.cpp
Expand Down Expand Up @@ -165,10 +169,10 @@ set(HEADER_FILES
qkxbuttonassist.h
qkxfilterbox.h
qkxfilterlineedit.h
qkxfilterlistview.h
qkxlicensedialog.h
qkxfilterlistview.h
qkxtouchpoint.h
qkxmessagebox.h
qkxloadingbarwidget.h
# window object
qwoapplication.h
qwomenubutton.h
Expand Down Expand Up @@ -256,6 +260,10 @@ set(HEADER_FILES
qwogroupinputdialog.h
qwofontlistmodel.h
qworecenthistory.h
qwolicensedialog.h
qwolicenseactivatedialog.h
qwoversionupgradetipdialog.h
qwolicensetrialapplydialog.h
qwotelnet.h
qwoutils.h
qwowidget.h
Expand Down Expand Up @@ -304,8 +312,7 @@ set(HEADER_FILES
set(OTHER_FILES
woterm.qrc
# window object
qkxfilterlistview.ui
qkxlicensedialog.ui
qkxfilterlistview.ui
qwoaboutdialog.ui
qwomenubutton.ui
qwoadmindialog.ui
Expand Down Expand Up @@ -341,6 +348,10 @@ set(OTHER_FILES
qwobindportpermissiondialog.ui
qwodbsftpdownlistdialog.ui
qwogroupinputdialog.ui
qwolicensedialog.ui
qwolicenseactivatedialog.ui
qwoversionupgradetipdialog.ui
qwolicensetrialapplydialog.ui

#mobile object
qmomainwindow.ui
Expand Down
2 changes: 1 addition & 1 deletion woterm/language/update.bat
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ echo %path_script%

cd %path_script%
rem lupdate -recursive %path_script%\..\ -I %path_script%\..\..\kxftp -I %path_script%\..\..\kxvnc -I %path_script%\..\..\kxutil -I %path_script%\..\..\kxterm %path_script%\..\qml -ts %path_script%woterm_en.ts
lupdate -recursive %path_script%\..\ %path_script%\..\..\kxftp %path_script%\..\..\kxvnc %path_script%\..\..\kxutil %path_script%\..\..\kxterm %path_script%\..\qml -ts %path_script%woterm_zh.ts
lupdate -recursive %path_script%\..\ %path_script%\..\..\kxftp %path_script%\..\..\kxvnc %path_script%\..\..\kxutil %path_script%\..\..\kxver %path_script%\..\..\kxterm %path_script%\..\qml -ts %path_script%woterm_zh.ts
pause
Binary file modified woterm/language/woterm_zh.qm
Binary file not shown.
Loading

0 comments on commit 27e6bf9

Please sign in to comment.