diff --git a/core/src/scopyaboutpage.cpp b/core/src/scopyaboutpage.cpp index 2f694320a..56bbc392c 100644 --- a/core/src/scopyaboutpage.cpp +++ b/core/src/scopyaboutpage.cpp @@ -51,8 +51,6 @@ void ScopyAboutPage::initUI() layout->setSpacing(0); this->setLayout(layout); layout->addWidget(tabWidget); - - StyleHelper::TabWidgetEastMenu(tabWidget, "aboutPageTable"); } QWidget *ScopyAboutPage::buildPage(QString src) diff --git a/core/src/scopymainwindow.cpp b/core/src/scopymainwindow.cpp index d8b514e87..f3c6b3f01 100644 --- a/core/src/scopymainwindow.cpp +++ b/core/src/scopymainwindow.cpp @@ -80,7 +80,6 @@ ScopyMainWindow::ScopyMainWindow(QWidget *parent) ScopyTitleManager::setScopyVersion("v" + QString(scopy::config::version())); ScopyTitleManager::setGitHash(QString(SCOPY_VERSION_GIT)); - StyleHelper::GetInstance()->initColorMap(); IIOUnitsManager::GetInstance(); setAttribute(Qt::WA_QuitOnClose, true); initPythonWIN32(); diff --git a/core/src/scopypreferencespage.cpp b/core/src/scopypreferencespage.cpp index d99fecf85..c8bf42f71 100644 --- a/core/src/scopypreferencespage.cpp +++ b/core/src/scopypreferencespage.cpp @@ -66,7 +66,6 @@ void ScopyPreferencesPage::initUI() layout->addWidget(tabWidget); Style::setBackgroundColor(tabWidget, json::theme::background_primary); - StyleHelper::TabWidgetEastMenu(tabWidget, "preferencesTable"); } void ScopyPreferencesPage::addHorizontalTab(QWidget *w, QString text) diff --git a/gui/include/gui/stylehelper.h b/gui/include/gui/stylehelper.h index a5ed09f88..967c512e1 100644 --- a/gui/include/gui/stylehelper.h +++ b/gui/include/gui/stylehelper.h @@ -67,35 +67,21 @@ class SCOPY_GUI_EXPORT StyleHelper : public QObject static StyleHelper *GetInstance(); public: - static void initColorMap(); - static QString getColor(QString id); static QString getChannelColor(int index); - static void SquareToggleButtonWithIcon(QPushButton *btn, QString objectName, bool checkable = false); static void BasicButton(QPushButton *btn, QString objectName = ""); static void RefreshButton(QPushButton *btn, QString objectName = ""); static void BasicSmallButton(QPushButton *btn, QString objectName = ""); static void CollapseCheckbox(QCheckBox *chk, QString objectName = ""); static void ColoredCircleCheckbox(QCheckBox *chk, QColor color, QString objectName = ""); static void ColoredSquareCheckbox(QCheckBox *chk, QColor color, QString objectName = ""); - static void MenuMediumLabel(QLabel *lbl, QString objectName = ""); static void MenuControlButton(QPushButton *btn, QString objectName = "", bool checkable = true); static void MenuControlWidget(QWidget *w, QColor color, QString objectName = ""); static void MenuLargeLabel(QLabel *lbl, QString objectName = ""); static void MenuHeaderLine(QFrame *line, QPen pen, QString objectName = ""); static void MenuHeaderWidget(QWidget *w, QString objectName = ""); - static void MenuEditTextHeaderWidget(QWidget *w, QString objectName = ""); - static void MenuSmallLabel(QLabel *lbl, QString objectName = ""); - static void MenuComboWidget(QWidget *w, QString objectName = ""); static void MenuSectionWidget(QWidget *w, QString objectName = ""); - static void MenuSpinComboBox(QComboBox *w, QString objectName = ""); - static void MenuOnOffSwitch(QWidget *w, QString objectName = ""); - static void MenuCollapseSection(QWidget *w, QString objectName = ""); static void MenuCollapseHeaderLineEdit(QLineEdit *w, QString objectName = ""); - static void MenuBigSwitch(QWidget *w, QString objectName = ""); - static void MenuBigSwitchButton(CustomSwitch *w, QString objectName = ""); - static void BlueGrayButton(QPushButton *btn, QString objectName = ""); static void BlueIconButton(QPushButton *w, QIcon icon, QString objectName = ""); - static void TabWidgetEastMenu(QTabWidget *w, QString objectName = ""); static void BackgroundPage(QWidget *w, QString objectName = ""); static void BackgroundWidget(QWidget *w, QString objectName = ""); static void MeasurementPanelLabel(MeasurementLabel *w, QString objectName = ""); @@ -104,25 +90,15 @@ class SCOPY_GUI_EXPORT StyleHelper : public QObject QString objectName = ""); static void HoverWidget(QWidget *w, bool draggable = false, QString objectName = ""); static void TransparentWidget(QWidget *w, QString objectName = ""); - static void ScopyStatusBar(QWidget *w, QString objectName = ""); static void HoverToolTip(QWidget *w, QString info, QString objectName = ""); - static void WarningLabel(QLabel *w, QString objectName = ""); static void NoBackgroundIconButton(QPushButton *w, QIcon icon, QString objectName = ""); - static void BackgroundAddPage(QWidget *w, QString objectName = ""); static void BrowseButton(QPushButton *btn, QString objectName = ""); - static void SpinBoxUpButton(QPushButton *w, QString objectName = ""); - static void SpinBoxDownButton(QPushButton *w, QString objectName = ""); - static void MenuSpinboxLabel(QLabel *m_label, QString objectName = ""); - static void TabWidgetBarUnderline(QTabWidget *w, QString objectName = ""); - static void TableWidgetDebugger(QTableWidget *w, QString objectName = ""); - static void SplitterStyle(QSplitter *w, QString objectName = ""); static void OrangeWidget(QWidget *w, QString objectName = ""); static void ActiveStoredLabel(QLabel *w, QString objectName = ""); static void FaultsFrame(QFrame *w, QString objectName = ""); static void FaultsExplanation(QWidget *w, QString objectName = ""); private: - QMap colorMap; static StyleHelper *pinstance_; }; } // namespace scopy diff --git a/gui/include/gui/widgets/menuonoffswitch.h b/gui/include/gui/widgets/menuonoffswitch.h index 9061cc1a9..b1e4598eb 100644 --- a/gui/include/gui/widgets/menuonoffswitch.h +++ b/gui/include/gui/widgets/menuonoffswitch.h @@ -41,7 +41,6 @@ class SCOPY_GUI_EXPORT MenuOnOffSwitch : public QWidget virtual ~MenuOnOffSwitch(); QAbstractButton *onOffswitch(); - void applyStylesheet(); private: QLabel *m_label; diff --git a/gui/src/style.cpp b/gui/src/style.cpp index 40e23cc7e..a510ae587 100644 --- a/gui/src/style.cpp +++ b/gui/src/style.cpp @@ -223,6 +223,8 @@ QList Style::getChannelColorList() return list; } +// using setStyle is more efficient if possible +// for example if the color is background_primary, you may use style::properties::widget::basicBackground void Style::setBackgroundColor(QWidget *widget, const char *color, bool extend_to_children) { setBackgroundColor(widget, getAttribute(color), extend_to_children); diff --git a/gui/src/stylehelper.cpp b/gui/src/stylehelper.cpp index 3b6351dc9..8f6a9945b 100644 --- a/gui/src/stylehelper.cpp +++ b/gui/src/stylehelper.cpp @@ -49,22 +49,6 @@ StyleHelper *StyleHelper::GetInstance() StyleHelper::~StyleHelper() {} -void StyleHelper::initColorMap() -{ - auto sh = StyleHelper::GetInstance(); - sh->colorMap.insert("interactive_primary_idle", Style::getAttribute(json::theme::interactive_primary_idle)); - sh->colorMap.insert("interactive_subtle_idle", Style::getAttribute(json::theme::interactive_subtle_idle)); - sh->colorMap.insert("interactive_subtle_disabled", - Style::getAttribute(json::theme::interactive_subtle_disabled)); - sh->colorMap.insert("background_primary", Style::getAttribute(json::theme::background_primary)); - sh->colorMap.insert("content_default", Style::getAttribute(json::theme::content_default)); - sh->colorMap.insert("content_subtle", Style::getAttribute(json::theme::content_subtle)); - sh->colorMap.insert("content_busy", Style::getAttribute(json::theme::content_busy)); - sh->colorMap.insert("content_inverse", Style::getAttribute(json::theme::content_inverse)); - sh->colorMap.insert("background_subtle", Style::getAttribute(json::theme::background_subtle)); - sh->colorMap.insert("danger_default", Style::getAttribute(json::theme::danger_default)); -} - QString StyleHelper::getChannelColor(int index) { QColor color; @@ -80,31 +64,6 @@ QString StyleHelper::getChannelColor(int index) return color.name(); } -QString StyleHelper::getColor(QString id) -{ - auto sh = StyleHelper::GetInstance(); - return sh->colorMap[id]; -} - -void StyleHelper::SquareToggleButtonWithIcon(QPushButton *btn, QString objectName, bool checkable) -{ - if(!objectName.isEmpty()) - btn->setObjectName(objectName); - btn->setCheckable(checkable); - btn->setChecked(false); - Style::setStyle(btn, style::properties::button::squareIconButton); - Style::setStyle(btn, style::properties::widget::solidBorder); -} - -void StyleHelper::BlueGrayButton(QPushButton *btn, QString objectName) -{ - if(!objectName.isEmpty()) - btn->setObjectName(objectName); - btn->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); - - Style::setStyle(btn, style::properties::button::blueGrayButton); -} - void StyleHelper::MeasurementPanelLabel(MeasurementLabel *w, QString objectName) { if(!objectName.isEmpty()) @@ -151,7 +110,7 @@ void StyleHelper::MeasurementSelectorItemWidget(QString iconPath, MeasurementSel lay->setMargin(0); lay->setSpacing(0); - w->m_icon->setPixmap(Style::getPixmap(iconPath)); + w->m_icon->setPixmap(iconPath); w->m_icon->setFixedSize(24, 24); w->m_name->setContentsMargins(5, 0, 0, 0); @@ -203,7 +162,9 @@ void StyleHelper::CollapseCheckbox(QCheckBox *chk, QString objectName) { if(!objectName.isEmpty()) chk->setObjectName(objectName); - chk->setFixedSize(16, 16); + + int size = Style::getDimension(json::global::unit_1); + chk->setFixedSize(size, size); Style::setStyle(chk, style::properties::checkbox::collapseCB, true, true); } @@ -216,39 +177,17 @@ void StyleHelper::ColoredSquareCheckbox(QCheckBox *chk, QColor color, QString ob Style::setStyle(chk, style::properties::checkbox::squareCB, true, true); } -void StyleHelper::MenuMediumLabel(QLabel *lbl, QString objectName) -{ - Style::setStyle(lbl, style::properties::label::menuMedium); -} - void StyleHelper::MenuControlButton(QPushButton *btn, QString objectName, bool checkable) { if(!objectName.isEmpty()) btn->setObjectName(objectName); btn->setCheckable(checkable); btn->setChecked(false); - btn->setFixedSize(32, 16); - QString style = QString(R"css( - QPushButton { - background-color: transparent; - } - QPushButton#btn:pressed { - border-image: url(:/gui/icons/setup_btn_checked.svg) - } - QPushButton#btn:!pressed { - border-image: url(:/gui/icons/&&theme&&/icons/setup_btn_unchecked.svg) - } - QPushButton#btn:hover:!pressed:!checked { - border-image: url(:/gui/icons/&&theme&&/icons/setup_btn_hover.svg) - } - QPushButton#btn:checked { - border-image: url(:/gui/icons/setup_btn_checked.svg); - } - )css"); - - style.replace("&&theme&&", Style::getAttribute(json::theme::icon_theme_folder)); - btn->setStyleSheet(style); - btn->setIconSize(QSize(48, 48)); + btn->setFixedSize(Style::getDimension(json::global::unit_2_5), Style::getDimension(json::global::unit_1)); + Style::setStyle(btn, style::properties::button::menuControlButton, true, true); + + int size = Style::getDimension(json::global::unit_4); + btn->setIconSize(QSize(size, size)); } void StyleHelper::MenuControlWidget(QWidget *w, QColor color, QString objectName) @@ -256,30 +195,7 @@ void StyleHelper::MenuControlWidget(QWidget *w, QColor color, QString objectName QString style = "scopy--MenuControlButton {background-color: &&background_primary&&;}" "scopy--MenuControlButton[selected=true] { background-color:&&colorname&&;}"; style.replace("&&colorname&&", color.name()); - style.replace("&&background_primary&&", StyleHelper::getColor("background_primary")); - w->setStyleSheet(style); -} - -void StyleHelper::MenuSmallLabel(QLabel *m_lbl, QString objectName) -{ - if(!objectName.isEmpty()) - m_lbl->setObjectName(objectName); - - Style::setStyle(m_lbl, style::properties::label::menuSmall); -} - -void StyleHelper::MenuComboWidget(QWidget *w, QString objectName) -{ - if(!objectName.isEmpty()) - w->setObjectName(objectName); - w->setFixedHeight(72); - w->layout()->setContentsMargins(10, 2, 10, 2); - QString style = QString(R"css( - scopy--MenuComboWidget {background-color: &&background_primary&&; - border-radius: 4px; - } - )css"); - style.replace("&&background_primary&&", StyleHelper::getColor("background_primary")); + style.replace("&&background_primary&&", Style::getAttribute(json::theme::background_primary)); w->setStyleSheet(style); } @@ -289,20 +205,7 @@ void StyleHelper::MenuLargeLabel(QLabel *m_lbl, QString objectName) m_lbl->setObjectName(objectName); m_lbl->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum); - QString style = QString(R"css( - QLabel { - color: &&content_default&&; - background-color: rgba(255,255,255,0); - font-weight: bold; - font-family: Open Sans; - font-size: &&font_size_1&&; - font-style: normal; - } - )css"); - m_lbl->setText(m_lbl->text().toUpper()); - style.replace("&&content_default&&", StyleHelper::getColor("content_default")); - style.replace(QString("&&font_size_1&&"), Style::getAttribute(json::global::font_size_1)); - m_lbl->setStyleSheet(style); + Style::setStyle(m_lbl, style::properties::label::menuBig); } void StyleHelper::MenuHeaderLine(QFrame *m_line, QPen pen, QString objectName) @@ -327,195 +230,32 @@ void StyleHelper::MenuHeaderWidget(QWidget *w, QString objectName) { if(!objectName.isEmpty()) w->setObjectName(objectName); - w->setFixedHeight(48); - w->layout()->setContentsMargins(10, 2, 10, 2); - QString style = QString(R"css( - scopy--MenuHeaderWidget {background-color: &&background_primary&&; - border-radius: 4px; - } - )css"); - style.replace("&&background_primary&&", StyleHelper::getColor("background_primary")); - w->setStyleSheet(style); -} -void StyleHelper::MenuEditTextHeaderWidget(QWidget *w, QString objectName) -{ - if(!objectName.isEmpty()) - w->setObjectName(objectName); - w->setFixedHeight(48); - w->layout()->setContentsMargins(10, 2, 10, 2); - QString style = QString(R"css( - scopy--EditTextMenuHeader {background-color: &&background_primary&&; - border-radius: 4px; - } - QLineEdit { - background-color: transparent; - color: &&content_default&&; - font-size: &&font_size_2&&; - border: none; - padding: 2px; - } - )css"); - style.replace("&&background_primary&&", StyleHelper::getColor("background_primary")); - style.replace("&&content_default&&", StyleHelper::getColor("content_default")); - style.replace(QString("&&font_size_2&&"), Style::getAttribute(json::global::font_size_2)); - w->setStyleSheet(style); -} - -void StyleHelper::MenuSpinComboBox(QComboBox *w, QString objectName) {} - -void StyleHelper::MenuOnOffSwitch(QWidget *w, QString objectName) -{ - if(!objectName.isEmpty()) - w->setObjectName(objectName); - - QString style = QString(R"css( - scopy--MenuOnOffSwitch { - background-color: transparent; - })css"); - - w->setStyleSheet(style); -} - -void StyleHelper::MenuBigSwitchButton(CustomSwitch *w, QString objectName) -{ - // This needs to be redone ... - if(!objectName.isEmpty()) - w->setObjectName(objectName); - QString style = QString(R"css( -QPushButton { -min-height: 30px; -max-height: 30px; -background-color: &&content_inverse&&; -border-radius: 4px; -} - -QPushButton:disabled { -background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.501, y2:0, stop:0 &&interactive_subtle_disabled&&, stop:1 &&content_inverse&&); -} - -QWidget#handle { -min-height: 30px; -max-height: 30px; -background-color: &&interactive_primary_idle&&; -border-radius: 2px; -} - -QWidget#handle:disabled { -background-color: &&interactive_subtle_idle&&; -} - -QLabel { -margin-top: 6px; -background-color: transparent; -font: &&font_size_1&&; -} - -QLabel#on { -margin-top: 0px; -min-height:30px; -max-height:30px; -min-width:50px; -max-width:50px; -qproperty-alignment: AlignCenter AlignCenter; -margin-left: 0px; -color: &&content_default&&; -} - -QLabel#on:disabled { -color: rgba(255,255,255,102); -} - -QLabel#off { -margin-top: 0px; -min-height:30px; -max-height:30px; -min-width:50px; -max-width:50px; -margin-left: 50px; -color: &&content_default&&; -qproperty-alignment: AlignCenter AlignCenter; -} - -QLabel#off:disabled { -color: rgba(255,255,255,51); -} - )css"); - style.replace(QString("&&font_size_1&&"), Style::getAttribute(json::global::font_size_1)); - style.replace("&&content_default&&", StyleHelper::getColor("content_default")); - style.replace("&&interactive_primary_idle&&", StyleHelper::getColor("interactive_primary_idle")); - style.replace("&&interactive_subtle_disabled&&", StyleHelper::getColor("interactive_subtle_disabled")); - style.replace("&&content_inverse&&", StyleHelper::getColor("content_inverse")); - style.replace("&&interactive_subtle_idle&&", StyleHelper::getColor("interactive_subtle_idle")); - w->setStyleSheet(style); -} - -void StyleHelper::MenuBigSwitch(QWidget *w, QString objectName) -{ - if(!objectName.isEmpty()) - w->setObjectName(objectName); - QString style = QString(R"css( - scopy--MenuBigSwitch { - background-color: transparent; - } - )css"); - w->setStyleSheet(style); -} - -void StyleHelper::MenuCollapseSection(QWidget *w, QString objectName) -{ - if(!objectName.isEmpty()) - w->setObjectName(objectName); - - /// ???? - QString style = QString(R"css( -.QWidget { - background-color: transparent; -} -)css"); - /// ???? - w->setStyleSheet(style); + MenuSectionWidget(w); + w->setFixedHeight(Style::getDimension(json::global::unit_4)); } void StyleHelper::MenuSectionWidget(QWidget *w, QString objectName) { if(!objectName.isEmpty()) w->setObjectName(objectName); + w->layout()->setContentsMargins(10, 10, 10, 10); - QString style = QString(R"css( - .scopy--MenuSectionWidget {background-color: &&background_primary&&; - border-radius: 4px; - } - )css"); - style.replace("&&background_primary&&", StyleHelper::getColor("background_primary")); - w->setStyleSheet(style); + Style::setStyle(w, style::properties::widget::basicBackground, true, true); + Style::setStyle(w, style::properties::widget::solidBorder, true, true); } void StyleHelper::BlueIconButton(QPushButton *w, QIcon icon, QString objectName) { if(!objectName.isEmpty()) w->setObjectName(objectName); - int size = 30; + int size = Style::getDimension(json::global::unit_2_5); w->setIcon(icon); w->setIconSize(QSize(size, size)); w->setFixedHeight(size); w->setFixedWidth(size); - QString style = QString(R"css( - QPushButton{ - background-color: &&interactive_primary_idle&&; - color: &&content_default&&; - border-radius: 4px; - font-size: &&font_size_1&&; - } - QPushButton:hover:!pressed { background-color: &&interactive_primary_idle&&; } - QPushButton:pressed { background-color: &&interactive_primary_idle&&; } - QPushButton:disabled { background-color: grey; } - )css"); - style.replace("&&content_default&&", StyleHelper::getColor("content_default")); - style.replace(QString("&&font_size_1&&"), Style::getAttribute(json::global::font_size_1)); - style.replace("&&interactive_primary_idle&&", StyleHelper::getColor("interactive_primary_idle")); - w->setStyleSheet(style); + Style::setStyle(w, style::properties::button::basicButton, true, true); } void StyleHelper::BackgroundWidget(QWidget *w, QString objectName) @@ -525,71 +265,14 @@ void StyleHelper::BackgroundWidget(QWidget *w, QString objectName) Style::setBackgroundColor(w, json::theme::background_primary); } -void StyleHelper::TabWidgetEastMenu(QTabWidget *w, QString objectName) -{ - if(!objectName.isEmpty()) - w->setObjectName(objectName); - w->setTabPosition(QTabWidget::TabPosition::East); - QString style = QString(R"css( - QTabWidget::tab-bar { left: 0;} - QTabWidget::pane { border-top: 0px; } - QTabBar { qproperty-drawBase: 0; - background: &&background_primary&&; } - QTabBar::tab { - background: &&background_primary&&; - min-width: 150px; - height: 40px; - padding-bottom: 5px; - font: normal; - } - QTabBar::tab:selected { - color: &&content_default&&; - border-bottom: 2px solid &&interactive_primary_idle&&; - margin-top: 0px; - } - QTabBar::tab:!selected { - border-bottom: 2px solid &&content_default&&; - } - QTabBar::scroller { - width: 25px; - } - )css"); - style.replace("&&background_primary&&", StyleHelper::getColor("background_primary")); - style.replace("&&content_default&&", StyleHelper::getColor("content_default")); - style.replace("&&interactive_primary_idle&&", StyleHelper::getColor("interactive_primary_idle")); - w->tabBar()->setStyleSheet(style); -} - void StyleHelper::MenuCollapseHeaderLineEdit(QLineEdit *w, QString objectName) { if(!objectName.isEmpty()) w->setObjectName(objectName); w->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); w->setMinimumWidth(50); - // lbl->setMaximumWidth(80); - QString style = QString(R"css( - QLineEdit { - color: &&content_default&&; - background-color: rgba(255,255,255,0); - font-weight: bold; - font-family: Open Sans; - font-size: &&font_size_1&&; - font-style: normal; - border: 0px solid &&content_subtle&&; - border-bottom: 1px solid rgba(255, 255, 255, 102); -padding-left: -2px; - } - QLineEdit:disabled { - border: 0px solid &&content_subtle&&; - border-bottom: 0px solid rgba(255, 255, 255, 102); -padding-left: -2px; - } - )css"); - style.replace("&&content_default&&", StyleHelper::getColor("content_default")); - style.replace(QString("&&font_size_1&&"), Style::getAttribute(json::global::font_size_1)); - style.replace("&&content_subtle&&", StyleHelper::getColor("content_subtle")); - w->setStyleSheet(style); + Style::setStyle(w, style::properties::lineedit::headerLineEdit); } void StyleHelper::HoverWidget(QWidget *w, bool draggable, QString objectName) @@ -611,8 +294,8 @@ void StyleHelper::HoverWidget(QWidget *w, bool draggable, QString objectName) )css"); if(draggable) { - style.replace("&&Background&&", StyleHelper::getColor("background_primary")); - style.replace("&&HoverBackground&&", StyleHelper::getColor("background_subtle")); + style.replace("&&Background&&", Style::getAttribute(json::theme::background_primary)); + style.replace("&&HoverBackground&&", Style::getAttribute(json::theme::background_subtle)); } else { style.replace("&&Background&&", "transparent"); style.replace("&&HoverBackground&&", "transparent"); @@ -628,20 +311,6 @@ void StyleHelper::TransparentWidget(QWidget *w, QString objectName) w->setStyleSheet(style); } -void StyleHelper::ScopyStatusBar(QWidget *w, QString objectName) -{ - if(!objectName.isEmpty()) - w->setObjectName(objectName); - - QString style = QString(R"css( - QWidget { - background-color: &&background_primary&&; - } - )css"); - style.replace("&&background_primary&&", StyleHelper::getColor("background_primary")); - w->setStyleSheet(style); -} - void StyleHelper::HoverToolTip(QWidget *w, QString info, QString objectName) { if(!objectName.isEmpty()) @@ -653,29 +322,20 @@ void StyleHelper::HoverToolTip(QWidget *w, QString info, QString objectName) color: &&content_default&&; } )css"); - style.replace("&&content_default&&", StyleHelper::getColor("content_default")); + style.replace("&&content_default&&", Style::getAttribute(json::theme::content_default)); label->style(); style = QString(R"css(QWidget { background-color: &&background_primary&&; } )css"); - style.replace("&&background_primary&&", StyleHelper::getColor("background_primary")); + style.replace("&&background_primary&&", Style::getAttribute(json::theme::background_primary)); w->setStyleSheet(style); QHBoxLayout *layout = new QHBoxLayout(w); layout->addWidget(label); } -void StyleHelper::WarningLabel(QLabel *w, QString objectName) -{ - QString style = QString(R"css( - color: &&content_busy&&; - )css"); - style.replace("&&content_busy&&", StyleHelper::getColor("content_busy")); - w->setStyleSheet(style); -} - void StyleHelper::NoBackgroundIconButton(QPushButton *w, QIcon icon, QString objectName) { if(!objectName.isEmpty()) @@ -693,145 +353,17 @@ void StyleHelper::NoBackgroundIconButton(QPushButton *w, QIcon icon, QString obj w->setStyleSheet(style); } -void StyleHelper::BackgroundAddPage(QWidget *w, QString objectName) -{ - if(!objectName.isEmpty()) - w->setObjectName(objectName); - QString style = QString(R"css( - .QWidget { - background-color: &&background_primary&&; - background-color: red; - } - )css"); - style.replace("&&background_primary&&", StyleHelper::getColor("background_primary")); - w->setStyleSheet(style); -} - void StyleHelper::BrowseButton(QPushButton *btn, QString objectName) { Style::setStyle(btn, style::properties::button::basicButton); btn->setText("..."); - btn->setFixedSize(30, 30); -} - -void StyleHelper::MenuSpinboxLabel(QLabel *w, QString objectName) -{ - if(!objectName.isEmpty()) - w->setObjectName(objectName); - - QString style = QString(R"css( -QLabel { - color: rgba(255, 255, 255, 102); - font-size: &&font_size_1&&; - background-color: transparent; -} -)css"); - style.replace(QString("&&font_size_1&&"), Style::getAttribute(json::global::font_size_1)); - w->setStyleSheet(style); -} - -void StyleHelper::SpinBoxUpButton(QPushButton *w, QString objectName) -{ - if(!objectName.isEmpty()) - w->setObjectName(objectName); - - QString style = QString(R"css( - QPushButton { - background-color: transparent; - border-image: url(:/gui/icons/sba_up_btn.svg); - border: 0px; - } - QPushButton:pressed { - border-image: url(:/gui/icons/sba_up_btn_pressed.svg); - } - QPushButton:hover:!pressed { - border-image: url(:/gui/icons/sba_up_btn_hover.svg); - })css"); - - w->setStyleSheet(style); -} - -void StyleHelper::SpinBoxDownButton(QPushButton *w, QString objectName) -{ - if(!objectName.isEmpty()) - w->setObjectName(objectName); - - QString style = QString(R"css( - QPushButton { - background-color: transparent; - border-image: url(:/gui/icons/sba_dn_btn.svg); - border: 0px; - } - QPushButton:pressed { - border-image: url(:/gui/icons/sba_dn_btn_pressed.svg); - } - QPushButton:hover:!pressed { - border-image: url(:/gui/icons/sba_dn_btn_hover.svg); - })css"); - - w->setStyleSheet(style); -} - -void StyleHelper::TabWidgetBarUnderline(QTabWidget *w, QString objectName) -{ - if(!objectName.isEmpty()) { - w->setObjectName(objectName); - } - - QString style = R"css(QTabBar::tab:selected { border-bottom-color: &&interactive_primary_idle&&; })css"; - style.replace("&&interactive_primary_idle&&", StyleHelper::getColor("interactive_primary_idle")); - w->setStyleSheet(style); -} - -void StyleHelper::TableWidgetDebugger(QTableWidget *w, QString objectName) -{ - if(!objectName.isEmpty()) { - w->setObjectName(objectName); - } - - QString style = QString(R"css( - QHeaderView::section { - border: none; - background-color:&&background_primary&&; - font-family: Open Sans; - } - QTableWidget::item { - border-left: 1px solid &&content_default&&; - font-family: Open Sans; - } - QTableWidget::item::selected { - background-color: &&interactive_primary_idle&&; - font-family: Open Sans; - } - QHeaderView::section { - border-left: 1px solid &&content_default&&; - font-family: Open Sans; - } - )css"); - style.replace("&&background_primary&&", StyleHelper::getColor("background_primary")); - style.replace("&&content_default&&", StyleHelper::getColor("content_default")); - style.replace("&&interactive_primary_idle&&", StyleHelper::getColor("interactive_primary_idle")); - w->setStyleSheet(style); -} - -void StyleHelper::SplitterStyle(QSplitter *w, QString objectName) -{ - if(!objectName.isEmpty()) { - w->setObjectName(objectName); - } - - QString style = QString(R"css( - QSplitter::handle:horizontal { width: 6px; } - QSplitter::handle:vertical { height: 6px; } - QSplitter::handle:hover { background-color: rgba(0, 0, 0, 40); } - QSplitter::handle:pressed { background-color: rgba(0, 0, 0, 70); } - QSplitter::handle:disabled { background-color: transparent; } - )css"); - - w->setStyleSheet(style); + int size = Style::getDimension(json::global::unit_2_5); + btn->setFixedSize(size, size); } +// TODO: move these functions to SWIOT specicfic style structure +// SWIOT ------------------------------------------------------- void StyleHelper::OrangeWidget(QWidget *w, QString objectName) { if(!objectName.isEmpty()) @@ -841,7 +373,7 @@ void StyleHelper::OrangeWidget(QWidget *w, QString objectName) color:&&orange&& } )css"); - style.replace("&&orange&&", StyleHelper::getColor("interactive_primary_idle")); + style.replace("&&orange&&", Style::getAttribute(json::theme::interactive_primary_idle)); w->setStyleSheet(style); } @@ -856,7 +388,7 @@ void StyleHelper::ActiveStoredLabel(QLabel *w, QString objectName) QLabel[high=false] { border-color: &&content_default&&; background-color: transparent; } QLabel[high=true] { border-color: &&content_default&&; background-color: &&content_default&&; } )css"); - style.replace("&&content_default&&", StyleHelper::getColor("content_default")); + style.replace("&&content_default&&", Style::getAttribute(json::theme::content_default)); w->setStyleSheet(style); } @@ -867,8 +399,8 @@ void StyleHelper::FaultsFrame(QFrame *w, QString objectName) QString style = QString(R"css( QFrame[pressed=true] { background-color: &&elementHighlight&&; border: 1px solid &&elementBackground&&; border-radius:5px; } )css"); - style.replace("&&elementHighlight&&", StyleHelper::getColor("content_subtle")); - style.replace("&&elementBackground&&", StyleHelper::getColor("background_primary")); + style.replace("&&elementHighlight&&", Style::getAttribute(json::theme::content_subtle)); + style.replace("&&elementBackground&&", Style::getAttribute(json::theme::background_primary)); w->setStyleSheet(style); } @@ -881,9 +413,10 @@ void StyleHelper::FaultsExplanation(QWidget *w, QString objectName) QWidget[highlighted=true]{color:&&content_default&&;} QWidget{color:&&defaultColor&&;} )css"); - style.replace("&&defaultColor&&", StyleHelper::getColor("interactive_subtle_idle")); - style.replace("&&content_default&&", StyleHelper::getColor("content_default")); + style.replace("&&defaultColor&&", Style::getAttribute(json::theme::interactive_subtle_idle)); + style.replace("&&content_default&&", Style::getAttribute(json::theme::content_default)); w->setStyleSheet(style); } +// SWIOT ------------------------------------------------------- #include "moc_stylehelper.cpp" diff --git a/gui/src/widgets/connectionloadingbar.cpp b/gui/src/widgets/connectionloadingbar.cpp index f531f0a9b..94c50034e 100644 --- a/gui/src/widgets/connectionloadingbar.cpp +++ b/gui/src/widgets/connectionloadingbar.cpp @@ -21,6 +21,7 @@ #include "connectionloadingbar.h" #include +#include #include using namespace scopy; @@ -67,7 +68,7 @@ void ConnectionLoadingBar::setupUi() m_progressBar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); m_progressBar->setValue(0); QString style = QString("QProgressBar::chunk {background-color: %1;}") - .arg(StyleHelper::getColor("interactive_primary_idle")); + .arg(Style::getAttribute(json::theme::interactive_primary_idle)); setStyleSheet(style); layout()->addWidget(m_loadingLabel); diff --git a/gui/src/widgets/edittextmenuheader.cpp b/gui/src/widgets/edittextmenuheader.cpp index eff54e9ff..372b0fb15 100644 --- a/gui/src/widgets/edittextmenuheader.cpp +++ b/gui/src/widgets/edittextmenuheader.cpp @@ -51,7 +51,6 @@ QLineEdit *EditTextMenuHeader::lineEdit() const { return m_lineEdit; } void EditTextMenuHeader::applyStylesheet() { StyleHelper::MenuHeaderLine(m_line, m_pen, "menuSeparator"); - StyleHelper::MenuEditTextHeaderWidget(this, "menuHeader"); } #include "moc_edittextmenuheader.cpp" diff --git a/gui/src/widgets/menucollapsesection.cpp b/gui/src/widgets/menucollapsesection.cpp index a08123f65..03630ceaf 100644 --- a/gui/src/widgets/menucollapsesection.cpp +++ b/gui/src/widgets/menucollapsesection.cpp @@ -97,7 +97,7 @@ MenuCollapseSection::MenuCollapseSection(QString title, MenuCollapseSection::Men : QWidget(parent) , m_title(title) { - StyleHelper::MenuCollapseSection(this, "menuCollapse"); + Style::setBackgroundColor(this, QString("transparent")); m_lay = new QVBoxLayout(this); m_lay->setMargin(0); m_lay->setSpacing(0); diff --git a/gui/src/widgets/menuonoffswitch.cpp b/gui/src/widgets/menuonoffswitch.cpp index d7faf941c..8460c3ae8 100644 --- a/gui/src/widgets/menuonoffswitch.cpp +++ b/gui/src/widgets/menuonoffswitch.cpp @@ -48,13 +48,10 @@ MenuOnOffSwitch::MenuOnOffSwitch(QString title, QWidget *parent, bool medium) lay->addWidget(m_label); lay->addSpacerItem(new QSpacerItem(10, 10, QSizePolicy::Expanding, QSizePolicy::Fixed)); lay->addWidget(m_switch); - applyStylesheet(); } MenuOnOffSwitch::~MenuOnOffSwitch() {} QAbstractButton *MenuOnOffSwitch::onOffswitch() { return m_switch; } -void MenuOnOffSwitch::applyStylesheet() { StyleHelper::MenuOnOffSwitch(this, "menuOnOffSwitch"); } - #include "moc_menuonoffswitch.cpp" diff --git a/gui/src/widgets/scopystatusbar.cpp b/gui/src/widgets/scopystatusbar.cpp index 94db498a6..fcd0250b2 100644 --- a/gui/src/widgets/scopystatusbar.cpp +++ b/gui/src/widgets/scopystatusbar.cpp @@ -24,6 +24,7 @@ #include #include #include +#include using namespace scopy; @@ -60,7 +61,7 @@ void ScopyStatusBar::initUi() m_stackedWidget = new QStackedWidget(this); layout()->addWidget(m_stackedWidget); - StyleHelper::ScopyStatusBar(this, "ScopyStatusBar"); + Style::setStyle(this, style::properties::widget::basicComponent); hide(); } diff --git a/gui/src/widgets/verticaltabwidget.cpp b/gui/src/widgets/verticaltabwidget.cpp index 23394a115..9577e8c60 100644 --- a/gui/src/widgets/verticaltabwidget.cpp +++ b/gui/src/widgets/verticaltabwidget.cpp @@ -19,6 +19,7 @@ * */ +#include #include #include @@ -28,4 +29,6 @@ VerticalTabWidget::VerticalTabWidget(QWidget *parent) : QTabWidget(parent) { setTabBar(new VerticalTabBar(this)); + setTabPosition(QTabWidget::TabPosition::East); + Style::setStyle(tabBar(), style::properties::tabwidget::eastTabMenu, true, true); } diff --git a/gui/style/qss/generic/global.qss b/gui/style/qss/generic/global.qss index 6bfae8339..e20852a94 100644 --- a/gui/style/qss/generic/global.qss +++ b/gui/style/qss/generic/global.qss @@ -7,6 +7,13 @@ QWidget { font-weight: normal; } +QSplitter { color: &content_default& } +QSplitter::handle:horizontal { width: 6px; } +QSplitter::handle:vertical { height: 6px; } +QSplitter::handle:hover { background-color: rgba(0, 0, 0, 40); } +QSplitter::handle:pressed { background-color: rgba(0, 0, 0, 70); } +QSplitter::handle:disabled { background-color: transparent; } + QTextBrowser { border: none; } diff --git a/gui/style/qss/properties/button/menuControlButton.qss b/gui/style/qss/properties/button/menuControlButton.qss new file mode 100644 index 000000000..28f539990 --- /dev/null +++ b/gui/style/qss/properties/button/menuControlButton.qss @@ -0,0 +1,15 @@ +QPushButton[&&property&&=true] { + background-color: transparent; +} +QPushButton#btn[&&property&&=true]:pressed { + border-image: url(:/gui/icons/setup_btn_checked.svg) +} +QPushButton#btn[&&property&&=true]:!pressed { + border-image: url(:/gui/icons/&icon_theme_folder&/icons/setup_btn_unchecked.svg) +} +QPushButton#btn[&&property&&=true]:hover:!pressed:!checked { + border-image: url(:/gui/icons/&icon_theme_folder&/icons/setup_btn_hover.svg) +} +QPushButton#btn[&&property&&=true]:checked { + border-image: url(:/gui/icons/setup_btn_checked.svg); +} diff --git a/gui/style/qss/properties/label/warning.qss b/gui/style/qss/properties/label/warning.qss new file mode 100644 index 000000000..df653705c --- /dev/null +++ b/gui/style/qss/properties/label/warning.qss @@ -0,0 +1,3 @@ +QLabel[&&property&&=true] { + color: &content_busy&; +} diff --git a/gui/style/qss/properties/lineedit/headerLineEdit.qss b/gui/style/qss/properties/lineedit/headerLineEdit.qss new file mode 100644 index 000000000..ff19408e1 --- /dev/null +++ b/gui/style/qss/properties/lineedit/headerLineEdit.qss @@ -0,0 +1,13 @@ +QLineEdit[&&property&&=true] { + font-weight: bold; + font-size: &font_size_1&; + font-style: normal; + border: 0px solid &content_subtle&; + border-bottom: 1px solid rgba(255, 255, 255, 102); + padding-left: -2px; +} +QLineEdit[&&property&&=true]:disabled { + border: 0px solid &content_subtle&; + border-bottom: 0px solid rgba(255, 255, 255, 102); + padding-left: -2px; +} diff --git a/gui/style/qss/properties/tabwidget/eastTabMenu.qss b/gui/style/qss/properties/tabwidget/eastTabMenu.qss new file mode 100644 index 000000000..d9ec35c53 --- /dev/null +++ b/gui/style/qss/properties/tabwidget/eastTabMenu.qss @@ -0,0 +1,28 @@ +QTabWidget::tab-bar[&&property&&=true] { + left: 0; +} +QTabWidget::pane[&&property&&=true] { + border-top: 0px; +} +QTabBar { + qproperty-drawBase: 0; + background: &background_primary&; +} +QTabBar::tab[&&property&&=true] { + background: &background_primary&; + min-width: 150px; + height: &unit_3&; + padding-bottom: &padding_1&; + font: normal; +} +QTabBar::tab[&&property&&=true]:selected { + color: &content_default&; + border-bottom: 2px solid &interactive_primary_idle&; + margin-top: 0px; +} +QTabBar::tab[&&property&&=true]:!selected { + border-bottom: 2px solid &content_default&; +} +QTabBar::scroller[&&property&&=true] { + width: 25px; +} diff --git a/plugins/adc/src/freq/fftplotcomponentsettings.cpp b/plugins/adc/src/freq/fftplotcomponentsettings.cpp index e778b438f..dcd12fbd4 100644 --- a/plugins/adc/src/freq/fftplotcomponentsettings.cpp +++ b/plugins/adc/src/freq/fftplotcomponentsettings.cpp @@ -51,7 +51,7 @@ FFTPlotComponentSettings::FFTPlotComponentSettings(FFTPlotComponent *plt, QWidge "SETTINGS", MenuCollapseSection::MHCW_NONE, MenuCollapseSection::MHW_BASEWIDGET, parent); QLabel *plotTitleLabel = new QLabel("Plot title"); - StyleHelper::MenuSmallLabel(plotTitleLabel); + Style::setStyle(plotTitleLabel, style::properties::label::menuSmall); QLineEdit *plotTitle = new QLineEdit(m_plotComponent->name()); Style::setStyle(plotTitle, style::properties::lineedit::menuLineEdit); diff --git a/plugins/adc/src/time/timeplotcomponentsettings.cpp b/plugins/adc/src/time/timeplotcomponentsettings.cpp index 2fa880a05..273fe9593 100644 --- a/plugins/adc/src/time/timeplotcomponentsettings.cpp +++ b/plugins/adc/src/time/timeplotcomponentsettings.cpp @@ -49,7 +49,7 @@ TimePlotComponentSettings::TimePlotComponentSettings(TimePlotComponent *plt, QWi "SETTINGS", MenuCollapseSection::MHCW_NONE, MenuCollapseSection::MHW_BASEWIDGET, parent); QLabel *plotTitleLabel = new QLabel("Plot title"); - StyleHelper::MenuSmallLabel(plotTitleLabel); + Style::setStyle(plotTitleLabel, style::properties::label::menuSmall); QLineEdit *plotTitle = new QLineEdit(m_plotComponent->name()); Style::setStyle(plotTitle, style::properties::lineedit::menuLineEdit); diff --git a/plugins/dac/src/bufferdacaddon.cpp b/plugins/dac/src/bufferdacaddon.cpp index 51ae43652..2aa727de5 100644 --- a/plugins/dac/src/bufferdacaddon.cpp +++ b/plugins/dac/src/bufferdacaddon.cpp @@ -195,7 +195,7 @@ BufferDacAddon::BufferDacAddon(DacDataModel *model, QWidget *parent) MenuSectionWidget *channelsSection = new MenuSectionWidget(this); channelsSection->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Expanding); QLabel *channelsLbl = new QLabel("Channels"); - StyleHelper::MenuSmallLabel(channelsLbl); + Style::setStyle(channelsLbl, style::properties::label::menuSmall); QScrollArea *scrollArea = new QScrollArea(channelsSection); scrollArea->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred); diff --git a/plugins/dac/src/dacdatamanager.cpp b/plugins/dac/src/dacdatamanager.cpp index c70480427..7014352c8 100644 --- a/plugins/dac/src/dacdatamanager.cpp +++ b/plugins/dac/src/dacdatamanager.cpp @@ -35,6 +35,7 @@ #include #include #include +#include using namespace scopy; using namespace scopy::dac; @@ -77,7 +78,7 @@ DacDataManager::DacDataManager(struct iio_device *dev, QWidget *parent) Q_EMIT m_mode->combo()->currentIndexChanged(0); modeSection->contentLayout()->addWidget(m_mode); - m_color = StyleHelper::getColor("interactive_primary_idle"); + m_color = Style::getAttribute(json::theme::interactive_primary_idle); m_layout->addWidget(modeSection); m_layout->addWidget(dacAddonStack); m_layout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding)); diff --git a/plugins/dac/src/dacinstrument.cpp b/plugins/dac/src/dacinstrument.cpp index 59c14abad..e1ae5d4fe 100644 --- a/plugins/dac/src/dacinstrument.cpp +++ b/plugins/dac/src/dacinstrument.cpp @@ -38,7 +38,6 @@ DacInstrument::DacInstrument(const Connection *conn, QWidget *parent) : QWidget(parent) , m_conn(conn) { - StyleHelper::GetInstance()->initColorMap(); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); QHBoxLayout *lay = new QHBoxLayout(this); lay->setMargin(0); diff --git a/plugins/dac/src/ddsdacaddon.cpp b/plugins/dac/src/ddsdacaddon.cpp index 363f4d6d6..57631c39b 100644 --- a/plugins/dac/src/ddsdacaddon.cpp +++ b/plugins/dac/src/ddsdacaddon.cpp @@ -35,6 +35,7 @@ #include #include #include +#include using namespace scopy; using namespace scopy::dac; @@ -93,7 +94,7 @@ QWidget *DdsDacAddon::setupDdsTx(TxNode *txNode) MenuSectionWidget *txLabelSection = new MenuSectionWidget(this); txLabelSection->setProperty("tutorial_name", "TX_INDICATOR"); QLabel *txLabel = new QLabel(txNode->getUuid(), txLabelSection); - StyleHelper::MenuMediumLabel(txLabel); + Style::setStyle(txLabel, style::properties::label::menuMedium); txLabelSection->contentLayout()->addWidget(txLabel); txLabelSection->setFixedHeight(63); diff --git a/plugins/debugger/src/iioexplorer/iioexplorerinstrument.cpp b/plugins/debugger/src/iioexplorer/iioexplorerinstrument.cpp index 6e6c3ac80..bdc4e0162 100644 --- a/plugins/debugger/src/iioexplorer/iioexplorerinstrument.cpp +++ b/plugins/debugger/src/iioexplorer/iioexplorerinstrument.cpp @@ -85,8 +85,6 @@ void IIOExplorerInstrument::setupUi() Style::setBackgroundColor(details_container, json::theme::background_subtle); Style::setBackgroundColor(tree_view_container, json::theme::background_subtle); - StyleHelper::SplitterStyle(m_HSplitter, "HorizontalSplitter"); - StyleHelper::SplitterStyle(m_VSplitter, "VerticalSplitter"); m_mainWidget->setLayout(new QVBoxLayout(m_mainWidget)); m_mainWidget->layout()->setContentsMargins(0, 0, 0, 0); diff --git a/plugins/pqm/src/harmonicsinstrument.cpp b/plugins/pqm/src/harmonicsinstrument.cpp index dcfbbaf70..521deb56b 100644 --- a/plugins/pqm/src/harmonicsinstrument.cpp +++ b/plugins/pqm/src/harmonicsinstrument.cpp @@ -48,7 +48,6 @@ HarmonicsInstrument::HarmonicsInstrument(ToolMenuEntry *tme, QString uri, QWidge QHBoxLayout *instrumentLayout = new QHBoxLayout(this); setLayout(instrumentLayout); instrumentLayout->setMargin(0); - StyleHelper::GetInstance()->initColorMap(); ToolTemplate *tool = new ToolTemplate(this); tool->topContainer()->setVisible(true); diff --git a/plugins/pqm/src/rmsinstrument.cpp b/plugins/pqm/src/rmsinstrument.cpp index 7c69001b6..cac968150 100644 --- a/plugins/pqm/src/rmsinstrument.cpp +++ b/plugins/pqm/src/rmsinstrument.cpp @@ -51,7 +51,6 @@ RmsInstrument::RmsInstrument(ToolMenuEntry *tme, QString uri, QWidget *parent) QHBoxLayout *instrumentLayout = new QHBoxLayout(this); setLayout(instrumentLayout); instrumentLayout->setMargin(0); - StyleHelper::GetInstance()->initColorMap(); ToolTemplate *tool = new ToolTemplate(this); tool->topContainer()->setVisible(true); diff --git a/plugins/pqm/src/waveforminstrument.cpp b/plugins/pqm/src/waveforminstrument.cpp index 05f46d7f1..533913fbf 100644 --- a/plugins/pqm/src/waveforminstrument.cpp +++ b/plugins/pqm/src/waveforminstrument.cpp @@ -52,7 +52,6 @@ WaveformInstrument::WaveformInstrument(ToolMenuEntry *tme, QString uri, QWidget QHBoxLayout *layout = new QHBoxLayout(this); setLayout(layout); layout->setMargin(0); - StyleHelper::GetInstance()->initColorMap(); m_plottingStrategy = PlottingStrategyBuilder::build("trigger", m_plotSampleRate); ToolTemplate *tool = new ToolTemplate(this); diff --git a/plugins/regmap/src/regmapstylehelper.cpp b/plugins/regmap/src/regmapstylehelper.cpp index c7612d109..26d19e6b9 100644 --- a/plugins/regmap/src/regmapstylehelper.cpp +++ b/plugins/regmap/src/regmapstylehelper.cpp @@ -138,12 +138,7 @@ void RegmapStyleHelper::BitFieldDetailedWidgetStyle(BitFieldDetailedWidget *widg widget->setMinimumWidth(10); widget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); Style::setStyle(widget->nameLabel, style::properties::label::menuSmall); - - if(widget->valueSwitch) { - StyleHelper::MenuOnOffSwitch(dynamic_cast(widget->valueSwitch), "onOffSwitch"); - } widget->setFixedHeight(96); - widget->setStyleSheet(style); } diff --git a/plugins/swiot/src/ad74413r/ad74413r.cpp b/plugins/swiot/src/ad74413r/ad74413r.cpp index cc9d56735..ed50e3280 100644 --- a/plugins/swiot/src/ad74413r/ad74413r.cpp +++ b/plugins/swiot/src/ad74413r/ad74413r.cpp @@ -571,7 +571,6 @@ void Ad74413r::setupToolTemplate() QHBoxLayout *layout = new QHBoxLayout(this); layout->setContentsMargins(0, 0, 0, 0); setLayout(layout); - StyleHelper::GetInstance()->initColorMap(); m_tool = new ToolTemplate(this); m_tool->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); diff --git a/plugins/swiot/src/ad74413r/buffermenu.cpp b/plugins/swiot/src/ad74413r/buffermenu.cpp index 8cd72e293..521064033 100644 --- a/plugins/swiot/src/ad74413r/buffermenu.cpp +++ b/plugins/swiot/src/ad74413r/buffermenu.cpp @@ -22,6 +22,7 @@ #include "swiot_logging_categories.h" #include +#include #include #include #include @@ -439,7 +440,7 @@ WithoutAdvSettings::WithoutAdvSettings(QWidget *parent, QString chnlFunction, Co : BufferMenu(parent, chnlFunction, conn, chnls) { QLabel *msgLabel = new QLabel("No advanced settings available", this); - StyleHelper::MenuSmallLabel(msgLabel); + Style::setStyle(msgLabel, style::properties::label::menuSmall); addMenuWidget(msgLabel); } diff --git a/plugins/swiot/src/faults/faultwidget.cpp b/plugins/swiot/src/faults/faultwidget.cpp index c1ed9ca9f..cae7741e9 100644 --- a/plugins/swiot/src/faults/faultwidget.cpp +++ b/plugins/swiot/src/faults/faultwidget.cpp @@ -20,6 +20,7 @@ #include "faults/faultwidget.h" +#include #include #include #include @@ -48,7 +49,7 @@ FaultWidget::FaultWidget(unsigned int id, QString name, QString faultExplanation m_titleLabel = new QLabel(this); m_titleLabel->setText("Bit" + QString::number(m_id)); - StyleHelper::MenuSmallLabel(m_titleLabel); + Style::setStyle(m_titleLabel, style::properties::label::menuSmall); layout->addWidget(m_activeLabel, 0, Qt::AlignCenter); layout->addWidget(m_storedLabel, 0, Qt::AlignCenter); diff --git a/plugins/swiot/src/max14906/diodigitalchannel.cpp b/plugins/swiot/src/max14906/diodigitalchannel.cpp index 2b3015ab9..58132bc58 100644 --- a/plugins/swiot/src/max14906/diodigitalchannel.cpp +++ b/plugins/swiot/src/max14906/diodigitalchannel.cpp @@ -23,6 +23,7 @@ #include "swiot_logging_categories.h" #include #include +#include #include #include @@ -174,7 +175,7 @@ QWidget *DioDigitalChannel::createBottomContainer(QWidget *parent) QLabel *readValueLabel = new QLabel(readBackWidget); readValueLabel->setText("Readback"); - StyleHelper::MenuSmallLabel(readValueLabel); + Style::setStyle(readValueLabel, style::properties::label::menuSmall); readBackWidget->layout()->addWidget(readValueLabel); m_lcdNumber = new LcdNumber(readBackWidget); @@ -196,7 +197,7 @@ QWidget *DioDigitalChannel::createTopContainer(QWidget *parent) QHBoxLayout *layout = new QHBoxLayout(topWidget); m_channelName = new QLabel(topWidget); - StyleHelper::MenuSmallLabel(m_channelName); + Style::setStyle(m_channelName, style::properties::label::menuSmall); layout->addWidget(m_channelName, 0, Qt::AlignLeft); QLineEdit *channelTitleLineEdit = new QLineEdit(topWidget); @@ -206,7 +207,7 @@ QWidget *DioDigitalChannel::createTopContainer(QWidget *parent) layout->addSpacerItem(new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum)); m_channelType = new QLabel(topWidget); - StyleHelper::MenuSmallLabel(m_channelType); + Style::setStyle(m_channelType, style::properties::label::menuSmall); layout->addWidget(m_channelType, 0, Qt::AlignRight); m_valueSwitch = new SmallOnOffSwitch(topWidget); diff --git a/plugins/swiot/src/max14906/diosettingstab.cpp b/plugins/swiot/src/max14906/diosettingstab.cpp index 6506c3095..de29b53c0 100644 --- a/plugins/swiot/src/max14906/diosettingstab.cpp +++ b/plugins/swiot/src/max14906/diosettingstab.cpp @@ -47,7 +47,7 @@ DioSettingsTab::DioSettingsTab(QWidget *parent) QLabel *label = new QLabel(this); label->setText("Polling at 1 sample/second"); - StyleHelper::MenuSmallLabel(label); + Style::setStyle(label, style::properties::label::menuSmall); // timespan m_maxSpinButton = new MenuSpinbox(tr("Timespan"), 10, "s", 1, 300, true, false, this); diff --git a/plugins/swiot/src/swiotplugin.cpp b/plugins/swiot/src/swiotplugin.cpp index 22c355b3d..2ced510b7 100644 --- a/plugins/swiot/src/swiotplugin.cpp +++ b/plugins/swiot/src/swiotplugin.cpp @@ -307,7 +307,7 @@ void SWIOTPlugin::createStatusContainer() auto statusLabel = new QLabel("AD-SWIOT1L-SL: The system is powered at limited capacity."); statusLabel->setWordWrap(true); - StyleHelper::WarningLabel(statusLabel, "extPsuStatusLabel"); + Style::setStyle(statusLabel, style::properties::label::warning); m_statusContainer->layout()->addWidget(exclamationIcon); m_statusContainer->layout()->addWidget(statusLabel); diff --git a/plugins/test/src/testtool.cpp b/plugins/test/src/testtool.cpp index ea2d9feaa..19e63e0bf 100644 --- a/plugins/test/src/testtool.cpp +++ b/plugins/test/src/testtool.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -72,7 +73,6 @@ TestTool::TestTool(QWidget *parent) tool->rightContainer()->setVisible(true); lay->addWidget(tool); - StyleHelper::GetInstance()->initColorMap(); btn3 = new OpenLastMenuBtn(dynamic_cast(tool->rightContainer()), false, this); tool->setLeftContainerWidth(200); tool->setRightContainerWidth(300); @@ -268,7 +268,7 @@ QWidget *TestTool::createMenu(QWidget *parent) MenuSectionWidget *vdiv = new MenuSectionWidget(w); QLabel *txt = new QLabel("VDiv", vdiv); - StyleHelper::MenuSmallLabel(txt, "vdivLabel"); + Style::setStyle(txt, style::properties::label::menuSmall); QComboBox *cbb = new QComboBox(vdiv); cbb->addItem("Lorem"); cbb->addItem("Ipsum"); @@ -295,7 +295,7 @@ QWidget *TestTool::createMenu(QWidget *parent) // MenuBigSwitch *bigsw = new MenuBigSwitch("Yes", "No", vdiv); QLabel *lbl = new QLabel("AUTOSCALE"); - StyleHelper::MenuSmallLabel(lbl, "edit"); + Style::setStyle(lbl, style::properties::label::menuSmall); MenuLineEdit *edit = new MenuLineEdit(vdiv); vdiv->contentLayout()->addWidget(section1);