From b46c5c5edfe2d8645600fede8cc73d1fa859c990 Mon Sep 17 00:00:00 2001 From: chenyong Date: Mon, 10 Oct 2016 21:28:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=96=87=E4=BB=B6=E5=8F=91?= =?UTF-8?q?=E9=80=81=E3=80=81=E6=8E=A5=E6=94=B6=E5=AE=8C=E6=88=90=E6=8F=90?= =?UTF-8?q?=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- feiqlib/filetask.cpp | 9 +++++++++ feiqlib/filetask.h | 2 ++ mainwindow.cpp | 14 ++++++++++++++ 3 files changed, 25 insertions(+) diff --git a/feiqlib/filetask.cpp b/feiqlib/filetask.cpp index 1a4ba8e..85ec36d 100644 --- a/feiqlib/filetask.cpp +++ b/feiqlib/filetask.cpp @@ -80,3 +80,12 @@ FileTaskType FileTask::type() const { return mType; } + +string FileTask::getTaskTypeDes() const +{ + if (mType == FileTaskType::Upload) + return "发送"; + else if (mType == FileTaskType::Download) + return "接收"; + return ""; +} diff --git a/feiqlib/filetask.h b/feiqlib/filetask.h index cec65b6..3e50748 100644 --- a/feiqlib/filetask.h +++ b/feiqlib/filetask.h @@ -6,6 +6,7 @@ #include #include #include "fellow.h" +#include using namespace std; enum class FileTaskType{ @@ -48,6 +49,7 @@ public: string getDetailInfo() const; shared_ptr getContent() const; FileTaskType type() const; + string getTaskTypeDes() const; private: shared_ptr mFellow;//要发送给的用户,或文件来自该用户 int mProcess=0; diff --git a/mainwindow.cpp b/mainwindow.cpp index 4aa4ec4..31af3c6 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -147,6 +147,20 @@ void MainWindow::showResult(pair ret, const Content* content) void MainWindow::onStateChanged(FileTask *fileTask) { + if (fileTask->getState()==FileTaskState::Finish) + { + auto title = QString(fileTask->getTaskTypeDes().c_str())+"完成"; + PlatformDepend::instance().showNotify(title, fileTask->getContent()->filename.c_str()); + } + else if (fileTask->getState()==FileTaskState::Error) + { + auto title = QString(fileTask->getTaskTypeDes().c_str())+"失败"; + auto content = QString(fileTask->getContent()->filename.c_str()); + content += "\n"; + content += fileTask->getDetailInfo().c_str(); + PlatformDepend::instance().showNotify(title, content); + } + if (mDownloadFileDlg->isVisible()) { emit statChanged(fileTask);