2021-11-18 14:58:01 +00:00
|
|
|
#ifndef DUST3D_APPLICATION_DOCUMENT_WINDOW_H_
|
|
|
|
#define DUST3D_APPLICATION_DOCUMENT_WINDOW_H_
|
|
|
|
|
2018-04-07 08:44:39 +00:00
|
|
|
#include <QMainWindow>
|
|
|
|
#include <QShowEvent>
|
2018-04-08 08:05:12 +00:00
|
|
|
#include <QPushButton>
|
2018-04-10 07:59:20 +00:00
|
|
|
#include <QString>
|
|
|
|
#include <QMenu>
|
|
|
|
#include <QAction>
|
2019-03-17 06:23:39 +00:00
|
|
|
#include <map>
|
2019-07-23 10:13:58 +00:00
|
|
|
#include <QStringList>
|
2019-12-14 13:28:14 +00:00
|
|
|
#include <QLabel>
|
2020-12-19 08:54:39 +00:00
|
|
|
#include <QShortcut>
|
2021-11-18 14:58:01 +00:00
|
|
|
#include "model_widget.h"
|
|
|
|
#include "graphics_container_widget.h"
|
2022-10-02 19:45:46 +00:00
|
|
|
#include "mesh_preview_images_generator.h"
|
2018-04-07 08:44:39 +00:00
|
|
|
|
2020-12-19 02:29:24 +00:00
|
|
|
class Document;
|
2018-04-10 07:59:20 +00:00
|
|
|
class SkeletonGraphicsWidget;
|
2022-10-03 00:06:25 +00:00
|
|
|
class PartManageWidget;
|
2021-11-18 14:58:01 +00:00
|
|
|
class ToolbarButton;
|
|
|
|
class SpinnableToolbarIcon;
|
2018-04-10 07:59:20 +00:00
|
|
|
|
2018-11-05 15:47:21 +00:00
|
|
|
class DocumentWindow : public QMainWindow
|
2018-04-07 08:44:39 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
signals:
|
|
|
|
void initialized();
|
2019-03-17 06:23:39 +00:00
|
|
|
void uninialized();
|
2020-04-07 23:15:20 +00:00
|
|
|
void waitingExportFinished(const QString &filename, bool isSuccessful);
|
2018-04-07 08:44:39 +00:00
|
|
|
public:
|
2018-11-05 15:47:21 +00:00
|
|
|
DocumentWindow();
|
|
|
|
~DocumentWindow();
|
2019-03-17 14:04:12 +00:00
|
|
|
Document *document();
|
2020-10-16 13:51:16 +00:00
|
|
|
ModelWidget *modelWidget();
|
2018-11-05 15:47:21 +00:00
|
|
|
static DocumentWindow *createDocumentWindow();
|
2021-11-18 14:58:01 +00:00
|
|
|
static const std::map<DocumentWindow *, dust3d::Uuid> &documentWindows();
|
2018-04-10 07:59:20 +00:00
|
|
|
static void showAcknowlegements();
|
2018-08-27 08:50:40 +00:00
|
|
|
static void showContributors();
|
2020-07-12 22:19:34 +00:00
|
|
|
static void showSupporters();
|
2018-04-10 07:59:20 +00:00
|
|
|
static void showAbout();
|
2020-04-04 00:54:05 +00:00
|
|
|
static size_t total();
|
2018-04-07 08:44:39 +00:00
|
|
|
protected:
|
|
|
|
void showEvent(QShowEvent *event);
|
2018-04-10 07:59:20 +00:00
|
|
|
void closeEvent(QCloseEvent *event);
|
2018-04-13 01:42:19 +00:00
|
|
|
void mousePressEvent(QMouseEvent *event);
|
2018-04-07 08:44:39 +00:00
|
|
|
public slots:
|
|
|
|
void changeTurnaround();
|
2018-04-10 07:59:20 +00:00
|
|
|
void save();
|
|
|
|
void saveTo(const QString &saveAsFilename);
|
|
|
|
void open();
|
2019-06-10 22:47:12 +00:00
|
|
|
void openExample(const QString &modelName);
|
2019-07-23 10:13:58 +00:00
|
|
|
void openPathAs(const QString &path, const QString &asName);
|
2018-09-05 03:14:36 +00:00
|
|
|
void exportObjResult();
|
2018-10-25 09:18:04 +00:00
|
|
|
void exportGlbResult();
|
2018-10-20 05:07:11 +00:00
|
|
|
void exportFbxResult();
|
2018-04-10 07:59:20 +00:00
|
|
|
void newWindow();
|
|
|
|
void newDocument();
|
|
|
|
void saveAs();
|
|
|
|
void saveAll();
|
2019-03-10 01:56:54 +00:00
|
|
|
void gotoHomepage();
|
2018-04-10 07:59:20 +00:00
|
|
|
void viewSource();
|
|
|
|
void about();
|
2019-07-24 12:41:55 +00:00
|
|
|
void checkForUpdates();
|
2018-04-10 07:59:20 +00:00
|
|
|
void reportIssues();
|
|
|
|
void seeAcknowlegements();
|
2018-08-27 08:50:40 +00:00
|
|
|
void seeContributors();
|
2020-07-12 22:19:34 +00:00
|
|
|
void seeSupporters();
|
2018-04-18 13:18:10 +00:00
|
|
|
void seeReferenceGuide();
|
2018-04-10 07:59:20 +00:00
|
|
|
void documentChanged();
|
2018-04-16 22:54:41 +00:00
|
|
|
void updateXlockButtonState();
|
|
|
|
void updateYlockButtonState();
|
|
|
|
void updateZlockButtonState();
|
2018-09-08 04:20:31 +00:00
|
|
|
void updateRadiusLockButtonState();
|
2018-09-21 07:10:18 +00:00
|
|
|
void registerDialog(QWidget *widget);
|
|
|
|
void unregisterDialog(QWidget *widget);
|
2019-07-23 10:13:58 +00:00
|
|
|
void setExportWaitingList(const QStringList &filenames);
|
|
|
|
void checkExportWaitingList();
|
|
|
|
void exportObjToFilename(const QString &filename);
|
|
|
|
void exportFbxToFilename(const QString &filename);
|
|
|
|
void exportGlbToFilename(const QString &filename);
|
2019-10-19 13:14:36 +00:00
|
|
|
void toggleRotation();
|
2022-10-02 19:45:46 +00:00
|
|
|
void generateComponentPreviewImages();
|
|
|
|
void componentPreviewImagesReady();
|
2021-11-18 14:58:01 +00:00
|
|
|
void updateInprogressIndicator();
|
2020-12-20 06:20:59 +00:00
|
|
|
void openRecentFile();
|
|
|
|
void updateRecentFileActions();
|
2018-04-08 08:05:12 +00:00
|
|
|
private:
|
2018-04-10 07:59:20 +00:00
|
|
|
void setCurrentFilename(const QString &filename);
|
|
|
|
void updateTitle();
|
2020-12-19 08:12:50 +00:00
|
|
|
void initializeShortcuts();
|
2020-12-19 08:54:39 +00:00
|
|
|
void initializeToolShortcuts(SkeletonGraphicsWidget *graphicsWidget);
|
|
|
|
void initializeCanvasShortcuts(SkeletonGraphicsWidget *graphicsWidget);
|
|
|
|
QShortcut *createShortcut(QKeySequence key);
|
2020-12-20 06:20:59 +00:00
|
|
|
QString strippedName(const QString &fullFileName);
|
2021-11-18 14:58:01 +00:00
|
|
|
bool openFiles(const QStringList &pathList);
|
|
|
|
|
2020-12-19 08:12:50 +00:00
|
|
|
Document *m_document = nullptr;
|
|
|
|
bool m_firstShow = true;
|
|
|
|
bool m_documentSaved = true;
|
2018-09-21 07:10:18 +00:00
|
|
|
std::vector<QWidget *> m_dialogs;
|
2020-12-19 08:12:50 +00:00
|
|
|
bool m_isLastMeshGenerationSucceed = true;
|
|
|
|
quint64 m_currentUpdatedMeshId = 0;
|
2019-07-23 10:13:58 +00:00
|
|
|
QStringList m_waitingForExportToFilenames;
|
2021-11-18 14:58:01 +00:00
|
|
|
|
2018-04-16 22:54:41 +00:00
|
|
|
QString m_currentFilename;
|
|
|
|
|
2020-12-19 08:12:50 +00:00
|
|
|
ModelWidget *m_modelRenderWidget = nullptr;
|
2021-11-18 14:58:01 +00:00
|
|
|
SkeletonGraphicsWidget *m_canvasGraphicsWidget = nullptr;
|
2020-12-19 08:12:50 +00:00
|
|
|
GraphicsContainerWidget *m_graphicsContainerWidget = nullptr;
|
|
|
|
|
|
|
|
QMenu *m_fileMenu = nullptr;
|
|
|
|
QAction *m_newWindowAction = nullptr;
|
|
|
|
QAction *m_newDocumentAction = nullptr;
|
|
|
|
QAction *m_openAction = nullptr;
|
|
|
|
QMenu *m_openExampleMenu = nullptr;
|
|
|
|
QAction *m_saveAction = nullptr;
|
|
|
|
QAction *m_saveAsAction = nullptr;
|
|
|
|
QAction *m_saveAllAction = nullptr;
|
|
|
|
QAction *m_changeTurnaroundAction = nullptr;
|
2020-12-20 06:20:59 +00:00
|
|
|
std::vector<QAction *> m_recentFileActions;
|
|
|
|
QAction *m_recentFileSeparatorAction = nullptr;
|
2020-12-19 08:12:50 +00:00
|
|
|
QAction *m_quitAction = nullptr;
|
2021-11-18 14:58:01 +00:00
|
|
|
|
2020-12-19 08:12:50 +00:00
|
|
|
QAction *m_exportAsObjAction = nullptr;
|
|
|
|
QAction *m_exportAsGlbAction = nullptr;
|
|
|
|
QAction *m_exportAsFbxAction = nullptr;
|
|
|
|
|
|
|
|
QMenu *m_viewMenu = nullptr;
|
|
|
|
QAction *m_toggleWireframeAction = nullptr;
|
|
|
|
QAction *m_toggleRotationAction = nullptr;
|
|
|
|
QAction *m_toggleColorAction = nullptr;
|
2020-01-05 05:05:07 +00:00
|
|
|
bool m_modelRemoveColor = false;
|
2018-04-10 07:59:20 +00:00
|
|
|
|
2020-12-19 08:12:50 +00:00
|
|
|
QMenu *m_windowMenu = nullptr;
|
|
|
|
QAction *m_showPartsListAction = nullptr;
|
|
|
|
QAction *m_showDebugDialogAction = nullptr;
|
|
|
|
QAction *m_showMaterialsAction = nullptr;
|
|
|
|
|
|
|
|
QMenu *m_helpMenu = nullptr;
|
|
|
|
QAction *m_gotoHomepageAction = nullptr;
|
|
|
|
QAction *m_viewSourceAction = nullptr;
|
|
|
|
QAction *m_aboutAction = nullptr;
|
|
|
|
QAction *m_checkForUpdatesAction = nullptr;
|
|
|
|
QAction *m_reportIssuesAction = nullptr;
|
|
|
|
QAction *m_seeContributorsAction = nullptr;
|
|
|
|
QAction *m_seeSupportersAction = nullptr;
|
|
|
|
QAction *m_seeAcknowlegementsAction = nullptr;
|
|
|
|
QAction *m_seeReferenceGuideAction = nullptr;
|
|
|
|
|
2021-11-18 14:58:01 +00:00
|
|
|
ToolbarButton *m_xLockButton = nullptr;
|
|
|
|
ToolbarButton *m_yLockButton = nullptr;
|
|
|
|
ToolbarButton *m_zLockButton = nullptr;
|
|
|
|
ToolbarButton *m_radiusLockButton = nullptr;
|
2018-04-30 11:31:09 +00:00
|
|
|
|
2018-05-10 09:16:22 +00:00
|
|
|
QMetaObject::Connection m_partListDockerVisibleSwitchConnection;
|
2020-04-02 10:39:57 +00:00
|
|
|
|
2022-10-02 19:45:46 +00:00
|
|
|
MeshPreviewImagesGenerator *m_componentPreviewImagesGenerator = nullptr;
|
|
|
|
bool m_isComponentPreviewImagesObsolete = false;
|
2020-10-15 10:06:28 +00:00
|
|
|
|
2022-10-03 00:06:25 +00:00
|
|
|
PartManageWidget *m_partManageWidget = nullptr;
|
2020-11-17 14:31:51 +00:00
|
|
|
|
2021-11-18 14:58:01 +00:00
|
|
|
SpinnableToolbarIcon *m_inprogressIndicator = nullptr;
|
2020-12-19 08:54:39 +00:00
|
|
|
|
|
|
|
std::map<QKeySequence, QShortcut *> m_shortcutMap;
|
2018-04-07 08:44:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|