Skip to content

Commit

Permalink
gui / stylehelper: general refactoring
Browse files Browse the repository at this point in the history
- fixed ADC measure icons
- removed StyleHelper color map

Signed-off-by: Andrei Popa <[email protected]>
  • Loading branch information
andrei47w committed Nov 26, 2024
1 parent ad538e5 commit bd8d503
Show file tree
Hide file tree
Showing 36 changed files with 130 additions and 564 deletions.
2 changes: 0 additions & 2 deletions core/src/scopyaboutpage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion core/src/scopymainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 0 additions & 1 deletion core/src/scopypreferencespage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
24 changes: 0 additions & 24 deletions gui/include/gui/stylehelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "");
Expand All @@ -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<QString, QString> colorMap;
static StyleHelper *pinstance_;
};
} // namespace scopy
Expand Down
1 change: 0 additions & 1 deletion gui/include/gui/widgets/menuonoffswitch.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class SCOPY_GUI_EXPORT MenuOnOffSwitch : public QWidget
virtual ~MenuOnOffSwitch();

QAbstractButton *onOffswitch();
void applyStylesheet();

private:
QLabel *m_label;
Expand Down
2 changes: 2 additions & 0 deletions gui/src/style.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,8 @@ QList<QColor> 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);
Expand Down
Loading

0 comments on commit bd8d503

Please sign in to comment.