-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add dot, frequency, and digraph plot display plugins
- Loading branch information
1 parent
33cc7d4
commit 272d692
Showing
39 changed files
with
1,585 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#------------------------------------------------- | ||
# | ||
# Project created by QtCreator 2020-04-20T23:19:44.928Z | ||
# | ||
#------------------------------------------------- | ||
|
||
QT += widgets | ||
|
||
QT -= gui | ||
|
||
TARGET = FrequencyPlot | ||
TEMPLATE = lib | ||
|
||
DEFINES += FREQUENCYPLOT_LIBRARY | ||
|
||
CONFIG += c++11 plugin | ||
CONFIG -= debug_and_release_target | ||
|
||
# The following define makes your compiler emit warnings if you use | ||
# any feature of Qt which has been marked as deprecated (the exact warnings | ||
# depend on your compiler). Please consult the documentation of the | ||
# deprecated API in order to know how to port your code away from it. | ||
DEFINES += QT_DEPRECATED_WARNINGS | ||
|
||
# You can also make your code fail to compile if you use deprecated APIs. | ||
# In order to do so, uncomment the following line. | ||
# You can also select to disable deprecated APIs only up to a certain version of Qt. | ||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 | ||
|
||
SOURCES += frequencyplot.cpp frequencyplotwidget.cpp frequencyplotcontrols.cpp | ||
|
||
HEADERS += frequencyplot.h frequencyplotwidget.h frequencyplotcontrols.h | ||
|
||
FORMS += frequencyplotcontrols.ui | ||
|
||
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../../../hobbits-core/release/ -lhobbits-core | ||
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../../../hobbits-core/debug/ -lhobbits-core | ||
else:unix: LIBS += -L$$OUT_PWD/../../../hobbits-core/ -lhobbits-core | ||
|
||
INCLUDEPATH += $$PWD/../../../hobbits-core | ||
DEPENDPATH += $$PWD/../../../hobbits-core | ||
|
||
unix:{ | ||
QMAKE_LFLAGS_RPATH= | ||
QMAKE_LFLAGS += "-Wl,-rpath,'$$ORIGIN/../../lib:$$ORIGIN'" | ||
} | ||
|
||
unix { | ||
target.path = target.path = $$(HOME)/.local/share/hobbits/plugins/displays | ||
INSTALLS += target | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#include "frequencyplot.h" | ||
|
||
FrequencyPlot::FrequencyPlot() : | ||
m_displayWidget(nullptr), | ||
m_controlsWidget(nullptr) | ||
{ | ||
|
||
} | ||
|
||
DisplayInterface* FrequencyPlot::createDefaultDisplay() | ||
{ | ||
return new FrequencyPlot(); | ||
} | ||
|
||
QString FrequencyPlot::getName() | ||
{ | ||
return "FrequencyPlot"; | ||
} | ||
|
||
QWidget* FrequencyPlot::getDisplayWidget(QSharedPointer<DisplayHandle> displayHandle) | ||
{ | ||
initialize(displayHandle); | ||
return m_displayWidget; | ||
} | ||
|
||
QWidget* FrequencyPlot::getControlsWidget(QSharedPointer<DisplayHandle> displayHandle) | ||
{ | ||
initialize(displayHandle); | ||
return m_controlsWidget; | ||
} | ||
|
||
void FrequencyPlot::initialize(QSharedPointer<DisplayHandle> displayHandle) | ||
{ | ||
if (!m_displayWidget) { | ||
m_displayWidget = new FrequencyPlotWidget(displayHandle, this); | ||
m_controlsWidget = new FrequencyPlotControls(); | ||
|
||
// make necessary connections here | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#ifndef FREQUENCYPLOT_H | ||
#define FREQUENCYPLOT_H | ||
|
||
#include "displayinterface.h" | ||
#include "frequencyplotcontrols.h" | ||
#include "frequencyplotwidget.h" | ||
|
||
class FrequencyPlot : public QObject, DisplayInterface | ||
{ | ||
Q_OBJECT | ||
Q_PLUGIN_METADATA(IID "hobbits.DisplayInterface.FrequencyPlot") | ||
Q_INTERFACES(DisplayInterface) | ||
|
||
public: | ||
FrequencyPlot(); | ||
|
||
DisplayInterface* createDefaultDisplay(); | ||
|
||
QString getName(); | ||
|
||
QWidget* getDisplayWidget(QSharedPointer<DisplayHandle> displayHandle); | ||
QWidget* getControlsWidget(QSharedPointer<DisplayHandle> displayHandle); | ||
|
||
private: | ||
void initialize(QSharedPointer<DisplayHandle> displayHandle); | ||
FrequencyPlotWidget* m_displayWidget; | ||
FrequencyPlotControls* m_controlsWidget; | ||
}; | ||
|
||
#endif // FREQUENCYPLOT_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include "frequencyplotcontrols.h" | ||
#include "ui_frequencyplotcontrols.h" | ||
|
||
|
||
FrequencyPlotControls::FrequencyPlotControls() : | ||
ui(new Ui::FrequencyPlotControls()) | ||
{ | ||
ui->setupUi(this); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#ifndef FREQUENCYPLOTCONTROLS_H | ||
#define FREQUENCYPLOTCONTROLS_H | ||
|
||
#include <QWidget> | ||
|
||
namespace Ui | ||
{ | ||
class FrequencyPlotControls; | ||
} | ||
|
||
class FrequencyPlotControls : public QWidget | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
FrequencyPlotControls(); | ||
|
||
private: | ||
Ui::FrequencyPlotControls *ui; | ||
}; | ||
|
||
#endif // FREQUENCYPLOTCONTROLS_H |
21 changes: 21 additions & 0 deletions
21
src/hobbits-plugins/FrequencyPlot/frequencyplotcontrols.ui
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>FrequencyPlotControls</class> | ||
<widget class="QWidget" name="FrequencyPlotControls"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>500</width> | ||
<height>100</height> | ||
</rect> | ||
</property> | ||
|
||
<layout class="QVBoxLayout" name="verticalLayout"> | ||
|
||
</layout> | ||
|
||
</widget> | ||
<resources/> | ||
<connections/> | ||
</ui> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#include "frequencyplotwidget.h" | ||
|
||
#include <QPainter> | ||
#include <QImage> | ||
#include "displayhelper.h" | ||
|
||
FrequencyPlotWidget::FrequencyPlotWidget( | ||
QSharedPointer<DisplayHandle> displayHandle, | ||
DisplayInterface *pluginRef, | ||
QWidget *parent) : | ||
DisplayBase(displayHandle, pluginRef, parent) | ||
{ | ||
|
||
} | ||
|
||
void FrequencyPlotWidget::paintEvent(QPaintEvent*) { | ||
if (m_displayHandle->getContainer().isNull()) { | ||
return; | ||
} | ||
|
||
QImage raster = DisplayHelper::getBitRasterImage( | ||
m_displayHandle->getContainer(), | ||
m_displayHandle->getBitOffset(), | ||
m_displayHandle->getFrameOffset(), | ||
this->width(), this->height()); | ||
|
||
QPainter painter(this); | ||
painter.setRenderHint(QPainter::Antialiasing, false); | ||
painter.drawImage(0, 0, raster); | ||
} | ||
|
||
void FrequencyPlotWidget::mouseMoveEvent(QMouseEvent *event) { | ||
sendHoverUpdate(event, 1, 1, 1, 1, QPoint(0, 0)); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#ifndef FREQUENCYPLOTWIDGET_H | ||
#define FREQUENCYPLOTWIDGET_H | ||
|
||
#include "displaybase.h" | ||
|
||
class FrequencyPlotWidget : public DisplayBase | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
FrequencyPlotWidget( | ||
QSharedPointer<DisplayHandle> displayHandle, | ||
DisplayInterface *pluginRef, | ||
QWidget *parent = nullptr); | ||
|
||
void paintEvent(QPaintEvent*) override; | ||
void mouseMoveEvent(QMouseEvent *event) override; | ||
}; | ||
|
||
#endif // FREQUENCYPLOTWIDGET_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#------------------------------------------------- | ||
# | ||
# Project created by QtCreator 2020-04-20T21:04:46.839Z | ||
# | ||
#------------------------------------------------- | ||
|
||
QT += widgets | ||
|
||
QT -= gui | ||
|
||
TARGET = DigraphPlot | ||
TEMPLATE = lib | ||
|
||
DEFINES += DIGRAPHPLOT_LIBRARY | ||
|
||
CONFIG += c++11 plugin | ||
CONFIG -= debug_and_release_target | ||
|
||
# The following define makes your compiler emit warnings if you use | ||
# any feature of Qt which has been marked as deprecated (the exact warnings | ||
# depend on your compiler). Please consult the documentation of the | ||
# deprecated API in order to know how to port your code away from it. | ||
DEFINES += QT_DEPRECATED_WARNINGS | ||
|
||
# You can also make your code fail to compile if you use deprecated APIs. | ||
# In order to do so, uncomment the following line. | ||
# You can also select to disable deprecated APIs only up to a certain version of Qt. | ||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 | ||
|
||
SOURCES += digraphplot.cpp digraphplotwidget.cpp digraphplotcontrols.cpp | ||
|
||
HEADERS += digraphplot.h digraphplotwidget.h digraphplotcontrols.h | ||
|
||
FORMS += digraphplotcontrols.ui | ||
|
||
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../../../hobbits-core/release/ -lhobbits-core | ||
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../../../hobbits-core/debug/ -lhobbits-core | ||
else:unix: LIBS += -L$$OUT_PWD/../../../hobbits-core/ -lhobbits-core | ||
|
||
INCLUDEPATH += $$PWD/../../../hobbits-core | ||
DEPENDPATH += $$PWD/../../../hobbits-core | ||
|
||
unix:{ | ||
QMAKE_LFLAGS_RPATH= | ||
QMAKE_LFLAGS += "-Wl,-rpath,'$$ORIGIN/../../lib:$$ORIGIN'" | ||
} | ||
|
||
unix { | ||
target.path = target.path = $$(HOME)/.local/share/hobbits/plugins/displays | ||
INSTALLS += target | ||
} |
Oops, something went wrong.