Changeset - 42deb804719e
[Not reviewed]
plot-manager
0 4 0
Hasan Yavuz Ă–ZDERYA - 9 years ago 2016-08-25 01:23:49
hy@ozderya.net
added multi plot checkbox to plot panel
4 files changed with 23 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/mainwindow.cpp
Show inline comments
 
@@ -123,12 +123,15 @@ MainWindow::MainWindow(QWidget *parent) 
 
    connect(&plotControlPanel, &PlotControlPanel::numOfSamplesChanged,
 
            this, &MainWindow::onNumOfSamplesChanged);
 

	
 
    connect(&plotControlPanel, &PlotControlPanel::scaleChanged,
 
            ui->plot, &Plot::setAxis);
 

	
 
    connect(&plotControlPanel, &PlotControlPanel::multiPlotChanged,
 
            plotMan, &PlotManager::setMulti);
 

	
 
    QObject::connect(ui->actionClear, SIGNAL(triggered(bool)),
 
                     this, SLOT(clearPlot()));
 

	
 
    QObject::connect(snapshotMan.takeSnapshotAction(), &QAction::triggered,
 
                     ui->plot, &Plot::flashSnapshotOverlay);
 

	
src/plotcontrolpanel.cpp
Show inline comments
 
@@ -57,12 +57,15 @@ PlotControlPanel::PlotControlPanel(QWidg
 
    connect(ui->spYmax, SIGNAL(valueChanged(double)),
 
            this, SLOT(onYScaleChanged()));
 

	
 
    connect(ui->spYmin, SIGNAL(valueChanged(double)),
 
            this, SLOT(onYScaleChanged()));
 

	
 
    connect(ui->cbMultiPlot, &QCheckBox::toggled,
 
            this, &PlotControlPanel::multiPlotChanged);
 

	
 
    // init scale range preset list
 
    for (int nbits = 8; nbits <= 24; nbits++) // signed binary formats
 
    {
 
        int rmax = pow(2, nbits-1)-1;
 
        int rmin = -rmax-1;
 
        Range r = {double(rmin),  double(rmax)};
 
@@ -149,6 +152,11 @@ void PlotControlPanel::onRangeSelected()
 
}
 

	
 
void PlotControlPanel::setChannelNamesModel(QAbstractItemModel * model)
 
{
 
    ui->lvChannelNames->setModel(model);
 
}
 

	
 
bool PlotControlPanel::multiPlot()
 
{
 
    return ui->cbMultiPlot->isChecked();
 
}
src/plotcontrolpanel.h
Show inline comments
 
@@ -36,18 +36,20 @@ public:
 
    ~PlotControlPanel();
 

	
 
    unsigned numOfSamples();
 
    bool autoScale();
 
    double yMax();
 
    double yMin();
 
    bool multiPlot(); ///< returns true if multi plot is selected
 

	
 
    void setChannelNamesModel(QAbstractItemModel * model);
 

	
 
signals:
 
    void numOfSamplesChanged(int value);
 
    void scaleChanged(bool autoScaled, double yMin = 0, double yMax = 1);
 
    void multiPlotChanged(bool enabled);
 

	
 
private:
 
    Ui::PlotControlPanel *ui;
 

	
 
private slots:
 
    void onAutoScaleChecked(bool checked);
src/plotcontrolpanel.ui
Show inline comments
 
@@ -154,12 +154,22 @@
 
      <widget class="QLabel" name="label">
 
       <property name="text">
 
        <string>Select Range Preset:</string>
 
       </property>
 
      </widget>
 
     </item>
 
     <item row="5" column="0">
 
      <widget class="QCheckBox" name="cbMultiPlot">
 
       <property name="toolTip">
 
        <string>Plot all channels separately</string>
 
       </property>
 
       <property name="text">
 
        <string>Multi Plot</string>
 
       </property>
 
      </widget>
 
     </item>
 
    </layout>
 
   </item>
 
  </layout>
 
 </widget>
 
 <resources/>
 
 <connections/>
0 comments (0 inline, 0 general)