cherish
Public Slots | Public Member Functions | Static Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
MainWindow Class Reference

Re-defined QMainWindow that contains all the GUI elements such as GLWidget, menu bars, tool bars and other widgets. More...

#include <MainWindow.h>

Inheritance diagram for MainWindow:
BaseGuiTest BookmarksTest CanvasTest MainWindowTest PolygonTest SceneStateTest StrokeTest UserSceneTest

Public Slots

void onSetTabletActivity (bool active)
 
void onRequestUpdate ()
 
void onAutoSwitchMode (cher::MOUSE_MODE mode)
 
void onRequestBookmarkSet (int row)
 
void onDeleteBookmark (const QModelIndex &index)
 
void onDeleteCanvas (const QModelIndex &index)
 
void onDeletePhoto (const QModelIndex &index)
 
void onVisibilitySetCanvas (int index)
 
void onMoveBookmark (const QModelIndex &index)
 
void onApplyStateBookmark (const QModelIndex &index)
 
void onBookmarkAddedToWidget (const QModelIndex &, int first, int last)
 
void onBookmarkRemovedFromWidget (const QModelIndex &, int first, int last)
 
void onMouseModeSet (cher::MOUSE_MODE mode)
 
void onPhotoTransparencyPlus (const QModelIndex &index)
 
void onPhotoTransparencyMinus (const QModelIndex &index)
 
void onPhotoPushed (int parent, int start, int, int destination, int)
 
void onRequestSceneData (entity::SceneState *state)
 
void onRequestSceneStateSet (entity::SceneState *state)
 
void onRequestSceneToolStatus (bool &visibility)
 
void onImportPhoto (const QString &path, const QString &fileName)
 
void onRequestCanvasCreate (const osg::Vec3f &eye, const osg::Vec3f &center, const osg::Vec3f &up)
 
void onCanvasClicked (const QModelIndex &index)
 

Public Member Functions

 MainWindow (QWidget *parent=0, Qt::WindowFlags flags=0)
 
 ~MainWindow ()
 
const RootScenegetRootScene () const
 
entity::CanvasgetCanvasCurrent () const
 
osg::Camera * getCamera () const
 
void setCameraView (const osg::Vec3d &eye, const osg::Vec3d &center, const osg::Vec3d &up, const double &fov2)
 
bool getStrokeFogFactor () const
 
QPixmap getScreenshot (const osg::Vec3d &eye, const osg::Vec3d &center, const osg::Vec3d &up)
 
int getViewportWidth () const
 
int getViewportHeight () const
 
osg::Vec4f getCurrentColor () const
 
double getFOV2 () const
 
BookmarkWidgetgetBookmarkWidget ()
 
void openFile (const QString &fname)
 

Static Public Member Functions

static MainWindowinstance ()
 

Protected Slots

void onFileNew ()
 
void onFileOpen ()
 
void onFileSave ()
 
void onFileSaveAs ()
 
void onFileExport ()
 
void onFileImage ()
 
void onFilePhotoBase ()
 
void onFileClose ()
 
void onFileExit ()
 
void onCut ()
 
void onCopy ()
 
void onPaste ()
 
void onTools ()
 
void onCameraOrbit ()
 
void onCameraZoom ()
 
void onCameraPan ()
 
void onCameraAperture ()
 
void onHomeView ()
 
void onViewAllCanvas ()
 
void onSelect ()
 
void onSelect3d ()
 
void onErase ()
 
void onDelete ()
 
void onSketch ()
 
void onPolygon ()
 
void onLineSegment ()
 
void onNewCanvasClone ()
 
void onNewCanvasXY ()
 
void onNewCanvasYZ ()
 
void onNewCanvasZY ()
 
void onNewCanvasXZ ()
 
void onNewCanvasOrtho ()
 
void onNewCanvasSeparate ()
 
void onNewCanvasStandard ()
 
void onNewCanvasCoaxial ()
 
void onNewCanvasParallel ()
 
void onNewCanvasRing ()
 
void onCanvasEdit ()
 
void onImageMove ()
 
void onImageRotate ()
 
void onImageScale ()
 
void onImageFlipH ()
 
void onImageFlipV ()
 
void onStrokesPush ()
 
void onBookmark ()
 
void onBookmarkNew ()
 
void onBookmarkSketch ()
 
void onBookmarkEdit (const QString &name)
 
void onStrokeFogFactor ()
 

Protected Member Functions

void initializeActions ()
 
void initializeMenus ()
 
void initializeToolbars ()
 
void initializeCallbacks ()
 
bool loadSceneFromFile ()
 
bool importPhoto (QString &fileName)
 
void setSceneState (const entity::SceneState *state)
 
void addMenuBookmark (const QString &name)
 

Protected Attributes

QMdiArea * m_mdiArea
 
QTabWidget * m_tabWidget
 
BookmarkWidgetm_bookmarkWidget
 
CanvasPhotoWidgetm_canvasWidget
 
PhotoWidgetm_photoWidget
 
PhotoModelm_photoModel
 
QUndoStack * m_undoStack
 
QMenuBar * m_menuBar
 
QMenu * m_submenuBookmarks
 
osg::ref_ptr< RootScenem_rootScene
 
QUndoStack * m_viewStack
 
GLWidgetm_glWidget
 
QAction * m_actionNewFile
 
QAction * m_actionClose
 
QAction * m_actionExit
 
QAction * m_actionImportImage
 
QAction * m_actionOpenFile
 
QAction * m_actionSaveFile
 
QAction * m_actionSaveAsFile
 
QAction * m_actionExportAs
 
QAction * m_actionPhotoBase
 
QAction * m_actionUndo
 
QAction * m_actionRedo
 
QAction * m_actionCut
 
QAction * m_actionCopy
 
QAction * m_actionPaste
 
QAction * m_actionDelete
 
QAction * m_actionTools
 
QAction * m_actionOrbit
 
QAction * m_actionPan
 
QAction * m_actionZoom
 
QAction * m_actionPrevView
 
QAction * m_actionNextView
 
QAction * m_actionBookmark
 
QAction * m_actionBookmarkSketch
 
QAction * m_actionCameraSettings
 
QAction * m_actionHomeView
 
QAction * m_actionViewAllCanvas
 
QAction * m_actionSketch
 
QAction * m_actionEraser
 
QAction * m_actionSelect
 
QAction * m_actionSelect3d
 
QAction * m_actionPolygon
 
QAction * m_actionLinesegment
 
QAction * m_actionCanvasClone
 
QAction * m_actionCanvasXY
 
QAction * m_actionCanvasYZ
 
QAction * m_actionCanvasZY
 
QAction * m_actionCanvasXZ
 
QAction * m_actionCanvasOrtho
 
QAction * m_actionCanvasSeparate
 
QAction * m_actionSetStandard
 
QAction * m_actionCanvasEdit
 
QAction * m_actionStrokesPush
 
QAction * m_actionStrokeFogFactor
 
CameraPropertiesm_cameraProperties
 
QColorDialog * m_colorDialog
 

Static Protected Attributes

static MainWindowm_instance = nullptr
 

Detailed Description

Re-defined QMainWindow that contains all the GUI elements such as GLWidget, menu bars, tool bars and other widgets.

Constructor & Destructor Documentation

§ MainWindow()

MainWindow::MainWindow ( QWidget *  parent = 0,
Qt::WindowFlags  flags = 0 
)
explicit

Constructor: initialies the GUI elements and scene graph structure.

§ ~MainWindow()

MainWindow::~MainWindow ( )

Destructor: annulates singlton-related pointer.

Member Function Documentation

§ addMenuBookmark()

void MainWindow::addMenuBookmark ( const QString &  name)
protected

UI Method to add name of editable bookmark into bookmark's submenu. Has to be run whenever the new bookmark is added throught the SVM method, or when opening new file. Has to be cleared when the scene is cleared, or certain elements deleted when the corresponding bookmark is deleted.

§ getBookmarkWidget()

BookmarkWidget * MainWindow::getBookmarkWidget ( )

A method to obtain a pointer on bookmark widget.

§ getCamera()

osg::Camera * MainWindow::getCamera ( ) const
Returns
pointer on a camera used within GLWidget.

§ getCanvasCurrent()

entity::Canvas * MainWindow::getCanvasCurrent ( ) const

A method to obtain pointer on current canvas, if there is one present.

§ getCurrentColor()

osg::Vec4f MainWindow::getCurrentColor ( ) const

A method to obtain current color of the color dialog (for polygon drawing).

§ getFOV2()

double MainWindow::getFOV2 ( ) const

A method to obtain current camera's FOV.

Returns
full angle FOV (not half angle).

§ getRootScene()

const RootScene * MainWindow::getRootScene ( ) const
Returns
const pointer to RootScene.

§ getScreenshot()

QPixmap MainWindow::getScreenshot ( const osg::Vec3d &  eye,
const osg::Vec3d &  center,
const osg::Vec3d &  up 
)

A method to obtain a scene screenshot with the given camera position.

§ getStrokeFogFactor()

bool MainWindow::getStrokeFogFactor ( ) const
Returns
state of the button responsible for whether fog factor is on (true) or off (false).

§ getViewportHeight()

int MainWindow::getViewportHeight ( ) const
Returns
height of GLWidget.

§ getViewportWidth()

int MainWindow::getViewportWidth ( ) const
Returns
width of GLWidget.

§ instance()

MainWindow & MainWindow::instance ( )
static

Singleton design pattern.

§ onApplyStateBookmark

void MainWindow::onApplyStateBookmark ( const QModelIndex &  index)
slot

Slot called when user presses on cog icon to change the state set of the bookmark.

§ onAutoSwitchMode

void MainWindow::onAutoSwitchMode ( cher::MOUSE_MODE  mode)
slot

Slot called when user performs switch of mouse mode automatically, e.g. by doing double-click.

§ onBookmarkAddedToWidget

void MainWindow::onBookmarkAddedToWidget ( const QModelIndex &  ,
int  first,
int  last 
)
slot

Slot called when BookmarkWidget content had changed, i.e., new row was inserted.

§ onBookmarkRemovedFromWidget

void MainWindow::onBookmarkRemovedFromWidget ( const QModelIndex &  ,
int  first,
int  last 
)
slot

Slot called when BookmarkWidget content had changed, i.e., a row was removed.

§ onCanvasClicked

void MainWindow::onCanvasClicked ( const QModelIndex &  index)
slot

Slot is called whenever user right clicks on Canvas within canvas widget. Called after similar slot of user scene. This slot is only for photo re-scaling mouse mode.

§ onDeleteBookmark

void MainWindow::onDeleteBookmark ( const QModelIndex &  index)
slot

Slot called when user requested to delete bookmark from the BookmarkWidget.

§ onDeleteCanvas

void MainWindow::onDeleteCanvas ( const QModelIndex &  index)
slot

Slot called when user requested to delete canvas from CanvasPhotoWidget.

§ onDeletePhoto

void MainWindow::onDeletePhoto ( const QModelIndex &  index)
slot

Slot called when user requested to delete photo from CanvasPhotoWidget.

§ onImportPhoto

void MainWindow::onImportPhoto ( const QString &  path,
const QString &  fileName 
)
slot

Slot called when user performed drag-and-drop from PhotoWidget to GLWidget of a entity::Photo.

§ onMouseModeSet

void MainWindow::onMouseModeSet ( cher::MOUSE_MODE  mode)
slot

Slot called when mouse mode is changed.

§ onMoveBookmark

void MainWindow::onMoveBookmark ( const QModelIndex &  index)
slot

Slot called when user changed order of bookmarks within BookmarkWidget.

§ onPhotoPushed

void MainWindow::onPhotoPushed ( int  parent,
int  start,
int  ,
int  destination,
int   
)
slot

Slot called when push photo is performed.

§ onPhotoTransparencyMinus

void MainWindow::onPhotoTransparencyMinus ( const QModelIndex &  index)
slot

Slot called when photo's transparency was changed by user from CanvasPhotoWidget.

§ onPhotoTransparencyPlus

void MainWindow::onPhotoTransparencyPlus ( const QModelIndex &  index)
slot

Slot called when photo's transparency was changed by user from CanvasPhotoWidget.

§ onRequestBookmarkSet

void MainWindow::onRequestBookmarkSet ( int  row)
slot

Slot called when a bookmark was added to scene graph.

§ onRequestCanvasCreate

void MainWindow::onRequestCanvasCreate ( const osg::Vec3f &  eye,
const osg::Vec3f &  center,
const osg::Vec3f &  up 
)
slot

Slot called when bookmark position is finished editing. The slot requests from user whether new canvas should be created within the FOV of the camera position.

Parameters
eyeis eye position of the camera,
centeris the center position of camera,
upis up vector of camera position.

§ onRequestSceneData

void MainWindow::onRequestSceneData ( entity::SceneState state)
slot

Slot called so that to request a data of SceneState, e.g. when setting up a bookmark.

§ onRequestSceneStateSet

void MainWindow::onRequestSceneStateSet ( entity::SceneState state)
slot

Slot called when scene state change was requested, e.g. when setting up a bookmark.

§ onRequestSceneToolStatus

void MainWindow::onRequestSceneToolStatus ( bool &  visibility)
slot

Slot called to obtain status of global tools visibilities.

§ onRequestUpdate

void MainWindow::onRequestUpdate ( )
slot

Slot called whenver we need to update GLWidget, e.g., when scene graph is changed.

§ onSetTabletActivity

void MainWindow::onSetTabletActivity ( bool  active)
slot

Slot called whenver CherishApplication catches change of tablet proximity.

§ onVisibilitySetCanvas

void MainWindow::onVisibilitySetCanvas ( int  index)
slot

Slot called when user requested to set canvas visibility by using controls of CanvasPhotoWidget.

§ openFile()

void MainWindow::openFile ( const QString &  fname)

A method would normally be called when file name is provided as command line argument.

§ setCameraView()

void MainWindow::setCameraView ( const osg::Vec3d &  eye,
const osg::Vec3d &  center,
const osg::Vec3d &  up,
const double &  fov2 
)

A method to setup camera position and parameters within GLWidget.

Parameters
fov2is the full angle (not half angle) FOV, in degrees.

The documentation for this class was generated from the following files: