Salome HOME
Merge branch 'master' of newgeom:newgeom
[modules/shaper.git] / src / XGUI / XGUI_MainMenu.cpp
index 96106a9111357da303ce4d14993cd204893aa057..9f79a1db88b6fd44796cbd4e33577fbed8f552ee 100644 (file)
@@ -13,9 +13,12 @@ XGUI_MainMenu::XGUI_MainMenu(XGUI_MainWindow *parent)
     : QObject(parent), myDesktop(parent)
 {
   parent->setTabPosition(Qt::TopDockWidgetArea, QTabWidget::North);
+  myDesktop->setStyleSheet("QTabBar::tab {height: 24px;}");
   myGeneralPage = addWorkbench(tr("General"));
   myGeneralPage->parentWidget()->setMaximumWidth(200);
   myGeneralPage->installEventFilter(this);
+//  QString aStyle = myDesktop->styleSheet();
+//  aStyle += " QTabBar::tab {min-height: 24px;}";
 }
 
 XGUI_MainMenu::~XGUI_MainMenu(void)
@@ -51,7 +54,7 @@ XGUI_Workbench* XGUI_MainMenu::addWorkbench(const QString& theId, const QString&
 /*
  * Searches for already created workbench with given name.
  */
-XGUI_Workbench* XGUI_MainMenu::findWorkbench(const QString& theObjName)
+XGUI_Workbench* XGUI_MainMenu::findWorkbench(const QString& theObjName) const
 {
   return myDesktop->findChild<XGUI_Workbench*>(theObjName);
 }
@@ -91,48 +94,14 @@ QList<XGUI_Command*> XGUI_MainMenu::features() const
   return aList;
 }
 
-void XGUI_MainMenu::onFeatureChecked(bool isChecked)
+QList<XGUI_Workbench*> XGUI_MainMenu::workbenches() const
 {
-  if (!isChecked) {
-    restoreCommandState();
-    return;
+  QList<XGUI_Workbench*> aList;
+  aList.append(myGeneralPage);
+  foreach(QDockWidget* aDoc, myMenuTabs) {
+    XGUI_Workbench* aWb = dynamic_cast<XGUI_Workbench*>(aDoc->widget());
+    if (aWb)
+      aList.append(aWb);
   }
-
-  saveCommandsState();
-  QStringList aSkippedIds;
-  XGUI_Command* aToggledFeature = dynamic_cast<XGUI_Command*>(sender());
-  aSkippedIds.append(aToggledFeature->unblockableCommands());
-//  aSkippedIds.append(aToggledFeature->id());
-  XGUI_Workbench* aGeneralWB = findWorkbench(tr("General"));
-  foreach(XGUI_Command* eachFeature, aGeneralWB->features()) {
-    aSkippedIds.append(eachFeature->id());
-  }
-  QList<XGUI_Command*> allFeatures = features();
-  foreach(XGUI_Command* eachFeature, allFeatures) {
-    QString aFeatureId = eachFeature->id();
-    if (aSkippedIds.removeAll(aFeatureId) > 0) {
-      continue;
-    }
-    eachFeature->setEnabled(false);
-  }
-}
-
-void XGUI_MainMenu::saveCommandsState()
-{
-  myCommandState.clear();
-  QList<XGUI_Command*> allFeatures = features();
-  XGUI_Command* eachFeature = NULL;
-  foreach(eachFeature, allFeatures) {
-    myCommandState.insert(eachFeature, eachFeature->enabled());
-  }
-}
-
-void XGUI_MainMenu::restoreCommandState()
-{
-  QList<XGUI_Command*> allFeatures = features();
-  XGUI_Command* eachFeature = NULL;
-  foreach(eachFeature, allFeatures) {
-    eachFeature->setChecked(false);
-    eachFeature->setEnabled(myCommandState[eachFeature]);
-  }
-}
+  return aList;
+}
\ No newline at end of file