From 1e831bba07699b6e27f5cdf68822f65bb6a1f71b Mon Sep 17 00:00:00 2001 From: sln Date: Wed, 23 Apr 2008 14:36:07 +0000 Subject: [PATCH] Searching in Object browser --- src/LightApp/LightApp_Application.cxx | 10 ++++++++++ src/LightApp/LightApp_Application.h | 1 + src/LightApp/resources/LightApp_msg_en.po | 3 +++ src/ObjBrowser/OB_Browser.cxx | 21 ++++++++++++++++++++- src/ObjBrowser/OB_Browser.h | 8 ++++++++ src/ObjBrowser/OB_FindDlg.cxx | 4 ++-- src/ObjBrowser/OB_ObjSearch.h | 3 ++- src/ObjBrowser/resources/OB_msg_en.po | 14 ++++++++++++++ 8 files changed, 60 insertions(+), 4 deletions(-) diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index ca99cc1d6..6addfa718 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -63,6 +63,7 @@ #include #include #include +#include #ifdef WIN32 #define DEFAULT_BROWSER "start iexplore.exe" @@ -1643,6 +1644,7 @@ QWidget* LightApp_Application::createWindow( const int flag ) if ( flag == WT_ObjectBrowser ) { OB_Browser* ob = new OB_Browser( desktop() ); + ob->setSearch( new OB_ObjSearch( ob ) ); ob->setAutoUpdate( true ); //ob->setAutoOpenLevel( 1 ); // commented by ASV as a fix to bug IPAL10107 ob->setCaption( tr( "OBJECT_BROWSER" ) ); @@ -2299,6 +2301,8 @@ void LightApp_Application::contextMenuPopup( const QString& type, QPopupMenu* th thePopup->insertSeparator(); thePopup->insertItem( tr( "MEN_REFRESH" ), this, SLOT( onRefresh() ) ); + if ( getenv( "GUI_FIND_OB" ) ) + thePopup->insertItem( tr( "MEN_FIND" ), this, SLOT( onFind() ) ); } /*! @@ -2520,3 +2524,9 @@ bool LightApp_Application::event( QEvent* e ) } return CAM_Application::event( e ); } + +void LightApp_Application::onFind() +{ + objectBrowser()->enableSearch( true ); +} + diff --git a/src/LightApp/LightApp_Application.h b/src/LightApp/LightApp_Application.h index f70724b03..9728717cd 100644 --- a/src/LightApp/LightApp_Application.h +++ b/src/LightApp/LightApp_Application.h @@ -211,6 +211,7 @@ protected slots: private slots: void onSelection(); void onRefresh(); + void onFind(); void onPreferences(); void onMRUActivated( QString ); void onPreferenceChanged( QString&, QString&, QString& ); diff --git a/src/LightApp/resources/LightApp_msg_en.po b/src/LightApp/resources/LightApp_msg_en.po index f06c47efc..7ffb92760 100644 --- a/src/LightApp/resources/LightApp_msg_en.po +++ b/src/LightApp/resources/LightApp_msg_en.po @@ -251,6 +251,9 @@ msgstr "Quick directory list" msgid "LightApp_Application::MEN_REFRESH" msgstr "Refresh" +msgid "LightApp_Application::MEN_FIND" +msgstr "Find" + msgid "LightApp_Application::PREF_GROUP_SUPERV" msgstr "Graph Supervisor" diff --git a/src/ObjBrowser/OB_Browser.cxx b/src/ObjBrowser/OB_Browser.cxx index 4b0b4840d..905d9405a 100755 --- a/src/ObjBrowser/OB_Browser.cxx +++ b/src/ObjBrowser/OB_Browser.cxx @@ -21,6 +21,7 @@ #include "OB_Filter.h" #include "OB_ListItem.h" #include "OB_ListView.h" +#include "OB_FindDlg.h" #include #include @@ -301,8 +302,12 @@ myRootDecorated( true ) myView->installEventFilter( this ); myView->viewport()->installEventFilter( this ); + myFindDlg = new OB_FindDlg( this ); + myFindDlg->hide(); + QVBoxLayout* main = new QVBoxLayout( this ); - main->addWidget( myView ); + main->addWidget( myView, 1 ); + main->addWidget( myFindDlg, 0 ); myShowToolTips = true; myTooltip = new ToolTip( this, myView->viewport() ); @@ -1638,6 +1643,20 @@ void OB_Browser::ensureItemVisible( const SUIT_DataObject* obj ) listView()->ensureItemVisible( item ); } +OB_ObjSearch* OB_Browser::getSearch() const +{ + return myFindDlg->getSearch(); +} + +void OB_Browser::setSearch( OB_ObjSearch* s ) +{ + myFindDlg->setSearch( s ); +} + +void OB_Browser::enableSearch( const bool on ) +{ + myFindDlg->setShown( on ); +} diff --git a/src/ObjBrowser/OB_Browser.h b/src/ObjBrowser/OB_Browser.h index a190c586e..af5fa9afb 100755 --- a/src/ObjBrowser/OB_Browser.h +++ b/src/ObjBrowser/OB_Browser.h @@ -38,6 +38,8 @@ class QToolTip; class OB_Filter; class OB_ListView; class OB_ListItem; +class OB_FindDlg; +class OB_ObjSearch; /*! \class OB_Browser @@ -130,6 +132,10 @@ public: void ensureItemVisible( const SUIT_DataObject* ); + OB_ObjSearch* getSearch() const; + void setSearch( OB_ObjSearch* ); + void enableSearch( const bool ); + signals: void selectionChanged(); void doubleClicked( SUIT_DataObject* ); @@ -201,6 +207,8 @@ private: friend class OB_Browser::ToolTip; unsigned long myModifiedTime; + + OB_FindDlg* myFindDlg; }; #endif diff --git a/src/ObjBrowser/OB_FindDlg.cxx b/src/ObjBrowser/OB_FindDlg.cxx index 07ed30dd5..5b07adc03 100644 --- a/src/ObjBrowser/OB_FindDlg.cxx +++ b/src/ObjBrowser/OB_FindDlg.cxx @@ -1,6 +1,6 @@ -#include -#include +#include "OB_FindDlg.h" +#include "OB_ObjSearch.h" #include #include diff --git a/src/ObjBrowser/OB_ObjSearch.h b/src/ObjBrowser/OB_ObjSearch.h index 6106d9fef..5562729a0 100644 --- a/src/ObjBrowser/OB_ObjSearch.h +++ b/src/ObjBrowser/OB_ObjSearch.h @@ -2,13 +2,14 @@ #ifndef OBJECT_BROWSER_OBJECT_SEARCH_HEADER #define OBJECT_BROWSER_OBJECT_SEARCH_HEADER +#include #include class OB_ListItem; class OB_Browser; class SUIT_DataObject; -class OB_ObjSearch +class OB_EXPORT OB_ObjSearch { public: OB_ObjSearch( OB_Browser* ); diff --git a/src/ObjBrowser/resources/OB_msg_en.po b/src/ObjBrowser/resources/OB_msg_en.po index 4b18212e9..2209af5a6 100755 --- a/src/ObjBrowser/resources/OB_msg_en.po +++ b/src/ObjBrowser/resources/OB_msg_en.po @@ -30,3 +30,17 @@ msgstr "" msgid "MEN_EXPAND_ALL" msgstr "Expand All" +msgid "OB_FindDlg::FIND" +msgstr "Find" + +msgid "OB_FindDlg::CLOSE" +msgstr "Close" + +msgid "OB_FindDlg::CASE_SENSITIVE" +msgstr "Case sensitive" + +msgid "OB_FindDlg::IS_REG_EXP" +msgstr "Regular expression" + +msgid "OB_FindDlg::NOT_FOUND" +msgstr "There is no object is found" -- 2.39.2