Browse Source

新增文件发送、接收完成提醒

tags/v1.1
chenyong 8 years ago
parent
commit
b46c5c5edf
3 changed files with 25 additions and 0 deletions
  1. +9
    -0
      feiqlib/filetask.cpp
  2. +2
    -0
      feiqlib/filetask.h
  3. +14
    -0
      mainwindow.cpp

+ 9
- 0
feiqlib/filetask.cpp View File

@@ -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 "";
}

+ 2
- 0
feiqlib/filetask.h View File

@@ -6,6 +6,7 @@
#include <memory>
#include <functional>
#include "fellow.h"
#include <string>
using namespace std;

enum class FileTaskType{
@@ -48,6 +49,7 @@ public:
string getDetailInfo() const;
shared_ptr<FileContent> getContent() const;
FileTaskType type() const;
string getTaskTypeDes() const;
private:
shared_ptr<Fellow> mFellow;//要发送给的用户,或文件来自该用户
int mProcess=0;


+ 14
- 0
mainwindow.cpp View File

@@ -147,6 +147,20 @@ void MainWindow::showResult(pair<bool, string> 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);


Loading…
Cancel
Save