Skip to content

Commit

Permalink
regmap: style updates
Browse files Browse the repository at this point in the history
Signed-off-by: IonutMuthi <[email protected]>
  • Loading branch information
IonutMuthi committed Nov 18, 2024
1 parent a402722 commit 284392e
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 25 deletions.
9 changes: 6 additions & 3 deletions plugins/regmap/src/deviceregistermap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ DeviceRegisterMap::DeviceRegisterMap(RegisterMapTemplate *registerMapTemplate, R
tool->bottomCentral()->setVisible(true);
layout->addWidget(tool);

Style::setBackgroundColor(this, Style::getAttribute(json::theme::interactive_primary_disabled));
Style::setBackgroundColor(this, Style::getAttribute(json::theme::interactive_secondary_disabled));

initSettings();

Expand All @@ -96,6 +96,8 @@ DeviceRegisterMap::DeviceRegisterMap(RegisterMapTemplate *registerMapTemplate, R

QWidget *registerMapTable = new QWidget();
QVBoxLayout *registerMapTableLayout = new QVBoxLayout(registerMapTable);
registerMapTableLayout->setMargin(0);
registerMapTableLayout->setSpacing(0);
Utils::removeLayoutMargins(registerMapTableLayout);
registerMapTable->setLayout(registerMapTableLayout);
tool->addWidgetToCentralContainerHelper(registerMapTable);
Expand All @@ -108,7 +110,7 @@ DeviceRegisterMap::DeviceRegisterMap(RegisterMapTemplate *registerMapTemplate, R

QWidget *registerTableHead = new QWidget(tableHeadWidget);
Style::setBackgroundColor(registerTableHead,
Style::getAttribute(json::theme::interactive_subtle_disabled));
Style::getAttribute(json::theme::interactive_secondary_disabled));

QHBoxLayout *registerTableHeadLayout = new QHBoxLayout(registerTableHead);
registerTableHeadLayout->setSpacing(0);
Expand All @@ -119,7 +121,8 @@ DeviceRegisterMap::DeviceRegisterMap(RegisterMapTemplate *registerMapTemplate, R
registerTableHead->setFixedWidth(180);

QWidget *colBitCount = new QWidget(tableHeadWidget);
Style::setBackgroundColor(colBitCount, Style::getAttribute(json::theme::interactive_subtle_disabled));
Style::setBackgroundColor(colBitCount,
Style::getAttribute(json::theme::interactive_secondary_disabled));

QHBoxLayout *tableHead = new QHBoxLayout(colBitCount);
colBitCount->setLayout(tableHead);
Expand Down
16 changes: 11 additions & 5 deletions plugins/regmap/src/register/registerdetailedwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,22 @@ RegisterDetailedWidget::RegisterDetailedWidget(RegisterModel *regModel, QWidget
QVBoxLayout *layout = new QVBoxLayout(this);
Utils::removeLayoutMargins(layout);
setLayout(layout);
layout->setSpacing(5);
layout->setSpacing(0);

regWidth = regModel->getWidth();

QWidget *nameDescriptionWidget = new QWidget(this);
Style::setBackgroundColor(nameDescriptionWidget, Style::getAttribute(json::theme::interactive_subtle_disabled));
Style::setBackgroundColor(nameDescriptionWidget,
Style::getAttribute(json::theme::interactive_secondary_disabled));
QHBoxLayout *nameDescriptionLayout = new QHBoxLayout(nameDescriptionWidget);
nameDescriptionWidget->setLayout(nameDescriptionLayout);
// nameDescriptionLayout->setMargin(10);

QLabel *nameLabel = new QLabel("Name: " + regModel->getName(), this);
QLabel *descriptionLabel = new QLabel("Description: " + regModel->getDescription(), this);
nameDescriptionLayout->addWidget(nameLabel);
nameDescriptionLayout->addWidget(descriptionLabel);
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);

QGridLayout *bitFieldsWidgetLayout = new QGridLayout();
bitFieldsWidgetLayout->setMargin(0);
Expand All @@ -70,12 +73,15 @@ RegisterDetailedWidget::RegisterDetailedWidget(RegisterModel *regModel, QWidget
bitFieldList = new QVector<BitFieldDetailedWidget *>();
BitFieldDetailedWidgetFactory bitFieldDetailedWidgetFactory;
QWidget *bitFieldsWidget = new QWidget();
bitFieldsWidget->setContentsMargins(0, 0, 2, 0);
bitFieldsWidget->setLayout(bitFieldsWidgetLayout);
VerticalScrollArea *scrollArea = new VerticalScrollArea();
scrollArea->setWidget(bitFieldsWidget);

// layout->addWidget(nameDescriptionWidget);
layout->addWidget(scrollArea);

bitFieldsWidgetLayout->addWidget(nameDescriptionWidget, 0, 0, 1, 8);
bitFieldsWidgetLayout->addWidget(nameDescriptionWidget, 0, 0, 1, 3);
int currentBitFieldCount = 0;
int row = 1;
int col = 0;
Expand Down Expand Up @@ -106,7 +112,7 @@ RegisterDetailedWidget::RegisterDetailedWidget(RegisterModel *regModel, QWidget
bitFieldsWidgetLayout->setColumnStretch(col, 1);
col++;
}
bitFieldsWidgetLayout->addItem(new QSpacerItem(10, 10, QSizePolicy::Preferred, QSizePolicy::Expanding),
bitFieldsWidgetLayout->addItem(new QSpacerItem(1, 1, QSizePolicy::Preferred, QSizePolicy::Expanding),
row + 1, col);
}
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/regmap/src/register/registersimplewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ RegisterSimpleWidget::RegisterSimpleWidget(RegisterModel *registerModel, QVector
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);

QHBoxLayout *layout = new QHBoxLayout();
layout->setMargin(2);
layout->setContentsMargins(0, 2, 0, 2);
layout->setSpacing(4);
setLayout(layout);

Expand Down
2 changes: 0 additions & 2 deletions plugins/regmap/src/registercontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,6 @@ void RegisterController::applyStyle()
Style::setStyle(writeButton, style::properties::button::basicButton, true, true);
writeButton->setFixedHeight(40);
Style::setStyle(valueLabel, style::properties::label::menuSmall);

// setStyleSheet(RegmapStyleHelper::regmapControllerStyle(nullptr));
}

void RegisterController::startTutorial()
Expand Down
3 changes: 3 additions & 0 deletions plugins/regmap/src/registermaptool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ RegisterMapTool::RegisterMapTool(QWidget *parent)
tool->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
tool->topContainer()->setVisible(true);
tool->rightContainer()->setVisible(true);
tool->layout()->setMargin(4);
tool->layout()->setSpacing(2);
tool->centralContainer()->layout()->setSpacing(0);
lay->addWidget(tool);

InfoBtn *infoBtn = new InfoBtn(this);
Expand Down
5 changes: 2 additions & 3 deletions plugins/regmap/src/regmapstylehelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ void RegmapStyleHelper::toggleSelectedRegister(QWidget *widget, bool toggle)
{
QString styleSheet = "";
if(toggle) {
styleSheet =
"background-color:" + Style::getAttribute(json::theme::interactive_primary_disabled) + " ;";
styleSheet = "background-color:" + Style::getAttribute(json::theme::interactive_primary_idle) + " ;";
} else {
styleSheet = "background-color:" + Style::getAttribute(json::theme::background_primary) + " ;";
}
Expand Down Expand Up @@ -134,7 +133,7 @@ void RegmapStyleHelper::BitFieldDetailedWidgetStyle(BitFieldDetailedWidget *widg
}
)css");

style.replace("&&frameBackground&&", Style::getAttribute(json::theme::interactive_subtle_disabled));
style.replace("&&frameBackground&&", Style::getAttribute(json::theme::interactive_secondary_disabled));

widget->setMinimumWidth(10);
widget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
Expand Down
7 changes: 3 additions & 4 deletions plugins/regmap/src/titlespinbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ TitleSpinBox::TitleSpinBox(QString title, QWidget *parent)
setLayout(mainLayout);

QWidget *spinboxWidget = new QWidget(this);
Style::setBackgroundColor(spinboxWidget, json::theme::interactive_subtle_disabled);
Style::setBackgroundColor(spinboxWidget, json::theme::interactive_secondary_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);
Style::setBackgroundColor(buttonWidget, json::theme::interactive_secondary_disabled);
QVBoxLayout *buttonWidgetLayout = new QVBoxLayout(buttonWidget);
buttonWidgetLayout->setSpacing(0);
buttonWidgetLayout->setMargin(0);
Expand All @@ -63,7 +63,7 @@ TitleSpinBox::TitleSpinBox(QString title, QWidget *parent)

titleLabel = new QLabel(title);
Style::setStyle(titleLabel, style::properties::label::menuSmall);
Style::setBackgroundColor(titleLabel, json::theme::interactive_subtle_disabled);
Style::setBackgroundColor(titleLabel, json::theme::interactive_secondary_disabled);

spinBox = new QSpinBox(spinboxWidget);
spinBox->setButtonSymbols(spinBox->ButtonSymbols::NoButtons);
Expand All @@ -78,7 +78,6 @@ TitleSpinBox::TitleSpinBox(QString title, QWidget *parent)

Style::setStyle(this, style::properties::regmap::titleSpinbox, true, true);
Style::setStyle(spinBox, style::properties::regmap::titleSpinbox, true, true);
// RegmapStyleHelper::titleSpinBoxStyle(this);
}

TitleSpinBox::~TitleSpinBox() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ QWidget[&&property&&=true] {
margin-top: 4px ;
margin-bottom: 4px ;
border-radius: 4px;
background-color: &interactive_subtle_disabled& ;
background-color: &interactive_secondary_disabled& ;
}

QWidget[&&property&&=true] {
background-color: &interactive_subtle_disabled& ;
background-color: &interactive_secondary_disabled& ;
border-radius: 4px;
}

Expand Down
8 changes: 4 additions & 4 deletions plugins/regmap/style/qss/properties/regmap/regmapSlider.qss
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
QSlider[&&property&&=true]:handle {
background: #404040;
color: &interactive_subtle_idle&;
border: 0px;
max-width: 8px;
margin: -8px 0;
border-radius: 3px;
}

QSlider[&&property&&=true]:handle:vertical:hover {
background: #4a4a4b;
background-color: #4a4a4b;
}

QSlider[&&property&&=true]:groove {
border: 0px;
background: Transparent ;
background-color: &interactive_secondary_disabled& ;
margin: 2px 0;
border-radius: 0px;
max-width: 8px;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ QWidget[&&property&&=true] {
font-weight: normal;
text-align: left;
color: &content_default& ;
background-color: &interactive_subtle_disabled& ;
background-color: &interactive_secondary_disabled& ;
}

QSpinBox[&&property&&=true] {
Expand Down

0 comments on commit 284392e

Please sign in to comment.