#include "LightApp_SelectionMgr.h"
#include "LightApp_DataObject.h"
#include "LightApp_WgViewModel.h"
+#include "LightApp_FullScreenHelper.h"
#include <Basics_OCCTVersion.hxx>
#include <QTimer>
#include <QHeaderView>
#include <QTreeView>
+#include <QShortcut>
#include <utilities.h>
/*!Constructor.*/
LightApp_Application::LightApp_Application()
: CAM_Application( false ),
- myPrefs( 0 )
+ myPrefs( 0 ),
+ myScreenHelper(new LightApp_FullScreenHelper())
{
Q_INIT_RESOURCE( LightApp );
STD_TabDesktop* desk = new STD_TabDesktop();
+ desk->setFullScreenAllowed(false);
setDesktop( desk );
LightApp_Application::~LightApp_Application()
{
delete mySelMgr;
+ delete myScreenHelper;
}
/*!Start application.*/
createAction( StyleId, tr( "TOT_THEME" ), QIcon(), tr( "MEN_DESK_THEME" ), tr( "PRP_THEME" ),
0, desk, false, this, SLOT( onStylePreferences() ) );
+ createAction( FullScreenId, tr( "TOT_FULLSCREEN" ), QIcon(), tr( "MEN_DESK_FULLSCREEN" ), tr( "PRP_FULLSCREEN" ),
+ Qt::Key_F11, desk, false, this, SLOT( onFullScreen() ) );
+
+
int viewMenu = createMenu( tr( "MEN_DESK_VIEW" ), -1 );
createMenu( separator(), viewMenu, -1, 20, -1 );
createMenu( StyleId, viewMenu, 20, -1 );
+ createMenu( FullScreenId, viewMenu, 20, -1 );
int modTBar = createTool( tr( "INF_TOOLBAR_MODULES" ) );
createTool( ModulesListId, modTBar );
desktop()->setDockOptions( dopts );
desktop()->setOpaqueResize( opaqueResize );
if ( dynamic_cast<STD_TabDesktop*>( desktop() ) )
- dynamic_cast<STD_TabDesktop*>( desktop() )->workstack()->setOpaqueResize( opaqueResize );
+ dynamic_cast<STD_TabDesktop*>( desktop() )->workstack()->setOpaqueResize( opaqueResize );
}
}
resourceMgr()->setValue( "Style", "use_salome_style", Style_Salome::isActive() );
}
+void LightApp_Application::onFullScreen(){
+ if(myScreenHelper) {
+ if(desktop()->isFullScreen())
+ myScreenHelper->switchToNormalScreen();
+ else
+ myScreenHelper->switchToFullScreen();
+ }
+}
+
/*!
Connects just added view manager
*/
class LightApp_WidgetContainer;
class LightApp_Preferences;
class LightApp_SelectionMgr;
+class LightApp_FullScreenHelper;
class LightApp_DataObject;
class SUIT_DataBrowser;
class SUIT_Study;
CloseId, CloseAllId, GroupAllId,
PreferencesId, MRUId, ModulesListId,
NewGLViewId, NewPlot2dId, NewOCCViewId, NewVTKViewId, NewQxGraphViewId,
- NewQxSceneViewId = NewQxGraphViewId, StyleId,
+ NewQxSceneViewId = NewQxGraphViewId, StyleId, FullScreenId,
UserID };
protected:
void onMRUActivated( const QString& );
void onStylePreferences();
+ void onFullScreen();
private slots:
void onSelection();
LightApp_Preferences* myPrefs;
LightApp_SelectionMgr* mySelMgr;
+ LightApp_FullScreenHelper* myScreenHelper;
+
WinMap myWin;
WinVis myWinVis;
WinGeom myWinGeom;
--- /dev/null
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// File: LightApp_FullScreenHelper.h
+// Created: 04/10/2011 18:44:25 PM
+// Author: OCC team
+//
+#include <QAction>
+#include <QMenuBar>
+#include <QStatusBar>
+
+#include <PyConsole_Console.h>
+
+#include <STD_Application.h>
+
+#include <SUIT_Session.h>
+#include <SUIT_Desktop.h>
+#include <SUIT_DataBrowser.h>
+
+#include "LightApp_FullScreenHelper.h"
+#include "LightApp_Application.h"
+
+
+/*!
+ * Constructor
+ */
+LightApp_FullScreenHelper::LightApp_FullScreenHelper()
+{
+ myStatusBarVisibility = false;
+}
+
+/*!
+ * Destructor
+ */
+LightApp_FullScreenHelper::~LightApp_FullScreenHelper()
+{
+
+}
+
+
+/*!
+ * Switch application to the full screen mode.
+ */
+void LightApp_FullScreenHelper::switchToFullScreen() {
+
+ SUIT_Session* session = SUIT_Session::session();
+ if(!session)
+ return;
+
+ LightApp_Application* app = dynamic_cast<LightApp_Application*>( session->activeApplication() );
+
+ if(!app)
+ return;
+
+ SUIT_Desktop* desktop = app->desktop();
+
+ if(!desktop)
+ return;
+
+ desktop->setWindowState(desktop->windowState() ^ Qt::WindowFullScreen);
+
+ if(desktop->menuBar())
+ desktop->menuBar()->hide();
+
+ if(desktop->statusBar()) {
+ myStatusBarVisibility = desktop->statusBar()->isVisible();
+ desktop->statusBar()->hide();
+ QAction *act = app->action(STD_Application::ViewStatusBarId);
+ if(act)
+ act->setEnabled(false);
+ }
+
+
+ QList<QDockWidget*> aDocWidgets = desktop->findChildren<QDockWidget*>();
+ myDocWidgetMap.clear();
+
+ QWidget* ob = app->objectBrowser();
+ QObject* obParent = ob ? ob->parent() : 0;
+
+ foreach(QDockWidget* aWidget, aDocWidgets) {
+ if(aWidget && aWidget->parent() == desktop) {
+ if( aWidget->isVisible() && aWidget != obParent ) {
+ aWidget->hide();
+ QAction* act = aWidget->toggleViewAction();
+ bool isActionEnabled = false;
+ if(act) {
+ isActionEnabled = act->isEnabled();
+ if( isActionEnabled ) {
+ act->setEnabled(false);
+ }
+ }
+
+ myDocWidgetMap.insert(aWidget, isActionEnabled);
+ }
+ }
+ }
+
+ QList<QToolBar*> aToolBars = desktop->findChildren<QToolBar*>();
+ myToolBarMap.clear();
+ foreach(QToolBar* aWidget, aToolBars ) {
+ if( aWidget && aWidget->parent() == desktop ) {
+ if( aWidget->isVisible()) {
+ aWidget->hide();
+ QAction* act = aWidget->toggleViewAction();
+ bool isActionEnabled = false;
+ if(act) {
+ isActionEnabled = act->isEnabled();
+ if( isActionEnabled ) {
+ act->setEnabled(false);
+ }
+ }
+ myToolBarMap.insert(aWidget, isActionEnabled);
+ }
+ }
+ }
+}
+
+/*!
+ * Switch application to the normal screen mode.
+ */
+void LightApp_FullScreenHelper::switchToNormalScreen() {
+
+ SUIT_Session* session = SUIT_Session::session();
+ if(!session)
+ return;
+
+ LightApp_Application* app = dynamic_cast<LightApp_Application*>( session->activeApplication() );
+
+ if(!app)
+ return;
+
+ SUIT_Desktop* desktop = app->desktop();
+
+ if(!desktop)
+ return;
+
+ desktop->setWindowState(desktop->windowState() ^ Qt::WindowFullScreen);
+
+
+ DocWidgetMap::iterator it = myDocWidgetMap.begin();
+ for( ;it != myDocWidgetMap.end() ; it++ ) {
+ QDockWidget* aWidget = it.key();
+ bool state = it.value();
+ aWidget->show();
+ QAction* act = aWidget->toggleViewAction();
+ if(act && state)
+ act->setEnabled(true);
+ }
+
+ ToolBarMap::iterator it1 = myToolBarMap.begin();
+ for( ;it1 != myToolBarMap.end() ; it1++ ) {
+ QToolBar* aWidget = it1.key();
+ bool state = it1.value();
+ aWidget->show();
+ QAction* act = aWidget->toggleViewAction();
+ if(act && state)
+ act->setEnabled(true);
+ }
+
+ if(desktop->menuBar())
+ desktop->menuBar()->show();
+
+ if(desktop->statusBar() && myStatusBarVisibility) {
+ desktop->statusBar()->show();
+ QAction *act = app->action(STD_Application::ViewStatusBarId);
+ if(act)
+ act->setEnabled(true);
+ }
+
+}
--- /dev/null
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// File: LightApp_FullScreenHelper.h
+// Created: 04/10/2011 18:39:25 PM
+// Author: OCC team
+//
+#ifndef LIGHTAPP_FULLSCREEN_H
+#define LIGHTAPP_FULLSCREEN_H
+
+#include "LightApp.h"
+
+#include <QMap>
+#include <QDockWidget>
+#include <QToolBar>
+
+
+class LIGHTAPP_EXPORT LightApp_FullScreenHelper {
+ public:
+
+ LightApp_FullScreenHelper();
+ ~LightApp_FullScreenHelper();
+
+ void switchToFullScreen();
+ void switchToNormalScreen();
+
+ private:
+ typedef QMap<QDockWidget*,bool> DocWidgetMap;
+ DocWidgetMap myDocWidgetMap;
+
+ typedef QMap<QToolBar*, bool> ToolBarMap;
+ ToolBarMap myToolBarMap;
+
+
+ bool myStatusBarVisibility;
+
+};
+
+
+#endif //LIGHTAPP_FULLSCREEN_H
LightApp_Preferences.h \
LightApp_PreferencesDlg.h \
LightApp_UpdateFlags.h \
- LightApp_WgViewModel.h
+ LightApp_WgViewModel.h \
+ LightApp_FullScreenHelper.h
if ENABLE_PYCONSOLE
salomeinclude_HEADERS += LightApp_PyInterp.h
LightApp_SwitchOp.cxx \
LightApp_Preferences.cxx \
LightApp_PreferencesDlg.cxx \
- LightApp_WgViewModel.cxx
+ LightApp_WgViewModel.cxx \
+ LightApp_FullScreenHelper.cxx
if ENABLE_PYCONSOLE
dist_libLightApp_la_SOURCES += LightApp_PyInterp.cxx
<source>PRP_THEME</source>
<translation>Change style properties</translation>
</message>
+
+ <message>
+ <source>TOT_FULLSCREEN</source>
+ <translation>Full screen</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_FULLSCREEN</source>
+ <translation>Full screen</translation>
+ </message>
+ <message>
+ <source>PRP_FULLSCREEN</source>
+ <translation>Switch to full screen mode</translation>
+ </message>
<message>
<source>INF_TOOLBAR_MODULES</source>
<translation>Modules</translation>
myStatusBar( 0 ),
myOpaque( true ),
myResizer( 0 ),
- myMouseMove( 0 )
+ myMouseMove( 0 ),
+ myFullScreenAllowed(true)
{
//rnv: Enables tooltips for inactive windows.
//rnv: For details see http://bugtracker.opencascade.com/show_bug.cgi?id=20893
state = QString( "min" );
break;
case Qt::WindowFullScreen:
- state = QString( "full" );
+ state = isFullScreenAllowed() ? QString( "full" ) : QString( "max" );
break;
}
return ok;
}
+
+/*!
+ \brief FullScreenAllowed flag allowed dump in the main window geometry
+ Qt::WindowFullScreen parameter.
+ \return \c fullScreenAllowed flag.
+*/
+bool QtxMainWindow::isFullScreenAllowed() const {
+ return myFullScreenAllowed;
+}
+
+
+/*!
+ \brief Set FullScreenAllowed flag.
+ The default value is true.
+ \param f value of the fullScreenAllowed flag.
+*/
+void QtxMainWindow::setFullScreenAllowed( const bool f ) {
+ myFullScreenAllowed = f;
+}
QString storeGeometry() const;
void retrieveGeometry( const QString& );
+ bool isFullScreenAllowed() const;
+ void setFullScreenAllowed( const bool );
+
protected:
virtual bool event( QEvent* );
QToolBar* myMenuBar; //!< dockable menu bar
QToolBar* myStatusBar; //!< dockable status bar
+ bool myFullScreenAllowed;
+
bool myOpaque;
Resizer* myResizer;
QMouseEvent* myMouseMove;