Commit 740ac08d authored by Dirk Wilden's avatar Dirk Wilden
Browse files

updated viewMode Interface to allow setting of viewmodes

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@9949 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 7d18c52e
...@@ -433,7 +433,7 @@ public: ...@@ -433,7 +433,7 @@ public:
void slotSetViewModeIcon(QString _mode, bool _custom, QString _iconName); void slotSetViewModeIcon(QString _mode, bool _custom, QString _iconName);
/// Slot for Changing visible toolWidgets /// Slot for Changing visible toolWidgets
void slotChangeView(QString _mode, QStringList _toolboxWidgets, QStringList _toolbars, QStringList _contextmenus); void slotChangeView(QString _mode, QStringList _toolboxWidgets, QStringList _toolbars, QStringList _contextmenus, bool _expandAll = false);
private slots: private slots:
/// Remove viewMode /// Remove viewMode
...@@ -451,7 +451,7 @@ public: ...@@ -451,7 +451,7 @@ public:
/// Set the view Mode to the given Mode /// Set the view Mode to the given Mode
public slots : public slots :
void setViewMode( QString _mode ); void setViewMode( QString _mode, bool _expandAll = false );
/** @} */ /** @} */
......
...@@ -88,6 +88,16 @@ void SideArea::clear () ...@@ -88,6 +88,16 @@ void SideArea::clear ()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void SideArea::expandAll()
{
foreach (SideElement *e, items_)
{
e->setActive(true);
}
}
//-----------------------------------------------------------------------------
void SideArea::saveState (QSettings &_settings) void SideArea::saveState (QSettings &_settings)
{ {
_settings.beginGroup ("SideArea"); _settings.beginGroup ("SideArea");
......
...@@ -85,6 +85,9 @@ class SideArea : public QWidget { ...@@ -85,6 +85,9 @@ class SideArea : public QWidget {
/// clears the whole tool widget area /// clears the whole tool widget area
void clear (); void clear ();
//expand all elements
void expandAll();
/// returns the current state /// returns the current state
void saveState (QSettings &_settings); void saveState (QSettings &_settings);
......
...@@ -146,6 +146,29 @@ void SideElement::labelPress () ...@@ -146,6 +146,29 @@ void SideElement::labelPress ()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void SideElement::setActive(bool _active)
{
if ( dialog_ )
{
dialog_->raise ();
dialog_->activateWindow ();
}
else
{
active_ = _active;
if (active_)
widget_->show ();
else
widget_->hide ();
QFont font;
font.setBold (active_);
label_->setFont (font);
}
}
//-----------------------------------------------------------------------------
void SideElement::detachPressed (bool checked_) void SideElement::detachPressed (bool checked_)
{ {
if (checked_) if (checked_)
......
...@@ -89,6 +89,9 @@ class SideElement : public QWidget ...@@ -89,6 +89,9 @@ class SideElement : public QWidget
/// Destructor /// Destructor
~SideElement (); ~SideElement ();
/// Set the element as active
void setActive(bool _active);
/// saves the current state /// saves the current state
void saveState (QSettings &_settings); void saveState (QSettings &_settings);
......
...@@ -304,8 +304,8 @@ void CoreWidget::slotSetViewMode( QAction* action){ ...@@ -304,8 +304,8 @@ void CoreWidget::slotSetViewMode( QAction* action){
} }
/// Slot for setting the viewMode from menu /// Slot for setting the viewMode from menu
void CoreWidget::setViewMode( QString _mode ){ void CoreWidget::setViewMode( QString _mode, bool _expandAll ){
slotChangeView(_mode, QStringList(), QStringList(), QStringList()); slotChangeView(_mode, QStringList(), QStringList(), QStringList(), _expandAll);
} }
void CoreWidget::slotAddViewModeComplete(QString _mode , bool _custom, QStringList _toolboxes, QStringList _toolbars, QStringList _contextmenus) { void CoreWidget::slotAddViewModeComplete(QString _mode , bool _custom, QStringList _toolboxes, QStringList _toolbars, QStringList _contextmenus) {
...@@ -349,7 +349,7 @@ void CoreWidget::slotViewChangeDialog() { ...@@ -349,7 +349,7 @@ void CoreWidget::slotViewChangeDialog() {
} }
/// Slot for Changing visible toolWidgets /// Slot for Changing visible toolWidgets
void CoreWidget::slotChangeView(QString _mode, QStringList _toolboxWidgets, QStringList _toolbars, QStringList _contextmenus ){ void CoreWidget::slotChangeView(QString _mode, QStringList _toolboxWidgets, QStringList _toolbars, QStringList _contextmenus, bool _expandAll ){
//try to find Widgets if they aren't given //try to find Widgets if they aren't given
if (_mode != "" && _toolboxWidgets.size() == 0 && _toolbars.size() == 0) if (_mode != "" && _toolboxWidgets.size() == 0 && _toolbars.size() == 0)
...@@ -357,7 +357,7 @@ void CoreWidget::slotChangeView(QString _mode, QStringList _toolboxWidgets, QStr ...@@ -357,7 +357,7 @@ void CoreWidget::slotChangeView(QString _mode, QStringList _toolboxWidgets, QStr
if (viewModes_[i]->name == _mode) { if (viewModes_[i]->name == _mode) {
_toolboxWidgets = viewModes_[i]->visibleToolboxes; _toolboxWidgets = viewModes_[i]->visibleToolboxes;
_toolbars = viewModes_[i]->visibleToolbars; _toolbars = viewModes_[i]->visibleToolbars;
_contextmenus = viewModes_[i]->visibleContextMenus; _contextmenus = viewModes_[i]->visibleContextMenus;
} }
// Remove all toolbox entries // Remove all toolbox entries
...@@ -371,6 +371,9 @@ void CoreWidget::slotChangeView(QString _mode, QStringList _toolboxWidgets, QStr ...@@ -371,6 +371,9 @@ void CoreWidget::slotChangeView(QString _mode, QStringList _toolboxWidgets, QStr
toolBox_->addItem (plugins_[p].toolboxWidgets[j].second, plugins_[p].toolboxWidgets[j].first); toolBox_->addItem (plugins_[p].toolboxWidgets[j].second, plugins_[p].toolboxWidgets[j].first);
} }
if (_expandAll)
toolBox_->expandAll();
//find all Toolbars that should be visible and hide the others //find all Toolbars that should be visible and hide the others
for (uint p=0; p < plugins_.size(); p++) for (uint p=0; p < plugins_.size(); p++)
for ( uint j = 0 ; j < plugins_[p].toolbars.size(); ++j ) for ( uint j = 0 ; j < plugins_[p].toolbars.size(); ++j )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment