#include <XGUI_MenuGroupPanel.h>
#include <XGUI_MainWindow.h>
#include <XGUI_Command.h>
+ #include <XGUI_Preferences.h>
+
+ #include <SUIT_ResourceMgr.h>
#include <QLayout>
#include <QTabWidget>
return aList;
}
-QList<XGUI_Workbench*> XGUI_MainMenu::workbenches() const
-{
- QList<XGUI_Workbench*> aList;
- for (int aTabIdx = 0; aTabIdx < myMenuTabs->count(); ++aTabIdx) {
- XGUI_Workbench* aWb = dynamic_cast<XGUI_Workbench*>(myMenuTabs->widget(aTabIdx));
- if (aWb) {
- aList.append(aWb);
- }
- }
- return aList;
-}
-
int XGUI_MainMenu::menuItemSize() const
{
- //TODO(sbh, vsv): get this value from the preferences
- static const ItemSize DEFAULT_ITEM_SIZE = Medium;
- return (int) DEFAULT_ITEM_SIZE;
+ int DEFAULT_ITEM_SIZE = XGUI_Preferences::resourceMgr()->integerValue(
+ XGUI_Preferences::MENU_SECTION, "item_size");
+ return DEFAULT_ITEM_SIZE;
}
int XGUI_MainMenu::menuHeight() const
int XGUI_MainMenu::menuItemRowsCount() const
{
- //TODO(sbh, vsv): get this value from the preferences
- static const int DEFAULT_ITEM_ROWS_COUNT = 3;
+ int DEFAULT_ITEM_ROWS_COUNT = XGUI_Preferences::resourceMgr()->integerValue(
+ XGUI_Preferences::MENU_SECTION, "rows_number");
return DEFAULT_ITEM_ROWS_COUNT;
}
+
+ void XGUI_MainMenu::updateFromResources()
+ {
+ }
//! Size of menu item
//TODO(sbh, vsv): Move to the settings
- enum ItemSize {
- Small = 20,
- Medium = 25,
- Large = 30
- };
+ //enum ItemSize {
+ // Small = 20,
+ // Medium = 25,
+ // Large = 30
+ //};
public:
XGUI_MainMenu(XGUI_MainWindow *parent);
//! Returns list of created commands
QList<XGUI_Command*> features() const;
- QList<XGUI_Workbench*> workbenches() const;
-
virtual bool eventFilter(QObject *theWatched, QEvent *theEvent);
//! Displays given console as a tab in the workbench
//! Removes already created tab with python console
void removeConsole();
+ //! Defines size of menu item.
+ //! In the future this value should be extracted from the preferences.
int menuItemSize() const;
+ //! Defines number of menu item rows.
+ //! In the future this value should be extracted from the preferences.
int menuItemRowsCount() const;
+ //! Defines height of the main menu. (Number of rows * row height)
int menuHeight() const;
+ void updateFromResources();
+
private:
XGUI_MainWindow* myDesktop;
QTabWidget* myMenuTabs;
}
}
}
+ myOperationMgr->validateCurrentOperation();
}
//******************************************************
{
//std::set<ObjectPtr> aFeatures = theMsg->objects();
}
-
+
//******************************************************
void XGUI_Workshop::onOperationStarted()
{
showPropertyPanel();
QString aXmlRepr = aOperation->getDescription()->xmlRepresentation();
- ModuleBase_WidgetFactory aFactory = ModuleBase_WidgetFactory(aXmlRepr.toStdString(), myModuleConnector);
+ ModuleBase_WidgetFactory aFactory = ModuleBase_WidgetFactory(aXmlRepr.toStdString(),
+ myModuleConnector);
myPropertyPanel->cleanContent();
aFactory.createWidget(myPropertyPanel->contentWidget());
//******************************************************
void XGUI_Workshop::onPreferences()
{
- XGUI_Preferences::editPreferences();
+ XGUI_Prefs aModif;
+ XGUI_Preferences::editPreferences(aModif);
+ if (aModif.size() > 0) {
+ QString aSection;
+ foreach (XGUI_Pref aPref, aModif) {
+ aSection = aPref.first;
+ if (aSection == XGUI_Preferences::VIEWER_SECTION) {
+ if (!isSalomeMode())
+ myMainWindow->viewer()->updateFromResources();
+ } else if (aSection == XGUI_Preferences::MENU_SECTION) {
+ if (!isSalomeMode())
+ myMainWindow->menuObject()->updateFromResources();
+ }
+ }
+ }
}
//******************************************************
aCommands = salomeConnector()->commandList();
} else {
XGUI_MainMenu* aMenuBar = myMainWindow->menuObject();
- foreach (XGUI_Workbench* aWb, aMenuBar->workbenches()) {
- foreach(XGUI_Command* aCmd, aWb->features())
- aCommands.append(aCmd);
+ foreach(XGUI_Command* aCmd, aMenuBar->features()) {
+ aCommands.append(aCmd);
}
}
return aCommands;
myOperationMgr, SLOT(onWidgetActivated(ModuleBase_ModelWidget*)));
connect(myOperationMgr, SIGNAL(activateNextWidget(ModuleBase_ModelWidget*)),
myPropertyPanel, SLOT(onActivateNextWidget(ModuleBase_ModelWidget*)));
+ connect(myOperationMgr, SIGNAL(operationValidated(bool)),
+ myPropertyPanel, SLOT(setAcceptEnabled(bool)));
+
}
//******************************************************