mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +03:00
0029674: Improvements in Inspector tool
- preferences for dock windows geometry, tree view columns and current view projection; - ViewControl package for common functionality between plugins; - processing Location and Orientation for external TopoDS_Shape object - 'F5' key to update content of each plugin - visibility column in tree view (used now only in ShapeView) - properties child item for context (presents tree of current Filters of context)
This commit is contained in:
@@ -3,5 +3,9 @@ TInspector_Communicator.cxx
|
||||
TInspector_Communicator.hxx
|
||||
TInspector_PluginParameters.cxx
|
||||
TInspector_PluginParameters.hxx
|
||||
TInspector_Preferences.cxx
|
||||
TInspector_Preferences.hxx
|
||||
TInspector_Shortcut.cxx
|
||||
TInspector_Shortcut.hxx
|
||||
TInspector_Window.cxx
|
||||
TInspector_Window.hxx
|
||||
|
@@ -1,5 +1,6 @@
|
||||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource>
|
||||
<file>icons/item_algo_folder.png</file>
|
||||
<file>icons/plugin_actions.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@@ -37,9 +37,10 @@ TInspector_Communicator::TInspector_Communicator()
|
||||
static int argc = 1;
|
||||
static char* argv[] = { (char*)"", 0 };
|
||||
#if QT_VERSION > 0x050000
|
||||
TCollection_AsciiString aPlugindsDirName = OSD_Environment ("QTDIR").Value();
|
||||
if (!aPlugindsDirName.IsEmpty())
|
||||
QApplication::addLibraryPath (QString (aPlugindsDirName.ToCString()) + "/plugins");
|
||||
OSD_Environment anEnvironment ("QTDIR");
|
||||
TCollection_AsciiString aPlugindsDirName = anEnvironment.Value();
|
||||
aPlugindsDirName += "/plugins";
|
||||
QApplication::addLibraryPath (aPlugindsDirName.ToCString());
|
||||
#endif
|
||||
new QApplication (argc, argv);
|
||||
}
|
||||
@@ -58,3 +59,12 @@ void TInspector_Communicator::SetVisible (const bool theVisible)
|
||||
QApplication::processEvents();
|
||||
#endif
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Move
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void TInspector_Communicator::Move (const int theXPosition, const int theYPosition)
|
||||
{
|
||||
myWindow->GetMainWindow()->move (theXPosition, theYPosition);
|
||||
}
|
||||
|
@@ -86,10 +86,27 @@ public:
|
||||
Standard_EXPORT void SetSelected (const NCollection_List<Handle(Standard_Transient)>& theObjects)
|
||||
{ myWindow->SetSelected (theObjects); }
|
||||
|
||||
//! Sets path to a directory for temporary plugin files
|
||||
//! \param thePath a path
|
||||
void SetTemporaryDirectory (const TCollection_AsciiString& thePath) { myWindow->SetTemporaryDirectory (thePath); }
|
||||
|
||||
//! Returns path to a directory for temporary plugin files
|
||||
//! \return path
|
||||
TCollection_AsciiString GetTemporaryDirectory() const { return myWindow->GetTemporaryDirectory(); }
|
||||
|
||||
//! Change window visibility
|
||||
//! \param theVisible boolean state
|
||||
Standard_EXPORT virtual void SetVisible (const bool theVisible);
|
||||
|
||||
//! Change window position
|
||||
//! \param theX X pixel position of top left corner of the window
|
||||
//! \param theY Y pixel position
|
||||
Standard_EXPORT virtual void Move (const int theXPosition, const int theYPosition);
|
||||
|
||||
//! Puts in the stream information about communicator
|
||||
//! \param theStream stream for output
|
||||
void Dump (Standard_OStream& theStream) const { return myWindow->Dump (theStream); }
|
||||
|
||||
private:
|
||||
|
||||
TInspector_Window* myWindow; //!< current window
|
||||
|
@@ -15,6 +15,17 @@
|
||||
|
||||
|
||||
#include <inspector/TInspector_PluginParameters.hxx>
|
||||
#include <inspector/TInspector_Preferences.hxx>
|
||||
|
||||
// =======================================================================
|
||||
// function : Constructor
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
TInspector_PluginParameters::TInspector_PluginParameters (TInspector_Window* theWindow)
|
||||
: myWindow (theWindow), myPreferences (new TInspector_Preferences())
|
||||
{
|
||||
myPreferences->SetDirectory (GetTemporaryDirectory());
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetParameters
|
||||
@@ -32,3 +43,15 @@ void TInspector_PluginParameters::SetParameters (const TCollection_AsciiString&
|
||||
SetSelected (thePluginName, theParameters);
|
||||
myWindow->ActivateTool (thePluginName);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetTemporaryDirectory
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void TInspector_PluginParameters::SetTemporaryDirectory (const TCollection_AsciiString& thePath)
|
||||
{
|
||||
if (thePath.IsEqual (myPreferences->GetDirectory()))
|
||||
return;
|
||||
|
||||
myPreferences->SetDirectory (thePath);
|
||||
}
|
||||
|
@@ -20,8 +20,11 @@
|
||||
#include <Standard_Macro.hxx>
|
||||
|
||||
#include <inspector/TInspectorAPI_PluginParameters.hxx>
|
||||
#include <inspector/TInspector_Preferences.hxx>
|
||||
#include <inspector/TInspector_Window.hxx>
|
||||
|
||||
class TInspector_ReportCallBack;
|
||||
|
||||
//! \class TInspector_PluginParameters.
|
||||
//! \brief This is plugin parameters extended by a possibility to activate module during setting new parameters
|
||||
class TInspector_PluginParameters : public TInspectorAPI_PluginParameters
|
||||
@@ -29,7 +32,7 @@ class TInspector_PluginParameters : public TInspectorAPI_PluginParameters
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
Standard_EXPORT TInspector_PluginParameters (TInspector_Window* theWindow) : myWindow (theWindow) {}
|
||||
Standard_EXPORT TInspector_PluginParameters (TInspector_Window* theWindow);
|
||||
|
||||
//! Destructor
|
||||
virtual ~TInspector_PluginParameters() Standard_OVERRIDE {}
|
||||
@@ -42,9 +45,34 @@ public:
|
||||
const NCollection_List<Handle(Standard_Transient)>& theParameters,
|
||||
const Standard_Boolean& theToActivatePlugin = Standard_False) Standard_OVERRIDE;
|
||||
|
||||
//! Sets path to a directory for temporary plugin files. Sets the directory into preferences loader
|
||||
//! \param thePath a path
|
||||
virtual void SetTemporaryDirectory (const TCollection_AsciiString& thePath) Standard_OVERRIDE;
|
||||
|
||||
//! Returns plugin preferences
|
||||
//! \param thePluginName a plugin name
|
||||
virtual void GetPreferences (const TCollection_AsciiString& thePluginName,
|
||||
TInspectorAPI_PreferencesDataMap& theItem) Standard_OVERRIDE
|
||||
{ myPreferences->GetPreferences (thePluginName, theItem); }
|
||||
|
||||
//! Stores plugin preferences
|
||||
//! \param thePluginName a plugin name
|
||||
//! \theItem container of plugin preferences values in form: <name, value>
|
||||
virtual void SetPreferences (const TCollection_AsciiString& thePluginName,
|
||||
const TInspectorAPI_PreferencesDataMap& theItem) Standard_OVERRIDE
|
||||
{ myPreferences->SetPreferences (thePluginName, theItem); }
|
||||
|
||||
//! Store plugin preferences into a preferences file
|
||||
void StorePreferences() { myPreferences->StorePreferences(); }
|
||||
|
||||
//! Remove plugin preferences file
|
||||
void RemovePreferences() { myPreferences->RemovePreferences(); }
|
||||
|
||||
private:
|
||||
|
||||
TInspector_Window* myWindow; //!< the current window
|
||||
Handle(TInspector_ReportCallBack) myReportCallBack; //!< inspector report callback for automatic view update
|
||||
TInspector_Preferences* myPreferences; //!< the preferences loader
|
||||
};
|
||||
|
||||
#endif
|
||||
|
159
tools/TInspector/TInspector_Preferences.cxx
Normal file
159
tools/TInspector/TInspector_Preferences.cxx
Normal file
@@ -0,0 +1,159 @@
|
||||
// Created on: 2017-06-16
|
||||
// Created by: Natalia ERMOLAEVA
|
||||
// Copyright (c) 2017 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <inspector/TInspector_Preferences.hxx>
|
||||
|
||||
#include <Standard_WarningsDisable.hxx>
|
||||
#include <QDir>
|
||||
#include <QDomDocument>
|
||||
#include <QDomElement>
|
||||
#include <QDomNode>
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
#include <Standard_WarningsRestore.hxx>
|
||||
|
||||
// =======================================================================
|
||||
// function : GetPreferences
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void TInspector_Preferences::GetPreferences (const TCollection_AsciiString& thePluginName,
|
||||
TInspectorAPI_PreferencesDataMap& theItem)
|
||||
{
|
||||
theItem.Clear();
|
||||
if (!myIsLoadedPreferences)
|
||||
{
|
||||
loadPreferences();
|
||||
myIsLoadedPreferences = Standard_True;
|
||||
}
|
||||
myLoadedPreferences.Find (thePluginName, theItem);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : StorePreferences
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void TInspector_Preferences::StorePreferences()
|
||||
{
|
||||
if (myLoadedPreferences.IsEmpty())
|
||||
return;
|
||||
|
||||
QString aFileName = QString (GetDirectory().ToCString()) + QDir::separator() + PreferencesFileName();
|
||||
QFile aFile(aFileName);
|
||||
if (!aFile.open (QFile::WriteOnly))
|
||||
return;
|
||||
|
||||
QDomDocument aDomDocument (documentKey());
|
||||
QDomComment aComment = aDomDocument.createComment("\nThis file is automatically created by TInspector application.\nChanges made in this file can be lost.\n");
|
||||
aDomDocument.appendChild (aComment);
|
||||
QDomElement aRootElement = aDomDocument.createElement (documentKey());
|
||||
aDomDocument.appendChild (aRootElement);
|
||||
|
||||
for (NCollection_DataMap<TCollection_AsciiString, TInspectorAPI_PreferencesDataMap>::Iterator aPrefsIt (myLoadedPreferences);
|
||||
aPrefsIt.More(); aPrefsIt.Next())
|
||||
{
|
||||
QDomElement aPluginElement = aDomDocument.createElement (pluginKey());
|
||||
aPluginElement.setAttribute (nameKey(), aPrefsIt.Key().ToCString());
|
||||
aRootElement.appendChild (aPluginElement);
|
||||
|
||||
const TInspectorAPI_PreferencesDataMap& aPluginMap = aPrefsIt.Value();
|
||||
for (TInspectorAPI_IteratorOfPreferencesDataMap aPluginPrefsIt (aPluginMap); aPluginPrefsIt.More(); aPluginPrefsIt.Next())
|
||||
{
|
||||
QDomElement aParameterElement = aDomDocument.createElement (parameterKey());
|
||||
aParameterElement.setAttribute (nameKey(), aPluginPrefsIt.Key().ToCString());
|
||||
aParameterElement.setAttribute (valueKey(), aPluginPrefsIt.Value().ToCString());
|
||||
aPluginElement.appendChild (aParameterElement);
|
||||
}
|
||||
}
|
||||
|
||||
QTextStream aTextStream (&aFile);
|
||||
QStringList aDocumentStr = aDomDocument.toString().split ("\n");
|
||||
for (QStringList::ConstIterator aContentIt = aDocumentStr.begin(); aContentIt != aDocumentStr.end(); ++aContentIt)
|
||||
aTextStream << *aContentIt << endl;
|
||||
aFile.close();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : RemovePreferences
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void TInspector_Preferences::RemovePreferences()
|
||||
{
|
||||
QString aFileName = QString (GetDirectory().ToCString()) + QDir::separator() + PreferencesFileName();
|
||||
QDir aDir (GetDirectory().ToCString());
|
||||
if (aDir.exists (aFileName))
|
||||
aDir.remove (aFileName);
|
||||
reset();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : loadPreferences
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void TInspector_Preferences::loadPreferences()
|
||||
{
|
||||
QString aFileName = QString (GetDirectory().ToCString()) + QDir::separator() + PreferencesFileName();
|
||||
QFile aFile (aFileName);
|
||||
if (!aFile.open (QFile::ReadOnly))
|
||||
return;
|
||||
|
||||
QDomDocument aDomDocument;
|
||||
bool aResult = aDomDocument.setContent (&aFile);
|
||||
aFile.close();
|
||||
if (!aResult)
|
||||
return;
|
||||
|
||||
QDomElement aRootElement = aDomDocument.documentElement();
|
||||
if (aRootElement.isNull() || aRootElement.tagName() != documentKey())
|
||||
return;
|
||||
|
||||
QDomNode aPluginNode = aRootElement.firstChild();
|
||||
while (!aPluginNode.isNull())
|
||||
{
|
||||
if (aPluginNode.isElement())
|
||||
{
|
||||
QDomElement aPluginElement = aPluginNode.toElement();
|
||||
if (aPluginElement.tagName() == pluginKey() && aPluginElement.hasAttribute (nameKey()))
|
||||
{
|
||||
TInspectorAPI_PreferencesDataMap anItem;
|
||||
readPluginItem (aPluginElement, anItem);
|
||||
myLoadedPreferences.Bind (aPluginElement.attribute (nameKey()).toStdString().c_str(), anItem);
|
||||
}
|
||||
}
|
||||
aPluginNode = aPluginNode.nextSibling();
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : readPluginItem
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void TInspector_Preferences::readPluginItem (const QDomElement thePluginElement, TInspectorAPI_PreferencesDataMap& theItem)
|
||||
{
|
||||
QDomNode aParameterNode = thePluginElement.firstChild();
|
||||
while (!aParameterNode.isNull())
|
||||
{
|
||||
if (aParameterNode.isElement())
|
||||
{
|
||||
QDomElement aParameterElement = aParameterNode.toElement();
|
||||
if (aParameterElement.tagName() == parameterKey() &&
|
||||
aParameterElement.hasAttribute (nameKey()) && aParameterElement.hasAttribute (valueKey()))
|
||||
{
|
||||
theItem.Bind (aParameterElement.attribute (nameKey()).toStdString().c_str(),
|
||||
aParameterElement.attribute (valueKey()).toStdString().c_str());
|
||||
}
|
||||
}
|
||||
aParameterNode = aParameterNode.nextSibling();
|
||||
}
|
||||
}
|
100
tools/TInspector/TInspector_Preferences.hxx
Normal file
100
tools/TInspector/TInspector_Preferences.hxx
Normal file
@@ -0,0 +1,100 @@
|
||||
// Created on: 2017-06-16
|
||||
// Created by: Natalia ERMOLAEVA
|
||||
// Copyright (c) 2017 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef TInspector_Preferences_H
|
||||
#define TInspector_Preferences_H
|
||||
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <inspector/TInspectorAPI_PreferencesDataMap.hxx>
|
||||
|
||||
#include <Standard_WarningsDisable.hxx>
|
||||
#include <QDomElement>
|
||||
#include <Standard_WarningsRestore.hxx>
|
||||
|
||||
//! The class to read/write custom plugin preferences in XML format.
|
||||
//! The preferences file is intended to know about:
|
||||
//! - dock window placement
|
||||
//! - tree view columns: visibility, width
|
||||
class TInspector_Preferences
|
||||
{
|
||||
public:
|
||||
//! Constructs the communicator.
|
||||
TInspector_Preferences() {}
|
||||
|
||||
//! Destructor
|
||||
virtual ~TInspector_Preferences() {}
|
||||
|
||||
static Standard_CString PreferencesFileName() { return ".tinspector.xml"; }
|
||||
|
||||
//! Sets path to a preferences file
|
||||
//! \param thePath a path
|
||||
void SetDirectory (const TCollection_AsciiString& thePath) { reset(); myDirectory = thePath; }
|
||||
|
||||
//! Returns path to a preferences file
|
||||
//! \return path
|
||||
TCollection_AsciiString GetDirectory() const { return myDirectory; }
|
||||
|
||||
//! Returns plugin preferences
|
||||
//! \param thePluginName a plugin name
|
||||
Standard_EXPORT void GetPreferences (const TCollection_AsciiString& thePluginName,
|
||||
TInspectorAPI_PreferencesDataMap& theItem);
|
||||
|
||||
//! Stores plugin preferences
|
||||
//! \param thePluginName a plugin name
|
||||
//! \theItem container of plugin preferences values in form: <name, value>
|
||||
void SetPreferences (const TCollection_AsciiString& thePluginName, const TInspectorAPI_PreferencesDataMap& theItem)
|
||||
{ myLoadedPreferences.Bind(thePluginName, theItem); }
|
||||
|
||||
//! Store plugin preferences into a preferences file
|
||||
Standard_EXPORT void StorePreferences();
|
||||
|
||||
//! Remove plugin preferences file
|
||||
Standard_EXPORT void RemovePreferences();
|
||||
|
||||
private:
|
||||
//! Loads the directory preference file with filling internal container
|
||||
void loadPreferences();
|
||||
|
||||
//! clears all internal containers with information of already loaded file
|
||||
void reset() { myLoadedPreferences.Clear(); myIsLoadedPreferences = Standard_False; }
|
||||
|
||||
//! Reads plugin preferences and fill container
|
||||
void readPluginItem(const QDomElement thePluginElement, TInspectorAPI_PreferencesDataMap& theItem);
|
||||
|
||||
//! Returns text of attribute document
|
||||
static Standard_CString documentKey() { return "document"; }
|
||||
|
||||
//! Returns text of attribute plugin
|
||||
static Standard_CString pluginKey() { return "plugin"; }
|
||||
|
||||
//! Returns text of attribute parameter
|
||||
static Standard_CString parameterKey() { return "parameter"; }
|
||||
|
||||
//! Returns text of attribute name
|
||||
static Standard_CString nameKey() { return "name"; }
|
||||
|
||||
//! Returns text of attribute value
|
||||
static Standard_CString valueKey() { return "value"; }
|
||||
|
||||
private:
|
||||
//! directory of preferences file
|
||||
TCollection_AsciiString myDirectory;
|
||||
//! container of already loaded preferences : cache
|
||||
NCollection_DataMap<TCollection_AsciiString, TInspectorAPI_PreferencesDataMap> myLoadedPreferences;
|
||||
//! state whether the preferences of the current directory is loaded
|
||||
Standard_Boolean myIsLoadedPreferences;
|
||||
};
|
||||
|
||||
#endif
|
55
tools/TInspector/TInspector_Shortcut.cxx
Normal file
55
tools/TInspector/TInspector_Shortcut.cxx
Normal file
@@ -0,0 +1,55 @@
|
||||
// Created on: 2017-06-16
|
||||
// Created by: Natalia ERMOLAEVA
|
||||
// Copyright (c) 2017 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <inspector/TInspector_Shortcut.hxx>
|
||||
|
||||
#include <inspector/TInspector_Window.hxx>
|
||||
|
||||
#include <Standard_WarningsDisable.hxx>
|
||||
#include <QApplication>
|
||||
#include <QKeyEvent>
|
||||
#include <Standard_WarningsRestore.hxx>
|
||||
|
||||
// =======================================================================
|
||||
// function : Constructor
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
TInspector_Shortcut::TInspector_Shortcut (QObject* theParent, TInspector_Window* theWindow)
|
||||
: QObject (theParent), myWindow (theWindow)
|
||||
{
|
||||
qApp->installEventFilter (this);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : eventFilter
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
bool TInspector_Shortcut::eventFilter (QObject* theObject, QEvent* theEvent)
|
||||
{
|
||||
if (!myWindow || theEvent->type() != QEvent::KeyRelease)
|
||||
return QObject::eventFilter (theObject, theEvent);
|
||||
|
||||
QKeyEvent* aKeyEvent = dynamic_cast<QKeyEvent*> (theEvent);
|
||||
switch (aKeyEvent->key())
|
||||
{
|
||||
case Qt::Key_F5:
|
||||
{
|
||||
myWindow->UpdateContent();
|
||||
return true;
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
return QObject::eventFilter (theObject, theEvent);
|
||||
}
|
50
tools/TInspector/TInspector_Shortcut.hxx
Normal file
50
tools/TInspector/TInspector_Shortcut.hxx
Normal file
@@ -0,0 +1,50 @@
|
||||
// Created on: 2017-06-16
|
||||
// Created by: Natalia ERMOLAEVA
|
||||
// Copyright (c) 2017 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef TInspector_Shortcut_H
|
||||
#define TInspector_Shortcut_H
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
|
||||
#include <Standard_WarningsDisable.hxx>
|
||||
#include <QObject>
|
||||
#include <Standard_WarningsRestore.hxx>
|
||||
|
||||
class TInspector_Window;
|
||||
class QEvent;
|
||||
|
||||
//! \class TInspector_Shortcut
|
||||
//! Listens application KeyRelease event. Processes key event:
|
||||
//! - <Key_F5>: updates content (tree view model) of the active plugin
|
||||
class TInspector_Shortcut : public QObject
|
||||
{
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
Standard_EXPORT TInspector_Shortcut (QObject* theParent, TInspector_Window* theWindow);
|
||||
|
||||
//! Destructor
|
||||
virtual ~TInspector_Shortcut() {}
|
||||
|
||||
//! Processes key release event to update view model, otherwise do usual QObject functionality
|
||||
Standard_EXPORT virtual bool eventFilter (QObject *theObject, QEvent* theEvent) Standard_OVERRIDE;
|
||||
|
||||
private:
|
||||
TInspector_Window* myWindow; //!< the current window
|
||||
};
|
||||
|
||||
|
||||
#endif
|
@@ -13,19 +13,30 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <inspector/TInspector_Window.hxx>
|
||||
#include <inspector/TInspector_Window.hxx>
|
||||
|
||||
#include <inspector/TInspectorAPI_Communicator.hxx>
|
||||
#include <inspector/TInspector_PluginParameters.hxx>
|
||||
#include <inspector/TInspector_Shortcut.hxx>
|
||||
#include <inspector/TreeModel_Tools.hxx>
|
||||
|
||||
#include <inspector/ViewControl_Tools.hxx>
|
||||
|
||||
#include <OSD_Directory.hxx>
|
||||
#include <OSD_Environment.hxx>
|
||||
#include <OSD_Path.hxx>
|
||||
#include <OSD_Protection.hxx>
|
||||
|
||||
#include <Standard_WarningsDisable.hxx>
|
||||
#include <QApplication>
|
||||
#include <QButtonGroup>
|
||||
#include <QDockWidget>
|
||||
#include <QLabel>
|
||||
#include <QMainWindow>
|
||||
#include <QMenu>
|
||||
#include <QPushButton>
|
||||
#include <QStackedWidget>
|
||||
#include <QToolButton>
|
||||
#include <QVBoxLayout>
|
||||
#include <Standard_WarningsRestore.hxx>
|
||||
|
||||
@@ -56,13 +67,32 @@ TInspector_Window::TInspector_Window()
|
||||
myEmptyWidget = new QWidget (aCentralWidget);
|
||||
myToolsStack->addWidget (myEmptyWidget);
|
||||
|
||||
QWidget* aTopWidget = new QWidget (aCentralWidget);
|
||||
QHBoxLayout* aTopWidgetLayout = new QHBoxLayout (aTopWidget);
|
||||
aTopWidgetLayout->setContentsMargins (0, 0, 0, 0);
|
||||
aTopWidgetLayout->setSpacing (0);
|
||||
|
||||
myButtonWidget = new QWidget (aCentralWidget);
|
||||
myButtonLay = new QHBoxLayout (myButtonWidget);
|
||||
myButtonLay->setContentsMargins (0, 0, 0, 0);
|
||||
myButtonLay->setSpacing (0);
|
||||
myButtonLay->insertStretch (0, 1);
|
||||
|
||||
aCentralLayout->addWidget (myButtonWidget);
|
||||
myButtonGroup = new QButtonGroup (aCentralWidget);
|
||||
myButtonGroup->setExclusive (true);
|
||||
|
||||
myActionsWidget = new QToolButton(aCentralWidget);
|
||||
myActionsWidget->setPopupMode(QToolButton::InstantPopup);
|
||||
myActionsWidget->setIcon (QIcon (":/icons/plugin_actions.png"));
|
||||
myActionsWidget->setIconSize (QSize (20, 20));
|
||||
QMenu* anActionsMenu = new QMenu(myActionsWidget);
|
||||
myActionsWidget->setMenu(anActionsMenu);
|
||||
connect (anActionsMenu, SIGNAL (aboutToShow()), this, SLOT (onShowActionsMenu()));
|
||||
|
||||
aTopWidgetLayout->addWidget(myButtonWidget, 1);
|
||||
aTopWidgetLayout->addWidget(myActionsWidget);
|
||||
|
||||
aCentralLayout->addWidget (aTopWidget);
|
||||
aCentralLayout->addWidget (myToolsStack);
|
||||
|
||||
myMainWindow->resize (TINSPECTOR_DEFAULT_WIDTH, TINSPECTOR_DEFAULT_HEIGHT);
|
||||
@@ -70,6 +100,13 @@ TInspector_Window::TInspector_Window()
|
||||
myMainWindow->setDockOptions (QMainWindow::VerticalTabs);
|
||||
|
||||
myParameters = new TInspector_PluginParameters (this);
|
||||
|
||||
myDefaultDirectory = defaultTemporaryDirectory();
|
||||
myParameters->SetTemporaryDirectory (myDefaultDirectory);
|
||||
|
||||
applyPreferences();
|
||||
|
||||
myShortcut = new TInspector_Shortcut (myMainWindow, this);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -80,7 +117,7 @@ void TInspector_Window::RegisterPlugin (const TCollection_AsciiString& thePlugin
|
||||
{
|
||||
TInspector_ToolInfo anInfo;
|
||||
int aToolId;
|
||||
if (FindPlugin (thePluginName, anInfo, aToolId))
|
||||
if (findPlugin (thePluginName, anInfo, aToolId))
|
||||
return;
|
||||
|
||||
myToolNames.append (TInspector_ToolInfo (thePluginName));
|
||||
@@ -137,7 +174,7 @@ void TInspector_Window::Init (const TCollection_AsciiString& thePluginName,
|
||||
|
||||
TInspector_ToolInfo anInfo;
|
||||
int aToolId;
|
||||
if (!FindPlugin (thePluginName, anInfo, aToolId))
|
||||
if (!findPlugin (thePluginName, anInfo, aToolId))
|
||||
return;
|
||||
|
||||
if (anInfo.myButton)
|
||||
@@ -148,8 +185,10 @@ void TInspector_Window::Init (const TCollection_AsciiString& thePluginName,
|
||||
aButtonName = aButtonName.mid(2);
|
||||
|
||||
QPushButton* aButton = new QPushButton(aButtonName, myButtonWidget);
|
||||
aButton->setCheckable (true);
|
||||
connect (aButton, SIGNAL (clicked (bool)), this, SLOT (onButtonClicked()));
|
||||
myButtonLay->insertWidget (myButtonLay->count()-1, aButton);
|
||||
myButtonGroup->addButton (aButton);
|
||||
anInfo.myButton = aButton;
|
||||
myToolNames[aToolId] = anInfo;
|
||||
}
|
||||
@@ -173,6 +212,7 @@ void TInspector_Window::ActivateTool (const TCollection_AsciiString& thePluginNa
|
||||
return;
|
||||
|
||||
TInspector_ToolInfo anInfo = myToolNames[aToolIndex];
|
||||
bool isPluginLoaded = false;
|
||||
if (!anInfo.myWidget)
|
||||
{
|
||||
if (!LoadPlugin (thePluginName, anInfo))
|
||||
@@ -180,6 +220,7 @@ void TInspector_Window::ActivateTool (const TCollection_AsciiString& thePluginNa
|
||||
anInfo.myButton->setEnabled (false);
|
||||
return;
|
||||
}
|
||||
isPluginLoaded = true;
|
||||
myToolsStack->addWidget (anInfo.myWidget);
|
||||
myToolNames[aToolIndex] = anInfo;
|
||||
}
|
||||
@@ -190,6 +231,13 @@ void TInspector_Window::ActivateTool (const TCollection_AsciiString& thePluginNa
|
||||
myOpenButton->setObjectName (thePluginName.ToCString());
|
||||
|
||||
anInfo.myCommunicator->UpdateContent();
|
||||
if (isPluginLoaded)
|
||||
{
|
||||
// apply preferences
|
||||
TInspectorAPI_PreferencesDataMap aPreferences;
|
||||
myParameters->GetPreferences (thePluginName, aPreferences);
|
||||
anInfo.myCommunicator->SetPreferences (aPreferences);
|
||||
}
|
||||
onCommuncatorNameChanged();
|
||||
}
|
||||
|
||||
@@ -200,7 +248,7 @@ void TInspector_Window::ActivateTool (const TCollection_AsciiString& thePluginNa
|
||||
void TInspector_Window::SetSelected (const NCollection_List<TCollection_AsciiString>& theItemNames)
|
||||
{
|
||||
TInspector_ToolInfo anInfo;
|
||||
if (!ActiveToolInfo (anInfo))
|
||||
if (!activeToolInfo (anInfo))
|
||||
return;
|
||||
|
||||
myParameters->SetSelectedNames (anInfo.myName, theItemNames);
|
||||
@@ -219,7 +267,7 @@ void TInspector_Window::SetSelected (const NCollection_List<TCollection_AsciiStr
|
||||
void TInspector_Window::SetSelected (const NCollection_List<Handle(Standard_Transient)>& theObjects)
|
||||
{
|
||||
TInspector_ToolInfo anInfo;
|
||||
if (!ActiveToolInfo (anInfo))
|
||||
if (!activeToolInfo (anInfo))
|
||||
return;
|
||||
|
||||
myParameters->SetSelected (anInfo.myName, theObjects);
|
||||
@@ -239,7 +287,7 @@ void TInspector_Window::SetOpenButton (QPushButton* theButton)
|
||||
{
|
||||
myOpenButton = theButton;
|
||||
TInspector_ToolInfo anInfo;
|
||||
if (ActiveToolInfo (anInfo))
|
||||
if (activeToolInfo (anInfo))
|
||||
myOpenButton->setObjectName (anInfo.myName.ToCString());
|
||||
myButtonLay->insertWidget (0, theButton);
|
||||
}
|
||||
@@ -262,7 +310,7 @@ void TInspector_Window::OpenFile (const TCollection_AsciiString& thePluginName,
|
||||
myParameters->AddFileName (thePluginName, theFileName);
|
||||
|
||||
TInspector_ToolInfo anInfo;
|
||||
if (!ActiveToolInfo (anInfo) || anInfo.myName != thePluginName)
|
||||
if (!activeToolInfo (anInfo) || anInfo.myName != thePluginName)
|
||||
return;
|
||||
|
||||
TInspectorAPI_Communicator* aCommunicator = anInfo.myCommunicator;
|
||||
@@ -277,10 +325,8 @@ void TInspector_Window::OpenFile (const TCollection_AsciiString& thePluginName,
|
||||
void TInspector_Window::UpdateContent()
|
||||
{
|
||||
TInspector_ToolInfo anInfo;
|
||||
if (!ActiveToolInfo (anInfo) || !anInfo.myCommunicator)
|
||||
return;
|
||||
|
||||
anInfo.myCommunicator->UpdateContent();
|
||||
if (activeToolInfo (anInfo) && anInfo.myCommunicator)
|
||||
anInfo.myCommunicator->UpdateContent();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -314,6 +360,90 @@ bool TInspector_Window::LoadPlugin (const TCollection_AsciiString& thePluginName
|
||||
return aLoaded;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetPreferences
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void TInspector_Window::GetPreferences (TInspectorAPI_PreferencesDataMap& theItem)
|
||||
{
|
||||
theItem.Clear();
|
||||
theItem.Bind ("geometry", TreeModel_Tools::ToString (myMainWindow->saveGeometry()).toStdString().c_str());
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetPreferences
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void TInspector_Window::SetPreferences (const TInspectorAPI_PreferencesDataMap& theItem)
|
||||
{
|
||||
for (TInspectorAPI_IteratorOfPreferencesDataMap anItemIt (theItem); anItemIt.More(); anItemIt.Next())
|
||||
{
|
||||
if (anItemIt.Key().IsEqual ("geometry"))
|
||||
myMainWindow->restoreGeometry (TreeModel_Tools::ToByteArray (anItemIt.Value().ToCString()));
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Dump
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void TInspector_Window::Dump (Standard_OStream& theStream) const
|
||||
{
|
||||
TInspector_ToolInfo anInfo;
|
||||
activeToolInfo(anInfo);
|
||||
|
||||
theStream << "Active Plugin: " << anInfo.myName << "\n";
|
||||
theStream << "Temporary Directory: " << GetTemporaryDirectory() << "\n";
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : OnStorePreferences
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void TInspector_Window::OnStorePreferences()
|
||||
{
|
||||
Handle(TInspector_PluginParameters) aParameters = Handle(TInspector_PluginParameters)::DownCast (myParameters);
|
||||
TInspectorAPI_PreferencesDataMap aPreferences;
|
||||
GetPreferences (aPreferences);
|
||||
aParameters->SetPreferences ("Desktop", aPreferences);
|
||||
|
||||
TInspector_ToolInfo anInfo;
|
||||
for (int aToolId = 0, aSize = myToolNames.size(); aToolId < aSize; aToolId++)
|
||||
{
|
||||
anInfo = myToolNames[aToolId];
|
||||
if (!anInfo.myCommunicator)
|
||||
continue;
|
||||
|
||||
anInfo.myCommunicator->GetPreferences (aPreferences);
|
||||
myParameters->SetPreferences (anInfo.myName, aPreferences);
|
||||
}
|
||||
|
||||
// store preferences parameters into a file
|
||||
aParameters->StorePreferences();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : OnRemovePreferences
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void TInspector_Window::OnRemovePreferences()
|
||||
{
|
||||
Handle(TInspector_PluginParameters) aParameters = Handle(TInspector_PluginParameters)::DownCast (myParameters);
|
||||
|
||||
// remove preferences file
|
||||
aParameters->RemovePreferences();
|
||||
|
||||
// restore plugins default state
|
||||
TInspector_ToolInfo anInfo;
|
||||
for (int aToolId = 0, aSize = myToolNames.size(); aToolId < aSize; aToolId++)
|
||||
{
|
||||
anInfo = myToolNames[aToolId];
|
||||
if (!anInfo.myCommunicator)
|
||||
continue;
|
||||
anInfo.myCommunicator->SetPreferences (TInspectorAPI_PreferencesDataMap());
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : onButtonClicked
|
||||
// purpose :
|
||||
@@ -321,7 +451,38 @@ bool TInspector_Window::LoadPlugin (const TCollection_AsciiString& thePluginName
|
||||
void TInspector_Window::onButtonClicked()
|
||||
{
|
||||
QPushButton* aButton = (QPushButton*)sender();
|
||||
ActivateTool (TCollection_AsciiString ("TK") + aButton->text().toStdString().c_str());
|
||||
|
||||
TCollection_AsciiString aPluginName = aButton->text().toStdString().c_str();
|
||||
|
||||
TInspector_ToolInfo anInfo;
|
||||
int aToolId;
|
||||
if (!findPlugin (aPluginName, anInfo, aToolId))
|
||||
aPluginName = TCollection_AsciiString ("TK") + aPluginName;
|
||||
|
||||
ActivateTool (aPluginName);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : onShowActionsMenu
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void TInspector_Window::onShowActionsMenu()
|
||||
{
|
||||
myActionsWidget->menu()->clear();
|
||||
|
||||
TInspector_ToolInfo anInfo;
|
||||
activeToolInfo(anInfo);
|
||||
|
||||
QMenu* aMenu = myActionsWidget->menu();
|
||||
anInfo.myCommunicator->FillActionsMenu(aMenu);
|
||||
|
||||
aMenu->addSeparator();
|
||||
aMenu->addAction (ViewControl_Tools::CreateAction (tr ("Store Preferences"),
|
||||
SLOT (OnStorePreferences()), myMainWindow, this));
|
||||
QAction* anAction = ViewControl_Tools::CreateAction (tr ("Remove Preferences"),
|
||||
SLOT (OnRemovePreferences()), myMainWindow, this);
|
||||
anAction->setToolTip ("Default state will be restored after restarting the application");
|
||||
aMenu->addAction (anAction);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -332,17 +493,17 @@ void TInspector_Window::onCommuncatorNameChanged()
|
||||
{
|
||||
#if QT_VERSION >= 0x050000
|
||||
TInspector_ToolInfo anInfo;
|
||||
if (!ActiveToolInfo (anInfo))
|
||||
if (!activeToolInfo (anInfo))
|
||||
return;
|
||||
myMainWindow->setWindowTitle (anInfo.myWidget->objectName());
|
||||
#endif
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : ActiveToolInfo
|
||||
// function : activeToolInfo
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
bool TInspector_Window::ActiveToolInfo (TInspector_Window::TInspector_ToolInfo& theToolInfo) const
|
||||
bool TInspector_Window::activeToolInfo (TInspector_Window::TInspector_ToolInfo& theToolInfo) const
|
||||
{
|
||||
QWidget* anActiveWidget = myToolsStack->currentWidget();
|
||||
if (anActiveWidget == myEmptyWidget)
|
||||
@@ -360,10 +521,10 @@ bool TInspector_Window::ActiveToolInfo (TInspector_Window::TInspector_ToolInfo&
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : FindPlugin
|
||||
// function : findPlugin
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
bool TInspector_Window::FindPlugin (const TCollection_AsciiString& thePluginName, TInspector_ToolInfo& theToolInfo,
|
||||
bool TInspector_Window::findPlugin (const TCollection_AsciiString& thePluginName, TInspector_ToolInfo& theToolInfo,
|
||||
int& theToolId)
|
||||
{
|
||||
for (int aToolId = 0, aSize = myToolNames.size(); aToolId < aSize; aToolId++)
|
||||
@@ -378,4 +539,53 @@ bool TInspector_Window::FindPlugin (const TCollection_AsciiString& thePluginName
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// =======================================================================
|
||||
// function : applyPreferences
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void TInspector_Window::applyPreferences()
|
||||
{
|
||||
TInspectorAPI_PreferencesDataMap aPreferences;
|
||||
myParameters->GetPreferences ("Desktop", aPreferences);
|
||||
SetPreferences (aPreferences);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : defaultTemporaryDirectory
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
TCollection_AsciiString TInspector_Window::defaultTemporaryDirectory() const
|
||||
{
|
||||
// main window creation
|
||||
TCollection_AsciiString aTmpDir;
|
||||
#ifdef _WIN32
|
||||
OSD_Environment anEnvironment ("TEMP");
|
||||
aTmpDir = anEnvironment.Value();
|
||||
if (aTmpDir.IsEmpty() )
|
||||
{
|
||||
anEnvironment.SetName ("TMP");
|
||||
aTmpDir = anEnvironment.Value();
|
||||
if (aTmpDir.IsEmpty())
|
||||
aTmpDir = "C:\\";
|
||||
}
|
||||
if (!aTmpDir.EndsWith ("\\"))
|
||||
aTmpDir += "\\";
|
||||
OSD_Path aTmpPath (aTmpDir);
|
||||
OSD_Directory aTmpDirectory;
|
||||
#else
|
||||
OSD_Directory aTmpDirectory = OSD_Directory::BuildTemporary();
|
||||
OSD_Path aTmpPath;
|
||||
aTmpDirectory.Path (aTmpPath);
|
||||
#endif
|
||||
aTmpPath.DownTrek ("TInspector");
|
||||
aTmpDirectory.SetPath (aTmpPath);
|
||||
if (!aTmpDirectory.Exists())
|
||||
aTmpDirectory.Build (OSD_Protection());
|
||||
|
||||
aTmpDirectory.Path (aTmpPath);
|
||||
TCollection_AsciiString aTmpDirectoryName;
|
||||
aTmpPath.SystemName (aTmpDirectoryName);
|
||||
|
||||
return aTmpDir;
|
||||
}
|
||||
|
@@ -29,11 +29,14 @@
|
||||
#include <Standard_WarningsRestore.hxx>
|
||||
|
||||
class TInspectorAPI_Communicator;
|
||||
class TInspector_Shortcut;
|
||||
|
||||
class QButtonGroup;
|
||||
class QMainWindow;
|
||||
class QHBoxLayout;
|
||||
class QPushButton;
|
||||
class QStackedWidget;
|
||||
class QToolButton;
|
||||
|
||||
//! \class Inspector_Window
|
||||
//! Control that contains:
|
||||
@@ -117,11 +120,42 @@ public:
|
||||
//! \param theInfo an output parameter for plugin info
|
||||
Standard_EXPORT bool LoadPlugin (const TCollection_AsciiString& thePluginName, TInspector_ToolInfo& theInfo);
|
||||
|
||||
//! Sets path to a directory for temporary plugin files. If parameter is empty, using default directory
|
||||
//! \param thePath a path
|
||||
void SetTemporaryDirectory (const TCollection_AsciiString& thePath)
|
||||
{ myParameters->SetTemporaryDirectory (thePath.IsEmpty() ? myDefaultDirectory : thePath); }
|
||||
|
||||
//! Returns path to a directory for temporary plugin files
|
||||
//! \return path
|
||||
TCollection_AsciiString GetTemporaryDirectory() const { return myParameters->GetTemporaryDirectory(); }
|
||||
|
||||
//! Returns plugin preferences: dock widgets state, tree view columns.
|
||||
//! \param theItem container of preference elements
|
||||
Standard_EXPORT void GetPreferences (TInspectorAPI_PreferencesDataMap& theItem);
|
||||
|
||||
//! Applies plugin preferences
|
||||
//! \param theItem container of preference elements
|
||||
Standard_EXPORT void SetPreferences (const TInspectorAPI_PreferencesDataMap& theItem);
|
||||
|
||||
//! Puts in the stream information about communicator
|
||||
//! \param theStream stream for output
|
||||
Standard_EXPORT void Dump (Standard_OStream& theStream) const;
|
||||
|
||||
public slots:
|
||||
//! Stores preferences (current state) of all plugins into a preferences file
|
||||
Standard_EXPORT void OnStorePreferences();
|
||||
|
||||
//! Remove preferences file
|
||||
Standard_EXPORT void OnRemovePreferences();
|
||||
|
||||
protected slots:
|
||||
|
||||
//! Activates plugin correspnded to the clicked button
|
||||
void onButtonClicked();
|
||||
|
||||
//! Updates available actions by the active plugin
|
||||
void onShowActionsMenu();
|
||||
|
||||
//! Updates the TInspector window title giving object name of plugin widget (available only in Qt5)
|
||||
void onCommuncatorNameChanged();
|
||||
|
||||
@@ -129,16 +163,23 @@ protected:
|
||||
|
||||
//! Activates plugin by the plugin info
|
||||
//! \param theToolInfo an information about plugin
|
||||
bool ActiveToolInfo (TInspector_ToolInfo& theToolInfo) const;
|
||||
bool activeToolInfo (TInspector_ToolInfo& theToolInfo) const;
|
||||
|
||||
//! Returns true if there is plugin registered by the given name
|
||||
//! \param thePluginName a name of the plugin
|
||||
//! \param theToolInfo an output parameter for plugin information
|
||||
//! \param theToolId an index in internal map
|
||||
//! \return true if the plugin is found
|
||||
bool FindPlugin (const TCollection_AsciiString& thePluginName, TInspector_ToolInfo& theToolInfo,
|
||||
bool findPlugin (const TCollection_AsciiString& thePluginName, TInspector_ToolInfo& theToolInfo,
|
||||
int& theToolId);
|
||||
|
||||
//! Applies desktop preferences to window
|
||||
void applyPreferences();
|
||||
|
||||
//! Generate default temp directory by 'TEMP' or 'TMP' environment variables
|
||||
//! \return generated path
|
||||
TCollection_AsciiString defaultTemporaryDirectory() const;
|
||||
|
||||
private:
|
||||
|
||||
QWidget* myEmptyWidget; //!< widget that is active in tools stack while no one plugin is loaded
|
||||
@@ -147,8 +188,12 @@ private:
|
||||
QWidget* myButtonWidget; //!< container of plugin buttons
|
||||
QPushButton* myOpenButton; //!< button to open file for the active plugin
|
||||
QHBoxLayout* myButtonLay; //!< layout of plugin buttons
|
||||
QButtonGroup* myButtonGroup; //!< exclusive toggled button
|
||||
QToolButton* myActionsWidget; //!< tool button for plugin actions
|
||||
QList<TInspector_ToolInfo> myToolNames; //!< container of plugin names
|
||||
Handle(TInspectorAPI_PluginParameters) myParameters; //!< plugins parameters container
|
||||
TInspector_Shortcut* myShortcut; //!< listener of key events
|
||||
TCollection_AsciiString myDefaultDirectory; //!< default directory
|
||||
};
|
||||
|
||||
#endif
|
||||
|
BIN
tools/TInspector/icons/plugin_actions.png
Normal file
BIN
tools/TInspector/icons/plugin_actions.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 204 B |
Reference in New Issue
Block a user