mirror of
https://gitee.com/spark-store-project/spark-store
synced 2026-03-25 23:09:44 +08:00
fix:修正使用软件名获取下载的问题
This commit is contained in:
@@ -140,10 +140,11 @@ bool AppDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, const QS
|
|||||||
// 更新按钮区域
|
// 更新按钮区域
|
||||||
QRect buttonRect(rect.right() - 80, rect.top() + (rect.height() - 30) / 2, 70, 30);
|
QRect buttonRect(rect.right() - 80, rect.top() + (rect.height() - 30) / 2, 70, 30);
|
||||||
if (buttonRect.contains(mouseEvent->pos())) {
|
if (buttonRect.contains(mouseEvent->pos())) {
|
||||||
QString appName = index.data(Qt::DisplayRole).toString();
|
// 修改这里:使用Qt::UserRole +1获取包名
|
||||||
|
QString packageName = index.data(Qt::UserRole + 1).toString();
|
||||||
m_isDownloading = true;
|
m_isDownloading = true;
|
||||||
m_progress = 0;
|
m_progress = 0;
|
||||||
m_downloadManager->startDownload(appName);
|
m_downloadManager->startDownload(packageName);
|
||||||
emit updateDisplay(); // 触发重绘
|
emit updateDisplay(); // 触发重绘
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "downloadmanager.h"
|
#include "downloadmanager.h"
|
||||||
|
#include <QDebug> // 包含 QDebug 头文件
|
||||||
|
|
||||||
DownloadManager::DownloadManager(QObject *parent) : QObject(parent), m_process(new QProcess(this))
|
DownloadManager::DownloadManager(QObject *parent) : QObject(parent), m_process(new QProcess(this))
|
||||||
{
|
{
|
||||||
@@ -17,7 +18,11 @@ DownloadManager::~DownloadManager()
|
|||||||
|
|
||||||
void DownloadManager::startDownload(const QString &appName)
|
void DownloadManager::startDownload(const QString &appName)
|
||||||
{
|
{
|
||||||
|
// 输出开始下载的日志
|
||||||
|
qDebug() << "开始下载应用:" << appName;
|
||||||
QString command = QString("aptss download --print-uris %1").arg(appName);
|
QString command = QString("aptss download --print-uris %1").arg(appName);
|
||||||
|
// 输出执行的命令日志
|
||||||
|
qDebug() << "执行命令:" << command;
|
||||||
m_process->start(command);
|
m_process->start(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user