XGUI_ContextMenuMgr.h
XGUI_ModuleConnector.h
XGUI_Selection.h
+ XGUI_Preferences.h
)
SET(PROJECT_AUTOMOC
XGUI_ContextMenuMgr.cpp
XGUI_ModuleConnector.cpp
XGUI_Selection.cpp
+ XGUI_Preferences.cpp
)
SET(PROJECT_RESOURCES
};
//! Types of background in view window
-enum BackgroundMode
-{
- NoBackground, // no (invalid) background data
- ColorBackground, // single color
- SimpleGradientBackground, // simple two-color gradient
- CustomGradientBackground // custom (complex) gradient
-};
+//enum BackgroundMode
+//{
+// NoBackground, // no (invalid) background data
+// ColorBackground, // single color
+// SimpleGradientBackground, // simple two-color gradient
+// CustomGradientBackground // custom (complex) gradient
+//};
//! Texture mode
enum TextureMode
--- /dev/null
+// File: XGUI_Preferences.cpp
+// Created: 07 Aug 2014
+// Author: Vitaly SMETANNIKOV
+
+#include "XGUI_Preferences.h"
+#include "XGUI_Constants.h"
+
+#include <SUIT_ResourceMgr.h>
+#include <SUIT_PreferenceMgr.h>
+
+#include <QLayout>
+#include <QApplication>
+#include <QDialogButtonBox>
+
+SUIT_ResourceMgr* XGUI_Preferences::myResourceMgr = 0;
+
+
+SUIT_ResourceMgr* XGUI_Preferences::resourceMgr()
+{
+ if (!myResourceMgr) {
+ myResourceMgr = new SUIT_ResourceMgr("NewGeom");
+ myResourceMgr->setCurrentFormat("xml");
+ }
+ return myResourceMgr;
+}
+
+void XGUI_Preferences::editPreferences()
+{
+ XGUI_PreferencesDlg aDlg(resourceMgr(), QApplication::activeWindow());
+ aDlg.exec();
+}
+
+
+
+//**********************************************************
+//**********************************************************
+//**********************************************************
+XGUI_PreferencesDlg::XGUI_PreferencesDlg(SUIT_ResourceMgr* theResurces, QWidget* theParent)
+ : QDialog(theParent)
+{
+ setWindowTitle( tr("Edit preferences") );
+
+ QVBoxLayout* main = new QVBoxLayout(this);
+ main->setMargin( 5 );
+ main->setSpacing( 5 );
+
+ myPreferences = new SUIT_PreferenceMgr(theResurces, this);
+ main->addWidget( myPreferences );
+
+ setFocusProxy( myPreferences );
+ myPreferences->setFrameStyle( QFrame::Box | QFrame::Sunken );
+ //myPreferences->show();
+
+ QDialogButtonBox* aBtnBox = new QDialogButtonBox(
+ QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
+ main->addWidget(aBtnBox);
+ connect(aBtnBox, SIGNAL(accepted()), this, SLOT(accept()));
+ connect(aBtnBox, SIGNAL(rejected()), this, SLOT(reject()));
+
+ myPreferences->retrieve();
+ createEditors();
+}
+
+XGUI_PreferencesDlg::~XGUI_PreferencesDlg()
+{
+}
+
+void XGUI_PreferencesDlg::createEditors()
+{
+ int aLFpage = myPreferences->addItem("Look&Feel");
+ myPreferences->setItemIcon(aLFpage, QIcon(":pictures/view_prefs.png"));
+
+ int viewTab = myPreferences->addItem( tr("Viewer"), aLFpage );
+
+ QStringList gradList;
+ gradList << tr("Horizontal gradient") << tr("Vertical gradient") <<
+ tr("First diagonal gradient") << tr("Second diagonal gradient") <<
+ tr("First corner gradient") << tr("Second corner gradient") <<
+ tr("Third corner gradient") << tr("Fourth corner gradient");
+
+ QList<QVariant> anIndicesList;
+ QIntList idList;
+ idList << XGUI::HorizontalGradient << XGUI::VerticalGradient <<
+ XGUI::Diagonal1Gradient << XGUI::Diagonal2Gradient <<
+ XGUI::Corner1Gradient << XGUI::Corner2Gradient <<
+ XGUI::Corner3Gradient << XGUI::Corner4Gradient;
+
+ foreach(int gid, idList ) anIndicesList << gid;
+
+ int bgGroup = myPreferences->addItem( tr( "Background" ), viewTab );
+
+ //QIntList txtList;
+ //txtList << Qtx::CenterTexture << Qtx::TileTexture << Qtx::StretchTexture;
+
+ QString aImgFiles("Image files (*.bmp *.gif *.pix *.xwd *.rgb *.rs)");
+
+ int bgId = myPreferences->addItem( tr("Viewer 3d" ), bgGroup,
+ SUIT_PreferenceMgr::Background, "Viewer", "background" );
+ myPreferences->setItemProperty( "gradient_names", gradList, bgId );
+ //myPreferences->setItemProperty( "gradient_ids", anIndicesList, bgId );
+ myPreferences->setItemProperty( "texture_enabled", true, bgId );
+ myPreferences->setItemProperty( "texture_center_enabled", true, bgId );
+ myPreferences->setItemProperty( "texture_tile_enabled", true, bgId );
+ myPreferences->setItemProperty( "texture_stretch_enabled", true, bgId );
+ myPreferences->setItemProperty( "custom_enabled", false, bgId );
+ myPreferences->setItemProperty( "image_formats", aImgFiles, bgId );
+
+}
+
+
+
+
+
--- /dev/null
+// File: XGUI_Preferences.h
+// Created: 07 Aug 2014
+// Author: Vitaly SMETANNIKOV
+
+#ifndef XGUI_Preferences_H
+#define XGUI_Preferences_H
+
+#include "XGUI.h"
+#include <QDialog>
+
+class SUIT_ResourceMgr;
+class SUIT_PreferenceMgr;
+class QWidget;
+
+class XGUI_EXPORT XGUI_Preferences
+{
+public:
+
+ static void editPreferences();
+
+ static SUIT_ResourceMgr* resourceMgr();
+
+private:
+ static SUIT_ResourceMgr* myResourceMgr;
+};
+
+
+class XGUI_PreferencesDlg: public QDialog
+{
+ Q_OBJECT
+public:
+ XGUI_PreferencesDlg(SUIT_ResourceMgr* theResurces, QWidget* theParent = 0);
+ virtual ~XGUI_PreferencesDlg();
+
+private:
+ void createEditors();
+
+ SUIT_PreferenceMgr* myPreferences;
+};
+
+
+#endif
\ No newline at end of file
// In OCCT 6.5.3 all above mentioned problems are fixed; so, above comment should be removed as soon
// as SALOME is migrated to OCCT 6.5.3. The same concerns #ifdef statements in the below code
switch(myBackground.mode()) {
- case XGUI::ColorBackground: {
+ case Qtx::ColorBackground: {
QColor c = myBackground.color();
if (c.isValid()) {
// Unset texture should be done here
}
break;
}
- case XGUI::SimpleGradientBackground: {
+ case Qtx::SimpleGradientBackground: {
QColor c1, c2;
int type = myBackground.gradient(c1, c2);
if (c1.isValid() && type >= XGUI::HorizontalGradient && type <= XGUI::LastGradient) {
}
break;
}
- case XGUI::CustomGradientBackground:
+ case Qtx::CustomGradientBackground:
// NOT IMPLEMENTED YET
break;
default:
#include "XGUI_MainWindow.h"
#include "XGUI_ViewWindow.h"
#include "XGUI_ViewPort.h"
-#include "XGUI_Workshop.h"
+#include "XGUI_Preferences.h"
#include <SUIT_ResourceMgr.h>
if (myViews.size() == 0)
setTrihedronShown(true);
- Qtx::BackgroundData aBk = XGUI_Workshop::resourceMgr()->backgroundValue("Viewer", "background");
+ Qtx::BackgroundData aBk = XGUI_Preferences::resourceMgr()->backgroundValue("Viewer", "background");
view->setBackground(aBk);
view->updateEnabledDrawMode();
#include "XGUI_Workbench.h"
#include "XGUI_Workshop.h"
#include "XGUI_Viewer.h"
-#include "ModuleBase_WidgetFactory.h"
#include "XGUI_SelectionMgr.h"
#include "XGUI_Selection.h"
#include "XGUI_ObjectsBrowser.h"
#include "XGUI_PropertyPanel.h"
#include "XGUI_ContextMenuMgr.h"
#include "XGUI_ModuleConnector.h"
+#include "XGUI_Preferences.h"
#include <ModelAPI_Events.h>
#include <ModelAPI_PluginManager.h>
#include <ModuleBase_OperationDescription.h>
#include <ModuleBase_SelectionValidator.h>
#include <ModuleBase_ResultValidators.h>
+#include "ModuleBase_WidgetFactory.h"
#include <Config_Common.h>
#include <Config_FeatureMessage.h>
#include <Config_PointerMessage.h>
#include <Config_ModuleReader.h>
-#include <SUIT_ResourceMgr.h>
-
#include <QApplication>
#include <QFileDialog>
#include <QMessageBox>
#include <dlfcn.h>
#endif
-SUIT_ResourceMgr* XGUI_Workshop::myResourceMgr = 0;
-
QMap<QString, QString> XGUI_Workshop::myIcons;
QString XGUI_Workshop::featureIcon(const std::string& theId)
myObjectBrowser(0),
myDisplayer(0)
{
- if (!myResourceMgr) {
- myResourceMgr = new SUIT_ResourceMgr("NewGeom");
- myResourceMgr->setCurrentFormat("xml");
- }
myMainWindow = mySalomeConnector? 0 : new XGUI_MainWindow();
myDisplayer = new XGUI_Displayer(this);
// QIcon(":pictures/new.png"), QKeySequence::New);
//aCommand->connectTo(this, SLOT(onNew()));
+ aCommand = aGroup->addFeature("PREF_CMD", tr("Preferences"), tr("Edit preferences"),
+ QIcon(":pictures/preferences.png"), QKeySequence::Preferences);
+ aCommand->connectTo(this, SLOT(onPreferences()));
+
aCommand = aGroup->addFeature("EXIT_CMD", tr("Exit"), tr("Exit application"),
QIcon(":pictures/close.png"), QKeySequence::Close);
aCommand->connectTo(this, SLOT(onExit()));
updateCommandStatus();
}
+//******************************************************
+void XGUI_Workshop::onPreferences()
+{
+ XGUI_Preferences::editPreferences();
+}
+
//******************************************************
ModuleBase_IModule* XGUI_Workshop::loadModule(const QString& theModule)
{
class ModelAPI_ObjectDeletedMessage;
class QAction;
-class SUIT_ResourceMgr;
-
/**\class XGUI_Workshop
* \ingroup GUI
* \brief Class which defines a configuration of the application (Workshop) and launches it.
//! Returns icon name according to feature Id
static QString featureIcon(const std::string& theId);
- static SUIT_ResourceMgr* resourceMgr() { return myResourceMgr; }
-
//! Activates or deactivates a part
//! If PartPtr is Null pointer then PartSet will be activated
void activatePart(ResultPartPtr theFeature);
void onExit();
void onUndo();
void onRedo();
+ void onPreferences();
void showPropertyPanel();
void hidePropertyPanel();
QString myCurrentDir;
static QMap<QString, QString> myIcons;
-
- static SUIT_ResourceMgr* myResourceMgr;
-
};
#endif
<file>pictures/redo.png</file>
<file>pictures/undo.png</file>
<file>pictures/rebuild.png</file>
+ <file>pictures/preferences.png</file>
<file>pictures/occ_view_back.png</file>
<file>pictures/occ_view_bottom.png</file>
<file>pictures/rename_edit.png</file>
<file>pictures/eye_pencil.png</file>
<file>pictures/eye_pencil_closed.png</file>
+
+ <file>pictures/view_prefs.png</file>
</qresource>
</RCC>