!359 修复在qt 5.11 的编译问题

Merge pull request !359 from shenmo/dev
This commit is contained in:
shenmo 2025-09-05 13:56:46 +00:00 committed by Gitee
commit 85e3e35e1c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 64 additions and 60 deletions

View File

@ -1,4 +1,5 @@
#include "applistmodel.h"
#include <QDebug>
AppListModel::AppListModel(QObject *parent) : QAbstractListModel(parent) {}

View File

@ -24,7 +24,7 @@ QStringList aptssUpdater::getUpdateablePackages()
}
QString output = process.readAllStandardOutput();
QStringList lines = output.split('\n', Qt::SkipEmptyParts);
QStringList lines = output.split('\n', QString::SkipEmptyParts);
// 创建临时文件
QTemporaryFile tempFile;
@ -131,7 +131,7 @@ QStringList aptssUpdater::getDesktopAppNames()
// 获取包文件列表
dpkgProcess.start("dpkg", QStringList() << "-L" << packageName);
dpkgProcess.waitForFinished();
QStringList files = QString(dpkgProcess.readAllStandardOutput()).split('\n', Qt::SkipEmptyParts);
QStringList files = QString(dpkgProcess.readAllStandardOutput()).split('\n', QString::SkipEmptyParts);
// 先检查常规应用目录
QStringList regularDesktopFiles = files.filter("/usr/share/applications/");
@ -237,7 +237,7 @@ QStringList aptssUpdater::getPackageIcons()
// 获取包文件列表
dpkgProcess.start("dpkg", QStringList() << "-L" << packageName);
dpkgProcess.waitForFinished();
QStringList files = QString(dpkgProcess.readAllStandardOutput()).split('\n', Qt::SkipEmptyParts);
QStringList files = QString(dpkgProcess.readAllStandardOutput()).split('\n', QString::SkipEmptyParts);
// 查找.desktop文件
QStringList desktopFiles = files.filter(QRegularExpression("/(usr/share|opt/apps)/.*\\.desktop$"));

View File

@ -20,6 +20,13 @@ shopt -s nullglob
# third argument are piped to stderr.
THREADS=$(nproc 2>/dev/null || echo 4)
# Set color variables.
cGreen='\e[0;32m'
cRed='\e[0;31m'
cBlue='\e[0;34m'
endColor='\e[0m'
msg(){
msg_options=()
case "$2" in
@ -36,6 +43,51 @@ msg(){
echo -e "${msg_options[@]}" "${aptfast_prefix}${beginColor}$1${endColor}" >&2
fi
}
msg_already_running()
{
msg "Other aptss is running. Waited $timer senconds..." "normal"
msg "有其他的aptss正在运行。已经等待了$timer秒" "normal"
}
# Check if a lock file exists.
#if [ -f "$LCK_FILE.lock" ]; then
# msg_already_running
# exit 1
#fi
LCK_FD=99
# create the lock file and lock it, die on failure
_create_lock()
{
eval "exec $LCK_FD>\"$LCK_FILE.lock\""
# 设置 trap 来清理资源
trap "cleanup_aptfast" EXIT
trap "cleanup_aptfast; exit 1" INT TERM
timer=0
max_wait=180 # 最大等待时间为180秒3分钟
until $(flock -xn $LCK_FD); do
msg_already_running
sleep 1
let timer+=1
if [ $timer -ge $max_wait ]; then
echo "timeout"
exit 1
fi
done
unset timer
}
# unlock and remove the lock file
_remove_lock()
{
flock -u "$LCK_FD" 2>/dev/null
rm -f "$LCK_FILE.lock"
}
# Search for known options and decide if root privileges are needed.
root=$#
@ -44,6 +96,7 @@ for argument in "$@"; do
case "$argument" in
upgrade | full-upgrade | install | dist-upgrade | build-dep)
option="install"
_create_lock
;;
clean | autoclean)
option="clean"
@ -122,7 +175,7 @@ LCK_FILE="/tmp/apt-fast-in-container.lock"
else
LCK_FILE="/tmp/apt-fast.lock"
fi
LCK_FD=99
# Set default package manager, APT cache, temporary download dir,
# temporary download list file, and maximal parallel downloads
@ -145,11 +198,9 @@ if [ -f "$NETRC" ]; then
fi
APTAUTHFILES+=("$NETRCDIR"*)
if [ "$IS_ACE_ENV" != "" ];then
DLLIST="/tmp/apt-fast-in-container.list"
else
DLLIST="/tmp/apt-fast.list"
fi
LISTTEMP=$(mktemp -d)
DLLIST="${LISTTEMP}/apt-fast.list"
@ -164,11 +215,7 @@ MIRRORS=()
aptfast_prefix=
# aptfast_prefix="$(date '+%b %_d %T.%N') apt-fast: "
# Set color variables.
cGreen='\e[0;32m'
cRed='\e[0;31m'
cBlue='\e[0;34m'
endColor='\e[0m'
# Set timout value for apt-fast download confirmation dialog.
# Value is in seconds.
@ -240,51 +287,7 @@ if [ ! -t 1 ]; then
fi
msg_already_running()
{
msg "Other aptss is running. Waited $timer senconds..." "normal"
msg "有其他的aptss正在运行。已经等待了$timer秒" "normal"
}
# Check if a lock file exists.
#if [ -f "$LCK_FILE.lock" ]; then
# msg_already_running
# exit 1
#fi
# create the lock file and lock it, die on failure
_create_lock()
{
eval "exec $LCK_FD>\"$LCK_FILE.lock\""
# 设置 trap 来清理资源
trap "cleanup_aptfast" EXIT
trap "cleanup_aptfast; exit 1" INT TERM
timer=0
max_wait=180 # 最大等待时间为180秒3分钟
until $(flock -xn $LCK_FD); do
msg_already_running
sleep 1
let timer+=1
if [ $timer -ge $max_wait ]; then
echo "timeout"
exit 1
fi
done
unset timer
}
# unlock and remove the lock file
_remove_lock()
{
flock -u "$LCK_FD" 2>/dev/null
rm -f "$LCK_FILE.lock"
}
# Move download file away so missing permissions won't stop usage.
CLEANUP_STATE=0
@ -294,7 +297,7 @@ cleanup_dllist()
then
if ! mv -- "$DLLIST{,.old}" 2>/dev/null
then
if ! rm -f -- "$DLLIST" 2>/dev/null
if ! rm -fr -- "${LISTTEMP}" 2>/dev/null
then
msg "Could not clean up download list file." "warning"
msg "无法清除下载列表文件." "warning"
@ -608,7 +611,7 @@ display_downloadfile(){
# Create and insert a PID number to lockfile.
_create_lock
# Make sure aria2c (in general first parameter from _DOWNLOADER) is available.
CMD="$(echo "$_DOWNLOADER" | sed 's/^\s*\([^ ]\+\).*$/\1/')"