| 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 SIGNALMANAGER_H |
| 22 |
#define SIGNALMANAGER_H |
| 23 |
|
| 24 |
#include "dbmanager/dbmanager.h" |
| 25 |
#include <QObject> |
| 26 |
#include <dgiomount.h> |
| 27 |
#include <thumbnail/thumbnaillistview.h> |
| 28 |
|
| 29 |
class ModulePanel; |
| 30 |
class SignalManager : public QObject |
| 31 |
{ |
| 32 |
Q_OBJECT |
| 33 |
public: |
| 34 |
static SignalManager *instance(); |
| 35 |
|
| 36 |
// For view images |
| 37 |
struct ViewInfo { |
| 38 |
ModulePanel *lastPanel; // For back to the last panel |
| 39 |
#ifndef LITE_DIV |
| 40 |
bool inDatabase = true; |
| 41 |
#else |
| 42 |
static constexpr bool inDatabase = false; |
| 43 |
#endif |
| 44 |
bool fullScreen = false; |
| 45 |
bool slideShow = false; |
| 46 |
int viewMainWindowID = 0; // 0:all picture 1:time line 2:album 4:view |
| 47 |
QString album = QString(); |
| 48 |
QString path; // Specific current open one |
| 49 |
QStringList paths = QStringList(); // Limit the view range |
| 50 |
QList<DBImgInfo> dBImgInfos; |
| 51 |
QString viewType = QString(); |
| 52 |
}; |
| 53 |
|
| 54 |
void emitSliderValueChg(int value); |
| 55 |
int getSliderValue(); |
| 56 |
|
| 57 |
void showInfoDlg(const QString &path, ItemType type = ItemTypeNull); |
| 58 |
signals: |
| 59 |
void enableMainMenu(bool enable); |
| 60 |
void updateTopToolbarLeftContent(QWidget *content); |
| 61 |
void updateTopToolbarMiddleContent(QWidget *content); |
| 62 |
void updateBottomToolbarContent(QWidget *content, bool wideMode = false); |
| 63 |
void updateTopToolbar(); |
| 64 |
void updateBottomToolbar(bool wideMode = false); |
| 65 |
void updateExtensionPanelContent(QWidget *content); |
| 66 |
void updatePicView(int i); |
| 67 |
void showTopToolbar(); |
| 68 |
void hideTopToolbar(bool immediately = false); |
| 69 |
void showBottomToolbar(); |
| 70 |
void hideBottomToolbar(bool immediately = false); |
| 71 |
void showExtensionPanel(); |
| 72 |
void hideExtensionPanel(bool immediately = false); |
| 73 |
|
| 74 |
void showImageView(int index); |
| 75 |
void hideImageView(); |
| 76 |
void showSlidePanel(int index); |
| 77 |
void hideSlidePanel(); |
| 78 |
void extensionPanelHeight(int height, bool immediately = false); |
| 79 |
void sendPathlist(QStringList pathlist); |
| 80 |
void enterView(bool immediately = false); |
| 81 |
void enterScaledMode(bool immediately = false); |
| 82 |
|
| 83 |
void gotoTimelinePanel(); |
| 84 |
void gotoSearchPanel(const QString &keyWord = ""); |
| 85 |
void gotoPanel(ModulePanel *panel); |
| 86 |
void backToMainPanel(); |
| 87 |
void activeWindow(); |
| 88 |
|
| 89 |
void imagesInserted(/*const DBImgInfoList infos*/); |
| 90 |
void imagesRemoved(); |
| 91 |
void imagesRemovedPar(const DBImgInfoList &infos); |
| 92 |
void imagesTrashInserted(/*const DBImgInfoList infos*/); |
| 93 |
void imagesTrashRemoved(/*const DBImgInfoList &infos*/); |
| 94 |
void editImage(const QString &path); |
| 95 |
void showInFileManager(const QString &path); |
| 96 |
void startSlideShow(const ViewInfo &vinfo, bool inDB = true); |
| 97 |
void viewImage(const ViewInfo &vinfo); |
| 98 |
void viewImageNoNeedReload(int &fileindex); |
| 99 |
void exportImage(const QStringList &paths); |
| 100 |
void updateFileName(const QString &fileName); |
| 101 |
void resizeFileName(); |
| 102 |
void sigAlbDelToast(const QString &albname); |
| 103 |
void sigAddToAlbToast(const QString &album); |
| 104 |
void sigAddDuplicatePhotos(); |
| 105 |
void updateStatusBarImportLabel(const QStringList &paths, int count, QString album = ""); |
| 106 |
void updateIcon(); |
| 107 |
void ImportSuccess(); |
| 108 |
void SearchEditClear(); |
| 109 |
void TransmitAlbumName(const QString &name); |
| 110 |
void ImportFailed(); |
| 111 |
void ImportSomeFailed(int successful, int failed); |
| 112 |
void ImportDonotFindPicOrVideo(); |
| 113 |
void RepeatImportingTheSamePhotos(QStringList importPaths, QStringList duplicatePaths, const QString &albumName); |
| 114 |
void ImgExportSuccess(); |
| 115 |
void ImgExportFailed(); |
| 116 |
void AlbExportSuccess(); |
| 117 |
void AlbExportFailed(); |
| 118 |
void DeviceImageLoadEnd(); |
| 119 |
void sigExporting(const QString &path); |
| 120 |
void sigRestoreStatus(); |
| 121 |
|
| 122 |
void updateButton(); |
| 123 |
void sigStartTimer(); |
| 124 |
void updatePauseButton(); |
| 125 |
void initSlideShowButton(); |
| 126 |
|
| 127 |
// Handle by album |
| 128 |
void gotoAlbumPanel(const QString &album = ""); |
| 129 |
void createAlbum(QStringList imgPath = QStringList()); |
| 130 |
|
| 131 |
// void sigDrawingBoard(QStringList Paths);//lmh0407 |
| 132 |
#if 1 |
| 133 |
void viewCreateAlbum(QString path, bool bmodel = true); |
| 134 |
void sigCreateNewAlbumFrom(const QString &albumname); |
| 135 |
#endif |
| 136 |
void importDir(const QString &dir); |
| 137 |
void insertedIntoAlbum(const QString &album, const QStringList &paths); |
| 138 |
void removedFromAlbum(const QString &album, const QStringList &paths); |
| 139 |
void sigSendKeywordsIntoALLPic(QString keywords, QString album = nullptr); |
| 140 |
void sigCreateNewAlbumFromDialog(const QString &albumname); |
| 141 |
void sigMainwindowSliderValueChg(int value); |
| 142 |
void sigMouseMove(bool show); |
| 143 |
void sigShowFullScreen(); |
| 144 |
void sigESCKeyActivated(); |
| 145 |
void sigESCKeyStopSlide(); |
| 146 |
void sigUpdataAlbumRightTitle(const QString &titlename); |
| 147 |
void sigUpdateTrashImageLoader(); |
| 148 |
void sigUpdateImageLoader(QStringList pathlist = QStringList()); |
| 149 |
void sigLoadMountImagesEnd(QString mountname); |
| 150 |
void sigCtrlADDKeyActivated(); |
| 151 |
void sigCtrlSubtractKeyActivated(); |
| 152 |
void sigDeletePhotos(int num); |
| 153 |
// void trashDelete(); |
| 154 |
void sigLoadOnePhoto(); |
| 155 |
void sigImportFailedToView(); |
| 156 |
void sigShortcutKeyDelete(); |
| 157 |
void sigShortcutKeyF2(); |
| 158 |
void picNotExists(bool immediately = false); |
| 159 |
|
| 160 |
void deleteByMenu(); |
| 161 |
void startImprot(); |
| 162 |
void popupWaitDialog(QString waittext, bool bneedprogress = true); |
| 163 |
void closeWaitDialog(); |
| 164 |
void progressOfWaitDialog(int allfiles, int completefiles); |
| 165 |
void waitDevicescan(); |
| 166 |
// void cacheThreadStop(); |
| 167 |
void sigSyncListviewModelData(QStringList paths, QString albumName, int actionType); |
| 168 |
|
| 169 |
//lmh0426设备退出,信号通知线程退出 |
| 170 |
void sigDevStop(QString devName); |
| 171 |
|
| 172 |
//对于外设后台加载是否暂停,在查看界面使用 -xiaolong |
| 173 |
void sigPauseOrStart(bool bpause); |
| 174 |
|
| 175 |
//监控到改变 |
| 176 |
void sigMonitorChanged(QStringList newfile); |
| 177 |
|
| 178 |
private: |
| 179 |
explicit SignalManager(QObject *parent = nullptr); |
| 180 |
|
| 181 |
private: |
| 182 |
static SignalManager *m_signalManager; |
| 183 |
|
| 184 |
int m_sliderValue; |
| 185 |
}; |
| 186 |
|
| 187 |
#endif // SIGNALMANAGER_H |