Open Source Snapmatic picture and Savegame viewer/editor for GTA V https://gta5view.syping.de/

PictureDialog.h 4.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. /*****************************************************************************
  2. * gta5view Grand Theft Auto V Profile Viewer
  3. * Copyright (C) 2016-2017 Syping
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. *****************************************************************************/
  18. #ifndef PICTUREDIALOG_H
  19. #define PICTUREDIALOG_H
  20. #include "SnapmaticPicture.h"
  21. #include "ProfileDatabase.h"
  22. #include "CrewDatabase.h"
  23. #include <QResizeEvent>
  24. #include <QMouseEvent>
  25. #include <QToolBar>
  26. #include <QDialog>
  27. #include <QEvent>
  28. #include <QMenu>
  29. #ifdef GTA5SYNC_WIN
  30. #if QT_VERSION >= 0x050200
  31. #ifdef GTA5SYNC_APV
  32. #include <dwmapi.h>
  33. #endif
  34. #endif
  35. #endif
  36. namespace Ui {
  37. class PictureDialog;
  38. }
  39. class PictureDialog : public QDialog
  40. {
  41. Q_OBJECT
  42. public:
  43. explicit PictureDialog(ProfileDatabase *profileDB, CrewDatabase *crewDB, QWidget *parent = 0);
  44. explicit PictureDialog(ProfileDatabase *profileDB, CrewDatabase *crewDB, QString profileName, QWidget *parent = 0);
  45. explicit PictureDialog(bool primaryWindow, ProfileDatabase *profileDB, CrewDatabase *crewDB, QWidget *parent = 0);
  46. explicit PictureDialog(bool primaryWindow, ProfileDatabase *profileDB, CrewDatabase *crewDB, QString profileName, QWidget *parent = 0);
  47. void setupPictureDialog();
  48. void setSnapmaticPicture(SnapmaticPicture *picture, bool readOk, bool indexed, int index);
  49. void setSnapmaticPicture(SnapmaticPicture *picture, bool readOk, int index);
  50. void setSnapmaticPicture(SnapmaticPicture *picture, bool readOk);
  51. void setSnapmaticPicture(SnapmaticPicture *picture, int index);
  52. void setSnapmaticPicture(SnapmaticPicture *picture);
  53. void addPreviousNextButtons();
  54. void stylizeDialog();
  55. bool isIndexed();
  56. int getIndex();
  57. ~PictureDialog();
  58. public slots:
  59. void crewNameUpdated();
  60. void playerNameUpdated();
  61. void dialogNextPictureRequested();
  62. void dialogPreviousPictureRequested();
  63. void adaptNewDialogSize(QSize newLabelSize);
  64. void exportCustomContextMenuRequested(const QPoint &pos);
  65. private slots:
  66. void copySnapmaticPicture();
  67. void exportSnapmaticPicture();
  68. void triggerFullscreenDoubeClick();
  69. void on_labPicture_mouseDoubleClicked(Qt::MouseButton button);
  70. void on_labPicture_customContextMenuRequested(const QPoint &pos);
  71. void exportCustomContextMenuRequestedPrivate(const QPoint &pos, bool fullscreen);
  72. void nextPictureRequestedSlot();
  73. void previousPictureRequestedSlot();
  74. void editSnapmaticProperties();
  75. void editSnapmaticRawJson();
  76. void editSnapmaticImage();
  77. void renderOverlayPicture();
  78. void renderPicture();
  79. void openPreviewMap();
  80. void updated();
  81. void customSignal(QString signal);
  82. signals:
  83. void nextPictureRequested();
  84. void previousPictureRequested();
  85. void newPictureCommited(QImage picture);
  86. void endDatabaseThread();
  87. protected:
  88. void closeEvent(QCloseEvent *ev);
  89. bool eventFilter(QObject *obj, QEvent *ev);
  90. void mousePressEvent(QMouseEvent *ev);
  91. bool event(QEvent *event);
  92. #ifdef GTA5SYNC_WIN
  93. #if QT_VERSION >= 0x050200
  94. #ifdef GTA5SYNC_APV
  95. bool nativeEvent(const QByteArray &eventType, void *message, long *result);
  96. LRESULT HitTestNCA(HWND hWnd, LPARAM lParam);
  97. void resizeEvent(QResizeEvent *event);
  98. #endif
  99. #endif
  100. #endif
  101. private:
  102. QString generateCrewString();
  103. QString generatePlayersString();
  104. bool primaryWindow;
  105. ProfileDatabase *profileDB;
  106. CrewDatabase *crewDB;
  107. QString profileName;
  108. Ui::PictureDialog *ui;
  109. QMap<QString, QString> globalMap;
  110. SnapmaticPicture *smpic;
  111. QWidget *fullscreenWidget;
  112. QImage avatarAreaPicture;
  113. QImage snapmaticPicture;
  114. QImage overlayTempImage;
  115. QString jsonDrawString;
  116. QString windowTitleStr;
  117. QString picAreaStr;
  118. QString crewStr;
  119. bool overlayEnabled;
  120. bool rqFullscreen;
  121. bool naviEnabled;
  122. bool previewMode;
  123. bool indexed;
  124. int index;
  125. int avatarLocX;
  126. int avatarLocY;
  127. int avatarSize;
  128. QMenu *manageMenu;
  129. #ifdef GTA5SYNC_WIN
  130. #if QT_VERSION >= 0x050200
  131. QPoint dragPosition;
  132. bool dragStart;
  133. #endif
  134. #endif
  135. };
  136. #endif // PICTUREDIALOG_H