dust3d/application/sources/document_window.h

170 lines
5.5 KiB
C
Raw Normal View History

#ifndef DUST3D_APPLICATION_DOCUMENT_WINDOW_H_
#define DUST3D_APPLICATION_DOCUMENT_WINDOW_H_
#include <QMainWindow>
#include <QShowEvent>
2018-04-08 08:05:12 +00:00
#include <QPushButton>
#include <QString>
#include <QMenu>
#include <QAction>
#include <map>
#include <QStringList>
2019-12-14 13:28:14 +00:00
#include <QLabel>
#include <QShortcut>
#include "model_widget.h"
#include "graphics_container_widget.h"
#include "mesh_preview_images_generator.h"
2020-12-19 02:29:24 +00:00
class Document;
class SkeletonGraphicsWidget;
class ComponentPreviewGridWidget;
class ToolbarButton;
class SpinnableToolbarIcon;
class DocumentWindow : public QMainWindow
{
Q_OBJECT
signals:
void initialized();
void uninialized();
void waitingExportFinished(const QString &filename, bool isSuccessful);
public:
DocumentWindow();
~DocumentWindow();
2019-03-17 14:04:12 +00:00
Document *document();
2020-10-16 13:51:16 +00:00
ModelWidget *modelWidget();
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);
2018-04-13 01:42:19 +00:00
void mousePressEvent(QMouseEvent *event);
public slots:
void changeTurnaround();
void save();
void saveTo(const QString &saveAsFilename);
void open();
2019-06-10 22:47:12 +00:00
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 updateInprogressIndicator();
void openRecentFile();
void updateRecentFileActions();
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);
Document *m_document = nullptr;
bool m_firstShow = true;
bool m_documentSaved = true;
std::vector<QWidget *> m_dialogs;
bool m_isLastMeshGenerationSucceed = true;
quint64 m_currentUpdatedMeshId = 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;
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;
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;
ComponentPreviewGridWidget *m_componentPreviewGridWidget = nullptr;
2020-11-17 14:31:51 +00:00
SpinnableToolbarIcon *m_inprogressIndicator = nullptr;
std::map<QKeySequence, QShortcut *> m_shortcutMap;
};
#endif