@@ -28,6 +28,7 @@ MainWindow::MainWindow(QWidget *parent) :
2828 Blackman_on = NULL ;
2929 Bartlett_on = NULL ;
3030 Chebyshev_on = NULL ;
31+ Flattop_on = NULL ;
3132 Kaiser_on = NULL ;
3233
3334 graph_counter = 0 ;
@@ -44,6 +45,7 @@ MainWindow::MainWindow(QWidget *parent) :
4445 connect (ui->Blackman , SIGNAL (released ()), this , SLOT (EChanged ()));
4546 connect (ui->Bartlett , SIGNAL (released ()), this , SLOT (FHChanged ()));
4647 connect (ui->Chebyshev , SIGNAL (released ()), this , SLOT (GChanged ()));
48+ connect (ui->Flattop , SIGNAL (released ()), this , SLOT (FTChanged ()));
4749 connect (ui->Kaiser , SIGNAL (released ()), this , SLOT (CBChanged ()));
4850
4951 connect (ui->customPlot , SIGNAL (mousePress (QMouseEvent*)),
@@ -57,7 +59,7 @@ MainWindow::MainWindow(QWidget *parent) :
5759void MainWindow::BChanged () {
5860 if (Hanning_on==NULL ) {
5961 shape = " Hanning" ;
60- LPF.change_filter (spuce::Hamming );
62+ LPF.change_filter (spuce::Hanning );
6163 Hanning_on = ui->customPlot ->addGraph ();
6264 plot2 (ui->customPlot );
6365 } else {
@@ -114,6 +116,18 @@ void MainWindow::GChanged() {
114116 ui->customPlot ->replot ();
115117 }
116118}
119+ void MainWindow::FTChanged () {
120+ if (Flattop_on==NULL ) {
121+ shape = " Flattop" ;
122+ LPF.change_filter (spuce::Flattop);
123+ Flattop_on = ui->customPlot ->addGraph ();
124+ plot2 (ui->customPlot );
125+ } else {
126+ ui->customPlot ->removeGraph (Flattop_on);
127+ Flattop_on = NULL ;
128+ ui->customPlot ->replot ();
129+ }
130+ }
117131void MainWindow::CBChanged () {
118132 if (Kaiser_on==NULL ) {
119133 shape = " Kaiser" ;
@@ -133,6 +147,7 @@ QCPGraph* MainWindow::GetPtr() {
133147 else if (shape==" Hanning" ) return (Hanning_on);
134148 else if (shape==" Blackman" ) return (Blackman_on);
135149 else if (shape==" Chebyshev" ) return (Chebyshev_on);
150+ else if (shape==" Flattop" ) return (Flattop_on);
136151 else if (shape==" Kaiser" ) return (Kaiser_on);
137152 else std::cout << " Invalid filter selection " << shape << " \n " ;
138153 return (Hanning_on);
0 commit comments