File indexing completed on 2024-04-14 03:40:33

0001 /*************************************************************************************
0002  *  Copyright (C) 2013 by Punit Mehta <punit9462@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 #ifndef DICTIONARY_COLLECTION_H
0020 #define DICTIONARY_COLLECTION_H
0021 
0022 //Analitza includes
0023 #include <analitzaplot/plotsdictionarymodel.h>
0024 
0025 //Qt includes
0026 #include <QWidget>
0027 #include <QDialog>
0028 #include <QComboBox>
0029 #include <QLabel>
0030 #include <QDockWidget>
0031 
0032 //local includes
0033 #include "dashboard.h"
0034 
0035 using namespace Analitza;
0036 
0037 namespace Ui
0038 {
0039     class DictionaryCollectionWidget;
0040 }
0041 
0042 class DictionaryCollection : public QDockWidget
0043 {
0044     Q_OBJECT
0045 
0046 public:
0047     DictionaryCollection(QWidget *parent);
0048     ~ DictionaryCollection() override;
0049 
0050     //set the appropirate dashboard widget reference
0051     void setDashboardWidget(Dashboard *dashboard);
0052 
0053     //set the current document
0054     void setDocument(DataStore *doc);
0055 
0056     //attach the in-built dictionaries provided by analitza
0057     void setDefaultDictionaries();
0058 
0059     //map the dictionary path to the dictionary names
0060     void setDictionaryDataMap();
0061 
0062     //checks whether the dictionary is available in the combobox
0063     bool conains(const QString &dictionaryname);
0064 
0065     //total number of avalialble dictionaries
0066     int totalDictionaries();
0067 
0068     //retuns the reference of the dictionary view
0069     QTreeView* dictionaryPlotsView();
0070 
0071     //returns the index of the dictionary from the combo-box
0072     int indexOf(const QString &dictionaryname);
0073 
0074 signals:
0075 
0076     //this signal is emited when the plot is added in the document
0077     void mapDataChanged();
0078 
0079 public slots:
0080 
0081     //Slot for handling push button's click-event and plots from the dictionaries
0082     void addPlotClicked();
0083     void setDictionaryData(int ind);
0084     void addPlotinSpace(const QModelIndex& ind);
0085     void setSpaceDimension(Analitza::Dimension dim);
0086 
0087 private slots:
0088 
0089     //To import dictionary from the disk
0090     void importDictionary();
0091 
0092     //Used to add random coloring in the dictionary plots
0093     QColor randomFunctionColor() { return QColor::fromHsv(qrand()%255, 255, 255); }
0094 
0095 private:
0096     Ui::DictionaryCollectionWidget *m_widget;
0097     Dashboard* m_dashboard;
0098     DataStore* m_document;
0099     Analitza::Dimension m_currentDimension;
0100     PlotsDictionaryModel* m_dictionaryModel;
0101     QMap<QString,QString> m_DictionaryPathName;
0102 };
0103 
0104 #endif