File indexing completed on 2024-04-28 17:02:19
0001 /* 0002 This file is part of Massif Visualizer 0003 0004 Copyright 2014 Milian Wolff <mail@milianw.de> 0005 0006 This program is free software; you can redistribute it and/or 0007 modify it under the terms of the GNU General Public License as 0008 published by the Free Software Foundation; either version 2 of 0009 the License or (at your option) version 3 or any later version 0010 accepted by the membership of KDE e.V. (or its successor approved 0011 by the membership of KDE e.V.), which shall act as a proxy 0012 defined in Section 14 of version 3 of the license. 0013 0014 This program is distributed in the hope that it will be useful, 0015 but WITHOUT ANY WARRANTY; without even the implied warranty of 0016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0017 GNU General Public License for more details. 0018 0019 You should have received a copy of the GNU General Public License 0020 along with this program. If not, see <http://www.gnu.org/licenses/>. 0021 */ 0022 0023 #ifndef CHARTTAB_H 0024 #define CHARTTAB_H 0025 0026 #include "documenttabinterface.h" 0027 #include <QSpinBox> 0028 #include <QPrinter> 0029 0030 class QAction; 0031 class QLabel; 0032 class QModelIndex; 0033 0034 namespace KChart { 0035 class Chart; 0036 class HeaderFooter; 0037 class Plotter; 0038 class CartesianAxis; 0039 class Legend; 0040 class BarDiagram; 0041 } 0042 0043 namespace Massif { 0044 class FileData; 0045 class TotalCostModel; 0046 class DetailedCostModel; 0047 class DataTreeModel; 0048 class FilteredDataTreeModel; 0049 } 0050 0051 class ChartTab : public DocumentTabInterface 0052 { 0053 Q_OBJECT 0054 0055 public: 0056 ChartTab(const Massif::FileData* data, 0057 KXMLGUIClient* guiParent, QWidget* parent = 0); 0058 ~ChartTab(); 0059 0060 virtual void settingsChanged(); 0061 0062 virtual void selectModelItem(const Massif::ModelItem& item); 0063 0064 private: 0065 void setupGui(); 0066 void setupActions(); 0067 void updateHeader(); 0068 void updatePeaks(); 0069 void updateLegendPosition(); 0070 void updateLegendFont(); 0071 void updateDetailedPeaks(); 0072 0073 void printFile(QPrinter *printer); 0074 0075 private Q_SLOTS: 0076 void setDetailedDiagramHidden(bool hidden); 0077 void setDetailedDiagramVisible(bool visible); 0078 0079 void setTotalDiagramHidden(bool hidden); 0080 void setTotalDiagramVisible(bool visible); 0081 0082 void saveCurrentDocument(); 0083 void showPrintPreviewDialog(); 0084 0085 void showDetailedGraph(bool show); 0086 void showTotalGraph(bool show); 0087 0088 void setStackNum(int num); 0089 0090 void chartContextMenuRequested(const QPoint &pos); 0091 0092 void slotHideFunction(); 0093 void slotHideOtherFunctions(); 0094 0095 void detailedItemClicked(const QModelIndex& item); 0096 void totalItemClicked(const QModelIndex& item); 0097 0098 private: 0099 KChart::Chart* m_chart; 0100 QLabel* m_header; 0101 KChart::Plotter* m_totalDiagram; 0102 Massif::TotalCostModel* m_totalCostModel; 0103 0104 KChart::Plotter* m_detailedDiagram; 0105 Massif::DetailedCostModel* m_detailedCostModel; 0106 0107 KChart::Legend* m_legend; 0108 0109 QAction* m_print; 0110 QAction* m_saveAs; 0111 0112 QAction* m_toggleTotal; 0113 QAction* m_toggleDetailed; 0114 0115 QAction* m_hideFunction; 0116 QAction* m_hideOtherFunctions; 0117 0118 QSpinBox* m_box; 0119 0120 bool m_settingSelection; 0121 }; 0122 0123 #endif // CHARTTAB_H