From ffcf76ad145a37017c3cf038aa11979f59a61a08 Mon Sep 17 00:00:00 2001 From: vsr Date: Fri, 6 Jul 2007 16:39:47 +0000 Subject: [PATCH] Porting to Qt 4 --- src/GLViewer/GLViewer_ViewFrame.cxx | 4 +- src/LightApp/LightApp_Application.cxx | 69 +- src/LightApp/LightApp_Module.cxx | 4 +- src/LightApp/LightApp_ModuleAction.cxx | 30 +- src/LightApp/LightApp_ModuleAction.h | 4 +- src/LightApp/LightApp_Preferences.h | 8 +- src/LightApp/LightApp_PreferencesDlg.cxx | 1 + src/OCCViewer/OCCViewer_ViewWindow.cxx | 14 +- src/Plot2d/Plot2d_ViewWindow.cxx | 29 +- src/Qtx/QtxAction.cxx | 53 - src/Qtx/QtxAction.h | 4 - src/Qtx/QtxColorButton.cxx | 98 +- src/Qtx/QtxFontEdit.cxx | 107 +- src/Qtx/QtxFontEdit.h | 21 +- src/Qtx/QtxPagePrefMgr.cxx | 1131 ++++++++++++++++++++- src/Qtx/QtxPagePrefMgr.h | 69 -- src/Qtx/QtxPathEdit.cxx | 90 +- src/Qtx/QtxPathListEdit.cxx | 239 ++++- src/Qtx/QtxPreferenceMgr.cxx | 474 ++++++--- src/Qtx/QtxPreferenceMgr.h | 9 - src/SALOME_PYQT/SalomePyQt/SalomePyQt.h | 1 - src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip | 1 - src/SUIT/SUIT_ActionOperation.cxx | 14 +- src/SUIT/SUIT_ActionOperation.h | 1 - src/SUPERVGraph/SUPERVGraph_ViewFrame.cxx | 4 +- src/SVTK/SVTK_MainWindow.cxx | 16 +- src/SalomeApp/SalomeApp_Application.cxx | 2 +- src/VTKViewer/VTKViewer_ViewWindow.cxx | 8 +- 28 files changed, 2031 insertions(+), 474 deletions(-) diff --git a/src/GLViewer/GLViewer_ViewFrame.cxx b/src/GLViewer/GLViewer_ViewFrame.cxx index 0461a4edd..24e7f0e99 100644 --- a/src/GLViewer/GLViewer_ViewFrame.cxx +++ b/src/GLViewer/GLViewer_ViewFrame.cxx @@ -157,7 +157,7 @@ void GLViewer_ViewFrame::createActions() */ void GLViewer_ViewFrame::createToolBar() { - myActionsMap[DumpId]->addTo(myToolBar); + myToolBar->addAction( myActionsMap[DumpId] ); SUIT_ToolButton* aScaleBtn = new SUIT_ToolButton(myToolBar); aScaleBtn->AddAction(myActionsMap[FitAllId]); @@ -169,7 +169,7 @@ void GLViewer_ViewFrame::createToolBar() aPanBtn->AddAction(myActionsMap[PanId]); aPanBtn->AddAction(myActionsMap[GlobalPanId]); - myActionsMap[ResetId]->addTo(myToolBar); + myToolBar->addAction( myActionsMap[ResetId] ); } /*! diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index f388f2ef6..f10e316a0 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -585,6 +585,7 @@ void LightApp_Application::createActions() } connect( myModuleAction, SIGNAL( moduleActivated( const QString& ) ), this, SLOT( onModuleActivation( const QString& ) ) ); + modTBar->addAction( myModuleAction ); } // New window @@ -1767,6 +1768,9 @@ LightApp_Preferences* LightApp_Application::preferences( const bool crt ) const QStringList modNameList; app->modules( modNameList, false ); + for ( QStringList::const_iterator it = modNameList.begin(); + it != modNameList.end(); ++it ) + _prefs_->addPreference( *it ); ModuleList modList; app->modules( modList ); @@ -1781,15 +1785,13 @@ LightApp_Preferences* LightApp_Application::preferences( const bool crt ) const if ( mod && !_prefs_->hasModule( mod->moduleName() ) ) { - int modCat = _prefs_->addPreference( mod->moduleName() ); - _prefs_->setItemProperty( modCat, "info", QString() ); + _prefs_->addPreference( mod->moduleName() ); if( toCreate ) mod->createPreferences(); } } - int id = _prefs_->addPreference( "Root" ); - _prefs_->setItemProperty( id, "info", tr( "PREFERENCES_NOT_LOADED" ) ); } + _prefs_->setItemProperty( "info", tr( "PREFERENCES_NOT_LOADED" ) ); connect( myPrefs, SIGNAL( preferenceChanged( QString&, QString&, QString& ) ), this, SLOT( onPreferenceChanged( QString&, QString&, QString& ) ) ); @@ -1811,8 +1813,10 @@ void LightApp_Application::moduleAdded( CAM_Module* mod ) if ( myPrefs && lightMod && !myPrefs->hasModule( lightMod->moduleName() )) { int modCat = myPrefs->addPreference( mod->moduleName() ); - myPrefs->setItemProperty( modCat, "info", QString() ); lightMod->createPreferences(); + QtxPreferenceItem* item = myPrefs->findItem( modCat ); + if ( item && item->isEmpty() ) + delete item; } } @@ -1828,14 +1832,15 @@ void LightApp_Application::createPreferences( LightApp_Preferences* pref ) int genTab = pref->addPreference( tr( "PREF_TAB_GENERAL" ), salomeCat ); int studyGroup = pref->addPreference( tr( "PREF_GROUP_STUDY" ), genTab ); - pref->setItemProperty( studyGroup, "columns", 1 ); + + //pref->setItemProperty( "columns", 1, studyGroup ); pref->addPreference( tr( "PREF_MULTI_FILE" ), studyGroup, LightApp_Preferences::Bool, "Study", "multi_file" ); pref->addPreference( tr( "PREF_ASCII_FILE" ), studyGroup, LightApp_Preferences::Bool, "Study", "ascii_file" ); pref->addPreference( tr( "PREF_STORE_POS" ), studyGroup, LightApp_Preferences::Bool, "Study", "store_positions" ); int extgroup = pref->addPreference( tr( "PREF_GROUP_EXT_BROWSER" ), genTab ); - pref->setItemProperty( extgroup, "columns", 1 ); + //pref->setItemProperty( "columns", 1, extgroup ); QString platform; #ifdef WIN32 platform = "winapplication"; @@ -1843,14 +1848,12 @@ void LightApp_Application::createPreferences( LightApp_Preferences* pref ) platform = "application"; #endif int apppref = pref->addPreference( tr( "PREF_APP" ), extgroup, LightApp_Preferences::File, "ExternalBrowser", platform ); - pref->setItemProperty( apppref, "existing", true ); - pref->setItemProperty( apppref, "flags", QFile::ExeUser ); - pref->setItemProperty( apppref, "readOnly", false ); + pref->setItemProperty( "mode", QtxPagePrefPathItem::OpenFile, apppref ); pref->addPreference( tr( "PREF_PARAM" ), extgroup, LightApp_Preferences::String, "ExternalBrowser", "parameters" ); int pythonConsoleGroup = pref->addPreference( tr( "PREF_GROUP_PY_CONSOLE" ), genTab ); - pref->setItemProperty( pythonConsoleGroup, "columns", 1 ); + //pref->setItemProperty( "columns", 1, pythonConsoleGroup ); pref->addPreference( tr( "PREF_FONT" ), pythonConsoleGroup, LightApp_Preferences::Font, "PyConsole", "font" ); int viewTab = pref->addPreference( tr( "PREF_TAB_VIEWERS" ), salomeCat ); @@ -1863,28 +1866,28 @@ void LightApp_Application::createPreferences( LightApp_Preferences* pref ) int supervGroup = pref->addPreference( tr( "PREF_GROUP_SUPERV" ), viewTab ); - pref->setItemProperty( occGroup, "columns", 1 ); - pref->setItemProperty( vtkGroup, "columns", 1 ); - pref->setItemProperty( plot2dGroup, "columns", 1 ); + //pref->setItemProperty( "columns", 1, occGroup ); + //pref->setItemProperty( "columns", 1, vtkGroup ); + //pref->setItemProperty( "columns", 1, plot2dGroup ); int occTS = pref->addPreference( tr( "PREF_TRIHEDRON_SIZE" ), occGroup, LightApp_Preferences::DblSpin, "OCCViewer", "trihedron_size" ); pref->addPreference( tr( "PREF_VIEWER_BACKGROUND" ), occGroup, LightApp_Preferences::Color, "OCCViewer", "background" ); - pref->setItemProperty( occTS, "min", 1.0E-06 ); - pref->setItemProperty( occTS, "max", 1000 ); + pref->setItemProperty( "min", 1.0E-06, occTS ); + pref->setItemProperty( "max", 1000, occTS ); int isoU = pref->addPreference( tr( "PREF_ISOS_U" ), occGroup, LightApp_Preferences::IntSpin, "OCCViewer", "iso_number_u" ); int isoV = pref->addPreference( tr( "PREF_ISOS_V" ), occGroup, LightApp_Preferences::IntSpin, "OCCViewer", "iso_number_v" ); - pref->setItemProperty( isoU, "min", 0 ); - pref->setItemProperty( isoU, "max", 100000 ); + pref->setItemProperty( "min", 0, isoU ); + pref->setItemProperty( "max", 100000, isoU ); - pref->setItemProperty( isoV, "min", 0 ); - pref->setItemProperty( isoV, "max", 100000 ); + pref->setItemProperty( "min", 0, isoV ); + pref->setItemProperty( "max", 100000, isoV ); int vtkTS = pref->addPreference( tr( "PREF_TRIHEDRON_SIZE" ), vtkGroup, LightApp_Preferences::DblSpin, "VTKViewer", "trihedron_size" ); @@ -1892,8 +1895,8 @@ void LightApp_Application::createPreferences( LightApp_Preferences* pref ) pref->addPreference( tr( "PREF_VIEWER_BACKGROUND" ), vtkGroup, LightApp_Preferences::Color, "VTKViewer", "background" ); - pref->setItemProperty( vtkTS, "min", 1.0E-06 ); - pref->setItemProperty( vtkTS, "max", 150 ); + pref->setItemProperty( "min", 1.0E-06, vtkTS ); + pref->setItemProperty( "max", 150, vtkTS ); pref->addPreference( tr( "PREF_SHOW_LEGEND" ), plot2dGroup, LightApp_Preferences::Bool, "Plot2d", "ShowLegend" ); @@ -1912,8 +1915,8 @@ void LightApp_Application::createPreferences( LightApp_Preferences* pref ) anIndexesList.append(2); anIndexesList.append(3); - pref->setItemProperty( legendPosition, "strings", aLegendPosList ); - pref->setItemProperty( legendPosition, "indexes", anIndexesList ); + pref->setItemProperty( "strings", aLegendPosList, legendPosition ); + pref->setItemProperty( "indexes", anIndexesList, legendPosition ); int curveType = pref->addPreference( tr( "PREF_CURVE_TYPE" ), plot2dGroup, LightApp_Preferences::Selector, "Plot2d", "CurveType" ); @@ -1927,14 +1930,14 @@ void LightApp_Application::createPreferences( LightApp_Preferences* pref ) anIndexesList.append(1); anIndexesList.append(2); - pref->setItemProperty( curveType, "strings", aCurveTypesList ); - pref->setItemProperty( curveType, "indexes", anIndexesList ); + pref->setItemProperty( "strings", aCurveTypesList, curveType ); + pref->setItemProperty( "indexes", anIndexesList, curveType ); int markerSize = pref->addPreference( tr( "PREF_MARKER_SIZE" ), plot2dGroup, LightApp_Preferences::IntSpin, "Plot2d", "MarkerSize" ); - pref->setItemProperty( markerSize, "min", 0 ); - pref->setItemProperty( markerSize, "max", 100 ); + pref->setItemProperty( "min", 0, markerSize ); + pref->setItemProperty( "max", 100, markerSize ); QStringList aScaleModesList; aScaleModesList.append( tr("PREF_LINEAR") ); @@ -1947,21 +1950,21 @@ void LightApp_Application::createPreferences( LightApp_Preferences* pref ) int horScale = pref->addPreference( tr( "PREF_HOR_AXIS_SCALE" ), plot2dGroup, LightApp_Preferences::Selector, "Plot2d", "HorScaleMode" ); - pref->setItemProperty( horScale, "strings", aScaleModesList ); - pref->setItemProperty( horScale, "indexes", anIndexesList ); + pref->setItemProperty( "strings", aScaleModesList, horScale ); + pref->setItemProperty( "indexes", anIndexesList, horScale ); int verScale = pref->addPreference( tr( "PREF_VERT_AXIS_SCALE" ), plot2dGroup, LightApp_Preferences::Selector, "Plot2d", "VerScaleMode" ); - pref->setItemProperty( verScale, "strings", aScaleModesList ); - pref->setItemProperty( verScale, "indexes", anIndexesList ); + pref->setItemProperty( "strings", aScaleModesList, verScale ); + pref->setItemProperty( "indexes", anIndexesList, verScale ); pref->addPreference( tr( "PREF_VIEWER_BACKGROUND" ), plot2dGroup, LightApp_Preferences::Color, "Plot2d", "Background" ); int dirTab = pref->addPreference( tr( "PREF_TAB_DIRECTORIES" ), salomeCat ); int dirGroup = pref->addPreference( tr( "PREF_GROUP_DIRECTORIES" ), dirTab ); - pref->setItemProperty( dirGroup, "columns", 1 ); + //pref->setItemProperty( dirGroup, "columns", 1 ); pref->addPreference( tr( "" ), dirGroup, LightApp_Preferences::DirList, "FileDlg", "QuickDirList" ); diff --git a/src/LightApp/LightApp_Module.cxx b/src/LightApp/LightApp_Module.cxx index eac7e67a3..a83523f91 100644 --- a/src/LightApp/LightApp_Module.cxx +++ b/src/LightApp/LightApp_Module.cxx @@ -427,7 +427,7 @@ QVariant LightApp_Module::preferenceProperty( const int id, const QString& prop QVariant var; LightApp_Preferences* pref = preferences(); if ( pref ) - var = pref->itemProperty( id, prop ); + var = pref->itemProperty( prop, id ); return var; } @@ -436,7 +436,7 @@ void LightApp_Module::setPreferenceProperty( const int id, const QString& prop, { LightApp_Preferences* pref = preferences(); if ( pref ) - pref->setItemProperty( id, prop, var ); + pref->setItemProperty( prop, var, id ); } /*! diff --git a/src/LightApp/LightApp_ModuleAction.cxx b/src/LightApp/LightApp_ModuleAction.cxx index 4e929fa12..06095e262 100755 --- a/src/LightApp/LightApp_ModuleAction.cxx +++ b/src/LightApp/LightApp_ModuleAction.cxx @@ -387,17 +387,15 @@ int LightApp_ModuleAction::mode() const } /*! - \brief Add action to the widget. - \param w widget (menu or toolbar) - \return \c true if the action is added successfully and \c false otherwise. - \sa removeFrom() + \brief Called when the action is added to the widget. + \param w widget (not used) */ -bool LightApp_ModuleAction::addTo( QWidget* w ) +void LightApp_ModuleAction::addedTo( QWidget* w ) { - bool ok = QtxAction::addTo( w ); + w->insertAction( mySet, this ); if ( w->inherits( "QToolBar" ) ) - ok = ok && myCombo->addTo( w ); - return ok && mySet->addTo( w ); + w->insertAction( myCombo, this ); + update(); } /*! @@ -406,21 +404,11 @@ bool LightApp_ModuleAction::addTo( QWidget* w ) \return \c true if the action is removed successfully and \c false otherwise. \sa addTo() */ -bool LightApp_ModuleAction::removeFrom( QWidget* w ) +void LightApp_ModuleAction::removedFrom( QWidget* w ) { - bool ok = mySet->removeFrom( w ); if ( w->inherits( "QToolBar" ) ) - ok = ok && myCombo->removeFrom( w ); - return ok && QtxAction::removeFrom( w ); -} - -/*! - \brief Called when the action is added to the widget. - \param w widget (not used) -*/ -void LightApp_ModuleAction::addedTo( QWidget* /*w*/ ) -{ - update(); + w->removeAction( myCombo ); + w->removeAction( mySet ); } /*! diff --git a/src/LightApp/LightApp_ModuleAction.h b/src/LightApp/LightApp_ModuleAction.h index 333c265e2..85f592870 100755 --- a/src/LightApp/LightApp_ModuleAction.h +++ b/src/LightApp/LightApp_ModuleAction.h @@ -63,11 +63,9 @@ public: void setMode( const int ); int mode() const; - virtual bool addTo( QWidget* ); - virtual bool removeFrom( QWidget* ); - protected: virtual void addedTo( QWidget* ); + virtual void removedFrom( QWidget* ); signals: void moduleActivated( const QString& ); diff --git a/src/LightApp/LightApp_Preferences.h b/src/LightApp/LightApp_Preferences.h index 624f6e2be..497cbe20e 100644 --- a/src/LightApp/LightApp_Preferences.h +++ b/src/LightApp/LightApp_Preferences.h @@ -42,10 +42,10 @@ public: LightApp_Preferences( QtxResourceMgr*, QWidget* = 0 ); virtual ~LightApp_Preferences(); - int addPreference( const QString& label, const int pId = -1, const int = -1, - const QString& section = QString::null, const QString& param = QString::null ); - int addPreference( const QString& modName, const QString& label, const int pId = -1, const int = -1, - const QString& section = QString::null, const QString& param = QString::null ); + int addPreference( const QString& label,const int pId = -1, const int = Auto, + const QString& section = QString(), const QString& param = QString() ); + int addPreference( const QString& modName, const QString& label, const int pId = -1, const int = Auto, + const QString& section = QString(), const QString& param = QString() ); bool hasModule( const QString& ) const; diff --git a/src/LightApp/LightApp_PreferencesDlg.cxx b/src/LightApp/LightApp_PreferencesDlg.cxx index aecff557e..f656689e0 100644 --- a/src/LightApp/LightApp_PreferencesDlg.cxx +++ b/src/LightApp/LightApp_PreferencesDlg.cxx @@ -50,6 +50,7 @@ myPrefs( prefs ), mySaved ( false ) setFocusProxy( myPrefs ); myPrefs->setFrameStyle( QFrame::Box | QFrame::Sunken ); + myPrefs->show(); setButtonPosition( Right, Close ); diff --git a/src/OCCViewer/OCCViewer_ViewWindow.cxx b/src/OCCViewer/OCCViewer_ViewWindow.cxx index 69485ba30..8757574d2 100755 --- a/src/OCCViewer/OCCViewer_ViewWindow.cxx +++ b/src/OCCViewer/OCCViewer_ViewWindow.cxx @@ -976,9 +976,9 @@ void OCCViewer_ViewWindow::createActions() */ void OCCViewer_ViewWindow::createToolBar() { - myActionsMap[DumpId]->addTo(myToolBar); + myToolBar->addAction( myActionsMap[DumpId] ); if ( myModel->trihedronActivated() ) - myActionsMap[TrihedronShowId]->addTo(myToolBar); + myToolBar->addAction( myActionsMap[TrihedronShowId] ); SUIT_ToolButton* aScaleBtn = new SUIT_ToolButton(myToolBar, "scale"); aScaleBtn->AddAction(myActionsMap[FitAllId]); @@ -989,9 +989,9 @@ void OCCViewer_ViewWindow::createToolBar() aPanningBtn->AddAction(myActionsMap[PanId]); aPanningBtn->AddAction(myActionsMap[GlobalPanId]); - myActionsMap[ChangeRotationPointId]->addTo(myToolBar); + myToolBar->addAction( myActionsMap[ChangeRotationPointId] ); - myActionsMap[RotationId]->addTo(myToolBar); + myToolBar->addAction( myActionsMap[RotationId] ); SUIT_ToolButton* aViewsBtn = new SUIT_ToolButton(myToolBar, "projection"); aViewsBtn->AddAction(myActionsMap[FrontId]); @@ -1001,17 +1001,17 @@ void OCCViewer_ViewWindow::createToolBar() aViewsBtn->AddAction(myActionsMap[LeftId]); aViewsBtn->AddAction(myActionsMap[RightId]); - myActionsMap[ResetId]->addTo(myToolBar); + myToolBar->addAction( myActionsMap[ResetId] ); SUIT_ToolButton* aMemBtn = new SUIT_ToolButton(myToolBar, "view"); aMemBtn->AddAction(myActionsMap[MemId]); aMemBtn->AddAction(myActionsMap[RestoreId]); myToolBar->addSeparator(); - myActionsMap[CloneId]->addTo(myToolBar); + myToolBar->addAction( myActionsMap[CloneId] ); myToolBar->addSeparator(); - myActionsMap[ClippingId]->addTo(myToolBar); + myToolBar->addAction( myActionsMap[ClippingId] ); } /*! diff --git a/src/Plot2d/Plot2d_ViewWindow.cxx b/src/Plot2d/Plot2d_ViewWindow.cxx index 44e1dfa2a..de258817f 100755 --- a/src/Plot2d/Plot2d_ViewWindow.cxx +++ b/src/Plot2d/Plot2d_ViewWindow.cxx @@ -89,12 +89,11 @@ void Plot2d_ViewWindow::contextMenuPopup( QMenu* thePopup ) // scaling QMenu* scalingPopup = new QMenu( thePopup ); scalingPopup->addAction( myActionsMap[ PModeXLinearId ] ); - myActionsMap[ PModeXLinearId ]->addTo( scalingPopup ); - myActionsMap[ PModeXLogarithmicId ]->addTo( scalingPopup ); + scalingPopup->addAction( myActionsMap[ PModeXLogarithmicId ] ); onChangeHorMode(); scalingPopup->addSeparator(); - myActionsMap[ PModeYLinearId ]->addTo( scalingPopup ); - myActionsMap[ PModeYLogarithmicId ]->addTo( scalingPopup ); + scalingPopup->addAction( myActionsMap[ PModeYLinearId ] ); + scalingPopup->addAction( myActionsMap[ PModeYLogarithmicId ] ); scalingPopup->setTitle( tr( "SCALING_POPUP" ) ); thePopup->addMenu( scalingPopup ); onChangeVerMode(); @@ -102,16 +101,16 @@ void Plot2d_ViewWindow::contextMenuPopup( QMenu* thePopup ) thePopup->addAction(tr("TOT_PLOT2D_FITDATA"), myViewFrame, SLOT(onFitData())); // curve type QMenu* curTypePopup = new QMenu( thePopup ); - myActionsMap[ CurvPointsId ]->addTo( curTypePopup ); - myActionsMap[ CurvLinesId ]->addTo( curTypePopup ); - myActionsMap[ CurvSplinesId ]->addTo( curTypePopup ); + scalingPopup->addAction( myActionsMap[ CurvPointsId ] ); + scalingPopup->addAction( myActionsMap[ CurvLinesId ] ); + scalingPopup->addAction( myActionsMap[ CurvSplinesId ] ); curTypePopup->setTitle( tr( "CURVE_TYPE_POPUP" ) ); thePopup->addMenu( curTypePopup ); // legend - myActionsMap[ LegendId ]->addTo(thePopup); + scalingPopup->addAction( myActionsMap[ LegendId ] ); // settings - myActionsMap[ CurvSettingsId ]->addTo(thePopup); + scalingPopup->addAction( myActionsMap[ CurvSettingsId ] ); } /*! @@ -303,7 +302,7 @@ void Plot2d_ViewWindow::createActions() */ void Plot2d_ViewWindow::createToolBar() { - myActionsMap[DumpId]->addTo(myToolBar); + myToolBar->addAction( myActionsMap[DumpId] ); SUIT_ToolButton* aScaleBtn = new SUIT_ToolButton(myToolBar); aScaleBtn->AddAction(myActionsMap[FitAllId]); @@ -324,14 +323,14 @@ void Plot2d_ViewWindow::createToolBar() myActionsMap[CurvLinesId]->setChecked(true); onChangeCurveMode(); - myActionsMap[HorId]->addTo(myToolBar); + myToolBar->addAction( myActionsMap[HorId] ); onChangeHorMode(); - myActionsMap[VerId]->addTo(myToolBar); + myToolBar->addAction( myActionsMap[VerId] ); onChangeVerMode(); - myActionsMap[LegendId]->addTo(myToolBar); - myActionsMap[CurvSettingsId]->addTo(myToolBar); - myActionsMap[CloneId]->addTo(myToolBar); + myToolBar->addAction( myActionsMap[LegendId] ); + myToolBar->addAction( myActionsMap[CurvSettingsId] ); + myToolBar->addAction( myActionsMap[CloneId] ); onChangeLegendMode(); } diff --git a/src/Qtx/QtxAction.cxx b/src/Qtx/QtxAction.cxx index 53f0f16e5..c43f03242 100755 --- a/src/Qtx/QtxAction.cxx +++ b/src/Qtx/QtxAction.cxx @@ -141,59 +141,6 @@ bool QtxAction::eventFilter( QObject* o, QEvent* e ) return QWidgetAction::eventFilter( o, e ); } -/*! - \brief Add action to widget. - \param w widget (menu or toolbar) - \return \c true if the action is added successfully and \c false otherwise. -*/ -bool QtxAction::addTo( QWidget* w ) -{ - if ( !w ) - return false; - - w->addAction( this ); - return true; -} - -/*! - \brief Add action to widget. - - The function adds the action to the menu or toolbar widget at the - specified \a index. If \a index is negative or greater than number of - items in the menu/toolbar, the action is added to the end of list. - - \param w widget (menu or toolbar) - \param index index of the action in the action list - \return \c true if the action is added successfully and \c false otherwise. -*/ -bool QtxAction::addTo( QWidget* w, const int index ) -{ - if ( !w ) - return false; - - QAction* b = 0; - if ( 0 <= index && index < w->actions().count() ) - b = w->actions().at( index ); - - w->insertAction( b, this ); - - return true; -} - -/*! - \brief Remove action from widget. - \param w widget (menu or toolbar) - \return \c true if the action is removed successfully and \c false otherwise. -*/ -bool QtxAction::removeFrom( QWidget* w ) -{ - if ( !w ) - return false; - - w->removeAction( this ); - return true; -} - /*! \brief Called when the action is added to the widget. diff --git a/src/Qtx/QtxAction.h b/src/Qtx/QtxAction.h index 265a1a4bb..c1a206110 100755 --- a/src/Qtx/QtxAction.h +++ b/src/Qtx/QtxAction.h @@ -46,10 +46,6 @@ public: virtual bool eventFilter( QObject*, QEvent* ); - virtual bool addTo( QWidget* ); - virtual bool addTo( QWidget*, const int ); - virtual bool removeFrom( QWidget* ); - protected: virtual void addedTo( QWidget* ); virtual void removedFrom( QWidget* ); diff --git a/src/Qtx/QtxColorButton.cxx b/src/Qtx/QtxColorButton.cxx index ed9e9c330..d921487ce 100644 --- a/src/Qtx/QtxColorButton.cxx +++ b/src/Qtx/QtxColorButton.cxx @@ -35,15 +35,19 @@ \brief The QtxColorButton class implements a widget for color preference items editing. - The color preference item is represented as the colored button, - clicking on which invokes the standard "Select color" dialog box. - - Initial color value can be set with setColor() method. Currently - chosen color can be retrieved with color() method. + The color preference item is represented as the colored button with + assocoiated popup menu whihc is called when the user presses the small + arrow button near it. The popup menu allows selecting of the color + from the predefined set. In addition it contains the button which + invokes standard "Select color" dialog box. + + Initial color value can be set with setColor() method. Chosen color + can be retrieved with the color() method. */ /*! - \brief + \brief Constructor. + \param parent parent widget */ QtxColorButton::QtxColorButton( QWidget* parent ) : QToolButton( parent ) @@ -95,14 +99,19 @@ QtxColorButton::QtxColorButton( QWidget* parent ) } /*! - \brief + \brief Destructor. */ QtxColorButton::~QtxColorButton() { } /*! - \brief + \brief Get currently selected color. + + Returns null QColor if no color is selected. + + \return selected color + \sa setColor() */ QColor QtxColorButton::color() const { @@ -110,7 +119,9 @@ QColor QtxColorButton::color() const } /*! - \brief + \brief Set color. + \param c color to be set as current + \sa color() */ void QtxColorButton::setColor( const QColor& c ) { @@ -119,6 +130,12 @@ void QtxColorButton::setColor( const QColor& c ) update(); } +/*! + \brief Filter events for the child widgets. + \param o event receiver object + \param e event + \return \c true if the event should be filtered +*/ bool QtxColorButton::eventFilter( QObject* o, QEvent* e ) { if ( e->type() == QEvent::Leave ) @@ -126,21 +143,36 @@ bool QtxColorButton::eventFilter( QObject* o, QEvent* e ) return QToolButton::eventFilter( o, e ); } +/*! + \brief Called when the popup menu is about to show. + + Updates the menu and child widgets state. +*/ void QtxColorButton::onAboutToShow() { updateState(); } /*! - \brief + \brief Called when the button is clicked by the user. + + Emits the signal clicked( QColor ). + + \param on button state (not used) */ -void QtxColorButton::onClicked( bool ) +void QtxColorButton::onClicked( bool /*on*/ ) { emit clicked( color() ); } /*! - \brief + \brief Called when any color selection button from popup menu + is clicked. + + Changes the currently selected color and emits the signal + changed( QColor ). + + \param on button state */ void QtxColorButton::onToggled( bool on ) { @@ -166,7 +198,14 @@ void QtxColorButton::onToggled( bool on ) } /*! - \brief + \brief Called the "Other colors" child button from popup menu + is clicked. + + Invokes standard "Select color" dialog box allowing user to select + custom color. If the current color is changed by the user, emits + the signal changed( QColor ). + + \param on (not used) */ void QtxColorButton::onDialogClicked( bool ) { @@ -183,7 +222,8 @@ void QtxColorButton::onDialogClicked( bool ) } /*! - \brief + \brief Customize paint event for the widget. + \param e paint event */ void QtxColorButton::paintEvent( QPaintEvent* e ) { @@ -212,7 +252,7 @@ void QtxColorButton::paintEvent( QPaintEvent* e ) } /*! - \brief + \brief Update widget state. */ void QtxColorButton::updateState() { @@ -222,7 +262,8 @@ void QtxColorButton::updateState() } /*! - \brief + \brief Update child button state. + \param btn child button */ void QtxColorButton::updateButton( QToolButton* btn ) { @@ -238,6 +279,11 @@ void QtxColorButton::updateButton( QToolButton* btn ) btn->blockSignals( block ); } +/*! + \brief Generate (if necessary) or get the icon for the button. + \param c color to be used for the icon + \return icon pixmap for the button +*/ QPixmap QtxColorButton::buttonIcon( const QColor& c ) const { static QMap pixMap; @@ -262,7 +308,10 @@ QPixmap QtxColorButton::buttonIcon( const QColor& c ) const } /*! - \brief + \brief Draw pixmap. + \param pd paint device + \param c color + \param m margin */ void QtxColorButton::drawColor( QPaintDevice* pd, const QColor& c, const int m ) const { @@ -277,7 +326,8 @@ void QtxColorButton::drawColor( QPaintDevice* pd, const QColor& c, const int m ) } /*! - \brief + \brief Get predefined list of colors to be used in the popup menu. + \return list of colors */ QList QtxColorButton::colorsList() const { @@ -294,3 +344,15 @@ QList QtxColorButton::colorsList() const return lst; } +/*! + \fn void QtxColorButton::clicked( QColor color ); + \brief This signal is emitted when the widget button is clicked by + the user. + \param color current color +*/ + +/*! + \fn void QtxColorButton::changed( QColor color ); + \brief This signal is emitted when the current color is changed. + \param color new current color +*/ diff --git a/src/Qtx/QtxFontEdit.cxx b/src/Qtx/QtxFontEdit.cxx index eff70ac39..30970d8f1 100644 --- a/src/Qtx/QtxFontEdit.cxx +++ b/src/Qtx/QtxFontEdit.cxx @@ -29,29 +29,74 @@ #include #include +/*! + \class QtxFontEdit + \brief The QtxFontEdit class represents a widget for font + preference items editing. + + The font preference item is represented as the drop-down combo box + filled with the list of available fonts. Additional controls for + modifying font properties ('bold', 'italic', font size, etc) are also + available for use. + + Initial font value can be set with setCurrentFont() method. Chosen font + can be retrieved with the currentFont() method. + + Font properties can be set with the setFontSize(), setFontFamily(), + setFontScripting() methods and retrieved with fontSize(), fontFamily(), + fontScripting() methods. + + Additional widgets for direct modyfing font properties are available + with use of setFeatures() method. +*/ + +/*! + \brief Constructor + \param feat font widget features (ORed QtxFontEdit::Features flags) + \param parent parent widget +*/ QtxFontEdit::QtxFontEdit( const int feat, QWidget* parent ) : QFrame( parent ), -myFeatures( feat ) + myFeatures( feat ) { initialize(); } +/*! + \brief Constructor + \param parent parent widget + + All font widget features are enabled. +*/ QtxFontEdit::QtxFontEdit( QWidget* parent ) : QFrame( parent ), -myFeatures( All ) + myFeatures( All ) { initialize(); } +/*! + \brief Destructor +*/ QtxFontEdit::~QtxFontEdit() { } +/*! + \brief Get font widget features. + \return font widget features (ORed QtxFontEdit::Features flags) + \sa setFeatures() +*/ int QtxFontEdit::features() const { return myFeatures; } +/*! + \brief Set font widget features. + \param f font widget features (ORed QtxFontEdit::Features flags) + \sa features() +*/ void QtxFontEdit::setFeatures( const int f ) { if ( myFeatures == f ) @@ -61,6 +106,11 @@ void QtxFontEdit::setFeatures( const int f ) updateState(); } +/*! + \brief Get currently selected font. + \return current font + \sa setCurrentFont() +*/ QFont QtxFontEdit::currentFont() const { QFont fnt( fontFamily(), fontSize() ); @@ -73,6 +123,11 @@ QFont QtxFontEdit::currentFont() const return fnt; } +/*! + \brief Set currently selected font. + \param fnt current font + \sa currentFont() +*/ void QtxFontEdit::setCurrentFont( const QFont& fnt ) { setFontFamily( fnt.family() ); @@ -82,11 +137,21 @@ void QtxFontEdit::setCurrentFont( const QFont& fnt ) ( fnt.underline() ? Underline : 0 ) ); } +/*! + \brief Get selected font family name. + \return current font family name + \sa setFontFamily() +*/ QString QtxFontEdit::fontFamily() const { return myFamily->currentFont().family(); } +/*! + \brief Get selected font size. + \return current font size + \sa setFontSize() +*/ int QtxFontEdit::fontSize() const { bool ok; @@ -94,6 +159,11 @@ int QtxFontEdit::fontSize() const return ok ? pSize : 0; } +/*! + \brief Get selected font scripting. + \return current font scripting + \sa setFontScripting() +*/ int QtxFontEdit::fontScripting() const { return ( myB->isChecked() ? Bold : 0 ) | @@ -101,12 +171,22 @@ int QtxFontEdit::fontScripting() const ( myU->isChecked() ? Underline : 0 ); } +/*! + \brief Set font family name. + \param fam new font family name + \sa fontFamily() +*/ void QtxFontEdit::setFontFamily( const QString& fam ) { myFamily->setCurrentFont( QFont( fam ) ); onFontChanged( myFamily->currentFont() ); } +/*! + \brief Set font size. + \param fam new font size + \sa fontSize() +*/ void QtxFontEdit::setFontSize( const int s ) { if ( s <= 0 ) @@ -119,6 +199,11 @@ void QtxFontEdit::setFontSize( const int s ) mySize->setEditText( QString::number( s ) ); } +/*! + \brief Set font scripting. + \param fam new font scripting + \sa fontScripting() +*/ void QtxFontEdit::setFontScripting( const int script ) { myB->setChecked( script & Bold ); @@ -126,6 +211,9 @@ void QtxFontEdit::setFontScripting( const int script ) myU->setChecked( script & Underline ); } +/*! + \brief Update widget state +*/ void QtxFontEdit::updateState() { int feat = features(); @@ -140,7 +228,11 @@ void QtxFontEdit::updateState() mySize->setEditable( feat & UserSize ); } -void QtxFontEdit::onFontChanged( const QFont& ) +/*! + \brief Called when current font is changed. + \param f (not used) +*/ +void QtxFontEdit::onFontChanged( const QFont& /*f*/ ) { int s = fontSize(); mySize->clear(); @@ -154,7 +246,11 @@ void QtxFontEdit::onFontChanged( const QFont& ) setFontSize( s ); } -void QtxFontEdit::onPreview( bool ) +/*! + \brief Called when "Preview" button is clicked. + \param on (not used) +*/ +void QtxFontEdit::onPreview( bool /*on*/ ) { bool ok; QFont fnt = QFontDialog::getFont( &ok, currentFont() ); @@ -163,6 +259,9 @@ void QtxFontEdit::onPreview( bool ) setCurrentFont( fnt ); } +/* + \brief Perform internal intialization. +*/ void QtxFontEdit::initialize() { QHBoxLayout* base = new QHBoxLayout( this ); diff --git a/src/Qtx/QtxFontEdit.h b/src/Qtx/QtxFontEdit.h index 7db64f34f..b0ef25eef 100644 --- a/src/Qtx/QtxFontEdit.h +++ b/src/Qtx/QtxFontEdit.h @@ -35,15 +35,18 @@ class QTX_EXPORT QtxFontEdit : public QFrame Q_OBJECT public: - typedef enum { Family = 0x01, - Size = 0x02, - UserSize = 0x04, - Bold = 0x08, - Italic = 0x10, - Underline = 0x20, - Preview = 0x40, - Scripting = Bold | Italic | Underline, - All = Family | Size | UserSize | Scripting | Preview } Features; + //! Font widget features + typedef enum { + Family = 0x01, //!< show font family selection widget + Size = 0x02, //!< show font size widget + UserSize = 0x04, //!< allow font size direct change + Bold = 0x08, //!< show 'bold' widget + Italic = 0x10, //!< show 'italic' widget + Underline = 0x20, //!< show 'underline' widget + Preview = 0x40, //!< show font preview widget + Scripting = Bold | Italic | Underline, //!< show font scripting widgets ('bold','italic','underline') + All = Family | Size | UserSize | Scripting | Preview //!< show all font widgets + } Features; public: QtxFontEdit( const int, QWidget* = 0 ); diff --git a/src/Qtx/QtxPagePrefMgr.cxx b/src/Qtx/QtxPagePrefMgr.cxx index cad550c6d..8c9fc0a14 100644 --- a/src/Qtx/QtxPagePrefMgr.cxx +++ b/src/Qtx/QtxPagePrefMgr.cxx @@ -41,13 +41,18 @@ /*! \class QtxPagePrefMgr - GUI implementation of QtxPreferenceMgr - manager of preferences + \brief GUI implementation of the QtxPreferenceMgr class: preferences manager. */ +/*! + \brief Constructor. + \param resMgr resource manager + \param parent parent widget +*/ QtxPagePrefMgr::QtxPagePrefMgr( QtxResourceMgr* resMgr, QWidget* parent ) : QFrame( parent ), -QtxPreferenceMgr( resMgr ), -myInit( false ) + QtxPreferenceMgr( resMgr ), + myInit( false ) { myBox = new QtxGridBox( 1, Qt::Horizontal, this, 0 ); QVBoxLayout* base = new QVBoxLayout( this ); @@ -56,10 +61,17 @@ myInit( false ) base->addWidget( myBox ); } +/*! + \brief Destructor +*/ QtxPagePrefMgr::~QtxPagePrefMgr() { } +/*! + \brief Get recommended size for the widget. + \return recommended widget size +*/ QSize QtxPagePrefMgr::sizeHint() const { initialize(); @@ -67,6 +79,10 @@ QSize QtxPagePrefMgr::sizeHint() const return QFrame::sizeHint(); } +/*! + \brief Get recommended minimum size for the widget. + \return recommended minimum widget size +*/ QSize QtxPagePrefMgr::minimumSizeHint() const { initialize(); @@ -74,6 +90,11 @@ QSize QtxPagePrefMgr::minimumSizeHint() const return QFrame::minimumSizeHint(); } +/*! + \brief Customize show/hide widget operation. + \param on if \c true the widget is being shown, otherswise + it is being hidden +*/ void QtxPagePrefMgr::setVisible( bool on ) { if ( on && !myInit ) @@ -82,6 +103,9 @@ void QtxPagePrefMgr::setVisible( bool on ) QFrame::setVisible( on ); } +/*! + \brief Update widget contents. +*/ void QtxPagePrefMgr::updateContents() { QtxPreferenceMgr::updateContents(); @@ -98,21 +122,45 @@ void QtxPagePrefMgr::updateContents() } } -void QtxPagePrefMgr::itemAdded( QtxPreferenceItem* ) +/*! + \brief Callback function which is called when the child + preference item is added. + \param item child item being added + \sa itemRemoved(), itemChanged() +*/ +void QtxPagePrefMgr::itemAdded( QtxPreferenceItem* /*item*/ ) { triggerUpdate(); } -void QtxPagePrefMgr::itemRemoved( QtxPreferenceItem* ) +/*! + \brief Callback function which is called when the child + preference item is removed. + \param item child item being removed + \sa itemAdded(), itemChanged() +*/ +void QtxPagePrefMgr::itemRemoved( QtxPreferenceItem* /*item*/ ) { triggerUpdate(); } -void QtxPagePrefMgr::itemChanged( QtxPreferenceItem* ) +/*! + \brief Callback function which is called when the child + preference item is modified. + \param item child item being modified + \sa itemAdded(), itemRemoved() +*/ +void QtxPagePrefMgr::itemChanged( QtxPreferenceItem* /*item*/ ) { triggerUpdate(); } +/*! + \brief Get preference item option value. + \param name option name + \return property value or null QVariant if option is not set + \sa setOptionValue() +*/ QVariant QtxPagePrefMgr::optionValue( const QString& name ) const { if ( name == "orientation" ) @@ -121,6 +169,12 @@ QVariant QtxPagePrefMgr::optionValue( const QString& name ) const return QtxPreferenceMgr::optionValue( name ); } +/*! + \brief Set preference item option value. + \param name option name + \param val new property value + \sa optionValue() +*/ void QtxPagePrefMgr::setOptionValue( const QString& name, const QVariant& val ) { if ( name == "orientation" ) @@ -132,6 +186,9 @@ void QtxPagePrefMgr::setOptionValue( const QString& name, const QVariant& val ) QtxPreferenceMgr::setOptionValue( name, val ); } +/*! + \brief Perform internal initialization. +*/ void QtxPagePrefMgr::initialize() const { if ( myInit ) @@ -150,65 +207,133 @@ void QtxPagePrefMgr::initialize() const /*! \class QtxPagePrefItem - Base class for implementation of the preference items + \brief Base class for implementation of all the widget-based + preference items. */ +/*! + \brief Constructor. + \param title preference item title + \param parent parent preference item + \param sect resource file section associated with the preference item + \param param resource file parameter associated with the preference item +*/ QtxPagePrefItem::QtxPagePrefItem( const QString& title, QtxPreferenceItem* parent, const QString& sect, const QString& param ) : QtxPreferenceItem( title, sect, param, parent ), -myWidget( 0 ) + myWidget( 0 ) { } +/*! + \brief Destructor. +*/ QtxPagePrefItem::~QtxPagePrefItem() { delete myWidget; } +/*! + \brief Get unique item type identifier. + \return item type ID +*/ int QtxPagePrefItem::rtti() const { return QtxPagePrefItem::RTTI(); } +/*! + \brief Get preference item editor widget. + \return editor widget + \sa setWidget() +*/ QWidget* QtxPagePrefItem::widget() const { return myWidget; } +/*! + \brief Specify unique item class identifier. + \return item class ID +*/ int QtxPagePrefItem::RTTI() { return 1000; } +/*! + \brief Set preference item editor widget. + \param wid editor widget + \sa widget() +*/ void QtxPagePrefItem::setWidget( QWidget* wid ) { myWidget = wid; sendItemChanges(); } -void QtxPagePrefItem::itemAdded( QtxPreferenceItem* ) +/*! + \brief Callback function which is called when the child + preference item is added. + \param item child item being added + \sa itemRemoved(), itemChanged() +*/ +void QtxPagePrefItem::itemAdded( QtxPreferenceItem* /*item*/ ) { contentChanged(); } -void QtxPagePrefItem::itemRemoved( QtxPreferenceItem* ) +/*! + \brief Callback function which is called when the child + preference item is removed. + \param item child item being removed + \sa itemAdded(), itemChanged() +*/ +void QtxPagePrefItem::itemRemoved( QtxPreferenceItem* /*item*/ ) { contentChanged(); } -void QtxPagePrefItem::itemChanged( QtxPreferenceItem* ) +/*! + \brief Callback function which is called when the child + preference item is modified. + \param item child item being modified + \sa itemAdded(), itemRemoved() +*/ +void QtxPagePrefItem::itemChanged( QtxPreferenceItem* /*item*/ ) { contentChanged(); } +/*! + \brief Store preference item to the resource manager. + + This method should be reimplemented in the subclasses. + Base implementation does nothing. + + \sa retrieve() +*/ void QtxPagePrefItem::store() { } +/*! + \brief Retrieve preference item from the resource manager. + + This method should be reimplemented in the subclasses. + Base implementation does nothing. + + \sa store() +*/ void QtxPagePrefItem::retrieve() { } +/*! + \brief Find all child items of the QtxPagePrefItem type. + \param list used to return list of child items + \param rec if \c true, perform recursive search +*/ void QtxPagePrefItem::pageChildItems( QList& list, const bool rec ) const { QList lst = childItems( rec ); @@ -219,6 +344,11 @@ void QtxPagePrefItem::pageChildItems( QList& list, const bool } } +/*! + \brief Called when contents is changed (item is added, removed or modified). + + Triggers the item update. +*/ void QtxPagePrefItem::contentChanged() { triggerUpdate(); @@ -226,12 +356,21 @@ void QtxPagePrefItem::contentChanged() /*! \class QtxPageNamedPrefItem - Base class for implementation of the named preference items (items with text labels). + \brief Base class for implementation of the named preference items + (items with text labels). +*/ + +/*! + \brief Constructor. + \param title preference item title + \param parent parent preference item + \param sect resource file section associated with the preference item + \param param resource file parameter associated with the preference item */ QtxPageNamedPrefItem::QtxPageNamedPrefItem( const QString& title, QtxPreferenceItem* parent, const QString& sect, const QString& param ) : QtxPagePrefItem( title, parent, sect, param ), -myControl( 0 ) + myControl( 0 ) { QWidget* main = new QWidget(); QHBoxLayout* base = new QHBoxLayout( main ); @@ -246,10 +385,17 @@ myControl( 0 ) myLabel->setVisible( !title.isEmpty() ); } +/*! + \brief Destructor. +*/ QtxPageNamedPrefItem::~QtxPageNamedPrefItem() { } +/*! + \brief Set preference title. + \param txt new preference title. +*/ void QtxPageNamedPrefItem::setTitle( const QString& txt ) { QtxPagePrefItem::setTitle( txt ); @@ -259,16 +405,30 @@ void QtxPageNamedPrefItem::setTitle( const QString& txt ) label()->setVisible( true ); } +/*! + \brief Get label widget corresponding to the preference item. + \return label widget +*/ QLabel* QtxPageNamedPrefItem::label() const { return myLabel; } +/*! + \brief Get control widget corresponding to the preference item. + \return control widget + \sa setControl() +*/ QWidget* QtxPageNamedPrefItem::control() const { return myControl; } +/*! + \brief Set control widget corresponding to the preference item. + \param wid control widget + \sa control() +*/ void QtxPageNamedPrefItem::setControl( QWidget* wid ) { if ( myControl == wid ) @@ -283,12 +443,20 @@ void QtxPageNamedPrefItem::setControl( QWidget* wid ) /*! \class QtxPagePrefListItem + \brief GUI implementation of the list container preference item. */ +/*! + \brief Constructor. + \param title preference item title + \param parent parent preference item + \param sect resource file section associated with the preference item + \param param resource file parameter associated with the preference item +*/ QtxPagePrefListItem::QtxPagePrefListItem( const QString& title, QtxPreferenceItem* parent, const QString& sect, const QString& param ) : QtxPagePrefItem( title, parent, sect, param ), -myFix( false ) + myFix( false ) { QSplitter* main = new QSplitter( Qt::Horizontal ); main->setChildrenCollapsible( false ); @@ -306,15 +474,28 @@ myFix( false ) setWidget( main ); } +/*! + \brief Destructor. +*/ QtxPagePrefListItem::~QtxPagePrefListItem() { } +/*! + \brief Get message text which is shown if the container is empty. + \return message text + \sa setEmptyInfo() +*/ QString QtxPagePrefListItem::emptyInfo() const { return myInfText; } +/*! + \brief Set message text which is shown if the container is empty. + \param new message text + \sa emptyInfo() +*/ void QtxPagePrefListItem::setEmptyInfo( const QString& inf ) { if ( myInfText == inf ) @@ -325,11 +506,21 @@ void QtxPagePrefListItem::setEmptyInfo( const QString& inf ) updateVisible(); } +/*! + \brief Check if the preference item widget is of fixed size. + \return \c true if the widget has the fixed size + \sa setFixedSize() +*/ bool QtxPagePrefListItem::isFixedSize() const { return myFix; } +/*! + \brief Set the preference item widget to be of fixed size. + \param on if \c true, the widget will have the fixed size + \sa isFixedSize() +*/ void QtxPagePrefListItem::setFixedSize( const bool on ) { if ( myFix == on ) @@ -340,11 +531,20 @@ void QtxPagePrefListItem::setFixedSize( const bool on ) updateGeom(); } +/*! + \brief Update widget contents. +*/ void QtxPagePrefListItem::updateContents() { updateVisible(); } +/*! + \brief Get preference item option value. + \param name option name + \return property value or null QVariant if option is not set + \sa setOptionValue() +*/ QVariant QtxPagePrefListItem::optionValue( const QString& name ) const { if ( name == "fixed_size" ) @@ -355,6 +555,12 @@ QVariant QtxPagePrefListItem::optionValue( const QString& name ) const return QtxPagePrefItem::optionValue( name ); } +/*! + \brief Set preference item option value. + \param name option name + \param val new property value + \sa optionValue() +*/ void QtxPagePrefListItem::setOptionValue( const QString& name, const QVariant& val ) { if ( name == "fixed_size" ) @@ -371,11 +577,17 @@ void QtxPagePrefListItem::setOptionValue( const QString& name, const QVariant& v QtxPagePrefItem::setOptionValue( name, val ); } +/*! + \brief Called when the selection in the list box is changed. +*/ void QtxPagePrefListItem::onItemSelectionChanged() { updateState(); } +/*! + \brief Update information label widget. +*/ void QtxPagePrefListItem::updateInfo() { QString infoText; @@ -397,6 +609,9 @@ void QtxPagePrefListItem::updateInfo() myInfLabel->setText( infoText ); } +/*! + \brief Update widget state. +*/ void QtxPagePrefListItem::updateState() { QtxPagePrefItem* item = selectedItem(); @@ -407,6 +622,9 @@ void QtxPagePrefListItem::updateState() updateInfo(); } +/*! + \brief Update visibile child widgets. +*/ void QtxPagePrefListItem::updateVisible() { QList items; @@ -443,12 +661,15 @@ void QtxPagePrefListItem::updateVisible() if ( selected() == -1 && myList->count() ) setSelected( myList->item( 0 )->data( Qt::UserRole ).toInt() ); - myList->setVisible( myList->count() > 1 ); + //myList->setVisible( myList->count() > 1 ); updateState(); updateGeom(); } +/*! + \brief Update widget geometry. +*/ void QtxPagePrefListItem::updateGeom() { if ( myFix ) @@ -470,6 +691,11 @@ void QtxPagePrefListItem::updateGeom() } } +/*! + \brief Get identifier of the currently selected preference item. + \return identifier of the currently selected item or -1 if no item is selected + \sa setSelected() +*/ int QtxPagePrefListItem::selected() const { QList selList = myList->selectedItems(); @@ -480,6 +706,11 @@ int QtxPagePrefListItem::selected() const return v.canConvert( QVariant::Int ) ? v.toInt() : -1; } +/*! + \brief Get currently selected preference item. + \return currently selected item or 0 if no item is selected + \sa setSelected() +*/ QtxPagePrefItem* QtxPagePrefListItem::selectedItem() const { int selId = selected(); @@ -496,6 +727,10 @@ QtxPagePrefItem* QtxPagePrefListItem::selectedItem() const return item; } +/*! + \brief Set currently selected preference item. + \param id identifier of the preference item to make selected +*/ void QtxPagePrefListItem::setSelected( const int id ) { int idx = -1; @@ -517,8 +752,16 @@ void QtxPagePrefListItem::setSelected( const int id ) /*! \class QtxPagePrefTabsItem + \brief GUI implementation of the tab widget container. */ +/*! + \brief Constructor. + \param title preference item title + \param parent parent preference item + \param sect resource file section associated with the preference item + \param param resource file parameter associated with the preference item +*/ QtxPagePrefTabsItem::QtxPagePrefTabsItem( const QString& title, QtxPreferenceItem* parent, const QString& sect, const QString& param ) : QtxPagePrefItem( title, parent, sect, param ) @@ -527,45 +770,87 @@ QtxPagePrefTabsItem::QtxPagePrefTabsItem( const QString& title, QtxPreferenceIte setWidget( myTabs ); } +/*! + \brief Destructor. +*/ QtxPagePrefTabsItem::~QtxPagePrefTabsItem() { } +/*! + \brief Update widget contents. +*/ void QtxPagePrefTabsItem::updateContents() { updateTabs(); } +/*! + \brief Get tabs position. + \return current tabs position (QTabWidget::TabPosition) + \sa setTabPosition() +*/ int QtxPagePrefTabsItem::tabPosition() const { return myTabs->tabPosition(); } +/*! + \brief Set tabs position. + \param tp new tabs position (QTabWidget::TabPosition) + \sa tabPosition() +*/ void QtxPagePrefTabsItem::setTabPosition( const int tp ) { myTabs->setTabPosition( (QTabWidget::TabPosition)tp ); } +/*! + \brief Get tabs shape. + \return current tabs shape (QTabWidget::TabShape) + \sa setTabShape() +*/ int QtxPagePrefTabsItem::tabShape() const { return myTabs->tabShape(); } +/*! + \brief Set tabs shape. + \param ts new tabs shape (QTabWidget::TabShape) + \sa tabShape() +*/ void QtxPagePrefTabsItem::setTabShape( const int ts ) { myTabs->setTabShape( (QTabWidget::TabShape)ts ); } +/*! + \brief Get tabs icon size. + \return current tabs icon size + \sa setTabIconSize() +*/ QSize QtxPagePrefTabsItem::tabIconSize() const { return myTabs->iconSize(); } +/*! + \brief Set tabs icon size. + \param sz new tabs icon size + \sa tabIconSize() +*/ void QtxPagePrefTabsItem::setTabIconSize( const QSize& sz ) { myTabs->setIconSize( sz ); } +/*! + \brief Get preference item option value. + \param name option name + \return property value or null QVariant if option is not set + \sa setOptionValue() +*/ QVariant QtxPagePrefTabsItem::optionValue( const QString& name ) const { if ( name == "position" ) @@ -578,6 +863,12 @@ QVariant QtxPagePrefTabsItem::optionValue( const QString& name ) const return QtxPagePrefItem::optionValue( name ); } +/*! + \brief Set preference item option value. + \param name option name + \param val new property value + \sa optionValue() +*/ void QtxPagePrefTabsItem::setOptionValue( const QString& name, const QVariant& val ) { if ( name == "position" ) @@ -599,6 +890,9 @@ void QtxPagePrefTabsItem::setOptionValue( const QString& name, const QVariant& v QtxPagePrefItem::setOptionValue( name, val ); } +/*! + \brief Update tabs. +*/ void QtxPagePrefTabsItem::updateTabs() { QList items; @@ -646,8 +940,16 @@ void QtxPagePrefTabsItem::updateTabs() /*! \class QtxPagePrefFrameItem + \brief GUI implementation of the frame widget container. */ +/*! + \brief Constructor. + \param title preference item title + \param parent parent preference item + \param sect resource file section associated with the preference item + \param param resource file parameter associated with the preference item +*/ QtxPagePrefFrameItem::QtxPagePrefFrameItem( const QString& title, QtxPreferenceItem* parent, const QString& sect, const QString& param ) : QtxPagePrefItem( title, parent, sect, param ) @@ -656,55 +958,107 @@ QtxPagePrefFrameItem::QtxPagePrefFrameItem( const QString& title, QtxPreferenceI setWidget( myBox ); } +/*! + \brief Destructor. +*/ QtxPagePrefFrameItem::~QtxPagePrefFrameItem() { } +/*! + \brief Update widget contents. +*/ void QtxPagePrefFrameItem::updateContents() { updateFrame(); } +/*! + \brief Get frame margin. + \return current frame margin + \sa setMargin() +*/ int QtxPagePrefFrameItem::margin() const { return myBox->insideMargin(); } +/*! + \brief Get frame margin. + \param m new frame margin + \sa margin() +*/ void QtxPagePrefFrameItem::setMargin( const int m ) { myBox->setInsideMargin( m ); } +/*! + \brief Get frame spacing. + \return current frame spacing + \sa setSpacing() +*/ int QtxPagePrefFrameItem::spacing() const { return myBox->insideSpacing(); } +/*! + \brief Set frame spacing. + \param s new frame spacing + \sa spacing() +*/ void QtxPagePrefFrameItem::setSpacing( const int s ) { myBox->setInsideSpacing( s ); } +/*! + \brief Get number of frame columns. + \return current columns number + \sa setColumns() +*/ int QtxPagePrefFrameItem::columns() const { return myBox->columns(); } +/*! + \brief Set number of frame columns. + \param c new columns number + \sa columns() +*/ void QtxPagePrefFrameItem::setColumns( const int c ) { myBox->setColumns( c ); } +/*! + \brief Get frame box orientation. + \return current frame orientation + \sa setOrientation() +*/ Qt::Orientation QtxPagePrefFrameItem::orientation() const { return myBox->orientation(); } +/*! + \brief Set frame box orientation. + \param o new frame orientation + \sa orientation() +*/ void QtxPagePrefFrameItem::setOrientation( const Qt::Orientation o ) { myBox->setOrientation( o ); } +/*! + \brief Get preference item option value. + \param name option name + \return property value or null QVariant if option is not set + \sa setOptionValue() +*/ QVariant QtxPagePrefFrameItem::optionValue( const QString& name ) const { if ( name == "margin" ) @@ -719,6 +1073,12 @@ QVariant QtxPagePrefFrameItem::optionValue( const QString& name ) const return QtxPagePrefItem::optionValue( name ); } +/*! + \brief Set preference item option value. + \param name option name + \param val new property value + \sa optionValue() +*/ void QtxPagePrefFrameItem::setOptionValue( const QString& name, const QVariant& val ) { if ( name == "margin" ) @@ -745,6 +1105,9 @@ void QtxPagePrefFrameItem::setOptionValue( const QString& name, const QVariant& QtxPagePrefItem::setOptionValue( name, val ); } +/*! + \brief Update frame widget. +*/ void QtxPagePrefFrameItem::updateFrame() { QList items; @@ -763,8 +1126,16 @@ void QtxPagePrefFrameItem::updateFrame() /*! \class QtxPagePrefGroupItem + \brief GUI implementation of the group widget container. */ +/*! + \brief Constructor. + \param title preference item title + \param parent parent preference item + \param sect resource file section associated with the preference item + \param param resource file parameter associated with the preference item +*/ QtxPagePrefGroupItem::QtxPagePrefGroupItem( const QString& title, QtxPreferenceItem* parent, const QString& sect, const QString& param ) : QtxPagePrefItem( title, parent, sect, param ) @@ -776,6 +1147,14 @@ QtxPagePrefGroupItem::QtxPagePrefGroupItem( const QString& title, QtxPreferenceI setWidget( myGroup ); } +/*! + \brief Constructor. + \param cols columns number + \param title preference item title + \param parent parent preference item + \param sect resource file section associated with the preference item + \param param resource file parameter associated with the preference item +*/ QtxPagePrefGroupItem::QtxPagePrefGroupItem( const int cols, const QString& title, QtxPreferenceItem* parent, const QString& sect, const QString& param ) : QtxPagePrefItem( title, parent, sect, param ) @@ -787,16 +1166,28 @@ QtxPagePrefGroupItem::QtxPagePrefGroupItem( const int cols, const QString& title setWidget( myGroup ); } +/*! + \brief Destructor. +*/ QtxPagePrefGroupItem::~QtxPagePrefGroupItem() { } +/*! + \brief Assign resource file settings to the preference item. + \param sect resource file section name + \param param resource file parameter name + \sa resource() +*/ void QtxPagePrefGroupItem::setResource( const QString& sect, const QString& param ) { QtxPagePrefItem::setResource( sect, param ); updateState(); } +/*! + \brief Update widget contents. +*/ void QtxPagePrefGroupItem::updateContents() { myGroup->setTitle( title() ); @@ -805,68 +1196,130 @@ void QtxPagePrefGroupItem::updateContents() updateGroup(); } +/*! + \brief Get group box margin. + \return current group box margin + \sa setMargin() +*/ int QtxPagePrefGroupItem::margin() const { return myBox->insideMargin(); } +/*! + \brief Get group box margin. + \param m new group box margin + \sa margin() +*/ void QtxPagePrefGroupItem::setMargin( const int m ) { myBox->setInsideMargin( m ); } +/*! + \brief Get group box spacing. + \return current group box spacing + \sa setSpacing() +*/ int QtxPagePrefGroupItem::spacing() const { return myBox->insideSpacing(); } +/*! + \brief Set group box spacing. + \param s new group box spacing + \sa spacing() +*/ void QtxPagePrefGroupItem::setSpacing( const int s ) { myBox->setInsideSpacing( s ); } +/*! + \brief Get number of group box columns. + \return current columns number + \sa setColumns() +*/ int QtxPagePrefGroupItem::columns() const { return myBox->columns(); } +/*! + \brief Set number of group box columns. + \param c new columns number + \sa columns() +*/ void QtxPagePrefGroupItem::setColumns( const int c ) { myBox->setColumns( c ); } +/*! + \brief Get group box orientation. + \return current group box orientation + \sa setOrientation() +*/ Qt::Orientation QtxPagePrefGroupItem::orientation() const { return myBox->orientation(); } +/*! + \brief Set group box orientation. + \param o new group box orientation + \sa orientation() +*/ void QtxPagePrefGroupItem::setOrientation( const Qt::Orientation o ) { myBox->setOrientation( o ); } +/*! + \brief Get 'flat' flag of the group box widget. + \return \c true if the group box is flat +*/ bool QtxPagePrefGroupItem::isFlat() const { return myGroup->isFlat(); } +/*! + \brief Get 'flat' flag of the group box widget. + \param on if \c true the group box will be made flat +*/ void QtxPagePrefGroupItem::setFlat( const bool on ) { myGroup->setFlat( on ); } +/*! + \brief Store preference item to the resource manager. + \sa retrieve() +*/ void QtxPagePrefGroupItem::store() { if ( myGroup->isCheckable() ) setBoolean( myGroup->isChecked() ); } +/*! + \brief Retrieve preference item from the resource manager. + \sa store() +*/ void QtxPagePrefGroupItem::retrieve() { if ( myGroup->isCheckable() ) myGroup->setChecked( getBoolean() ); } +/*! + \brief Get preference item option value. + \param name option name + \return property value or null QVariant if option is not set + \sa setOptionValue() +*/ QVariant QtxPagePrefGroupItem::optionValue( const QString& name ) const { if ( name == "margin" ) @@ -883,6 +1336,12 @@ QVariant QtxPagePrefGroupItem::optionValue( const QString& name ) const return QtxPagePrefItem::optionValue( name ); } +/*! + \brief Set preference item option value. + \param name option name + \param val new property value + \sa optionValue() +*/ void QtxPagePrefGroupItem::setOptionValue( const QString& name, const QVariant& val ) { if ( name == "margin" ) @@ -914,6 +1373,9 @@ void QtxPagePrefGroupItem::setOptionValue( const QString& name, const QVariant& QtxPagePrefItem::setOptionValue( name, val ); } +/*! + \brief Update widget state. +*/ void QtxPagePrefGroupItem::updateState() { QString section, param; @@ -921,6 +1383,9 @@ void QtxPagePrefGroupItem::updateState() myGroup->setCheckable( !title().isEmpty() && !section.isEmpty() && !param.isEmpty() ); } +/*! + \brief Update group box widget. +*/ void QtxPagePrefGroupItem::updateGroup() { QList items; @@ -939,14 +1404,33 @@ void QtxPagePrefGroupItem::updateGroup() /*! \class QtxPagePrefSpaceItem + \brief Simple spacer item which can be used in the preferences + editor dialog box. */ +/*! + \brief Constructor. + + Creates spacer item with zero width and height and expanding + on both directions (by height and width). + + \param parent parent preference item +*/ QtxPagePrefSpaceItem::QtxPagePrefSpaceItem( QtxPreferenceItem* parent ) : QtxPagePrefItem( QString(), parent ) { initialize( 0, 0, 1, 1 ); } +/*! + \brief Constructor. + + Creates spacer item with zero width and height and expanding + according to the specified orientation. + + \param o spacer orientation + \param parent parent preference item +*/ QtxPagePrefSpaceItem::QtxPagePrefSpaceItem( Qt::Orientation o, QtxPreferenceItem* parent ) : QtxPagePrefItem( QString(), parent ) { @@ -956,21 +1440,47 @@ QtxPagePrefSpaceItem::QtxPagePrefSpaceItem( Qt::Orientation o, QtxPreferenceItem initialize( 0, 0, 0, 1 ); } +/*! + \brief Constructor. + + Creates spacer item with specified width and height. The spacing + item is expanding horizontally if \a w <= 0 and vertically + if \a h <= 0. + + \param w spacer width + \param h spacer height + \param parent parent preference item +*/ QtxPagePrefSpaceItem::QtxPagePrefSpaceItem( const int w, const int h, QtxPreferenceItem* parent ) : QtxPagePrefItem( QString(), parent ) { initialize( w, h, w > 0 ? 0 : 1, h > 0 ? 0 : 1 ); } +/*! + \brief Destructor. +*/ QtxPagePrefSpaceItem::~QtxPagePrefSpaceItem() { } +/*! + \brief Get spacer item size for the specified direction. + \param o direction + \return size for the specified direction + \sa setSize() +*/ int QtxPagePrefSpaceItem::size( Qt::Orientation o ) const { return o == Qt::Horizontal ? widget()->minimumWidth() : widget()->minimumHeight(); } +/*! + \brief Set spacer item size for the specified direction. + \param o direction + \param sz new size for the specified direction + \sa size() +*/ void QtxPagePrefSpaceItem::setSize( Qt::Orientation o, const int sz ) { if ( o == Qt::Horizontal ) @@ -979,12 +1489,24 @@ void QtxPagePrefSpaceItem::setSize( Qt::Orientation o, const int sz ) widget()->setMinimumHeight( sz ); } +/*! + \brief Get spacer item stretch factor for the specified direction. + \param o direction + \return stretch factor for the specified direction + \sa setStretch() +*/ int QtxPagePrefSpaceItem::stretch( Qt::Orientation o ) const { QSizePolicy sp = widget()->sizePolicy(); return o == Qt::Horizontal ? sp.horizontalStretch() : sp.verticalStretch(); } +/*! + \brief Set spacer item stretch factor for the specified direction. + \param o direction + \param sf new stretch factor for the specified direction + \sa stretch() +*/ void QtxPagePrefSpaceItem::setStretch( Qt::Orientation o, const int sf ) { QSizePolicy sp = widget()->sizePolicy(); @@ -1002,6 +1524,12 @@ void QtxPagePrefSpaceItem::setStretch( Qt::Orientation o, const int sf ) widget()->setSizePolicy( sp ); } +/*! + \brief Get preference item option value. + \param name option name + \return property value or null QVariant if option is not set + \sa setOptionValue() +*/ QVariant QtxPagePrefSpaceItem::optionValue( const QString& name ) const { if ( name == "horizontal_size" || name == "hsize" ) @@ -1016,6 +1544,12 @@ QVariant QtxPagePrefSpaceItem::optionValue( const QString& name ) const return QtxPagePrefItem::optionValue( name ); } +/*! + \brief Set preference item option value. + \param name option name + \param val new property value + \sa optionValue() +*/ void QtxPagePrefSpaceItem::setOptionValue( const QString& name, const QVariant& val ) { if ( name == "horizontal_size" || name == "hsize" ) @@ -1042,6 +1576,13 @@ void QtxPagePrefSpaceItem::setOptionValue( const QString& name, const QVariant& QtxPagePrefItem::setOptionValue( name, val ); } +/*! + \brief Perform internal initialization. + \param w spacer item width + \param h spacer item height + \param ws spacer item horizontal stretch factor + \param hs spacer item vertical stretch factor +*/ void QtxPagePrefSpaceItem::initialize( const int w, const int h, const int hs, const int vs ) { QSizePolicy sp; @@ -1061,9 +1602,16 @@ void QtxPagePrefSpaceItem::initialize( const int w, const int h, const int hs, c /*! \class QtxPagePrefCheckItem - GUI implementation of resources check item (bool). + \brief GUI implementation of the resources check box item (boolean). */ +/*! + \brief Constructor. + \param title preference item title + \param parent parent preference item + \param sect resource file section associated with the preference item + \param param resource file parameter associated with the preference item +*/ QtxPagePrefCheckItem::QtxPagePrefCheckItem( const QString& title, QtxPreferenceItem* parent, const QString& sect, const QString& param ) @@ -1074,10 +1622,17 @@ QtxPagePrefCheckItem::QtxPagePrefCheckItem( const QString& title, QtxPreferenceI setWidget( myCheck ); } +/*! + \brief Destructor. +*/ QtxPagePrefCheckItem::~QtxPagePrefCheckItem() { } +/*! + \brief Set preference item title. + \param txt new preference title. +*/ void QtxPagePrefCheckItem::setTitle( const QString& txt ) { QtxPagePrefItem::setTitle( txt ); @@ -1085,48 +1640,93 @@ void QtxPagePrefCheckItem::setTitle( const QString& txt ) myCheck->setText( title() ); } +/*! + \brief Store preference item to the resource manager. + \sa retrieve() +*/ void QtxPagePrefCheckItem::store() { setBoolean( myCheck->isChecked() ); } +/*! + \brief Retrieve preference item from the resource manager. + \sa store() +*/ void QtxPagePrefCheckItem::retrieve() { myCheck->setChecked( getBoolean() ); } /*! - \class QtxPagePrefEditItem - GUI implementation of resources line edit item (string, integer, double). + \class QtxPagePrefEditItem + \brief GUI implementation of the resources line edit box item + for string, integer and double values. */ +/*! + \brief Constructor. + + Creates preference item for string value editing. + + \param title preference item title + \param parent parent preference item + \param sect resource file section associated with the preference item + \param param resource file parameter associated with the preference item +*/ QtxPagePrefEditItem::QtxPagePrefEditItem( const QString& title, QtxPreferenceItem* parent, const QString& sect, const QString& param ) : QtxPageNamedPrefItem( title, parent, sect, param ), -myType( String ) + myType( String ) { setControl( myEditor = new QLineEdit() ); updateEditor(); } +/*! + \brief Constructor. + + Creates preference item for editing of the value which type + is specified by parameter \a type. + + \param type preference item input type (QtxPagePrefEditItem::InputType) + \param title preference item title + \param parent parent preference item + \param sect resource file section associated with the preference item + \param param resource file parameter associated with the preference item +*/ QtxPagePrefEditItem::QtxPagePrefEditItem( const int type, const QString& title, - QtxPreferenceItem* parent, const QString& sect, const QString& param ) + QtxPreferenceItem* parent, const QString& sect, + const QString& param ) : QtxPageNamedPrefItem( title, parent, sect, param ), -myType( type ) + myType( type ) { setControl( myEditor = new QLineEdit() ); updateEditor(); } +/*! + \brief Destructor. +*/ QtxPagePrefEditItem::~QtxPagePrefEditItem() { } +/*! + \brief Get edit box preference item input type. + \return preference item input type (QtxPagePrefEditItem::InputType) + \sa setInputType() +*/ int QtxPagePrefEditItem::inputType() const { return myType; } +/*! + \brief Set edit box preference item input type. + \param type new preference item input type (QtxPagePrefEditItem::InputType) + \sa inputType() +*/ void QtxPagePrefEditItem::setInputType( const int type ) { if ( myType == type ) @@ -1136,11 +1736,19 @@ void QtxPagePrefEditItem::setInputType( const int type ) updateEditor(); } +/*! + \brief Store preference item to the resource manager. + \sa retrieve() +*/ void QtxPagePrefEditItem::store() { setString( myEditor->text() ); } +/*! + \brief Retrieve preference item from the resource manager. + \sa store() +*/ void QtxPagePrefEditItem::retrieve() { QString txt = getString(); @@ -1153,6 +1761,12 @@ void QtxPagePrefEditItem::retrieve() myEditor->setText( txt ); } +/*! + \brief Get preference item option value. + \param name option name + \return property value or null QVariant if option is not set + \sa setOptionValue() +*/ QVariant QtxPagePrefEditItem::optionValue( const QString& name ) const { if ( name == "input_type" || name == "type" ) @@ -1161,6 +1775,12 @@ QVariant QtxPagePrefEditItem::optionValue( const QString& name ) const return QtxPageNamedPrefItem::optionValue( name ); } +/*! + \brief Set preference item option value. + \param name option name + \param val new property value + \sa optionValue() +*/ void QtxPagePrefEditItem::setOptionValue( const QString& name, const QVariant& val ) { if ( name == "input_type" || name == "type" ) @@ -1172,6 +1792,9 @@ void QtxPagePrefEditItem::setOptionValue( const QString& name, const QVariant& v QtxPageNamedPrefItem::setOptionValue( name, val ); } +/*! + \brief Update edit box widget. +*/ void QtxPagePrefEditItem::updateEditor() { QValidator* val = 0; @@ -1201,12 +1824,29 @@ void QtxPagePrefEditItem::updateEditor() /*! \class QtxPagePrefSelectItem - GUI implementation of resources selector item (enum). + \brief GUI implementation of the resources selector item + (string, integer or double values list). + + All items in the list (represented as combo box) should be specified + by the unique identifier which is stored to the resource file instead + of the value itself. +*/ + +/*! + \brief Constructor. + + Creates preference item with combo box widget which is not editable + (direct value entering is disabled). + + \param title preference item title + \param parent parent preference item + \param sect resource file section associated with the preference item + \param param resource file parameter associated with the preference item */ QtxPagePrefSelectItem::QtxPagePrefSelectItem( const QString& title, QtxPreferenceItem* parent, const QString& sect, const QString& param ) : QtxPageNamedPrefItem( title, parent, sect, param ), -myType( NoInput ) + myType( NoInput ) { setControl( mySelector = new QtxComboBox() ); mySelector->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); @@ -1214,25 +1854,50 @@ myType( NoInput ) updateSelector(); } +/*! + \brief Constructor. + + Creates preference item with combo box widget which is editable + according to the specified input type (integer, double or string values). + + \param type input type (QtxPagePrefSelectItem::InputType) + \param title preference item title + \param parent parent preference item + \param sect resource file section associated with the preference item + \param param resource file parameter associated with the preference item +*/ QtxPagePrefSelectItem::QtxPagePrefSelectItem( const int type, const QString& title, QtxPreferenceItem* parent, const QString& sect, const QString& param ) : QtxPageNamedPrefItem( title, parent, sect, param ), -myType( type ) + myType( type ) { setControl( mySelector = new QtxComboBox() ); mySelector->setDuplicatesEnabled( false ); updateSelector(); } +/*! + \brief Destructor. +*/ QtxPagePrefSelectItem::~QtxPagePrefSelectItem() { } +/*! + \brief Get edit box preference item input type. + \return preference item input type (QtxPagePrefSelectItem::InputType) + \sa setInputType() +*/ int QtxPagePrefSelectItem::inputType() const { return myType; } +/*! + \brief Set edit box preference item input type. + \param type new preference item input type (QtxPagePrefSelectItem::InputType) + \sa inputType() +*/ void QtxPagePrefSelectItem::setInputType( const int type ) { if ( myType == type ) @@ -1242,6 +1907,11 @@ void QtxPagePrefSelectItem::setInputType( const int type ) updateSelector(); } +/*! + \brief Get the list of the values from the selection widget. + \return list of values + \sa numbers(), setStrings() +*/ QStringList QtxPagePrefSelectItem::strings() const { QStringList res; @@ -1250,6 +1920,11 @@ QStringList QtxPagePrefSelectItem::strings() const return res; } +/*! + \brief Get the list of the values identifiers from the selection widget. + \return list of values IDs + \sa strings(), setNumbers() +*/ QList QtxPagePrefSelectItem::numbers() const { QList res; @@ -1261,12 +1936,22 @@ QList QtxPagePrefSelectItem::numbers() const return res; } +/*! + \brief Set the list of the values to the selection widget. + \param lst new list of values + \sa strings(), setNumbers() +*/ void QtxPagePrefSelectItem::setStrings( const QStringList& lst ) { mySelector->clear(); mySelector->addItems( lst ); } +/*! + \brief Set the list of the values identifiers to the selection widget. + \param ids new list of values IDs + \sa numbers(), setStrings() +*/ void QtxPagePrefSelectItem::setNumbers( const QList& ids ) { uint i = 0; @@ -1274,6 +1959,10 @@ void QtxPagePrefSelectItem::setNumbers( const QList& ids ) mySelector->setId( i, *it ); } +/*! + \brief Store preference item to the resource manager. + \sa retrieve() +*/ void QtxPagePrefSelectItem::store() { if ( mySelector->isCleared() ) @@ -1287,6 +1976,10 @@ void QtxPagePrefSelectItem::store() setString( mySelector->itemText( idx ) ); } +/*! + \brief Retrieve preference item from the resource manager. + \sa store() +*/ void QtxPagePrefSelectItem::retrieve() { QString txt = getString(); @@ -1323,6 +2016,12 @@ void QtxPagePrefSelectItem::retrieve() } } +/*! + \brief Get preference item option value. + \param name option name + \return property value or null QVariant if option is not set + \sa setOptionValue() +*/ QVariant QtxPagePrefSelectItem::optionValue( const QString& name ) const { if ( name == "input_type" || name == "type" ) @@ -1341,6 +2040,12 @@ QVariant QtxPagePrefSelectItem::optionValue( const QString& name ) const return QtxPageNamedPrefItem::optionValue( name ); } +/*! + \brief Set preference item option value. + \param name option name + \param val new property value + \sa optionValue() +*/ void QtxPagePrefSelectItem::setOptionValue( const QString& name, const QVariant& val ) { if ( name == "input_type" || name == "type" ) @@ -1356,6 +2061,11 @@ void QtxPagePrefSelectItem::setOptionValue( const QString& name, const QVariant& QtxPageNamedPrefItem::setOptionValue( name, val ); } +/*! + \brief Set the list of the values from the resource manager. + \param var new values list + \internal +*/ void QtxPagePrefSelectItem::setStrings( const QVariant& var ) { if ( var.type() != QVariant::StringList ) @@ -1364,6 +2074,11 @@ void QtxPagePrefSelectItem::setStrings( const QVariant& var ) setStrings( var.toStringList() ); } +/*! + \brief Set the list of the values identifiers from the resource manager. + \param var new values IDs list + \internal +*/ void QtxPagePrefSelectItem::setNumbers( const QVariant& var ) { if ( var.type() != QVariant::List ) @@ -1379,6 +2094,9 @@ void QtxPagePrefSelectItem::setNumbers( const QVariant& var ) setNumbers( lst ); } +/*! + \brief Update selector widget. +*/ void QtxPagePrefSelectItem::updateSelector() { QValidator* val = 0; @@ -1409,35 +2127,72 @@ void QtxPagePrefSelectItem::updateSelector() } /*! - \class QtxPagePrefSpinItem - GUI implementation of resources spin box item (integer, double). + \class QtxPagePrefSpinItem + \brief GUI implementation of the resources spin box item + (for integer or double value). */ +/*! + \brief Constructor. + + Creates spin box preference item for the entering integer values. + + \param title preference item title + \param parent parent preference item + \param sect resource file section associated with the preference item + \param param resource file parameter associated with the preference item +*/ QtxPagePrefSpinItem::QtxPagePrefSpinItem( const QString& title, QtxPreferenceItem* parent, const QString& sect, const QString& param ) : QtxPageNamedPrefItem( title, parent, sect, param ), -myType( Integer ) + myType( Integer ) { updateSpinBox(); } +/*! + \brief Constructor. + + Creates spin box preference item for the entering values which type + is specified by the parameter \a type. + + \param type input type (QtxPagePrefSpinItem::InputType). + \param title preference item title + \param parent parent preference item + \param sect resource file section associated with the preference item + \param param resource file parameter associated with the preference item +*/ QtxPagePrefSpinItem::QtxPagePrefSpinItem( const int type, const QString& title, - QtxPreferenceItem* parent, const QString& sect, const QString& param ) + QtxPreferenceItem* parent, const QString& sect, + const QString& param ) : QtxPageNamedPrefItem( title, parent, sect, param ), -myType( type ) + myType( type ) { updateSpinBox(); } +/*! + \brief Destructor. +*/ QtxPagePrefSpinItem::~QtxPagePrefSpinItem() { } +/*! + \brief Get spin box preference item input type. + \return preference item input type (QtxPagePrefSpinItem::InputType) + \sa setInputType() +*/ int QtxPagePrefSpinItem::inputType() const { return myType; } +/*! + \brief Set spin box preference item input type. + \param type new preference item input type (QtxPagePrefSpinItem::InputType) + \sa inputType() +*/ void QtxPagePrefSpinItem::setInputType( const int type ) { if ( myType == type ) @@ -1447,6 +2202,11 @@ void QtxPagePrefSpinItem::setInputType( const int type ) updateSpinBox(); } +/*! + \brief Get spin box preference item step value. + \return spin box single step value + \sa setStep() +*/ QVariant QtxPagePrefSpinItem::step() const { if ( QtxIntSpinBox* isb = ::qobject_cast( control() ) ) @@ -1457,6 +2217,11 @@ QVariant QtxPagePrefSpinItem::step() const return QVariant(); } +/*! + \brief Get spin box preference item minimum value. + \return spin box minimum value + \sa setMinimum() +*/ QVariant QtxPagePrefSpinItem::minimum() const { if ( QtxIntSpinBox* isb = ::qobject_cast( control() ) ) @@ -1467,6 +2232,11 @@ QVariant QtxPagePrefSpinItem::minimum() const return QVariant(); } +/*! + \brief Get spin box preference item maximum value. + \return spin box maximum value + \sa setMaximum() +*/ QVariant QtxPagePrefSpinItem::maximum() const { if ( QtxIntSpinBox* isb = ::qobject_cast( control() ) ) @@ -1477,6 +2247,11 @@ QVariant QtxPagePrefSpinItem::maximum() const return QVariant(); } +/*! + \brief Get spin box preference item prefix string. + \return spin box prefix string + \sa setPrefix() +*/ QString QtxPagePrefSpinItem::prefix() const { if ( QtxIntSpinBox* isb = ::qobject_cast( control() ) ) @@ -1487,6 +2262,11 @@ QString QtxPagePrefSpinItem::prefix() const return QString(); } +/*! + \brief Get spin box preference item suffix string. + \return spin box suffix string + \sa setSuffix() +*/ QString QtxPagePrefSpinItem::suffix() const { if ( QtxIntSpinBox* isb = ::qobject_cast( control() ) ) @@ -1497,6 +2277,12 @@ QString QtxPagePrefSpinItem::suffix() const return QString(); } +/*! + \brief Get spin box preference item special value text (which is shown + when the spin box reaches minimum value). + \return spin box special value text + \sa setSpecialValueText() +*/ QString QtxPagePrefSpinItem::specialValueText() const { QAbstractSpinBox* sb = ::qobject_cast( control() ); @@ -1506,6 +2292,11 @@ QString QtxPagePrefSpinItem::specialValueText() const return QString(); } +/*! + \brief Set spin box preference item step value. + \param step new spin box single step value + \sa step() +*/ void QtxPagePrefSpinItem::setStep( const QVariant& step ) { if ( QtxIntSpinBox* isb = ::qobject_cast( control() ) ) @@ -1520,6 +2311,11 @@ void QtxPagePrefSpinItem::setStep( const QVariant& step ) } } +/*! + \brief Set spin box preference item minimum value. + \param min new spin box minimum value + \sa minimum() +*/ void QtxPagePrefSpinItem::setMinimum( const QVariant& min ) { if ( QtxIntSpinBox* isb = ::qobject_cast( control() ) ) @@ -1534,6 +2330,11 @@ void QtxPagePrefSpinItem::setMinimum( const QVariant& min ) } } +/*! + \brief Set spin box preference item maximum value. + \param min new spin box maximum value + \sa maximum() +*/ void QtxPagePrefSpinItem::setMaximum( const QVariant& max ) { if ( QtxIntSpinBox* isb = ::qobject_cast( control() ) ) @@ -1548,6 +2349,11 @@ void QtxPagePrefSpinItem::setMaximum( const QVariant& max ) } } +/*! + \brief Set spin box preference item prefix string. + \param txt new spin box prefix string + \sa prefix() +*/ void QtxPagePrefSpinItem::setPrefix( const QString& txt ) { if ( QtxIntSpinBox* isb = ::qobject_cast( control() ) ) @@ -1556,6 +2362,11 @@ void QtxPagePrefSpinItem::setPrefix( const QString& txt ) dsb->setPrefix( txt ); } +/*! + \brief Set spin box preference item suffix string. + \param txt new spin box suffix string + \sa suffix() +*/ void QtxPagePrefSpinItem::setSuffix( const QString& txt ) { if ( QtxIntSpinBox* isb = ::qobject_cast( control() ) ) @@ -1564,6 +2375,12 @@ void QtxPagePrefSpinItem::setSuffix( const QString& txt ) dsb->setSuffix( txt ); } +/*! + \brief Set spin box preference item special value text (which is shown + when the spin box reaches minimum value). + \param txt new spin box special value text + \sa specialValueText() +*/ void QtxPagePrefSpinItem::setSpecialValueText( const QString& txt ) { QAbstractSpinBox* sb = ::qobject_cast( control() ); @@ -1571,6 +2388,10 @@ void QtxPagePrefSpinItem::setSpecialValueText( const QString& txt ) sb->setSpecialValueText( txt ); } +/*! + \brief Store preference item to the resource manager. + \sa retrieve() +*/ void QtxPagePrefSpinItem::store() { if ( QtxIntSpinBox* isb = ::qobject_cast( control() ) ) @@ -1579,6 +2400,10 @@ void QtxPagePrefSpinItem::store() setDouble( dsb->value() ); } +/*! + \brief Retrieve preference item from the resource manager. + \sa store() +*/ void QtxPagePrefSpinItem::retrieve() { if ( QtxIntSpinBox* isb = ::qobject_cast( control() ) ) @@ -1587,6 +2412,12 @@ void QtxPagePrefSpinItem::retrieve() dsb->setValue( getDouble( dsb->value() ) ); } +/*! + \brief Get preference item option value. + \param name option name + \return property value or null QVariant if option is not set + \sa setOptionValue() +*/ QVariant QtxPagePrefSpinItem::optionValue( const QString& name ) const { if ( name == "input_type" || name == "type" ) @@ -1607,6 +2438,12 @@ QVariant QtxPagePrefSpinItem::optionValue( const QString& name ) const return QtxPageNamedPrefItem::optionValue( name ); } +/*! + \brief Set preference item option value. + \param name option name + \param val new property value + \sa optionValue() +*/ void QtxPagePrefSpinItem::setOptionValue( const QString& name, const QVariant& val ) { if ( name == "input_type" || name == "type" ) @@ -1639,6 +2476,9 @@ void QtxPagePrefSpinItem::setOptionValue( const QString& name, const QVariant& v QtxPageNamedPrefItem::setOptionValue( name, val ); } +/*! + \brief Update spin box widget. +*/ void QtxPagePrefSpinItem::updateSpinBox() { QVariant val; @@ -1683,9 +2523,18 @@ void QtxPagePrefSpinItem::updateSpinBox() /*! \class QtxPagePrefTextItem - GUI implementation of resources text edit item (text - several strings). + \brief GUI implementation of the resources text box edit item + (for large text data). +*/ + +/*! + \brief Constructor. + \param parent parent preference item + \param sect resource file section associated with the preference item + \param param resource file parameter associated with the preference item */ -QtxPagePrefTextItem::QtxPagePrefTextItem( QtxPreferenceItem* parent, const QString& sect, const QString& param ) +QtxPagePrefTextItem::QtxPagePrefTextItem( QtxPreferenceItem* parent, const QString& sect, + const QString& param ) : QtxPageNamedPrefItem( QString(), parent, sect, param ) { myEditor = new QTextEdit(); @@ -1694,6 +2543,13 @@ QtxPagePrefTextItem::QtxPagePrefTextItem( QtxPreferenceItem* parent, const QStri setControl( myEditor ); } +/*! + \brief Constructor. + \param title preference item title + \param parent parent preference item + \param sect resource file section associated with the preference item + \param param resource file parameter associated with the preference item +*/ QtxPagePrefTextItem::QtxPagePrefTextItem( const QString& title, QtxPreferenceItem* parent, const QString& sect, const QString& param ) : QtxPageNamedPrefItem( title, parent, sect, param ) @@ -1704,23 +2560,42 @@ QtxPagePrefTextItem::QtxPagePrefTextItem( const QString& title, QtxPreferenceIte setControl( myEditor ); } +/*! + \brief Destructor. +*/ QtxPagePrefTextItem::~QtxPagePrefTextItem() { } +/*! + \brief Store preference item to the resource manager. + \sa retrieve() +*/ void QtxPagePrefTextItem::store() { setString( myEditor->toPlainText() ); } +/*! + \brief Retrieve preference item from the resource manager. + \sa store() +*/ void QtxPagePrefTextItem::retrieve() { myEditor->setPlainText( getString() ); } /*! - \class QtxPagePrefColorItem - GUI implementation of resources color item. + \class QtxPagePrefColorItem + \brief GUI implementation of the resources color item. +*/ + +/*! + \brief Constructor. + \param title preference item title + \param parent parent preference item + \param sect resource file section associated with the preference item + \param param resource file parameter associated with the preference item */ QtxPagePrefColorItem::QtxPagePrefColorItem( const QString& title, QtxPreferenceItem* parent, const QString& sect, const QString& param ) @@ -1730,31 +2605,59 @@ QtxPagePrefColorItem::QtxPagePrefColorItem( const QString& title, QtxPreferenceI myColor->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); } +/*! + \brief Destructor. +*/ QtxPagePrefColorItem::~QtxPagePrefColorItem() { } +/*! + \brief Store preference item to the resource manager. + \sa retrieve() +*/ void QtxPagePrefColorItem::store() { setColor( myColor->color() ); } +/*! + \brief Retrieve preference item from the resource manager. + \sa store() +*/ void QtxPagePrefColorItem::retrieve() { myColor->setColor( getColor() ); } /*! - \class QtxPagePrefFontItem - GUI implementation of resources font item. + \class QtxPagePrefFontItem + \brief GUI implementation of the resources font item. +*/ + +/*! + \brief Constructor. + \param feat font editor widget features (QtxFontEdit::Features) + \param title preference item title + \param parent parent preference item + \param sect resource file section associated with the preference item + \param param resource file parameter associated with the preference item */ QtxPagePrefFontItem::QtxPagePrefFontItem( const int feat, const QString& title, - QtxPreferenceItem* parent, const QString& sect, const QString& param ) + QtxPreferenceItem* parent, const QString& sect, + const QString& param ) : QtxPageNamedPrefItem( title, parent, sect, param ) { setControl( myFont = new QtxFontEdit( feat ) ); } +/*! + \brief Constructor. + \param title preference item title + \param parent parent preference item + \param sect resource file section associated with the preference item + \param param resource file parameter associated with the preference item +*/ QtxPagePrefFontItem::QtxPagePrefFontItem( const QString& title, QtxPreferenceItem* parent, const QString& sect, const QString& param ) : QtxPageNamedPrefItem( title, parent, sect, param ) @@ -1762,30 +2665,57 @@ QtxPagePrefFontItem::QtxPagePrefFontItem( const QString& title, QtxPreferenceIte setControl( myFont = new QtxFontEdit() ); } +/*! + \brief Destructor. +*/ QtxPagePrefFontItem::~QtxPagePrefFontItem() { } +/*! + \brief Get font widget features. + \return font widget features (ORed QtxFontEdit::Features flags) + \sa setFeatures() +*/ int QtxPagePrefFontItem::features() const { return myFont->features(); } +/*! + \brief Set font widget features. + \param f new font widget features (ORed QtxFontEdit::Features flags) + \sa features() +*/ void QtxPagePrefFontItem::setFeatures( const int f ) { myFont->setFeatures( f ); } +/*! + \brief Store preference item to the resource manager. + \sa retrieve() +*/ void QtxPagePrefFontItem::store() { setFont( myFont->currentFont() ); } +/*! + \brief Retrieve preference item from the resource manager. + \sa store() +*/ void QtxPagePrefFontItem::retrieve() { myFont->setCurrentFont( getFont() ); } +/*! + \brief Get preference item option value. + \param name option name + \return property value or null QVariant if option is not set + \sa setOptionValue() +*/ QVariant QtxPagePrefFontItem::optionValue( const QString& name ) const { if ( name == "features" ) @@ -1794,6 +2724,12 @@ QVariant QtxPagePrefFontItem::optionValue( const QString& name ) const return QtxPageNamedPrefItem::optionValue( name ); } +/*! + \brief Set preference item option value. + \param name option name + \param val new property value + \sa optionValue() +*/ void QtxPagePrefFontItem::setOptionValue( const QString& name, const QVariant& val ) { if ( name == "features" ) @@ -1807,7 +2743,16 @@ void QtxPagePrefFontItem::setOptionValue( const QString& name, const QVariant& v /*! \class QtxPagePrefPathItem - GUI implementation of resources path item. + \brief GUI implementation of the resources file/directory path item. +*/ + +/*! + \brief Constructor. + \param type path widget mode (Qtx::PathType ) + \param title preference item title + \param parent parent preference item + \param sect resource file section associated with the preference item + \param param resource file parameter associated with the preference item */ QtxPagePrefPathItem::QtxPagePrefPathItem( const Qtx::PathType type, const QString& title, QtxPreferenceItem* parent, const QString& sect, const QString& param ) @@ -1816,6 +2761,13 @@ QtxPagePrefPathItem::QtxPagePrefPathItem( const Qtx::PathType type, const QStrin setControl( myPath = new QtxPathEdit( type ) ); } +/*! + \brief Constructor. + \param title preference item title + \param parent parent preference item + \param sect resource file section associated with the preference item + \param param resource file parameter associated with the preference item +*/ QtxPagePrefPathItem::QtxPagePrefPathItem( const QString& title, QtxPreferenceItem* parent, const QString& sect, const QString& param ) : QtxPageNamedPrefItem( title, parent, sect, param ) @@ -1823,40 +2775,77 @@ QtxPagePrefPathItem::QtxPagePrefPathItem( const QString& title, QtxPreferenceIte setControl( myPath = new QtxPathEdit() ); } +/*! + \brief Destructor. +*/ QtxPagePrefPathItem::~QtxPagePrefPathItem() { } +/*! + \brief Get path widget mode. + \return current path widget mode (Qtx::PathType) + \sa setPathType() +*/ Qtx::PathType QtxPagePrefPathItem::pathType() const { return myPath->pathType(); } +/*! + \brief Set path widget mode. + \param type new path widget mode (Qtx::PathType) + \sa pathType() +*/ void QtxPagePrefPathItem::setPathType( const Qtx::PathType type ) { myPath->setPathType( type ); } +/*! + \brief Get currently used path widget filters. + \return file or directory path filters + \sa setPathFilter() +*/ QString QtxPagePrefPathItem::pathFilter() const { return myPath->pathFilter(); } +/*! + \brief Set path widget filters. + \param f new file or directory path filters + \sa pathFilter() +*/ void QtxPagePrefPathItem::setPathFilter( const QString& f ) { myPath->setPathFilter( f ); } +/*! + \brief Store preference item to the resource manager. + \sa retrieve() +*/ void QtxPagePrefPathItem::store() { setString( myPath->path() ); } +/*! + \brief Retrieve preference item from the resource manager. + \sa store() +*/ void QtxPagePrefPathItem::retrieve() { myPath->setPath( getString() ); } +/*! + \brief Get preference item option value. + \param name option name + \return property value or null QVariant if option is not set + \sa setOptionValue() +*/ QVariant QtxPagePrefPathItem::optionValue( const QString& name ) const { if ( name == "path_type" ) @@ -1867,6 +2856,12 @@ QVariant QtxPagePrefPathItem::optionValue( const QString& name ) const return QtxPageNamedPrefItem::optionValue( name ); } +/*! + \brief Set preference item option value. + \param name option name + \param val new property value + \sa optionValue() +*/ void QtxPagePrefPathItem::setOptionValue( const QString& name, const QVariant& val ) { if ( name == "path_type" ) @@ -1884,15 +2879,31 @@ void QtxPagePrefPathItem::setOptionValue( const QString& name, const QVariant& v } /*! - \class QtxPagePrefPathsItem - \brief GUI implementation of resources directory list item. + \class QtxPagePrefPathsItem + \brief GUI implementation of the resources files/directories list item. */ -QtxPagePrefPathsItem::QtxPagePrefPathsItem( QtxPreferenceItem* parent, const QString& sect, const QString& param ) + +/*! + \brief Constructor. + \param parent parent preference item + \param sect resource file section associated with the preference item + \param param resource file parameter associated with the preference item +*/ +QtxPagePrefPathsItem::QtxPagePrefPathsItem( QtxPreferenceItem* parent, const QString& sect, + const QString& param ) : QtxPageNamedPrefItem( QString(), parent, sect, param ) { setControl( myPaths = new QtxPathListEdit() ); } +/*! + \brief Constructor. + \param type path list widget mode (Qtx::PathType) + \param title preference item title + \param parent parent preference item + \param sect resource file section associated with the preference item + \param param resource file parameter associated with the preference item +*/ QtxPagePrefPathsItem::QtxPagePrefPathsItem( const Qtx::PathType type, const QString& title, QtxPreferenceItem* parent, const QString& sect, const QString& param ) : QtxPageNamedPrefItem( title, parent, sect, param ) @@ -1900,6 +2911,13 @@ QtxPagePrefPathsItem::QtxPagePrefPathsItem( const Qtx::PathType type, const QStr setControl( myPaths = new QtxPathListEdit( type ) ); } +/*! + \brief Constructor. + \param title preference item title + \param parent parent preference item + \param sect resource file section associated with the preference item + \param param resource file parameter associated with the preference item +*/ QtxPagePrefPathsItem::QtxPagePrefPathsItem( const QString& title, QtxPreferenceItem* parent, const QString& sect, const QString& param ) : QtxPageNamedPrefItem( title, parent, sect, param ) @@ -1907,30 +2925,57 @@ QtxPagePrefPathsItem::QtxPagePrefPathsItem( const QString& title, QtxPreferenceI setControl( myPaths = new QtxPathListEdit() ); } +/*! + \brief Destructor. +*/ QtxPagePrefPathsItem::~QtxPagePrefPathsItem() { } +/*! + \brief Get path list widget mode. + \return currently used path list widget mode (Qtx::PathType) + \sa setPathType() +*/ Qtx::PathType QtxPagePrefPathsItem::pathType() const { return myPaths->pathType(); } +/*! + \brief Set path list widget mode. + \param type new path list widget mode (Qtx::PathType) + \sa pathType() +*/ void QtxPagePrefPathsItem::setPathType( const Qtx::PathType type ) { myPaths->setPathType( type ); } +/*! + \brief Store preference item to the resource manager. + \sa retrieve() +*/ void QtxPagePrefPathsItem::store() { setString( myPaths->pathList().join( ";" ) ); } +/*! + \brief Retrieve preference item from the resource manager. + \sa store() +*/ void QtxPagePrefPathsItem::retrieve() { myPaths->setPathList( getString().split( ";" ) ); } +/*! + \brief Get preference item option value. + \param name option name + \return property value or null QVariant if option is not set + \sa setOptionValue() +*/ QVariant QtxPagePrefPathsItem::optionValue( const QString& name ) const { if ( name == "path_type" ) @@ -1939,6 +2984,12 @@ QVariant QtxPagePrefPathsItem::optionValue( const QString& name ) const return QtxPageNamedPrefItem::optionValue( name ); } +/*! + \brief Set preference item option value. + \param name option name + \param val new property value + \sa optionValue() +*/ void QtxPagePrefPathsItem::setOptionValue( const QString& name, const QVariant& val ) { if ( name == "path_type" ) diff --git a/src/Qtx/QtxPagePrefMgr.h b/src/Qtx/QtxPagePrefMgr.h index eb06e0373..220727137 100644 --- a/src/Qtx/QtxPagePrefMgr.h +++ b/src/Qtx/QtxPagePrefMgr.h @@ -46,11 +46,6 @@ class QListWidget; class QFileDialog; class QStackedWidget; -/*! - \class QtxPagePrefMgr - GUI implementation of QtxPreferenceMgr - manager of preferences -*/ - class QTX_EXPORT QtxPagePrefMgr : public QFrame, public QtxPreferenceMgr { Q_OBJECT @@ -88,10 +83,6 @@ private: bool myInit; }; -/*! - \class QtxPagePrefItem - Base class for implementation of the preference items -*/ class QTX_EXPORT QtxPagePrefItem : public QtxPreferenceItem { public: @@ -124,10 +115,6 @@ private: QPointer myWidget; }; -/*! - \class QtxPageNamedPrefItem - Base class for implementation of the named preference items (items with text labels). -*/ class QTX_EXPORT QtxPageNamedPrefItem : public QtxPagePrefItem { public: @@ -148,10 +135,6 @@ private: QPointer myControl; }; -/*! - \class QtxPagePrefListItem - GUI implementation of listed container. -*/ class QTX_EXPORT QtxPagePrefListItem : public QObject, public QtxPagePrefItem { Q_OBJECT @@ -195,10 +178,6 @@ private: QLabel* myInfLabel; }; -/*! - \class QtxPagePrefTabsItem - GUI implementation of tab widget container. -*/ class QTX_EXPORT QtxPagePrefTabsItem : public QtxPagePrefItem { public: @@ -228,10 +207,6 @@ private: QTabWidget* myTabs; }; -/*! - \class QtxPagePrefFrameItem - GUI implementation of frame container. -*/ class QTX_EXPORT QtxPagePrefFrameItem : public QtxPagePrefItem { public: @@ -264,10 +239,6 @@ private: QtxGridBox* myBox; }; -/*! - \class QtxPagePrefGroupItem - GUI implementation of group container. -*/ class QTX_EXPORT QtxPagePrefGroupItem : public QtxPagePrefItem { public: @@ -312,9 +283,6 @@ private: QtxGroupBox* myGroup; }; -/*! - \class QtxPagePrefSpaceItem -*/ class QTX_EXPORT QtxPagePrefSpaceItem : public QtxPagePrefItem { public: @@ -337,10 +305,6 @@ private: void initialize( const int, const int, const int, const int ); }; -/*! - \class QtxPagePrefCheckItem - GUI implementation of resources check item (bool). -*/ class QTX_EXPORT QtxPagePrefCheckItem : public QtxPagePrefItem { public: @@ -357,10 +321,6 @@ private: QCheckBox* myCheck; }; -/*! - \class QtxPagePrefEditItem - GUI implementation of resources line edit item (string, integer, double). -*/ class QTX_EXPORT QtxPagePrefEditItem : public QtxPageNamedPrefItem { public: @@ -391,11 +351,6 @@ private: QLineEdit* myEditor; }; -/*! - \class QtxPagePrefSelectItem - GUI implementation of resources selector item (enum). -*/ - class QTX_EXPORT QtxPagePrefSelectItem : public QtxPageNamedPrefItem { public: @@ -434,10 +389,6 @@ private: QtxComboBox* mySelector; }; -/*! - \class QtxPagePrefSpinItem - GUI implementation of resources spin box item (integer, double). -*/ class QTX_EXPORT QtxPagePrefSpinItem : public QtxPageNamedPrefItem { public: @@ -483,10 +434,6 @@ private: int myType; }; -/*! - \class QtxPagePrefTextItem - GUI implementation of resources text edit item (text - several strings). -*/ class QTX_EXPORT QtxPagePrefTextItem : public QtxPageNamedPrefItem { public: @@ -503,10 +450,6 @@ private: QTextEdit* myEditor; }; -/*! - \class QtxPagePrefColorItem - GUI implementation of resources color item. -*/ class QTX_EXPORT QtxPagePrefColorItem : public QtxPageNamedPrefItem { public: @@ -521,10 +464,6 @@ private: QtxColorButton* myColor; }; -/*! - \class QtxPagePrefFontItem - GUI implementation of resources font item. -*/ class QTX_EXPORT QtxPagePrefFontItem : public QObject, public QtxPageNamedPrefItem { Q_OBJECT @@ -550,10 +489,6 @@ private: QtxFontEdit* myFont; }; -/*! - \class QtxPagePrefPathItem - GUI implementation of resources path item. -*/ class QTX_EXPORT QtxPagePrefPathItem : public QtxPageNamedPrefItem { public: @@ -580,10 +515,6 @@ private: QtxPathEdit* myPath; }; -/*! - \class QtxPagePrefPathsItem - \brief GUI implementation of resources directory list item. -*/ class QTX_EXPORT QtxPagePrefPathsItem : public QtxPageNamedPrefItem { public: diff --git a/src/Qtx/QtxPathEdit.cxx b/src/Qtx/QtxPathEdit.cxx index dfbcb7831..3e0c37fa0 100644 --- a/src/Qtx/QtxPathEdit.cxx +++ b/src/Qtx/QtxPathEdit.cxx @@ -54,29 +54,75 @@ static const char* browse_icon[] = { " " }; +/*! + \class QtxPathEdit + \brief The QtxPathEdit class represents a widget for file or directory + path preference items editing. + + The path preference item is represented as the line edit box for the + direct path editing and small button clicking on which invokes browse + dialog box. The widget can be used in different modes: "Open File", + "Save File", "Select Directory". The mode defines the type of the + standard browse dialog box which is invoked on the button clicking. + + Initial path value can be set with setPath() method. Chosen path + can be retrieved with the path() method. The widget mode can be set + with setPathType() and retrieved with pathType() method. + + In addition, file/direcrory filters (wildcards) can be set with the + setPathFilter() method and retrieved with pathFilter() method. +*/ + +/*! + \brief Constructor + \param type widget mode (Qtx::PathType) + \param parent parent widget + \sa pathType(), setPathType() +*/ QtxPathEdit::QtxPathEdit( const Qtx::PathType type, QWidget* parent ) : QFrame( parent ), -myType( type ) + myType( type ) { initialize(); } +/*! + \brief Constructor + + Qtx::PT_OpenFile mode is used by default. + + \param parent parent widget + \sa pathType(), setPathType() +*/ QtxPathEdit::QtxPathEdit( QWidget* parent ) : QFrame( parent ), -myType( Qtx::PT_OpenFile ) + myType( Qtx::PT_OpenFile ) { initialize(); } +/*! + \brief Destructor +*/ QtxPathEdit::~QtxPathEdit() { } +/*! + \brief Get widget mode. + \return currently used widget mode (Qtx::PathType) + \sa setPathType() +*/ Qtx::PathType QtxPathEdit::pathType() const { return myType; } +/*! + \brief Set widget mode. + \param type new widget mode (Qtx::PathType) + \sa pathType() +*/ void QtxPathEdit::setPathType( const Qtx::PathType type ) { if ( myType == type ) @@ -86,21 +132,41 @@ void QtxPathEdit::setPathType( const Qtx::PathType type ) updateState(); } +/*! + \brief Get currently selected path. + \return file or directory path entered by the user + \sa setPath() +*/ QString QtxPathEdit::path() const { return myPath->text(); } +/*! + \brief Set path. + \param txt file or directory path + \sa path() +*/ void QtxPathEdit::setPath( const QString& txt ) { myPath->setText( txt ); } +/*! + \brief Get currently used path filters. + \return file or directory path filters + \sa setPathFilter() +*/ QString QtxPathEdit::pathFilter() const { return myFilter; } +/*! + \brief Set path filters. + \param f new file or directory path filters + \sa pathFilter() +*/ void QtxPathEdit::setPathFilter( const QString& f ) { if ( myFilter == f ) @@ -110,7 +176,15 @@ void QtxPathEdit::setPathFilter( const QString& f ) updateState(); } -void QtxPathEdit::onBrowse( bool ) +/*! + \brief Called when user clicks "Browse" button. + + Invokes standard browsng dialog box depending on the used widget mode. + + \param on (not used) + \sa mode(), setMode() +*/ +void QtxPathEdit::onBrowse( bool /*on*/ ) { QString path; QString initial = QFileInfo( myPath->text() ).path(); @@ -133,11 +207,18 @@ void QtxPathEdit::onBrowse( bool ) myPath->setFocus(); } +/*! + \brief Get internal line edit widget. + \return line edit box widget +*/ QLineEdit* QtxPathEdit::lineEdit() const { return myPath; } +/*! + \brief Perform internal widget intialization. +*/ void QtxPathEdit::initialize() { QHBoxLayout* base = new QHBoxLayout( this ); @@ -158,6 +239,9 @@ void QtxPathEdit::initialize() updateState(); } +/*! + \brief Update widget state. +*/ void QtxPathEdit::updateState() { myPath->setCompleter( Qtx::pathCompleter( pathType(), pathFilter() ) ); diff --git a/src/Qtx/QtxPathListEdit.cxx b/src/Qtx/QtxPathListEdit.cxx index c2de46f61..dee61a389 100644 --- a/src/Qtx/QtxPathListEdit.cxx +++ b/src/Qtx/QtxPathListEdit.cxx @@ -128,24 +128,39 @@ static const char* moveup_icon[] = { " " }; + /*! \class QtxPathListEdit::Editor + \brief Path editor widget + \internal */ + class QtxPathListEdit::Editor : public QtxPathEdit { public: + /*! + \brief Constructor + \internal + */ Editor( QWidget* parent = 0 ) : QtxPathEdit( parent ) { layout()->setSpacing( 0 ); lineEdit()->setFrame( false ); } + /*! + \brief Destructor + \internal + */ virtual ~Editor() {} }; /*! \class QtxPathListEdit::Delegate + \brief Custom item delegate for the paths list widget. + \internal */ + class QtxPathListEdit::Delegate : public QItemDelegate { public: @@ -164,33 +179,70 @@ private: QtxPathListEdit* myPathEdit; }; +/*! + \brief Constructor. + \internal + \param pe path list editor + \param parent parent widget +*/ QtxPathListEdit::Delegate::Delegate( QtxPathListEdit* pe, QObject* parent ) : QItemDelegate( parent ), -myPathEdit( pe ) + myPathEdit( pe ) { } +/*! + \brief Destructor. + \internal +*/ QtxPathListEdit::Delegate::~Delegate() { } +/*! + \brief Create editor widget. + \internal + \param parent parent widget + \param option style option + \param index data model index +*/ QWidget* QtxPathListEdit::Delegate::createEditor( QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index ) const { return myPathEdit->createEditor( parent ); } +/*! + \brief Set modified data back to the data model. + \internal + \param editor editor widget + \param model data model + \param index data model index +*/ void QtxPathListEdit::Delegate::setModelData( QWidget* editor, QAbstractItemModel* model, const QModelIndex& index ) const { myPathEdit->setModelData( editor, index ); } +/*! + \brief Set data from the data model to the editor. + \internal + \param editor editor widget + \param index data model index +*/ void QtxPathListEdit::Delegate::setEditorData( QWidget* editor, const QModelIndex& index ) const { myPathEdit->setEditorData( editor, index ); } +/*! + \brief Customize paint operation. + \internal + \param painter painter + \param option style option + \param index data model index +*/ void QtxPathListEdit::Delegate::paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const { @@ -209,6 +261,13 @@ void QtxPathListEdit::Delegate::paint( QPainter* painter, const QStyleOptionView QItemDelegate::paint( painter, option, index ); } +/*! + \brief Customize drawing selection focus operation. + \internal + \param painter painter + \param option style option + \param rect selection rectangle +*/ void QtxPathListEdit::Delegate::drawFocus( QPainter* painter, const QStyleOptionViewItem& option, const QRect& rect ) const { @@ -217,37 +276,82 @@ void QtxPathListEdit::Delegate::drawFocus( QPainter* painter, const QStyleOption /*! \class QtxPathListEdit + \brief The QtxPathListEdit class represents a widget for files or + directories paths list preference items editing. + + The path list preference item is represented as the list box widget. + It provides such operations like adding new file/directory path to the + list, removing selected paths and modifying of already entered ones. + + The widget can be used in two modes: list of files or list of directories. + The mode defines the type of the standard browse dialog box which is + invoked on the browse button clicking. + + Initial path list value can be set with setPathList() method. Chosen path + list can be retrieved with the pathList() method. The widget mode can be set + with setPathType() and retrieved with pathType() method. + + In addition, it is possible to add path items to the list with the insert() + method, remove items with the remove() methods, clear all the widget contents + with the clear() method. To get the number of entered paths can be retrieved + with the count() method. To check if any path already exists in the paths list, + use contains() method. +*/ + +/*! + \brief Constructor. + \param type widget mode (Qtx::PathType) + \param parent parent widget + \sa pathType(), setPathType() */ QtxPathListEdit::QtxPathListEdit( const Qtx::PathType type, QWidget* parent ) : QFrame( parent ), -myCompleter( 0 ), -myType( type ), -myDuplicate( false ) + myCompleter( 0 ), + myType( type ), + myDuplicate( false ) { initialize(); } +/*! + \brief Constructor. + + Qtx::PT_OpenFile mode is used by default. + + \param parent parent widget + \sa pathType(), setPathType() +*/ QtxPathListEdit::QtxPathListEdit( QWidget* parent ) : QFrame( parent ), -myCompleter( 0 ), -myType( Qtx::PT_OpenFile ), -myDuplicate( false ) + myCompleter( 0 ), + myType( Qtx::PT_OpenFile ), + myDuplicate( false ) { initialize(); } /*! - Destructor + \brief Destructor. */ QtxPathListEdit::~QtxPathListEdit() { } +/*! + \brief Get widget mode. + \return currently used widget mode (Qtx::PathType) + \sa setPathType() +*/ Qtx::PathType QtxPathListEdit::pathType() const { return myType; } +/*! + \brief Set widget mode. + \param t new widget mode (Qtx::PathType) + \sa pathType() +*/ void QtxPathListEdit::setPathType( const Qtx::PathType t ) { if ( myType == t ) @@ -259,47 +363,87 @@ void QtxPathListEdit::setPathType( const Qtx::PathType t ) myCompleter = 0; } +/*! + \brief Get currently selected paths list. + \return files or directories paths list entered by the user + \sa setPathList() +*/ QStringList QtxPathListEdit::pathList() const { return myModel->stringList(); } +/*! + \brief Set paths list. + \param lst files or directories paths list + \sa pathList() +*/ void QtxPathListEdit::setPathList( const QStringList& lst ) { myModel->setStringList( lst ); } +/*! + \brief Check if the duplication of paths is enabled. + \return \c true if the duplication is enabled +*/ bool QtxPathListEdit::isDuplicateEnabled() const { return myDuplicate; } +/*! + \brief Enable/disable paths duplication. + \param on new flag value +*/ void QtxPathListEdit::setDuplicateEnabled( const bool on ) { myDuplicate = on; } +/*! + \brief Get number of currently entered paths. + \return current paths number +*/ int QtxPathListEdit::count() const { return myModel->rowCount(); } +/*! + \brief Check if the specified \a path already exists in + the paths list. + \param path path to be checked + \return \c true if the path is already selected by the user + or \c false otherwise +*/ bool QtxPathListEdit::contains( const QString& path ) const { return myModel->stringList().contains( path ); } +/*! + \brief Clear paths list. +*/ void QtxPathListEdit::clear() { myModel->removeRows( 0, myModel->rowCount() ); } +/*! + \brief Remove path from the paths list. + \param idx path index in the list +*/ void QtxPathListEdit::remove( const int idx ) { if ( 0 <= idx && idx < myModel->rowCount() ) myModel->removeRow( idx ); } +/*! + \brief Remove path from the paths list. + \param path path to be removed +*/ void QtxPathListEdit::remove( const QString& path ) { QModelIndexList indexes = myModel->match( myModel->index( 0, 0 ), Qt::DisplayRole, path, @@ -311,6 +455,15 @@ void QtxPathListEdit::remove( const QString& path ) } } +/*! + \brief Add path to the list of paths. + + If the specified index is out of range, the path is added to + the end of the list. + + \param path path to be added + \param idx index in the list to which the path should be inserted. +*/ void QtxPathListEdit::insert( const QString& path, const int idx ) { int index = idx < 0 ? myModel->rowCount() : qMin( idx, myModel->rowCount() ); @@ -318,9 +471,6 @@ void QtxPathListEdit::insert( const QString& path, const int idx ) myModel->setData( myModel->index( index, 0 ), path, Qt::EditRole ); } -/*! - Validates entered path, returns true if OK -*/ /* bool QtxPathListEdit::validate( const bool quietMode ) { @@ -379,8 +529,12 @@ bool QtxPathListEdit::validate( const bool quietMode ) return true; } */ + /*! - Event filter + \brief Customize child widget events processing. + \param o event receiver object + \param e event + \return \c true if the further event processing should be stopped. */ bool QtxPathListEdit::eventFilter( QObject* o, QEvent* e ) { @@ -407,10 +561,13 @@ bool QtxPathListEdit::eventFilter( QObject* o, QEvent* e ) } /*! - button slot -*/ + \brief Called when button is clicked. -void QtxPathListEdit::onInsert( bool ) + Inserts new empty line to the list and sets input focus to it. + + \param on (not used) +*/ +void QtxPathListEdit::onInsert( bool /*on*/ ) { int empty = -1; QStringList lst = myModel->stringList(); @@ -429,7 +586,11 @@ void QtxPathListEdit::onInsert( bool ) } /*! - button slot + \brief Called when button is clicked. + + Removes currently selected path item. + + \param on (not used) */ void QtxPathListEdit::onDelete( bool ) { @@ -441,7 +602,11 @@ void QtxPathListEdit::onDelete( bool ) } /*! - button slot + \brief Called when button is clicked. + + Move currently selected path item up to one row in the paths list. + + \param on (not used) */ void QtxPathListEdit::onUp( bool ) { @@ -459,7 +624,11 @@ void QtxPathListEdit::onUp( bool ) } /*! - button slot + \brief Called when button is clicked. + + Move currently selected path item down to one row in the paths list. + + \param on (not used) */ void QtxPathListEdit::onDown( bool ) { @@ -476,6 +645,9 @@ void QtxPathListEdit::onDown( bool ) myList->setCurrentIndex( toIdx ); } +/*! + \brief Perform internal widget initialization. +*/ void QtxPathListEdit::initialize() { QVBoxLayout* base = new QVBoxLayout( this ); @@ -527,6 +699,11 @@ void QtxPathListEdit::initialize() connect( downBtn, SIGNAL( clicked( bool ) ), this, SLOT( onDown( bool ) ) ); } +/*! + \brief Create editor widget. + \param parent parent widget for the editor + \return created editor widget +*/ QWidget* QtxPathListEdit::createEditor( QWidget* parent ) { QtxPathEdit* edit = new Editor( parent ); @@ -534,6 +711,11 @@ QWidget* QtxPathListEdit::createEditor( QWidget* parent ) return edit; } +/*! + \brief Set modified data from the editor to the list widget. + \param editor editor widget + \param index data model index +*/ void QtxPathListEdit::setModelData( QWidget* editor, const QModelIndex& index ) { QtxPathEdit* edit = ::qobject_cast( editor ); @@ -551,6 +733,12 @@ void QtxPathListEdit::setModelData( QWidget* editor, const QModelIndex& index ) myModel->setData( index, path, Qt::EditRole ); } +/*! + \brief Set data to the editor from the list widget when + user starts path edition. + \param editor editor widget + \param index data model index +*/ void QtxPathListEdit::setEditorData( QWidget* editor, const QModelIndex& index ) { QtxPathEdit* edit = ::qobject_cast( editor ); @@ -561,6 +749,13 @@ void QtxPathListEdit::setEditorData( QWidget* editor, const QModelIndex& index ) edit->setPath( v.toString() ); } +/*! + \brief Check if path is correct (exists) and optionally + show the question message box. + \param str path to be checked + \param msg if \c true and path does not exist, question message box is shown + \return \c true if the user confirms the path adding +*/ bool QtxPathListEdit::checkExistance( const QString& str, const bool msg ) { if ( pathType() == Qtx::PT_SaveFile ) @@ -591,6 +786,14 @@ bool QtxPathListEdit::checkExistance( const QString& str, const bool msg ) return ok; } +/*! + \brief Check if path already exists in the list and optionally + show the warning message box. + \param str path to be checked + \param row row corresponding to the path checked + \param msg if \c true and path does not exist, warning message box is shown + \return \c true if the user confirms the path adding +*/ bool QtxPathListEdit::checkDuplicate( const QString& str, const int row, const bool msg ) { int cur = -1; diff --git a/src/Qtx/QtxPreferenceMgr.cxx b/src/Qtx/QtxPreferenceMgr.cxx index b355a6d0c..ee4397694 100644 --- a/src/Qtx/QtxPreferenceMgr.cxx +++ b/src/Qtx/QtxPreferenceMgr.cxx @@ -28,13 +28,14 @@ /*! \class QtxPreferenceItem::Updater - Class for incapsulation of one preference item + \brief Preference item updater. + \internal */ class QtxPreferenceItem::Updater : public QObject { -public: Updater(); +public: ~Updater(); static Updater* instance(); @@ -52,14 +53,27 @@ private: QtxPreferenceItem::Updater* QtxPreferenceItem::Updater::_Updater = 0; +/*! + \brief Constructor. + \internal +*/ QtxPreferenceItem::Updater::Updater() { } +/*! + \brief Destructor. + \internal +*/ QtxPreferenceItem::Updater::~Updater() { } +/*! + \brief Get the only updater instance. + \internal + \return the only updater instance +*/ QtxPreferenceItem::Updater* QtxPreferenceItem::Updater::instance() { if ( !_Updater ) @@ -67,6 +81,11 @@ QtxPreferenceItem::Updater* QtxPreferenceItem::Updater::instance() return _Updater; } +/*! + \brief Update the preference item. + \internal + \param item preference item to be updated +*/ void QtxPreferenceItem::Updater::updateItem( QtxPreferenceItem* item ) { if ( !item || myItems.contains( item ) ) @@ -76,12 +95,22 @@ void QtxPreferenceItem::Updater::updateItem( QtxPreferenceItem* item ) QApplication::postEvent( this, new QEvent( QEvent::User ) ); } +/*! + \brief Called when preference item is removed. + \internal + \param item preference item being removed +*/ void QtxPreferenceItem::Updater::removeItem( QtxPreferenceItem* item ) { myItems.removeAll( item ); } -void QtxPreferenceItem::Updater::customEvent( QEvent* e ) +/*! + \brief Custom events provessing. Updates all the items. + \internal + \param e custom event (not used) +*/ +void QtxPreferenceItem::Updater::customEvent( QEvent* /*e*/ ) { QList lst = myItems; for ( QList::const_iterator it = lst.begin(); it != lst.end(); ++it ) @@ -90,12 +119,15 @@ void QtxPreferenceItem::Updater::customEvent( QEvent* e ) /*! \class QtxPreferenceItem - Class for incapsulation of one preference item -*/ + \brief Base class for implementing of all the preference items. + To implement any specific preference item, cubclass from the + QtxPreferenceItem and redefine store() and retrieve() methods. +*/ /*! - Constructor + \brief Constructor. + \param parent parent preference item */ QtxPreferenceItem::QtxPreferenceItem( QtxPreferenceItem* parent ) : myParent( 0 ) @@ -106,9 +138,14 @@ QtxPreferenceItem::QtxPreferenceItem( QtxPreferenceItem* parent ) parent->insertItem( this ); } +/*! + \brief Constructor. + \param title item title + \param parent parent preference item +*/ QtxPreferenceItem::QtxPreferenceItem( const QString& title, QtxPreferenceItem* parent ) : myParent( 0 ), -myTitle( title ) + myTitle( title ) { myId = generateId(); @@ -116,12 +153,19 @@ myTitle( title ) parent->insertItem( this ); } +/*! + \brief Constructor. + \param title item title + \param sect resource file section to be associated with the item + \param param resource file parameter to be associated with the item + \param parent parent preference item +*/ QtxPreferenceItem::QtxPreferenceItem( const QString& title, const QString& sect, const QString& param, QtxPreferenceItem* parent ) : myParent( 0 ), -myTitle( title ), -mySection( sect ), -myParameter( param ) + myTitle( title ), + mySection( sect ), + myParameter( param ) { myId = generateId(); @@ -130,7 +174,7 @@ myParameter( param ) } /*! - Destructor + \brief Destructor. */ QtxPreferenceItem::~QtxPreferenceItem() { @@ -145,24 +189,34 @@ QtxPreferenceItem::~QtxPreferenceItem() } /*! - \return id of item + \brief Get unique item identifier. + \return item ID */ int QtxPreferenceItem::id() const { return myId; } +/*! + \brief Get unique item type identifier. + \return item type ID +*/ int QtxPreferenceItem::rtti() const { return QtxPreferenceItem::RTTI(); } +/*! + \brief Specify unique item class identifier. + \return item class ID +*/ int QtxPreferenceItem::RTTI() { return 1; } /*! + \brief Get root preference item. \return root item */ QtxPreferenceItem* QtxPreferenceItem::rootItem() const @@ -174,6 +228,7 @@ QtxPreferenceItem* QtxPreferenceItem::rootItem() const } /*! + \brief Get parent preference item. \return parent item */ QtxPreferenceItem* QtxPreferenceItem::parentItem() const @@ -182,8 +237,12 @@ QtxPreferenceItem* QtxPreferenceItem::parentItem() const } /*! - Appends child and (if necessary) removes item from old parent - \param item - item to be added + \brief Append child preference item. + + Removes (if necessary) the item from the previous parent. + + \param item item to be added + \sa removeItem() */ void QtxPreferenceItem::insertItem( QtxPreferenceItem* item ) { @@ -200,8 +259,9 @@ void QtxPreferenceItem::insertItem( QtxPreferenceItem* item ) } /*! - Removes child - \param item - item to be removed + \brief Remove child preference item. + \param item item to be removed + \sa insertItem() */ void QtxPreferenceItem::removeItem( QtxPreferenceItem* item ) { @@ -215,8 +275,9 @@ void QtxPreferenceItem::removeItem( QtxPreferenceItem* item ) } /*! - Fills list with children items - \param lst - list to be filled with + \brief Get all child preference items. + \param rec recursion boolean flag + \return list of child items */ QList QtxPreferenceItem::childItems( const bool rec ) const { @@ -230,18 +291,29 @@ QList QtxPreferenceItem::childItems( const bool rec ) const return lst; } +/*! + \brief Get preference item depth. + \return item depth +*/ int QtxPreferenceItem::depth() const { return parentItem() ? parentItem()->depth() + 1 : 0; } +/*! + \brief Get child preference items number. + \return number of child items + \sa isEmpty() +*/ int QtxPreferenceItem::count() const { return myChildren.count(); } /*! - \return true if there is no children of this item + \brief Check if the item has children. + \return \c true if item does not have children + \sa count() */ bool QtxPreferenceItem::isEmpty() const { @@ -249,7 +321,9 @@ bool QtxPreferenceItem::isEmpty() const } /*! - \return icon of item + \brief Get preference item icon. + \return item icon + \sa setIcon() */ QIcon QtxPreferenceItem::icon() const { @@ -257,7 +331,9 @@ QIcon QtxPreferenceItem::icon() const } /*! - \return title of item + \brief Get preference item title. + \return item title + \sa setTitle() */ QString QtxPreferenceItem::title() const { @@ -265,9 +341,10 @@ QString QtxPreferenceItem::title() const } /*! - \return assigned resource placement - \param sec - to return section - \param param - to return param name + \brief Get resource file settings associated to the preference item. + \param sec used to return resource file section name + \param param used to return resource file parameter name + \sa setResource() */ void QtxPreferenceItem::resource( QString& sec, QString& param ) const { @@ -276,8 +353,9 @@ void QtxPreferenceItem::resource( QString& sec, QString& param ) const } /*! - Sets item icon - \param ico - new item icon + \brief Set prefence item icon. + \param ico new item icon + \sa icon() */ void QtxPreferenceItem::setIcon( const QIcon& ico ) { @@ -289,8 +367,9 @@ void QtxPreferenceItem::setIcon( const QIcon& ico ) } /*! - Sets item title - \param title - new item title + \brief Set preference item title . + \param title new item title + \sa title() */ void QtxPreferenceItem::setTitle( const QString& title ) { @@ -302,9 +381,10 @@ void QtxPreferenceItem::setTitle( const QString& title ) } /*! - Assigns new resource to item - \param sec - section - \param sec - param name + \brief Assign resource file settings to the preference item. + \param sec resource file section name + \param param resource file parameter name + \sa resource() */ void QtxPreferenceItem::setResource( const QString& sec, const QString& param ) { @@ -313,7 +393,7 @@ void QtxPreferenceItem::setResource( const QString& sec, const QString& param ) } /*! - Updates item (default implementation is empty) + \brief Update preference item. */ void QtxPreferenceItem::updateContents() { @@ -321,7 +401,10 @@ void QtxPreferenceItem::updateContents() } /*! - \return property value + \brief Get preference item option value. + \param name option name + \return property value or null QVariant if option is not set + \sa setOption() */ QVariant QtxPreferenceItem::option( const QString& name ) const { @@ -329,7 +412,10 @@ QVariant QtxPreferenceItem::option( const QString& name ) const } /*! - Sets property value + \brief Set preference item option value. + \param name option name + \param val new property value + \sa option() */ void QtxPreferenceItem::setOption( const QString& name, const QVariant& val ) { @@ -340,7 +426,27 @@ void QtxPreferenceItem::setOption( const QString& name, const QVariant& val ) } /*! - \return value of assigned resource + \fn void QtxPreferenceItem::store(); + \brief Save preference item (for example, to the resource file). + + This method should be implemented in the subclasses. + + \sa retrieve() +*/ + +/*! + \fn virtual void QtxPreferenceItem::retrieve(); + \brief Restore preference item (for example, from the resource file). + + This method should be implemented in the subclasses. + + \sa store() +*/ + +/*! + \brief Get the value of the associated resource file setting. + \return associated resource file setting value + \sa setResourceValue() */ QString QtxPreferenceItem::resourceValue() const { @@ -348,8 +454,9 @@ QString QtxPreferenceItem::resourceValue() const } /*! - Sets value of assigned resource - \param val - new value + \brief Get the value of the associated resource file setting. + \param val new associated resource file setting value + \sa resourceValue() */ void QtxPreferenceItem::setResourceValue( const QString& val ) { @@ -357,7 +464,8 @@ void QtxPreferenceItem::setResourceValue( const QString& val ) } /*! - \return corresponding resource manager + \brief Get the resources manager. + \return resource manager pointer or 0 if it is not defined */ QtxResourceMgr* QtxPreferenceItem::resourceMgr() const { @@ -366,7 +474,8 @@ QtxResourceMgr* QtxPreferenceItem::resourceMgr() const } /*! - \return corresponding resource edit + \brief Get the parent preferences manager. + \return preferences manager or 0 if it is not defined */ QtxPreferenceMgr* QtxPreferenceItem::preferenceMgr() const { @@ -374,8 +483,10 @@ QtxPreferenceMgr* QtxPreferenceItem::preferenceMgr() const } /*! - \return other item - \param id - other item id + \brief Find the item by the specified identifier. + \param id child item ID + \param rec if \c true recursive search is done + \return child item or 0 if it is not found */ QtxPreferenceItem* QtxPreferenceItem::findItem( const int id, const bool rec ) const { @@ -392,8 +503,10 @@ QtxPreferenceItem* QtxPreferenceItem::findItem( const int id, const bool rec ) c } /*! - \return other item - \param title - other item title + \brief Find the item by the specified title. + \param title child item title + \param rec if \c true recursive search is done + \return child item or 0 if it is not found */ QtxPreferenceItem* QtxPreferenceItem::findItem( const QString& title, const bool rec ) const { @@ -410,9 +523,11 @@ QtxPreferenceItem* QtxPreferenceItem::findItem( const QString& title, const bool } /*! - \return other item - \param title - other item title - \param id - parent item id + \brief Find the item by the specified title and identifier. + \param title child item title + \param id child item ID + \param rec if \c true recursive search is done + \return child item or 0 if it is not found */ QtxPreferenceItem* QtxPreferenceItem::findItem( const QString& title, const int id, const bool rec ) const { @@ -430,8 +545,10 @@ QtxPreferenceItem* QtxPreferenceItem::findItem( const QString& title, const int /*! - \return integer value of resource corresponding to item - \param val - default value (it is returned if there is no such resource) + \brief Get integer resources value corresponding to the item. + \param val default value (returned if there is no such resource) + \return integer value of the associated resource + \sa setInteger() */ int QtxPreferenceItem::getInteger( const int val ) const { @@ -440,8 +557,10 @@ int QtxPreferenceItem::getInteger( const int val ) const } /*! - \return double value of resource corresponding to item - \param val - default value (it is returned if there is no such resource) + \brief Get double resources value corresponding to the item. + \param val default value (returned if there is no such resource) + \return double value of the associated resource + \sa setDouble() */ double QtxPreferenceItem::getDouble( const double val ) const { @@ -450,8 +569,10 @@ double QtxPreferenceItem::getDouble( const double val ) const } /*! - \return boolean value of resource corresponding to item - \param val - default value (it is returned if there is no such resource) + \brief Get boolean resources value corresponding to the item. + \param val default value (returned if there is no such resource) + \return boolean value of the associated resource + \sa setBoolean() */ bool QtxPreferenceItem::getBoolean( const bool val ) const { @@ -460,8 +581,10 @@ bool QtxPreferenceItem::getBoolean( const bool val ) const } /*! - \return string value of resource corresponding to item - \param val - default value (it is returned if there is no such resource) + \brief Get string resources value corresponding to the item. + \param val default value (returned if there is no such resource) + \return string value of the associated resource + \sa setString() */ QString QtxPreferenceItem::getString( const QString& val ) const { @@ -470,8 +593,10 @@ QString QtxPreferenceItem::getString( const QString& val ) const } /*! - \return color value of resource corresponding to item - \param val - default value (it is returned if there is no such resource) + \brief Get color resources value corresponding to the item. + \param val default value (returned if there is no such resource) + \return color value of the associated resource + \sa setColor() */ QColor QtxPreferenceItem::getColor( const QColor& val ) const { @@ -480,8 +605,10 @@ QColor QtxPreferenceItem::getColor( const QColor& val ) const } /*! - \return font value of resource corresponding to item - \param val - default value (it is returned if there is no such resource) + \brief Get font resources value corresponding to the item. + \param val default value (returned if there is no such resource) + \return font value of the associated resource + \sa setFont() */ QFont QtxPreferenceItem::getFont( const QFont& val ) const { @@ -490,8 +617,9 @@ QFont QtxPreferenceItem::getFont( const QFont& val ) const } /*! - Sets value of resource - \param val - value + \brief Set integer resources value corresponding to the item. + \param val new value + \sa getInteger() */ void QtxPreferenceItem::setInteger( const int val ) { @@ -501,8 +629,9 @@ void QtxPreferenceItem::setInteger( const int val ) } /*! - Sets value of resource - \param val - value + \brief Set double resources value corresponding to the item. + \param val new value + \sa getDouble() */ void QtxPreferenceItem::setDouble( const double val ) { @@ -512,8 +641,9 @@ void QtxPreferenceItem::setDouble( const double val ) } /*! - Sets value of resource - \param val - value + \brief Set boolean resources value corresponding to the item. + \param val new value + \sa getBoolean() */ void QtxPreferenceItem::setBoolean( const bool val ) { @@ -523,8 +653,9 @@ void QtxPreferenceItem::setBoolean( const bool val ) } /*! - Sets value of resource - \param val - value + \brief Set string resources value corresponding to the item. + \param val new value + \sa getString() */ void QtxPreferenceItem::setString( const QString& val ) { @@ -534,8 +665,9 @@ void QtxPreferenceItem::setString( const QString& val ) } /*! - Sets value of resource - \param val - value + \brief Set color resources value corresponding to the item. + \param val new value + \sa getColor() */ void QtxPreferenceItem::setColor( const QColor& val ) { @@ -545,8 +677,9 @@ void QtxPreferenceItem::setColor( const QColor& val ) } /*! - Sets value of resource - \param val - value + \brief Set font resources value corresponding to the item. + \param val new value + \sa getFont() */ void QtxPreferenceItem::setFont( const QFont& val ) { @@ -555,32 +688,88 @@ void QtxPreferenceItem::setFont( const QFont& val ) resMgr->setValue( mySection, myParameter, val ); } -void QtxPreferenceItem::itemAdded( QtxPreferenceItem* ) +/*! + \brief Callback function which is called when the child + preference item is added. + + This function can be reimplemented in the subclasses to customize + child item addition operation. Base implementation does nothing. + + \param item child item being added + \sa itemRemoved(), itemChanged() +*/ +void QtxPreferenceItem::itemAdded( QtxPreferenceItem* /*item*/ ) { } -void QtxPreferenceItem::itemRemoved( QtxPreferenceItem* ) +/*! + \brief Callback function which is called when the child + preference item is removed. + + This function can be reimplemented in the subclasses to customize + child item removal operation. Base implementation does nothing. + + \param item child item being removed + \sa itemAdded(), itemChanged() +*/ +void QtxPreferenceItem::itemRemoved( QtxPreferenceItem* /*item*/ ) { } -void QtxPreferenceItem::itemChanged( QtxPreferenceItem* ) +/*! + \brief Callback function which is called when the child + preference item is modified. + + This function can be reimplemented in the subclasses to customize + child item modifying operation. Base implementation does nothing. + + \param item child item being modified + \sa itemAdded(), itemRemoved() +*/ +void QtxPreferenceItem::itemChanged( QtxPreferenceItem* /*item*/ ) { } +/*! + \brief Initiate item updating. +*/ void QtxPreferenceItem::triggerUpdate() { Updater::instance()->updateItem( this ); } -QVariant QtxPreferenceItem::optionValue( const QString& ) const +/*! + \brief Get preference item option value. + + This function can be reimplemented in the subclasses. + Base implementation does nothing. + + \param name option name + \return property value or null QVariant if option is not set + \sa setOptionValue() +*/ +QVariant QtxPreferenceItem::optionValue( const QString& /*name*/ ) const { return QVariant(); } -void QtxPreferenceItem::setOptionValue( const QString&, const QVariant& ) +/*! + \brief Set preference item option value. + + This function can be reimplemented in the subclasses. + Base implementation does nothing. + + \param name option name + \param val new property value + \sa optionValue() +*/ +void QtxPreferenceItem::setOptionValue( const QString& /*name*/, const QVariant& /*val*/ ) { } +/*! + \brief Initiate item changing call back operation. +*/ void QtxPreferenceItem::sendItemChanges() { if ( parentItem() ) @@ -588,7 +777,8 @@ void QtxPreferenceItem::sendItemChanges() } /*! - \return free item id + \brief Generate unique preference item identifier. + \return unique item ID */ int QtxPreferenceItem::generateId() { @@ -596,51 +786,53 @@ int QtxPreferenceItem::generateId() return _id++; } - - /*! \class QtxPreferenceMgr - Class for managing preferences items + \brief Class for managing preferences items. */ - - /*! - Constructor + \brief Constructor. + \param mgr resources manager */ QtxPreferenceMgr::QtxPreferenceMgr( QtxResourceMgr* mgr ) : QtxPreferenceItem( 0 ), -myResMgr( mgr ) + myResMgr( mgr ) { } /*! - Destructor + \brief Destructor. */ QtxPreferenceMgr::~QtxPreferenceMgr() { } /*! - \return assigned resource manager + \brief Get the resources manager. + \return resource manager pointer or 0 if it is not defined */ QtxResourceMgr* QtxPreferenceMgr::resourceMgr() const { return myResMgr; } +/*! + \brief Get the parent preferences manager. + \return pointer to itself +*/ QtxPreferenceMgr* QtxPreferenceMgr::preferenceMgr() const { return (QtxPreferenceMgr*)this; } -/*! - Adds new item - \param label - label of widget to edit preference - \param pId - parent item id - \param type - type of item - \param section - section of resource assigned with item - \param param - name of resource assigned with item +/* + \brief Add new preference item. + \param label label of widget to edit preference item + \param pId parent preference item id + \param type preference item type + \param section resource file section associated to the preference item + \param param resource file parameter associated to the preference item */ /* int QtxPreferenceMgr::addItem( const QString& label, const int pId, const int type, @@ -668,9 +860,11 @@ int QtxPreferenceMgr::addItem( const QString& label, const int pId, const int ty */ /*! - \return value of item property - \param id - item id - \propName - propertyName + \brief Get preference item option value. + \param id preference item ID + \param propName option name + \return property value or null QVariant if option is not set + \sa setOption() */ QVariant QtxPreferenceMgr::option( const int id, const QString& propName ) const { @@ -680,11 +874,13 @@ QVariant QtxPreferenceMgr::option( const int id, const QString& propName ) const propValue = i->option( propName ); return propValue; } + /*! - Sets value of item property - \param id - item id - \propName - propertyName - \propValue - new value of property + \brief Set preference item option value. + \param id preference item ID + \param propName option name + \param propValue new property value + \sa option() */ void QtxPreferenceMgr::setOption( const int id, const QString& propName, const QVariant& propValue ) { @@ -694,7 +890,8 @@ void QtxPreferenceMgr::setOption( const int id, const QString& propName, const Q } /*! - Stores all values to resource manager + \brief Store all preferences item to the resource manager. + \sa retrieve() */ void QtxPreferenceMgr::store() { @@ -715,7 +912,8 @@ void QtxPreferenceMgr::store() } /*! - Retrieve all values from resource manager + \brief Retrieve all preference items from the resource manager. + \sa store() */ void QtxPreferenceMgr::retrieve() { @@ -725,7 +923,8 @@ void QtxPreferenceMgr::retrieve() } /*! - Stores all values to backup container + \brief Dumps all values to the backup container. + \sa fromBackup() */ void QtxPreferenceMgr::toBackup() { @@ -734,7 +933,8 @@ void QtxPreferenceMgr::toBackup() } /*! - Retrieve all values from backup container + \brief Restore all values from the backup container. + \sa toBackup() */ void QtxPreferenceMgr::fromBackup() { @@ -753,19 +953,22 @@ void QtxPreferenceMgr::fromBackup() } /*! - Updates resource edit (default implementation is empty) + \brief Update preferences manager. + + Base implementation does nothing. */ void QtxPreferenceMgr::update() { } -/*! - Creates item +/* + \brief Create preference item. + \param label preference item title + \param type preference item type + \param pId parent preference item ID \return new item - \param label - text of label for new item - \param type - type of new item - \param pId - parent id - +*/ +/* QtxPreferenceItem* QtxPreferenceMgr::createItem( const QString& label, const int type, const int pId ) { Item* i = 0; @@ -786,8 +989,9 @@ QtxPreferenceItem* QtxPreferenceMgr::createItem( const QString& label, const int */ /*! - \return all resources values from widgets - \param map - map to be filled by resources values + \brief Get all resources items values. + \param map used as container filled with the resources values (:) + \sa setResourceValues() */ void QtxPreferenceMgr::resourceValues( QMap& map ) const { @@ -804,8 +1008,10 @@ void QtxPreferenceMgr::resourceValues( QMap& map ) const } /*! - \return all resources values from widgets - \param map - map to be filled by resources values + \brief Get all resources items values. + \param map used as container filled with the resources values + (:) + \sa setResourceValues() */ void QtxPreferenceMgr::resourceValues( ResourceMap& map ) const { @@ -822,8 +1028,9 @@ void QtxPreferenceMgr::resourceValues( ResourceMap& map ) const } /*! - Sets to widgets all resources values from map - \param map - map with resources values + \brief Set all resources items values. + \param map map with resources values (:) + \sa resourceValues() */ void QtxPreferenceMgr::setResourceValues( QMap& map ) const { @@ -836,8 +1043,9 @@ void QtxPreferenceMgr::setResourceValues( QMap& map ) const } /*! - Sets to widgets all resources values from map - \param map - map with resources values + \brief Set all resources items values. + \param map map with resources values (:) + \sa resourceValues() */ void QtxPreferenceMgr::setResourceValues( ResourceMap& map ) const { @@ -846,11 +1054,12 @@ void QtxPreferenceMgr::setResourceValues( ResourceMap& map ) const } /*! - Compares two map of resources values and finds different ones - \param map1 - first map - \param map2 - second map - \param resMap - map to be filled with different values - \param fromFirst - if it is true, then resMap will be filled with values from first map, otherwise - from second + \brief Compare two maps of resources values to find differences. + \param map1 first map + \param map2 second map + \param resMap map to be filled with different values + \param fromFirst if \c true, then \a resMap will be filled with the values + from \a map1, otherwise - from \a map2 */ void QtxPreferenceMgr::differentValues( const QMap& map1, const QMap& map2, QMap& resMap, const bool fromFirst ) const @@ -867,11 +1076,12 @@ void QtxPreferenceMgr::differentValues( const QMap& map1, const QM } /*! - Compares two map of resources values and finds different ones - \param map1 - first map - \param map2 - second map - \param resMap - map to be filled with different values - \param fromFirst - if it is true, then resMap will be filled with values from first map, otherwise - from second + \brief Compare two maps of resources values to find differences. + \param map1 first map + \param map2 second map + \param resMap map to be filled with different values + \param fromFirst if \c true, then \a resMap will be filled with the values + from \a map1, otherwise - from \a map2 */ void QtxPreferenceMgr::differentValues( const ResourceMap& map1, const ResourceMap& map2, ResourceMap& resMap, const bool fromFirst ) const @@ -888,8 +1098,12 @@ void QtxPreferenceMgr::differentValues( const ResourceMap& map1, const ResourceM } /*! - Makes some activity on resource changing (called from store() method) - \sa store() + \brief Perform custom activity on resource changing. + + This method is called from store() and fromBackup() methods. + Base implementation does nothing. + + \sa store(), fromBackup() */ void QtxPreferenceMgr::changedResources( const ResourceMap& ) { diff --git a/src/Qtx/QtxPreferenceMgr.h b/src/Qtx/QtxPreferenceMgr.h index 1c5010702..50fc32416 100644 --- a/src/Qtx/QtxPreferenceMgr.h +++ b/src/Qtx/QtxPreferenceMgr.h @@ -36,10 +36,6 @@ class QtxResourceMgr; class QtxPreferenceMgr; -/*! - \class QtxPreferenceItem - Class for incapsulation of one preference item -*/ class QTX_EXPORT QtxPreferenceItem { class Updater; @@ -135,11 +131,6 @@ private: QString myParameter; }; - -/*! - \class QtxPreferenceMgr - Class for managing preferences items -*/ class QTX_EXPORT QtxPreferenceMgr : public QtxPreferenceItem { public: diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h index f26cda993..c6c2fd679 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h @@ -91,7 +91,6 @@ enum { PT_Font = LightApp_Preferences::Font, PT_DirList = LightApp_Preferences::DirList, PT_File = LightApp_Preferences::File, - PT_User = LightApp_Preferences::User }; class SalomePyQt diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip index 9218f790d..5ef7ac3a3 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip @@ -61,7 +61,6 @@ enum PrefType { PT_Font, PT_DirList, PT_File, - PT_User }; class QtxAction : QAction diff --git a/src/SUIT/SUIT_ActionOperation.cxx b/src/SUIT/SUIT_ActionOperation.cxx index 68d207687..85d96b221 100644 --- a/src/SUIT/SUIT_ActionOperation.cxx +++ b/src/SUIT/SUIT_ActionOperation.cxx @@ -87,18 +87,8 @@ bool SUIT_ActionOperation::addTo( QWidget* wid ) if ( !action() ) return false; - return action()->addTo( wid ); -} - -/*! Add action to widget \a wid. - *\retval TRUE - successful, FALSE - not successful. - */ -bool SUIT_ActionOperation::addTo( QWidget* wid, int idx ) -{ - if ( !action() ) - return false; - - return action()->addTo( wid, idx ); + wid->addAction( action() ); + return true; } /*! Set status tip for action. diff --git a/src/SUIT/SUIT_ActionOperation.h b/src/SUIT/SUIT_ActionOperation.h index 89d9b1f25..12ba0ebf7 100644 --- a/src/SUIT/SUIT_ActionOperation.h +++ b/src/SUIT/SUIT_ActionOperation.h @@ -51,7 +51,6 @@ public: virtual void setAction( QtxAction* theAction ); bool addTo( QWidget* theWidget ); - bool addTo( QWidget* theWidget, int thePos ); void setStatusTip( const QString& theTip ); //@} diff --git a/src/SUPERVGraph/SUPERVGraph_ViewFrame.cxx b/src/SUPERVGraph/SUPERVGraph_ViewFrame.cxx index fe2c9b137..d61e9e5d4 100755 --- a/src/SUPERVGraph/SUPERVGraph_ViewFrame.cxx +++ b/src/SUPERVGraph/SUPERVGraph_ViewFrame.cxx @@ -129,8 +129,8 @@ void SUPERVGraph_ViewFrame::createActions() */ void SUPERVGraph_ViewFrame::createToolBar() { - myActionsMap[PanId]->addTo(myToolBar); - myActionsMap[ResetId]->addTo(myToolBar); + myToolBar->addAction( myActionsMap[PanId] ); + myToolBar->addAction( myActionsMap[ResetId] ); } /*! diff --git a/src/SVTK/SVTK_MainWindow.cxx b/src/SVTK/SVTK_MainWindow.cxx index 1c0b5e9f5..0dd655d31 100644 --- a/src/SVTK/SVTK_MainWindow.cxx +++ b/src/SVTK/SVTK_MainWindow.cxx @@ -587,8 +587,8 @@ void SVTK_MainWindow ::createToolBar() { - myActionsMap[DumpId]->addTo(myToolBar); - myActionsMap[ViewTrihedronId]->addTo(myToolBar); + myToolBar->addAction( myActionsMap[DumpId] ); + myToolBar->addAction( myActionsMap[ViewTrihedronId] ); SUIT_ToolButton* aScaleBtn = new SUIT_ToolButton(myToolBar); aScaleBtn->AddAction(myActionsMap[FitAllId]); @@ -599,9 +599,9 @@ SVTK_MainWindow aPanningBtn->AddAction(myActionsMap[PanId]); aPanningBtn->AddAction(myActionsMap[GlobalPanId]); - myActionsMap[ChangeRotationPointId]->addTo(myToolBar); + myToolBar->addAction( myActionsMap[ChangeRotationPointId] ); - myActionsMap[RotationId]->addTo(myToolBar); + myToolBar->addAction( myActionsMap[RotationId] ); SUIT_ToolButton* aViewsBtn = new SUIT_ToolButton(myToolBar); aViewsBtn->AddAction(myActionsMap[FrontId]); @@ -611,11 +611,11 @@ SVTK_MainWindow aViewsBtn->AddAction(myActionsMap[LeftId]); aViewsBtn->AddAction(myActionsMap[RightId]); - myActionsMap[ResetId]->addTo(myToolBar); + myToolBar->addAction( myActionsMap[ResetId] ); - myActionsMap[UpdateRate]->addTo(myToolBar); - myActionsMap[NonIsometric]->addTo(myToolBar); - myActionsMap[GraduatedAxes]->addTo(myToolBar); + myToolBar->addAction( myActionsMap[UpdateRate] ); + myToolBar->addAction( myActionsMap[NonIsometric] ); + myToolBar->addAction( myActionsMap[GraduatedAxes] ); } /*! diff --git a/src/SalomeApp/SalomeApp_Application.cxx b/src/SalomeApp/SalomeApp_Application.cxx index dce4fc577..11a4fbf70 100644 --- a/src/SalomeApp/SalomeApp_Application.cxx +++ b/src/SalomeApp/SalomeApp_Application.cxx @@ -834,7 +834,7 @@ void SalomeApp_Application::createPreferences( LightApp_Preferences* pref ) pref->addPreference( tr( QString().sprintf( "OBJ_BROWSER_COLUMN_%d", i ).toLatin1() ), defCols, LightApp_Preferences::Bool, "ObjectBrowser", QString().sprintf( "visibility_column_%d", i ) ); } - pref->setItemProperty( defCols, "columns", 1 ); + pref->setItemProperty( "columns", 1, defCols ); // adding preference to LightApp_Application handled preferences.. a bit of hacking with resources.. int genTab = pref->addPreference( LightApp_Application::tr( "PREF_TAB_GENERAL" ), salomeCat ); diff --git a/src/VTKViewer/VTKViewer_ViewWindow.cxx b/src/VTKViewer/VTKViewer_ViewWindow.cxx index 507c2cf98..c04e58115 100755 --- a/src/VTKViewer/VTKViewer_ViewWindow.cxx +++ b/src/VTKViewer/VTKViewer_ViewWindow.cxx @@ -290,8 +290,8 @@ void VTKViewer_ViewWindow::createActions() /*!Create tool bar.*/ void VTKViewer_ViewWindow::createToolBar() { - myActionsMap[DumpId]->addTo(myToolBar); - myActionsMap[TrihedronShowId]->addTo(myToolBar); + myToolBar->addAction( myActionsMap[DumpId] ); + myToolBar->addAction( myActionsMap[TrihedronShowId] ); SUIT_ToolButton* aScaleBtn = new SUIT_ToolButton(myToolBar); aScaleBtn->AddAction(myActionsMap[FitAllId]); @@ -302,7 +302,7 @@ void VTKViewer_ViewWindow::createToolBar() aPanningBtn->AddAction(myActionsMap[PanId]); aPanningBtn->AddAction(myActionsMap[GlobalPanId]); - myActionsMap[RotationId]->addTo(myToolBar); + myToolBar->addAction( myActionsMap[RotationId] ); SUIT_ToolButton* aViewsBtn = new SUIT_ToolButton(myToolBar); aViewsBtn->AddAction(myActionsMap[FrontId]); @@ -312,7 +312,7 @@ void VTKViewer_ViewWindow::createToolBar() aViewsBtn->AddAction(myActionsMap[LeftId]); aViewsBtn->AddAction(myActionsMap[RightId]); - myActionsMap[ResetId]->addTo(myToolBar); + myToolBar->addAction( myActionsMap[ResetId] ); } /*!On front view event.*/ -- 2.39.2