跟进翻译

This commit is contained in:
gfdgd xi 2024-05-12 12:24:07 +08:00
parent c4ebe15b79
commit a569f6b63c
11 changed files with 165 additions and 54 deletions

@ -17,5 +17,6 @@
<file>data/new/en_US.html</file>
<file>data/new/zh_CN.html</file>
<file>data/version</file>
<file>shell/kernel-installer-upgrade-template.sh</file>
</qresource>
</RCC>

@ -2,6 +2,8 @@
<pre>
<b>※1、支持从 apt 源读取内核数据并显示安装
※2、支持只显示与当前系统相同架构的内核
※3、下载/更新内核时支持调用 aptss 提升下载速度
</b>
3、优化表格显示
4、优化表格显示效果
5、支持显示内核描述
</pre>

2
debian/postinst vendored Normal file

@ -0,0 +1,2 @@
#!/bin/bash
apt update | true

@ -10,14 +10,23 @@ KernelInformation::KernelInformation()
void KernelInformation::LoadInfo()
{
// 从 apt 获取信息
//QStringList data = this->GetAptPackageList("linux-*");
/*for(QString i: data) {
}*/
AptPkgInfo info = AptPkgInfo("linux-", AptPkgInfo::PkgSearchOption::HeadInclude);
QStringList list = info.GetAptPackageList();
// 添加 GXDE Kernel Manager
QJsonArray array;
AptPkgInfo kernelManagerinfo = AptPkgInfo("gxde-kernel-manager", AptPkgInfo::PkgSearchOption::Equal);
QStringList list = kernelManagerinfo.GetAptPackageList();
for(QString i: list) {
QJsonObject object;
kernelManagerinfo.SetPkgName(i);
object.insert("Name", i);
object.insert("Author", kernelManagerinfo.get_maintainer(i));
object.insert("Des", kernelManagerinfo.get_description(i));
object.insert("Arch", QJsonArray::fromStringList(QStringList() << arch()));
object.insert("PkgName", QJsonArray::fromStringList(QStringList() << i));
array.append(object);
}
AptPkgInfo info = AptPkgInfo("linux-", AptPkgInfo::PkgSearchOption::HeadInclude);
list = info.GetAptPackageList();
indexMap = {};
for(QString i: list) {
QJsonObject object;
@ -72,19 +81,7 @@ void KernelInformation::LoadInfo()
indexMap.insert(strTemp, array.count());
array.append(object);
}
// 添加 GXDE Kernel Manager
AptPkgInfo kernelManagerinfo = AptPkgInfo("gxde-kernel-manager", AptPkgInfo::PkgSearchOption::Equal);
list = kernelManagerinfo.GetAptPackageList();
for(QString i: list) {
QJsonObject object;
info.SetPkgName(i);
object.insert("Name", i);
object.insert("Author", kernelManagerinfo.get_maintainer(i));
object.insert("Des", kernelManagerinfo.get_description(i));
object.insert("Arch", QJsonArray::fromStringList(QStringList() << arch()));
object.insert("PkgName", QJsonArray::fromStringList(QStringList() << i));
array.append(object);
}
this->listData = array;
emit loadFinished(NULL);
@ -160,7 +157,6 @@ QStringList KernelInformation::get_arch(int value) const
}
if(!result.count()) {
result << "all";
qDebug() << get_kernelData(value);
}
return result;
}

@ -35,6 +35,9 @@ KernelInstaller::KernelInstaller(Option option, QStringList kernelList, QWidget
case Option::Update:
ui->m_status->setText(tr("Try to update apt cache"));
break;
case Option::Upgrade:
ui->m_status->setText(tr("Try to upgrade ") + kernel);
break;
}
@ -93,6 +96,9 @@ QString KernelInstaller::BuildKernelInstallerBash(QStringList kernelList, QStrin
case Option::Update:
filePath = ":/shell/kernel-installer-update-template.sh";
break;
case Option::Upgrade:
filePath = ":/shell/kernel-installer-upgrade-template.sh";
break;
}
QFile file(filePath);

@ -18,7 +18,8 @@ public:
Install,
Remove,
Reconfigure,
Update
Update,
Upgrade
};
explicit KernelInstaller(Option option, QStringList kernelList, QWidget *parent = nullptr);

@ -174,3 +174,16 @@ void MainWindow::on_actionUpdate_apt_cache_triggered()
installer->show();
}
void MainWindow::on_actionAbout_QT_triggered()
{
QMessageBox::aboutQt(this);
}
void MainWindow::on_actionUpgrade_triggered()
{
KernelInstaller *installer = new KernelInstaller(KernelInstaller::Option::Upgrade, QStringList());
installer->show();
}

@ -39,6 +39,10 @@ private slots:
void on_actionUpdate_apt_cache_triggered();
void on_actionAbout_QT_triggered();
void on_actionUpgrade_triggered();
private:
Ui::MainWindow *ui;
KernelInformation *kernelInformation;

@ -118,8 +118,6 @@
<property name="title">
<string>Program</string>
</property>
<addaction name="actionUpdate_apt_cache"/>
<addaction name="separator"/>
<addaction name="actionExit"/>
</widget>
<widget class="QMenu" name="menuHelp">
@ -129,9 +127,19 @@
<addaction name="actionGitee"/>
<addaction name="actionGithub"/>
<addaction name="separator"/>
<addaction name="actionAbout_QT"/>
<addaction name="actionAbout"/>
</widget>
<widget class="QMenu" name="menuApt">
<property name="title">
<string>Apt</string>
</property>
<addaction name="actionUpdate_apt_cache"/>
<addaction name="separator"/>
<addaction name="actionUpgrade"/>
</widget>
<addaction name="menuProgram"/>
<addaction name="menuApt"/>
<addaction name="menuHelp"/>
</widget>
<widget class="QStatusBar" name="statusbar"/>
@ -160,6 +168,16 @@
<string>Update apt cache</string>
</property>
</action>
<action name="actionAbout_QT">
<property name="text">
<string>About QT</string>
</property>
</action>
<action name="actionUpgrade">
<property name="text">
<string>Upgrade</string>
</property>
</action>
</widget>
<resources>
<include location="Resource.qrc"/>

@ -0,0 +1,12 @@
#!/bin/bash
set -e
rm /tmp/gxde-kernel-manager-installer-status -f
aptPath="apt"
which aptss > /dev/null
if [[ $? == 0 ]]; then
# 如果 aptss 存在,则使用 aptss
aptPath="aptss"
fi
$aptPath update
$aptPath full-upgrade ${KernelList} -y
rm -f "${kernelInstallerShellTempPath}"

@ -19,17 +19,22 @@
<translation></translation>
</message>
<message>
<location filename="../aboutwindow.cpp" line="13"/>
<location filename="../aboutwindow.cpp" line="18"/>
<source>A kernel manager allows users to install or remove kernels easily.</source>
<translation>GXDE 便</translation>
</message>
<message>
<location filename="../aboutwindow.cpp" line="14"/>
<location filename="../aboutwindow.cpp" line="19"/>
<source>Warning: You may damage your system unless you know what you will do!</source>
<translation></translation>
</message>
<message>
<location filename="../aboutwindow.cpp" line="17"/>
<location filename="../aboutwindow.cpp" line="20"/>
<source>Built Time: </source>
<translation> </translation>
</message>
<message>
<location filename="../aboutwindow.cpp" line="25"/>
<source>Website</source>
<translation></translation>
</message>
@ -46,7 +51,6 @@
<translation></translation>
</message>
<message>
<location filename="../kernelinstaller.ui" line="33"/>
<location filename="../kernelinstaller.ui" line="46"/>
<source>TextLabel</source>
<translation></translation>
@ -54,20 +58,35 @@
<message>
<location filename="../kernelinstaller.cpp" line="27"/>
<source>Try to install </source>
<translation> </translation>
<translation> </translation>
</message>
<message>
<location filename="../kernelinstaller.cpp" line="30"/>
<source>Try to remove </source>
<translation> </translation>
<translation> </translation>
</message>
<message>
<location filename="../kernelinstaller.cpp" line="135"/>
<location filename="../kernelinstaller.cpp" line="33"/>
<source>Try to reconfigure </source>
<translation> </translation>
</message>
<message>
<location filename="../kernelinstaller.cpp" line="36"/>
<source>Try to update apt cache</source>
<translation> apt </translation>
</message>
<message>
<location filename="../kernelinstaller.cpp" line="39"/>
<source>Try to upgrade </source>
<translation> </translation>
</message>
<message>
<location filename="../kernelinstaller.cpp" line="156"/>
<source>Done</source>
<translation></translation>
</message>
<message>
<location filename="../kernelinstaller.cpp" line="140"/>
<location filename="../kernelinstaller.cpp" line="161"/>
<source>Something error, exit code: </source>
<translation>退 </translation>
</message>
@ -84,99 +103,136 @@
<translation>GXDE </translation>
</message>
<message>
<location filename="../mainwindow.ui" line="43"/>
<location filename="../mainwindow.ui" line="49"/>
<source>TextLabel</source>
<translation></translation>
</message>
<message>
<location filename="../mainwindow.ui" line="63"/>
<location filename="../mainwindow.ui" line="69"/>
<source>Show local PC architecture only</source>
<translation></translation>
</message>
<message>
<location filename="../mainwindow.ui" line="79"/>
<source>Refresh</source>
<translation></translation>
</message>
<message>
<location filename="../mainwindow.ui" line="70"/>
<location filename="../mainwindow.ui" line="86"/>
<source>Reconfigure</source>
<translation></translation>
</message>
<message>
<location filename="../mainwindow.ui" line="93"/>
<source>Install</source>
<translation></translation>
</message>
<message>
<location filename="../mainwindow.ui" line="77"/>
<location filename="../mainwindow.ui" line="100"/>
<source>Remove</source>
<translation></translation>
</message>
<message>
<location filename="../mainwindow.ui" line="96"/>
<location filename="../mainwindow.ui" line="119"/>
<source>Program</source>
<translation></translation>
</message>
<message>
<location filename="../mainwindow.ui" line="102"/>
<location filename="../mainwindow.ui" line="125"/>
<source>Help</source>
<translation></translation>
</message>
<message>
<location filename="../mainwindow.ui" line="115"/>
<location filename="../mainwindow.ui" line="135"/>
<source>Apt</source>
<translation>Apt</translation>
</message>
<message>
<location filename="../mainwindow.ui" line="148"/>
<source>Exit</source>
<translation>退</translation>
</message>
<message>
<location filename="../mainwindow.ui" line="120"/>
<location filename="../mainwindow.ui" line="153"/>
<source>About</source>
<translation></translation>
</message>
<message>
<location filename="../mainwindow.ui" line="125"/>
<location filename="../mainwindow.ui" line="158"/>
<source>Gitee</source>
<translation>Gitee</translation>
</message>
<message>
<location filename="../mainwindow.ui" line="130"/>
<location filename="../mainwindow.ui" line="163"/>
<source>Github</source>
<translation>Github</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="21"/>
<location filename="../mainwindow.ui" line="168"/>
<source>Update apt cache</source>
<translation> apt </translation>
</message>
<message>
<location filename="../mainwindow.ui" line="173"/>
<source>About QT</source>
<translation> QT</translation>
</message>
<message>
<location filename="../mainwindow.ui" line="178"/>
<source>Upgrade</source>
<translation></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="23"/>
<source>Kernel: </source>
<translation> </translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="21"/>
<location filename="../mainwindow.cpp" line="23"/>
<source>Arch: </source>
<translation> </translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="34"/>
<location filename="../mainwindow.cpp" line="35"/>
<source>ID</source>
<translation>ID</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="34"/>
<location filename="../mainwindow.cpp" line="35"/>
<source>Kernel Name</source>
<translation></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="34"/>
<location filename="../mainwindow.cpp" line="35"/>
<source>Author</source>
<translation></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="34"/>
<location filename="../mainwindow.cpp" line="35"/>
<source>Arch</source>
<translation></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="34"/>
<location filename="../mainwindow.cpp" line="35"/>
<source>Installed</source>
<translation></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="63"/>
<location filename="../mainwindow.cpp" line="106"/>
<location filename="../mainwindow.cpp" line="35"/>
<source>Description</source>
<translation></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="85"/>
<location filename="../mainwindow.cpp" line="132"/>
<location filename="../mainwindow.cpp" line="156"/>
<source>Error</source>
<translation></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="63"/>
<location filename="../mainwindow.cpp" line="106"/>
<location filename="../mainwindow.cpp" line="85"/>
<location filename="../mainwindow.cpp" line="132"/>
<location filename="../mainwindow.cpp" line="156"/>
<source>Nothing to choose</source>
<translation></translation>
</message>