Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/src/iiotabwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ QWidget *IioTabWidget::createUriWidget(QWidget *parent)
Style::setStyle(w, style::properties::widget::border_interactive);

QLabel *uriLabel = new QLabel("URI", w);
StyleHelper::MenuLargeLabel(uriLabel);
Style::setStyle(uriLabel, style::properties::label::menuMedium);

m_uriEdit = new QLineEdit(w);
m_uriEdit->setPlaceholderText("The device you are connecting to");
Expand Down
1 change: 1 addition & 0 deletions gui/include/gui/basicscaledraw.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class SCOPY_GUI_EXPORT BasicScaleDraw : public QwtScaleDraw
QString getUnitType() const;

void setColor(QColor color);
QColor getColor();

void setDisplayScale(double value);
void setFormatter(PrefixFormatter *formatter);
Expand Down
1 change: 1 addition & 0 deletions gui/include/gui/cursorcontroller.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public Q_SLOTS:
void readoutsDragToggled(bool toggled);
void onAddedChannel(PlotChannel *ch);
void onRemovedChannel(PlotChannel *ch);
void onSelectedChannel(PlotChannel *ch);
void updateTracking();

Q_SIGNALS:
Expand Down
1 change: 0 additions & 1 deletion gui/include/gui/stylehelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ class SCOPY_GUI_EXPORT StyleHelper : public QObject
static void ColoredSquareCheckbox(QCheckBox *chk, QColor color, 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 MenuSectionWidget(QWidget *w, QString objectName = "");
Expand Down
3 changes: 2 additions & 1 deletion gui/include/gui/widgets/menuspinbox.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class SCOPY_GUI_EXPORT MenuSpinbox : public QWidget
} IncrementMode;

MenuSpinbox(QString name, double val, QString unit, double min, double max, bool vertical = 0, bool left = 0,
QWidget *parent = nullptr);
bool large_widget = true, QWidget *parent = nullptr);
~MenuSpinbox();

double value() const;
Expand Down Expand Up @@ -203,6 +203,7 @@ private Q_SLOTS:
double m_value, m_min, m_max;
double m_scaleMin, m_scaleMax;
QString m_unit;
bool m_large_widget;

QList<UnitPrefix> m_scales;
// QMap<QString, double> m_scaleMap;
Expand Down
2 changes: 2 additions & 0 deletions gui/include/gui/widgets/plotcursorreadouts.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ public Q_SLOTS:
void setXFormatter(PrefixFormatter *formatter);
void setYFormatter(PrefixFormatter *formatter);

void setColor(QColor color);

private:
QWidget *y_contents;
QWidget *x_contents;
Expand Down
3 changes: 2 additions & 1 deletion gui/src/axishandle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@
#include "qpainter.h"
#include <qwt_scale_div.h>
#include <QMouseEvent>
#include <style.h>

using namespace scopy;

AxisHandle::AxisHandle(QwtAxisId axisId, HandlePos handlePos, QwtPlot *plot)
: QWidget(plot->canvas())
, m_axisId(axisId)
, m_plot(plot)
, m_color(Qt::gray)
, m_color(Style::getColor(json::theme::content_silent))
, m_handlePos(handlePos)
, m_pos(QPoint(0, 0))
, m_handleMargins(6)
Expand Down
2 changes: 2 additions & 0 deletions gui/src/basicscaledraw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ QString BasicScaleDraw::getUnitType() const { return m_unit; }

void BasicScaleDraw::setColor(QColor color) { m_color = color; }

QColor BasicScaleDraw::getColor() { return m_color; }

void BasicScaleDraw::setDisplayScale(double value) { m_displayScale = value; }

void BasicScaleDraw::setFormatter(PrefixFormatter *formatter) { m_formatter = formatter; }
Expand Down
30 changes: 17 additions & 13 deletions gui/src/cursorcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,19 +121,7 @@ void CursorController::connectSignals(CursorSettings *cursorSettings)
}
connect(m_plot, &PlotWidget::addedChannel, this, &CursorController::onAddedChannel);
connect(m_plot, &PlotWidget::removedChannel, this, &CursorController::onRemovedChannel);
connect(m_plot, &PlotWidget::channelSelected, this, [=](PlotChannel *ch) {
PlotAxis *xAxis = m_plot->xAxis();
PlotAxis *yAxis = m_plot->yAxis();
if(ch != nullptr) {
xAxis = ch->xAxis();
yAxis = ch->yAxis();
}

plotCursorReadouts->setXFormatter(xAxis->getFormatter());
plotCursorReadouts->setYFormatter(yAxis->getFormatter());
plotCursorReadouts->setXUnits(xAxis->getUnits());
plotCursorReadouts->setYUnits(yAxis->getUnits());
});
connect(m_plot, &PlotWidget::channelSelected, this, &CursorController::onSelectedChannel);
}

void CursorController::xEnToggled(bool toggled)
Expand Down Expand Up @@ -184,6 +172,22 @@ void CursorController::onAddedChannel(PlotChannel *ch)
connect(ch->yAxis(), &PlotAxis::unitsChanged, plotCursorReadouts, &PlotCursorReadouts::setYUnits);
}

void CursorController::onSelectedChannel(PlotChannel *ch)
{
PlotAxis *xAxis = m_plot->xAxis();
PlotAxis *yAxis = m_plot->yAxis();
if(ch != nullptr) {
xAxis = ch->xAxis();
yAxis = ch->yAxis();
}

plotCursorReadouts->setXFormatter(xAxis->getFormatter());
plotCursorReadouts->setYFormatter(yAxis->getFormatter());
plotCursorReadouts->setXUnits(xAxis->getUnits());
plotCursorReadouts->setYUnits(yAxis->getUnits());
plotCursorReadouts->setColor(yAxis->scaleDraw()->getColor());
}

void CursorController::onRemovedChannel(PlotChannel *ch)
{
disconnect(ch->xAxis(), &PlotAxis::formatterChanged, plotCursorReadouts, nullptr);
Expand Down
4 changes: 3 additions & 1 deletion gui/src/plotwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ void PlotWidget::plotChannelChangeYAxis(PlotChannel *c, PlotAxis *y)
m_navigator->addChannel(c);
m_tracker->addChannel(c);
showAxisLabels();

Q_EMIT channelSelected(c);
}

void PlotWidget::addPlotChannel(PlotChannel *ch)
Expand Down Expand Up @@ -282,7 +284,7 @@ void PlotWidget::setupAxes()

m_xPosition = Preferences::get("adc_plot_xaxis_label_position").toInt();
m_yPosition = Preferences::get("adc_plot_yaxis_label_position").toInt();
QPen pen(QColor(Style::getAttribute(json::theme::interactive_subtle_idle)));
QPen pen(QColor(Style::getAttribute(json::theme::content_subtle)));
m_xAxis = new PlotAxis(m_xPosition, this, pen, this);
m_yAxis = new PlotAxis(m_yPosition, this, pen, this);
}
Expand Down
4 changes: 2 additions & 2 deletions gui/src/style.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,8 @@ const char *Style::replaceProperty(const char *prop)
for(const QString &key : m_theme_json->object().keys()) {
if(prop == key) {
QJsonValue value = m_theme_json->object().value(key);
prop = value.toString().toLocal8Bit().data();
return strdup(prop);
prop = strdup(value.toString().toLocal8Bit().data());
return prop;
}
}

Expand Down
9 changes: 0 additions & 9 deletions gui/src/stylehelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,15 +199,6 @@ void StyleHelper::MenuControlWidget(QWidget *w, QColor color, QString objectName
w->setStyleSheet(style);
}

void StyleHelper::MenuLargeLabel(QLabel *m_lbl, QString objectName)
{
if(!objectName.isEmpty())
m_lbl->setObjectName(objectName);
m_lbl->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);

Style::setStyle(m_lbl, style::properties::label::menuBig);
}

void StyleHelper::MenuHeaderLine(QFrame *m_line, QPen pen, QString objectName)
{
if(!objectName.isEmpty())
Expand Down
1 change: 1 addition & 0 deletions gui/src/widgets/measurementpanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ using namespace scopy;

MeasurementsPanel::MeasurementsPanel(QWidget *parent)
: QWidget(parent)
, m_inhibitUpdates(false)
{
QVBoxLayout *lay = new QVBoxLayout(this);
setLayout(lay);
Expand Down
3 changes: 3 additions & 0 deletions gui/src/widgets/menucombo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
*/

#include <QVBoxLayout>
#include <style.h>

#include <widgets/menucombo.h>

Expand Down Expand Up @@ -56,6 +57,8 @@ MenuCombo::MenuCombo(QString title, QWidget *parent)
lay->setMargin(0);

m_label = new QLabel(title, this);
Style::setStyle(m_label, style::properties::label::subtle);

m_combo = new QComboBox(this);

lay->addWidget(m_label);
Expand Down
20 changes: 14 additions & 6 deletions gui/src/widgets/menuspinbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ namespace scopy {
namespace gui {

MenuSpinbox::MenuSpinbox(QString name, double val, QString unit, double min, double max, bool vertical, bool left,
QWidget *parent)
bool large_widget, QWidget *parent)
: QWidget(parent)
{

m_large_widget = large_widget;
m_label = new QLabel(name, parent);
Style::setStyle(m_label, style::properties::label::subtle);

m_edit = new QLineEdit("0", parent);
m_scaleCb = new QComboBox(parent);
m_plus = new QPushButton("", parent);
Expand Down Expand Up @@ -91,7 +93,7 @@ void MenuSpinbox::layoutVertically(bool left)
auto lay = new QHBoxLayout(this);
setLayout(lay);

lay->setSpacing(5);
lay->setSpacing(0);
lay->setMargin(0);

QLayout *btnLay;
Expand All @@ -101,7 +103,7 @@ void MenuSpinbox::layoutVertically(bool left)
editLay = new QVBoxLayout();

btnLay->setSpacing(2);
btnLay->setMargin(0);
btnLay->setContentsMargins(5, 0, 0, 0);
editLay->setSpacing(2);
editLay->setMargin(0);

Expand All @@ -121,17 +123,23 @@ void MenuSpinbox::layoutVertically(bool left)
lay->addLayout(btnLay);
}

Style::setStyle(m_label, style::properties::label::subtle);
Style::setStyle(m_scaleCb, style::properties::widget::noBorder);
int size = m_large_widget ? Style::getDimension(json::global::unit_2_5)
: Style::getDimension(json::global::unit_1);

int size = Style::getDimension(json::global::unit_2_5);
m_plus->setIcon(Style::getPixmap(":/gui/icons/plus.svg", Style::getColor(json::theme::content_inverse)));
Style::setStyle(m_plus, style::properties::button::spinboxButton);
m_plus->setFixedSize(size, size);

m_minus->setIcon(Style::getPixmap(":/gui/icons/minus.svg", Style::getColor(json::theme::content_inverse)));
Style::setStyle(m_minus, style::properties::button::spinboxButton);
m_minus->setFixedSize(size, size);

if(!m_large_widget) {
int icon_size = Style::getDimension(json::global::unit_0_5);
m_plus->setIconSize(QSize(icon_size, icon_size));
m_minus->setIconSize(QSize(icon_size, icon_size));
}
}

void MenuSpinbox::layoutHorizontally(bool left)
Expand Down
2 changes: 2 additions & 0 deletions gui/src/widgets/plotcursorreadouts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ bool PlotCursorReadouts::isXVisible() { return x_contents->isVisible(); }

bool PlotCursorReadouts::isYVisible() { return y_contents->isVisible(); }

void PlotCursorReadouts::setColor(QColor color) { setStyleSheet("color: " + color.name(QColor::HexRgb)); }

void PlotCursorReadouts::setYUnits(QString unit)
{
yUnit = unit;
Expand Down
4 changes: 2 additions & 2 deletions gui/style/json/Harmonic light.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"interactive_subtle_idle": "#848B95",
"interactive_subtle_hover": "#5E6773",
"interactive_subtle_pressed": "#4b525c",
"interactive_subtle_disabled": "#c1c3c7",
"interactive_subtle_disabled": "#d5d7db",
"interactive_focus": "#F6EEFC",
"interactive_primary_idle": "#0067B9",
"interactive_primary_hover": "#00427A",
Expand All @@ -13,7 +13,7 @@
"interactive_secondary_idle": "#0067B9",
"interactive_secondary_hover": "#00427A",
"interactive_secondary_pressed": "#003969",
"interactive_secondary_disabled": "#c1c3c7",
"interactive_secondary_disabled": "#d5d7db",
"content_default": "#101820",
"content_subtle": "#5E6773",
"content_silent": "#9FA4AD",
Expand Down
4 changes: 2 additions & 2 deletions gui/style/qss/generic/global.qss
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ QTabBar::tab {
}

QTabBar::tab:selected {
background: &background_primary&;
color: &interactive_primary_idle&;
background: &interactive_subtle_disabled&;
color: &content_default&;
border-bottom: 1px solid &interactive_primary_idle&;
}

Expand Down
12 changes: 0 additions & 12 deletions gui/style/qss/properties/label/iioCompactLabel.qss

This file was deleted.

1 change: 0 additions & 1 deletion iio-widgets/src/guistrategy/comboguistrategy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ ComboAttrUi::ComboAttrUi(IIOWidgetFactoryRecipe recipe, bool isCompact, QWidget
m_ui->layout()->setContentsMargins(0, 0, 0, 0);

auto label = new QLabel(recipe.data, m_ui);
Style::setStyle(label, style::properties::label::iioCompactLabel);
m_comboWidget = new QComboBox(m_ui);
m_comboWidget->setSizeAdjustPolicy(QComboBox::SizeAdjustPolicy::AdjustToContents);

Expand Down
3 changes: 2 additions & 1 deletion iio-widgets/src/guistrategy/editableguistrategy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ EditableGuiStrategy::EditableGuiStrategy(IIOWidgetFactoryRecipe recipe, bool isC

if(isCompact) {
m_ui->setLayout(new QHBoxLayout(m_ui));
Style::setStyle(label, style::properties::label::iioCompactLabel);
m_lineEdit->edit()->setAlignment(Qt::AlignRight);
} else {
Style::setStyle(label, style::properties::label::subtle);
m_ui->setLayout(new QVBoxLayout(m_ui));
}

Expand All @@ -44,6 +44,7 @@ EditableGuiStrategy::EditableGuiStrategy(IIOWidgetFactoryRecipe recipe, bool isC
m_ui->layout()->setContentsMargins(0, 0, 0, 0);
m_ui->layout()->addWidget(label);
m_ui->layout()->addWidget(m_lineEdit);
m_ui->layout()->setSpacing(0);

connect(m_lineEdit->edit(), &QLineEdit::editingFinished, this, [this]() {
QString currentText = m_lineEdit->edit()->text();
Expand Down
2 changes: 1 addition & 1 deletion iio-widgets/src/guistrategy/rangeguistrategy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ RangeAttrUi::RangeAttrUi(IIOWidgetFactoryRecipe recipe, bool isCompact, QWidget
m_ui->setLayout(new QVBoxLayout(m_ui));
m_ui->layout()->setContentsMargins(0, 0, 0, 0);

m_spinBox = new gui::MenuSpinbox(m_recipe.data.toUpper(), 0, "", 0, 1, true, false, m_ui);
m_spinBox = new gui::MenuSpinbox(m_recipe.data, 0, "", 0, 1, true, false, false, m_ui);
m_spinBox->setIncrementMode(gui::MenuSpinbox::IS_FIXED);
m_spinBox->setScaleRange(1, 1);
m_spinBox->setScalingEnabled(false);
Expand Down
1 change: 0 additions & 1 deletion plugins/adc/src/time/grtimechannelcomponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,6 @@ void GRTimeChannelComponent::setYModeHelper(YMode mode)
ymax = 1 << (fmt->bits);
}
m_timePlotComponentChannel->m_timePlotYAxis->setUnits("");
m_timePlotComponentChannel->m_timePlotYAxis->setUnits("");
m_timePlotComponentChannel->m_timePlotYAxis->scaleDraw()->setFloatPrecision(3);
m_timePlotComponentChannel->m_timePlotYAxis->getFormatter()->setTwoDecimalMode(false);
break;
Expand Down
3 changes: 0 additions & 3 deletions plugins/adc/src/time/timeplotcomponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@ TimePlotComponent::TimePlotComponent(QString name, uint32_t uuid, QWidget *paren
m_plotLayout->addWidget(m_timePlot);
m_plotLayout->addWidget(m_xyPlot);

// Need to set this for some reason .. spinboxes should be refactored
m_timePlot->yAxis()->setUnits("V");

m_plotMenu = new TimePlotComponentSettings(this, parent);
addComponent(m_plotMenu);

Expand Down
2 changes: 0 additions & 2 deletions plugins/adc/src/time/timeplotcomponentchannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ adc::TimePlotComponentChannel::TimePlotComponentChannel(ChannelComponent *ch, Ti
m_plotComponent = nullptr;
initPlotComponent(plotComponent);

m_timePlotYAxis->setUnits("V");
m_timePlotCh->xAxis()->setUnits("s");
m_timePlotYAxis->setInterval(-2048, 2048);
m_xyPlotYAxis->setInterval(-2048, 2048);
}
Expand Down
5 changes: 5 additions & 0 deletions plugins/adc/src/time/timeplotcomponentsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <QLineEdit>
#include <timeplotcomponentchannel.h>
#include <style.h>
#include <pluginbase/preferences.h>

using namespace scopy;
using namespace scopy::adc;
Expand Down Expand Up @@ -183,6 +184,10 @@ TimePlotComponentSettings::TimePlotComponentSettings(TimePlotComponent *plt, QWi
m_plotComponent->timePlot()->plotButtonManager()->add(m_deletePlotHover);
m_plotComponent->timePlot()->plotButtonManager()->add(m_settingsPlotHover);
m_autoscaleBtn->onOffswitch()->setChecked(true);

m_ymode = static_cast<YMode>(-1);
auto y = Preferences::get("adc_default_y_mode").toInt();
m_yModeCb->combo()->setCurrentIndex(y);
}

void TimePlotComponentSettings::showDeleteButtons(bool b)
Expand Down
Loading
Loading