diff --git a/easy_profiler_core/include/easy/details/profiler_colors.h b/easy_profiler_core/include/easy/details/profiler_colors.h index c40e071..61e8b5b 100644 --- a/easy_profiler_core/include/easy/details/profiler_colors.h +++ b/easy_profiler_core/include/easy/details/profiler_colors.h @@ -43,29 +43,30 @@ The Apache License, Version 2.0 (the "License"); #ifndef EASY_PROFILER_COLORS_H #define EASY_PROFILER_COLORS_H -#include +#include +#include ////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// namespace profiler { - typedef uint32_t color_t; // Standard four-byte ARGB color format + using color_t = uint32_t; // Standard four-byte ARGB color format namespace colors { ///< Change alpha for color. Only 8 major bytes (0xff000000) used from alpha. - inline color_t modify_alpha32(color_t _color, color_t _alpha) { + inline EASY_CONSTEXPR_FCN color_t modify_alpha32(color_t _color, color_t _alpha) { return (_alpha & 0xff000000) | (_color & 0x00ffffff); } ///< Change alpha for color. - inline color_t modify_alpha8(color_t _color, uint8_t _alpha) { + inline EASY_CONSTEXPR_FCN color_t modify_alpha8(color_t _color, uint8_t _alpha) { return (static_cast(_alpha) << 24) | (_color & 0x00ffffff); } ///< Create color from ARGB components. - inline color_t color(uint8_t _red, uint8_t _green, uint8_t _blue, uint8_t _alpha = 0xff) { + inline EASY_CONSTEXPR_FCN color_t color(uint8_t _red, uint8_t _green, uint8_t _blue, uint8_t _alpha = 0xff) { return (static_cast(_alpha) << 24) | (static_cast(_red) << 16) | (static_cast(_green) << 8) | static_cast(_blue); } @@ -73,333 +74,333 @@ namespace profiler { // Google Material Design colors // See https://material.google.com/style/color.html - const color_t Red50 = 0xffffebee; - const color_t Red100 = 0xffffcdd2; - const color_t Red200 = 0xffef9a9a; - const color_t Red300 = 0xffe57373; - const color_t Red400 = 0xffef5350; - const color_t Red500 = 0xfff44336; - const color_t Red600 = 0xffe53935; - const color_t Red700 = 0xffd32f2f; - const color_t Red800 = 0xffc62828; - const color_t Red900 = 0xffb71c1c; - const color_t RedA100 = 0xffff8a80; - const color_t RedA200 = 0xffff5252; - const color_t RedA400 = 0xffff1744; - const color_t RedA700 = 0xffd50000; + EASY_CONSTEXPR color_t Red50 = 0xffffebee; + EASY_CONSTEXPR color_t Red100 = 0xffffcdd2; + EASY_CONSTEXPR color_t Red200 = 0xffef9a9a; + EASY_CONSTEXPR color_t Red300 = 0xffe57373; + EASY_CONSTEXPR color_t Red400 = 0xffef5350; + EASY_CONSTEXPR color_t Red500 = 0xfff44336; + EASY_CONSTEXPR color_t Red600 = 0xffe53935; + EASY_CONSTEXPR color_t Red700 = 0xffd32f2f; + EASY_CONSTEXPR color_t Red800 = 0xffc62828; + EASY_CONSTEXPR color_t Red900 = 0xffb71c1c; + EASY_CONSTEXPR color_t RedA100 = 0xffff8a80; + EASY_CONSTEXPR color_t RedA200 = 0xffff5252; + EASY_CONSTEXPR color_t RedA400 = 0xffff1744; + EASY_CONSTEXPR color_t RedA700 = 0xffd50000; - const color_t Pink50 = 0xfffce4ec; - const color_t Pink100 = 0xfff8bbd0; - const color_t Pink200 = 0xfff48fb1; - const color_t Pink300 = 0xfff06292; - const color_t Pink400 = 0xffec407a; - const color_t Pink500 = 0xffe91e63; - const color_t Pink600 = 0xffd81b60; - const color_t Pink700 = 0xffc2185b; - const color_t Pink800 = 0xffad1457; - const color_t Pink900 = 0xff880e4f; - const color_t PinkA100 = 0xffff80ab; - const color_t PinkA200 = 0xffff4081; - const color_t PinkA400 = 0xfff50057; - const color_t PinkA700 = 0xffc51162; + EASY_CONSTEXPR color_t Pink50 = 0xfffce4ec; + EASY_CONSTEXPR color_t Pink100 = 0xfff8bbd0; + EASY_CONSTEXPR color_t Pink200 = 0xfff48fb1; + EASY_CONSTEXPR color_t Pink300 = 0xfff06292; + EASY_CONSTEXPR color_t Pink400 = 0xffec407a; + EASY_CONSTEXPR color_t Pink500 = 0xffe91e63; + EASY_CONSTEXPR color_t Pink600 = 0xffd81b60; + EASY_CONSTEXPR color_t Pink700 = 0xffc2185b; + EASY_CONSTEXPR color_t Pink800 = 0xffad1457; + EASY_CONSTEXPR color_t Pink900 = 0xff880e4f; + EASY_CONSTEXPR color_t PinkA100 = 0xffff80ab; + EASY_CONSTEXPR color_t PinkA200 = 0xffff4081; + EASY_CONSTEXPR color_t PinkA400 = 0xfff50057; + EASY_CONSTEXPR color_t PinkA700 = 0xffc51162; - const color_t Purple50 = 0xfff3e5f5; - const color_t Purple100 = 0xffe1bee7; - const color_t Purple200 = 0xffce93d8; - const color_t Purple300 = 0xffba68c8; - const color_t Purple400 = 0xffab47bc; - const color_t Purple500 = 0xff9c27b0; - const color_t Purple600 = 0xff8e24aa; - const color_t Purple700 = 0xff7b1fa2; - const color_t Purple800 = 0xff6a1b9a; - const color_t Purple900 = 0xff4a148c; - const color_t PurpleA100 = 0xffea80fc; - const color_t PurpleA200 = 0xffe040fb; - const color_t PurpleA400 = 0xffd500f9; - const color_t PurpleA700 = 0xffaa00ff; + EASY_CONSTEXPR color_t Purple50 = 0xfff3e5f5; + EASY_CONSTEXPR color_t Purple100 = 0xffe1bee7; + EASY_CONSTEXPR color_t Purple200 = 0xffce93d8; + EASY_CONSTEXPR color_t Purple300 = 0xffba68c8; + EASY_CONSTEXPR color_t Purple400 = 0xffab47bc; + EASY_CONSTEXPR color_t Purple500 = 0xff9c27b0; + EASY_CONSTEXPR color_t Purple600 = 0xff8e24aa; + EASY_CONSTEXPR color_t Purple700 = 0xff7b1fa2; + EASY_CONSTEXPR color_t Purple800 = 0xff6a1b9a; + EASY_CONSTEXPR color_t Purple900 = 0xff4a148c; + EASY_CONSTEXPR color_t PurpleA100 = 0xffea80fc; + EASY_CONSTEXPR color_t PurpleA200 = 0xffe040fb; + EASY_CONSTEXPR color_t PurpleA400 = 0xffd500f9; + EASY_CONSTEXPR color_t PurpleA700 = 0xffaa00ff; - const color_t DeepPurple50 = 0xffede7f6; - const color_t DeepPurple100 = 0xffd1c4e9; - const color_t DeepPurple200 = 0xffb39ddb; - const color_t DeepPurple300 = 0xff9575cd; - const color_t DeepPurple400 = 0xff7e57c2; - const color_t DeepPurple500 = 0xff673ab7; - const color_t DeepPurple600 = 0xff5e35b1; - const color_t DeepPurple700 = 0xff512da8; - const color_t DeepPurple800 = 0xff4527a0; - const color_t DeepPurple900 = 0xff311b92; - const color_t DeepPurpleA100 = 0xffb388ff; - const color_t DeepPurpleA200 = 0xff7c4dff; - const color_t DeepPurpleA400 = 0xff651fff; - const color_t DeepPurpleA700 = 0xff6200ea; + EASY_CONSTEXPR color_t DeepPurple50 = 0xffede7f6; + EASY_CONSTEXPR color_t DeepPurple100 = 0xffd1c4e9; + EASY_CONSTEXPR color_t DeepPurple200 = 0xffb39ddb; + EASY_CONSTEXPR color_t DeepPurple300 = 0xff9575cd; + EASY_CONSTEXPR color_t DeepPurple400 = 0xff7e57c2; + EASY_CONSTEXPR color_t DeepPurple500 = 0xff673ab7; + EASY_CONSTEXPR color_t DeepPurple600 = 0xff5e35b1; + EASY_CONSTEXPR color_t DeepPurple700 = 0xff512da8; + EASY_CONSTEXPR color_t DeepPurple800 = 0xff4527a0; + EASY_CONSTEXPR color_t DeepPurple900 = 0xff311b92; + EASY_CONSTEXPR color_t DeepPurpleA100 = 0xffb388ff; + EASY_CONSTEXPR color_t DeepPurpleA200 = 0xff7c4dff; + EASY_CONSTEXPR color_t DeepPurpleA400 = 0xff651fff; + EASY_CONSTEXPR color_t DeepPurpleA700 = 0xff6200ea; - const color_t Indigo50 = 0xffe8eaf6; - const color_t Indigo100 = 0xffc5cae9; - const color_t Indigo200 = 0xff9fa8da; - const color_t Indigo300 = 0xff7986cb; - const color_t Indigo400 = 0xff5c6bc0; - const color_t Indigo500 = 0xff3f51b5; - const color_t Indigo600 = 0xff3949ab; - const color_t Indigo700 = 0xff303f9f; - const color_t Indigo800 = 0xff283593; - const color_t Indigo900 = 0xff1a237e; - const color_t IndigoA100 = 0xff8c9eff; - const color_t IndigoA200 = 0xff536dfe; - const color_t IndigoA400 = 0xff3d5afe; - const color_t IndigoA700 = 0xff304ffe; + EASY_CONSTEXPR color_t Indigo50 = 0xffe8eaf6; + EASY_CONSTEXPR color_t Indigo100 = 0xffc5cae9; + EASY_CONSTEXPR color_t Indigo200 = 0xff9fa8da; + EASY_CONSTEXPR color_t Indigo300 = 0xff7986cb; + EASY_CONSTEXPR color_t Indigo400 = 0xff5c6bc0; + EASY_CONSTEXPR color_t Indigo500 = 0xff3f51b5; + EASY_CONSTEXPR color_t Indigo600 = 0xff3949ab; + EASY_CONSTEXPR color_t Indigo700 = 0xff303f9f; + EASY_CONSTEXPR color_t Indigo800 = 0xff283593; + EASY_CONSTEXPR color_t Indigo900 = 0xff1a237e; + EASY_CONSTEXPR color_t IndigoA100 = 0xff8c9eff; + EASY_CONSTEXPR color_t IndigoA200 = 0xff536dfe; + EASY_CONSTEXPR color_t IndigoA400 = 0xff3d5afe; + EASY_CONSTEXPR color_t IndigoA700 = 0xff304ffe; - const color_t Blue50 = 0xffe3f2fd; - const color_t Blue100 = 0xffbbdefb; - const color_t Blue200 = 0xff90caf9; - const color_t Blue300 = 0xff64b5f6; - const color_t Blue400 = 0xff42a5f5; - const color_t Blue500 = 0xff2196f3; - const color_t Blue600 = 0xff1e88e5; - const color_t Blue700 = 0xff1976d2; - const color_t Blue800 = 0xff1565c0; - const color_t Blue900 = 0xff0d47a1; - const color_t BlueA100 = 0xff82b1ff; - const color_t BlueA200 = 0xff448aff; - const color_t BlueA400 = 0xff2979ff; - const color_t BlueA700 = 0xff2962ff; + EASY_CONSTEXPR color_t Blue50 = 0xffe3f2fd; + EASY_CONSTEXPR color_t Blue100 = 0xffbbdefb; + EASY_CONSTEXPR color_t Blue200 = 0xff90caf9; + EASY_CONSTEXPR color_t Blue300 = 0xff64b5f6; + EASY_CONSTEXPR color_t Blue400 = 0xff42a5f5; + EASY_CONSTEXPR color_t Blue500 = 0xff2196f3; + EASY_CONSTEXPR color_t Blue600 = 0xff1e88e5; + EASY_CONSTEXPR color_t Blue700 = 0xff1976d2; + EASY_CONSTEXPR color_t Blue800 = 0xff1565c0; + EASY_CONSTEXPR color_t Blue900 = 0xff0d47a1; + EASY_CONSTEXPR color_t BlueA100 = 0xff82b1ff; + EASY_CONSTEXPR color_t BlueA200 = 0xff448aff; + EASY_CONSTEXPR color_t BlueA400 = 0xff2979ff; + EASY_CONSTEXPR color_t BlueA700 = 0xff2962ff; - const color_t LightBlue50 = 0xffe1f5fe; - const color_t LightBlue100 = 0xffb3e5fc; - const color_t LightBlue200 = 0xff81d4fa; - const color_t LightBlue300 = 0xff4fc3f7; - const color_t LightBlue400 = 0xff29b6f6; - const color_t LightBlue500 = 0xff03a9f4; - const color_t LightBlue600 = 0xff039be5; - const color_t LightBlue700 = 0xff0288d1; - const color_t LightBlue800 = 0xff0277bd; - const color_t LightBlue900 = 0xff01579b; - const color_t LightBlueA100 = 0xff80d8ff; - const color_t LightBlueA200 = 0xff40c4ff; - const color_t LightBlueA400 = 0xff00b0ff; - const color_t LightBlueA700 = 0xff0091ea; + EASY_CONSTEXPR color_t LightBlue50 = 0xffe1f5fe; + EASY_CONSTEXPR color_t LightBlue100 = 0xffb3e5fc; + EASY_CONSTEXPR color_t LightBlue200 = 0xff81d4fa; + EASY_CONSTEXPR color_t LightBlue300 = 0xff4fc3f7; + EASY_CONSTEXPR color_t LightBlue400 = 0xff29b6f6; + EASY_CONSTEXPR color_t LightBlue500 = 0xff03a9f4; + EASY_CONSTEXPR color_t LightBlue600 = 0xff039be5; + EASY_CONSTEXPR color_t LightBlue700 = 0xff0288d1; + EASY_CONSTEXPR color_t LightBlue800 = 0xff0277bd; + EASY_CONSTEXPR color_t LightBlue900 = 0xff01579b; + EASY_CONSTEXPR color_t LightBlueA100 = 0xff80d8ff; + EASY_CONSTEXPR color_t LightBlueA200 = 0xff40c4ff; + EASY_CONSTEXPR color_t LightBlueA400 = 0xff00b0ff; + EASY_CONSTEXPR color_t LightBlueA700 = 0xff0091ea; - const color_t Cyan50 = 0xffe0f7fa; - const color_t Cyan100 = 0xffb2ebf2; - const color_t Cyan200 = 0xff80deea; - const color_t Cyan300 = 0xff4dd0e1; - const color_t Cyan400 = 0xff26c6da; - const color_t Cyan500 = 0xff00bcd4; - const color_t Cyan600 = 0xff00acc1; - const color_t Cyan700 = 0xff0097a7; - const color_t Cyan800 = 0xff00838f; - const color_t Cyan900 = 0xff006064; - const color_t CyanA100 = 0xff84ffff; - const color_t CyanA200 = 0xff18ffff; - const color_t CyanA400 = 0xff00e5ff; - const color_t CyanA700 = 0xff00b8d4; + EASY_CONSTEXPR color_t Cyan50 = 0xffe0f7fa; + EASY_CONSTEXPR color_t Cyan100 = 0xffb2ebf2; + EASY_CONSTEXPR color_t Cyan200 = 0xff80deea; + EASY_CONSTEXPR color_t Cyan300 = 0xff4dd0e1; + EASY_CONSTEXPR color_t Cyan400 = 0xff26c6da; + EASY_CONSTEXPR color_t Cyan500 = 0xff00bcd4; + EASY_CONSTEXPR color_t Cyan600 = 0xff00acc1; + EASY_CONSTEXPR color_t Cyan700 = 0xff0097a7; + EASY_CONSTEXPR color_t Cyan800 = 0xff00838f; + EASY_CONSTEXPR color_t Cyan900 = 0xff006064; + EASY_CONSTEXPR color_t CyanA100 = 0xff84ffff; + EASY_CONSTEXPR color_t CyanA200 = 0xff18ffff; + EASY_CONSTEXPR color_t CyanA400 = 0xff00e5ff; + EASY_CONSTEXPR color_t CyanA700 = 0xff00b8d4; - const color_t Teal50 = 0xffe0f2f1; - const color_t Teal100 = 0xffb2dfdb; - const color_t Teal200 = 0xff80cbc4; - const color_t Teal300 = 0xff4db6ac; - const color_t Teal400 = 0xff26a69a; - const color_t Teal500 = 0xff009688; - const color_t Teal600 = 0xff00897b; - const color_t Teal700 = 0xff00796b; - const color_t Teal800 = 0xff00695c; - const color_t Teal900 = 0xff004d40; - const color_t TealA100 = 0xffa7ffeb; - const color_t TealA200 = 0xff64ffda; - const color_t TealA400 = 0xff1de9b6; - const color_t TealA700 = 0xff00bfa5; + EASY_CONSTEXPR color_t Teal50 = 0xffe0f2f1; + EASY_CONSTEXPR color_t Teal100 = 0xffb2dfdb; + EASY_CONSTEXPR color_t Teal200 = 0xff80cbc4; + EASY_CONSTEXPR color_t Teal300 = 0xff4db6ac; + EASY_CONSTEXPR color_t Teal400 = 0xff26a69a; + EASY_CONSTEXPR color_t Teal500 = 0xff009688; + EASY_CONSTEXPR color_t Teal600 = 0xff00897b; + EASY_CONSTEXPR color_t Teal700 = 0xff00796b; + EASY_CONSTEXPR color_t Teal800 = 0xff00695c; + EASY_CONSTEXPR color_t Teal900 = 0xff004d40; + EASY_CONSTEXPR color_t TealA100 = 0xffa7ffeb; + EASY_CONSTEXPR color_t TealA200 = 0xff64ffda; + EASY_CONSTEXPR color_t TealA400 = 0xff1de9b6; + EASY_CONSTEXPR color_t TealA700 = 0xff00bfa5; - const color_t Green50 = 0xffe8f5e9; - const color_t Green100 = 0xffc8e6c9; - const color_t Green200 = 0xffa5d6a7; - const color_t Green300 = 0xff81c784; - const color_t Green400 = 0xff66bb6a; - const color_t Green500 = 0xff4caf50; - const color_t Green600 = 0xff43a047; - const color_t Green700 = 0xff388e3c; - const color_t Green800 = 0xff2e7d32; - const color_t Green900 = 0xff1b5e20; - const color_t GreenA100 = 0xffb9f6ca; - const color_t GreenA200 = 0xff69f0ae; - const color_t GreenA400 = 0xff00e676; - const color_t GreenA700 = 0xff00c853; + EASY_CONSTEXPR color_t Green50 = 0xffe8f5e9; + EASY_CONSTEXPR color_t Green100 = 0xffc8e6c9; + EASY_CONSTEXPR color_t Green200 = 0xffa5d6a7; + EASY_CONSTEXPR color_t Green300 = 0xff81c784; + EASY_CONSTEXPR color_t Green400 = 0xff66bb6a; + EASY_CONSTEXPR color_t Green500 = 0xff4caf50; + EASY_CONSTEXPR color_t Green600 = 0xff43a047; + EASY_CONSTEXPR color_t Green700 = 0xff388e3c; + EASY_CONSTEXPR color_t Green800 = 0xff2e7d32; + EASY_CONSTEXPR color_t Green900 = 0xff1b5e20; + EASY_CONSTEXPR color_t GreenA100 = 0xffb9f6ca; + EASY_CONSTEXPR color_t GreenA200 = 0xff69f0ae; + EASY_CONSTEXPR color_t GreenA400 = 0xff00e676; + EASY_CONSTEXPR color_t GreenA700 = 0xff00c853; - const color_t LightGreen50 = 0xfff1f8e9; - const color_t LightGreen100 = 0xffdcedc8; - const color_t LightGreen200 = 0xffc5e1a5; - const color_t LightGreen300 = 0xffaed581; - const color_t LightGreen400 = 0xff9ccc65; - const color_t LightGreen500 = 0xff8bc34a; - const color_t LightGreen600 = 0xff7cb342; - const color_t LightGreen700 = 0xff689f38; - const color_t LightGreen800 = 0xff558b2f; - const color_t LightGreen900 = 0xff33691e; - const color_t LightGreenA100 = 0xffccff90; - const color_t LightGreenA200 = 0xffb2ff59; - const color_t LightGreenA400 = 0xff76ff03; - const color_t LightGreenA700 = 0xff64dd17; + EASY_CONSTEXPR color_t LightGreen50 = 0xfff1f8e9; + EASY_CONSTEXPR color_t LightGreen100 = 0xffdcedc8; + EASY_CONSTEXPR color_t LightGreen200 = 0xffc5e1a5; + EASY_CONSTEXPR color_t LightGreen300 = 0xffaed581; + EASY_CONSTEXPR color_t LightGreen400 = 0xff9ccc65; + EASY_CONSTEXPR color_t LightGreen500 = 0xff8bc34a; + EASY_CONSTEXPR color_t LightGreen600 = 0xff7cb342; + EASY_CONSTEXPR color_t LightGreen700 = 0xff689f38; + EASY_CONSTEXPR color_t LightGreen800 = 0xff558b2f; + EASY_CONSTEXPR color_t LightGreen900 = 0xff33691e; + EASY_CONSTEXPR color_t LightGreenA100 = 0xffccff90; + EASY_CONSTEXPR color_t LightGreenA200 = 0xffb2ff59; + EASY_CONSTEXPR color_t LightGreenA400 = 0xff76ff03; + EASY_CONSTEXPR color_t LightGreenA700 = 0xff64dd17; - const color_t Lime50 = 0xfff9ebe7; - const color_t Lime100 = 0xfff0f4c3; - const color_t Lime200 = 0xffe6ee9c; - const color_t Lime300 = 0xffdce775; - const color_t Lime400 = 0xffd4e157; - const color_t Lime500 = 0xffcddc39; - const color_t Lime600 = 0xffc0ca33; - const color_t Lime700 = 0xffafb42b; - const color_t Lime800 = 0xff9e9d24; - const color_t Lime900 = 0xff827717; - const color_t LimeA100 = 0xfff4ff81; - const color_t LimeA200 = 0xffeeff41; - const color_t LimeA400 = 0xffc6ff00; - const color_t LimeA700 = 0xffaeea00; + EASY_CONSTEXPR color_t Lime50 = 0xfff9ebe7; + EASY_CONSTEXPR color_t Lime100 = 0xfff0f4c3; + EASY_CONSTEXPR color_t Lime200 = 0xffe6ee9c; + EASY_CONSTEXPR color_t Lime300 = 0xffdce775; + EASY_CONSTEXPR color_t Lime400 = 0xffd4e157; + EASY_CONSTEXPR color_t Lime500 = 0xffcddc39; + EASY_CONSTEXPR color_t Lime600 = 0xffc0ca33; + EASY_CONSTEXPR color_t Lime700 = 0xffafb42b; + EASY_CONSTEXPR color_t Lime800 = 0xff9e9d24; + EASY_CONSTEXPR color_t Lime900 = 0xff827717; + EASY_CONSTEXPR color_t LimeA100 = 0xfff4ff81; + EASY_CONSTEXPR color_t LimeA200 = 0xffeeff41; + EASY_CONSTEXPR color_t LimeA400 = 0xffc6ff00; + EASY_CONSTEXPR color_t LimeA700 = 0xffaeea00; - const color_t Yellow50 = 0xfffffde7; - const color_t Yellow100 = 0xfffff9c4; - const color_t Yellow200 = 0xfffff59d; - const color_t Yellow300 = 0xfffff176; - const color_t Yellow400 = 0xffffee58; - const color_t Yellow500 = 0xffffeb3b; - const color_t Yellow600 = 0xfffdd835; - const color_t Yellow700 = 0xfffbc02d; - const color_t Yellow800 = 0xfff9a825; - const color_t Yellow900 = 0xfff57f17; - const color_t YellowA100 = 0xffffff8d; - const color_t YellowA200 = 0xffffff00; - const color_t YellowA400 = 0xffffea00; - const color_t YellowA700 = 0xffffd600; + EASY_CONSTEXPR color_t Yellow50 = 0xfffffde7; + EASY_CONSTEXPR color_t Yellow100 = 0xfffff9c4; + EASY_CONSTEXPR color_t Yellow200 = 0xfffff59d; + EASY_CONSTEXPR color_t Yellow300 = 0xfffff176; + EASY_CONSTEXPR color_t Yellow400 = 0xffffee58; + EASY_CONSTEXPR color_t Yellow500 = 0xffffeb3b; + EASY_CONSTEXPR color_t Yellow600 = 0xfffdd835; + EASY_CONSTEXPR color_t Yellow700 = 0xfffbc02d; + EASY_CONSTEXPR color_t Yellow800 = 0xfff9a825; + EASY_CONSTEXPR color_t Yellow900 = 0xfff57f17; + EASY_CONSTEXPR color_t YellowA100 = 0xffffff8d; + EASY_CONSTEXPR color_t YellowA200 = 0xffffff00; + EASY_CONSTEXPR color_t YellowA400 = 0xffffea00; + EASY_CONSTEXPR color_t YellowA700 = 0xffffd600; - const color_t Amber50 = 0xfffff8e1; - const color_t Amber100 = 0xffffecb3; - const color_t Amber200 = 0xffffe082; - const color_t Amber300 = 0xffffd54f; - const color_t Amber400 = 0xffffca28; - const color_t Amber500 = 0xffffc107; - const color_t Amber600 = 0xffffb300; - const color_t Amber700 = 0xffffa000; - const color_t Amber800 = 0xffff8f00; - const color_t Amber900 = 0xffff6f00; - const color_t AmberA100 = 0xffffe57f; - const color_t AmberA200 = 0xffffd740; - const color_t AmberA400 = 0xffffc400; - const color_t AmberA700 = 0xffffab00; + EASY_CONSTEXPR color_t Amber50 = 0xfffff8e1; + EASY_CONSTEXPR color_t Amber100 = 0xffffecb3; + EASY_CONSTEXPR color_t Amber200 = 0xffffe082; + EASY_CONSTEXPR color_t Amber300 = 0xffffd54f; + EASY_CONSTEXPR color_t Amber400 = 0xffffca28; + EASY_CONSTEXPR color_t Amber500 = 0xffffc107; + EASY_CONSTEXPR color_t Amber600 = 0xffffb300; + EASY_CONSTEXPR color_t Amber700 = 0xffffa000; + EASY_CONSTEXPR color_t Amber800 = 0xffff8f00; + EASY_CONSTEXPR color_t Amber900 = 0xffff6f00; + EASY_CONSTEXPR color_t AmberA100 = 0xffffe57f; + EASY_CONSTEXPR color_t AmberA200 = 0xffffd740; + EASY_CONSTEXPR color_t AmberA400 = 0xffffc400; + EASY_CONSTEXPR color_t AmberA700 = 0xffffab00; - const color_t Orange50 = 0xfffff3e0; - const color_t Orange100 = 0xffffe0b2; - const color_t Orange200 = 0xffffcc80; - const color_t Orange300 = 0xffffb74d; - const color_t Orange400 = 0xffffa726; - const color_t Orange500 = 0xffff9800; - const color_t Orange600 = 0xfffb8c00; - const color_t Orange700 = 0xfff57c00; - const color_t Orange800 = 0xffef6c00; - const color_t Orange900 = 0xffe65100; - const color_t OrangeA100 = 0xffffd180; - const color_t OrangeA200 = 0xffffab40; - const color_t OrangeA400 = 0xffff9100; - const color_t OrangeA700 = 0xffff6d00; + EASY_CONSTEXPR color_t Orange50 = 0xfffff3e0; + EASY_CONSTEXPR color_t Orange100 = 0xffffe0b2; + EASY_CONSTEXPR color_t Orange200 = 0xffffcc80; + EASY_CONSTEXPR color_t Orange300 = 0xffffb74d; + EASY_CONSTEXPR color_t Orange400 = 0xffffa726; + EASY_CONSTEXPR color_t Orange500 = 0xffff9800; + EASY_CONSTEXPR color_t Orange600 = 0xfffb8c00; + EASY_CONSTEXPR color_t Orange700 = 0xfff57c00; + EASY_CONSTEXPR color_t Orange800 = 0xffef6c00; + EASY_CONSTEXPR color_t Orange900 = 0xffe65100; + EASY_CONSTEXPR color_t OrangeA100 = 0xffffd180; + EASY_CONSTEXPR color_t OrangeA200 = 0xffffab40; + EASY_CONSTEXPR color_t OrangeA400 = 0xffff9100; + EASY_CONSTEXPR color_t OrangeA700 = 0xffff6d00; - const color_t DeepOrange50 = 0xfffbe9e7; - const color_t DeepOrange100 = 0xffffccbc; - const color_t DeepOrange200 = 0xffffab91; - const color_t DeepOrange300 = 0xffff8a65; - const color_t DeepOrange400 = 0xffff7043; - const color_t DeepOrange500 = 0xffff5722; - const color_t DeepOrange600 = 0xfff4511e; - const color_t DeepOrange700 = 0xffe64a19; - const color_t DeepOrange800 = 0xffd84315; - const color_t DeepOrange900 = 0xffbf360c; - const color_t DeepOrangeA100 = 0xffff9e80; - const color_t DeepOrangeA200 = 0xffff6e40; - const color_t DeepOrangeA400 = 0xffff3d00; - const color_t DeepOrangeA700 = 0xffdd2c00; + EASY_CONSTEXPR color_t DeepOrange50 = 0xfffbe9e7; + EASY_CONSTEXPR color_t DeepOrange100 = 0xffffccbc; + EASY_CONSTEXPR color_t DeepOrange200 = 0xffffab91; + EASY_CONSTEXPR color_t DeepOrange300 = 0xffff8a65; + EASY_CONSTEXPR color_t DeepOrange400 = 0xffff7043; + EASY_CONSTEXPR color_t DeepOrange500 = 0xffff5722; + EASY_CONSTEXPR color_t DeepOrange600 = 0xfff4511e; + EASY_CONSTEXPR color_t DeepOrange700 = 0xffe64a19; + EASY_CONSTEXPR color_t DeepOrange800 = 0xffd84315; + EASY_CONSTEXPR color_t DeepOrange900 = 0xffbf360c; + EASY_CONSTEXPR color_t DeepOrangeA100 = 0xffff9e80; + EASY_CONSTEXPR color_t DeepOrangeA200 = 0xffff6e40; + EASY_CONSTEXPR color_t DeepOrangeA400 = 0xffff3d00; + EASY_CONSTEXPR color_t DeepOrangeA700 = 0xffdd2c00; - const color_t Brown50 = 0xffefebe9; - const color_t Brown100 = 0xffd7ccc8; - const color_t Brown200 = 0xffbcaaa4; - const color_t Brown300 = 0xffa1887f; - const color_t Brown400 = 0xff8d6e63; - const color_t Brown500 = 0xff795548; - const color_t Brown600 = 0xff6d4c41; - const color_t Brown700 = 0xff5d4037; - const color_t Brown800 = 0xff4e342e; - const color_t Brown900 = 0xff3e2723; + EASY_CONSTEXPR color_t Brown50 = 0xffefebe9; + EASY_CONSTEXPR color_t Brown100 = 0xffd7ccc8; + EASY_CONSTEXPR color_t Brown200 = 0xffbcaaa4; + EASY_CONSTEXPR color_t Brown300 = 0xffa1887f; + EASY_CONSTEXPR color_t Brown400 = 0xff8d6e63; + EASY_CONSTEXPR color_t Brown500 = 0xff795548; + EASY_CONSTEXPR color_t Brown600 = 0xff6d4c41; + EASY_CONSTEXPR color_t Brown700 = 0xff5d4037; + EASY_CONSTEXPR color_t Brown800 = 0xff4e342e; + EASY_CONSTEXPR color_t Brown900 = 0xff3e2723; - const color_t Grey50 = 0xfffafafa; - const color_t Grey100 = 0xfff5f5f5; - const color_t Grey200 = 0xffeeeeee; - const color_t Grey300 = 0xffe0e0e0; - const color_t Grey400 = 0xffbdbdbd; - const color_t Grey500 = 0xff9e9e9e; - const color_t Grey600 = 0xff757575; - const color_t Grey700 = 0xff616161; - const color_t Grey800 = 0xff424242; - const color_t Grey900 = 0xff212121; + EASY_CONSTEXPR color_t Grey50 = 0xfffafafa; + EASY_CONSTEXPR color_t Grey100 = 0xfff5f5f5; + EASY_CONSTEXPR color_t Grey200 = 0xffeeeeee; + EASY_CONSTEXPR color_t Grey300 = 0xffe0e0e0; + EASY_CONSTEXPR color_t Grey400 = 0xffbdbdbd; + EASY_CONSTEXPR color_t Grey500 = 0xff9e9e9e; + EASY_CONSTEXPR color_t Grey600 = 0xff757575; + EASY_CONSTEXPR color_t Grey700 = 0xff616161; + EASY_CONSTEXPR color_t Grey800 = 0xff424242; + EASY_CONSTEXPR color_t Grey900 = 0xff212121; - const color_t BlueGrey50 = 0xffeceff1; - const color_t BlueGrey100 = 0xffcfd8dc; - const color_t BlueGrey200 = 0xffb0bec5; - const color_t BlueGrey300 = 0xff90a4ae; - const color_t BlueGrey400 = 0xff78909c; - const color_t BlueGrey500 = 0xff607d8b; - const color_t BlueGrey600 = 0xff546e7a; - const color_t BlueGrey700 = 0xff455a64; - const color_t BlueGrey800 = 0xff37474f; - const color_t BlueGrey900 = 0xff263238; + EASY_CONSTEXPR color_t BlueGrey50 = 0xffeceff1; + EASY_CONSTEXPR color_t BlueGrey100 = 0xffcfd8dc; + EASY_CONSTEXPR color_t BlueGrey200 = 0xffb0bec5; + EASY_CONSTEXPR color_t BlueGrey300 = 0xff90a4ae; + EASY_CONSTEXPR color_t BlueGrey400 = 0xff78909c; + EASY_CONSTEXPR color_t BlueGrey500 = 0xff607d8b; + EASY_CONSTEXPR color_t BlueGrey600 = 0xff546e7a; + EASY_CONSTEXPR color_t BlueGrey700 = 0xff455a64; + EASY_CONSTEXPR color_t BlueGrey800 = 0xff37474f; + EASY_CONSTEXPR color_t BlueGrey900 = 0xff263238; - const color_t Black = 0xff000000; - const color_t White = 0xffffffff; - const color_t Null = 0x00000000; + EASY_CONSTEXPR color_t Black = 0xff000000; + EASY_CONSTEXPR color_t White = 0xffffffff; + EASY_CONSTEXPR color_t Null = 0x00000000; - const color_t Red = Red500; - const color_t DarkRed = Red900; - const color_t Coral = Red200; - const color_t RichRed = 0xffff0000; - const color_t Pink = Pink500; - const color_t Rose = PinkA100; - const color_t Purple = Purple500; - const color_t Magenta = PurpleA200; - const color_t DarkMagenta = PurpleA700; - const color_t DeepPurple = DeepPurple500; - const color_t Indigo = Indigo500; - const color_t Blue = Blue500; - const color_t DarkBlue = Blue900; - const color_t RichBlue = 0xff0000ff; - const color_t LightBlue = LightBlue500; - const color_t SkyBlue = LightBlueA100; - const color_t Navy = LightBlue800; - const color_t Cyan = Cyan500; - const color_t DarkCyan = Cyan900; - const color_t Teal = Teal500; - const color_t DarkTeal = Teal900; - const color_t Green = Green500; - const color_t DarkGreen = Green900; - const color_t RichGreen = 0xff00ff00; - const color_t LightGreen = LightGreen500; - const color_t Mint = LightGreen900; - const color_t Lime = Lime500; - const color_t Olive = Lime900; - const color_t Yellow = Yellow500; - const color_t RichYellow = YellowA200; - const color_t Amber = Amber500; - const color_t Gold = Amber300; - const color_t PaleGold = AmberA100; - const color_t Orange = Orange500; - const color_t Skin = Orange100; - const color_t DeepOrange = DeepOrange500; - const color_t Brick = DeepOrange900; - const color_t Brown = Brown500; - const color_t DarkBrown = Brown900; - const color_t CreamWhite = Orange50; - const color_t Wheat = Amber100; - const color_t Grey = Grey500; - const color_t Dark = Grey900; - const color_t Silver = Grey300; - const color_t BlueGrey = BlueGrey500; + EASY_CONSTEXPR color_t Red = Red500; + EASY_CONSTEXPR color_t DarkRed = Red900; + EASY_CONSTEXPR color_t Coral = Red200; + EASY_CONSTEXPR color_t RichRed = 0xffff0000; + EASY_CONSTEXPR color_t Pink = Pink500; + EASY_CONSTEXPR color_t Rose = PinkA100; + EASY_CONSTEXPR color_t Purple = Purple500; + EASY_CONSTEXPR color_t Magenta = PurpleA200; + EASY_CONSTEXPR color_t DarkMagenta = PurpleA700; + EASY_CONSTEXPR color_t DeepPurple = DeepPurple500; + EASY_CONSTEXPR color_t Indigo = Indigo500; + EASY_CONSTEXPR color_t Blue = Blue500; + EASY_CONSTEXPR color_t DarkBlue = Blue900; + EASY_CONSTEXPR color_t RichBlue = 0xff0000ff; + EASY_CONSTEXPR color_t LightBlue = LightBlue500; + EASY_CONSTEXPR color_t SkyBlue = LightBlueA100; + EASY_CONSTEXPR color_t Navy = LightBlue800; + EASY_CONSTEXPR color_t Cyan = Cyan500; + EASY_CONSTEXPR color_t DarkCyan = Cyan900; + EASY_CONSTEXPR color_t Teal = Teal500; + EASY_CONSTEXPR color_t DarkTeal = Teal900; + EASY_CONSTEXPR color_t Green = Green500; + EASY_CONSTEXPR color_t DarkGreen = Green900; + EASY_CONSTEXPR color_t RichGreen = 0xff00ff00; + EASY_CONSTEXPR color_t LightGreen = LightGreen500; + EASY_CONSTEXPR color_t Mint = LightGreen900; + EASY_CONSTEXPR color_t Lime = Lime500; + EASY_CONSTEXPR color_t Olive = Lime900; + EASY_CONSTEXPR color_t Yellow = Yellow500; + EASY_CONSTEXPR color_t RichYellow = YellowA200; + EASY_CONSTEXPR color_t Amber = Amber500; + EASY_CONSTEXPR color_t Gold = Amber300; + EASY_CONSTEXPR color_t PaleGold = AmberA100; + EASY_CONSTEXPR color_t Orange = Orange500; + EASY_CONSTEXPR color_t Skin = Orange100; + EASY_CONSTEXPR color_t DeepOrange = DeepOrange500; + EASY_CONSTEXPR color_t Brick = DeepOrange900; + EASY_CONSTEXPR color_t Brown = Brown500; + EASY_CONSTEXPR color_t DarkBrown = Brown900; + EASY_CONSTEXPR color_t CreamWhite = Orange50; + EASY_CONSTEXPR color_t Wheat = Amber100; + EASY_CONSTEXPR color_t Grey = Grey500; + EASY_CONSTEXPR color_t Dark = Grey900; + EASY_CONSTEXPR color_t Silver = Grey300; + EASY_CONSTEXPR color_t BlueGrey = BlueGrey500; - const color_t Default = Wheat; + EASY_CONSTEXPR color_t Default = Wheat; #else - const color_t Default = 0xffffecb3; + EASY_CONSTEXPR color_t Default = 0xffffecb3; #endif // #if !defined(EASY_OPTION_BUILTIN_COLORS) || EASY_OPTION_BUILTIN_COLORS == 0 } // END of namespace colors. diff --git a/profiler_gui/CMakeLists.txt b/profiler_gui/CMakeLists.txt index 448d53d..4a77c3e 100644 --- a/profiler_gui/CMakeLists.txt +++ b/profiler_gui/CMakeLists.txt @@ -16,6 +16,7 @@ if (Qt5Widgets_FOUND) blocks_graphics_view.cpp blocks_tree_widget.h blocks_tree_widget.cpp + common_types.h descriptors_tree_widget.h descriptors_tree_widget.cpp easy_chronometer_item.h diff --git a/profiler_gui/blocks_graphics_view.cpp b/profiler_gui/blocks_graphics_view.cpp index 8ea248a..930d7e2 100644 --- a/profiler_gui/blocks_graphics_view.cpp +++ b/profiler_gui/blocks_graphics_view.cpp @@ -90,9 +90,10 @@ const qreal BASE_SCALE = pow(::profiler_gui::SCALING_COEFFICIENT_INV, 25); // ~0 EASY_CONSTEXPR uint16_t TIMELINE_ROW_SIZE = 20; -EASY_CONSTEXPR QRgb BACKGROUND_1 = ::profiler::colors::Grey300; +EASY_CONSTEXPR QRgb BACKGROUND_1 = 0xffe4e4ec; EASY_CONSTEXPR QRgb BACKGROUND_2 = ::profiler::colors::White; EASY_CONSTEXPR QRgb TIMELINE_BACKGROUND = 0x20000000 | (::profiler::colors::Grey800 & 0x00ffffff);// 0x20303030; +EASY_CONSTEXPR QRgb TIMELINE_BORDER = 0xffa8a0a0; EASY_CONSTEXPR int IDLE_TIMER_INTERVAL = 200; // 5Hz EASY_CONSTEXPR uint64_t IDLE_TIME = 400; @@ -148,6 +149,7 @@ void EasyBackgroundItem::paint(QPainter* _painter, const QStyleOptionGraphicsIte const auto left = offset * currentScale; const auto h = visibleSceneRect.height(); const auto visibleBottom = h - 1; + const auto borderColor = QColor::fromRgb(TIMELINE_BORDER); QRectF rect; @@ -162,7 +164,7 @@ void EasyBackgroundItem::paint(QPainter* _painter, const QStyleOptionGraphicsIte int i = -1; // Draw background - _painter->setPen(Qt::NoPen); + _painter->setPen(::profiler_gui::SYSTEM_BORDER_COLOR); for (auto item : items) { ++i; @@ -202,11 +204,11 @@ void EasyBackgroundItem::paint(QPainter* _painter, const QStyleOptionGraphicsIte const auto nsteps = (1 + odd) * 2 + static_cast(visibleSceneRect.width() / step); first -= odd; - QPen pen(Qt::darkGray); + QPen pen(borderColor); pen.setWidth(2); _painter->setPen(pen); _painter->drawLine(QPointF(0, h), QPointF(visibleSceneRect.width(), h)); - _painter->setPen(Qt::darkGray); + _painter->setPen(borderColor); QLineF marks[20]; qreal first_x = first * sceneStep; @@ -238,9 +240,9 @@ void EasyBackgroundItem::paint(QPainter* _painter, const QStyleOptionGraphicsIte if (next <= 0) { next = n; - _painter->setPen(Qt::black); + _painter->setPen(::profiler_gui::TEXT_COLOR); _painter->drawText(QPointF(current + 1, h + 17), QString::number(static_cast(0.5 + (current + left) * factor / currentScale))); - _painter->setPen(Qt::darkGray); + _painter->setPen(borderColor); } // TEST @@ -2061,7 +2063,7 @@ void EasyThreadNameItem::paint(QPainter* _painter, const QStyleOptionGraphicsIte const auto h = visibleSceneRect.height() + TIMELINE_ROW_SIZE - 2; const auto w = parentView->width();//parentView->sceneRect().width(); - static const uint16_t OVERLAP = ::profiler_gui::THREADS_ROW_SPACING >> 1; + EASY_STATIC_CONSTEXPR uint16_t OVERLAP = ::profiler_gui::THREADS_ROW_SPACING >> 1; static const QBrush brushes[2] = {QColor::fromRgb(BACKGROUND_1), QColor::fromRgb(BACKGROUND_2)}; int i = -1; @@ -2101,11 +2103,11 @@ void EasyThreadNameItem::paint(QPainter* _painter, const QStyleOptionGraphicsIte rect.setRect(0, top, w, hgt); - _painter->setPen(Qt::NoPen); + _painter->setPen(::profiler_gui::SYSTEM_BORDER_COLOR); _painter->drawRect(rect); rect.translate(-5, 0); - _painter->setPen(QColor::fromRgb(::profiler::colors::Dark)); + _painter->setPen(::profiler_gui::TEXT_COLOR); _painter->drawText(rect, Qt::AlignRight | Qt::AlignVCenter, item->threadName()); } @@ -2116,12 +2118,12 @@ void EasyThreadNameItem::paint(QPainter* _painter, const QStyleOptionGraphicsIte rect.translate(5, rect.height()); rect.setHeight(h - rect_bottom); _painter->setBrush(brushes[i & 1]); - _painter->setPen(Qt::NoPen); + _painter->setPen(::profiler_gui::SYSTEM_BORDER_COLOR); _painter->drawRect(rect); } // Draw separator between thread names area and information area - _painter->setPen(Qt::darkGray); + _painter->setPen(::profiler_gui::SYSTEM_BORDER_COLOR); _painter->drawLine(QLineF(0, h, w, h)); _painter->drawLine(QLineF(0, h + 2, w, h + 2)); diff --git a/profiler_gui/blocks_tree_widget.cpp b/profiler_gui/blocks_tree_widget.cpp index 43ffbc0..56b3939 100644 --- a/profiler_gui/blocks_tree_widget.cpp +++ b/profiler_gui/blocks_tree_widget.cpp @@ -63,6 +63,7 @@ #include #include +#include #include #include #include @@ -153,6 +154,7 @@ EasyTreeWidget::EasyTreeWidget(QWidget* _parent) setAnimated(true); setSortingEnabled(false); setColumnCount(COL_COLUMNS_NUMBER); + setSelectionBehavior(QAbstractItemView::SelectRows); auto header_item = new QTreeWidgetItem(); auto f = header()->font(); @@ -612,19 +614,25 @@ void EasyTreeWidget::contextMenuEvent(QContextMenuEvent* _event) menu.addSeparator(); } - action = menu.addAction("Hierarchy mode"); - action->setToolTip("Display full blocks hierarchy"); - action->setCheckable(true); - action->setChecked(m_mode == EasyTreeMode_Full); - action->setData((quint32)EasyTreeMode_Full); - connect(action, &QAction::triggered, this, &This::onModeChange); + auto actionGroup = new QActionGroup(&menu); + actionGroup->setExclusive(true); - action = menu.addAction("Plain mode"); - action->setToolTip("Display plain list of blocks per frame.\nSome columns are disabled with this mode."); - action->setCheckable(true); - action->setChecked(m_mode == EasyTreeMode_Plain); - action->setData((quint32)EasyTreeMode_Plain); - connect(action, &QAction::triggered, this, &This::onModeChange); + auto actionHierarchy = new QAction("Hierarchy mode", actionGroup); + actionHierarchy->setCheckable(true); + actionHierarchy->setChecked(m_mode == EasyTreeMode_Full); + actionHierarchy->setToolTip("Display full blocks hierarchy"); + actionHierarchy->setData((quint32)EasyTreeMode_Full); + menu.addAction(actionHierarchy); + + auto actionPlain = new QAction("Plain mode", actionGroup); + actionPlain->setCheckable(true); + actionPlain->setChecked(m_mode == EasyTreeMode_Plain); + actionPlain->setToolTip("Display plain list of blocks per frame.\nSome columns are disabled with this mode."); + actionPlain->setData((quint32)EasyTreeMode_Plain); + menu.addAction(actionPlain); + + connect(actionHierarchy, &QAction::triggered, this, &This::onModeChange); + connect(actionPlain, &QAction::triggered, this, &This::onModeChange); menu.addSeparator(); @@ -904,11 +912,7 @@ void EasyTreeWidget::onItemCollapse(QTreeWidgetItem* _item) void EasyTreeWidget::onCurrentItemChange(QTreeWidgetItem* _item, QTreeWidgetItem* _previous) { if (_previous != nullptr) - { - auto f = font(); - for (int i = 0; i < COL_COLUMNS_NUMBER; ++i) - _previous->setFont(i, f); - } + static_cast(_previous)->setBold(false); if (_item == nullptr) { @@ -917,12 +921,10 @@ void EasyTreeWidget::onCurrentItemChange(QTreeWidgetItem* _item, QTreeWidgetItem } else { - auto f = font(); - f.setBold(true); - for (int i = 0; i < COL_COLUMNS_NUMBER; ++i) - _item->setFont(i, f); + auto item = static_cast(_item); + item->setBold(true); - EASY_GLOBALS.selected_block = static_cast(_item)->block_index(); + EASY_GLOBALS.selected_block = item->block_index(); if (EASY_GLOBALS.selected_block < EASY_GLOBALS.gui_blocks.size()) EASY_GLOBALS.selected_block_id = easyBlock(EASY_GLOBALS.selected_block).tree.node->id(); else @@ -997,13 +999,13 @@ void EasyTreeWidget::onSelectedBlockChange(uint32_t _block_index) #endif } + auto previous = static_cast(currentItem()); + if (previous != nullptr) + previous->setBold(false); + if (item != nullptr) { //const QSignalBlocker b(this); - auto previous = currentItem(); - auto f = font(); - if (previous != nullptr) for (int i = 0; i < COL_COLUMNS_NUMBER; ++i) - previous->setFont(i, f); if (EASY_GLOBALS.bind_scene_and_tree_expand_status) { @@ -1028,20 +1030,10 @@ void EasyTreeWidget::onSelectedBlockChange(uint32_t _block_index) connect(this, &Parent::itemExpanded, this, &This::onItemExpand); } - f.setBold(true); - for (int i = 0; i < COL_COLUMNS_NUMBER; ++i) - item->setFont(i, f); + item->setBold(true); } else { - auto previous = currentItem(); - if (previous != nullptr) - { - auto f = font(); - for (int i = 0; i < COL_COLUMNS_NUMBER; ++i) - previous->setFont(i, f); - } - setCurrentItem(item); } diff --git a/profiler_gui/common_types.h b/profiler_gui/common_types.h index 9fbe565..c24c647 100644 --- a/profiler_gui/common_types.h +++ b/profiler_gui/common_types.h @@ -478,6 +478,38 @@ inline QString valueString(const ::profiler::ArbitraryValue& _serializedValue) } // END of namespace profiler_gui. +template +struct Overload +{ + template + static EASY_CONSTEXPR_FCN auto of(TReturn (TClass::*method)(Args...)) -> decltype(method) + { + return method; + } + + template + static EASY_CONSTEXPR_FCN auto of(TReturn (*func)(Args...)) -> decltype(func) + { + return func; + } +}; + +template <> +struct Overload +{ + template + static EASY_CONSTEXPR_FCN auto of(TReturn (TClass::*method)()) -> decltype(method) + { + return method; + } + + template + static EASY_CONSTEXPR_FCN auto of(TReturn (*func)()) -> decltype(func) + { + return func; + } +}; + ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// diff --git a/profiler_gui/default.css b/profiler_gui/default.css index f7d68fd..7d4eaaa 100644 --- a/profiler_gui/default.css +++ b/profiler_gui/default.css @@ -15,67 +15,122 @@ * { font-family: "DejaVu Sans"; font-size: 13px; - color: #686060; } + color: #504040; } *:disabled { - color: #b8b0b0; } + color: #a08888; } EasyMainWindow, QToolBar, QDialog { - background-color: #fffbfb; } + background-color: #f8f2f2; } + +QToolTip { + border: 1px solid #cccccc; } /* ****************************************************************************************************************** */ -QLineEdit, QComboBox { +QLineEdit, QComboBox, QSpinBox { height: 24px; border: 1px solid #cccccc; background-color: white; - selection-background-color: rgba(152, 206, 152, 0.4); - selection-color: #686060; } + selection-background-color: rgba(136, 189, 136, 0.4); + selection-color: #504040; } -QLineEdit:disabled, QComboBox:disabled { - background-color: #dddddd; - color: #b8b0b0; - selection-background-color: rgba(152, 206, 152, 0.4); - selection-color: #b8b0b0; } +QLineEdit:disabled, QComboBox:disabled, QSpinBox:disabled { + background-color: #f0f0f0; + color: #a08888; + selection-background-color: rgba(136, 189, 136, 0.4); + selection-color: #a08888; } QLineEdit:focus { border: 1px solid #ffbcbc; } +/* ****************************************************************************************************************** */ QComboBox::drop-down { subcontrol-origin: padding; subcontrol-position: top right; - width: 20px; - border-left: none; + width: 24px; + border: none; margin-left: 0; } QComboBox::down-arrow { - image: url(":/images/combo-arrow"); + image: url(":/images/arrow-down"); height: 8px; width: 8px; } +QComboBox::down-arrow:hover { + image: url(":/images/arrow-down-hover"); } + QComboBox::down-arrow:disabled { - image: url(":/images/combo-arrow-disabled"); + image: url(":/images/arrow-down-disabled"); } + +/* ****************************************************************************************************************** */ +QSpinBox::up-button { + subcontrol-origin: padding; + subcontrol-position: top right; + margin-left: 5px; + width: 24px; + border-left: 1px solid #cccccc; + border-bottom: 1px solid #cccccc; } + +QSpinBox::down-button { + subcontrol-origin: padding; + subcontrol-position: bottom right; + margin-left: 5px; + width: 24px; + border-left: 1px solid #cccccc; } + +QSpinBox::up-button:pressed, QSpinBox::down-button:pressed { + background-color: #f4f4f4; } + +QSpinBox::up-arrow { + image: url(":/images/arrow-up"); height: 8px; width: 8px; } +QSpinBox::up-arrow:hover { + image: url(":/images/arrow-up-hover"); } + +QSpinBox::up-arrow:disabled { + image: url(":/images/arrow-up-disabled"); } + +QSpinBox::down-arrow { + image: url(":/images/arrow-down"); + height: 8px; + width: 8px; } + +QSpinBox::down-arrow:hover { + image: url(":/images/arrow-down-hover"); } + +QSpinBox::down-arrow:disabled { + image: url(":/images/arrow-down-disabled"); } + +/* ****************************************************************************************************************** */ QPushButton { height: 24px; border: 1px solid #cccccc; background-color: white; padding: 0 5px 0 5px; } +QPushButton:disabled { + background-color: #f0f0f0; + color: #a08888; } + QPushButton:hover { border: 1px solid #ffbcbc; - color: #d77d7d; } - -QPushButton:pressed { - border: 1px solid #d77d7d; color: #922c2c; } -QComboBox QListView { +QPushButton:pressed { + border: 1px solid #922c2c; + color: #370400; } + +/* ****************************************************************************************************************** */ +QListView { background-color: white; border: 1px solid #cccccc; - selection-background-color: rgba(152, 206, 152, 0.4); - selection-color: #686060; } + selection-background-color: rgba(136, 189, 136, 0.4); + selection-color: #504040; } + +QListView::item, QListView::item, QTableView::item, QTreeView::item { + height: 24px; } /* ****************************************************************************************************************** */ QMenu { @@ -85,18 +140,18 @@ QMenu { padding-bottom: 4px; } QMenu::item { - height: 22px; + height: 24px; padding: 0 16px 0 25px; border: 1px solid transparent; /* reserve space for selection border */ } QMenu::item:selected { - border: 1px solid rgba(152, 206, 152, 0.4); - background-color: rgba(152, 206, 152, 0.4); } + border: 1px solid rgba(136, 189, 136, 0.4); + background-color: rgba(136, 189, 136, 0.4); } QMenu::icon { - width: 12px; - height: 12px; + width: 14px; + height: 14px; background: none; border: 1px inset transparent; padding: 1px; @@ -218,7 +273,7 @@ QWidget#DiagramPopup, QWidget#ThreadsPopup { QProgressBar { height: 24px; background-color: white; - border: 1px solid #64BC64; + border: 1px solid #cccccc; color: #0B530B; text-align: center; } @@ -226,3 +281,48 @@ QProgressBar::chunk { background-color: #98DE98; width: 2px; margin: 0; } + +/* ****************************************************************************************************************** */ +QScrollBar { + background-color: transparent; + border: none; + padding: 0; } + +QScrollBar:hover { + background-color: rgba(0, 0, 0, 0.1); } + +QScrollBar:horizontal { + margin: 0; + height: 8px; } + +QScrollBar:vertical { + margin: 0; + width: 8px; } + +QScrollBar::handle { + background-color: rgba(0, 0, 0, 0.4); + border: none; + margin: 0; + padding: 0; } + +QScrollBar::handle:pressed { + background-color: rgba(0, 0, 0, 0.6); } + +QScrollBar::handle:vertical { + min-height: 20px; + margin-left: 4px; } + +QScrollBar::handle:vertical:hover, QScrollBar::handle:vertical:pressed { + margin-left: 0; } + +QScrollBar::handle:horizontal { + min-width: 20px; + max-width: 100px; + margin-top: 4px; } + +QScrollBar::handle:horizontal:hover, QScrollBar::handle:horizontal:pressed { + margin-top: 0; } + +QScrollBar::add-line, QScrollBar::sub-line { + background: none; + border: none; } diff --git a/profiler_gui/default.scss b/profiler_gui/default.scss index 2dd32ff..32d7ff0 100644 --- a/profiler_gui/default.scss +++ b/profiler_gui/default.scss @@ -15,15 +15,19 @@ /* ****************************************************************************************************************** */ /* Constants */ -$TextColor: #686060; -$DisabledTextColor: #b8b0b0; +$TextColor: #504040; +$DisabledTextColor: #a08888; $BorderColor: #cccccc; $MainColor: #f44336; -$HoveredMenuRowColor: rgb_a(#98CE98, 0.4); +$HoveredMenuRowColor: rgb_a(#88BD88, 0.4); $BackgroundColor: white; -$DisabledBackgroundColor: #dddddd; -$ButtonHoverColor: #d77d7d; -$ButtonPressedColor: #922c2c; +$DisabledBackgroundColor: #f0f0f0; +$ButtonHoverColor: #922c2c;//#d77d7d; +$ButtonPressedColor: #370400;//#922c2c; +$FocusBorderColor: #ffbcbc; +$DefaultHeight: 24px; +$ComboBoxArrowSize: 8px; +$SpinBoxArrowSize: 8px; /* ****************************************************************************************************************** */ /* StyleSheet */ @@ -39,49 +43,89 @@ $ButtonPressedColor: #922c2c; } EasyMainWindow, QToolBar, QDialog { - background-color: #fffbfb; + background-color: #f8f2f2; } - +QToolTip { + border: 1px solid $BorderColor; +} /* ****************************************************************************************************************** */ -QLineEdit, QComboBox { - height: 24px; +QLineEdit, QComboBox, QSpinBox { + height: $DefaultHeight; border: 1px solid $BorderColor; background-color: $BackgroundColor; selection-background-color: $HoveredMenuRowColor; selection-color: $TextColor; } -QLineEdit:disabled, QComboBox:disabled { +QLineEdit:disabled, QComboBox:disabled, QSpinBox:disabled { background-color: $DisabledBackgroundColor; color: $DisabledTextColor; selection-background-color: $HoveredMenuRowColor; selection-color: $DisabledTextColor; } -QLineEdit:focus { border: 1px solid #ffbcbc; } +QLineEdit:focus { border: 1px solid $FocusBorderColor; } +/* ****************************************************************************************************************** */ QComboBox::drop-down { subcontrol-origin: padding; subcontrol-position: top right; - width: 20px; - border-left: none; + width: $DefaultHeight; + border: none; margin-left: 0; } -QComboBox::down-arrow { image: url(":/images/combo-arrow"); height: 8px; width: 8px; } -QComboBox::down-arrow:disabled { image: url(":/images/combo-arrow-disabled"); height: 8px; width: 8px; } +QComboBox::down-arrow { image: url(":/images/arrow-down"); height: $ComboBoxArrowSize; width: $ComboBoxArrowSize; } +QComboBox::down-arrow:hover { image: url(":/images/arrow-down-hover"); } +QComboBox::down-arrow:disabled { image: url(":/images/arrow-down-disabled"); } +/* ****************************************************************************************************************** */ +QSpinBox::up-button { + subcontrol-origin: padding; + subcontrol-position: top right; + margin-left: 5px; + width: $DefaultHeight; + border-left: 1px solid $BorderColor; + border-bottom: 1px solid $BorderColor; +} + +QSpinBox::down-button { + subcontrol-origin: padding; + subcontrol-position: bottom right; + margin-left: 5px; + width: $DefaultHeight; + border-left: 1px solid $BorderColor; +} + +QSpinBox::up-button:pressed, QSpinBox::down-button:pressed { + background-color: #f4f4f4; +} + +QSpinBox::up-arrow { image: url(":/images/arrow-up"); height: $SpinBoxArrowSize; width: $SpinBoxArrowSize; } +QSpinBox::up-arrow:hover { image: url(":/images/arrow-up-hover"); } +QSpinBox::up-arrow:disabled { image: url(":/images/arrow-up-disabled"); } + +QSpinBox::down-arrow { image: url(":/images/arrow-down"); height: $SpinBoxArrowSize; width: $SpinBoxArrowSize; } +QSpinBox::down-arrow:hover { image: url(":/images/arrow-down-hover"); } +QSpinBox::down-arrow:disabled { image: url(":/images/arrow-down-disabled"); } + +/* ****************************************************************************************************************** */ QPushButton { - height: 24px; + height: $DefaultHeight; border: 1px solid $BorderColor; background-color: $BackgroundColor; padding: 0 5px 0 5px; } +QPushButton:disabled { + background-color: $DisabledBackgroundColor; + color: $DisabledTextColor; +} + QPushButton:hover { - border: 1px solid #ffbcbc; + border: 1px solid $FocusBorderColor; color: $ButtonHoverColor; } @@ -90,13 +134,18 @@ QPushButton:pressed { color: $ButtonPressedColor; } -QComboBox QListView { +/* ****************************************************************************************************************** */ +QListView { background-color: $BackgroundColor; border: 1px solid $BorderColor; selection-background-color: $HoveredMenuRowColor; selection-color: $TextColor; } +QListView::item, QListView::item, QTableView::item, QTreeView::item { + height: $DefaultHeight; +} + /* ****************************************************************************************************************** */ QMenu { background-color: $BackgroundColor; @@ -106,7 +155,7 @@ QMenu { } QMenu::item { - height: 22px; + height: $DefaultHeight; padding: 0 16px 0 25px; border: 1px solid transparent; /* reserve space for selection border */ } @@ -117,8 +166,8 @@ QMenu::item:selected { } QMenu::icon { - width: 12px; - height: 12px; + width: 14px; + height: 14px; background: none; border: 1px inset transparent; padding: 1px; @@ -251,9 +300,9 @@ QWidget#DiagramPopup, QWidget#ThreadsPopup { /* ****************************************************************************************************************** */ QProgressBar { - height: 24px; + height: $DefaultHeight; background-color: $BackgroundColor; - border: 1px solid #64BC64; + border: 1px solid $BorderColor;//#64BC64; color: #0B530B; text-align: center; } @@ -263,3 +312,46 @@ QProgressBar::chunk { width: 2px; margin: 0; } + +/* ****************************************************************************************************************** */ +QScrollBar { + background-color: transparent; + border: none; + padding: 0; +} + +QScrollBar:hover { + background-color: rgb_a(#000000, 0.1); +} + +QScrollBar:horizontal { + margin: 0; + height: 8px; +} + +QScrollBar:vertical { + margin: 0; + width: 8px; +} + +QScrollBar::handle { + background-color: rgb_a(#000000, 0.4); + border: none; + margin: 0; + padding: 0; +} + +QScrollBar::handle:pressed { + background-color: rgb_a(#000000, 0.6); +} + +QScrollBar::handle:vertical { min-height: 20px; margin-left: 4px; } +QScrollBar::handle:vertical:hover, QScrollBar::handle:vertical:pressed { margin-left: 0; } + +QScrollBar::handle:horizontal { min-width: 20px; max-width: 100px; margin-top: 4px; } +QScrollBar::handle:horizontal:hover, QScrollBar::handle:horizontal:pressed { margin-top: 0; } + +QScrollBar::add-line, QScrollBar::sub-line { + background: none; + border: none; +} diff --git a/profiler_gui/easy_graphics_item.cpp b/profiler_gui/easy_graphics_item.cpp index c996ccf..403f675 100644 --- a/profiler_gui/easy_graphics_item.cpp +++ b/profiler_gui/easy_graphics_item.cpp @@ -245,7 +245,7 @@ void EasyGraphicsItem::paintChildren(const float _minWidth, const int _narrowSiz //p.inverseColor = 0xffffffff - p.previousColor; p.is_light = ::profiler_gui::isLightColor(p.previousColor); p.textColor = ::profiler_gui::textColorForFlag(p.is_light); - p.brush.setColor(p.previousColor); + p.brush.setColor(QColor::fromRgba(p.previousColor)); _painter->setBrush(p.brush); } @@ -328,7 +328,7 @@ void EasyGraphicsItem::paintChildren(const float _minWidth, const int _narrowSiz //p.inverseColor = 0xffffffff - p.previousColor; p.is_light = ::profiler_gui::isLightColor(p.previousColor); p.textColor = ::profiler_gui::textColorForFlag(p.is_light); - p.brush.setColor(p.previousColor); + p.brush.setColor(QColor::fromRgba(p.previousColor)); _painter->setBrush(p.brush); } @@ -657,7 +657,7 @@ void EasyGraphicsItem::paint(QPainter* _painter, const QStyleOptionGraphicsItem* //p.inverseColor = 0xffffffff - p.previousColor; p.is_light = ::profiler_gui::isLightColor(p.previousColor); p.textColor = ::profiler_gui::textColorForFlag(p.is_light); - p.brush.setColor(p.previousColor); + p.brush.setColor(QColor::fromRgba(p.previousColor)); _painter->setBrush(p.brush); } @@ -739,7 +739,7 @@ void EasyGraphicsItem::paint(QPainter* _painter, const QStyleOptionGraphicsItem* //p.inverseColor = 0xffffffff - p.previousColor; p.is_light = ::profiler_gui::isLightColor(p.previousColor); p.textColor = ::profiler_gui::textColorForFlag(p.is_light); - p.brush.setColor(p.previousColor); + p.brush.setColor(QColor::fromRgba(p.previousColor)); _painter->setBrush(p.brush); } @@ -896,7 +896,7 @@ void EasyGraphicsItem::paint(QPainter* _painter, const QStyleOptionGraphicsItem* if (!p.selectedItemsWasPainted) { - p.brush.setColor(itemDesc.color());// SELECTED_ITEM_COLOR); + p.brush.setColor(QColor::fromRgba(itemDesc.color()));// SELECTED_ITEM_COLOR); _painter->setBrush(p.brush); } else diff --git a/profiler_gui/easy_graphics_scrollbar.cpp b/profiler_gui/easy_graphics_scrollbar.cpp index 03746a5..be72588 100644 --- a/profiler_gui/easy_graphics_scrollbar.cpp +++ b/profiler_gui/easy_graphics_scrollbar.cpp @@ -96,13 +96,13 @@ namespace profiler_gui { ////////////////////////////////////////////////////////////////////////// -const int DEFAULT_TOP = -40; -const int DEFAULT_HEIGHT = 80; -const int INDICATOR_SIZE = 6; -const int INDICATOR_SIZE_x2 = INDICATOR_SIZE << 1; -const int HIST_COLUMN_MIN_HEIGHT = 2; -const int WORKER_THREAD_CHECK_INTERVAL = 40; -const int BOUNDARY_TIMER_INTERVAL = 100; +EASY_CONSTEXPR int DEFAULT_TOP = -40; +EASY_CONSTEXPR int DEFAULT_HEIGHT = 80; +EASY_CONSTEXPR int INDICATOR_SIZE = 6; +EASY_CONSTEXPR int INDICATOR_SIZE_x2 = INDICATOR_SIZE << 1; +EASY_CONSTEXPR int HIST_COLUMN_MIN_HEIGHT = 2; +EASY_CONSTEXPR int WORKER_THREAD_CHECK_INTERVAL = 40; +EASY_CONSTEXPR int BOUNDARY_TIMER_INTERVAL = 100; ////////////////////////////////////////////////////////////////////////// @@ -296,7 +296,7 @@ void EasyHistogramItem::paintBusyIndicator(QPainter* _painter, qreal _current_sc const auto width = m_boundingRect.width() * _current_scale; const auto h = _painter->fontMetrics().height(); - _painter->setPen(Qt::black); + _painter->setPen(::profiler_gui::TEXT_COLOR); _painter->drawText(QRectF(0, m_boundingRect.top(), width, m_boundingRect.height() - h), Qt::AlignCenter, "Generating image"); _painter->drawText(QRectF(0, m_boundingRect.top() + h, width, m_boundingRect.height() - h), @@ -477,11 +477,11 @@ void EasyHistogramItem::paintByPtr(QPainter* _painter) //bottom_width -= fm.width(m_bottomDurationStr) + 7; top_width -= fm.width(m_topDurationStr) + 7; - _painter->setPen(m_topDuration < m_maxDuration ? Qt::darkRed : Qt::black); + _painter->setPen(m_topDuration < m_maxDuration ? QColor(Qt::darkRed) : ::profiler_gui::TEXT_COLOR); _painter->drawText(rect, Qt::AlignRight | Qt::AlignTop, m_topDurationStr); rect.setRect(0, bottom, width - 3, font_h); - _painter->setPen(m_bottomDuration > m_minDuration ? Qt::darkRed : Qt::black); + _painter->setPen(m_bottomDuration > m_minDuration ? QColor(Qt::darkRed) : ::profiler_gui::TEXT_COLOR); _painter->drawText(rect, Qt::AlignRight | Qt::AlignTop, m_bottomDurationStr); } @@ -507,7 +507,7 @@ void EasyHistogramItem::paintByPtr(QPainter* _painter) _painter->drawLine(QLineF(0, h, w, h)); } - _painter->setPen(Qt::black); + _painter->setPen(::profiler_gui::TEXT_COLOR); rect.setRect(0, bottom + 2, width, widget->defaultFontHeight()); const auto eventsSize = m_pProfilerThread->events.size(); _painter->drawText(rect, Qt::AlignHCenter | Qt::TextDontClip, QString("%1 | duration: %2 | profiled: %3 (%4%) | wait: %5 (%6%) | %7 frames | %8 blocks | %9 markers") @@ -716,12 +716,11 @@ void EasyHistogramItem::paintById(QPainter* _painter) //bottom_width -= fm.width(m_bottomDurationStr) + 7; top_width -= fm.width(m_topDurationStr) + 7; - _painter->setPen(Qt::black); - _painter->setPen(m_topDuration < m_maxDuration ? Qt::darkRed : Qt::black); + _painter->setPen(m_topDuration < m_maxDuration ? QColor(Qt::darkRed) : ::profiler_gui::TEXT_COLOR); _painter->drawText(rect, Qt::AlignRight | Qt::AlignTop, m_topDurationStr); rect.setRect(0, bottom, width - 3, font_h); - _painter->setPen(m_bottomDuration > m_minDuration ? Qt::darkRed : Qt::black); + _painter->setPen(m_bottomDuration > m_minDuration ? QColor(Qt::darkRed) : ::profiler_gui::TEXT_COLOR); _painter->drawText(rect, Qt::AlignRight | Qt::AlignTop, m_bottomDurationStr); } @@ -747,7 +746,7 @@ void EasyHistogramItem::paintById(QPainter* _painter) _painter->drawLine(QLineF(0, h, w, h)); } - _painter->setPen(Qt::black); + _painter->setPen(::profiler_gui::TEXT_COLOR); rect.setRect(0, bottom + 2, width, widget->defaultFontHeight()); if (!m_selectedBlocks.empty()) diff --git a/profiler_gui/globals.h b/profiler_gui/globals.h index 17c0aa3..6df9d6d 100644 --- a/profiler_gui/globals.h +++ b/profiler_gui/globals.h @@ -74,24 +74,26 @@ namespace profiler_gui { const QColor CHRONOMETER_COLOR = QColor::fromRgba(0x40000000 | (::profiler::colors::RichBlue & 0x00ffffff));// 0x402020c0); const QColor CHRONOMETER_COLOR2 = QColor::fromRgba(0x40000000 | (::profiler::colors::Dark & 0x00ffffff));// 0x40408040); - const QRgb SELECTED_THREAD_BACKGROUND = 0x00e0e060; - const QRgb SELECTED_THREAD_FOREGROUND = 0x00ffffff - SELECTED_THREAD_BACKGROUND; + const QColor TEXT_COLOR = QColor::fromRgb(0xff504040); + const QColor SYSTEM_BORDER_COLOR = QColor::fromRgb(0xffcccccc); + EASY_CONSTEXPR QRgb SELECTED_THREAD_BACKGROUND = 0xffe0e060; + EASY_CONSTEXPR QRgb SELECTED_THREAD_FOREGROUND = 0xffffffff - (SELECTED_THREAD_BACKGROUND & 0x00ffffff); - const qreal SCALING_COEFFICIENT = 1.25; - const qreal SCALING_COEFFICIENT_INV = 1.0 / SCALING_COEFFICIENT; + EASY_CONSTEXPR qreal SCALING_COEFFICIENT = 1.25; + EASY_CONSTEXPR qreal SCALING_COEFFICIENT_INV = 1.0 / SCALING_COEFFICIENT; - const uint32_t V130 = 0x01030000; + EASY_CONSTEXPR uint32_t V130 = 0x01030000; - const QSize ICONS_SIZE(28, 28); - const uint16_t GRAPHICS_ROW_SIZE = 18; - const uint16_t GRAPHICS_ROW_SPACING = 0; - const uint16_t GRAPHICS_ROW_SIZE_FULL = GRAPHICS_ROW_SIZE + GRAPHICS_ROW_SPACING; - const uint16_t THREADS_ROW_SPACING = 8; + EASY_CONSTEXPR QSize ICONS_SIZE(28, 28); + EASY_CONSTEXPR uint16_t GRAPHICS_ROW_SIZE = 18; + EASY_CONSTEXPR uint16_t GRAPHICS_ROW_SPACING = 0; + EASY_CONSTEXPR uint16_t GRAPHICS_ROW_SIZE_FULL = GRAPHICS_ROW_SIZE + GRAPHICS_ROW_SPACING; + EASY_CONSTEXPR uint16_t THREADS_ROW_SPACING = 8; #ifdef _WIN32 - const qreal FONT_METRICS_FACTOR = 1.05; + EASY_CONSTEXPR qreal FONT_METRICS_FACTOR = 1.05; #else - const qreal FONT_METRICS_FACTOR = 1.; + EASY_CONSTEXPR qreal FONT_METRICS_FACTOR = 1.; #endif ////////////////////////////////////////////////////////////////////////// diff --git a/profiler_gui/icons/combo-arrow-disabled.svg b/profiler_gui/icons/arrow-down-disabled.svg similarity index 100% rename from profiler_gui/icons/combo-arrow-disabled.svg rename to profiler_gui/icons/arrow-down-disabled.svg diff --git a/profiler_gui/icons/combo-arrow.svg b/profiler_gui/icons/arrow-down-hover.svg similarity index 92% rename from profiler_gui/icons/combo-arrow.svg rename to profiler_gui/icons/arrow-down-hover.svg index 643c8b7..e16736a 100644 --- a/profiler_gui/icons/combo-arrow.svg +++ b/profiler_gui/icons/arrow-down-hover.svg @@ -5,7 +5,7 @@ width="451.847px" height="451.847px" viewBox="0 0 451.847 451.847" style="enable-background:new 0 0 451.847 451.847;" xml:space="preserve"> - diff --git a/profiler_gui/icons/arrow-down.svg b/profiler_gui/icons/arrow-down.svg new file mode 100644 index 0000000..13d0004 --- /dev/null +++ b/profiler_gui/icons/arrow-down.svg @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/profiler_gui/icons/arrow-left.svg b/profiler_gui/icons/arrow-left.svg new file mode 100644 index 0000000..7c452e6 --- /dev/null +++ b/profiler_gui/icons/arrow-left.svg @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/profiler_gui/icons/arrow-right.svg b/profiler_gui/icons/arrow-right.svg new file mode 100644 index 0000000..199bfc8 --- /dev/null +++ b/profiler_gui/icons/arrow-right.svg @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/profiler_gui/icons/arrow-up-disabled.svg b/profiler_gui/icons/arrow-up-disabled.svg new file mode 100644 index 0000000..4581ed1 --- /dev/null +++ b/profiler_gui/icons/arrow-up-disabled.svg @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/profiler_gui/icons/arrow-up-hover.svg b/profiler_gui/icons/arrow-up-hover.svg new file mode 100644 index 0000000..da0da91 --- /dev/null +++ b/profiler_gui/icons/arrow-up-hover.svg @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/profiler_gui/icons/arrow-up.svg b/profiler_gui/icons/arrow-up.svg new file mode 100644 index 0000000..2120ab9 --- /dev/null +++ b/profiler_gui/icons/arrow-up.svg @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/profiler_gui/icons/attribution.txt b/profiler_gui/icons/attribution.txt index 35f7ba9..2976cfa 100644 --- a/profiler_gui/icons/attribution.txt +++ b/profiler_gui/icons/attribution.txt @@ -32,5 +32,11 @@ maximize-white-hover.svg - Icon made by Freepik from www.flaticon.com maximize-white-pressed.svg - Icon made by Freepik from www.flaticon.com minimize-white.svg - Icon made by Freepik from www.flaticon.com minimize-white-pressed.svg - Icon made by Freepik from www.flaticon.com -combo-arrow.svg - Icon made by Freepik from www.flaticon.com -combo-arrow-disabled.svg - Icon made by Freepik from www.flaticon.com +arrow-down.svg - Icon made by Freepik from www.flaticon.com +arrow-down-hover.svg - Icon made by Freepik from www.flaticon.com +arrow-down-disabled.svg - Icon made by Freepik from www.flaticon.com +arrow-up.svg - Icon made by Freepik from www.flaticon.com +arrow-up-hover.svg - Icon made by Freepik from www.flaticon.com +arrow-up-disabled.svg - Icon made by Freepik from www.flaticon.com +arrow-left.svg - Icon made by Freepik from www.flaticon.com +arrow-right.svg - Icon made by Freepik from www.flaticon.com diff --git a/profiler_gui/main_window.cpp b/profiler_gui/main_window.cpp index f29d749..6a8f25c 100644 --- a/profiler_gui/main_window.cpp +++ b/profiler_gui/main_window.cpp @@ -629,17 +629,28 @@ EasyMainWindow::EasyMainWindow() : Parent(), m_lastAddress("localhost"), m_lastP actionGroup->setExclusive(true); auto default_codec_mib = QTextCodec::codecForLocale()->mibEnum(); - foreach(int mib, QTextCodec::availableMibs()) { - auto codec = QTextCodec::codecForMib(mib)->name(); + QList actions; - action = new QAction(codec, actionGroup); - action->setCheckable(true); - if (mib == default_codec_mib) - action->setChecked(true); + for (int mib : QTextCodec::availableMibs()) + { + auto codec = QTextCodec::codecForMib(mib)->name(); - submenu->addAction(action); - connect(action, &QAction::triggered, this, &This::onEncodingChanged); + action = new QAction(codec, actionGroup); + action->setData(mib); + action->setCheckable(true); + if (mib == default_codec_mib) + action->setChecked(true); + + actions.push_back(action); + connect(action, &QAction::triggered, this, &This::onEncodingChanged); + } + + qSort(actions.begin(), actions.end(), [](QAction* lhs, QAction* rhs) { + return lhs->text().compare(rhs->text(), Qt::CaseInsensitive) < 0; + }); + + submenu->addActions(actions); } auto tb_height = toolbar->height() + 4; @@ -1032,10 +1043,14 @@ void EasyMainWindow::onExitClicked(bool) void EasyMainWindow::onEncodingChanged(bool) { - auto _sender = qobject_cast(sender()); - auto name = _sender->text(); - QTextCodec *codec = QTextCodec::codecForName(name.toStdString().c_str()); - QTextCodec::setCodecForLocale(codec); + auto action = qobject_cast(sender()); + if (action == nullptr) + return; + + const int mib = action->data().toInt(); + auto codec = QTextCodec::codecForMib(mib); + if (codec != nullptr) + QTextCodec::setCodecForLocale(codec); } void EasyMainWindow::onChronoTextPosChanged(bool) diff --git a/profiler_gui/resources.qrc b/profiler_gui/resources.qrc index f021579..cd973c2 100644 --- a/profiler_gui/resources.qrc +++ b/profiler_gui/resources.qrc @@ -41,7 +41,11 @@ icons/close-white.svg icons/close-white-hover.svg icons/close-white-pressed.svg - icons/combo-arrow.svg - icons/combo-arrow-disabled.svg + icons/arrow-up.svg + icons/arrow-up-hover.svg + icons/arrow-up-disabled.svg + icons/arrow-down.svg + icons/arrow-down-hover.svg + icons/arrow-down-disabled.svg diff --git a/profiler_gui/tree_widget_item.cpp b/profiler_gui/tree_widget_item.cpp index a955f96..be70848 100644 --- a/profiler_gui/tree_widget_item.cpp +++ b/profiler_gui/tree_widget_item.cpp @@ -58,11 +58,13 @@ ////////////////////////////////////////////////////////////////////////// +EASY_CONSTEXPR QRgb TEXT_RGB = 0xff504040; + EasyTreeWidgetItem::EasyTreeWidgetItem(const ::profiler::block_index_t _treeBlock, Parent* _parent) : Parent(_parent) , m_block(_treeBlock) , m_customBGColor(0) - , m_customTextColor(0) + , m_customTextColor(TEXT_RGB) { } @@ -211,17 +213,18 @@ void EasyTreeWidgetItem::colorize(bool _colorize) { for (int i = 0; i < COL_COLUMNS_NUMBER; ++i) { - setBackground(i, QColor::fromRgb(m_customBGColor)); + setBackground(i, QColor::fromRgba(m_customBGColor)); setForeground(i, QColor::fromRgb(m_customTextColor)); } } else { const QBrush nobrush; + const QBrush textbrush(::profiler_gui::TEXT_COLOR); for (int i = 0; i < COL_COLUMNS_NUMBER; ++i) { setBackground(i, nobrush); - setForeground(i, nobrush); + setForeground(i, textbrush); } } } @@ -250,4 +253,12 @@ void EasyTreeWidgetItem::expandAll() guiBlock().expanded = true; } +void EasyTreeWidgetItem::setBold(bool _bold) +{ + auto f = font(0); + f.setBold(_bold); + for (int i = 0; i < COL_COLUMNS_NUMBER; ++i) + setFont(i, f); +} + ////////////////////////////////////////////////////////////////////////// diff --git a/profiler_gui/tree_widget_item.h b/profiler_gui/tree_widget_item.h index 9126c86..2051745 100644 --- a/profiler_gui/tree_widget_item.h +++ b/profiler_gui/tree_widget_item.h @@ -155,6 +155,8 @@ public: void expandAll(); + void setBold(bool _bold); + }; // END of class EasyTreeWidgetItem. //////////////////////////////////////////////////////////////////////////