File indexing completed on 2024-04-21 14:43:51

0001 /*************************************************************************************
0002  *  Copyright (C) 2010-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 #ifndef GPLACS_DASHBOARD_H
0020 #define GPLACS_DASHBOARD_H
0021 
0022 //Analitza includes
0023 #include <analitzaplot/plotsdictionarymodel.h>
0024 #include <analitzaplot/plottingenums.h>
0025 
0026 //Qt includes
0027 #include <QWidget>
0028 #include <QListView>
0029 #include <QSortFilterProxyModel>
0030 #include <QStackedWidget>
0031 #include <QModelIndex>
0032 #include <QMap>
0033 
0034 //local includes
0035 #include "plotseditor.h"
0036 
0037 class DictionariesViewer;
0038 class KWidgetItemDelegate;
0039 class SpacesDelegate;
0040 class SpacesFilterProxyModel;
0041 class QTreeView;
0042 
0043 namespace Ui
0044 {
0045     class DashboardWidget;
0046 }
0047 namespace Analitza
0048 {
0049     class PlotsView3DES;
0050     class PlotsView2D;
0051     class PlotsDictionaryModel;
0052 }
0053 
0054 
0055 // Dashboard is a main widget for the user. It allows user to save his work on the same UI.
0056 // User can add/remove spaces in khipu using the tools provided by Dashboard class.
0057 class Dashboard : public QStackedWidget
0058 {
0059     Q_OBJECT
0060 
0061 public:
0062 
0063     explicit Dashboard(QWidget *parent = nullptr);
0064     ~Dashboard() override;
0065 
0066     void setDocument(DataStore *doc);
0067     QMap<QString,QString> dictionaryDataMap() const { return  m_DictionaryPathName; }
0068 
0069     //views
0070     Analitza::PlotsView2D *view2d();
0071     Analitza::PlotsView3DES *view3d();
0072     bool m_openclicked;
0073 
0074 public slots:
0075     
0076     //Slots to control the filter feature
0077     void filterByText(const QString &text); // any text on the title or description
0078     void filterByDimension(Analitza::Dimensions dim);
0079     
0080     //shows the dashboard
0081     void goHome();
0082 
0083     //shows dictionary view
0084     void showDictionary();
0085 
0086     //shows appropriate plotsview
0087     void showPlotsView2D();
0088     void showPlotsView3D();
0089 
0090     void exportSpaceSnapshot(Analitza::Dimension dim);
0091     void copySpace2DSnapshotToClipboard();
0092     void copySpace3DSnapshotToClipboard();
0093     void setGridColor(const QColor &color);
0094     void setGridStyle(int i);
0095     void setPlotsViewGridColor(const QColor& color);
0096 
0097     void setCurrentSpace(const QModelIndex &index);
0098 
0099     void importDictionaryClicked();
0100     void getDictionaryClicked();
0101     void activateDictionaryData();
0102     QPixmap thumbnail(Analitza::Dimension dim) const;
0103 
0104 private slots:
0105     void setDictionaryData(int ind);
0106     void setCurrentSpace(const QModelIndex &index, const QModelIndex &old);
0107     void setCurrentSpace(const QModelIndex& index, int row);
0108 
0109     void setCurrentPlot(const QModelIndex& parent, int start);
0110     void setModelIndex(const QModelIndex & ind);
0111 
0112 signals:
0113     void spaceActivated(int spaceidx);
0114     void plotRequested(const QModelIndex &ind); //  for requesting the plots when double-clicked on the plot-space thumbnail.
0115     void showFilter(bool b);
0116     void setDialogSettingsVisible(bool b);
0117     void restoreDictionaryData(Analitza::Dimension dim);
0118 
0119 private:
0120     void initializeDictionaryNames();
0121     void setPlotsView(Analitza::Dimension dim);
0122     void initializePlotsViews();
0123 
0124     DataStore * m_document;
0125     QScopedPointer<Ui::DashboardWidget> m_ui;
0126     QModelIndexList m_spaceindexList;
0127     SpacesFilterProxyModel *m_spacesProxyModel;
0128     QStringList m_filterText;
0129     Analitza::PlotsDictionaryModel* m_plotdictionarymodel;
0130     bool m_isDictionaryFound;
0131     QMap<QString,QString> m_DictionaryPathName;
0132     SpacesDelegate *m_delegate;
0133 };
0134 
0135 #endif