2016-06-30 21:39:04 +03:00
|
|
|
/************************************************************************
|
|
|
|
* file name : main_window.h
|
|
|
|
* ----------------- :
|
|
|
|
* creation time : 2016/06/26
|
|
|
|
* copyright : (c) 2016 Victor Zarubkin
|
|
|
|
* author : Victor Zarubkin
|
|
|
|
* email : v.s.zarubkin@gmail.com
|
|
|
|
* ----------------- :
|
|
|
|
* description : The file contains declaration of MainWindow for easy_profiler GUI.
|
|
|
|
* ----------------- :
|
|
|
|
* change log : * 2016/06/26 Victor Zarubkin: initial commit.
|
|
|
|
* : *
|
|
|
|
* ----------------- :
|
|
|
|
* license : TODO: add license text
|
2016-06-26 20:54:16 +03:00
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#ifndef EASY_PROFILER_GUI__MAIN_WINDOW__H
|
|
|
|
#define EASY_PROFILER_GUI__MAIN_WINDOW__H
|
|
|
|
|
|
|
|
#include <string>
|
2016-08-18 23:26:41 +03:00
|
|
|
#include <thread>
|
|
|
|
#include <atomic>
|
|
|
|
#include <QMainWindow>
|
|
|
|
#include <QTimer>
|
2016-06-26 20:54:16 +03:00
|
|
|
#include "profiler/reader.h"
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
class QDockWidget;
|
|
|
|
|
2016-08-18 23:26:41 +03:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
class EasyFileReader final
|
|
|
|
{
|
|
|
|
::profiler::SerializedData m_serializedData; ///<
|
|
|
|
::profiler::thread_blocks_tree_t m_blocksTree; ///<
|
2016-08-23 22:44:04 +03:00
|
|
|
QString m_filename; ///<
|
2016-08-18 23:26:41 +03:00
|
|
|
::std::thread m_thread; ///<
|
|
|
|
::std::atomic_bool m_bDone; ///<
|
|
|
|
::std::atomic<int> m_progress; ///<
|
|
|
|
::std::atomic<unsigned int> m_size; ///<
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
EasyFileReader();
|
|
|
|
~EasyFileReader();
|
|
|
|
|
|
|
|
bool done() const;
|
|
|
|
int progress() const;
|
|
|
|
unsigned int size() const;
|
2016-08-23 22:44:04 +03:00
|
|
|
const QString& filename() const;
|
2016-08-18 23:26:41 +03:00
|
|
|
|
2016-08-23 22:44:04 +03:00
|
|
|
void load(const QString& _filename);
|
2016-08-18 23:26:41 +03:00
|
|
|
void interrupt();
|
2016-08-23 22:44:04 +03:00
|
|
|
void get(::profiler::SerializedData& _data, ::profiler::thread_blocks_tree_t& _tree, QString& _filename);
|
2016-08-18 23:26:41 +03:00
|
|
|
|
|
|
|
}; // END of class EasyFileReader.
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
class EasyMainWindow : public QMainWindow
|
2016-06-26 20:54:16 +03:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2016-08-18 23:26:41 +03:00
|
|
|
typedef EasyMainWindow This;
|
|
|
|
typedef QMainWindow Parent;
|
2016-06-30 02:57:57 +03:00
|
|
|
|
2016-08-23 22:44:04 +03:00
|
|
|
QString m_lastFile;
|
2016-08-14 22:22:44 +03:00
|
|
|
QDockWidget* m_treeWidget;
|
|
|
|
QDockWidget* m_graphicsView;
|
2016-08-18 23:26:41 +03:00
|
|
|
class QProgressDialog* m_progress;
|
|
|
|
QTimer m_readerTimer;
|
2016-08-14 22:22:44 +03:00
|
|
|
::profiler::SerializedData m_serializedData;
|
2016-08-18 23:26:41 +03:00
|
|
|
EasyFileReader m_reader;
|
2016-06-26 20:54:16 +03:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2016-08-18 23:26:41 +03:00
|
|
|
EasyMainWindow();
|
|
|
|
virtual ~EasyMainWindow();
|
2016-06-26 20:54:16 +03:00
|
|
|
|
2016-08-04 23:46:04 +03:00
|
|
|
// Public virtual methods
|
|
|
|
|
|
|
|
void closeEvent(QCloseEvent* close_event) override;
|
|
|
|
|
2016-06-26 20:54:16 +03:00
|
|
|
protected slots:
|
|
|
|
|
|
|
|
void onOpenFileClicked(bool);
|
|
|
|
void onReloadFileClicked(bool);
|
|
|
|
void onExitClicked(bool);
|
2016-08-09 00:45:45 +03:00
|
|
|
void onEncodingChanged(bool);
|
2016-08-18 23:26:41 +03:00
|
|
|
void onDrawBordersChanged(bool);
|
2016-08-23 22:44:04 +03:00
|
|
|
void onCollapseItemsAfterCloseChanged(bool);
|
|
|
|
void onAllItemsExpandedByDefaultChange(bool);
|
2016-08-21 22:44:03 +03:00
|
|
|
void onExpandAllClicked(bool);
|
|
|
|
void onCollapseAllClicked(bool);
|
2016-08-18 23:26:41 +03:00
|
|
|
void onFileReaderTimeout();
|
|
|
|
void onFileReaderCancel();
|
2016-06-26 20:54:16 +03:00
|
|
|
|
2016-06-30 21:39:04 +03:00
|
|
|
private:
|
|
|
|
|
2016-08-04 23:46:04 +03:00
|
|
|
// Private non-virtual methods
|
|
|
|
|
2016-08-23 22:44:04 +03:00
|
|
|
void loadFile(const QString& filename);
|
2016-08-04 23:12:41 +03:00
|
|
|
|
2016-08-07 19:35:58 +03:00
|
|
|
void loadSettings();
|
2016-08-04 23:12:41 +03:00
|
|
|
void saveSettings();
|
2016-06-30 21:39:04 +03:00
|
|
|
|
2016-08-18 23:26:41 +03:00
|
|
|
}; // END of class EasyMainWindow.
|
2016-06-26 20:54:16 +03:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#endif // EASY_PROFILER_GUI__MAIN_WINDOW__H
|