changeset 204:c5970f7af886

remove in the preferences the possibility to have one property box per panes
author lbajardsilogic
date Wed, 30 Jan 2008 09:06:08 +0000
parents 74d1b3bda5a3
children 00cf9a7faa4d
files base/Preferences.cpp base/Preferences.h sv/main/MainWindow.cpp sv/main/MainWindow.h sv/main/PreferencesDialog.cpp sv/main/PreferencesDialog.h sv/main/main.cpp view/PaneStack.cpp view/PaneStack.h
diffstat 9 files changed, 13 insertions(+), 168 deletions(-) [+]
line wrap: on
line diff
--- a/base/Preferences.cpp	Tue Jan 29 17:21:42 2008 +0000
+++ b/base/Preferences.cpp	Wed Jan 30 09:06:08 2008 +0000
@@ -37,7 +37,6 @@
 Preferences::Preferences() :
     m_spectrogramSmoothing(SpectrogramZeroPadded),
     m_tuningFrequency(440),
-    m_propertyBoxLayout(VerticallyStacked),
     m_windowType(HanningWindow),
     m_resampleQuality(1)
 {
@@ -46,8 +45,6 @@
     m_spectrogramSmoothing = SpectrogramSmoothing
         (settings.value("spectrogram-smoothing", int(m_spectrogramSmoothing)).toInt());
     m_tuningFrequency = settings.value("tuning-frequency", 440.f).toDouble();
-    m_propertyBoxLayout = PropertyBoxLayout
-        (settings.value("property-box-layout", int(VerticallyStacked)).toInt());
     m_windowType = WindowType
         (settings.value("window-type", int(HanningWindow)).toInt());
     m_resampleQuality = settings.value("resample-quality", 1).toInt();
@@ -64,7 +61,6 @@
     PropertyList props;
     props.push_back("Spectrogram Smoothing");
     props.push_back("Tuning Frequency");
-    props.push_back("Property Box Layout");
     props.push_back("Window Type");
     props.push_back("Resample Quality");
     return props;
@@ -79,9 +75,6 @@
     if (name == "Tuning Frequency") {
         return tr("Frequency of concert A");
     }
-    if (name == "Property Box Layout") {
-        return tr("Property box layout");
-    }
     if (name == "Window Type") {
         return tr("Spectral analysis window shape");
     }
@@ -123,14 +116,7 @@
         return int(m_spectrogramSmoothing);
     }
 
-    //!!! freq mapping
-
-    if (name == "Property Box Layout") {
-        if (min) *min = 0;
-        if (max) *max = 1;
-        if (deflt) *deflt = 0;
-        return m_propertyBoxLayout == Layered ? 1 : 0;
-    }        
+    //!!! freq mapping   
 
     if (name == "Window Type") {
         if (min) *min = int(RectangularWindow);
@@ -153,10 +139,6 @@
 Preferences::getPropertyValueLabel(const PropertyName &name,
                                    int value) const
 {
-    if (name == "Property Box Layout") {
-        if (value == 0) return tr("Show boxes for all panes");
-        else return tr("Show box for current pane only");
-    }
     if (name == "Window Type") {
         switch (WindowType(value)) {
         case RectangularWindow: return tr("Rectangular");
@@ -207,8 +189,6 @@
         setSpectrogramSmoothing(SpectrogramSmoothing(value));
     } else if (name == "Tuning Frequency") {
         //!!!
-    } else if (name == "Property Box Layout") {
-        setPropertyBoxLayout(value == 0 ? VerticallyStacked : Layered);
     } else if (name == "Window Type") {
         setWindowType(WindowType(value));
     } else if (name == "Resample Quality") {
@@ -247,19 +227,6 @@
 }
 
 void
-Preferences::setPropertyBoxLayout(PropertyBoxLayout layout)
-{
-    if (m_propertyBoxLayout != layout) {
-        m_propertyBoxLayout = layout;
-        QSettings settings;
-        settings.beginGroup("Preferences");
-        settings.setValue("property-box-layout", int(layout));
-        settings.endGroup();
-        emit propertyChanged("Property Box Layout");
-    }
-}
-
-void
 Preferences::setWindowType(WindowType type)
 {
     if (m_windowType != type) {
--- a/base/Preferences.h	Tue Jan 29 17:21:42 2008 +0000
+++ b/base/Preferences.h	Wed Jan 30 09:06:08 2008 +0000
@@ -47,19 +47,11 @@
     WindowType getWindowType() const { return m_windowType; }
     int getResampleQuality() const { return m_resampleQuality; }
 
-    //!!! harmonise with PaneStack
-    enum PropertyBoxLayout {
-        VerticallyStacked,
-        Layered
-    };
-    PropertyBoxLayout getPropertyBoxLayout() const { return m_propertyBoxLayout; }
-
 public slots:
     virtual void setProperty(const PropertyName &, int);
 
     void setSpectrogramSmoothing(SpectrogramSmoothing smoothing);
     void setTuningFrequency(float freq);
-    void setPropertyBoxLayout(PropertyBoxLayout layout);
     void setWindowType(WindowType type);
     void setResampleQuality(int quality);
 
@@ -71,7 +63,6 @@
 
     SpectrogramSmoothing m_spectrogramSmoothing;
     float m_tuningFrequency;
-    PropertyBoxLayout m_propertyBoxLayout;
     WindowType m_windowType;
     int m_resampleQuality;
 };
--- a/sv/main/MainWindow.cpp	Tue Jan 29 17:21:42 2008 +0000
+++ b/sv/main/MainWindow.cpp	Wed Jan 30 09:06:08 2008 +0000
@@ -369,12 +369,10 @@
     connect(m_viewManager, SIGNAL(viewZoomLevelChanged(View *, unsigned long, bool)),
             this, SLOT(viewZoomLevelChanged(View *, unsigned long, bool)));
 
-    connect(Preferences::getInstance(),
+    /*connect(Preferences::getInstance(),
             SIGNAL(propertyChanged(PropertyContainer::PropertyName)),
             this,
-            SLOT(preferenceChanged(PropertyContainer::PropertyName)));
-
-//    preferenceChanged("Property Box Layout");
+            SLOT(preferenceChanged(PropertyContainer::PropertyName)));*/
 
     if (m_oscQueue && m_oscQueue->isOK()) {
         connect(m_oscQueue, SIGNAL(messagesAvailable()), this, SLOT(pollOSC()));
@@ -967,13 +965,13 @@
     action->setChecked(m_viewManager->getZoomWheelsEnabled());
     menu->addAction(action);
         
-    action = new QAction(tr("Show Property Bo&xes"), this);
+    /*action = new QAction(tr("Show Property Bo&xes"), this);
     action->setShortcut(tr("X"));
     action->setStatusTip(tr("Show the layer property boxes at the side of the main window"));
     connect(action, SIGNAL(triggered()), this, SLOT(togglePropertyBoxes()));
     action->setCheckable(true);
     action->setChecked(true);
-    menu->addAction(action);
+    menu->addAction(action);*/
 
     action = new QAction(tr("Show Status &Bar"), this);
     action->setStatusTip(tr("Show context help information in the status bar at the bottom of the window"));
@@ -3509,21 +3507,6 @@
 }
 
 void
-MainWindow::togglePropertyBoxes()
-{
-    if (m_paneStack->getLayoutStyle() == PaneStack::NoPropertyStacks) {
-        if (Preferences::getInstance()->getPropertyBoxLayout() ==
-            Preferences::VerticallyStacked) {
-            m_paneStack->setLayoutStyle(PaneStack::PropertyStackPerPaneLayout);
-        } else {
-            m_paneStack->setLayoutStyle(PaneStack::SinglePropertyStackLayout);
-        }
-    } else {
-        m_paneStack->setLayoutStyle(PaneStack::NoPropertyStacks);
-    }
-}
-
-void
 MainWindow::toggleStatusBar()
 {
     QSettings settings;
@@ -3541,20 +3524,11 @@
     settings.endGroup();
 }
 
-void
+/*void
 MainWindow::preferenceChanged(PropertyContainer::PropertyName name)
 {
-    if (name == "Property Box Layout") {
-        if (m_paneStack->getLayoutStyle() != PaneStack::NoPropertyStacks) {
-            if (Preferences::getInstance()->getPropertyBoxLayout() ==
-                Preferences::VerticallyStacked) {
-                m_paneStack->setLayoutStyle(PaneStack::PropertyStackPerPaneLayout);
-            } else {
-                m_paneStack->setLayoutStyle(PaneStack::SinglePropertyStackLayout);
-            }
-        }
-    }
-}
+    
+}*/
 
 void
 MainWindow::play()
@@ -4670,11 +4644,7 @@
                 }                    
             } else if (property == "zoomwheels") {
                 m_viewManager->setZoomWheelsEnabled(value > 0.5);
-            } else if (property == "propertyboxes") {
-                bool toggle = ((value < 0.5) !=
-                               (m_paneStack->getLayoutStyle() == PaneStack::NoPropertyStacks));
-                if (toggle) togglePropertyBoxes();
-            }
+            } 
                 
         } else {
             PropertyContainer *container = 0;
--- a/sv/main/MainWindow.h	Tue Jan 29 17:21:42 2008 +0000
+++ b/sv/main/MainWindow.h	Wed Jan 30 09:06:08 2008 +0000
@@ -163,7 +163,7 @@
 	void newCurrentPane(Pane *pane);
 
 public slots:
-    void preferenceChanged(PropertyContainer::PropertyName);
+    //void preferenceChanged(PropertyContainer::PropertyName);
 
 protected slots:
     void openSession();
@@ -200,7 +200,6 @@
     void showAllOverlays();
 
     void toggleZoomWheels();
-    void togglePropertyBoxes();
     void toggleStatusBar();
 
     void play();
--- a/sv/main/PreferencesDialog.cpp	Tue Jan 29 17:21:42 2008 +0000
+++ b/sv/main/PreferencesDialog.cpp	Wed Jan 30 09:06:08 2008 +0000
@@ -73,20 +73,6 @@
     connect(smoothing, SIGNAL(currentIndexChanged(int)),
             this, SLOT(spectrogramSmoothingChanged(int)));
 
-    QComboBox *propertyLayout = new QComboBox;
-    int pl = prefs->getPropertyRangeAndValue("Property Box Layout", &min, &max,
-                                         &deflt);
-    m_propertyLayout = pl;
-
-    for (i = min; i <= max; ++i) {
-        propertyLayout->addItem(prefs->getPropertyValueLabel("Property Box Layout", i));
-    }
-
-    propertyLayout->setCurrentIndex(pl);
-
-    connect(propertyLayout, SIGNAL(currentIndexChanged(int)),
-            this, SLOT(propertyLayoutChanged(int)));
-
     m_tuningFrequency = prefs->getTuningFrequency();
 
     QDoubleSpinBox *frequency = new QDoubleSpinBox;
@@ -118,11 +104,6 @@
     int row = 0;
 
     subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel
-                                                ("Property Box Layout"))),
-                       row, 0);
-    subgrid->addWidget(propertyLayout, row++, 1, 1, 2);
-
-    subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel
                                                 ("Tuning Frequency"))),
                        row, 0);
     subgrid->addWidget(frequency, row++, 1, 1, 2);
@@ -180,13 +161,6 @@
 }
 
 void
-PreferencesDialog::propertyLayoutChanged(int layout)
-{
-    m_propertyLayout = layout;
-    m_applyButton->setEnabled(true);
-}
-
-void
 PreferencesDialog::tuningFrequencyChanged(double freq)
 {
     m_tuningFrequency = freq;
@@ -214,8 +188,6 @@
     prefs->setWindowType(WindowType(m_windowType));
     prefs->setSpectrogramSmoothing(Preferences::SpectrogramSmoothing
                                    (m_spectrogramSmoothing));
-    prefs->setPropertyBoxLayout(Preferences::PropertyBoxLayout
-                                (m_propertyLayout));
     prefs->setTuningFrequency(m_tuningFrequency);
     prefs->setResampleQuality(m_resampleQuality);
     m_applyButton->setEnabled(false);
--- a/sv/main/PreferencesDialog.h	Tue Jan 29 17:21:42 2008 +0000
+++ b/sv/main/PreferencesDialog.h	Wed Jan 30 09:06:08 2008 +0000
@@ -34,7 +34,6 @@
 protected slots:
     void windowTypeChanged(WindowType type);
     void spectrogramSmoothingChanged(int state);
-    void propertyLayoutChanged(int layout);
     void tuningFrequencyChanged(double freq);
     void resampleQualityChanged(int quality);
 
@@ -48,7 +47,6 @@
     
     WindowType m_windowType;
     int   m_spectrogramSmoothing;
-    int   m_propertyLayout;
     float m_tuningFrequency;
     int   m_resampleQuality;
 };
--- a/sv/main/main.cpp	Tue Jan 29 17:21:42 2008 +0000
+++ b/sv/main/main.cpp	Wed Jan 30 09:06:08 2008 +0000
@@ -296,11 +296,6 @@
 	splash->finish(&gui);
 	delete splash;
 
-    // The MainWindow class seems to have trouble dealing with this if
-    // it tries to adapt to this preference before the constructor is
-    // complete.  As a lazy hack, apply it explicitly from here
-    gui.preferenceChanged("Property Box Layout");
-
     bool haveSession = false;
     bool haveMainModel = false;
 
--- a/view/PaneStack.cpp	Tue Jan 29 17:21:42 2008 +0000
+++ b/view/PaneStack.cpp	Wed Jan 30 09:06:08 2008 +0000
@@ -39,8 +39,7 @@
     m_currentPane(0),
     m_splitter(new QSplitter),
     m_propertyStackStack(new QStackedWidget),
-    m_viewManager(viewManager),
-    m_layoutStyle(PropertyStackPerPaneLayout)
+    m_viewManager(viewManager)
 {
     QHBoxLayout *layout = new QHBoxLayout;
     layout->setMargin(0);
@@ -119,40 +118,6 @@
     m_propertyStackMinWidth = mw;
 }
 
-void
-PaneStack::setLayoutStyle(LayoutStyle style)
-{
-    if (style == m_layoutStyle) return;
-    m_layoutStyle = style;
-
-    std::vector<PaneRec>::iterator i;
-
-    switch (style) {
-
-    case NoPropertyStacks:
-    case SinglePropertyStackLayout:
-        
-        for (i = m_panes.begin(); i != m_panes.end(); ++i) {
-            i->layout->removeWidget(i->propertyStack);
-            i->propertyStack->setParent(m_propertyStackStack);
-            m_propertyStackStack->addWidget(i->propertyStack);
-        }
-        m_propertyStackStack->setVisible(style != NoPropertyStacks);
-        break;
-
-    case PropertyStackPerPaneLayout:
-
-        for (i = m_panes.begin(); i != m_panes.end(); ++i) {
-            m_propertyStackStack->removeWidget(i->propertyStack);
-            i->propertyStack->setParent(i->frame);
-            i->layout->addWidget(i->propertyStack);
-            i->propertyStack->show();
-        }
-        m_propertyStackStack->hide();
-        break;
-    }
-}
-
 Pane *
 PaneStack::getPane(int n)
 {
@@ -293,10 +258,8 @@
     while (i != m_panes.end()) {
 	if (i->pane == pane) {
 	    i->currentIndicator->setPixmap(selectedMap);
-            if (m_layoutStyle != PropertyStackPerPaneLayout) {
-                m_propertyStackStack->setCurrentWidget(i->propertyStack);
-            }
-	    found = true;
+        m_propertyStackStack->setCurrentWidget(i->propertyStack);
+        found = true;
 
 		QFrame* frame = (QFrame*) (i->pane->parentWidget());
 		if(frame!=0){
--- a/view/PaneStack.h	Tue Jan 29 17:21:42 2008 +0000
+++ b/view/PaneStack.h	Wed Jan 30 09:06:08 2008 +0000
@@ -54,15 +54,6 @@
     void setCurrentLayer(Pane *pane, Layer *layer);
     Pane *getCurrentPane();
 
-    enum LayoutStyle {
-        NoPropertyStacks = 0,
-        SinglePropertyStackLayout = 1,
-        PropertyStackPerPaneLayout = 2
-    };
-
-    LayoutStyle getLayoutStyle() const { return m_layoutStyle; }
-    void setLayoutStyle(LayoutStyle style);
-
     void setPropertyStackMinWidth(int mw);
 
 signals:
@@ -107,7 +98,6 @@
     int m_propertyStackMinWidth;
     void sizePropertyStacks();
 
-    LayoutStyle m_layoutStyle;
 };
 
 #endif