Skip to content

Commit

Permalink
Style: rename themes
Browse files Browse the repository at this point in the history
- small UI changes

Signed-off-by: Andrei Popa <[email protected]>
  • Loading branch information
andrei47w committed Oct 30, 2024
1 parent 44409c2 commit 1b8cd8e
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 21 deletions.
2 changes: 1 addition & 1 deletion core/src/scopymainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ void ScopyMainWindow::initPreferences()
p->init("general_use_opengl", true);
#endif
p->init("general_use_animations", true);
p->init("general_theme", "legacy");
p->init("general_theme", "Scopy");
p->init("general_language", "en");
p->init("show_grid", true);
p->init("show_graticule", false);
Expand Down
29 changes: 21 additions & 8 deletions core/ui/scopyhomepage.ui
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@
<number>10</number>
</property>
<property name="leftMargin">
<number>20</number>
<number>10</number>
</property>
<property name="topMargin">
<number>20</number>
<number>10</number>
</property>
<property name="rightMargin">
<number>20</number>
<number>10</number>
</property>
<property name="bottomMargin">
<number>20</number>
<number>10</number>
</property>
<item>
<widget class="QWidget" name="horizontalLayout_2" native="true">
Expand Down Expand Up @@ -82,20 +82,20 @@
<item>
<widget class="QWidget" name="scanContainer" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,0,1">
<property name="sizeConstraint">
<enum>QLayout::SizeConstraint::SetFixedSize</enum>
<enum>QLayout::SizeConstraint::SetMaximumSize</enum>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>1</number>
<number>6</number>
</property>
<property name="rightMargin">
<number>1</number>
Expand Down Expand Up @@ -129,6 +129,19 @@
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
Expand Down
2 changes: 1 addition & 1 deletion gui/src/style.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ QMap<QString, QString> *Style::m_styleMap{new QMap<QString, QString>()};
Style::Style(QObject *parent)
: QObject(parent)
, m_globalJsonPath("/json/global.json")
, m_themeJsonPath("/json/legacy.json")
, m_themeJsonPath("/json/Scopy.json")
, m_qssFolderPath("/qss")
, m_qssGlobalFile("global")
, m_m2kqssFile("m2k")
Expand Down
12 changes: 6 additions & 6 deletions gui/src/stylehelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ void StyleHelper::SquareToggleButtonWithIcon(QPushButton *btn, QString objectNam
btn->setObjectName(objectName);
btn->setCheckable(checkable);
btn->setChecked(false);
Style::setStyle(btn, style::properties::button::squareIconButton, true, true);
Style::setStyle(btn, style::properties::widget::solidBorder, true, true);
Style::setStyle(btn, style::properties::button::squareIconButton);
Style::setStyle(btn, style::properties::widget::solidBorder);
}

void StyleHelper::BlueGrayButton(QPushButton *btn, QString objectName)
Expand All @@ -82,7 +82,7 @@ void StyleHelper::BlueGrayButton(QPushButton *btn, QString objectName)
btn->setObjectName(objectName);
btn->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);

Style::setStyle(btn, style::properties::button::blueGrayButton, true, true);
Style::setStyle(btn, style::properties::button::blueGrayButton);
}

void StyleHelper::MeasurementPanelLabel(MeasurementLabel *w, QString objectName)
Expand Down Expand Up @@ -142,7 +142,7 @@ void StyleHelper::BasicButton(QPushButton *btn, QString objectName)
if(!objectName.isEmpty())
btn->setObjectName(objectName);

Style::setStyle(btn, style::properties::button::basicButton, true, true);
Style::setStyle(btn, style::properties::button::basicButton);
btn->setFixedHeight(Style::getDimension(json::global::unit_4));
}

Expand All @@ -162,7 +162,7 @@ void StyleHelper::BasicSmallButton(QPushButton *btn, QString objectName)
if(!objectName.isEmpty())
btn->setObjectName(objectName);

Style::setStyle(btn, style::properties::button::basicButton, true, true);
Style::setStyle(btn, style::properties::button::basicButton);
btn->setFixedHeight(Style::getDimension(json::global::unit_3));
}

Expand All @@ -172,7 +172,7 @@ void StyleHelper::ColoredCircleCheckbox(QCheckBox *chk, QColor color, QString ob
chk->setObjectName(objectName);

chk->setStyleSheet("QCheckBox::indicator:checked { background-color: " + color.name() + "; }");
Style::setStyle(chk, style::properties::checkbox::circleCB, true, true);
Style::setStyle(chk, style::properties::checkbox::circleCB, "idle", true);
}

void StyleHelper::CollapseCheckbox(QCheckBox *chk, QString objectName)
Expand Down
3 changes: 3 additions & 0 deletions gui/src/widgets/menucontrolbutton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ MenuControlButton::MenuControlButton(QWidget *parent)
connect(this, &QAbstractButton::toggled, this, [=](bool b) {
setDynamicProperty(this, "selected", b);
Style::setStyle(m_label, style::properties::label::menuMedium, b ? "selected" : "idle");
if(m_cs == CS_CIRCLE) {
Style::setStyle(m_chk, style::properties::checkbox::circleCB, b ? "selected" : "idle", true);
}
}); // Hackish - QStyle should be implemented

dblClickToOpenMenu = QMetaObject::Connection();
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion gui/style/qss/properties/button/spinboxButton.qss
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ QPushButton[&&property&&=true]:checked {
color: &content_inverse&;
}
QPushButton[&&property&&=true]:disabled {
background-color: &interactive_secondary_pressed&;
background-color: &interactive_secondary_hover&;
color: &content_inverse&;
}
25 changes: 22 additions & 3 deletions gui/style/qss/properties/checkbox/circleCB.qss
Original file line number Diff line number Diff line change
@@ -1,17 +1,36 @@
QCheckBox[&&property&&=true] {
QCheckBox[&&property&&="selected"] {
width: 16px;
height: 16px;
background-color: transparent;
color: rgba(255, 255, 255, 153);
}
QCheckBox::indicator[&&property&&=true] {
QCheckBox::indicator[&&property&&="selected"] {
width: 12px;
height: 12px;
border: 2px solid &content_default&;
border-radius: 7px;
image: none;
}
QCheckBox::indicator[&&property&&=true]:unchecked {
QCheckBox::indicator[&&property&&="selected"]:unchecked {
background-color: &background_primary&;
}
QCheckBox::indicator[&&property&&="selected"]:checked {
background-color: &content_default&;
}

QCheckBox[&&property&&="idle"] {
width: 16px;
height: 16px;
background-color: transparent;
color: rgba(255, 255, 255, 153);
}
QCheckBox::indicator[&&property&&="idle"] {
width: 12px;
height: 12px;
border: 2px solid &content_default&;
border-radius: 7px;
image: none;
}
QCheckBox::indicator[&&property&&="idle"]:unchecked {
background-color: &background_primary&;
}
7 changes: 6 additions & 1 deletion tools/style_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def generate_json() -> None:
json_header_name = "style_attributes.h"
json_header_path = os.path.join(generated_header_folder, json_header_name)
global_json_path = os.path.join(style_folder, "json", "global.json")
theme_json_path = os.path.join(style_folder, "json", "dark.json")
theme_json_path = os.path.join(style_folder, "json", "Harmonic dark.json")

json_namespace_code = generate_namespace_code(
create_namespace_structure(".json", global_json_path, "global"),
Expand Down Expand Up @@ -261,6 +261,11 @@ def copy_and_append_jsons(src_dir: str, dest_dir: str, append: bool) -> None:
generated_header_folder = sys.argv[3]
build_folder = sys.argv[4]

# remove style folder from previous builds
built_style_folder = os.path.join(build_folder, "style")
if not is_plugin and os.path.isdir(built_style_folder):
shutil.rmtree(built_style_folder)

# this is used for having different names for header defines
header_name_prefix = "" if not is_plugin else generated_header_folder[generated_header_folder.rfind("/") + 1:] + "_"
build_qss_folder = os.path.join(build_folder, "style", "qss")
Expand Down

0 comments on commit 1b8cd8e

Please sign in to comment.