2016-08-08 22:54:20 +03:00
/************************************************************************
* file name : globals . h
* - - - - - - - - - - - - - - - - - :
* creation time : 2016 / 08 / 03
* copyright : ( c ) 2016 Victor Zarubkin
* author : Victor Zarubkin
* email : v . s . zarubkin @ gmail . com
* - - - - - - - - - - - - - - - - - :
* description : The file contains declaration of global constants and variables for profiler gui .
* - - - - - - - - - - - - - - - - - :
* change log : * 2016 / 08 / 03 Victor Zarubkin : initial commit .
* :
* : *
* - - - - - - - - - - - - - - - - - :
* license : TODO : add license text
2016-08-03 23:00:04 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
# ifndef EASY_PROFILER__GUI_GLOBALS_H
# define EASY_PROFILER__GUI_GLOBALS_H
# include <string>
# include <QObject>
2016-08-06 14:50:31 +03:00
# include <QColor>
2016-08-09 00:45:45 +03:00
# include <QTextCodec>
2016-08-03 23:00:04 +03:00
# include "common_types.h"
2016-08-08 22:54:20 +03:00
# include "globals_qobjects.h"
2016-08-03 23:00:04 +03:00
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
namespace profiler_gui {
2016-08-04 23:12:41 +03:00
const QString ORGANAZATION_NAME = " EasyProfiler " ;
const QString APPLICATION_NAME = " Easy profiler gui application " ;
2016-08-21 14:26:04 +03:00
const QColor CHRONOMETER_COLOR = QColor : : fromRgba ( 0x402020c0 ) ;
2016-08-07 19:38:31 +03:00
const QRgb SELECTED_THREAD_BACKGROUND = 0x00e0e060 ;
2016-08-06 14:50:31 +03:00
const QRgb SELECTED_THREAD_FOREGROUND = 0x00ffffff - SELECTED_THREAD_BACKGROUND ;
2016-08-04 22:38:45 +03:00
//////////////////////////////////////////////////////////////////////////
2016-08-11 23:43:34 +03:00
# pragma pack(push, 1)
2016-08-18 23:26:41 +03:00
struct EasyBlock final
2016-08-04 22:38:45 +03:00
{
2016-08-11 23:43:34 +03:00
unsigned int tree_item ;
unsigned int graphics_item_index ;
unsigned char graphics_item_level ;
unsigned char graphics_item ;
2016-08-18 23:26:41 +03:00
bool expanded ;
2016-08-04 22:38:45 +03:00
} ;
2016-08-11 23:43:34 +03:00
# pragma pack(pop)
2016-08-04 22:38:45 +03:00
2016-08-18 23:26:41 +03:00
typedef : : std : : vector < EasyBlock > EasyBlocks ;
2016-08-04 22:38:45 +03:00
2016-08-09 00:45:45 +03:00
template < class T >
2016-08-09 01:29:24 +03:00
inline auto toUnicode ( const T & _inputString ) - > decltype ( QTextCodec : : codecForLocale ( ) - > toUnicode ( _inputString ) )
2016-08-09 00:45:45 +03:00
{
return QTextCodec : : codecForLocale ( ) - > toUnicode ( _inputString ) ;
}
2016-08-04 22:38:45 +03:00
//////////////////////////////////////////////////////////////////////////
2016-08-18 23:26:41 +03:00
struct EasyGlobals final
2016-08-03 23:00:04 +03:00
{
2016-08-18 23:26:41 +03:00
static EasyGlobals & instance ( ) ;
2016-08-03 23:00:04 +03:00
2016-08-18 23:26:41 +03:00
EasyGlobalSignals events ; ///< Global signals
2016-08-09 00:14:58 +03:00
: : profiler : : thread_blocks_tree_t profiler_blocks ; ///< Profiler blocks tree loaded from file
2016-08-18 23:26:41 +03:00
EasyBlocks gui_blocks ; ///< Profiler graphics blocks builded by GUI
2016-08-09 00:14:58 +03:00
: : profiler : : thread_id_t selected_thread ; ///< Current selected thread id
unsigned int selected_block ; ///< Current selected profiler block index
bool draw_graphics_items_borders ; ///< Draw borders for graphics blocks or not
bool display_only_relevant_stats ; ///< Display only relevant information in ProfTreeWidget (excludes min, max, average times if there are only 1 calls number)
2016-08-03 23:00:04 +03:00
private :
2016-08-18 23:26:41 +03:00
EasyGlobals ( ) ;
2016-08-03 23:00:04 +03:00
} ;
2016-08-08 22:54:20 +03:00
# ifndef IGNORE_GLOBALS_DECLARATION
2016-08-18 23:26:41 +03:00
static EasyGlobals & EASY_GLOBALS = EasyGlobals : : instance ( ) ;
2016-08-08 22:54:20 +03:00
# endif
2016-08-04 22:38:45 +03:00
//////////////////////////////////////////////////////////////////////////
2016-08-03 23:00:04 +03:00
} // END of namespace profiler_gui.
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
# endif // EASY_PROFILER__GUI_GLOBALS_H