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