Repository navigation
Expand file tree
/
Copy pathaboutdialog.cpp
More file actions
139 lines (121 loc) · 5.27 KB
/
Copy pathaboutdialog.cpp
File metadata and controls
139 lines (121 loc) · 5.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#include "aboutdialog.h"
#include "apptheme.h"
#include "appversion.h"
#include <QCoreApplication>
#include <QDialog>
#include <QFrame>
#include <QHBoxLayout>
#include <QIcon>
#include <QLabel>
#include <QPixmap>
#include <QPushButton>
#include <QTextBrowser>
#include <QTextDocument>
#include <QVBoxLayout>
namespace {
QString aboutText(const char *source) {
return QCoreApplication::translate("AboutDialog", source);
}
QString appVersion() {
const QString version = QCoreApplication::applicationVersion();
return version.isEmpty() ? QStringLiteral(ISHELL_VERSION) : version;
}
} // namespace
void showAboutDialog(QWidget *parent) {
QDialog dialog(parent);
dialog.setWindowTitle(aboutText("关于 ishell"));
dialog.setWindowIcon(QIcon(QStringLiteral(":/logo.png")));
dialog.setModal(true);
dialog.resize(620, 680);
dialog.setMinimumSize(560, 560);
QVBoxLayout *root = new QVBoxLayout(&dialog);
root->setContentsMargins(24, 22, 24, 18);
root->setSpacing(0);
QLabel *logo = new QLabel(&dialog);
logo->setPixmap(QIcon(QStringLiteral(":/logo.png")).pixmap(64, 64));
logo->setFixedSize(64, 64);
QLabel *title = new QLabel(QStringLiteral("ishell"), &dialog);
title->setObjectName(QStringLiteral("pageTitle"));
QLabel *subtitle =
new QLabel(aboutText("跨平台终端与远程运维工作台"), &dialog);
subtitle->setObjectName(QStringLiteral("pageSubtitle"));
QLabel *version = new QLabel(
aboutText("版本 %1 · Qt %2")
.arg(appVersion(), QString::fromLatin1(QT_VERSION_STR)),
&dialog);
version->setObjectName(QStringLiteral("pageSubtitle"));
QVBoxLayout *titleLayout = new QVBoxLayout();
titleLayout->setSpacing(3);
titleLayout->addWidget(title);
titleLayout->addWidget(subtitle);
titleLayout->addWidget(version);
titleLayout->addStretch(1);
QHBoxLayout *header = new QHBoxLayout();
header->setSpacing(16);
header->addWidget(logo, 0, Qt::AlignTop);
header->addLayout(titleLayout, 1);
root->addLayout(header);
root->addSpacing(16);
// 1px 分隔线,直接用背景色比 QFrame::HLine 在不同平台上更可控。
QFrame *line = new QFrame(&dialog);
line->setFixedHeight(1);
line->setStyleSheet(QStringLiteral("background-color:#e2e8f0;border:none;"));
root->addWidget(line);
root->addSpacing(10);
QTextBrowser *browser = new QTextBrowser(&dialog);
browser->setOpenExternalLinks(true);
browser->setFrameShape(QFrame::NoFrame);
browser->setFocusPolicy(Qt::NoFocus);
browser->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
browser->setStyleSheet(
QStringLiteral("QTextBrowser{background:transparent;border:none;}"));
browser->viewport()->setAutoFillBackground(false);
browser->document()->setDocumentMargin(4);
browser->document()->setDefaultFont(dialog.font());
browser->setHtml(QStringLiteral(
"<p style=\"margin:0 0 10px 0;line-height:150%;\">"
"ishell 是一款使用 <b>C++11 + Qt</b> 构建的跨平台桌面工作台,"
"把本地终端、SSH 会话、SFTP/SCP 文件管理、VNC 远控和资产组织放进"
"同一个窗口。网络与渲染均为原生实现,不依赖 Qt WebEngine 或"
"浏览器内核。</p>"
"<h3 style=\"color:#0f172a;font-size:13px;margin:12px 0 6px 0;\">"
"主要功能</h3>"
"<ul style=\"margin-top:0;margin-bottom:0;\">"
"<li style=\"margin-bottom:4px;line-height:145%;\">"
"<b>本地终端</b>:启动即打开系统 Shell,libvterm + QPainter "
"原生渲染,支持 16 / 256 / 真彩色。</li>"
"<li style=\"margin-bottom:4px;line-height:145%;\">"
"<b>SSH 会话</b>:密码或公私钥认证,终端尺寸随窗口同步,"
"断线原因以中文状态卡片呈现。</li>"
"<li style=\"margin-bottom:4px;line-height:145%;\">"
"<b>文件管理</b>:SFTP / SCP 双传输,既可作为独立页签,"
"也可内嵌在 SSH 会话中,传输队列从底部滑出。</li>"
"<li style=\"margin-bottom:4px;line-height:145%;\">"
"<b>VNC 远控</b>:原生 RFB + OpenGL 渲染,支持页签、"
"独立窗口与全屏切换。</li>"
"<li style=\"margin-bottom:4px;line-height:145%;\">"
"<b>资产管理</b>:分组树、搜索、右键菜单,以及 AES-256-GCM "
"加密备份与恢复。</li>"
"</ul>"
"<p style=\"margin:12px 0 0 0;line-height:150%;\">"
"技术栈:C++11 · Qt 5 · libssh2 · LibVNCServer · libvterm · "
"OpenSSL,支持 Windows、Linux 与 macOS。</p>"
"<p style=\"margin:12px 0 0 0;line-height:150%;\">"
"项目主页:<a href=\"https://github.com/yz-java/ishell\">GitHub</a>"
" · <a href=\"https://gitee.com/yangzhao_java/ishell\">Gitee</a>"
" · <a href=\"https://github.com/yz-java/ishell/issues\">问题反馈</a>"
"<br/>MIT License · Copyright © 2026 yangzhao_java</p>"));
root->addWidget(browser, 1);
root->addSpacing(14);
QHBoxLayout *footer = new QHBoxLayout();
footer->addStretch(1);
QPushButton *closeButton = new QPushButton(aboutText("关闭"), &dialog);
closeButton->setAutoDefault(true);
closeButton->setDefault(true);
markPrimaryButton(closeButton);
QObject::connect(closeButton, &QPushButton::clicked, &dialog,
&QDialog::accept);
footer->addWidget(closeButton);
root->addLayout(footer);
dialog.exec();
}