#include "fileitem.h"

FileItem::FileItem(QObject *parent) :
    QObject(parent)
{
    clear();
}

FileItem::~FileItem()
{
    clear();
}

FileItem::FileItem(const FileItem & item) :
    QObject(item.parent())
{
    copyData(item);
}

FileItem & FileItem::operator=(const FileItem & item)
{
    copyData(item);
    return *this;
}

void FileItem::clear()
{
    m_filePathName.clear();     // 文件路径
    m_showInfo.clear();         // 显示信息
    m_imagePath.clear();        // 图片路径
    m_previewImage = QImage();  // 图形预览
}

// 拷贝
void FileItem::copyData(const FileItem & item)
{
    if (this != &item)
    {
        this->m_filePathName    = item.m_filePathName;     // 文件路径
        this->m_showInfo        = item.m_showInfo;         // 显示信息
        this->m_imagePath       = item.m_imagePath;        // 图片路径
        this->m_previewImage    = item.m_previewImage;     // 图形预览
    }
}

#if (1)
void FileItem::setFileInfo(QString & path, QString & show, QImage & previewImg)
#else
void FileItem::setFileInfo(QString path, QString show, QImage previewImg)
#endif
{
    m_filePathName  = path;         // 文件路径
    m_showInfo      = show;         // 显示信息
    m_previewImage  = previewImg;   // 预览图形
}


void FileItem::setFileInfo(QString path, QString show, QString imagePath)
{
    m_filePathName  = path;         // 文件路径
    m_showInfo      = show;         // 显示信息
    m_imagePath     = imagePath;    // 图片路径
}
