dust3d/application/sources/document_window.h

196 lines
6.3 KiB
C
Raw Normal View History

#ifndef DUST3D_APPLICATION_DOCUMENT_WINDOW_H_
#define DUST3D_APPLICATION_DOCUMENT_WINDOW_H_
#include "component_preview_images_decorator.h"
#include "graphics_container_widget.h"
#include "mesh_preview_images_generator.h"
#include "model_widget.h"
#include <QAction>
#include <QLabel>
#include <QMainWindow>
#include <QMenu>
2018-04-08 08:05:12 +00:00
#include <QPushButton>
#include <QShortcut>
#include <QShowEvent>
#include <QString>
#include <QStringList>
#include <map>
#include <memory>
2020-12-19 02:29:24 +00:00
class Document;
class SkeletonGraphicsWidget;
2022-10-03 00:06:25 +00:00
class PartManageWidget;
2022-11-11 12:06:06 +00:00
class BoneManageWidget;
class ToolbarButton;
class SpinnableToolbarIcon;
class DocumentWindow : public QMainWindow {
Q_OBJECT
signals:
void initialized();
void uninialized();
void waitingExportFinished(const QString& filename, bool isSuccessful);
void workingStatusChanged(bool isWorking);
public:
DocumentWindow();
~DocumentWindow();
Document* document();
ModelWidget* modelWidget();
bool isWorking();
static DocumentWindow* createDocumentWindow();
static const std::map<DocumentWindow*, dust3d::Uuid>& documentWindows();
static void showAcknowlegements();
static void showContributors();
static void showSupporters();
static void showAbout();
static size_t total();
protected:
void showEvent(QShowEvent* event);
void closeEvent(QCloseEvent* event);
void mousePressEvent(QMouseEvent* event);
public slots:
void changeTurnaround();
void save();
void saveTo(const QString& saveAsFilename);
void open();
void openExample(const QString& modelName);
void openPathAs(const QString& path, const QString& asName);
2018-09-05 03:14:36 +00:00
void exportObjResult();
void exportGlbResult();
void exportFbxResult();
void newWindow();
void newDocument();
void saveAs();
void saveAll();
2019-03-10 01:56:54 +00:00
void gotoHomepage();
void viewSource();
void about();
2019-07-24 12:41:55 +00:00
void checkForUpdates();
void reportIssues();
void seeAcknowlegements();
void seeContributors();
void seeSupporters();
2018-04-18 13:18:10 +00:00
void seeReferenceGuide();
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();
void registerDialog(QWidget* widget);
void unregisterDialog(QWidget* widget);
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();
void generateComponentPreviewImages();
void componentPreviewImagesReady();
void decorateComponentPreviewImages();
void componentPreviewImageDecorationsReady();
void generateBonePreviewImages();
void bonePreviewImagesReady();
void updateInprogressIndicator();
void openRecentFile();
void updateRecentFileActions();
2022-10-14 08:21:20 +00:00
void toggleRenderColor();
2022-12-05 11:02:12 +00:00
void updateRenderModel();
void forceUpdateRenderModel();
void updateRenderWireframe();
void forceUpdateRenderWireframe();
2018-04-08 08:05:12 +00:00
private:
void setCurrentFilename(const QString& filename);
void updateTitle();
void initializeShortcuts();
void initializeToolShortcuts(SkeletonGraphicsWidget* graphicsWidget);
void initializeCanvasShortcuts(SkeletonGraphicsWidget* graphicsWidget);
QShortcut* createShortcut(QKeySequence key);
QString strippedName(const QString& fullFileName);
bool openFiles(const QStringList& pathList);
2022-12-05 11:02:12 +00:00
void reset();
Document* m_document = nullptr;
bool m_firstShow = true;
bool m_documentSaved = true;
std::vector<QWidget*> m_dialogs;
bool m_isLastMeshGenerationSucceed = true;
2022-12-05 11:02:12 +00:00
qint64 m_currentUpdatedMeshId = 0;
quint64 m_currentUpdatedWireframeId = 0;
QStringList m_waitingForExportToFilenames;
2018-04-16 22:54:41 +00:00
QString m_currentFilename;
ModelWidget* m_modelRenderWidget = nullptr;
SkeletonGraphicsWidget* m_canvasGraphicsWidget = nullptr;
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;
std::vector<QAction*> m_recentFileActions;
QAction* m_recentFileSeparatorAction = nullptr;
QAction* m_quitAction = nullptr;
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;
QMenu* m_windowMenu = nullptr;
QAction* m_showPartsListAction = nullptr;
2022-12-06 09:01:22 +00:00
QAction* m_showBonesListAction = nullptr;
QAction* m_showDebugDialogAction = 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;
ToolbarButton* m_xLockButton = nullptr;
ToolbarButton* m_yLockButton = nullptr;
ToolbarButton* m_zLockButton = nullptr;
ToolbarButton* m_radiusLockButton = nullptr;
QMetaObject::Connection m_partListDockerVisibleSwitchConnection;
MeshPreviewImagesGenerator* m_componentPreviewImagesGenerator = nullptr;
bool m_isComponentPreviewImagesObsolete = false;
std::unique_ptr<ComponentPreviewImagesDecorator> m_componentPreviewImagesDecorator;
bool m_isComponentPreviewImageDecorationsObsolete = false;
MeshPreviewImagesGenerator* m_bonePreviewImagesGenerator = nullptr;
bool m_isBonePreviewImagesObsolete = false;
PartManageWidget* m_partManageWidget = nullptr;
2022-11-11 12:06:06 +00:00
BoneManageWidget* m_boneManageWidget = nullptr;
SpinnableToolbarIcon* m_inprogressIndicator = nullptr;
std::map<QKeySequence, QShortcut*> m_shortcutMap;
2022-12-06 09:01:22 +00:00
bool m_showBodyBonePreview = false;
};
#endif