Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/src/imageitem.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (C) 2020 - 2026 Uniontech Software Technology Co.,Ltd.
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023 - 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

Expand All @@ -24,10 +24,11 @@
#include <QClipboard>
#include <QDir>
#include <QTime>
#include <QThread>

Check warning on line 27 in src/src/imageitem.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QThread> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QDBusPendingCall>

Check warning on line 28 in src/src/imageitem.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QDBusPendingCall> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QDBusPendingCallWatcher>

Check warning on line 29 in src/src/imageitem.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QDBusPendingCallWatcher> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QUrl>

Check warning on line 30 in src/src/imageitem.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QUrl> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <libffmpegthumbnailer/videothumbnailerc.h>

Check warning on line 31 in src/src/imageitem.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <libffmpegthumbnailer/videothumbnailerc.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.

extern "C" {
#include <libavformat/avformat.h>
Expand Down Expand Up @@ -417,11 +418,16 @@
//用看图打开
QDBusMessage message =
QDBusMessage::createMethodCall("com.deepin.imageViewer", "/", "com.deepin.imageViewer", "openImageFile");
message << filePath;
//看图内部按 URL 列表匹配文件,需传 file:// 形式路径
message << QUrl::fromLocalFile(filePath).toString();
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(QDBusConnection::sessionBus().asyncCall(message), this);
connect(watcher, &QDBusPendingCallWatcher::finished, this, [watcher, openWithBackup]() {
const QDBusMessage retMessage = watcher->reply();
bool ok = false;
if (retMessage.type() != QDBusMessage::ErrorMessage) {
ok = retMessage.arguments().value(0).toBool();
}
if (ok) {
qDebug() << "Successfully opened image with deepin-image-viewer via DBus";
} else {
qWarning() << "Failed to open image with deepin-image-viewer via DBus:" << retMessage.errorMessage();
Expand All @@ -442,7 +448,8 @@
ret = myProcess->startDetached(program, arguments);
#else
QDBusMessage message = QDBusMessage::createMethodCall("com.deepin.movie", "/", "com.deepin.movie", "openFile");
message << filePath;
//与图片分支保持一致,传 file:// 形式路径
message << QUrl::fromLocalFile(filePath).toString();
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(QDBusConnection::sessionBus().asyncCall(message), this);
connect(watcher, &QDBusPendingCallWatcher::finished, this, [watcher, openWithBackup]() {
const QDBusMessage retMessage = watcher->reply();
Expand Down
Loading