Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Porting old gui elements to m2k #1642

Merged
merged 6 commits into from
Jun 17, 2024
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
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,8 @@ core/include/core/scopy-core_export.h
common/include/common/scopy-common_config.h
common/include/common/scopy-common_export.h
gr-util/include/gr-util/scopy-gr-util_export.h
gui/gr-gui/include/gr-gui/scopy-gr-gui_export.h
gui/gr-gui/include/gr-gui/scopy-gr-gui_config.h
gui/include/gui/scopy-gui_export.h
gui/include/gui/scopy-gui_config.h
gui/sigrok-gui/include/sigrok-gui/scopy-sigrok-gui_export.h
gui/sigrok-gui/include/sigrok-gui/scopy-sigrok-gui_config.h
iio-widgets/include/iio-widgets/scopy-iio-widgets_export.h
iioutil/include/iioutil/scopy-iioutil_export.h
pluginbase/include/pluginbase/scopy-pluginbase_config.h
Expand Down
4 changes: 3 additions & 1 deletion ci/macOS/package_darwin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ source $REPO_SRC/ci/macOS/macos_config.sh

pushd $BUILDDIR

SCOPYLIBS=$(find $BUILDDIR -name "*.dylib" -d 2 -type f)
SCOPYLIBS="$(find $BUILDDIR -name "*.dylib" -d 2 -type f)
$(find $BUILDDIR/plugins/m2k/m2k-gui -name "*.dylib" -type f)"

SCOPYPLUGINS=$(find $BUILDDIR/Scopy.app/Contents/MacOs/plugins/plugins -name "*.dylib" -type f)

echo "### Copy DLLs to Frameworks folder"
Expand Down
6 changes: 4 additions & 2 deletions ci/windows/build_and_create_installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ EMU_BUILD_FOLDER=$WORKDIR/iio-emu/build
PLUGINBASE_DLL=$BUILD_FOLDER/pluginbase
CORE_DLL=$BUILD_FOLDER/core
GUI_DLL=$BUILD_FOLDER/gui
SIGROK_GUI_DLL=$BUILD_FOLDER/gui/sigrok-gui
GR_GUI_DLL=$BUILD_FOLDER/gui/gr-gui
M2K_GUI_DLL=$BUILD_FOLDER/plugins/m2k/m2k-gui
SIGROK_GUI_DLL=$BUILD_FOLDER/plugins/m2k/m2k-gui
GR_GUI_DLL=$BUILD_FOLDER/plugins/m2k/m2k-gui
IIOUTIL_DLL=$BUILD_FOLDER/iioutil
COMMON_DLL=$BUILD_FOLDER/common
IIO_WIDGETS_DLL=$BUILD_FOLDER/iio-widgets
Expand Down Expand Up @@ -92,6 +93,7 @@ deploy_app(){
cp $CORE_DLL/libscopy-core.dll $DEST_FOLDER
cp $GUI_DLL/libscopy-gui.dll $DEST_FOLDER
cp $IIOUTIL_DLL/libscopy-iioutil.dll $DEST_FOLDER
cp $M2K_GUI_DLL/libscopy-m2k-gui.dll $DEST_FOLDER
cp $SIGROK_GUI_DLL/libscopy-sigrok-gui.dll $DEST_FOLDER
cp $GR_GUI_DLL/libscopy-gr-gui.dll $DEST_FOLDER
cp $COMMON_DLL/libscopy-common.dll $DEST_FOLDER
Expand Down
1 change: 0 additions & 1 deletion gr-util/include/gr-util/grtimeplotaddon.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include <QVBoxLayout>
#include <QtConcurrent>

#include <gui/oscilloscope_plot.hpp>
#include <gui/widgets/plotbufferpreviewer.h>
#include <plotwidget.h>
#include <gnuradio/blocks/stream_to_vector.h>
Expand Down
15 changes: 1 addition & 14 deletions gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,6 @@ endif()
set(PROJECT_SOURCES ${SRC_LIST} ${HEADER_LIST} ${UI_LIST})

find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets Xml Svg REQUIRED)
option(SCOPY_ENABLE_GR_GUI "Build gnuradio addons for scopy-gui" ON)
option(SCOPY_ENABLE_SIGROK_GUI "Build sigrok addons for scopy-gui" ON)
if(SCOPY_ENABLE_GR_GUI)
add_subdirectory(gr-gui)
set(SCOPY_HAVE_GR_GUI ON)
endif()
if(SCOPY_ENABLE_SIGROK_GUI)
add_subdirectory(sigrok-gui)
set(SCOPY_HAVE_SIGROK_GUI ON)
endif()

add_definitions(-DBOOST_ALL_DYN_LINK)
find_package(Boost COMPONENTS system filesystem thread chrono REQUIRED)
Expand All @@ -119,10 +109,7 @@ target_include_directories(
target_include_directories(
${PROJECT_NAME}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include/${SCOPY_MODULE}/
${CMAKE_CURRENT_SOURCE_DIR}/include/${SCOPY_MODULE}/widgets
scopy-common
scopy-pluginbase
scopy-sigrok-gui
${CMAKE_CURRENT_SOURCE_DIR}/include/${SCOPY_MODULE}/widgets scopy-common scopy-pluginbase
)

target_include_directories(
Expand Down
50 changes: 50 additions & 0 deletions gui/include/gui/basicscaledraw.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#ifndef BASICSCALEDRAW_H
#define BASICSCALEDRAW_H

#include "scopy-gui_export.h"
#include <QColor>
#include <QwtScaleDraw>
#include "plot_utils.hpp"

namespace scopy {
/*
* BasicScaleDraw class overrides the way the major values are being displayed.
*/
class SCOPY_GUI_EXPORT BasicScaleDraw : public QwtScaleDraw
{
public:
BasicScaleDraw(const QString &unit_type = "");
BasicScaleDraw(PrefixFormatter *, const QString &);
QwtText label(double) const;

void setFloatPrecision(unsigned int numDigits);
unsigned int getFloatPrecison() const;

void setUnitType(const QString &unit);
QString getUnitType() const;

void setColor(QColor color);

void setDisplayScale(double value);
void setFormatter(PrefixFormatter *formatter);

void enableDeltaLabel(bool enable);
void setUnitsEnabled(bool enable);

protected:
virtual void draw(QPainter *, const QPalette &) const;

private:
int m_floatPrecision;
QString m_unit;
PrefixFormatter *m_formatter;
QColor m_color;
double m_displayScale;
mutable unsigned int m_nrTicks;
mutable bool m_shouldDrawMiddleDelta;
bool m_delta;
bool m_unitsEn;
};
} // namespace scopy

#endif // BASICSCALEDRAW_H
31 changes: 31 additions & 0 deletions gui/include/gui/edgelessplot.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#ifndef EDGELESSPLOT_H
#define EDGELESSPLOT_H

#include "scopy-gui_export.h"

#include <QwtPlotGrid>
#include <QwtPlotScaleItem>

namespace scopy {
/*
* EdgelessPlotScaleItem class ensures that the first and last major ticks are ignored
*/
class SCOPY_GUI_EXPORT EdgelessPlotScaleItem : public QwtPlotScaleItem
{
public:
explicit EdgelessPlotScaleItem(QwtScaleDraw::Alignment = QwtScaleDraw::BottomScale, const double pos = 0.0);
virtual void updateScaleDiv(const QwtScaleDiv &, const QwtScaleDiv &);
};

/*
* EdgelessPlotGrid class ensures that the first and last major ticks are ignored
*/
class SCOPY_GUI_EXPORT EdgelessPlotGrid : public QwtPlotGrid
{
public:
explicit EdgelessPlotGrid();
virtual void updateScaleDiv(const QwtScaleDiv &, const QwtScaleDiv &);
};
} // namespace scopy

#endif // EDGELESSPLOT_H
5 changes: 2 additions & 3 deletions gui/include/gui/filemanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#define FILEMANAGER_H

#include "scopy-gui_export.h"

#include <QString>
#include <QStringList>
#include <QVector>
Expand Down Expand Up @@ -100,14 +99,14 @@ class SCOPY_GUI_EXPORT FileManager
QStringList additionalInformation;
};

class ScopyFileHeader
class SCOPY_GUI_EXPORT ScopyFileHeader
{
public:
static bool hasValidHeader(QVector<QVector<QString>> data);
static QStringList getHeader();
};

class FileManagerException : public std::runtime_error
class SCOPY_GUI_EXPORT FileManagerException : public std::runtime_error
{
public:
FileManagerException(const char *msg)
Expand Down
8 changes: 4 additions & 4 deletions gui/include/gui/plotaxis.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
#include "osc_scale_engine.h"
#include "plotaxishandle.h"
#include "plotwidget.h"
#include "plot_utils.hpp"
#include "basicscaledraw.h"
#include "scopy-gui_export.h"

#include <QwtPlotZoomer>
#include <QwtScaleEngine>

#include <DisplayPlot.h>

namespace scopy {
class SCOPY_GUI_EXPORT PlotAxis : public QObject
{
Expand All @@ -36,7 +36,7 @@ class SCOPY_GUI_EXPORT PlotAxis : public QObject
QwtPlotZoomer *zoomer() const;
OscScaleEngine *scaleEngine() const;

OscScaleDraw *scaleDraw() const;
BasicScaleDraw *scaleDraw() const;

double divs() const;

Expand Down Expand Up @@ -67,7 +67,7 @@ public Q_SLOTS:
PlotWidget *m_plotWidget;
QwtPlot *m_plot;
int m_position;
OscScaleDraw *m_scaleDraw;
BasicScaleDraw *m_scaleDraw;
OscScaleEngine *m_scaleEngine;
QString m_units;
PrefixFormatter *m_formatter;
Expand Down
1 change: 0 additions & 1 deletion gui/include/gui/polarplotwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

#include <QGridLayout>
#include <QWidget>
#include <nyquistplotzoomer.h>
#include <polarplotchannel.h>
#include <qwt_plot_zoomer.h>
#include <qwt_polar_grid.h>
Expand Down
Loading
Loading