| 1 |
/* |
| 2 |
* Copyright (C) 2020 ~ 2021 Uniontech Software Technology Co., Ltd. |
| 3 |
* |
| 4 |
* Author: ZhangYong <[email protected]> |
| 5 |
* |
| 6 |
* Maintainer: ZhangYong <[email protected]> |
| 7 |
* |
| 8 |
* This program is free software: you can redistribute it and/or modify |
| 9 |
* it under the terms of the GNU General Public License as published by |
| 10 |
* the Free Software Foundation, either version 3 of the License, or |
| 11 |
* any later version. |
| 12 |
* |
| 13 |
* This program is distributed in the hope that it will be useful, |
| 14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 |
* GNU General Public License for more details. |
| 17 |
* |
| 18 |
* You should have received a copy of the GNU General Public License |
| 19 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 20 |
*/ |
| 21 |
#ifndef ALBUMGLOBAL_H |
| 22 |
#define ALBUMGLOBAL_H |
| 23 |
|
| 24 |
#include <QPixmap> |
| 25 |
#include <QList> |
| 26 |
#include <QPixmap> |
| 27 |
#include <QIcon> |
| 28 |
#include <QFileInfo> |
| 29 |
#include <QSize> |
| 30 |
#include <QBuffer> |
| 31 |
#include <QPointer> |
| 32 |
#include <QDateTime> |
| 33 |
#include <QDebug> |
| 34 |
#include <QStandardPaths> |
| 35 |
#include <QDir> |
| 36 |
|
| 37 |
namespace albumGlobal { |
| 38 |
|
| 39 |
const QString CACHE_PATH = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) |
| 40 |
+ QDir::separator() + "deepin" + QDir::separator() + "deepin-album"/* + QDir::separator()*/; |
| 41 |
} |
| 42 |
|
| 43 |
//数据库存储的文件类型 |
| 44 |
enum DbFileType { |
| 45 |
DbFileTypeNull = 0, |
| 46 |
DbFileTypePic, //图片 |
| 47 |
DbFileTypeVideo //视频 |
| 48 |
}; |
| 49 |
|
| 50 |
struct DBAlbumInfo { |
| 51 |
QString name; |
| 52 |
// int count; |
| 53 |
QDateTime beginTime; |
| 54 |
QDateTime endTime; |
| 55 |
}; |
| 56 |
|
| 57 |
enum ItemType { |
| 58 |
ItemTypeNull = 1, |
| 59 |
ItemTypeBlank, //空白项,列表上方,悬浮控件下方高度 |
| 60 |
ItemTypePic, |
| 61 |
ItemTypeVideo, |
| 62 |
ItemTypeTimeLineTitle, //时间线标题 |
| 63 |
ItemTypeImportTimeLineTitle, //已导入时间线标题 |
| 64 |
ItemTypeMountImg //设备图片 |
| 65 |
}; |
| 66 |
|
| 67 |
struct DBImgInfo { |
| 68 |
//数据库 |
| 69 |
QString filePath; |
| 70 |
QString fileName; |
| 71 |
QString dirHash; |
| 72 |
QString dataHash; |
| 73 |
QDateTime time; // 图片创建时间 |
| 74 |
QDateTime changeTime; // 文件修改时间 |
| 75 |
QDateTime importTime; // 导入时间 Or 删除时间 |
| 76 |
QString albumname; // 图片所属相册名,以","分隔 |
| 77 |
QString albumSize; //原图片分辨率 |
| 78 |
QString videoDuration = "00:00"; //视频时长 |
| 79 |
ItemType itemType = ItemTypePic;//类型,空白,图片,视频 |
| 80 |
|
| 81 |
//显示 |
| 82 |
int imgWidth = 0; |
| 83 |
int imgHeight = 0; |
| 84 |
QString remainDays = "30天"; |
| 85 |
bool isSelected = false; |
| 86 |
QPixmap image = QPixmap(); |
| 87 |
QPixmap damagedPixmap = QPixmap(); |
| 88 |
bool bNotSupportedOrDamaged = false; |
| 89 |
bool bNeedDelete = false;//删除时间线与已导入标题时使用 |
| 90 |
QString date; |
| 91 |
QString num; |
| 92 |
|
| 93 |
bool operator==(const DBImgInfo &other) const |
| 94 |
{ |
| 95 |
return (dataHash == other.dataHash); |
| 96 |
} |
| 97 |
|
| 98 |
friend QDebug operator<<(QDebug &dbg, const DBImgInfo &info) |
| 99 |
{ |
| 100 |
dbg << "(DBImgInfo)[" |
| 101 |
<< " Path:" << info.filePath |
| 102 |
<< " Name:" << info.fileName |
| 103 |
<< " Dir:" << info.dirHash |
| 104 |
<< " Time:" << info.time |
| 105 |
<< " ChangeTime:" << info.changeTime |
| 106 |
<< " ImportTime:" << info.importTime |
| 107 |
<< " AlbumName:" << info.albumname |
| 108 |
<< " AlbumSize:" << info.albumSize |
| 109 |
<< "]"; |
| 110 |
return dbg; |
| 111 |
} |
| 112 |
}; |
| 113 |
typedef QList<DBImgInfo> DBImgInfoList; |
| 114 |
|
| 115 |
enum OpenImgViewType { |
| 116 |
VIEW_MAINWINDOW_ALLPIC = 0, |
| 117 |
VIEW_MAINWINDOW_TIMELINE = 1, |
| 118 |
VIEW_MAINWINDOW_ALBUM = 2 // |
| 119 |
}; |
| 120 |
|
| 121 |
Q_DECLARE_METATYPE(DBImgInfo) |
| 122 |
#endif // ALBUMGLOBAL_H |