0
0
mirror of https://github.com/yse/easy_profiler.git synced 2024-12-27 08:41:02 +08:00

#0 [GUI] Styling

This commit is contained in:
Victor Zarubkin 2017-11-16 22:32:28 +03:00
parent b3fd7c7837
commit aa1ddb44ca
17 changed files with 379 additions and 49 deletions

View File

@ -1522,6 +1522,7 @@ void EasyGraphicsView::onIdleTimeout()
if (widget == nullptr) if (widget == nullptr)
return; return;
widget->setObjectName(QStringLiteral("DiagramPopup"));
widget->setAttribute(Qt::WA_ShowWithoutActivating, true); widget->setAttribute(Qt::WA_ShowWithoutActivating, true);
widget->setFocusPolicy(Qt::NoFocus); widget->setFocusPolicy(Qt::NoFocus);
@ -1529,6 +1530,8 @@ void EasyGraphicsView::onIdleTimeout()
if (lay == nullptr) if (lay == nullptr)
return; return;
lay->setSpacing(2);
int row = 0; int row = 0;
switch (itemDesc.type()) switch (itemDesc.type())
{ {
@ -2326,6 +2329,7 @@ void EasyThreadNamesWidget::onIdleTimeout()
if (widget == nullptr) if (widget == nullptr)
return; return;
widget->setObjectName(QStringLiteral("ThreadsPopup"));
widget->setAttribute(Qt::WA_ShowWithoutActivating, true); widget->setAttribute(Qt::WA_ShowWithoutActivating, true);
widget->setFocusPolicy(Qt::NoFocus); widget->setFocusPolicy(Qt::NoFocus);
@ -2335,6 +2339,7 @@ void EasyThreadNamesWidget::onIdleTimeout()
int row = 0; int row = 0;
lay->setSpacing(2);
lay->addWidget(new EasyBoldLabel(intersectingItem->threadName(), widget), row, 0, 1, 2, Qt::AlignHCenter); lay->addWidget(new EasyBoldLabel(intersectingItem->threadName(), widget), row, 0, 1, 2, Qt::AlignHCenter);
++row; ++row;

187
profiler_gui/default.css Normal file
View File

@ -0,0 +1,187 @@
/**********************************
* *
* Light theme for EasyProfiler. *
* *
***********************************/
/* ****************************************************************************************************************** */
* {
font-family: "DejaVu Sans";
font-size: 13px;
color: #606070;
}
*:disabled {
color: #b0b0c0;
}
/* ****************************************************************************************************************** */
QLineEdit, QPushButton {
height: 24px;
border: 1px solid #cccccc;
background-color: white;
}
QPushButton {
padding: 2px 5px 2px 5px;
}
QPushButton:hover {
border: 1px solid #f4a386;
color: #806070;
}
QPushButton:pressed {
border: 1px solid #d47366;
color: #705060;
}
/* ****************************************************************************************************************** */
QMenu {
background-color: white;
padding-top: 4px;
padding-bottom: 4px;
}
QMenu::item {
height: 22px;
padding: 0 16px 0 25px;
border: 1px solid transparent; /* reserve space for selection border */
}
QMenu::item:selected {
border-color: rgba(96, 112, 208, 128);
background: rgba(96, 112, 208, 64);
}
QMenu::icon {
width: 12px;
height: 12px;
background: none;
border: 1px inset transparent;
padding: 1px;
margin-left: 2px;
}
QMenu::icon:checked { /* appearance of a 'checked' icon */
background-color: #dddddd;
border: 1px inset #aaaaaa;
}
QMenu::separator {
height: 1px;
background: #cccccc;
margin-left: 5px;
margin-right: 5px;
}
QMenu::indicator {
width: 14px;
height: 14px;
background-color: white;
border: 1px solid #cccccc;
margin-left: 2px;
padding: 1px;
}
QMenu::indicator:non-exclusive:checked { image: url(":/CheckIndicator"); }
QMenu::indicator:non-exclusive:checked:disabled { image: url(":/CheckIndicatorDisabled"); }
QMenu::indicator:exclusive { border-radius: 8px; }
QMenu::indicator:exclusive:checked { image: url(":/RadioIndicator"); }
QMenu::indicator:exclusive:checked:disabled { image: url(":/RadioIndicatorDisabled"); }
/* ****************************************************************************************************************** */
/*QToolButton {
border: 1px solid transparent;
background: none;
padding: 2px;
}
QToolButton:hover {
border: 1px solid #cccccc;
}
QToolButton[popupMode="1"] {
padding-right: 13px;
}
QToolButton:pressed {
background-color: #808080;
}
QToolButton::menu-button {
border: none;
border-left: 1px solid transparent;
width: 12px;
}
QToolButton::menu-button:hover {
border-left: 1px solid #cccccc;
background-color: #bbbbbb;
}
QToolButton::menu-button:pressed {
border-left: 1px solid #cccccc;
background-color: #808080;
}*/
/* ****************************************************************************************************************** */
QHeaderView::section {
height: 28px;
width: 96px;
min-width: 64px;
background: #eeeeee;
}
/* ****************************************************************************************************************** */
QDockWidget QWidget#EasyDockWidgetTitle {
background-color: #666666;
}
QDockWidget QWidget#EasyDockWidgetTitle QLabel {
color: white;
margin-left: 4px;
}
QDockWidget QWidget#EasyDockWidgetTitle QPushButton {
background: none;
border: none;
max-height: 12px;
max-width: 12px;
margin-right: 4px;
padding: 0;
}
QDockWidget QWidget#EasyDockWidgetTitle QPushButton#EasyDockWidgetFloatButton { image: url(":/DockMaximizeWhite"); }
QDockWidget QWidget#EasyDockWidgetTitle QPushButton#EasyDockWidgetFloatButton:hover { image: url(":/DockMaximizeWhiteHover"); }
QDockWidget QWidget#EasyDockWidgetTitle QPushButton#EasyDockWidgetCloseButton { image: url(":/DockCloseWhite"); }
QDockWidget QWidget#EasyDockWidgetTitle QPushButton#EasyDockWidgetCloseButton:hover { image: url(":/DockCloseWhiteHover"); }
/* ****************************************************************************************************************** */
QWidget#DiagramPopup, QWidget#ThreadsPopup {
background-color: white;
border: 1px solid #cccccc;
}

View File

@ -269,7 +269,7 @@ EasyFrameRateViewer::EasyFrameRateViewer(QWidget* _parent) : Parent(_parent), m_
// Dirty hack for QDockWidget stupid initial size policy :( // Dirty hack for QDockWidget stupid initial size policy :(
setFixedHeight(10); // Set very small height to enable appropriate minimum height on the application startup setFixedHeight(10); // Set very small height to enable appropriate minimum height on the application startup
QTimer::singleShot(100, [this]() QTimer::singleShot(100, [this]
{ {
// Now set appropriate minimum height // Now set appropriate minimum height
setMinimumHeight((QFontMetrics(scene()->font()).height() + 3) * 6); setMinimumHeight((QFontMetrics(scene()->font()).height() + 3) * 6);

View File

@ -104,10 +104,10 @@ namespace profiler_gui {
, auto_adjust_histogram_height(true) , auto_adjust_histogram_height(true)
, display_only_frames_on_histogram(false) , display_only_frames_on_histogram(false)
, bind_scene_and_tree_expand_status(true) , bind_scene_and_tree_expand_status(true)
, bg_font(::profiler_gui::EFont("Helvetica", 10, QFont::Bold)) , bg_font(::profiler_gui::EFont("DejaVu Sans", 10, QFont::Bold))
, chronometer_font(::profiler_gui::EFont("Helvetica", 16, QFont::Bold)) , chronometer_font(::profiler_gui::EFont("DejaVu Sans", 16, QFont::Bold))
, items_font(::profiler_gui::EFont("Helvetica", 10, QFont::Medium)) , items_font(::profiler_gui::EFont("DejaVu Sans", 10, QFont::Medium))
, selected_item_font(::profiler_gui::EFont("Helvetica", 10, QFont::Medium)) , selected_item_font(::profiler_gui::EFont("DejaVu Sans", 10, QFont::Medium))
{ {
} }

View File

@ -22,3 +22,10 @@ list.svg - Icon made by Freepik from www.flaticon.com
search-prev.svg - Icon made by Freepik from www.flaticon.com search-prev.svg - Icon made by Freepik from www.flaticon.com
search-next.svg - Icon made by Freepik from www.flaticon.com search-next.svg - Icon made by Freepik from www.flaticon.com
settings.svg - Icon made by Freepik from www.flaticon.com settings.svg - Icon made by Freepik from www.flaticon.com
check.svg - Icon made by Kirill Kazachek from www.flaticon.com
check-disabled.svg - Icon made by Kirill Kazachek from www.flaticon.com
close-white.svg - Icon made by Cole Bemis from www.flaticon.com
close-white-disabled.svg - Icon made by Cole Bemis from www.flaticon.com
maximize-white.svg - Icon made by Google from www.flaticon.com
maximize-white-disabled.svg - Icon made by Google from www.flaticon.com

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 426.667 426.667" style="enable-background:new 0 0 426.667 426.667;" xml:space="preserve">
<g>
<polygon fill="#cccccc" points="293.333,135.04 190.08,240.213 137.173,187.093 108.8,215.467 192.213,298.667 326.187,168.747"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 514 B

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 426.667 426.667" style="enable-background:new 0 0 426.667 426.667;" xml:space="preserve">
<g>
<polygon fill="#484848" points="293.333,135.04 190.08,240.213 137.173,187.093 108.8,215.467 192.213,298.667 326.187,168.747"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 514 B

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
<g>
<path fill="#f4a386" d="M505.943,6.058c-8.077-8.077-21.172-8.077-29.249,0L6.058,476.693c-8.077,8.077-8.077,21.172,0,29.249
C10.096,509.982,15.39,512,20.683,512c5.293,0,10.586-2.019,14.625-6.059L505.943,35.306
C514.019,27.23,514.019,14.135,505.943,6.058z"/>
<path fill="#f4a386" d="M505.942,476.694L35.306,6.059c-8.076-8.077-21.172-8.077-29.248,0c-8.077,8.076-8.077,21.171,0,29.248l470.636,470.636
c4.038,4.039,9.332,6.058,14.625,6.058c5.293,0,10.587-2.019,14.624-6.057C514.018,497.866,514.018,484.771,505.942,476.694z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 899 B

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
<g>
<path fill="#ffffff" d="M505.943,6.058c-8.077-8.077-21.172-8.077-29.249,0L6.058,476.693c-8.077,8.077-8.077,21.172,0,29.249
C10.096,509.982,15.39,512,20.683,512c5.293,0,10.586-2.019,14.625-6.059L505.943,35.306
C514.019,27.23,514.019,14.135,505.943,6.058z"/>
<path fill="#ffffff" d="M505.942,476.694L35.306,6.059c-8.076-8.077-21.172-8.077-29.248,0c-8.077,8.076-8.077,21.171,0,29.248l470.636,470.636
c4.038,4.039,9.332,6.058,14.625,6.058c5.293,0,10.587-2.019,14.624-6.057C514.018,497.866,514.018,484.771,505.942,476.694z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 899 B

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 384 384" style="enable-background:new 0 0 384 384;" xml:space="preserve">
<g>
<path fill="#e0e0e0" d="M341.333,341.333H42.667V42.667H192V0H42.667C19.093,0,0,19.093,0,42.667v298.667C0,364.907,19.093,384,42.667,384
h298.667C364.907,384,384,364.907,384,341.333V192h-42.667V341.333z"/>
<polygon fill="#e0e0e0" points="234.667,0 234.667,42.667 311.147,42.667 101.44,252.373 131.627,282.56 341.333,72.853 341.333,149.333
384,149.333 384,0"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 639 B

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 384 384" style="enable-background:new 0 0 384 384;" xml:space="preserve">
<g>
<path fill="#ffffff" d="M341.333,341.333H42.667V42.667H192V0H42.667C19.093,0,0,19.093,0,42.667v298.667C0,364.907,19.093,384,42.667,384
h298.667C364.907,384,384,364.907,384,341.333V192h-42.667V341.333z"/>
<polygon fill="#ffffff" points="234.667,0 234.667,42.667 311.147,42.667 101.44,252.373 131.627,282.56 341.333,72.853 341.333,149.333
384,149.333 384,0"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 639 B

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="64px" height="64px" viewBox="0 0 64 64" style="enable-background:new 0 0 64 64;" xml:space="preserve">
<g>
<circle fill="#cccccc" cx="32" cy="32" r="16"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 346 B

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="64px" height="64px" viewBox="0 0 64 64" style="enable-background:new 0 0 64 64;" xml:space="preserve">
<g>
<circle fill="#484848" cx="32" cy="32" r="16"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 346 B

View File

@ -50,6 +50,8 @@
#include <chrono> #include <chrono>
#include <QApplication> #include <QApplication>
#include <QFile>
#include <QTextStream>
#include "main_window.h" #include "main_window.h"
#include "globals.h" #include "globals.h"
@ -61,6 +63,15 @@ int main(int argc, char **argv)
{ {
QApplication app(argc, argv); QApplication app(argc, argv);
QFile file(":/DefaultTheme");
if (file.open(QFile::ReadOnly | QFile::Text))
{
QTextStream in(&file);
QString style = in.readAll();
if (!style.isEmpty())
app.setStyleSheet(style);
}
//Instanciate easy globals after QApplication to allow creation of global fonts, and on the main thread to avoid data races //Instanciate easy globals after QApplication to allow creation of global fonts, and on the main thread to avoid data races
EASY_GLOBALS; EASY_GLOBALS;

View File

@ -64,11 +64,11 @@
#include <QApplication> #include <QApplication>
#include <QCoreApplication> #include <QCoreApplication>
#include <QStatusBar> #include <QStatusBar>
#include <QDockWidget>
#include <QFileDialog> #include <QFileDialog>
#include <QAction> #include <QAction>
#include <QMenu> #include <QMenu>
#include <QMenuBar> #include <QMenuBar>
#include <QPushButton>
#include <QCloseEvent> #include <QCloseEvent>
#include <QSettings> #include <QSettings>
#include <QTextCodec> #include <QTextCodec>
@ -134,6 +134,38 @@ inline void clear_stream(std::stringstream& _stream)
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
EasyDockWidget::EasyDockWidget(const QString& title, QWidget* parent) : QDockWidget(title, parent)
{
auto floatingButton = new QPushButton();
floatingButton->setObjectName("EasyDockWidgetFloatButton");
connect(floatingButton, &QPushButton::clicked, [this] {
setFloating(!isFloating());
});
auto closeButton = new QPushButton();
closeButton->setObjectName("EasyDockWidgetCloseButton");
connect(closeButton, &QPushButton::clicked, [this] {
close();
});
auto caption = new QWidget(this);
caption->setObjectName("EasyDockWidgetTitle");
auto lay = new QHBoxLayout(caption);
lay->setContentsMargins(0, 0, 0, 0);
lay->setSpacing(2);
lay->addWidget(new QLabel(title));
lay->addStretch(100);
lay->addWidget(floatingButton);
lay->addWidget(closeButton);
setTitleBarWidget(caption);
}
EasyDockWidget::~EasyDockWidget()
{
}
EasyMainWindow::EasyMainWindow() : Parent(), m_lastAddress("localhost"), m_lastPort(::profiler::DEFAULT_PORT) EasyMainWindow::EasyMainWindow() : Parent(), m_lastAddress("localhost"), m_lastPort(::profiler::DEFAULT_PORT)
{ {
{ QIcon icon(":/logo"); if (!icon.isNull()) QApplication::setWindowIcon(icon); } { QIcon icon(":/logo"); if (!icon.isNull()) QApplication::setWindowIcon(icon); }
@ -146,7 +178,7 @@ EasyMainWindow::EasyMainWindow() : Parent(), m_lastAddress("localhost"), m_lastP
setStatusBar(nullptr); setStatusBar(nullptr);
m_graphicsView = new QDockWidget("Diagram", this); m_graphicsView = new EasyDockWidget("Diagram", this);
m_graphicsView->setObjectName("ProfilerGUI_Diagram"); m_graphicsView->setObjectName("ProfilerGUI_Diagram");
m_graphicsView->setMinimumHeight(50); m_graphicsView->setMinimumHeight(50);
m_graphicsView->setAllowedAreas(Qt::AllDockWidgetAreas); m_graphicsView->setAllowedAreas(Qt::AllDockWidgetAreas);
@ -154,7 +186,7 @@ EasyMainWindow::EasyMainWindow() : Parent(), m_lastAddress("localhost"), m_lastP
auto graphicsView = new EasyGraphicsViewWidget(this); auto graphicsView = new EasyGraphicsViewWidget(this);
m_graphicsView->setWidget(graphicsView); m_graphicsView->setWidget(graphicsView);
m_treeWidget = new QDockWidget("Hierarchy", this); m_treeWidget = new EasyDockWidget("Hierarchy", this);
m_treeWidget->setObjectName("ProfilerGUI_Hierarchy"); m_treeWidget->setObjectName("ProfilerGUI_Hierarchy");
m_treeWidget->setMinimumHeight(50); m_treeWidget->setMinimumHeight(50);
m_treeWidget->setAllowedAreas(Qt::AllDockWidgetAreas); m_treeWidget->setAllowedAreas(Qt::AllDockWidgetAreas);
@ -162,7 +194,7 @@ EasyMainWindow::EasyMainWindow() : Parent(), m_lastAddress("localhost"), m_lastP
auto treeWidget = new EasyHierarchyWidget(this); auto treeWidget = new EasyHierarchyWidget(this);
m_treeWidget->setWidget(treeWidget); m_treeWidget->setWidget(treeWidget);
m_fpsViewer = new QDockWidget("FPS Monitor", this); m_fpsViewer = new EasyDockWidget("FPS Monitor", this);
m_fpsViewer->setObjectName("ProfilerGUI_FPS"); m_fpsViewer->setObjectName("ProfilerGUI_FPS");
m_fpsViewer->setWidget(new EasyFrameRateViewer(this)); m_fpsViewer->setWidget(new EasyFrameRateViewer(this));
m_fpsViewer->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea); m_fpsViewer->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea);
@ -173,7 +205,7 @@ EasyMainWindow::EasyMainWindow() : Parent(), m_lastAddress("localhost"), m_lastP
#if EASY_GUI_USE_DESCRIPTORS_DOCK_WINDOW != 0 #if EASY_GUI_USE_DESCRIPTORS_DOCK_WINDOW != 0
auto descTree = new EasyDescWidget(); auto descTree = new EasyDescWidget();
m_descTreeWidget = new QDockWidget("Blocks"); m_descTreeWidget = new EasyDockWidget("Blocks");
m_descTreeWidget->setObjectName("ProfilerGUI_Blocks"); m_descTreeWidget->setObjectName("ProfilerGUI_Blocks");
m_descTreeWidget->setMinimumHeight(50); m_descTreeWidget->setMinimumHeight(50);
m_descTreeWidget->setAllowedAreas(Qt::AllDockWidgetAreas); m_descTreeWidget->setAllowedAreas(Qt::AllDockWidgetAreas);
@ -443,12 +475,12 @@ EasyMainWindow::EasyMainWindow() : Parent(), m_lastAddress("localhost"), m_lastP
submenu->addSeparator(); submenu->addSeparator();
auto w = new QWidget(submenu); auto w = new QWidget(submenu);
auto l = new QHBoxLayout(w); auto l = new QHBoxLayout(w);
l->setContentsMargins(33, 1, 1, 1); l->setContentsMargins(26, 1, 16, 1);
l->addWidget(new QLabel("Min blocks spacing, px", w), 0, Qt::AlignLeft); l->addWidget(new QLabel("Min blocks spacing, px", w), 0, Qt::AlignLeft);
auto spinbox = new QSpinBox(w); auto spinbox = new QSpinBox(w);
spinbox->setRange(0, 400); spinbox->setRange(0, 400);
spinbox->setValue(EASY_GLOBALS.blocks_spacing); spinbox->setValue(EASY_GLOBALS.blocks_spacing);
spinbox->setFixedWidth(50); spinbox->setFixedWidth(70);
connect(spinbox, SIGNAL(valueChanged(int)), this, SLOT(onSpacingChange(int))); connect(spinbox, SIGNAL(valueChanged(int)), this, SLOT(onSpacingChange(int)));
l->addWidget(spinbox); l->addWidget(spinbox);
w->setLayout(l); w->setLayout(l);
@ -458,12 +490,12 @@ EasyMainWindow::EasyMainWindow() : Parent(), m_lastAddress("localhost"), m_lastP
w = new QWidget(submenu); w = new QWidget(submenu);
l = new QHBoxLayout(w); l = new QHBoxLayout(w);
l->setContentsMargins(33, 1, 1, 1); l->setContentsMargins(26, 1, 16, 1);
l->addWidget(new QLabel("Min blocks size, px", w), 0, Qt::AlignLeft); l->addWidget(new QLabel("Min blocks size, px", w), 0, Qt::AlignLeft);
spinbox = new QSpinBox(w); spinbox = new QSpinBox(w);
spinbox->setRange(1, 400); spinbox->setRange(1, 400);
spinbox->setValue(EASY_GLOBALS.blocks_size_min); spinbox->setValue(EASY_GLOBALS.blocks_size_min);
spinbox->setFixedWidth(50); spinbox->setFixedWidth(70);
connect(spinbox, SIGNAL(valueChanged(int)), this, SLOT(onMinSizeChange(int))); connect(spinbox, SIGNAL(valueChanged(int)), this, SLOT(onMinSizeChange(int)));
l->addWidget(spinbox); l->addWidget(spinbox);
w->setLayout(l); w->setLayout(l);
@ -473,12 +505,12 @@ EasyMainWindow::EasyMainWindow() : Parent(), m_lastAddress("localhost"), m_lastP
w = new QWidget(submenu); w = new QWidget(submenu);
l = new QHBoxLayout(w); l = new QHBoxLayout(w);
l->setContentsMargins(33, 1, 1, 1); l->setContentsMargins(26, 1, 16, 1);
l->addWidget(new QLabel("Blocks narrow size, px", w), 0, Qt::AlignLeft); l->addWidget(new QLabel("Blocks narrow size, px", w), 0, Qt::AlignLeft);
spinbox = new QSpinBox(w); spinbox = new QSpinBox(w);
spinbox->setRange(1, 400); spinbox->setRange(1, 400);
spinbox->setValue(EASY_GLOBALS.blocks_narrow_size); spinbox->setValue(EASY_GLOBALS.blocks_narrow_size);
spinbox->setFixedWidth(50); spinbox->setFixedWidth(70);
connect(spinbox, SIGNAL(valueChanged(int)), this, SLOT(onNarrowSizeChange(int))); connect(spinbox, SIGNAL(valueChanged(int)), this, SLOT(onNarrowSizeChange(int)));
l->addWidget(spinbox); l->addWidget(spinbox);
w->setLayout(l); w->setLayout(l);
@ -492,12 +524,12 @@ EasyMainWindow::EasyMainWindow() : Parent(), m_lastAddress("localhost"), m_lastP
submenu = menu->addMenu("FPS Monitor"); submenu = menu->addMenu("FPS Monitor");
w = new QWidget(submenu); w = new QWidget(submenu);
l = new QHBoxLayout(w); l = new QHBoxLayout(w);
l->setContentsMargins(33, 1, 1, 1); l->setContentsMargins(26, 1, 16, 1);
l->addWidget(new QLabel("Request interval, ms", w), 0, Qt::AlignLeft); l->addWidget(new QLabel("Request interval, ms", w), 0, Qt::AlignLeft);
spinbox = new QSpinBox(w); spinbox = new QSpinBox(w);
spinbox->setRange(1, 600000); spinbox->setRange(1, 600000);
spinbox->setValue(EASY_GLOBALS.fps_timer_interval); spinbox->setValue(EASY_GLOBALS.fps_timer_interval);
spinbox->setFixedWidth(50); spinbox->setFixedWidth(70);
connect(spinbox, SIGNAL(valueChanged(int)), this, SLOT(onFpsIntervalChange(int))); connect(spinbox, SIGNAL(valueChanged(int)), this, SLOT(onFpsIntervalChange(int)));
l->addWidget(spinbox); l->addWidget(spinbox);
w->setLayout(l); w->setLayout(l);
@ -507,12 +539,12 @@ EasyMainWindow::EasyMainWindow() : Parent(), m_lastAddress("localhost"), m_lastP
w = new QWidget(submenu); w = new QWidget(submenu);
l = new QHBoxLayout(w); l = new QHBoxLayout(w);
l->setContentsMargins(33, 1, 1, 1); l->setContentsMargins(26, 1, 16, 1);
l->addWidget(new QLabel("Max history size", w), 0, Qt::AlignLeft); l->addWidget(new QLabel("Max history size", w), 0, Qt::AlignLeft);
spinbox = new QSpinBox(w); spinbox = new QSpinBox(w);
spinbox->setRange(2, 200); spinbox->setRange(2, 200);
spinbox->setValue(EASY_GLOBALS.max_fps_history); spinbox->setValue(EASY_GLOBALS.max_fps_history);
spinbox->setFixedWidth(50); spinbox->setFixedWidth(70);
connect(spinbox, SIGNAL(valueChanged(int)), this, SLOT(onFpsHistoryChange(int))); connect(spinbox, SIGNAL(valueChanged(int)), this, SLOT(onFpsHistoryChange(int)));
l->addWidget(spinbox); l->addWidget(spinbox);
w->setLayout(l); w->setLayout(l);
@ -522,12 +554,12 @@ EasyMainWindow::EasyMainWindow() : Parent(), m_lastAddress("localhost"), m_lastP
w = new QWidget(submenu); w = new QWidget(submenu);
l = new QHBoxLayout(w); l = new QHBoxLayout(w);
l->setContentsMargins(33, 1, 1, 1); l->setContentsMargins(26, 1, 16, 1);
l->addWidget(new QLabel("Line width, px", w), 0, Qt::AlignLeft); l->addWidget(new QLabel("Line width, px", w), 0, Qt::AlignLeft);
spinbox = new QSpinBox(w); spinbox = new QSpinBox(w);
spinbox->setRange(1, 6); spinbox->setRange(1, 6);
spinbox->setValue(EASY_GLOBALS.fps_widget_line_width); spinbox->setValue(EASY_GLOBALS.fps_widget_line_width);
spinbox->setFixedWidth(50); spinbox->setFixedWidth(70);
connect(spinbox, SIGNAL(valueChanged(int)), this, SLOT(onFpsMonitorLineWidthChange(int))); connect(spinbox, SIGNAL(valueChanged(int)), this, SLOT(onFpsMonitorLineWidthChange(int)));
l->addWidget(spinbox); l->addWidget(spinbox);
w->setLayout(l); w->setLayout(l);

View File

@ -60,6 +60,7 @@
#include <sstream> #include <sstream>
#include <QMainWindow> #include <QMainWindow>
#include <QDockWidget>
#include <QTimer> #include <QTimer>
#include <QStringList> #include <QStringList>
@ -78,8 +79,6 @@
#define EASY_GUI_USE_DESCRIPTORS_DOCK_WINDOW 0 #define EASY_GUI_USE_DESCRIPTORS_DOCK_WINDOW 0
class QDockWidget;
namespace profiler { namespace net { struct EasyProfilerStatus; } } namespace profiler { namespace net { struct EasyProfilerStatus; } }
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
@ -195,6 +194,12 @@ private:
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
struct EasyDockWidget : public QDockWidget
{
EasyDockWidget(const QString& title, QWidget* parent = nullptr);
virtual ~EasyDockWidget();
};
class EasyMainWindow : public QMainWindow class EasyMainWindow : public QMainWindow
{ {
Q_OBJECT Q_OBJECT

View File

@ -1,5 +1,6 @@
<!DOCTYPE RCC><RCC version="1.0"> <!DOCTYPE RCC><RCC version="1.0">
<qresource> <qresource>
<file alias="DefaultTheme">default.css</file>
<file alias="logo">icons/logo.svg</file> <file alias="logo">icons/logo.svg</file>
<file alias="Exit">icons/off.svg</file> <file alias="Exit">icons/off.svg</file>
<file alias="Open">icons/open-folder2.svg</file> <file alias="Open">icons/open-folder2.svg</file>
@ -25,5 +26,13 @@
<file alias="Search-next">icons/search-next.svg</file> <file alias="Search-next">icons/search-next.svg</file>
<file alias="Search-prev">icons/search-prev.svg</file> <file alias="Search-prev">icons/search-prev.svg</file>
<file alias="Settings">icons/settings.svg</file> <file alias="Settings">icons/settings.svg</file>
<file alias="CheckIndicator">icons/check.svg</file>
<file alias="CheckIndicatorDisabled">icons/check-disabled.svg</file>
<file alias="RadioIndicator">icons/radio-indicator.svg</file>
<file alias="RadioIndicatorDisabled">icons/radio-indicator-disabled.svg</file>
<file alias="DockMaximizeWhite">icons/maximize-white.svg</file>
<file alias="DockMaximizeWhiteHover">icons/maximize-white-hover.svg</file>
<file alias="DockCloseWhite">icons/close-white.svg</file>
<file alias="DockCloseWhiteHover">icons/close-white-hover.svg</file>
</qresource> </qresource>
</RCC> </RCC>