Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
adisuciu committed Jun 25, 2024
1 parent a74b5ba commit 5eb42f0
Show file tree
Hide file tree
Showing 45 changed files with 241 additions and 382 deletions.
4 changes: 2 additions & 2 deletions gr-util/include/gr-util/griiodevicesource.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ class SCOPY_GR_UTIL_EXPORT GRIIOChannel : public GRProxyBlock
virtual double readSampleRate() { return -1; }
static QString findAttribute(QStringList possibleNames, iio_channel *);

virtual bool scaleAttributeAvailable() { return false;};
virtual double readScale() { return 1;};
virtual bool scaleAttributeAvailable() { return false; };
virtual double readScale() { return 1; };

protected:
QString channelName;
Expand Down
5 changes: 1 addition & 4 deletions gr-util/src/griiodevicesource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ QString GRIIODeviceSource::findAttribute(QStringList possibleNames, iio_device *

iio_device *GRIIODeviceSource::iioDev() const { return m_iioDev; }

iio_context *GRIIODeviceSource::ctx() const
{
return m_ctx;
}
iio_context *GRIIODeviceSource::ctx() const { return m_ctx; }

QString GRIIOChannel::findAttribute(QStringList possibleNames, iio_channel *ch)
{
Expand Down
23 changes: 7 additions & 16 deletions gr-util/src/griiofloatchannelsrc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ GRIIOFloatChannelSrc::GRIIOFloatChannelSrc(GRIIODeviceSource *dev, QString chann
m_iioCh);

m_scaleAttribute = findAttribute(
{
"scale",
},
m_iioCh);
{
"scale",
},
m_iioCh);
}

void GRIIOFloatChannelSrc::build_blks(GRTopBlock *top)
Expand Down Expand Up @@ -106,21 +106,12 @@ double GRIIOFloatChannelSrc::readScale()
}
}



const iio_data_format *GRIIOFloatChannelSrc::getFmt() const { return fmt; }

struct iio_channel *GRIIOFloatChannelSrc::channel() const { return m_iioCh; }

struct iio_device *GRIIOFloatChannelSrc::dev() const {
return m_dev->iioDev();
}
struct iio_device *GRIIOFloatChannelSrc::dev() const { return m_dev->iioDev(); }

struct iio_context *GRIIOFloatChannelSrc::ctx() const {
return m_dev->ctx();
}
struct iio_context *GRIIOFloatChannelSrc::ctx() const { return m_dev->ctx(); }

const QString &GRIIOFloatChannelSrc::scaleAttribute() const
{
return m_scaleAttribute;
}
const QString &GRIIOFloatChannelSrc::scaleAttribute() const { return m_scaleAttribute; }
1 change: 0 additions & 1 deletion gui/include/gui/plotaxishandle.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ class SCOPY_GUI_EXPORT PlotAxisHandle : public QWidget
void scalePosChanged(double);
void updatePos();


private:
double m_pos;
PlotWidget *m_plotWidget;
Expand Down
1 change: 0 additions & 1 deletion gui/include/gui/plotchannel.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ public Q_SLOTS:
void enable();
void disable();


private:
void setThicknessInternal(int);
void setStyleInternal(int);
Expand Down
2 changes: 1 addition & 1 deletion gui/include/gui/stylehelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class SCOPY_GUI_EXPORT StyleHelper : public QObject
static void MenuOnOffSwitchButton(SmallOnOffSwitch *w, QString objectName = "");
static void MenuCollapseSection(QWidget *w, QString objectName = "");
static void MenuCollapseHeaderLabel(QLabel *w, QString objectName = "");
static void MenuCollapseHeaderLineEdit(QLineEdit *w, QString objectName ="");
static void MenuCollapseHeaderLineEdit(QLineEdit *w, QString objectName = "");
static void MenuComboLabel(QLabel *w, QString objectName = "");
static void MenuHeaderLabel(QLabel *w, QString objectName = "");
static void MenuControlLabel(QLabel *w, QString objectName = "");
Expand Down
4 changes: 2 additions & 2 deletions gui/include/gui/widgets/compositewidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

#include <QWidget>

class Collapsable {
class Collapsable
{
public:
virtual bool collapsed() = 0;
virtual void setCollapsed(bool b) = 0;

};

class CompositeWidget
Expand Down
9 changes: 5 additions & 4 deletions gui/include/gui/widgets/menucontrolbutton.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
namespace scopy {

class MenuControlButton;
class SCOPY_GUI_EXPORT MenuControlWidget {
class SCOPY_GUI_EXPORT MenuControlWidget
{

public:
virtual MenuControlButton* header() = 0;
virtual MenuControlButton *header() = 0;
};

class SCOPY_GUI_EXPORT MenuControlButton : public QAbstractButton, public MenuControlWidget
Expand Down Expand Up @@ -47,7 +48,7 @@ class SCOPY_GUI_EXPORT MenuControlButton : public QAbstractButton, public MenuCo
QCheckBox *checkBox();
QPushButton *button();

MenuControlButton *header() override {return this;}
MenuControlButton *header() override { return this; }

public Q_SLOTS:
void setName(QString s);
Expand Down Expand Up @@ -83,7 +84,7 @@ class SCOPY_GUI_EXPORT CollapsableMenuControlButton : public QWidget, public Com
void add(QWidget *ch) override;
void remove(QWidget *ch) override;
MenuControlButton *getControlBtn();
MenuControlButton *header() override {return m_ctrl;}
MenuControlButton *header() override { return m_ctrl; }

private:
MenuControlButton *m_ctrl;
Expand Down
12 changes: 6 additions & 6 deletions gui/include/gui/widgets/menusectionwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@ class SCOPY_GUI_EXPORT MenuVScrollArea : public QScrollArea
QVBoxLayout *m_layout;
};

class SCOPY_GUI_EXPORT MenuSectionCollapseWidget : public QWidget, public Collapsable, public CompositeWidget {
class SCOPY_GUI_EXPORT MenuSectionCollapseWidget : public QWidget, public Collapsable, public CompositeWidget
{
Q_OBJECT
QWIDGET_PAINT_EVENT_HELPER
public:

MenuSectionCollapseWidget(QString title, MenuCollapseSection::MenuHeaderCollapseStyle style, QWidget *parent = nullptr);
MenuSectionCollapseWidget(QString title, MenuCollapseSection::MenuHeaderCollapseStyle style,
QWidget *parent = nullptr);
~MenuSectionCollapseWidget();
QVBoxLayout *contentLayout() const;

Expand All @@ -51,13 +52,12 @@ class SCOPY_GUI_EXPORT MenuSectionCollapseWidget : public QWidget, public Collap

bool collapsed() override;
void setCollapsed(bool b) override;
MenuCollapseSection* collapseSection();
MenuCollapseSection *collapseSection();

private:
QVBoxLayout *m_layout;
MenuSectionWidget* m_section;
MenuSectionWidget *m_section;
MenuCollapseSection *m_collapse;

};

} // namespace scopy
Expand Down
17 changes: 8 additions & 9 deletions gui/include/gui/widgets/menuwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

namespace scopy {
namespace gui {
class SCOPY_GUI_EXPORT MenuWidget : public QWidget, public CompositeWidget {
class SCOPY_GUI_EXPORT MenuWidget : public QWidget, public CompositeWidget
{
Q_OBJECT
public:

enum MenuAlignment
{
MA_TOPFIRST,
Expand All @@ -31,24 +31,23 @@ class SCOPY_GUI_EXPORT MenuWidget : public QWidget, public CompositeWidget {
void remove(QWidget *) override;
void add(QWidget *, QString name);
void remove(QString);
MenuHeaderWidget* header();
MenuHeaderWidget *header();

QWidget* findWidget(QString name);
QString widgetName(QWidget*);
QWidget *findWidget(QString name);
QString widgetName(QWidget *);

void collapseAll();
void setCollapsed(QString name, bool b);

private:
QMap<QString, QWidget*> m_widgetMap;
QMap<QString, QWidget *> m_widgetMap;
QSpacerItem *m_spacer;
QVBoxLayout *m_layScroll;
MenuHeaderWidget *m_header;
int uuid;

};
}
} // namespace gui

}
} // namespace scopy

#endif // MENUWIDGET_H
1 change: 1 addition & 0 deletions gui/include/gui/widgets/verticalchannelmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class SCOPY_GUI_EXPORT VerticalChannelManager : public QWidget, public Composite
void add(QWidget *ch) override;
void remove(QWidget *ch) override;
void addEnd(QWidget *ch);

private:
QSpacerItem *spacer;
QVBoxLayout *lay;
Expand Down
5 changes: 1 addition & 4 deletions gui/src/plotaxishandle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,7 @@ void PlotAxisHandle::init()
});
}

void PlotAxisHandle::deinit() {
delete m_handle;

}
void PlotAxisHandle::deinit() { delete m_handle; }

void PlotAxisHandle::setAxis(PlotAxis *axis)
{
Expand Down
30 changes: 9 additions & 21 deletions gui/src/plotchannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@ PlotChannel::PlotChannel(QString name, QPen pen, PlotAxis *xAxis, PlotAxis *yAxi
, m_style(0)
, m_thickness(1)

{

}
{}

void PlotChannel::init() {
void PlotChannel::init()
{
m_curve = new QwtPlotCurve(m_name);
m_curve->setAxes(m_xAxis->axisId(), m_yAxis->axisId());
m_curve->setStyle(QwtPlotCurve::Lines);
Expand All @@ -33,12 +32,9 @@ void PlotChannel::init() {
// curvefitter (?)
}

void PlotChannel::deinit() {
delete m_curve;
}
void PlotChannel::deinit() { delete m_curve; }

PlotChannel::~PlotChannel() {
}
PlotChannel::~PlotChannel() {}

QwtPlotCurve *PlotChannel::curve() const { return m_curve; }

Expand Down Expand Up @@ -168,30 +164,22 @@ PlotAxis *PlotChannel::yAxis() const { return m_yAxis; }

PlotAxis *PlotChannel::xAxis() const { return m_xAxis; }


int PlotChannel::thickness() const
{
return m_thickness;
}
int PlotChannel::thickness() const { return m_thickness; }

void PlotChannel::setThickness(int newThickness)
{
if (m_thickness == newThickness)
if(m_thickness == newThickness)
return;
m_thickness = newThickness;
setThicknessInternal(newThickness);
Q_EMIT thicknessChanged();
}


int PlotChannel::style() const
{
return m_style;
}
int PlotChannel::style() const { return m_style; }

void PlotChannel::setStyle(int newStyle)
{
if (m_style == newStyle)
if(m_style == newStyle)
return;
m_style = newStyle;
setStyleInternal(newStyle);
Expand Down
2 changes: 2 additions & 0 deletions gui/src/plotscales.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,5 @@ void PlotScales::initGraticule()
m_plot->replot();
});
}

#include "moc_plotscales.cpp"
8 changes: 2 additions & 6 deletions gui/src/plotwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,9 @@ void PlotWidget::removePlotChannel(PlotChannel *ch)

QList<PlotChannel *> PlotWidget::getChannels() { return m_plotChannels; }

void PlotWidget::addPlotAxisHandle(PlotAxisHandle *ax) {
m_plotAxisHandles[ax->axis()->position()].append(ax);
}
void PlotWidget::addPlotAxisHandle(PlotAxisHandle *ax) { m_plotAxisHandles[ax->axis()->position()].append(ax); }

void PlotWidget::removePlotAxisHandle(PlotAxisHandle *ax) {
m_plotAxisHandles[ax->axis()->position()].removeAll(ax);
}
void PlotWidget::removePlotAxisHandle(PlotAxisHandle *ax) { m_plotAxisHandles[ax->axis()->position()].removeAll(ax); }

void PlotWidget::addPlotAxis(PlotAxis *ax) { m_plotAxis[ax->position()].append(ax); }

Expand Down
4 changes: 2 additions & 2 deletions gui/src/widgets/measurementpanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ void MeasurementsPanel::addMeasurement(MeasurementLabel *meas)
void MeasurementsPanel::removeMeasurement(MeasurementLabel *meas)
{
m_labels.removeAll(meas);
// updateOrder();
// updateOrder();
}

void MeasurementsPanel::sort(int sortType)
Expand Down Expand Up @@ -122,7 +122,7 @@ void MeasurementsPanel::updateOrder()
m_stacks.append(new VerticalWidgetStack(this));
panelLayout->insertWidget(idx, m_stacks.last());

for(QWidget *label : m_labels) {
for(QWidget *label : qAsConst(m_labels)) {
addWidget(label);
}
}
Expand Down
6 changes: 2 additions & 4 deletions gui/src/widgets/menucollapsesection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ MenuCollapseHeader::MenuCollapseHeader(QString title, MenuCollapseSection::MenuH
m_label->setReadOnly(false);

StyleHelper::MenuCollapseHeaderLineEdit(m_label, "menuCollapseLabel");
m_label->setTextMargins(0,0,0,0);
m_label->setTextMargins(0, 0, 0, 0);

switch(style) {
case MenuCollapseSection::MHCW_ARROW:
Expand All @@ -35,9 +35,7 @@ MenuCollapseHeader::MenuCollapseHeader(QString title, MenuCollapseSection::MenuH
case MenuCollapseSection::MHCW_ONOFF:
m_ctrl = new SmallOnOffSwitch(this);
StyleHelper::MenuOnOffSwitchButton(dynamic_cast<SmallOnOffSwitch *>(m_ctrl), "menuCollapseButton");
connect(this, &QAbstractButton::toggled, [=](bool b) {
m_ctrl->setChecked(b);
});
connect(this, &QAbstractButton::toggled, [=](bool b) { m_ctrl->setChecked(b); });
m_ctrl->setChecked(true);
break;
default:
Expand Down
Loading

0 comments on commit 5eb42f0

Please sign in to comment.