leocad/common/lc_application.h
2020-04-25 12:16:37 -07:00

100 lines
1.8 KiB
C++

#pragma once
#include "lc_array.h"
class Project;
class lcPiecesLibrary;
enum class lcShadingMode
{
Wireframe,
Flat,
DefaultLights,
Full
};
enum class lcViewSphereLocation
{
TopLeft,
TopRight,
BottomLeft,
BottomRight
};
class lcPreferences
{
public:
void LoadDefaults();
void SaveDefaults();
int mMouseSensitivity;
lcShadingMode mShadingMode;
bool mDrawAxes;
bool mDrawEdgeLines;
float mLineWidth;
bool mAllowLOD;
bool mFadeSteps;
quint32 mFadeStepsColor;
bool mHighlightNewParts;
quint32 mHighlightNewPartsColor;
bool mDrawGridStuds;
quint32 mGridStudColor;
bool mDrawGridLines;
int mGridLineSpacing;
quint32 mGridLineColor;
bool mFixedAxes;
bool mViewSphereEnabled;
lcViewSphereLocation mViewSphereLocation;
int mViewSphereSize;
quint32 mViewSphereColor;
quint32 mViewSphereTextColor;
quint32 mViewSphereHighlightColor;
bool mAutoLoadMostRecent;
bool mRestoreTabLayout;
};
class lcApplication : public QApplication
{
Q_OBJECT
public:
lcApplication(int& Argc, char** Argv);
~lcApplication();
void SetProject(Project* Project);
bool Initialize(QList<QPair<QString, bool>>& LibraryPaths, bool& ShowWindow);
void Shutdown();
void ShowPreferencesDialog();
void SaveTabLayout() const;
bool LoadPartsLibrary(const QList<QPair<QString, bool>>& LibraryPaths, bool OnlyUsePaths, bool ShowProgress);
void SetClipboard(const QByteArray& Clipboard);
void ExportClipboard(const QByteArray& Clipboard);
Project* mProject;
lcPiecesLibrary* mLibrary;
lcPreferences mPreferences;
QByteArray mClipboard;
protected:
QString GetTabLayoutKey() const;
};
extern lcApplication* gApplication;
inline lcPiecesLibrary* lcGetPiecesLibrary()
{
return gApplication->mLibrary;
}
inline Project* lcGetActiveProject()
{
return gApplication->mProject;
}
inline lcPreferences& lcGetPreferences()
{
return gApplication->mPreferences;
}