Mercurial > hg > easaier-soundaccess
changeset 101:bc5b79e7b1d8
when adding a new pane, the pane stack is divided in equals parts
author | lbajardsilogic |
---|---|
date | Thu, 12 Jul 2007 07:25:32 +0000 |
parents | 133c282edba1 |
children | 033a39bff919 |
files | sv/main/MainWindow.cpp sv/main/MainWindow.h view/PaneStack.cpp view/PaneStack.h widgets/ExpandWidget.cpp widgets/ExpandWidget.h |
diffstat | 6 files changed, 70 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/sv/main/MainWindow.cpp Wed Jul 11 16:04:19 2007 +0000 +++ b/sv/main/MainWindow.cpp Thu Jul 12 07:25:32 2007 +0000 @@ -279,9 +279,10 @@ QWidget *auxwidget = new QWidget; auxwidget->setLayout(auxlayout); - ExpandWidget *bottomExpandWidget = new ExpandWidget(); - bottomExpandWidget->setWidgetLocation(ExpandWidget::Location_Bottom); - bottomExpandWidget->setPanes(auxwidget, m_qtabwidget); + m_leftExpandWidget = new ExpandWidget(); + m_leftExpandWidget->setWidgetLocation(ExpandWidget::Location_Bottom); + m_leftExpandWidget->setPanes(auxwidget, m_qtabwidget); + m_leftExpandWidget->setPercentage( 1, 4); m_toolBox = new AdvancedToolBox(); m_toolBox->addItem("Layers", new QWidget); @@ -306,11 +307,12 @@ widgetAuxForLogo->setLayout(logoLayout); /****************************/ - ExpandWidget *mainExpandWidget = new ExpandWidget(); - mainExpandWidget->setWidgetLocation(ExpandWidget::Location_Right); - mainExpandWidget->setPanes(bottomExpandWidget, widgetAuxForLogo); + m_rightExpandWidget = new ExpandWidget(); + m_rightExpandWidget->setWidgetLocation(ExpandWidget::Location_Right); + m_rightExpandWidget->setPanes(m_leftExpandWidget, widgetAuxForLogo); + m_rightExpandWidget->setPercentage( 3, 1); - layout->addWidget(mainExpandWidget, 0, 0); + layout->addWidget(m_rightExpandWidget, 0, 0); m_paneStack->setPropertyStackMinWidth (m_fader->width() + m_playSpeed->width() + m_playSharpen->width() +
--- a/sv/main/MainWindow.h Wed Jul 11 16:04:19 2007 +0000 +++ b/sv/main/MainWindow.h Thu Jul 12 07:25:32 2007 +0000 @@ -66,6 +66,7 @@ class EasaierSessionManager; class QueryModel; class RealTimeFilterPropertyStack; +class ExpandWidget; class MainWindow : public QMainWindow { @@ -461,7 +462,10 @@ bool saveConfigFile(); static MainWindow *m_instance; - + + ExpandWidget *m_leftExpandWidget; + ExpandWidget *m_rightExpandWidget; + InfoWidget *m_infoWidget; SearchWidget *m_searchWidget; QueryResultsWidget *m_resultsWidget;
--- a/view/PaneStack.cpp Wed Jul 11 16:04:19 2007 +0000 +++ b/view/PaneStack.cpp Thu Jul 12 07:25:32 2007 +0000 @@ -86,6 +86,8 @@ frame->setLayout(layout); m_splitter->addWidget(frame); + resizePane(); + connect(pane, SIGNAL(propertyContainerAdded(PropertyContainer *)), this, SLOT(propertyContainerAdded(PropertyContainer *))); connect(pane, SIGNAL(propertyContainerRemoved(PropertyContainer *)), @@ -442,4 +444,20 @@ emit propertyStacksResized(); } +void PaneStack::resizePane() +{ + int totalSize = m_splitter->size().height(); + int nbPane = getPaneCount(); + if (nbPane == 0) + return; + + QList<int> newSizes; + + for (int i = 0; i< nbPane; i++) + { + newSizes.push_back(totalSize/nbPane); + } + + m_splitter->setSizes(newSizes); +}
--- a/view/PaneStack.h Wed Jul 11 16:04:19 2007 +0000 +++ b/view/PaneStack.h Thu Jul 12 07:25:32 2007 +0000 @@ -83,6 +83,9 @@ void rightButtonMenuRequested(QPoint); protected: + + void resizePane(); + Pane *m_currentPane; struct PaneRec
--- a/widgets/ExpandWidget.cpp Wed Jul 11 16:04:19 2007 +0000 +++ b/widgets/ExpandWidget.cpp Thu Jul 12 07:25:32 2007 +0000 @@ -90,8 +90,6 @@ void ExpandWidget::setPanes(QWidget *newCenterPane, QWidget *newOtherPane){ QList<int> sizes; - int maxsize = 0; - m_centerPane = newCenterPane; m_otherPane = newOtherPane; @@ -126,9 +124,8 @@ widgetAux->setLayout(lay); this->addWidget(widgetAux); this->addWidget(m_otherPane); - maxsize = widgetAux->height() + m_otherPane->height(); - sizes.push_back(maxsize/5); - sizes.push_back(maxsize*4/5); + sizes.push_back(widgetAux->height()); + sizes.push_back(m_otherPane->height()); this->setSizes(sizes); break; case ExpandWidget::Location_Top: @@ -147,6 +144,9 @@ widgetAux->setLayout(lay); this->addWidget(m_otherPane); this->addWidget(widgetAux); + sizes.push_back(m_otherPane->height()); + sizes.push_back(widgetAux->height()); + this->setSizes(sizes); break; case ExpandWidget::Location_Left: lay = new QHBoxLayout(); @@ -157,9 +157,8 @@ widgetAux->setLayout(lay); this->addWidget(m_otherPane); this->addWidget(widgetAux); - maxsize = widgetAux->width() + m_otherPane->width(); - sizes.push_back(maxsize/4); - sizes.push_back(maxsize*3/4); + sizes.push_back(m_otherPane->width()); + sizes.push_back(widgetAux->width()); this->setSizes(sizes); break; case ExpandWidget::Location_Right: @@ -172,9 +171,8 @@ widgetAux->setLayout(lay); this->addWidget(widgetAux); this->addWidget(m_otherPane); - maxsize = widgetAux->width() + m_otherPane->width(); - sizes.push_back(maxsize*3/4); - sizes.push_back(maxsize/4); + sizes.push_back(widgetAux->width()); + sizes.push_back(m_otherPane->width()); this->setSizes(sizes); break; } @@ -189,4 +187,28 @@ refreshButtonIcone(); } +void ExpandWidget::setPercentage(int a, int b) +{ + int percent = a + b; + + if (percent == 0) + return; + QList<int> newSizes; + int totalSize = 0; + + QList<int> sizes = this->sizes(); + QList<int>::iterator iter = sizes.begin(); + + QListIterator<int> it(this->sizes()); + while (it.hasNext()) + { + totalSize += it.next(); + } + + newSizes.push_back(totalSize*a/percent); + newSizes.push_back(totalSize*b/percent); + this->setSizes(newSizes); +} + +
--- a/widgets/ExpandWidget.h Wed Jul 11 16:04:19 2007 +0000 +++ b/widgets/ExpandWidget.h Thu Jul 12 07:25:32 2007 +0000 @@ -42,6 +42,8 @@ void setPanes(QWidget *newCenterPane, QWidget *newOtherPane); void setWidgetLocation(ExpandWidget::Location newWidgetLocation); + void setPercentage(int a, int b); + //signals: private slots: