Commit 206eb5f2 authored by Jan Blackquill's avatar Jan Blackquill 🌈
Browse files

Refactor metrics into their own C++ file

parent acfb94fb
......@@ -94,6 +94,7 @@ set(breeze_PART_SRCS
breezestyleplugin.cpp
breezetileset.cpp
breezewindowmanager.cpp
breezemetrics.cpp
)
kconfig_add_kcfg_files(breeze_PART_SRCS breezestyleconfigdata.kcfgc)
......
#include "breezemetrics.h"
namespace Breeze {
const constexpr qreal PenWidth::Symbol = 1.01;
const constexpr int PenWidth::Frame = 1;
const constexpr int PenWidth::Shadow = 1;
const constexpr int PenWidth::NoPen = 0;
const constexpr int Metrics::Frame_FrameWidth = 2;
const constexpr int Metrics::Frame_FrameRadius = 3;
const constexpr int Metrics::Layout_TopLevelMarginWidth = 10;
const constexpr int Metrics::Layout_ChildMarginWidth = 6;
const constexpr int Metrics::Layout_DefaultSpacing = 6;
const constexpr int Metrics::LineEdit_FrameWidth = 6;
const constexpr int Metrics::Menu_FrameWidth = 0;
const constexpr int Metrics::MenuItem_MarginWidth = 5;
const constexpr int Metrics::MenuItem_MarginHeight = 3;
const constexpr int Metrics::MenuItem_ItemSpacing = 4;
const constexpr int Metrics::MenuItem_AcceleratorSpace = 16;
const constexpr int Metrics::MenuButton_IndicatorWidth = 20;
const constexpr int Metrics::ComboBox_FrameWidth = 6;
const constexpr int Metrics::SpinBox_FrameWidth = LineEdit_FrameWidth;
const constexpr int Metrics::SpinBox_ArrowButtonWidth = 20;
const constexpr int Metrics::GroupBox_TitleMarginWidth = 4;
const constexpr int Metrics::Button_MinWidth = 80;
const constexpr int Metrics::Button_MarginWidth = 6;
const constexpr int Metrics::Button_ItemSpacing = 4;
const constexpr int Metrics::ToolButton_MarginWidth = 6;
const constexpr int Metrics::ToolButton_ItemSpacing = 4;
const constexpr int Metrics::ToolButton_InlineIndicatorWidth = 12;
const constexpr int Metrics::CheckBox_Size = 20;
const constexpr int Metrics::CheckBox_FocusMarginWidth = 2;
const constexpr int Metrics::CheckBox_ItemSpacing = 4;
const constexpr int Metrics::MenuBarItem_MarginWidth = 10;
const constexpr int Metrics::MenuBarItem_MarginHeight = 6;
const constexpr int Metrics::ScrollBar_Extend = 21;
const constexpr int Metrics::ScrollBar_SliderWidth = 6;
const constexpr int Metrics::ScrollBar_MinSliderHeight = 20;
const constexpr int Metrics::ScrollBar_NoButtonHeight = (ScrollBar_Extend-ScrollBar_SliderWidth)/2;
const constexpr int Metrics::ScrollBar_SingleButtonHeight = ScrollBar_Extend;
const constexpr int Metrics::ScrollBar_DoubleButtonHeight = 2*ScrollBar_Extend;
const constexpr int Metrics::ToolBar_FrameWidth = 2;
const constexpr int Metrics::ToolBar_HandleExtent = 10;
const constexpr int Metrics::ToolBar_HandleWidth = 6;
const constexpr int Metrics::ToolBar_SeparatorWidth = 8;
const constexpr int Metrics::ToolBar_ExtensionWidth = 20;
const constexpr int Metrics::ToolBar_ItemSpacing = 0;
const constexpr int Metrics::ProgressBar_BusyIndicatorSize = 14;
const constexpr int Metrics::ProgressBar_Thickness = 6;
const constexpr int Metrics::ProgressBar_ItemSpacing = 4;
const constexpr int Metrics::TitleBar_MarginWidth = 4;
const constexpr int Metrics::Slider_TickLength = 8;
const constexpr int Metrics::Slider_TickMarginWidth = 2;
const constexpr int Metrics::Slider_GrooveThickness = 6;
const constexpr int Metrics::Slider_ControlThickness = 20;
const constexpr int Metrics::TabBar_TabMarginHeight = 4;
const constexpr int Metrics::TabBar_TabMarginWidth = 8;
const constexpr int Metrics::TabBar_TabMinWidth = 80;
const constexpr int Metrics::TabBar_TabMinHeight = 30;
const constexpr int Metrics::TabBar_TabItemSpacing = 8;
const constexpr int Metrics::TabBar_TabOverlap = 1;
const constexpr int Metrics::TabBar_BaseOverlap = 2;
const constexpr int Metrics::TabWidget_MarginWidth = 4;
const constexpr int Metrics::ToolBox_TabMinWidth = 80;
const constexpr int Metrics::ToolBox_TabItemSpacing = 4;
const constexpr int Metrics::ToolBox_TabMarginWidth = 8;
const constexpr int Metrics::ToolTip_FrameWidth = 3;
const constexpr int Metrics::Header_MarginWidth = 6;
const constexpr int Metrics::Header_ItemSpacing = 4;
const constexpr int Metrics::Header_ArrowSize = 10;
const constexpr int Metrics::ItemView_ArrowSize = 10;
const constexpr int Metrics::ItemView_ItemMarginWidth = 3;
const constexpr int Metrics::SidePanel_ItemMarginWidth = 4;
const constexpr int Metrics::Splitter_SplitterWidth = 1;
const constexpr int Metrics::Shadow_Overlap = 2;
}
\ No newline at end of file
#ifndef breezemetrics_h
#define breezemetrics_h
#include <QtCore>
/*************************************************************************
* Copyright (C) 2014 by Hugo Pereira Da Costa <hugo.pereira@free.fr> *
* Copyright (C) 2020 by Noah Davis <noahadvs@gmail.com> *
......@@ -24,142 +26,142 @@
namespace Breeze
{
//* standard pen widths
namespace PenWidth
struct PenWidth
{
/* Using 1 instead of slightly more than 1 causes symbols drawn with
* pen strokes to look skewed. The exact amount added does not matter
* as long as it isn't too visible.
*/
// The standard pen stroke width for symbols.
static constexpr qreal Symbol = 1.01;
static const qreal Symbol;
// The standard pen stroke width for frames.
static constexpr int Frame = 1;
static const int Frame;
// The standard pen stroke width for shadows.
static constexpr int Shadow = 1;
static const int Shadow;
// A value for pen width arguments to make it clear that there is no pen stroke
static constexpr int NoPen = 0;
}
static const int NoPen;
};
//* metrics
enum Metrics
struct Metrics
{
// frames
Frame_FrameWidth = 2,
Frame_FrameRadius = 3,
static const int Frame_FrameWidth;
static const int Frame_FrameRadius;
// layout
Layout_TopLevelMarginWidth = 10,
Layout_ChildMarginWidth = 6,
Layout_DefaultSpacing = 6,
static const int Layout_TopLevelMarginWidth;
static const int Layout_ChildMarginWidth;
static const int Layout_DefaultSpacing;
// line editors
LineEdit_FrameWidth = 6,
static const int LineEdit_FrameWidth;
// menu items
Menu_FrameWidth = 0,
MenuItem_MarginWidth = 5,
MenuItem_MarginHeight = 3,
MenuItem_ItemSpacing = 4,
MenuItem_AcceleratorSpace = 16,
MenuButton_IndicatorWidth = 20,
static const int Menu_FrameWidth;
static const int MenuItem_MarginWidth;
static const int MenuItem_MarginHeight;
static const int MenuItem_ItemSpacing;
static const int MenuItem_AcceleratorSpace;
static const int MenuButton_IndicatorWidth;
// combobox
ComboBox_FrameWidth = 6,
static const int ComboBox_FrameWidth;
// spinbox
SpinBox_FrameWidth = LineEdit_FrameWidth,
SpinBox_ArrowButtonWidth = 20,
static const int SpinBox_FrameWidth;
static const int SpinBox_ArrowButtonWidth;
// groupbox title margin
GroupBox_TitleMarginWidth = 4,
static const int GroupBox_TitleMarginWidth;
// buttons
Button_MinWidth = 80,
Button_MarginWidth = 6,
Button_ItemSpacing = 4,
static const int Button_MinWidth;
static const int Button_MarginWidth;
static const int Button_ItemSpacing;
// tool buttons
ToolButton_MarginWidth = 6,
ToolButton_ItemSpacing = 4,
ToolButton_InlineIndicatorWidth = 12,
static const int ToolButton_MarginWidth;
static const int ToolButton_ItemSpacing;
static const int ToolButton_InlineIndicatorWidth;
// checkboxes and radio buttons
CheckBox_Size = 20,
CheckBox_FocusMarginWidth = 2,
CheckBox_ItemSpacing = 4,
static const int CheckBox_Size;
static const int CheckBox_FocusMarginWidth;
static const int CheckBox_ItemSpacing;
// menubar items
MenuBarItem_MarginWidth = 10,
MenuBarItem_MarginHeight = 6,
static const int MenuBarItem_MarginWidth;
static const int MenuBarItem_MarginHeight;
// scrollbars
ScrollBar_Extend = 21,
ScrollBar_SliderWidth = 6,
ScrollBar_MinSliderHeight = 20,
ScrollBar_NoButtonHeight = (ScrollBar_Extend-ScrollBar_SliderWidth)/2,
ScrollBar_SingleButtonHeight = ScrollBar_Extend,
ScrollBar_DoubleButtonHeight = 2*ScrollBar_Extend,
static const int ScrollBar_Extend;
static const int ScrollBar_SliderWidth;
static const int ScrollBar_MinSliderHeight;
static const int ScrollBar_NoButtonHeight;
static const int ScrollBar_SingleButtonHeight;
static const int ScrollBar_DoubleButtonHeight;
// toolbars
ToolBar_FrameWidth = 2,
ToolBar_HandleExtent = 10,
ToolBar_HandleWidth = 6,
ToolBar_SeparatorWidth = 8,
ToolBar_ExtensionWidth = 20,
ToolBar_ItemSpacing = 0,
static const int ToolBar_FrameWidth;
static const int ToolBar_HandleExtent;
static const int ToolBar_HandleWidth;
static const int ToolBar_SeparatorWidth;
static const int ToolBar_ExtensionWidth;
static const int ToolBar_ItemSpacing;
// progressbars
ProgressBar_BusyIndicatorSize = 14,
ProgressBar_Thickness = 6,
ProgressBar_ItemSpacing = 4,
static const int ProgressBar_BusyIndicatorSize;
static const int ProgressBar_Thickness;
static const int ProgressBar_ItemSpacing;
// mdi title bar
TitleBar_MarginWidth = 4,
static const int TitleBar_MarginWidth;
// sliders
Slider_TickLength = 8,
Slider_TickMarginWidth = 2,
Slider_GrooveThickness = 6,
Slider_ControlThickness = 20,
static const int Slider_TickLength;
static const int Slider_TickMarginWidth;
static const int Slider_GrooveThickness;
static const int Slider_ControlThickness;
// tabbar
TabBar_TabMarginHeight = 4,
TabBar_TabMarginWidth = 8,
TabBar_TabMinWidth = 80,
TabBar_TabMinHeight = 30,
TabBar_TabItemSpacing = 8,
TabBar_TabOverlap = 1,
TabBar_BaseOverlap = 2,
static const int TabBar_TabMarginHeight;
static const int TabBar_TabMarginWidth;
static const int TabBar_TabMinWidth;
static const int TabBar_TabMinHeight;
static const int TabBar_TabItemSpacing;
static const int TabBar_TabOverlap;
static const int TabBar_BaseOverlap;
// tab widget
TabWidget_MarginWidth = 4,
static const int TabWidget_MarginWidth;
// toolbox
ToolBox_TabMinWidth = 80,
ToolBox_TabItemSpacing = 4,
ToolBox_TabMarginWidth = 8,
static const int ToolBox_TabMinWidth;
static const int ToolBox_TabItemSpacing;
static const int ToolBox_TabMarginWidth;
// tooltips
ToolTip_FrameWidth = 3,
static const int ToolTip_FrameWidth;
// list headers
Header_MarginWidth = 6,
Header_ItemSpacing = 4,
Header_ArrowSize = 10,
static const int Header_MarginWidth;
static const int Header_ItemSpacing;
static const int Header_ArrowSize;
// tree view
ItemView_ArrowSize = 10,
ItemView_ItemMarginWidth = 3,
SidePanel_ItemMarginWidth = 4,
static const int ItemView_ArrowSize;
static const int ItemView_ItemMarginWidth;
static const int SidePanel_ItemMarginWidth;
// splitter
Splitter_SplitterWidth = 1,
static const int Splitter_SplitterWidth;
// shadow dimensions
Shadow_Overlap = 2
static const int Shadow_Overlap;
};
}
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment