Skip to content
This repository has been archived by the owner on Oct 7, 2023. It is now read-only.

Commit

Permalink
Added controls to main window for user defined transfer functions
Browse files Browse the repository at this point in the history
  • Loading branch information
ra3xdh committed May 13, 2014
1 parent 8bc830b commit 8f66ceb
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
2 changes: 1 addition & 1 deletion filter.h
Expand Up @@ -30,7 +30,7 @@ class Filter

public:
enum FType {HighPass, LowPass, BandPass, BandStop, NoFilter};
enum FilterFunc {Butterworth, Chebyshev, Cauer, Bessel, InvChebyshev, NoFunc};
enum FilterFunc {Butterworth, Chebyshev, Cauer, Bessel, InvChebyshev, NoFunc, User};

private:
void besselCoefficients();
Expand Down
32 changes: 31 additions & 1 deletion filtersintez.cpp
Expand Up @@ -46,10 +46,15 @@ FilterSintez::FilterSintez(QWidget *parent)
lst2<<tr("Фильтр Баттерворта")
<<tr("Фильтр Чебышева")
<<tr("Инверсный фильтр Чебышева")
<<tr("Эллиптический фильтр");
<<tr("Эллиптический фильтр")
<<tr("User defined");
cbxFilterFunc->addItems(lst2);
connect(cbxFilterFunc,SIGNAL(currentIndexChanged(int)),this,SLOT(slotSwitchParameters()));

btnDefineTransferFunc = new QPushButton(tr("Manually define transfer function"));
btnDefineTransferFunc->setEnabled(false);
connect(btnDefineTransferFunc,SIGNAL(clicked()),this,SLOT(slotDefineTransferFunc()));

btnCalcSchematic = new QPushButton(tr("Рассчитать элементы схемы фильтра"));
connect(btnCalcSchematic,SIGNAL(clicked()),SLOT(slotCalcSchematic()));

Expand Down Expand Up @@ -121,6 +126,8 @@ FilterSintez::FilterSintez(QWidget *parent)
l3->addWidget(cbxFilterFunc);
left->addLayout(l3);

left->addWidget(btnDefineTransferFunc);

QHBoxLayout *l1 = new QHBoxLayout;
l1->addWidget(lblResp);
l1->addWidget(cbxResponse);
Expand Down Expand Up @@ -183,6 +190,8 @@ void FilterSintez::slotCalcSchematic()
break;
case 3 : ffunc = Filter::Cauer;
break;
case 4 : ffunc = Filter::User;
break;
default: ffunc = Filter::NoFunc;
break;
}
Expand Down Expand Up @@ -341,6 +350,27 @@ void FilterSintez::slotSwitchParameters()
} else {
cbxFilterType->setDisabled(false);
}

if ((cbxFilterFunc->currentIndex()==4)) {
btnDefineTransferFunc->setEnabled(true);
edtF2->setEnabled(false);
edtPassbRpl->setEnabled(false);
edtA1->setEnabled(false);
edtA2->setEnabled(false);
edtKv->setEnabled(false);
} else {
btnDefineTransferFunc->setEnabled(false);
edtF2->setEnabled(true);
edtPassbRpl->setEnabled(true);
edtA1->setEnabled(true);
edtA2->setEnabled(true);
edtKv->setEnabled(true);
}
}

void FilterSintez::slotDefineTransferFunc()
{

}

void FilterSintez::errorMessage(QString str)
Expand Down
2 changes: 2 additions & 0 deletions filtersintez.h
Expand Up @@ -33,6 +33,7 @@ class FilterSintez : public QMainWindow

QComboBox *cbxFilterFunc;
QPushButton *btnCalcSchematic;
QPushButton *btnDefineTransferFunc;

QLabel *lblResult;
QTextEdit *txtResult;
Expand Down Expand Up @@ -79,6 +80,7 @@ private slots:
void slotUpdateResponse();
void slotCalcSchematic();
void slotSwitchParameters();
void slotDefineTransferFunc();

public:
FilterSintez(QWidget *parent = 0);
Expand Down

0 comments on commit 8f66ceb

Please sign in to comment.