Debian Codegraph @

src/album/application.h

raw
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 APPLICATION_H_
22 #define APPLICATION_H_
23
24 #include <DApplication>
25 #include <QThread>
26 #include <QSharedMemory>
27 #include <dgiomount.h>
28 #include "dbmanager/dbmanager.h"
29
30 class MainWindow;
31 class Application;
32 class ConfigSetter;
33 class DatabaseManager;
34 class DBManager;
35 class Exporter;
36 class Importer;
37 class ScanPathsDialog;
38 class SignalManager;
39 class WallpaperSetter;
40 class ViewerThemeManager;
41 #if defined(dApp)
42 #undef dApp
43 #endif
44 //#define dApp (static_cast<Application *>(QCoreApplication::instance()))
45 #define dApp (Application::getApp())
46
47 DWIDGET_USE_NAMESPACE
48
49 class ImageLoader : public QObject
50 {
51 Q_OBJECT
52 public:
53 explicit ImageLoader(/*Application *parent, QStringList pathlist, QStringList pathlisttrash*/);
54
55 void ImportImageLoader(const DBImgInfoList &dbInfos, QString albumname = "");
56 void updateImageLoader(const QStringList &pathlist, const QList<QImage> &images = QList<QImage>());
57
58 signals:
59 void sigFinishiLoad();
60
61 private:
62 // Application *m_parent;
63 // QStringList m_pathlist;
64 // QStringList m_pathlisttrash;
65 };
66
67 class Application : public QObject
68 {
69 Q_OBJECT
70
71 public:
72 Application(/*int &argc, char **argv*/);
73 ~Application();
74
75 DApplication *getDAppNew();
76 static Application *getApp();
77 static void setApp(DApplication *);
78
79 ConfigSetter *setter = nullptr;
80 SignalManager *signalM = nullptr;
81 ViewerThemeManager *viewerTheme = nullptr;
82 WallpaperSetter *wpSetter = nullptr;
83
84 ImageLoader *m_imageloader;
85
86 static bool isWaylandPlatform();
87 signals:
88 void sigstartLoad();
89
90 public slots:
91
92 private:
93 void initChildren();
94
95 QThread *m_LoadThread;
96 public :
97 //LMH0420设置单例程序
98 void setupsinglecase();
99 //LMH0420是否已有相同程序运行
100 bool isRunning();
101 //打印信息
102 bool sendMessage(const QString &message);
103
104 //test
105 void setMainWindow(MainWindow *window);
106 MainWindow *getMainWindow();
107 public slots:
108 void checkForMessage();
109 signals:
110 void messageAvailable(QString message);
111 private:
112 bool _isRunning;
113 QSharedMemory sharedMemory;
114 MainWindow *m_mainwindow;
115 static DApplication *dAppNew;
116 static Application *dApp1;
117 };
118
119 #endif // APPLICATION_H_