Skip to content
Snippets Groups Projects
Commit 94f2ba2a authored by Provot Bertrand's avatar Provot Bertrand
Browse files

update filter choice new buttons and cleaner filter editor

parent e30b9d6e
No related branches found
No related tags found
No related merge requests found
......@@ -40,6 +40,7 @@
#include <QSpinBox>
#include <QTableView>
#include <QLineEdit>
#include <QCheckBox>
#include <QFile>
#include <QDomDocument>
......@@ -158,9 +159,22 @@ void FilterChoice::initUI()
radioBox->layout()->addWidget(_stdResButton);
radioBox->layout()->addWidget(_dblResButton);
QGroupBox* checkbox = new QGroupBox(tr("Options"));
QHBoxLayout* optLayout = new QHBoxLayout();
_offsetButton = new QCheckBox(tr("Offset"));
_scalingButton = new QCheckBox(tr("Scaling"));
_offsetButton->setChecked(true);
_scalingButton->setChecked(true);
_offsetButton->setAutoExclusive(false);
_scalingButton->setAutoExclusive(false);
optLayout->addWidget(_offsetButton);
optLayout->addWidget(_scalingButton);
checkbox->setLayout(optLayout);
leftLayout->addWidget(stdOrCustomBox);
leftLayout->addWidget(confBox);
leftLayout->addWidget(radioBox);
leftLayout->addWidget(checkbox);
mainLayout->addWidget(leftWidget);
......@@ -169,6 +183,7 @@ void FilterChoice::initUI()
QObject::connect(_number, SIGNAL(valueChanged(const QString&)), this, SLOT(dataChanged(const QString&)));
QObject::connect(_stdDevBox, SIGNAL(valueChanged(const QString&)), this, SLOT(dataChanged(const QString&)));
QObject::connect(_filterPathSelect, SIGNAL(clicked()), this, SLOT(openFile()));
QObject::connect(_stdResButton, SIGNAL(toggled(bool)), this, SLOT(updateOptions(bool)));
QWidget* rightWidget = new QWidget();
......@@ -593,3 +608,17 @@ void FilterChoice::updatePath(){
_path = _filterPath->text();
updateBlur(true);
}
void FilterChoice::updateOptions(bool a){
if(a){
_offsetButton->setChecked(true);
_scalingButton->setChecked(true);
_offsetButton->setEnabled(true);
_scalingButton->setEnabled(true);
}else{
_offsetButton->setChecked(true);
_scalingButton->setChecked(true);
_offsetButton->setEnabled(false);
_scalingButton->setEnabled(false);
}
}
......@@ -37,6 +37,7 @@
#include <Algorithm/Filtering.h>
#include <QRadioButton>
#include <QTextEdit>
#include <QCheckBox>
namespace filtrme
{
......@@ -53,6 +54,8 @@ namespace filtrme
FilterChoice(QWidget *parent);
inline imagein::algorithm::Filtering* getFiltering() { return _filtering; }
inline bool doubleResult() { return _dblResButton->isChecked(); }
inline bool scalingResult() { return _scalingButton->isChecked(); }
inline bool offsetResult() { return _offsetButton->isChecked(); }
inline void setDoubleResult(bool c) { _dblResButton->setChecked(c); _stdResButton->setChecked(!c);}
signals:
......@@ -68,6 +71,7 @@ namespace filtrme
void updateBlur(bool);
void openFile();
void updatePath();
void updateOptions(bool);
private:
bool _a = true;
......@@ -88,6 +92,8 @@ namespace filtrme
QRadioButton* _customButton;
QHBoxLayout* _pathLayout;
QString _path;
QCheckBox* _offsetButton;
QCheckBox* _scalingButton;
QLabel* _labelNumber;
QSpinBox* _number;
......
......@@ -298,10 +298,7 @@ vector<Filter*> FilterEditor::validFilters(bool* ok)
for(int i = 2; i <= 1+_nbFilters; i++)
{
FilterEditorItem* item = (FilterEditorItem*)_filterLayout->itemAt(i)->widget();
cout << "type d'item :" << _filterLayout->itemAt(i) << " \n";
Filter* f = item->validFilter();
cout << "out validFilter\n";
cout << "val de f : " << f << "\n";
if(f != NULL)
filters.push_back(f);
else
......
......@@ -40,6 +40,9 @@ using namespace std;
using namespace filtrme;
using namespace imagein::algorithm;
/**
* @brief FilterEditorItem::FilterEditorItem
*/
FilterEditorItem::FilterEditorItem()
{
_width = 3;
......@@ -47,7 +50,9 @@ FilterEditorItem::FilterEditorItem()
initUI();
}
/**
* @brief FilterEditorItem::initUI
*/
void FilterEditorItem::initUI()
{
QSpinBox *spinBoxWidth;
......@@ -94,8 +99,13 @@ void FilterEditorItem::initUI()
}
/**
* @brief FilterEditorItem::widthChanged
* @param width
*/
void FilterEditorItem::widthChanged(const int width)
{
cout << "diff de width: " << width << " | " << _width << "\n";
if(_width < width){
while(_width!=width){
emit(insertColumn(width-_width));
......@@ -128,6 +138,10 @@ void FilterEditorItem::heightChanged(const int height)
_filter->resizeRowsToContents();
}
/**
* @brief FilterEditorItem::validFilter
* @return
*/
imagein::algorithm::Filter* FilterEditorItem::validFilter()
{
Filter* filter = new Filter(_width, _height);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment