跟进翻译

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/en_US.html</file>
<file>data/new/zh_CN.html</file> <file>data/new/zh_CN.html</file>
<file>data/version</file> <file>data/version</file>
<file>shell/kernel-installer-upgrade-template.sh</file>
</qresource> </qresource>
</RCC> </RCC>

@ -2,6 +2,8 @@
<pre> <pre>
<b>※1、支持从 apt 源读取内核数据并显示安装 <b>※1、支持从 apt 源读取内核数据并显示安装
※2、支持只显示与当前系统相同架构的内核 ※2、支持只显示与当前系统相同架构的内核
※3、下载/更新内核时支持调用 aptss 提升下载速度
</b> </b>
3、优化表格显示 4、优化表格显示效果
5、支持显示内核描述
</pre> </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() void KernelInformation::LoadInfo()
{ {
// 从 apt 获取信息 // 添加 GXDE Kernel Manager
//QStringList data = this->GetAptPackageList("linux-*");
/*for(QString i: data) {
}*/
AptPkgInfo info = AptPkgInfo("linux-", AptPkgInfo::PkgSearchOption::HeadInclude);
QStringList list = info.GetAptPackageList();
QJsonArray array; 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 = {}; indexMap = {};
for(QString i: list) { for(QString i: list) {
QJsonObject object; QJsonObject object;
@ -72,19 +81,7 @@ void KernelInformation::LoadInfo()
indexMap.insert(strTemp, array.count()); indexMap.insert(strTemp, array.count());
array.append(object); 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; this->listData = array;
emit loadFinished(NULL); emit loadFinished(NULL);
@ -160,7 +157,6 @@ QStringList KernelInformation::get_arch(int value) const
} }
if(!result.count()) { if(!result.count()) {
result << "all"; result << "all";
qDebug() << get_kernelData(value);
} }
return result; return result;
} }

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

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

@ -174,3 +174,16 @@ void MainWindow::on_actionUpdate_apt_cache_triggered()
installer->show(); 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_actionUpdate_apt_cache_triggered();
void on_actionAbout_QT_triggered();
void on_actionUpgrade_triggered();
private: private:
Ui::MainWindow *ui; Ui::MainWindow *ui;
KernelInformation *kernelInformation; KernelInformation *kernelInformation;

@ -118,8 +118,6 @@
<property name="title"> <property name="title">
<string>Program</string> <string>Program</string>
</property> </property>
<addaction name="actionUpdate_apt_cache"/>
<addaction name="separator"/>
<addaction name="actionExit"/> <addaction name="actionExit"/>
</widget> </widget>
<widget class="QMenu" name="menuHelp"> <widget class="QMenu" name="menuHelp">
@ -129,9 +127,19 @@
<addaction name="actionGitee"/> <addaction name="actionGitee"/>
<addaction name="actionGithub"/> <addaction name="actionGithub"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionAbout_QT"/>
<addaction name="actionAbout"/> <addaction name="actionAbout"/>
</widget> </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="menuProgram"/>
<addaction name="menuApt"/>
<addaction name="menuHelp"/> <addaction name="menuHelp"/>
</widget> </widget>
<widget class="QStatusBar" name="statusbar"/> <widget class="QStatusBar" name="statusbar"/>
@ -160,6 +168,16 @@
<string>Update apt cache</string> <string>Update apt cache</string>
</property> </property>
</action> </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> </widget>
<resources> <resources>
<include location="Resource.qrc"/> <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> <translation></translation>
</message> </message>
<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> <source>A kernel manager allows users to install or remove kernels easily.</source>
<translation>GXDE 便</translation> <translation>GXDE 便</translation>
</message> </message>
<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> <source>Warning: You may damage your system unless you know what you will do!</source>
<translation></translation> <translation></translation>
</message> </message>
<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> <source>Website</source>
<translation></translation> <translation></translation>
</message> </message>
@ -46,7 +51,6 @@
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../kernelinstaller.ui" line="33"/>
<location filename="../kernelinstaller.ui" line="46"/> <location filename="../kernelinstaller.ui" line="46"/>
<source>TextLabel</source> <source>TextLabel</source>
<translation></translation> <translation></translation>
@ -54,20 +58,35 @@
<message> <message>
<location filename="../kernelinstaller.cpp" line="27"/> <location filename="../kernelinstaller.cpp" line="27"/>
<source>Try to install </source> <source>Try to install </source>
<translation> </translation> <translation> </translation>
</message> </message>
<message> <message>
<location filename="../kernelinstaller.cpp" line="30"/> <location filename="../kernelinstaller.cpp" line="30"/>
<source>Try to remove </source> <source>Try to remove </source>
<translation> </translation> <translation> </translation>
</message> </message>
<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> <source>Done</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../kernelinstaller.cpp" line="140"/> <location filename="../kernelinstaller.cpp" line="161"/>
<source>Something error, exit code: </source> <source>Something error, exit code: </source>
<translation>退 </translation> <translation>退 </translation>
</message> </message>
@ -84,99 +103,136 @@
<translation>GXDE </translation> <translation>GXDE </translation>
</message> </message>
<message> <message>
<location filename="../mainwindow.ui" line="43"/> <location filename="../mainwindow.ui" line="49"/>
<source>TextLabel</source> <source>TextLabel</source>
<translation></translation> <translation></translation>
</message> </message>
<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> <source>Refresh</source>
<translation></translation> <translation></translation>
</message> </message>
<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> <source>Install</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../mainwindow.ui" line="77"/> <location filename="../mainwindow.ui" line="100"/>
<source>Remove</source> <source>Remove</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../mainwindow.ui" line="96"/> <location filename="../mainwindow.ui" line="119"/>
<source>Program</source> <source>Program</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../mainwindow.ui" line="102"/> <location filename="../mainwindow.ui" line="125"/>
<source>Help</source> <source>Help</source>
<translation></translation> <translation></translation>
</message> </message>
<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> <source>Exit</source>
<translation>退</translation> <translation>退</translation>
</message> </message>
<message> <message>
<location filename="../mainwindow.ui" line="120"/> <location filename="../mainwindow.ui" line="153"/>
<source>About</source> <source>About</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../mainwindow.ui" line="125"/> <location filename="../mainwindow.ui" line="158"/>
<source>Gitee</source> <source>Gitee</source>
<translation>Gitee</translation> <translation>Gitee</translation>
</message> </message>
<message> <message>
<location filename="../mainwindow.ui" line="130"/> <location filename="../mainwindow.ui" line="163"/>
<source>Github</source> <source>Github</source>
<translation>Github</translation> <translation>Github</translation>
</message> </message>
<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> <source>Kernel: </source>
<translation> </translation> <translation> </translation>
</message> </message>
<message> <message>
<location filename="../mainwindow.cpp" line="21"/> <location filename="../mainwindow.cpp" line="23"/>
<source>Arch: </source> <source>Arch: </source>
<translation> </translation> <translation> </translation>
</message> </message>
<message> <message>
<location filename="../mainwindow.cpp" line="34"/> <location filename="../mainwindow.cpp" line="35"/>
<source>ID</source> <source>ID</source>
<translation>ID</translation> <translation>ID</translation>
</message> </message>
<message> <message>
<location filename="../mainwindow.cpp" line="34"/> <location filename="../mainwindow.cpp" line="35"/>
<source>Kernel Name</source> <source>Kernel Name</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../mainwindow.cpp" line="34"/> <location filename="../mainwindow.cpp" line="35"/>
<source>Author</source> <source>Author</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../mainwindow.cpp" line="34"/> <location filename="../mainwindow.cpp" line="35"/>
<source>Arch</source> <source>Arch</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../mainwindow.cpp" line="34"/> <location filename="../mainwindow.cpp" line="35"/>
<source>Installed</source> <source>Installed</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../mainwindow.cpp" line="63"/> <location filename="../mainwindow.cpp" line="35"/>
<location filename="../mainwindow.cpp" line="106"/> <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> <source>Error</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../mainwindow.cpp" line="63"/> <location filename="../mainwindow.cpp" line="85"/>
<location filename="../mainwindow.cpp" line="106"/> <location filename="../mainwindow.cpp" line="132"/>
<location filename="../mainwindow.cpp" line="156"/>
<source>Nothing to choose</source> <source>Nothing to choose</source>
<translation></translation> <translation></translation>
</message> </message>