Skip to content

Commit

Permalink
v9.29.6~v9.29.8
Browse files Browse the repository at this point in the history
[SFTP]优化文件监听的逻辑。
[SFTP]修复提示框在MacOSX无法至顶的缺憾。
[SFTP]清理不再需要的缓存文件。
更换应用图标
[RDP]修复4K屏下,默认非智能拉伸登录远程桌面时,底部出现的空白块问题。

[SFTP] Optimize the logic of file monitoring.
[SFTP] Fixed the bug that the prompt box cannot be topped on Mac OS X.
[SFTP] Clean up cached files that are no longer needed.
Replace the application icon
[RDP] Fixed the blank block issue that appears at the bottom when logging into remote desktop with default non-intelligent stretch under 4K screen.
  • Loading branch information
getwingm committed Nov 13, 2023
1 parent 5dc74e0 commit 188af2e
Show file tree
Hide file tree
Showing 25 changed files with 268 additions and 155 deletions.
Binary file removed doc/color.gif
Binary file not shown.
Binary file removed doc/search.gif
Binary file not shown.
Binary file removed doc/vnc.png
Binary file not shown.
2 changes: 2 additions & 0 deletions woterm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ set(SOURCE_FILES
qkxpositionitem.cpp
qkxbubblesyncwidget.cpp
qkxplaintextedit.cpp
qkxfilesystemwatcher.cpp
#window object
main.cpp
qwotheme.cpp
Expand Down Expand Up @@ -234,6 +235,7 @@ set(HEADER_FILES
qkxpositionitem.h
qkxbubblesyncwidget.h
qkxplaintextedit.h
qkxfilesystemwatcher.h
# window object
qwotheme.h
qwoapplication.h
Expand Down
4 changes: 2 additions & 2 deletions woterm/qkxbubblesyncwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
#include <QCursor>
#include <QDebug>

QKxBubbleSyncWidget::QKxBubbleSyncWidget(QWidget *parent) :
QWidget(parent, Qt::FramelessWindowHint | Qt::WindowSystemMenuHint | Qt::WindowStaysOnTopHint | Qt::Tool),
QKxBubbleSyncWidget::QKxBubbleSyncWidget() :
QWidget(nullptr, Qt::FramelessWindowHint | Qt::WindowSystemMenuHint | Qt::WindowStaysOnTopHint | Qt::ToolTip),
ui(new Ui::QKxBubbleSyncWidget)
{
ui->setupUi(this);
Expand Down
2 changes: 1 addition & 1 deletion woterm/qkxbubblesyncwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class QKxBubbleSyncWidget : public QWidget
Q_OBJECT

public:
explicit QKxBubbleSyncWidget(QWidget *parent = nullptr);
explicit QKxBubbleSyncWidget();
~QKxBubbleSyncWidget();

void setMessage(const QString& title, const QString& msg, int timeout = 1000);
Expand Down
72 changes: 72 additions & 0 deletions woterm/qkxfilesystemwatcher.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*******************************************************************************************
*
* Copyright (C) 2023 Guangzhou AoYiDuo Network Technology Co.,Ltd. All Rights Reserved.
*
* Contact: http://www.aoyiduo.com
*
* this file is used under the terms of the GPLv3[GNU GENERAL PUBLIC LICENSE v3]
* more information follow the website: https://www.gnu.org/licenses/gpl-3.0.en.html
*
*******************************************************************************************/

#include "qkxfilesystemwatcher.h"

#include <QFileInfo>
#include <QTimer>

QKxFileSystemWatcher::QKxFileSystemWatcher(QObject *parent)
: QObject(parent)
{

}

QKxFileSystemWatcher::~QKxFileSystemWatcher()
{

}

bool QKxFileSystemWatcher::addPath(const QString &file)
{
QFileInfo fi(file);
if(!fi.isFile()) {
return false;
}
m_files.insert(file, fi.lastModified());

if(m_timer == nullptr) {
m_timer = new QTimer(this);
QObject::connect(m_timer, SIGNAL(timeout()), this, SLOT(onFileCheckTimeout()));
}
if(!m_timer->isActive()) {
m_timer->start(1000);
}
return true;
}

void QKxFileSystemWatcher::removePath(const QString &file)
{
m_files.take(file);
}

QStringList QKxFileSystemWatcher::files() const
{
return m_files.keys();
}

void QKxFileSystemWatcher::onFileCheckTimeout()
{
for(auto it = m_files.begin(); it != m_files.end(); ) {
QString file = it.key();
QDateTime dt = it.value();
QFileInfo fi(file);
if(fi.lastModified() != dt) {
it = m_files.erase(it);
emit fileChanged(file);
}else{
it++;
}
}
if(m_files.isEmpty()) {
m_timer->stop();
}
}
42 changes: 42 additions & 0 deletions woterm/qkxfilesystemwatcher.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*******************************************************************************************
*
* Copyright (C) 2023 Guangzhou AoYiDuo Network Technology Co.,Ltd. All Rights Reserved.
*
* Contact: http://www.aoyiduo.com
*
* this file is used under the terms of the GPLv3[GNU GENERAL PUBLIC LICENSE v3]
* more information follow the website: https://www.gnu.org/licenses/gpl-3.0.en.html
*
*******************************************************************************************/

#ifndef QKXFILESYSTEMWATCHER_H
#define QKXFILESYSTEMWATCHER_H

#include <QObject>
#include <QPointer>
#include <QMap>
#include <QDateTime>

class QTimer;
class QKxFileSystemWatcher : public QObject
{
Q_OBJECT
public:
explicit QKxFileSystemWatcher(QObject *parent = nullptr);
virtual ~QKxFileSystemWatcher();

bool addPath(const QString &file);
void removePath(const QString &file);

QStringList files() const;

signals:
void fileChanged(const QString &path);
private slots:
void onFileCheckTimeout();
private:
QMap<QString, QDateTime> m_files;
QPointer<QTimer> m_timer;
};

#endif // QKXFILESYSTEMWATCHER_H
2 changes: 1 addition & 1 deletion woterm/qmoapplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
QMoApplication::QMoApplication(int &argc, char **argv)
: QApplication(argc, argv)
{
setWindowIcon(QIcon(":/woterm/resource/images/woterm2.png"));
setWindowIcon(QIcon(":/woterm/resource/images/woterm.png"));
m_timeStart = QDateTime::currentSecsSinceEpoch();

QString path = applicationDirPath();
Expand Down
4 changes: 2 additions & 2 deletions woterm/qwoapplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ QWoApplication::QWoApplication(int &argc, char **argv)
: QApplication(argc, argv)
{
QKxVer::installQSettingCipher();
setWindowIcon(QIcon(":/woterm/resource/images/woterm2.png"));
setWindowIcon(QIcon(":/woterm/resource/images/woterm.png"));
QString path = applicationDirPath();
addLibraryPath(path);
QString libPath = QDir::cleanPath(path + "/../lib");
Expand Down Expand Up @@ -131,7 +131,7 @@ void QWoTunnelApplication::init()
{
QMenu *menu = new QMenu();
menu->addAction(QIcon(":/woterm/resource/images/tunnel.png"), QObject::tr("Show tunnel window"), this, SLOT(onShowWindow()));
menu->addAction(QIcon(":/woterm/resource/images/woterm2.png"), QObject::tr("New session"), this, SLOT(onNewSessionWindow()));
menu->addAction(QIcon(":/woterm/resource/images/woterm.png"), QObject::tr("New session"), this, SLOT(onNewSessionWindow()));
menu->addAction(QIcon(":/woterm/resource/images/reload.png"), QObject::tr("Restart application"), this, SLOT(onRestartApplication()));
menu->addAction(QIcon(":/woterm/resource/images/exit.png"), QObject::tr("Exit"), this, SLOT(onAboutToQuit()));
m_menu = menu;
Expand Down
2 changes: 1 addition & 1 deletion woterm/qwomainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ QWoMainWindow::QWoMainWindow(QWidget *parent)
setMinimumSize(QSize(800, 600));
setAttribute(Qt::WA_DeleteOnClose);

setWindowIcon(QIcon(":/woterm/resource/images/woterm2.png"));
setWindowIcon(QIcon(":/woterm/resource/images/woterm.png"));

QKxVer *ver = QKxVer::instance();
QKxVer::ELicenseType type = ver->licenseType();
Expand Down
6 changes: 4 additions & 2 deletions woterm/qwordpwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void QWoRdpWidget::resizeEvent(QResizeEvent *event)
m_area->setGeometry(0, 0, sz.width(), sz.height());
m_loading->setGeometry(0, 0, sz.width(), sz.height());
m_mask->setGeometry(0, 0, sz.width(), sz.height());
resizeRdpWidget();
QMetaObject::invokeMethod(this, "resizeRdpWidget", Qt::QueuedConnection);
}

bool QWoRdpWidget::focusNextPrevChild(bool next)
Expand Down Expand Up @@ -134,6 +134,8 @@ void QWoRdpWidget::onConnectedArrived()
m_loading->hide();
m_mask->hide();
m_rdp->show();

QMetaObject::invokeMethod(this, "resizeRdpWidget", Qt::QueuedConnection);
}

void QWoRdpWidget::onDisconnectedArrived()
Expand Down Expand Up @@ -216,7 +218,7 @@ void QWoRdpWidget::reconnect()
m_rdp->setPerformanceFlags(flags);
m_rdp->setDesktopSize(width, height);
m_rdp->start(hi.host, hi.port, hi.user, hi.password);
resizeRdpWidget();
m_rdp->resize(QSize(1024, 768));

m_mask->setAutoReconnect(m_autoReconnect);
m_mask->hide();
Expand Down
8 changes: 4 additions & 4 deletions woterm/qwosetting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,17 +155,17 @@ QString QWoSetting::customKeytabPath()
return path;
}

QString QWoSetting::cachePath()
QString QWoSetting::sftpCachePath()
{
QString path = QWoSetting::ensurePath("cache");
QString path = QWoSetting::ensurePath("sftpCache");
path = QDir::cleanPath(path);
path = QDir::toNativeSeparators(path);
return path;
}

QString QWoSetting::viewPath()
QString QWoSetting::sftpViewPath()
{
QString path = QWoSetting::ensurePath("view");
QString path = QWoSetting::ensurePath("sftpView");
path = QDir::cleanPath(path);
path = QDir::toNativeSeparators(path);
return path;
Expand Down
4 changes: 2 additions & 2 deletions woterm/qwosetting.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ class QWoSetting : public QKxSetting
static QString sshServerDbPath();
static QString sftpTaskDbPath();
static QString sftpTaskLogPath();
static QString sftpCachePath();
static QString sftpViewPath();
static QString tempPath();
static QString customFontPath();
static QString customKeytabPath();
static QString cachePath();
static QString viewPath();
static QString fileIconCachePath();

Q_INVOKABLE static QString downloadPath();
Expand Down
18 changes: 12 additions & 6 deletions woterm/qwosftpeditordialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,18 @@ QWoSftpEditorDialog::QWoSftpEditorDialog(const QStringList &watchs, QWidget *par
for(auto it = watchs.begin(); it != watchs.end(); it++) {
QString file = *it;
QFileInfo fi(file);
QString fileName = fi.fileName();
int pos = fileName.indexOf('-');
QString sessionName = fileName.left(pos);
QString session = QByteArray::fromHex(sessionName.toLatin1());
fileName = fileName.replace(0, pos, session);
m_watchs.insert(fileName, file);
QString fileFull = fi.fileName();
QStringList fns = fileFull.split('-');
if(fns.length() >= 3) {
QString pid = fns.takeFirst();
QString sessionName = fns.takeFirst();
QString fileName = fns.join('-');
QString session = QByteArray::fromHex(sessionName.toLatin1());
m_watchs.insert(session+"-"+fileName, file);
}else{
QString fileName = fi.fileName();
m_watchs.insert(fileName, file);
}
}
QStringListModel *model = new QStringListModel(m_watchs.keys(), ui->tasks);
ui->tasks->setModel(model);
Expand Down
Loading

0 comments on commit 188af2e

Please sign in to comment.