File indexing completed on 2024-03-24 15:14:45

0001 /*************************************************************************************
0002  *  Copyright (C) 2012 by Percy Camilo T. Aucahuasi <percy.camilo.ta@gmail.com>      *
0003  *                                                                                   *
0004  *  This program is free software; you can redistribute it and/or                    *
0005  *  modify it under the terms of the GNU General Public License                      *
0006  *  as published by the Free Software Foundation; either version 2                   *
0007  *  of the License, or (at your option) any later version.                           *
0008  *                                                                                   *
0009  *  This program is distributed in the hope that it will be useful,                  *
0010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of                   *
0011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                    *
0012  *  GNU General Public License for more details.                                     *
0013  *                                                                                   *
0014  *  You should have received a copy of the GNU General Public License                *
0015  *  along with this program; if not, write to the Free Software                      *
0016  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA   *
0017  *************************************************************************************/
0018 
0019 #include "filter.h"
0020 #include "ui_filter.h"
0021 
0022 Filter::Filter(QWidget* parent)
0023     : QWidget(parent)
0024     , m_ui(new Ui::FilterWidget)
0025     , m_dashboard(nullptr)
0026 {
0027     m_ui->setupUi(this);
0028 
0029     m_ui->filterOptions->addItem(QIcon::fromTheme("all-space-filter"), i18n("Dimension All"));
0030     m_ui->filterOptions->addItem(QIcon::fromTheme("2d-space-filter"), i18n("Dimension 2D"));
0031     m_ui->filterOptions->addItem(QIcon::fromTheme("3d-space-filter"), i18n("Dimension 3D"));
0032 
0033     connect(m_ui->filterText, SIGNAL(textChanged(QString)), SIGNAL(filterByText(QString)));
0034     connect(m_ui->filterOptions, SIGNAL(currentIndexChanged(int)), SLOT(getDimIndex(int)));
0035 }
0036 
0037 Filter::~Filter()
0038 {
0039 }
0040 
0041 void Filter::getDimIndex(int index)
0042 {
0043     switch (index)
0044     {
0045         case 0: m_dashboard->filterByDimension(Analitza::DimAll); break;
0046         case 1: m_dashboard->filterByDimension(Analitza::Dim2D); break;
0047         case 2: m_dashboard->filterByDimension(Analitza::Dim3D); break;
0048     }
0049 }
0050 
0051 void Filter::setFilterDashboard(Dashboard *sourceDashboard)
0052 {
0053     m_dashboard = sourceDashboard;
0054 }
0055 
0056 void Filter::setFilterVisible(bool b)
0057 {
0058     m_ui->filterText->setVisible(b);
0059     m_ui->filterOptions->setVisible(b);
0060 }
0061 
0062 #include "moc_filter.cpp"