diff --git a/kcachegrind/toplevel.h b/kcachegrind/toplevel.h index db41317..4fbc4ef 100644 --- a/kcachegrind/toplevel.h +++ b/kcachegrind/toplevel.h @@ -1,298 +1,298 @@ /* This file is part of KCachegrind. Copyright (C) 2002-2016 Josef Weidendorfer KCachegrind is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* * KCachegrind top level window */ #ifndef TOPLEVEL_H #define TOPLEVEL_H -#include +#include #include #include #include #include #include "logger.h" #include "traceitemview.h" #include "tracedata.h" #include "toplevelbase.h" class MultiView; class QLineEdit; class QDockWidget; class QLabel; class QProgressBar; class QMenu; class QUrl; class KSelectAction; class KToggleAction; class KToolBarPopupAction; class KStatusBar; class TraceData; class KRecentFilesAction; class MainWidget; class PartSelection; class FunctionSelection; class DumpSelection; class StackSelection; class TraceFunction; class TopLevel : public KXmlGuiWindow, public Logger, public TopLevelBase { Q_OBJECT Q_CLASSINFO("D-Bus Interface", "org.kde.kcachegrind") public: TopLevel(); ~TopLevel() override; TraceData* data() { return _data; } void setData(TraceData*); void saveProperties(KConfigGroup &) override; void readProperties(const KConfigGroup &) override; void createActions(); void createDocks(); ProfileContext::Type groupType() { return _groupType; } EventType* eventType() { return _eventType; } EventType* eventType2() { return _eventType2; } TracePartList activeParts() { return _activeParts; } TracePartList hiddenParts() override { return _hiddenParts; } // current config bool showPercentage() const { return _showPercentage; } bool showExpanded() const { return _showExpanded; } bool showCycles() const { return _showCycles; } /* convenience functions for often used context menu items */ void addEventTypeMenu(QMenu*,bool) override; void addGoMenu(QMenu*) override; // Logger overwrites: notifications for file loading void loadStart(const QString& filename) override; void loadProgress(int progress) override; // 0 - 100 void loadWarning(int line, const QString& msg) override; void loadError(int line, const QString& msg) override; void loadFinished(const QString& msg) override; // msg could be error public Q_SLOTS: void load(); void load(const QUrl&); void load(QString); void add(); void add(const QUrl&); void add(QString); // for quickly showing the main window... void loadDelayed(QString); void loadDelayed(QStringList); void reload(); void exportGraph(); void newWindow(); void configure(); void querySlot(); void dummySlot(); // layouts void layoutDuplicate(); void layoutRemove(); void layoutNext(); void layoutPrevious(); void layoutSave(); void layoutRestore(); void updateLayoutActions(); void updateStatusBar(); void eventTypeSelected(const QString&); void eventType2Selected(const QString&); void groupTypeSelected(int); void splitSlot(); void splitDirSlot(); void configureToolbars() override; void configureKeys(); bool queryClose() override; void togglePartDock(); void toggleStackDock(); void toggleFunctionDock(); void toggleDumpDock(); void toggleStatusBar(); void partVisibilityChanged(bool); void dumpVisibilityChanged(bool); void stackVisibilityChanged(bool); void functionVisibilityChanged(bool); void togglePercentage(); void setPercentage(bool); void setAbsoluteCost(); void setRelativeCost(); void toggleExpanded(); void toggleCycles(); void toggleHideTemplates(); void forceTrace(); void forwardAboutToShow(); void forwardTriggered(QAction*); void backAboutToShow(); void backTriggered(QAction*); void upAboutToShow(); void upTriggered(QAction*); bool setEventType(EventType*); bool setEventType2(EventType*); bool setEventType(QString); bool setEventType2(QString); bool setEventType(QAction*); bool setEventType2(QAction*); bool setGroupType(ProfileContext::Type); bool setGroupType(QString); bool setGroup(TraceCostItem*); bool setGroup(QString); bool setFunction(TraceFunction*); bool setFunction(QString); void activePartsChangedSlot(const TracePartList& list) override; void partsHideSelectedSlot(); void partsUnhideAllSlot(); /* These go back to mainloop first by using a timer. * So they can be called from event handlers that * are not allowed to delete list entries. */ void setEventTypeDelayed(EventType*) override; void setEventType2Delayed(EventType*) override; void setGroupTypeDelayed(ProfileContext::Type) override; void setGroupDelayed(TraceCostItem*) override; void setTraceItemDelayed(CostItem*) override; void partsHideSelectedSlotDelayed(); void partsUnhideAllSlotDelayed(); void goBack(); void goForward(); void goUp(); void setDirectionDelayed(TraceItemView::Direction) override; /* SingleShot Slots (without parameters) for the delayed versions */ void setEventTypeDelayed(); void setEventType2Delayed(); void setGroupTypeDelayed(); void setGroupDelayed(); void setTraceItemDelayed(); void loadTraceDelayed(); void setDirectionDelayed(); // configuration has changed void configChanged() override; //void refresh(); void slotShowTipOnStart(); void slotShowTip(); // progress in status bar, empty message disables progress display void showStatus(const QString& msg, int progress); void showMessage(const QString&, int msec) override; // for running callgrind_control in the background void ccReadOutput(); void ccError(QProcess::ProcessError); void ccExit(int,QProcess::ExitStatus); private: void resetState(); void createLayoutActions(); void createMiscActions(); void setupMainWidget(MainWidget*); void setupPartSelection(PartSelection*); void restoreCurrentState(const QString& postfix); void saveCurrentState(const QString& postfix); void saveTraceSettings(); QString traceKey(); void restoreTraceTypes(); void restoreTraceSettings(); void updateViewsOnChange(int); /// open @p file, might be compressed /// @return true when the file could be opened, false otherwise. bool openDataFile(const QString& file); QStatusBar* _statusbar; QLabel* _statusLabel; KRecentFilesAction* _openRecent; bool _twoMainWidgets; Qt::Orientation _spOrientation; MultiView* _multiView; FunctionSelection* _functionSelection; DumpSelection* _dumpSelection; PartSelection* _partSelection; StackSelection* _stackSelection; QLineEdit* queryLineEdit; QDockWidget *_partDock, *_stackDock, *_functionDock, *_dumpDock; bool _forcePartDock; KSelectAction *_saCost, *_saCost2, *saGroup; KToggleAction *_partDockShown, *_stackDockShown; KToggleAction *_functionDockShown, *_dumpDockShown; KToggleAction *_taPercentage, *_taExpanded, *_taCycles, *_taHideTemplates; KToggleAction *_taDump, *_taSplit, *_taSplitDir; KToolBarPopupAction *_paForward, *_paBack, *_paUp; TraceFunction* _function; const QObject* _lastSender; // trace data shown in this window TraceData* _data; // subcost types used for visualization EventType* _eventType; EventType* _eventType2; // grouping of function list ProfileContext::Type _groupType; // selected group TraceCostItem* _group; // selected parts TracePartList _activeParts; // hidden parts TracePartList _hiddenParts; // layouts int _layoutCurrent, _layoutCount; // for delayed slots EventType* _eventTypeDelayed; EventType* _eventType2Delayed; ProfileContext::Type _groupTypeDelayed; TraceCostItem* _groupDelayed; CostItem* _traceItemDelayed; QStringList _loadFilesDelayed; TraceItemView::Direction _directionDelayed; // for status progress display QString _progressMsg; - QTime _progressStart; + QElapsedTimer _progressStart; QProgressBar* _progressBar; // toplevel configuration options bool _showPercentage, _showExpanded, _showCycles, _hideTemplates; // for running callgrind_control in the background QProcess* _ccProcess; QString _ccOutput; }; #endif diff --git a/qcachegrind/qcgtoplevel.h b/qcachegrind/qcgtoplevel.h index bec2b20..2fe4bc8 100644 --- a/qcachegrind/qcgtoplevel.h +++ b/qcachegrind/qcgtoplevel.h @@ -1,268 +1,268 @@ /* This file is part of KCachegrind. Copyright (c) 2002-2016 Josef Weidendorfer KCachegrind is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* * QCachegrind top level window */ #ifndef QCGTOPLEVEL_H #define QCGTOPLEVEL_H -#include +#include #include #include #include #include #include "logger.h" #include "traceitemview.h" #include "tracedata.h" #include "toplevelbase.h" class MultiView; class QDockWidget; class QLabel; class QComboBox; class QProgressBar; class QMenu; class TraceData; class MainWidget; class PartSelection; class FunctionSelection; class StackSelection; class TraceFunction; class QCGTopLevel : public QMainWindow, public Logger, public TopLevelBase { Q_OBJECT Q_CLASSINFO("D-Bus Interface", "io.github.qcachegrind") public: QCGTopLevel(); ~QCGTopLevel() override; TraceData* data() { return _data; } void setData(TraceData*); void createActions(); void createDocks(); void createMenu(); void createToolbar(); void closeEvent(QCloseEvent*) override; ProfileContext::Type groupType() { return _groupType; } EventType* eventType() { return _eventType; } EventType* eventType2() { return _eventType2; } TracePartList activeParts() { return _activeParts; } TracePartList hiddenParts() override { return _hiddenParts; } /* convenience functions for often used context menu items */ void addEventTypeMenu(QMenu*,bool) override; void addGoMenu(QMenu*) override; // Logger overwrites: notifications for file loading void loadStart(const QString& filename) override; void loadProgress(int progress) override; // 0 - 100 void loadWarning(int line, const QString& msg) override; void loadError(int line, const QString& msg) override; void loadFinished(const QString& msg) override; // msg could be error public Q_SLOTS: void load(); void load(QStringList files, bool addToRecentFiles = true); void add(); void add(QStringList files); // shows the main window before loading to see loading progress void loadDelayed(QString file, bool addToRecentFiles = true); void loadDelayed(QStringList files, bool addToRecentFiles = true); void exportGraph(); void newWindow(); void configure(QString page = QString()); void about(); // layouts void layoutDuplicate(); void layoutRemove(); void layoutNext(); void layoutPrevious(); void layoutSave(); void layoutRestore(); void updateLayoutActions(); void updateStatusBar(); void eventTypeSelected(const QString&); void eventType2Selected(const QString&); void groupTypeSelected(int); void toggleSplitted(); void toggleSplitDirection(); void togglePartDock(); void toggleStackDock(); void toggleFunctionDock(); void functionVisibilityChanged(bool); void togglePercentage(); void setPercentage(bool); void setAbsoluteCost(); void setRelativeCost(); void toggleHideTemplates(); void toggleExpanded(); void toggleCycles(); void recentFilesMenuAboutToShow(); void recentFilesTriggered(QAction*); void sidebarMenuAboutToShow(); void forwardAboutToShow(); void forwardTriggered(QAction*); void backAboutToShow(); void backTriggered(QAction*); void upAboutToShow(); void upTriggered(QAction*); void primaryAboutToShow(); void secondaryAboutToShow(); void groupingAboutToShow(); bool setEventType(EventType*); bool setEventType2(EventType*); bool setEventType(QString); bool setEventType2(QString); bool setEventType(QAction*); bool setEventType2(QAction*); bool setGroupType(ProfileContext::Type); bool setGroupType(QString); bool setGroup(TraceCostItem*); bool setGroup(QString); bool setFunction(TraceFunction*); bool setFunction(QString); void activePartsChangedSlot(const TracePartList& list) override; void partsHideSelectedSlot(); void partsUnhideAllSlot(); /* These go back to mainloop first by using a timer. * So they can be called from event handlers that * are not allowed to delete list entries. */ void setEventTypeDelayed(EventType*) override; void setEventType2Delayed(EventType*) override; void setGroupTypeDelayed(ProfileContext::Type) override; void setGroupDelayed(TraceCostItem*) override; void setTraceItemDelayed(CostItem*) override; void partsHideSelectedSlotDelayed(); void partsUnhideAllSlotDelayed(); void goBack(); void goForward(); void goUp(); void setDirectionDelayed(TraceItemView::Direction) override; /* SingleShot Slots (without parameters) for the delayed versions */ void setEventTypeDelayed(); void setEventType2Delayed(); void setGroupTypeDelayed(); void setGroupDelayed(); void setTraceItemDelayed(); void loadFilesDelayed(); void setDirectionDelayed(); // configuration has changed void configChanged() override; //void refresh(); // progress in status bar, empty message disables progress display void showStatus(const QString& msg, int progress); void showMessage(const QString&, int msec) override; private: void resetState(); void createLayoutActions(); void createMiscActions(); void setupMainWidget(MainWidget*); void setupPartSelection(PartSelection*); void updateEventTypeMenu(QMenu* m, bool secondary); void restoreCurrentState(const QString& postfix); void saveCurrentState(const QString& postfix); void saveTraceSettings(); QString traceKey(); void restoreTraceTypes(); void restoreTraceSettings(); QStatusBar* _statusbar; QLabel* _statusLabel; QString _progressMsg; - QTime _progressStart; + QElapsedTimer _progressStart; QProgressBar* _progressBar; MultiView* _multiView; Qt::Orientation _spOrientation; bool _twoMainWidgets; FunctionSelection* _functionSelection; PartSelection* _partSelection; StackSelection* _stackSelection; QDockWidget *_partDock, *_stackDock, *_functionDock; bool _forcePartDock; // menu/toolbar actions QAction *_newAction, *_openAction, *_addAction, *_reloadAction; QAction *_exportAction, *_dumpToggleAction, *_exitAction; QAction *_sidebarMenuAction, *_recentFilesMenuAction; QAction *_cyclesToggleAction, *_percentageToggleAction; QAction *_expandedToggleAction, *_hideTemplatesToggleAction; QAction *_primaryMenuAction, *_secondaryMenuAction; QAction *_groupingMenuAction; QAction *_splittedToggleAction, *_splitDirectionToggleAction; QAction *_layoutNext, *_layoutPrev, *_layoutRemove, *_layoutDup; QAction *_layoutRestore, *_layoutSave; QAction *_upAction, *_forwardAction, *_backAction; QAction *_configureAction, *_aboutAction, *_aboutQtAction; QComboBox* _eventTypeBox; TraceFunction* _function; const QObject* _lastSender; // trace data shown in this window TraceData* _data; // subcost types used for visualization EventType* _eventType; EventType* _eventType2; QStringList _eventTypes; // grouping of function list ProfileContext::Type _groupType; // selected group TraceCostItem* _group; // selected parts TracePartList _activeParts; // hidden parts TracePartList _hiddenParts; // layouts int _layoutCurrent, _layoutCount; // remember last file directory for new QFileDialogs QString _lastFile; // for delayed slots EventType* _eventTypeDelayed; EventType* _eventType2Delayed; ProfileContext::Type _groupTypeDelayed; TraceCostItem* _groupDelayed; CostItem* _traceItemDelayed; QStringList _loadFilesDelayed; bool _addToRecentFiles; TraceItemView::Direction _directionDelayed; }; #endif // QCGTOPLEVEL_H