From 82ad6bc667c23f2396b04fe1839b3b8906f6d58d Mon Sep 17 00:00:00 2001 From: Claudio Scafuri <claudio.scafuri@elettra.eu> Date: Fri, 25 Feb 2022 10:25:21 +0100 Subject: [PATCH] first release --- .gitignore | 21 +++++ sextupole.pro | 75 ++++++++++++++++++ src/main.cpp | 47 ++++++++++++ src/sextupole.cpp | 35 +++++++++ src/sextupole.h | 35 +++++++++ src/sextupole.ui | 192 ++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 405 insertions(+) create mode 100644 .gitignore create mode 100644 sextupole.pro create mode 100644 src/main.cpp create mode 100644 src/sextupole.cpp create mode 100644 src/sextupole.h create mode 100644 src/sextupole.ui diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d3a0efa --- /dev/null +++ b/.gitignore @@ -0,0 +1,21 @@ +.project +.cproject +.settings +Makefile +moc +obj +bin +objects +core* +*~ +*.so +*.so* +.metadata +.cvsignore +.nse_depinfo +software +ui_* +qrc*.cpp +.qmake.stash +CVS +*.user diff --git a/sextupole.pro b/sextupole.pro new file mode 100644 index 0000000..d8446ae --- /dev/null +++ b/sextupole.pro @@ -0,0 +1,75 @@ +isEmpty(CUMBIA_ROOT) { + CUMBIA_ROOT=/usr/local/cumbia-libs +} +include($${CUMBIA_ROOT}/include/quapps/quapps.pri) + +# CONFIG += debug | release + +DEFINES += QT_NO_DEBUG_OUTPUT + +# RESOURCES += + +SOURCES += src/main.cpp \ + src/sextupole.cpp + +HEADERS += src/sextupole.h + +# cuuimake runs uic +# FORMS = src/sextupole.ui +# but we need to include ui_xxxx.h file amongst the headers +# in order to be recompiled when it changes +# +HEADERS += \ + ui/ui_sextupole.h + +# - ui: where to find cuuimake ui_*.h files +# since FORMS is not used +# - src: where to find headers included by +# ui_*.h (e.g. for custom widget promoted +# from the Qt designer) +# +INCLUDEPATH += ui src + +TARGET = sextupole-gui +QMAKE_POST_LINK = $(STRIP) $(TARGET) +!wasm-emscripten { + TARGET = bin/$${TARGET} +} else { + TARGET = wasm/$${TARGET} +} + +# +# make install works if INSTALL_DIR is given to qmake +# +!isEmpty(INSTALL_DIR) { + wasm-emscripten { + inst.files = wasm/* + } else { + inst.files = $${TARGET} + } + inst.path = $${INSTALL_DIR} + INSTALLS += inst + message("-") + message("INSTALLATION") + message(" execute `make install` to install 'sextupole' under $${INSTALL_DIR} ") + message("-") +} else { + message("-") + message("INSTALLATION") + message(" call qmake INSTALL_DIR=/usr/local/bin to install sextupole later with `make install` ") + message("-") +} + +# unix:LIBS += -L. -lmylib + +# unix:INCLUDEPATH += . ../../src + +message("-") +message("NOTE") +message("You need to run cuuimake in order to build the project") +message("-") +message(" cuuimake --show-config to see cuuimake configuration options") +message(" cuuimake --configure to configure cuuimake") +message(" cuuimake -jN to execute cuuimake and then make -jN") +message(" cuuimake --make to run cuuimake and then make") +message("-") diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..1242640 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,47 @@ +#include <quapplication.h> +#include "sextupole.h" + +// cumbia +#include <cumbiapool.h> +#include <cuthreadfactoryimpl.h> +#include <qthreadseventbridgefactory.h> +// cumbia + +#define VERSION "1.0" + +int main(int argc, char *argv[]) +{ + QuApplication qu_app( argc, argv ); + qu_app.setOrganizationName("Elettra"); + qu_app.setApplicationName("Sextupole"); + QString version(VERSION); + qu_app.setApplicationVersion(version); + qu_app.setProperty("author", "Claudio Scafuri"); + qu_app.setProperty("mail", "claudio.scafuri@elettra.eu"); + qu_app.setProperty("phone", "8009"); + qu_app.setProperty("office", "T2 "); + qu_app.setProperty("hwReferent", "$HW_REFERENT$"); /* name of the referent that provides the device server */ + + // $palette$ + + CumbiaPool *cu_p = new CumbiaPool(); + Sextupole *w = new Sextupole(cu_p, NULL); + + QString title("Sextupole"); + QStringList argum=QApplication::arguments(); + if (argum.size() > 1 ) + title=argum.at(1).split('/').last(); //solo il member + w->setWindowTitle(title.toUpper()); + w->setText(title.toUpper()); + w->show(); + // exec application loop + int ret = qu_app.exec(); + // delete resources and return + delete w; + + for(std::string n : cu_p->names()) + if(cu_p->get(n)) + delete cu_p->get(n); + + return ret; +} diff --git a/src/sextupole.cpp b/src/sextupole.cpp new file mode 100644 index 0000000..3052ccd --- /dev/null +++ b/src/sextupole.cpp @@ -0,0 +1,35 @@ +#include "sextupole.h" +#include "ui_sextupole.h" + +// cumbia +#include <cumbiapool.h> +#include <cuserviceprovider.h> +#include <cumacros.h> +#include <quapps.h> +// cumbia + +Sextupole::Sextupole(CumbiaPool *cumbia_pool, QWidget *parent) : + QWidget(parent) +{ + // cumbia + CuModuleLoader mloader(cumbia_pool, &m_ctrl_factory_pool, &m_log_impl); + cu_pool = cumbia_pool; + ui = new Ui::Sextupole; + ui->setupUi(this, cu_pool, m_ctrl_factory_pool); + + // mloader.modules() to get the list of loaded modules + // cumbia +} + +Sextupole::~Sextupole() +{ + delete ui; +} + +void Sextupole::setText( const QString & s){ + ui->magName->setText(s); + QFont font = ui->magName->font(); + font.setPointSize(12); + font.setBold(true); + ui->magName->setFont(font); +} diff --git a/src/sextupole.h b/src/sextupole.h new file mode 100644 index 0000000..8b3d461 --- /dev/null +++ b/src/sextupole.h @@ -0,0 +1,35 @@ +#ifndef Sextupole_H +#define Sextupole_H + +#include <QWidget> + +// cumbia +#include <qulogimpl.h> +#include <cucontrolsfactorypool.h> +class CumbiaPool; +// cumbia + +namespace Ui { +class Sextupole; +} + +class Sextupole : public QWidget +{ + Q_OBJECT + +public: + explicit Sextupole(CumbiaPool *cu_p, QWidget *parent = 0); + ~Sextupole(); + void setText( const QString &); + +private: + Ui::Sextupole *ui; + + // cumbia + CumbiaPool *cu_pool; + QuLogImpl m_log_impl; + CuControlsFactoryPool m_ctrl_factory_pool; + // cumbia +}; + +#endif // Sextupole_H diff --git a/src/sextupole.ui b/src/sextupole.ui new file mode 100644 index 0000000..84b64c7 --- /dev/null +++ b/src/sextupole.ui @@ -0,0 +1,192 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Sextupole</class> + <widget class="QWidget" name="Sextupole"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>414</width> + <height>286</height> + </rect> + </property> + <property name="windowTitle"> + <string>Sextupole</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QuLed" name="quLed"> + <property name="source"> + <string>$1/State</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="magName"> + <property name="text"> + <string><html><head/><body><p><span style=" font-size:20pt; font-weight:600;">SF_B</span></p></body></html></string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string><html><head/><body><p><span style=" font-size:12pt;">Strength (k')</span></p></body></html></string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QuLabel" name="quLabel"> + <property name="minimumSize"> + <size> + <width>100</width> + <height>0</height> + </size> + </property> + <property name="source"> + <string>$1/Strength</string> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QuApplyNumeric" name="quApplyNum"> + <property name="target"> + <string>$1/Strength</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string><html><head/><body><p><span style=" font-size:12pt;">Integrated Field</span></p></body></html></string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QuLabel" name="quLabel_2"> + <property name="source"> + <string>$1/IntegratedField</string> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QuApplyNumeric" name="quApplyNum_2"> + <property name="target"> + <string>$1/IntegratedField</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_4"> + <property name="text"> + <string><html><head/><body><p><span style=" font-size:12pt;">Current</span></p></body></html></string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QuLabel" name="quLabel_3"> + <property name="source"> + <string>$1/Excitation</string> + </property> + </widget> + </item> + <item row="2" column="2"> + <widget class="QuApplyNumeric" name="quApplyNum_3"> + <property name="target"> + <string>$1/Excitation</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="Line" name="line"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <widget class="QLabel" name="label_5"> + <property name="text"> + <string><html><head/><body><p><span style=" font-size:12pt;">Beam Energy</span></p></body></html></string> + </property> + </widget> + </item> + <item> + <widget class="QuLabel" name="quLabel_4"> + <property name="minimumSize"> + <size> + <width>100</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>40</height> + </size> + </property> + <property name="source"> + <string>$1/Energy</string> + </property> + </widget> + </item> + <item> + <widget class="QuApplyNumeric" name="quApplyNum_4"> + <property name="target"> + <string>$1/Energy</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <layoutdefault spacing="6" margin="11"/> + <customwidgets> + <customwidget> + <class>EApplyNumeric</class> + <extends>QWidget</extends> + <header>eapplynumeric.h</header> + </customwidget> + <customwidget> + <class>QuLabel</class> + <extends>QLabel</extends> + <header>qulabel.h</header> + </customwidget> + <customwidget> + <class>QuLed</class> + <extends>QWidget</extends> + <header>quled.h</header> + </customwidget> + <customwidget> + <class>QuApplyNumeric</class> + <extends>EApplyNumeric</extends> + <header>quapplynumeric.h</header> + </customwidget> + </customwidgets> + <resources/> + <connections/> +</ui> -- GitLab