1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
|
/**************************************************************************
** **
** Copyright (C) 2011-2026 Lukas Spies **
** Contact: https://photoqt.org **
** **
** This file is part of PhotoQt. **
** **
** PhotoQt is free software: you can redistribute it and/or modify **
** it under the terms of the GNU General Public License as published by **
** the Free Software Foundation, either version 2 of the License, or **
** (at your option) any later version. **
** **
** PhotoQt is distributed in the hope that it will be useful, **
** but WITHOUT ANY WARRANTY; without even the implied warranty of **
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the **
** GNU General Public License for more details. **
** **
** You should have received a copy of the GNU General Public License **
** along with PhotoQt. If not, see <http://www.gnu.org/licenses/>. **
** **
**************************************************************************/
#pragma once
#include <QObject>
#include <QMutex>
#include <QMap>
class PQCNotifyCPP : public QObject {
Q_OBJECT
public:
static PQCNotifyCPP &get() {
static PQCNotifyCPP instance;
return instance;
}
PQCNotifyCPP(PQCNotifyCPP const&) = delete;
void operator=(PQCNotifyCPP const&) = delete;
/******************************************************/
// Some startup properties.
// These might be set before PQCConstants is set up from QML.
// Thus we cache them here so that we can initialize them properly
// in its constructor.
void setFilePath(QString val) { m_filepath = val; Q_EMIT filePathChanged(val); }
void setVirtualFiles(QStringList val) { m_virtualFiles = val; Q_EMIT virtualFilesChanged(val); }
void setVirtualFolders(QStringList val) { m_virtualFolders = val; Q_EMIT virtualFoldersChanged(val); }
void setDebug(bool val) { m_debug = val; Q_EMIT debugChanged(val); }
void setStartInTray(bool val) { m_startInTray = val; Q_EMIT startInTrayChanged(val); }
void setHaveScreenshots(bool val) { m_haveScreenshots = val; Q_EMIT haveScreenshotsChanged(val); }
void setSettingUpdate(QStringList val) { m_settingUpdate = val; Q_EMIT settingUpdateChanged(val); }
QString getFilePath() { return m_filepath; }
bool getDebug() { return m_debug; }
bool getStartInTray() { return m_startInTray; }
bool getHaveScreenshots() { return m_haveScreenshots; }
QStringList getSettingUpdate() { return m_settingUpdate; }
QStringList getVirtualFolders() { return m_virtualFolders; }
QStringList getVirtualFiles() { return m_virtualFiles; }
/******************************************************/
private:
PQCNotifyCPP(QObject *parent = 0) : QObject(parent) {
m_filepath = "";
m_debug = false;
m_startInTray = false;
m_haveScreenshots = false;
m_settingUpdate.clear();
}
/******************************************************/
// Some startup properties.
// These might be set before PQCConstants is set up from QML.
// Thus we cache them here so that we can initialize them properly
// in its constructor.
bool m_debug;
QString m_filepath;
bool m_startInTray;
bool m_haveScreenshots;
QStringList m_settingUpdate;
QStringList m_virtualFolders;
QStringList m_virtualFiles;
/******************************************************/
Q_SIGNALS:
/*************************************************************/
// these are passed from PQCNotifyQML to C++ (be careful)
// reset current session to free up as much memory as possible
void resetSessionData();
void reprocessStartupMessage();
/*************************************************************/
// these cached startup property signals are picked up in PQCConstants
void filePathChanged(QString val);
void virtualFilesChanged(QStringList val);
void virtualFoldersChanged(QStringList val);
void debugChanged(bool val);
void startInTrayChanged(bool val);
void haveScreenshotsChanged(bool val);
void settingUpdateChanged(QStringList val);
void addDebugLogMessages(QString val);
void setColorProfileFor(QString path, QString val);
/*************************************************************/
// these are signals from C++ to C++, no QML interaction
void disableColorSpaceSupport();
/*************************************************************/
// this are picked up by PQCNotifyQML and passed on to QML
// command line signals
void cmdOpen();
void cmdShow();
void cmdHide();
void cmdQuit();
void cmdToggle();
void cmdShortcutSequence(QString seq);
void cmdTray(bool tray);
// key/shortcuts related
void keyPress(int key, int modifiers);
void keyRelease(int key, int modifiers);
void mouseWindowExit();
void mouseWindowEnter();
void showNotificationMessage(QString title, QString msg);
void storeLocationToDatabase(QString path, QPointF location);
void showExtension(QString ele);
void showSettingsForExtension(QString id);
/*************************************************************/
// these are passed from PQCConstants to C++
void currentlyVisibleAreaChanged(QRectF val);
void currentWindowSizeChanged(QSize sze);
void currentImageResolutionChanged(QSize sze);
void currentImageRotationChanged(int rot);
void currentImageScaleChanged(double scale);
void currentImageIsVideoChanged(bool val);
void currentImageIsPhotoSphereChanged(bool val);
void currentImageIsMotionPhotoChanged(bool val);
void currentImageIsAnimatedChanged(bool val);
void currentImageIsDocumentChanged(bool val);
void currentImageIsArchiveChanged(bool val);
void insidePhotoSphereChanged(bool val);
void motionPhotoIsPlayingChanged(bool val);
void animatedImageIsPlayingChanged(bool val);
void barcodesAreDisplayedChanged(bool val);
void slideshowActiveChanged(bool val);
};
|