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

ProfileInterface.h 4.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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 PROFILEINTERFACE_H
  19. #define PROFILEINTERFACE_H
  20. #include "SnapmaticPicture.h"
  21. #include "SnapmaticWidget.h"
  22. #include "ProfileDatabase.h"
  23. #include "DatabaseThread.h"
  24. #include "SavegameWidget.h"
  25. #include "ProfileLoader.h"
  26. #include "ProfileWidget.h"
  27. #include "ExportThread.h"
  28. #include "SavegameData.h"
  29. #include "CrewDatabase.h"
  30. #include "pcg_basic.h"
  31. #include <QProgressDialog>
  32. #include <QSpacerItem>
  33. #include <QDateTime>
  34. #include <QWidget>
  35. #include <QList>
  36. #include <QMap>
  37. namespace Ui {
  38. class ProfileInterface;
  39. }
  40. enum class MassTool : int { Qualify = 0, Players = 1, Crew = 2, Title = 3 };
  41. class ProfileInterface : public QWidget
  42. {
  43. Q_OBJECT
  44. public:
  45. explicit ProfileInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, DatabaseThread *threadDB, QWidget *parent = 0);
  46. void setProfileFolder(QString folder, QString profile);
  47. void settingsApplied(int contentMode, bool languageChanged);
  48. void setupProfileInterface();
  49. void massTool(MassTool tool);
  50. void disableSelected();
  51. void enableSelected();
  52. int selectedWidgets();
  53. void retranslateUi();
  54. ~ProfileInterface();
  55. public slots:
  56. void contextMenuTriggeredPIC(QContextMenuEvent* ev);
  57. void contextMenuTriggeredSGD(QContextMenuEvent* ev);
  58. void hoverProfileWidgetCheck();
  59. void selectAllWidgets();
  60. void deselectAllWidgets();
  61. void exportSelected();
  62. void deleteSelected();
  63. void updatePalette();
  64. void importFiles();
  65. private slots:
  66. void on_cmdCloseProfile_clicked();
  67. void on_cmdImport_clicked();
  68. void pictureLoaded_event(SnapmaticPicture *picture);
  69. void pictureFixed_event(SnapmaticPicture *picture);
  70. void savegameLoaded_event(SavegameData *savegame, QString savegamePath);
  71. void loadingProgress(int value, int maximum);
  72. void pictureDeleted_event();
  73. void savegameDeleted_event();
  74. void profileLoaded_p();
  75. void profileWidgetSelected();
  76. void profileWidgetDeselected();
  77. void dialogNextPictureRequested(QWidget *dialog);
  78. void dialogPreviousPictureRequested(QWidget *dialog);
  79. void on_saProfileContent_dropped(const QMimeData *mimeData);
  80. protected:
  81. bool eventFilter(QObject *watched, QEvent *event);
  82. private:
  83. ProfileDatabase *profileDB;
  84. CrewDatabase *crewDB;
  85. DatabaseThread *threadDB;
  86. Ui::ProfileInterface *ui;
  87. ProfileLoader *profileLoader;
  88. ProfileWidget *previousWidget;
  89. QList<SavegameData*> savegames;
  90. QList<SnapmaticPicture*> pictures;
  91. QMap<ProfileWidget*,QString> widgets;
  92. QSpacerItem *saSpacerItem;
  93. QStringList fixedPictures;
  94. QColor highlightBackColor;
  95. QColor highlightTextColor;
  96. QString enabledPicStr;
  97. QString profileFolder;
  98. QString profileName;
  99. QString loadingStr;
  100. QString language;
  101. pcg32_random_t rng;
  102. bool contextMenuOpened;
  103. bool isProfileLoaded;
  104. int selectedWidgts;
  105. int contentMode;
  106. bool isSupportedImageFile(QString selectedFileName);
  107. bool importFile(QString selectedFile, QDateTime importDateTime, bool notMultiple);
  108. bool importUrls(const QMimeData *mimeData);
  109. bool importRemote(QUrl remoteUrl);
  110. bool importImage(QImage *snapmaticImage, QDateTime importDateTime);
  111. bool importFilesProgress(QStringList selectedFiles);
  112. bool importSnapmaticPicture(SnapmaticPicture *picture, bool warn = true);
  113. bool importSavegameData(SavegameData *savegame, QString sgdPath, bool warn = true);
  114. void pictureLoaded(SnapmaticPicture *picture, bool inserted);
  115. void savegameLoaded(SavegameData *savegame, QString savegamePath, bool inserted);
  116. void savegameDeleted(SavegameWidget *sgdWidget, bool isRemoteEmited = false);
  117. void pictureDeleted(SnapmaticWidget *picWidget, bool isRemoteEmited = false);
  118. void insertSnapmaticIPI(QWidget *widget);
  119. void insertSavegameIPI(QWidget *widget);
  120. void sortingProfileInterface();
  121. int getRandomUid();
  122. signals:
  123. void profileLoaded();
  124. void profileClosed();
  125. };
  126. #endif // PROFILEINTERFACE_H