diff --git a/plugins/pqm/src/pqmdatalogger.cpp b/plugins/pqm/src/pqmdatalogger.cpp index 31a8e01010..7c11b59a21 100644 --- a/plugins/pqm/src/pqmdatalogger.cpp +++ b/plugins/pqm/src/pqmdatalogger.cpp @@ -126,3 +126,5 @@ void PqmDataLogger::createHeader() qWarning(CAT_PQMLOG) << m_filePath << "cannot be opened!"; } } + +#include "moc_pqmdatalogger.cpp" diff --git a/plugins/regmap/src/deviceregistermap.cpp b/plugins/regmap/src/deviceregistermap.cpp index 6fb3da1353..880c570827 100644 --- a/plugins/regmap/src/deviceregistermap.cpp +++ b/plugins/regmap/src/deviceregistermap.cpp @@ -49,11 +49,14 @@ #include #include #include +#include #include #include #include +#include "style_properties.h" + using namespace scopy; using namespace regmap; @@ -74,11 +77,12 @@ DeviceRegisterMap::DeviceRegisterMap(RegisterMapTemplate *registerMapTemplate, R tool->bottomCentral()->setVisible(true); layout->addWidget(tool); - RegmapStyleHelper::DeviceRegisterMap(this); + Style::setBackgroundColor(this, Style::getAttribute(json::theme::interactive_primary_disabled)); initSettings(); registerController = new RegisterController(this); + Style::setStyle(registerController, style::properties::regmap::registercontroller, true, true); QWidget *controllerWidget = new QWidget(this); QHBoxLayout *controllerLayout = new QHBoxLayout(controllerWidget); @@ -103,7 +107,8 @@ DeviceRegisterMap::DeviceRegisterMap(RegisterMapTemplate *registerMapTemplate, R tableHeadWidget->setLayout(tableHeadWidgetLayout); QWidget *registerTableHead = new QWidget(tableHeadWidget); - registerTableHead->setStyleSheet(RegmapStyleHelper::FrameWidgetStyle()); + Style::setBackgroundColor(registerTableHead, + Style::getAttribute(json::theme::interactive_subtle_disabled)); QHBoxLayout *registerTableHeadLayout = new QHBoxLayout(registerTableHead); registerTableHeadLayout->setSpacing(0); @@ -114,7 +119,8 @@ DeviceRegisterMap::DeviceRegisterMap(RegisterMapTemplate *registerMapTemplate, R registerTableHead->setFixedWidth(180); QWidget *colBitCount = new QWidget(tableHeadWidget); - colBitCount->setStyleSheet(RegmapStyleHelper::FrameWidgetStyle()); + Style::setBackgroundColor(colBitCount, Style::getAttribute(json::theme::interactive_subtle_disabled)); + QHBoxLayout *tableHead = new QHBoxLayout(colBitCount); colBitCount->setLayout(tableHead); diff --git a/plugins/regmap/src/recyclerview/recyclerview.cpp b/plugins/regmap/src/recyclerview/recyclerview.cpp index 9c5b82d611..c97160eb43 100644 --- a/plugins/regmap/src/recyclerview/recyclerview.cpp +++ b/plugins/regmap/src/recyclerview/recyclerview.cpp @@ -31,6 +31,8 @@ #include #include +#include "style_properties.h" +#include using namespace scopy::regmap; @@ -60,7 +62,7 @@ RecyclerView::RecyclerView(QList *widgets, QWidget *parent) slider->setInvertedAppearance(true); slider->setInvertedControls(true); slider->setFixedWidth(8); - slider->setStyleSheet(RegmapStyleHelper::sliderStyle()); + Style::setStyle(slider, style::properties::regmap::regmapSlider); QObject::connect(m_scrollArea->verticalScrollBar(), &QAbstractSlider::valueChanged, this, [=](int value) { if(value == m_scrollArea->verticalScrollBar()->minimum()) { diff --git a/plugins/regmap/src/register/registerdetailedwidget.cpp b/plugins/regmap/src/register/registerdetailedwidget.cpp index 8ee05f73fb..b26e195903 100644 --- a/plugins/regmap/src/register/registerdetailedwidget.cpp +++ b/plugins/regmap/src/register/registerdetailedwidget.cpp @@ -38,6 +38,7 @@ #include #include #include +#include using namespace scopy; using namespace regmap; @@ -53,7 +54,7 @@ RegisterDetailedWidget::RegisterDetailedWidget(RegisterModel *regModel, QWidget regWidth = regModel->getWidth(); QWidget *nameDescriptionWidget = new QWidget(this); - Style::setStyle(nameDescriptionWidget, style::properties::widget::basicComponent, true, true); + Style::setBackgroundColor(nameDescriptionWidget, Style::getAttribute(json::theme::interactive_subtle_disabled)); QHBoxLayout *nameDescriptionLayout = new QHBoxLayout(nameDescriptionWidget); nameDescriptionWidget->setLayout(nameDescriptionLayout); QLabel *nameLabel = new QLabel("Name: " + regModel->getName(), this); diff --git a/plugins/regmap/src/registercontroller.cpp b/plugins/regmap/src/registercontroller.cpp index 00eccd7d98..c170a07131 100644 --- a/plugins/regmap/src/registercontroller.cpp +++ b/plugins/regmap/src/registercontroller.cpp @@ -38,6 +38,7 @@ #include #include #include +#include "style_properties.h" using namespace scopy; using namespace regmap; @@ -82,6 +83,7 @@ RegisterController::RegisterController(QWidget *parent) readWidgetLayout->addWidget(readButton, 1, Qt::AlignRight); + Style::setStyle(readWidget, style::properties::regmap::registercontroller); QWidget *writeWidget = new QWidget(this); writeWidget->setFixedHeight(72); mainLayout->addWidget(writeWidget); @@ -104,6 +106,8 @@ RegisterController::RegisterController(QWidget *parent) writeWidgetLeftLayout->addWidget(regValue); writeWidgetLayout->addLayout(writeWidgetLeftLayout, 3); + Style::setStyle(regValue, style::properties::regmap::lineEdit); + Style::setStyle(writeWidget, style::properties::regmap::registercontroller); writeButton = new QPushButton("Write", writeWidget); // request write on register QObject::connect(writeButton, &QPushButton::clicked, this, [=]() { @@ -158,7 +162,8 @@ void RegisterController::setHasMap(bool hasMap) QObject::connect(detailedRegisterToggle, &QPushButton::toggled, this, &RegisterController::toggleDetailedMenu); writeWidgetLayout->addWidget(detailedRegisterToggle, 0.5, Qt::AlignRight); - RegmapStyleHelper::iconBlueButton(detailedRegisterToggle); + Style::setStyle(detailedRegisterToggle, style::properties::button::squareIconButton, true, true); + detailedRegisterToggle->setFixedSize(32, 32); } } @@ -170,7 +175,7 @@ void RegisterController::applyStyle() readButton->setFixedHeight(40); Style::setStyle(writeButton, style::properties::button::basicButton, true, true); writeButton->setFixedHeight(40); - valueLabel->setStyleSheet(RegmapStyleHelper::grayLabelStyle()); + Style::setStyle(valueLabel, style::properties::label::menuSmall); - setStyleSheet(RegmapStyleHelper::regmapControllerStyle(nullptr)); + // setStyleSheet(RegmapStyleHelper::regmapControllerStyle(nullptr)); } diff --git a/plugins/regmap/src/registermapsettingsmenu.cpp b/plugins/regmap/src/registermapsettingsmenu.cpp index 0caa7548f5..4f3d9c8041 100644 --- a/plugins/regmap/src/registermapsettingsmenu.cpp +++ b/plugins/regmap/src/registermapsettingsmenu.cpp @@ -36,6 +36,7 @@ #include #include +#include using namespace scopy; using namespace regmap; @@ -48,7 +49,8 @@ RegisterMapSettingsMenu::RegisterMapSettingsMenu(QWidget *parent) layout->setSpacing(10); setLayout(layout); - header = new MenuHeaderWidget("Settings", QPen(RegmapStyleHelper::getColor("ScopyBlue")), this); + header = new MenuHeaderWidget("Settings", QPen(Style::getAttribute(json::theme::interactive_primary_idle)), + this); layout->addWidget(header); diff --git a/plugins/regmap/src/registermaptool.cpp b/plugins/regmap/src/registermaptool.cpp index bdb3386bd4..bffc6b74d1 100644 --- a/plugins/regmap/src/registermaptool.cpp +++ b/plugins/regmap/src/registermaptool.cpp @@ -43,6 +43,7 @@ #include #include #include +#include using namespace scopy; using namespace regmap; @@ -89,7 +90,8 @@ RegisterMapTool::RegisterMapTool(QWidget *parent) tool->addWidgetToTopContainerMenuControlHelper(settingsMenu, TTA_RIGHT); registerDeviceList = new QComboBox(tool->topContainer()); - RegmapStyleHelper::comboboxStyle(registerDeviceList); + Style::setStyle(registerDeviceList, style::properties::regmap::deviceComboBox, true, true); + Style::setStyle(registerDeviceList, style::properties::regmap::simpleWidget); registerDeviceList->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); QObject::connect(registerDeviceList, &QComboBox::currentTextChanged, this, &RegisterMapTool::updateActiveRegisterMap); diff --git a/plugins/regmap/src/regmapstylehelper.cpp b/plugins/regmap/src/regmapstylehelper.cpp index 330c4e2c1d..af9fa2b76e 100644 --- a/plugins/regmap/src/regmapstylehelper.cpp +++ b/plugins/regmap/src/regmapstylehelper.cpp @@ -43,156 +43,10 @@ RegmapStyleHelper *RegmapStyleHelper::GetInstance() { if(pinstance_ == nullptr) { pinstance_ = new RegmapStyleHelper(QApplication::instance()); // singleton has the app as parent - RegmapStyleHelper::initColorMap(); } return pinstance_; } -void RegmapStyleHelper::initColorMap() -{ - auto sh = RegmapStyleHelper::GetInstance(); - sh->colorMap.insert("ScopyBlue", Style::getAttribute(json::theme::interactive_primary_idle)); - sh->colorMap.insert("UIElementBackground", Style::getAttribute(json::theme::interactive_subtle_disabled)); - sh->colorMap.insert("LabelText", Style::getAttribute(json::theme::content_default)); - sh->colorMap.insert("LabelText2", "rgba(255, 255, 255, 150)"); - sh->colorMap.insert("ScopyBackground", Style::getAttribute(json::theme::interactive_primary_disabled)); - sh->colorMap.insert("WidgetBackground", Style::getAttribute(json::theme::interactive_subtle_disabled)); - sh->colorMap.insert("ButtonPressed", Style::getAttribute(json::theme::content_default)); - sh->colorMap.insert("ButtonHover", Style::getAttribute(json::theme::interactive_primary_idle)); - sh->colorMap.insert("ButtonDisabled", "grey"); - sh->colorMap.insert("Red", "red"); - sh->colorMap.insert("Transparent", "transparent"); - sh->colorMap.insert("CheckBoxTextColor", "rgba(255, 255, 255, 153)"); - sh->colorMap.insert("CheckBoxIndicatorBorderColor", "rgb(74,100,255)"); - sh->colorMap.insert("ScopyOrange", "#FF7200"); - sh->colorMap.insert("DisabledWidget", "#555555"); -} - -QString RegmapStyleHelper::getColor(QString id) -{ - auto sh = RegmapStyleHelper::GetInstance(); - return sh->colorMap[id]; -} - -QString RegmapStyleHelper::PartialFrameWidgetStyle() -{ - QString style = QString(R"css( - .QWidget { - border-top: 2px solid black; - border-right: 2px solid black; - border-left: 2px solid black; - } - )css"); - - return style; -} - -QString RegmapStyleHelper::FrameWidgetStyle() -{ - QString style = QString(R"css( - - QWidget { - background-color: &&interactive_subtle_disabled&& ; - } - - )css"); - style.replace("&&interactive_subtle_disabled&&", RegmapStyleHelper::getColor("WidgetBackground")); - - return style; -} - -void RegmapStyleHelper::DeviceRegisterMap(QWidget *widget) -{ - QString style = QString(R"css( - .QWidget { - background-color: &&widgetBackground&& ; - } - )css"); - style.replace("&&widgetBackground&&", RegmapStyleHelper::getColor("ScopyBackground")); - widget->setStyleSheet(style); -} - -QString RegmapStyleHelper::bigTextLabelStyle() -{ - QString style = QString(R"css( - QLabel { - font: normal; - font-size: 16px; - } - )css"); - - return style; -} - -void RegmapStyleHelper::bigTextLabel(QLabel *label, QString objectName) -{ - if(!objectName.isEmpty()) - label->setObjectName(objectName); - - label->setStyleSheet(RegmapStyleHelper::bigTextLabelStyle()); -} - -void RegmapStyleHelper::BlueButton(QPushButton *btn, QString objectName) -{ - if(!objectName.isEmpty()) - btn->setObjectName(objectName); - - Style::setStyle(btn, style::properties::button::basicButton); -} - -QString RegmapStyleHelper::checkBoxStyle() -{ - QString style = QString(R"css( - QCheckBox { - spacing: 8px; - background-color: &&checkBoxBackgroundColor&& ; - font-size: 14px; - font-weight: bold; - color: &&checkBoxColor&& - ; - } - QCheckBox::indicator { - width: 14px; - height: 14px; - border: 2px solid &&checkBoxIndicatorBorderColor&& ; - border-radius: 4px; - } - QCheckBox::indicator:unchecked { background-color: &&checkBoxIndicatorUnchecked&&; } - QCheckBox::indicator:checked { background-color: rgb(74,100,255); } - )css"); - - style.replace("&&checkBoxIndicatorUnchecked&&", RegmapStyleHelper::getColor("Transparent")); - style.replace("&&checkBoxBackgroundColor&&", RegmapStyleHelper::getColor("Transparent")); - style.replace("&&checkBoxColor&&", RegmapStyleHelper::getColor("CheckBoxTextColor")); - style.replace("&&checkBoxIndicatorBorderColor&&", RegmapStyleHelper::getColor("CheckBoxIndicatorBorderColor")); - - return style; -} - -void RegmapStyleHelper::checkBox(QCheckBox *checkbox, QString objectName) -{ - if(!objectName.isEmpty()) - checkbox->setObjectName(objectName); - - checkbox->setStyleSheet(RegmapStyleHelper::checkBoxStyle()); -} - -void RegmapStyleHelper::labelStyle(QLabel *label, QString objectName) -{ - if(!objectName.isEmpty()) - label->setObjectName(objectName); - - QString style = QString(R"css( - QLabel { - font-size: 12px; - font-style: normal; - font-weight: normal; - text-align: left; - } - )css"); - label->setStyleSheet(style); -} - void RegmapStyleHelper::regmapSettingsMenu(RegisterMapSettingsMenu *settings, QString objectName) { if(!objectName.isEmpty() && settings) @@ -202,16 +56,8 @@ void RegmapStyleHelper::regmapSettingsMenu(RegisterMapSettingsMenu *settings, QS Style::setStyle(settings->registerDump, style::properties::button::basicButton); Style::setStyle(settings->readInterval, style::properties::button::basicButton); Style::setStyle(settings->writeListOfValuesButton, style::properties::button::basicButton); - RegmapStyleHelper::bigTextLabel(settings->hexaPrefix1); - RegmapStyleHelper::bigTextLabel(settings->hexaPrefix2); -} - -void RegmapStyleHelper::grayBackgroundHoverWidget(QWidget *widget, QString objectName) -{ - if(!objectName.isEmpty() && widget) - widget->setObjectName(objectName); - - Style::setStyle(widget, style::properties::regmap::hoverWidget, true, true); + Style::setStyle(settings->hexaPrefix1, style::properties::label::menuBig); + Style::setStyle(settings->hexaPrefix2, style::properties::label::menuBig); } void RegmapStyleHelper::toggleSelectedRegister(QWidget *widget, bool toggle) @@ -270,30 +116,33 @@ void RegmapStyleHelper::BitFieldDetailedWidgetStyle(BitFieldDetailedWidget *widg widget->setObjectName(objectName); QString style = QString(R"css( - .scopy--regmap--BitFieldDetailedWidget { - padding-right : 2px ; - padding-top : 2px ; - padding-bottom : 2px ; - margin-left : 0px ; - } + .scopy--regmap--BitFieldDetailedWidget { + padding-right : 2px ; + padding-top : 2px ; + padding-bottom : 2px ; + margin-left : 0px ; + } .QFrame { background-color: &&frameBackground&& ; border-radius: 4px; } QWidget { - background-color: &&childWidgetBackground&& ; + background-color: Transparent ; } QComboBox { border-bottom: 0px; } )css"); - style.replace("&&frameBackground&&", Style::getAttribute(json::theme::background_primary)); - style.replace("&&childWidgetBackground&&", RegmapStyleHelper::getColor("Transparent")); + style.replace("&&frameBackground&&", Style::getAttribute(json::theme::interactive_subtle_disabled)); widget->setMinimumWidth(10); widget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); - widget->nameLabel->setStyleSheet(RegmapStyleHelper::whiteSmallTextLableStyle()); + Style::setStyle(widget->nameLabel, style::properties::label::menuSmall); + + if(widget->valueSwitch) { + StyleHelper::MenuOnOffSwitch(dynamic_cast(widget->valueSwitch), "onOffSwitch"); + } widget->setFixedHeight(96); widget->setStyleSheet(style); @@ -304,9 +153,8 @@ void RegmapStyleHelper::BitFieldSimpleWidgetStyle(BitFieldSimpleWidget *widget, if(!objectName.isEmpty()) widget->setObjectName(objectName); - widget->value->setStyleSheet(RegmapStyleHelper::grayLabelStyle()); - - grayBackgroundHoverWidget(widget->mainFrame); + Style::setStyle(widget->value, style::properties::label::menuSmall); + Style::setStyle(widget->mainFrame, style::properties::regmap::hoverWidget, true, true); Style::setStyle(widget->mainFrame, style::properties::regmap::bitfieldSimpleWidget); if(widget->value->text() != "N/R") { @@ -335,12 +183,12 @@ void RegmapStyleHelper::RegisterSimpleWidgetStyle(RegisterSimpleWidget *widget, } )css"); - style.replace("&&hoverBackground&&", RegmapStyleHelper::getColor("LabelText")); - style.replace("&&frameBackground&&", RegmapStyleHelper::getColor("WidgetBackground")); + style.replace("&&hoverBackground&&", Style::getAttribute(json::theme::content_default)); + style.replace("&&frameBackground&&", Style::getAttribute(json::theme::interactive_subtle_disabled)); - grayBackgroundHoverWidget(widget->regBaseInfoWidget); - widget->registerNameLabel->setStyleSheet(RegmapStyleHelper::whiteSmallTextLableStyle()); - widget->value->setStyleSheet(RegmapStyleHelper::grayLabelStyle()); + Style::setStyle(widget->regBaseInfoWidget, style::properties::regmap::hoverWidget, true, true); + Style::setStyle(widget->value, style::properties::label::menuSmall); + Style::setStyle(widget->registerNameLabel, style::properties::label::menuSmall); widget->setStyleSheet(style); @@ -349,135 +197,6 @@ void RegmapStyleHelper::RegisterSimpleWidgetStyle(RegisterSimpleWidget *widget, } } -QString RegmapStyleHelper::grayLabelStyle() -{ - QString style = QString(R"css( - QLabel { - font-size: 12px; - font-style: normal; - font-weight: normal; - text-align: left; - } - )css"); - - return style; -} - -QString RegmapStyleHelper::whiteSmallTextLableStyle() -{ - QString style = QString(R"css( - QLabel { - font: normal; - font-size: 12px; - } - )css"); - - return style; -} - -QString RegmapStyleHelper::simpleWidgetStyle() -{ - QString style = QString(R"css( - QWidget { - background-color: &&widgetBackground&& ; - border-radius: 4px; - } - )css"); - style.replace("&&widgetBackground&&", RegmapStyleHelper::getColor("WidgetBackground")); - - return style; -} - -void RegmapStyleHelper::comboboxStyle(QComboBox *combobox, QString objectName) -{ - if(!objectName.isEmpty() && combobox) - combobox->setObjectName(objectName); - - QString style = QString(R"css( - QComboBox { - color: &&textColor&& ; - font-size: 12px; - padding-left: 8px; - border-bottom: 0px; - background-color: &&widgetBackground&& ; - } - QComboBox::drop-down { - subcontrol-position: center right; - border-image: url(:/gui/icons/" + Style::getAttribute(json::theme::icon_theme_folder) + "/icons/sba_cmb_box_arrow.svg); - width: 10px; - height: 6px; - font-size: 16px; - text-align: left; - margin-right: 8px; - color: transparent; - } - )css"); - style.replace("&&textColor&&", RegmapStyleHelper::getColor("LabelText")); - style.replace("&&widgetBackground&&", Style::getAttribute(json::theme::background_primary)); - - combobox->setStyleSheet(style); -} - -void RegmapStyleHelper::titleSpinBoxStyle(TitleSpinBox *spinbox, QString objectName) -{ - if(!objectName.isEmpty() && spinbox) - spinbox->setObjectName(objectName); - - QString style = QString(R"css( - .QTitleSpinBox { - font-size: 18px; - font-style: normal; - font-weight: normal; - text-align: left; - color: &&textColor&& ; - } - QSpinBox { - border-bottom: 0px; - } - )css"); - style.replace("&&textColor&&", RegmapStyleHelper::getColor("LabelText")); - - style += RegmapStyleHelper::grayLabelStyle(); - - spinbox->setStyleSheet(style); -} - -void RegmapStyleHelper::searchBarStyle(SearchBarWidget *searchBar, QString objectName) -{ - if(!objectName.isEmpty() && searchBar) - searchBar->setObjectName(objectName); - - QString style = QString(R"css( - QLineEdit { - color: &&textColor&& ; - font-size: 12px; - padding-left: 16px; - padding-right: 16px; - border-bottom: 0px; - } - QLineEdit:hover { - border: 1px solid &&hoverBackground&& ; - border-radius: 4px; - } - - QLineEdit:disabled { color: &&disabledColor&& ; } - QPushButton:disable { - background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.501, y2:0, stop:0 #727273, stop:1 #141416); - } - - - - )css"); - - style.replace("&&textColor&&", RegmapStyleHelper::getColor("LabelText")); - style.replace("&&hoverBackground&&", RegmapStyleHelper::getColor("ScopyBlue")); - style.replace("&&disabledColor&&", RegmapStyleHelper::getColor("DisabledWidget")); - - style += RegmapStyleHelper::simpleWidgetStyle(); - - searchBar->setStyleSheet(style); -} - void RegmapStyleHelper::smallBlueButton(QPushButton *button, QString objectName) { if(!objectName.isEmpty()) @@ -488,63 +207,6 @@ void RegmapStyleHelper::smallBlueButton(QPushButton *button, QString objectName) Style::setStyle(button, style::properties::button::smallSquareIconButton, true, true); } -void RegmapStyleHelper::iconBlueButton(QPushButton *button, QString objectName) -{ - if(!objectName.isEmpty()) - button->setObjectName(objectName); - Style::setStyle(button, style::properties::button::squareIconButton, true, true); -} - -QString RegmapStyleHelper::regmapControllerStyle(QWidget *widget, QString objectName) -{ - QString style = QString(R"css( - .QWidget { - margin-top: 4px ; - margin-bottom: 4px ; - border-radius: 4px; - } - QLineEdit { - font-size: 16px; - font-style: normal; - font-weight: normal; - text-align: left; - border-bottom: 0px; - } - )css"); - - style += RegmapStyleHelper::simpleWidgetStyle(); - - return style; -} - -QString RegmapStyleHelper::sliderStyle() -{ - QString style = QString(R"css( - QSlider::handle { - background: #404040; - border: 0px; - max-width: 8px; - margin: -8px 0; - border-radius: 3px; - } - QSlider::handle:vertical:hover { - background: #4a4a4b; - } - QSlider::groove { - border: 0px; - background: &&grooveBackground&& ; - margin: 2px 0; - border-radius: 0px; - max-width: 8px; - } - )css"); - - style.replace("&&handleBackground&&", RegmapStyleHelper::getColor("LabelText")); - style.replace("&&grooveBackground&&", RegmapStyleHelper::getColor("Transparent")); - - return style; -} - QString RegmapStyleHelper::getColorBasedOnValue(QString value) { uint32_t colorIndex = Utils::convertQStringToUint32(value) % 16; diff --git a/plugins/regmap/src/regmapstylehelper.hpp b/plugins/regmap/src/regmapstylehelper.hpp index 5c86dd6876..e10fcc6a65 100644 --- a/plugins/regmap/src/regmapstylehelper.hpp +++ b/plugins/regmap/src/regmapstylehelper.hpp @@ -57,39 +57,15 @@ class RegmapStyleHelper void operator=(const RegmapStyleHelper &) = delete; static RegmapStyleHelper *GetInstance(); - static void initColorMap(); - static QString getColor(QString id); - - static void DeviceRegisterMap(QWidget *widget); - static QString PartialFrameWidgetStyle(); - static QString FrameWidgetStyle(); - static QString bigTextLabelStyle(); - static void bigTextLabel(QLabel *label, QString objectName = ""); - static void labelStyle(QLabel *label, QString objectName); - static void regmapSettingsMenu(RegisterMapSettingsMenu *settings, QString objectName = ""); - static void grayBackgroundHoverWidget(QWidget *widget, QString objectName = ""); - static void BlueButton(QPushButton *btn, QString objectName = ""); - static QString checkBoxStyle(); - static void checkBox(QCheckBox *checkbox, QString objectName = ""); static void BitFieldDetailedWidgetStyle(BitFieldDetailedWidget *widget, QString objectName = ""); static void BitFieldSimpleWidgetStyle(BitFieldSimpleWidget *widget, QString objectName = ""); static void RegisterSimpleWidgetStyle(RegisterSimpleWidget *widget, QString objectName = ""); - static QString grayLabelStyle(); - static QString whiteSmallTextLableStyle(); - static QString simpleWidgetStyle(); - static void comboboxStyle(QComboBox *combobox, QString objectName = ""); - static void titleSpinBoxStyle(TitleSpinBox *spinbox, QString objectName = ""); - static void searchBarStyle(SearchBarWidget *searchBar, QString objectName = ""); static void smallBlueButton(QPushButton *button, QString objectName = ""); - static void iconBlueButton(QPushButton *button, QString objectName = ""); - static QString regmapControllerStyle(QWidget *widget, QString objectName = ""); - static QString sliderStyle(); - static QString getColorBasedOnValue(QString value); - static void toggleSelectedRegister(QWidget *widget, bool toggle); static void applyBitfieldValueColorPreferences(BitFieldSimpleWidget *widget); static void applyRegisterValueColorPreferences(RegisterSimpleWidget *widget); + static QString getColorBasedOnValue(QString value); private: QMap colorMap; diff --git a/plugins/regmap/src/searchbarwidget.cpp b/plugins/regmap/src/searchbarwidget.cpp index 3d01a69660..6391ecf85d 100644 --- a/plugins/regmap/src/searchbarwidget.cpp +++ b/plugins/regmap/src/searchbarwidget.cpp @@ -31,6 +31,7 @@ #include #include #include "regmapstylehelper.hpp" +#include using namespace scopy; using namespace regmap; @@ -80,4 +81,4 @@ void SearchBarWidget::setEnabled(bool enabled) this->searchButton->setVisible(enabled); } -void SearchBarWidget::applyStyle() { RegmapStyleHelper::searchBarStyle(this); } +void SearchBarWidget::applyStyle() { Style::setStyle(searchBar, style::properties::regmap::searchBar, true, true); } diff --git a/plugins/regmap/src/titlespinbox.cpp b/plugins/regmap/src/titlespinbox.cpp index 0e7699f481..a6032cbb39 100644 --- a/plugins/regmap/src/titlespinbox.cpp +++ b/plugins/regmap/src/titlespinbox.cpp @@ -24,7 +24,9 @@ #include "regmapstylehelper.hpp" #include +#include #include +#include "style_properties.h" using namespace scopy; using namespace regmap; @@ -39,11 +41,13 @@ TitleSpinBox::TitleSpinBox(QString title, QWidget *parent) setLayout(mainLayout); QWidget *spinboxWidget = new QWidget(this); + Style::setBackgroundColor(spinboxWidget, json::theme::interactive_subtle_disabled); QVBoxLayout *spinboxWidgetLayout = new QVBoxLayout(spinboxWidget); spinboxWidgetLayout->setSpacing(0); spinboxWidgetLayout->setMargin(0); QWidget *buttonWidget = new QWidget(this); + Style::setBackgroundColor(buttonWidget, json::theme::interactive_subtle_disabled); QVBoxLayout *buttonWidgetLayout = new QVBoxLayout(buttonWidget); buttonWidgetLayout->setSpacing(0); buttonWidgetLayout->setMargin(0); @@ -58,6 +62,8 @@ TitleSpinBox::TitleSpinBox(QString title, QWidget *parent) buttonWidgetLayout->addWidget(spinBoxDownButton); titleLabel = new QLabel(title); + Style::setStyle(titleLabel, style::properties::label::menuSmall); + Style::setBackgroundColor(titleLabel, json::theme::interactive_subtle_disabled); spinBox = new QSpinBox(spinboxWidget); spinBox->setButtonSymbols(spinBox->ButtonSymbols::NoButtons); @@ -70,7 +76,9 @@ TitleSpinBox::TitleSpinBox(QString title, QWidget *parent) mainLayout->addWidget(buttonWidget); mainLayout->addWidget(spinboxWidget); - RegmapStyleHelper::titleSpinBoxStyle(this); + Style::setStyle(this, style::properties::regmap::titleSpinbox, true, true); + Style::setStyle(spinBox, style::properties::regmap::titleSpinbox, true, true); + // RegmapStyleHelper::titleSpinBoxStyle(this); } TitleSpinBox::~TitleSpinBox() {} diff --git a/plugins/regmap/style/qss/properties/regmap/basicButton.qss b/plugins/regmap/style/qss/properties/regmap/basicButton.qss new file mode 100644 index 0000000000..f7b33ade0b --- /dev/null +++ b/plugins/regmap/style/qss/properties/regmap/basicButton.qss @@ -0,0 +1,18 @@ +QPushButton[&&property&&=true] { + min-height: &unit_2&; + max-height: &unit_2&; + border-radius: &radius_1&; + background-color: &interactive_primary_disabled&; + color: &content_inverse&; + font-weight: 700; + /* qproperty-iconSize: &unit_4&px; */ +} +QPushButton[&&property&&=true]:hover { + background-color: &interactive_primary_hover&; + color: &content_inverse&; +} + +QPushButton[&&property&&=true]:pressed { + background-color: &interactive_primary_pressed&; + color: &content_inverse&; +} diff --git a/plugins/regmap/style/qss/properties/regmap/deviceComboBox.qss b/plugins/regmap/style/qss/properties/regmap/deviceComboBox.qss new file mode 100644 index 0000000000..57bed3511d --- /dev/null +++ b/plugins/regmap/style/qss/properties/regmap/deviceComboBox.qss @@ -0,0 +1,17 @@ +QComboBox[&&property&&=true] { + color: &content_default& ; + font-size: &font_size_0_5&; + padding-left: 8px; + border-bottom: 0px; + background-color: &background_primary& ; +} + +QComboBox[&&property&&=true]:drop-down { + subcontrol-position: center right; + width: 10px; + height: 6px; + font-size: &font_size_2&; + text-align: left; + margin-right: 8px; + color: transparent; +} \ No newline at end of file diff --git a/plugins/regmap/style/qss/properties/regmap/lineEdit.qss b/plugins/regmap/style/qss/properties/regmap/lineEdit.qss new file mode 100644 index 0000000000..ea47f2c110 --- /dev/null +++ b/plugins/regmap/style/qss/properties/regmap/lineEdit.qss @@ -0,0 +1,7 @@ +QLineEdit[&&property&&=true] { + font-size: &unit_1&px; + font-style: normal; + font-weight: normal; + text-align: left; + border-bottom: 0px; +} diff --git a/plugins/regmap/style/qss/properties/regmap/registercontroller.qss b/plugins/regmap/style/qss/properties/regmap/registercontroller.qss new file mode 100644 index 0000000000..83629daf9f --- /dev/null +++ b/plugins/regmap/style/qss/properties/regmap/registercontroller.qss @@ -0,0 +1,15 @@ + +QWidget[&&property&&=true] { + margin-top: 4px ; + margin-bottom: 4px ; + border-radius: 4px; + background-color: &interactive_subtle_disabled& ; +} + +QWidget[&&property&&=true] { + background-color: &interactive_subtle_disabled& ; + border-radius: 4px; +} + + + diff --git a/plugins/regmap/style/qss/properties/regmap/regmapSlider.qss b/plugins/regmap/style/qss/properties/regmap/regmapSlider.qss new file mode 100644 index 0000000000..4511fbce92 --- /dev/null +++ b/plugins/regmap/style/qss/properties/regmap/regmapSlider.qss @@ -0,0 +1,19 @@ +QSlider[&&property&&=true]:handle { + background: #404040; + border: 0px; + max-width: 8px; + margin: -8px 0; + border-radius: 3px; +} + +QSlider[&&property&&=true]:handle:vertical:hover { + background: #4a4a4b; +} + +QSlider[&&property&&=true]:groove { + border: 0px; + background: Transparent ; + margin: 2px 0; + border-radius: 0px; + max-width: 8px; +} \ No newline at end of file diff --git a/plugins/regmap/style/qss/properties/regmap/searchBar.qss b/plugins/regmap/style/qss/properties/regmap/searchBar.qss new file mode 100644 index 0000000000..0a61b7586c --- /dev/null +++ b/plugins/regmap/style/qss/properties/regmap/searchBar.qss @@ -0,0 +1,20 @@ +QWidget[&&property&&=true] { + border-radius: 4px; + background-color: &interactive_subtle_disabled&; +} + +QLineEdit[&&property&&=true] { + color: &content_default&; + font-size: &font_size_0_5&; + padding-left: 16px; + padding-right: 16px; + border-bottom: 0px; +} + +QLineEdit[&&property&&=true]:hover { + border: 1px solid &interactive_primary_idle&; + border-radius: 4px; +} + + + diff --git a/plugins/regmap/style/qss/properties/regmap/simpleWidget.qss b/plugins/regmap/style/qss/properties/regmap/simpleWidget.qss new file mode 100644 index 0000000000..0d7e1740e2 --- /dev/null +++ b/plugins/regmap/style/qss/properties/regmap/simpleWidget.qss @@ -0,0 +1,22 @@ +QWidget[&&property&&=true] { + background-color: &interactive_subtle_disabled&; + border-radius: 4px; +} + +QComboBox[&&property&&=true] { + color: &content_default& ; + font-size: &font_size_0_5&; + padding-left: 8px; + border-bottom: 0px; + background-color: &background_primary&; +} + +QComboBox[&&property&&=true]:drop-down { + subcontrol-position: center right; + width: 10px; + height: 6px; + font-size: 16px; + text-align: left; + margin-right: 8px; + color: transparent; +} \ No newline at end of file diff --git a/plugins/regmap/style/qss/properties/regmap/titleSpinbox.qss b/plugins/regmap/style/qss/properties/regmap/titleSpinbox.qss new file mode 100644 index 0000000000..dba9b0da3b --- /dev/null +++ b/plugins/regmap/style/qss/properties/regmap/titleSpinbox.qss @@ -0,0 +1,12 @@ +QWidget[&&property&&=true] { + font-size: 18px; + font-style: normal; + font-weight: normal; + text-align: left; + color: &content_default& ; + background-color: &interactive_subtle_disabled& ; +} + +QSpinBox[&&property&&=true] { + border: 0px; +} \ No newline at end of file