Commit c2d5f656 authored by Mike Kremer's avatar Mike Kremer

Added core scripting function that allows to put toolboxes on the top/bottom...

Added core scripting function that allows to put toolboxes on the top/bottom of the side area (variable positions are theoretically also possible).

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@10788 383ad7c9-94d9-4d36-a494-682f7c89f535
parent f3e47c03
......@@ -998,6 +998,12 @@ private slots:
/// Set the icon of a viewMode
void setViewModeIcon(QString _mode, QString _iconName);
/// Move selected toolbox to top of side area
void moveToolboxToTop(QString _name);
/// Move selected toolbox to bottom of side area
void moveToolboxToBottom(QString _name);
private :
/// Core scripting engine
......
......@@ -150,6 +150,24 @@ void Core::setViewModeIcon(QString _mode, QString _iconName){
//-----------------------------------------------------------------------------
void Core::moveToolboxToTop(QString _name) {
if(OpenFlipper::Options::gui()) {
coreWidget_->moveToolboxToTop(_name);
}
}
//-----------------------------------------------------------------------------
void Core::moveToolboxToBottom(QString _name) {
if(OpenFlipper::Options::gui()) {
coreWidget_->moveToolboxToBottom(_name);
}
}
//-----------------------------------------------------------------------------
void Core::addViewModeToolboxes(QString _modeName, QString _toolboxList) {
QStringList list = _toolboxList.split(";");
......
......@@ -451,16 +451,23 @@ public:
/// Slot for setting ViewMode from Menu
void slotSetViewMode( QAction* action);
/// Show a dialog in which the viewMode can be edited
void slotViewModeDialog();
/// Show a dialog in which the viewMode can be changed
void slotViewChangeDialog();
/// Set the view Mode to the given Mode
public slots :
/// Set the view Mode to the given Mode
void setViewMode( QString _mode, bool _expandAll = false );
/// Move a specific toolbox widget to the top of the side area
void moveToolboxToTop(QString _name);
/// Move a specific toolbox widget to the bottom of the side area
void moveToolboxToBottom(QString _name);
/** @} */
......
......@@ -86,6 +86,33 @@ void SideArea::addItem (QWidget *_w, QString _name)
//-----------------------------------------------------------------------------
void SideArea::moveItemToPosition(const QString& _name, int _position) {
// Position is in valid range
if(_position < 0 || _position >= items_.size())
return;
// Search item
QVector<SideElement*>::iterator it = items_.begin();
for(; it != items_.end(); ++it) {
if((*it)->name() == _name)
break;
}
if(it != items_.end()) {
layout_->removeWidget(*it);
layout_->insertWidget(_position, (*it));
}
}
//-----------------------------------------------------------------------------
int SideArea::getNumberOfWidgets() const {
return items_.size();
}
//-----------------------------------------------------------------------------
void SideArea::clear ()
{
foreach (SideElement *e, items_)
......
......@@ -105,6 +105,12 @@ class SideArea : public QWidget {
/// set the active state of given element
void setElementActive(QString _name, bool _active);
/// Move a toolbox widget to a given position
void moveItemToPosition(const QString& _name, int _position);
/// Get number of widgets
int getNumberOfWidgets() const;
private:
// elements
......
......@@ -401,6 +401,16 @@ void CoreWidget::slotChangeView(QString _mode, QStringList _toolboxWidgets, QStr
}
void CoreWidget::moveToolboxToTop(QString _name) {
toolBox_->moveItemToPosition(_name, 0);
}
void CoreWidget::moveToolboxToBottom(QString _name) {
toolBox_->moveItemToPosition(_name, toolBox_->getNumberOfWidgets()-1);
}
void CoreWidget::stereoButtonContextMenu(const QPoint& _pos) {
// Grey out OpenGL stereo mode option if not available
......
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