File indexing completed on 2024-04-28 17:02:19
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 DOCUMENTWIDGET_H 0025 #define DOCUMENTWIDGET_H 0026 0027 #include <QUrl> 0028 #include <QWidget> 0029 #include <QMenu> 0030 0031 #include <KXMLGUIClient> 0032 0033 #include "visualizer/modelitem.h" 0034 0035 class DocumentTabInterface; 0036 0037 class QMenu; 0038 class QLabel; 0039 class QProgressBar; 0040 class QToolButton; 0041 class QStackedWidget; 0042 class QTabWidget; 0043 0044 class KMessageWidget; 0045 0046 namespace Massif { 0047 class FileData; 0048 class ParseWorker; 0049 } 0050 0051 class DocumentWidget : public QWidget, public KXMLGUIClient 0052 { 0053 Q_OBJECT 0054 0055 public: 0056 explicit DocumentWidget(const QUrl &file, const QStringList& customAllocators, 0057 KXMLGUIClient* guiParent, QWidget* parent = 0); 0058 ~DocumentWidget(); 0059 0060 Massif::FileData* data() const; 0061 QUrl file() const; 0062 0063 bool isLoaded() const; 0064 0065 void settingsChanged(); 0066 0067 void addGuiActions(KXMLGUIFactory* factory); 0068 void clearGuiActions(KXMLGUIFactory* factory); 0069 0070 void selectModelItem(const Massif::ModelItem& item); 0071 0072 Q_SIGNALS: 0073 void loadingFinished(); 0074 void modelItemSelected(const Massif::ModelItem& item); 0075 void contextMenuRequested(const Massif::ModelItem& item, QMenu* menu); 0076 void requestClose(); 0077 0078 private Q_SLOTS: 0079 void stopParser(); 0080 void parserFinished(const QUrl& file, Massif::FileData* data); 0081 0082 void setProgress(int value); 0083 void setRange(int minimum, int maximum); 0084 0085 void showError(const QString& title, const QString& error); 0086 0087 void slotTabChanged(int tab); 0088 0089 private: 0090 Massif::FileData* m_data; 0091 Massif::ParseWorker* m_parseWorker; 0092 QUrl m_file; 0093 0094 DocumentTabInterface* m_currentTab; 0095 0096 QStackedWidget* m_stackedWidget; 0097 QTabWidget* m_tabs; 0098 KMessageWidget* m_errorMessage; 0099 QLabel* m_loadingMessage; 0100 QProgressBar* m_loadingProgressBar; 0101 QToolButton* m_stopParserButton; 0102 bool m_isLoaded; 0103 }; 0104 0105 #endif // DOCUMENTWIDGET_H