File indexing completed on 2024-04-28 17:02:20
0001 /* 0002 This file is part of Massif Visualizer 0003 0004 Copyright 2010 Milian Wolff <mail@milianw.de> 0005 Copyright 2013 Arnold Dumas <contact@arnolddumas.fr> 0006 0007 This program is free software; you can redistribute it and/or 0008 modify it under the terms of the GNU General Public License as 0009 published by the Free Software Foundation; either version 2 of 0010 the License or (at your option) version 3 or any later version 0011 accepted by the membership of KDE e.V. (or its successor approved 0012 by the membership of KDE e.V.), which shall act as a proxy 0013 defined in Section 14 of version 3 of the license. 0014 0015 This program is distributed in the hope that it will be useful, 0016 but WITHOUT ANY WARRANTY; without even the implied warranty of 0017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0018 GNU General Public License for more details. 0019 0020 You should have received a copy of the GNU General Public License 0021 along with this program. If not, see <http://www.gnu.org/licenses/>. 0022 */ 0023 0024 #ifndef MASSIF_MAINWINDOW_H 0025 #define MASSIF_MAINWINDOW_H 0026 0027 #include <KParts/MainWindow> 0028 0029 #include <QPrintPreviewDialog> 0030 0031 #include "ui_mainwindow.h" 0032 #include "documentwidget.h" 0033 0034 class QAction; 0035 class QSpinBox; 0036 class QStringListModel; 0037 0038 namespace KChart { 0039 class Chart; 0040 class HeaderFooter; 0041 class Plotter; 0042 class CartesianAxis; 0043 class Legend; 0044 class BarDiagram; 0045 } 0046 0047 class KRecentFilesAction; 0048 0049 #ifdef HAVE_KGRAPHVIEWER 0050 namespace KGraphViewer { 0051 class KGraphViewerInterface; 0052 } 0053 #endif 0054 0055 namespace Massif { 0056 0057 class FilteredDataTreeModel; 0058 class DataTreeModel; 0059 class SnapshotItem; 0060 class TreeLeafItem; 0061 0062 class MainWindow : public KParts::MainWindow 0063 { 0064 Q_OBJECT 0065 0066 public: 0067 MainWindow(QWidget* parent = 0, Qt::WindowFlags f = 0); 0068 virtual ~MainWindow(); 0069 0070 void setupActions(); 0071 0072 public Q_SLOTS: 0073 /** 0074 * Open a dialog to pick a massif output file(s) to display. 0075 */ 0076 void openFile(); 0077 0078 /** 0079 * Opens @p file as massif output file and visualize it. 0080 */ 0081 void openFile(const QUrl& file); 0082 0083 /** 0084 * reload currently opened file 0085 */ 0086 void reloadCurrentFile(); 0087 0088 /** 0089 * Close currently opened file. 0090 */ 0091 void closeCurrentFile(); 0092 0093 private Q_SLOTS: 0094 void closeRequested(); 0095 void closeFileTab(int idx); 0096 0097 void preferences(); 0098 void settingsChanged(); 0099 0100 void treeSelectionChanged(const QModelIndex& now, const QModelIndex& before); 0101 void selectPeakSnapshot(); 0102 void modelItemSelected(const Massif::ModelItem& item); 0103 void contextMenuRequested(const Massif::ModelItem& item, QMenu* menu); 0104 0105 void documentChanged(); 0106 0107 void allocatorsChanged(); 0108 void allocatorSelectionChanged(); 0109 void dataTreeContextMenuRequested(const QPoint &pos); 0110 void slotNewAllocator(); 0111 void slotRemoveAllocator(); 0112 /// operates on data of @c m_markCustomAllocator 0113 void slotMarkCustomAllocator(); 0114 void allocatorViewContextMenuRequested(const QPoint &pos); 0115 0116 void slotShortenTemplates(bool); 0117 0118 private: 0119 void updateWindowTitle(); 0120 0121 // Helper 0122 Ui::MainWindow ui; 0123 0124 KRecentFilesAction* m_recentFiles; 0125 0126 QAction* m_close; 0127 0128 QStringListModel* m_allocatorModel; 0129 QAction* m_newAllocator; 0130 QAction* m_removeAllocator; 0131 QAction* m_markCustomAllocator; 0132 0133 QAction* m_shortenTemplates; 0134 QAction* m_selectPeak; 0135 0136 DocumentWidget* m_currentDocument; 0137 0138 Massif::DataTreeModel* m_dataTreeModel; 0139 Massif::FilteredDataTreeModel* m_dataTreeFilterModel; 0140 bool m_settingSelection; 0141 }; 0142 0143 } 0144 0145 #endif // MASSIF_MAINWINDOW_H