表格支持自动调整行宽
This commit is contained in:
parent
90c04767ad
commit
20130363fb
@ -13,5 +13,6 @@
|
||||
<file>shell/kernel-installer-remove-template.sh</file>
|
||||
<file>translation/gxde-kernel-manager_zh_CN.qm</file>
|
||||
<file>shell/kernel-installer-reconfigure-template.sh</file>
|
||||
<file>shell/kernel-installer-update-template.sh</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@ -32,6 +32,9 @@ KernelInstaller::KernelInstaller(Option option, QStringList kernelList, QWidget
|
||||
case Option::Reconfigure:
|
||||
ui->m_status->setText(tr("Try to reconfigure ") + kernel);
|
||||
break;
|
||||
case Option::Update:
|
||||
ui->m_status->setText(tr("Try to update apt cache"));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@ -63,7 +66,7 @@ void KernelInstaller::StartInstaller()
|
||||
terminal->startShellProgram();
|
||||
processID = terminal->getShellPID();
|
||||
// 使用 QTimer 用于判断内核是否安装完成
|
||||
QTimer *runStatusTimer = new QTimer();
|
||||
runStatusTimer = new QTimer();
|
||||
runStatusTimer->setInterval(100);
|
||||
connect(runStatusTimer, &QTimer::timeout, this, &KernelInstaller::CheckInstallerStatusTimer);
|
||||
runStatusTimer->start();
|
||||
@ -87,6 +90,9 @@ QString KernelInstaller::BuildKernelInstallerBash(QStringList kernelList, QStrin
|
||||
case Option::Reconfigure:
|
||||
filePath = ":/shell/kernel-installer-reconfigure-template.sh";
|
||||
break;
|
||||
case Option::Update:
|
||||
filePath = ":/shell/kernel-installer-update-template.sh";
|
||||
break;
|
||||
}
|
||||
|
||||
QFile file(filePath);
|
||||
@ -136,6 +142,8 @@ void KernelInstaller::CheckInstallerStatusTimer()
|
||||
if(status == -1) {
|
||||
return;
|
||||
}
|
||||
// 关闭 Timer 防止一直发送错误的信号
|
||||
runStatusTimer->stop();
|
||||
emit InstallFinished(status);
|
||||
// 安装完成
|
||||
if(status == 0) {
|
||||
|
@ -17,7 +17,8 @@ public:
|
||||
enum Option {
|
||||
Install,
|
||||
Remove,
|
||||
Reconfigure
|
||||
Reconfigure,
|
||||
Update
|
||||
};
|
||||
|
||||
explicit KernelInstaller(Option option, QStringList kernelList, QWidget *parent = nullptr);
|
||||
@ -28,6 +29,7 @@ signals:
|
||||
void InstallFinished(int status);
|
||||
|
||||
private:
|
||||
QTimer *runStatusTimer;
|
||||
Option runOption;
|
||||
Ui::KernelInstaller *ui;
|
||||
QTermWidget *terminal;
|
||||
|
@ -58,6 +58,7 @@ void MainWindow::RefreshKernelListView(KernelInformation *info, bool showLocalAr
|
||||
line++;
|
||||
}
|
||||
ui->m_kernelShow->setModel(model);
|
||||
ui->m_kernelShow->resizeColumnsToContents();
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
@ -160,3 +161,13 @@ void MainWindow::on_m_reconfigureButton_clicked()
|
||||
installer->show();
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_actionUpdate_apt_cache_triggered()
|
||||
{
|
||||
KernelInstaller *installer = new KernelInstaller(KernelInstaller::Option::Update, QStringList());
|
||||
connect(installer, &KernelInstaller::InstallFinished, this, [this, installer](){
|
||||
RefreshKernelList();
|
||||
});
|
||||
installer->show();
|
||||
}
|
||||
|
||||
|
@ -37,6 +37,8 @@ private slots:
|
||||
|
||||
void on_m_reconfigureButton_clicked();
|
||||
|
||||
void on_actionUpdate_apt_cache_triggered();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
KernelInformation *kernelInformation;
|
||||
|
@ -27,9 +27,15 @@
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderCascadingSectionResizes">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
@ -112,6 +118,8 @@
|
||||
<property name="title">
|
||||
<string>Program</string>
|
||||
</property>
|
||||
<addaction name="actionUpdate_apt_cache"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionExit"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuHelp">
|
||||
@ -147,6 +155,11 @@
|
||||
<string>Github</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionUpdate_apt_cache">
|
||||
<property name="text">
|
||||
<string>Update apt cache</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="Resource.qrc"/>
|
||||
|
@ -1,6 +1,12 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
rm /tmp/gxde-kernel-manager-installer-status -f
|
||||
apt update
|
||||
apt install ${KernelList} -y
|
||||
aptPath="apt"
|
||||
which aptss > /dev/null
|
||||
if [[ $? == 0 ]]; then
|
||||
# 如果 aptss 存在,则使用 aptss
|
||||
aptPath="aptss"
|
||||
fi
|
||||
$aptPath update
|
||||
$aptPath install ${KernelList} -y
|
||||
rm -f "${kernelInstallerShellTempPath}"
|
11
shell/kernel-installer-update-template.sh
Normal file
11
shell/kernel-installer-update-template.sh
Normal file
@ -0,0 +1,11 @@
|
||||
#!/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
|
||||
rm -f "${kernelInstallerShellTempPath}"
|
Loading…
x
Reference in New Issue
Block a user