1 /* 2 * %kadu copyright begin% 3 * Copyright 2011 Piotr Galiszewski (piotr.galiszewski@kadu.im) 4 * Copyright 2011, 2013, 2014 Rafał Przemysław Malinowski (rafal.przemyslaw.malinowski@gmail.com) 5 * %kadu copyright end% 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License as 9 * published by the Free Software Foundation; either version 2 of 10 * the License, or (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 21 #pragma once 22 23 #include <vector> 24 25 #include <QtCore/QObject> 26 #include <QtCore/QPointer> 27 #include <QtCore/QRect> 28 #include <QtGui/QPixmap> 29 #include <injeqt/injeqt.h> 30 31 #include "screenshot-mode.h" 32 33 class QAction; 34 class QLabel; 35 class QMenu; 36 37 class ActionDescription; 38 class ChatWidget; 39 class ConfigurationUiHandler; 40 class Configuration; 41 class CropImageWidget; 42 class IconsManager; 43 class PluginInjectedFactory; 44 class ScreenShotConfiguration; 45 class ScreenshotNotificationService; 46 class ScreenshotTaker; 47 class ScreenshotToolBox; 48 class ScreenshotWidget; 49 50 class ScreenShot : public QObject 51 { 52 Q_OBJECT 53 54 QPointer<Configuration> m_configuration; 55 QPointer<IconsManager> m_iconsManager; 56 QPointer<PluginInjectedFactory> m_pluginInjectedFactory; 57 QPointer<ScreenShotConfiguration> m_screenShotConfiguration; 58 QPointer<ScreenshotNotificationService> m_screenshotNotificationService; 59 60 ScreenShotMode Mode; 61 ScreenshotTaker *MyScreenshotTaker; 62 ChatWidget *MyChatWidget; 63 64 bool warnedAboutSize; 65 66 void checkShotsSize(); 67 68 void pasteImageClause(const QString &path); 69 bool checkImageSize(long int size); 70 71 private slots: 72 INJEQT_SET void setConfiguration(Configuration *configuration); 73 INJEQT_SET void setIconsManager(IconsManager *iconsManager); 74 INJEQT_SET void setPluginInjectedFactory(PluginInjectedFactory *pluginInjectedFactory); 75 INJEQT_SET void setScreenshotNotificationService(ScreenshotNotificationService *screenshotNotificationService); 76 INJEQT_INIT void init(); 77 78 void screenshotTaken(QPixmap screenshot, bool needsCrop); 79 void screenshotNotTaken(); 80 81 void screenshotReady(QPixmap pixmap); 82 83 public: 84 explicit ScreenShot(ScreenShotConfiguration *screenShotConfiguration, ChatWidget *chatWidget); 85 virtual ~ScreenShot(); 86 87 void takeStandardShot(); 88 void takeShotWithChatWindowHidden(); 89 void takeWindowShot(); 90 91 }; 92