From 91734607e94a700f7e0e3a1866dc7933b634d949 Mon Sep 17 00:00:00 2001 From: Giacomo Strangolino <giacomo.strangolino@elettra.eu> Date: Tue, 10 Aug 2021 15:14:49 +0200 Subject: [PATCH] ported to cumbia multilib, cumbia version in gitlab. fixed layouts --- src/main.cpp | 72 ++++---- src/tdklambda-genesis.cpp | 29 +++- src/tdklambda-genesis.h | 19 +- src/tdklambda-genesis.ui | 354 +++++++++++++++----------------------- tdklamda-genesis.pro | 72 +++++++- 5 files changed, 279 insertions(+), 267 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 8091808..c660594 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -19,62 +19,52 @@ ***************************************************************************/ -#include <TApplication> -#include <TSplashScreen> -// #include <EStyleLoader> /* see comment below */ -// -#define CVSVERSION "$Name: $" +// #include <TApplication> +// cumbia +#include <cumbiapool.h> +#include <cuthreadfactoryimpl.h> +#include <qthreadseventbridgefactory.h> +// cumbia +#include <quapplication.h> #include "tdklambda-genesis.h" -#include <tutil.h> /* N.B.: prima degli include di X11 */ #include <X11/Xlib.h> #include <QX11Info> -#include <elettracolors.h> int main( int argc, char ** argv ) { - const char *cvs_version = CVSVERSION; - TApplication a( argc, argv ); - /* uncomment to set application color */ - a.setPalette(EPalette("fermi")); - a.setApplicationVersion(CVSVERSION); - a.setApplicationName("PowerSupplyTDKLambda"); - a.setProperty("author", "Giacomo"); - a.setProperty("mail", "giacomo.strangolino@elettra.trieste.it"); - a.setProperty("phone", "375-8073"); - a.setProperty("office", "T2PT025"); - a.setProperty("hwReferent", "Stefano C."); /* name of the referent that provides the device server */ + QuApplication qu_app( argc, argv );// TApplication is mapped into QuApplication. DBus connection is provided by cumbia dbus plugin // ## added by qumbiaprojectwizard + qu_app.setApplicationName("PowerSupplyTDKLambda"); + qu_app.setProperty("author", "Giacomo"); + qu_app.setProperty("mail", "giacomo.strangolino@elettra.trieste.it"); + qu_app.setProperty("phone", "375-8073"); + qu_app.setProperty("office", "T2PT025"); + qu_app.setProperty("hwReferent", "Stefano C."); /* name of the referent that provides the device server */ - /* load the style sheet for QTango application. - * The file is read from the "${INSTALL_ROOT}/share/qtango/stylesheets/qtango.css" - * file. You can load a custom stylesheet by exporting the environment variable - * "QTANGO_STYLESHEET" and setting it to a different path. - * Moreover, you can construct EStyleLoader with a file name as argument, to ignore - * the installed "${INSTALL_ROOT}/share/qtango/stylesheets/qtango.css" and the value - * of the environment variable. - * This does not work as expected in Qt version 4.4.x. So the following two lines are - * commented. Uncomment them when upgrading to a newer Qt version. - */ - // EStyleLoader sLoader; - // a.setStyleSheet(sLoader.styleSheet()); +// TUtil::instance()->setLoggingTarget(argv[0]); +// QTango TUtil:: class is not present in cumbia // ## added by qumbiaprojectwizard - /* splash screen */ - TSplashScreen splash; + CumbiaPool *cu_p = new CumbiaPool(); - TUtil::instance()->setLoggingTarget(argv[0]); - TdkLG mw; + TdkLG *w = new TdkLG(cu_p, 0); QString title("pstdklambda-genesis"); if (QApplication::arguments().size() > 1) title = QApplication::arguments()[1].split('/').last(); /* solo il member */ - mw.setWindowTitle(title); - mw.show(); - /* hide splash screen */ - splash.finish(&mw); + w->setWindowTitle(title); + w->show(); - /* register to window manager */ Display *disp = QX11Info::display(); - Window root_win = (Window) mw.winId(); + Window root_win = (Window) w->winId(); XSetCommand(disp, root_win, argv, argc); - return a.exec(); +// 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/tdklambda-genesis.cpp b/src/tdklambda-genesis.cpp index 8b99fe1..a2f98e0 100644 --- a/src/tdklambda-genesis.cpp +++ b/src/tdklambda-genesis.cpp @@ -19,9 +19,18 @@ ***************************************************************************/ +// cumbia +#include <cumbiapool.h> +#include <cuserviceprovider.h> +#include <cumacros.h> +#include <quapps.h> +// cumbia + #include "tdklambda-genesis.h" -#include <qtango.h> -#include <TLogDialog> +// #include <qtango.h> +// no cumbia include replacement found for qtango.h +// #include <TLogDialog> +// no cumbia include replacement found for TLogDialog #define LITTLEW 328 #define LITTLEH 450 @@ -29,9 +38,20 @@ #define BIGH 720 -TdkLG::TdkLG(QWidget *parent) : QWidget(parent) +TdkLG::TdkLG(CumbiaPool *cumbia_pool, QWidget *parent) : QWidget(parent) { - ui.setupUi(this); + +// cumbia + CuModuleLoader mloader(cumbia_pool, &m_ctrl_factory_pool, &m_log_impl); + cu_pool = cumbia_pool; + ui = new Ui::TdkLG; + ui->setupUi(this, cu_pool, m_ctrl_factory_pool); + + // mloader.modules() to get the list of loaded modules + // cumbia + + + //ui.setupUi(this); } TdkLG::~TdkLG() @@ -44,3 +64,4 @@ TdkLG::~TdkLG() + diff --git a/src/tdklambda-genesis.h b/src/tdklambda-genesis.h index 7937f7b..549a974 100644 --- a/src/tdklambda-genesis.h +++ b/src/tdklambda-genesis.h @@ -22,6 +22,12 @@ #ifndef tdklambdagenesis_H #define tdklambdagenesis_H +// cumbia +#include <qulogimpl.h> +#include <cucontrolsfactorypool.h> +class CumbiaPool; +// cumbia + #include "ui_tdklambda-genesis.h" class TdkLG: public QWidget @@ -29,12 +35,21 @@ class TdkLG: public QWidget Q_OBJECT public: - TdkLG(QWidget * =NULL); + TdkLG(CumbiaPool *cu_p, QWidget * =NULL); ~TdkLG(); private: - Ui::TdkLG ui; +// Ui::TdkLG ui; + Ui::TdkLG * ui; + +// cumbia + CumbiaPool *cu_pool; + QuLogImpl m_log_impl; + CuControlsFactoryPool m_ctrl_factory_pool; + // cumbia + }; #endif + diff --git a/src/tdklambda-genesis.ui b/src/tdklambda-genesis.ui index 0d4ee56..ffecf0c 100644 --- a/src/tdklambda-genesis.ui +++ b/src/tdklambda-genesis.ui @@ -6,15 +6,24 @@ <rect> <x>0</x> <y>0</y> - <width>422</width> - <height>507</height> + <width>440</width> + <height>529</height> </rect> </property> <property name="windowTitle"> <string>Form</string> </property> <layout class="QVBoxLayout" name="verticalLayout"> - <property name="margin"> + <property name="leftMargin"> + <number>3</number> + </property> + <property name="topMargin"> + <number>3</number> + </property> + <property name="rightMargin"> + <number>3</number> + </property> + <property name="bottomMargin"> <number>3</number> </property> <item> @@ -28,20 +37,20 @@ </attribute> <layout class="QGridLayout" name="gridLayout_2"> <item row="0" column="0" colspan="2"> - <widget class="TLabel" name="tLabel"> + <widget class="QuLabel" name="tLabel"> <property name="source"> <string>$1/State</string> </property> </widget> </item> <item row="0" column="2" rowspan="8" colspan="2"> - <widget class="TCircularGauge" name="tCircularGauge_2"> - <property name="referenceEnabled"> - <bool>false</bool> - </property> + <widget class="QuCircularGauge" name="tCircularGauge_2"> <property name="source"> <string>$1/Current</string> </property> + <property name="referenceEnabled" stdset="0"> + <bool>false</bool> + </property> </widget> </item> <item row="1" column="0" colspan="2"> @@ -52,81 +61,55 @@ </widget> </item> <item row="2" column="0" colspan="2"> - <widget class="TPushButton" name="tPushButton"> + <widget class="QuButton" name="tPushButton"> <property name="text"> <string>On</string> </property> - <property name="targets"> + <property name="target"> <string>$1->On</string> </property> </widget> </item> <item row="3" column="0" colspan="2"> - <widget class="TPushButton" name="tPushButton_2"> + <widget class="QuButton" name="tPushButton_2"> <property name="text"> <string>Off</string> </property> - <property name="targets"> + <property name="target"> <string>$1->Off</string> </property> </widget> </item> <item row="4" column="0" colspan="2"> - <widget class="TPushButton" name="tPushButton_3"> + <widget class="QuButton" name="tPushButton_3"> <property name="text"> <string>Reset</string> </property> - <property name="targets"> - <string>$1->ResetV;</string> + <property name="target"> + <string>$1->ResetV</string> </property> </widget> </item> <item row="5" column="0" colspan="2"> - <widget class="TPushButton" name="tPushButton_4"> + <widget class="QuButton" name="tPushButton_4"> <property name="text"> <string>Cycle</string> </property> - <property name="targets"> - <string>$1->StartCycling;;</string> + <property name="target"> + <string>$1->StartCycling</string> </property> </widget> </item> <item row="6" column="0" colspan="2"> - <widget class="TPushButton" name="tPushButton_5"> + <widget class="QuButton" name="tPushButton_5"> <property name="text"> <string>Abort</string> </property> - <property name="targets"> - <string>$1->Abort;;</string> + <property name="target"> + <string>$1->Abort</string> </property> </widget> </item> - <item row="7" column="0"> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>59</height> - </size> - </property> - </spacer> - </item> - <item row="8" column="0" rowspan="2" colspan="2"> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>72</width> - <height>68</height> - </size> - </property> - </spacer> - </item> <item row="8" column="2" colspan="2"> <widget class="QLabel" name="label_5"> <property name="sizePolicy"> @@ -154,15 +137,15 @@ </widget> </item> <item row="9" column="3"> - <widget class="TApplyNumeric" name="tApplyNumeric"> + <widget class="QuApplyNumeric" name="tApplyNumeric"> <property name="maximumSize"> <size> <width>16777215</width> <height>45</height> </size> </property> - <property name="targets"> - <string>$1/Current;</string> + <property name="target"> + <string>$1/Current</string> </property> </widget> </item> @@ -177,7 +160,10 @@ </widget> </item> <item row="11" column="1" colspan="3"> - <widget class="TLabel" name="tLabel_2"> + <widget class="QuLabel" name="tLabel_2"> + <property name="wordWrap"> + <bool>true</bool> + </property> <property name="source"> <string>$1/Status</string> </property> @@ -189,190 +175,128 @@ <attribute name="title"> <string>Expert</string> </attribute> - <widget class="TReaderWriter" name="tReaderWriter"> - <property name="geometry"> - <rect> - <x>138</x> - <y>84</y> - <width>127</width> - <height>28</height> - </rect> - </property> - <property name="minimumSize"> - <size> - <width>127</width> - <height>0</height> - </size> - </property> - <property name="source"> - <string>$1/VoltageLimit</string> - </property> - <property name="targets"> - <string/> - </property> - </widget> - <widget class="QLabel" name="label"> - <property name="geometry"> - <rect> - <x>9</x> - <y>7</y> - <width>124</width> - <height>19</height> - </rect> - </property> - <property name="text"> - <string>Operating Mode</string> - </property> - </widget> - <widget class="TLabel" name="tLabel_5"> - <property name="geometry"> - <rect> - <x>138</x> - <y>44</y> - <width>125</width> - <height>30</height> - </rect> - </property> - <property name="minimumSize"> - <size> - <width>125</width> - <height>30</height> - </size> - </property> - <property name="source"> - <string>$1/MeasuredVoltage</string> - </property> - <property name="period"> - <number>10000</number> - </property> - <property name="autoConfiguration"> - <bool>false</bool> - </property> - </widget> - <widget class="QLabel" name="label_3"> - <property name="geometry"> - <rect> - <x>35</x> - <y>85</y> - <width>98</width> - <height>19</height> - </rect> - </property> - <property name="text"> - <string>Voltage Limit</string> - </property> - </widget> - <widget class="QLabel" name="label_4"> - <property name="geometry"> - <rect> - <x>76</x> - <y>44</y> - <width>57</width> - <height>19</height> - </rect> - </property> - <property name="text"> - <string>Voltage</string> - </property> - </widget> - <widget class="TLabel" name="tLabel_3"> - <property name="geometry"> - <rect> - <x>138</x> - <y>7</y> - <width>125</width> - <height>30</height> - </rect> - </property> - <property name="minimumSize"> - <size> - <width>125</width> - <height>30</height> - </size> - </property> - <property name="source"> - <string>$1/OperatingMode</string> - </property> - <property name="period"> - <number>10000</number> - </property> - </widget> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Operating Mode</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QuLabel" name="tLabel_3"> + <property name="minimumSize"> + <size> + <width>125</width> + <height>30</height> + </size> + </property> + <property name="source"> + <string>$1/OperatingMode</string> + </property> + <property name="period" stdset="0"> + <number>10000</number> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_4"> + <property name="text"> + <string>Voltage</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QuLabel" name="tLabel_5"> + <property name="minimumSize"> + <size> + <width>125</width> + <height>30</height> + </size> + </property> + <property name="source"> + <string>$1/MeasuredVoltage</string> + </property> + <property name="period" stdset="0"> + <number>10000</number> + </property> + <property name="autoConfiguration" stdset="0"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string>Voltage Limit</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QuInputOutput" name="tReaderWriter"> + <property name="minimumSize"> + <size> + <width>127</width> + <height>0</height> + </size> + </property> + <property name="source"> + <string>$1/VoltageLimit</string> + </property> + <property name="target" stdset="0"> + <string/> + </property> + </widget> + </item> + <item row="3" column="1"> + <spacer name="verticalSpacer_2"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>328</height> + </size> + </property> + </spacer> + </item> + </layout> </widget> </widget> </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <spacer name="horizontalSpacer_2"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>316</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="TLogButton" name="tLogButton"> - <property name="font"> - <font> - <pointsize>10</pointsize> - </font> - </property> - </widget> - </item> - </layout> - </item> </layout> </widget> <customwidgets> <customwidget> - <class>TLabel</class> - <extends>ELabel</extends> - <header>TLabel</header> - </customwidget> - <customwidget> - <class>TCircularGauge</class> - <extends>ECircularGauge</extends> - <header>TCircularGauge</header> - </customwidget> - <customwidget> - <class>TApplyNumeric</class> - <extends>EApplyNumeric</extends> - <header>TApplyNumeric</header> + <class>QuLabel</class> + <extends>QLabel</extends> + <header>qulabel.h</header> </customwidget> <customwidget> - <class>TPushButton</class> - <extends>QPushButton</extends> - <header>TPushButton</header> + <class>QuCircularGauge</class> + <extends>QWidget</extends> + <header>qucirculargauge.h</header> </customwidget> <customwidget> - <class>TLogButton</class> + <class>QuButton</class> <extends>QPushButton</extends> - <header>TLogButton</header> + <header>qubutton.h</header> </customwidget> <customwidget> - <class>TReaderWriter</class> - <extends>TLabel</extends> - <header>TReaderWriter</header> - </customwidget> - <customwidget> - <class>ELabel</class> - <extends>QLabel</extends> - <header>ELabel</header> + <class>QuApplyNumeric</class> + <extends>EApplyNumeric</extends> + <header>quapplynumeric.h</header> </customwidget> <customwidget> - <class>ECircularGauge</class> - <extends>QWidget</extends> - <header>EGauge</header> + <class>QuInputOutput</class> + <extends>QFrame</extends> + <header>quinputoutput.h</header> </customwidget> <customwidget> <class>EApplyNumeric</class> <extends>QWidget</extends> - <header>EApplyNumeric</header> + <header>eapplynumeric.h</header> </customwidget> </customwidgets> <resources/> diff --git a/tdklamda-genesis.pro b/tdklamda-genesis.pro index e5172d9..42be2da 100644 --- a/tdklamda-genesis.pro +++ b/tdklamda-genesis.pro @@ -1,10 +1,72 @@ -include(/usr/local/qtango/include/qtango6/qtango.pri) +isEmpty(CUMBIA_ROOT) { + CUMBIA_ROOT=/usr/local/cumbia-libs +} +include($${CUMBIA_ROOT}/include/quapps/quapps.pri) -SOURCES += src/tdklambda-genesis.cpp \ - src/main.cpp +# CONFIG += debug | release + +DEFINES += QT_NO_DEBUG_OUTPUT + +# RESOURCES += + +SOURCES += src/main.cpp \ + src/tdklambda-genesis.cpp HEADERS += src/tdklambda-genesis.h -FORMS = src/tdklambda-genesis.ui +# cuuimake runs uic +# FORMS += \ + + +# - 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 = tdklamda-genesis-gui + +!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 '$PROJECT_NAME$' under $${INSTALL_DIR} ") + message("-") +} else { + message("-") + message("INSTALLATION") + message(" call qmake INSTALL_DIR=/usr/local/bin to install $PROJECT_NAME$ 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("-") -TARGET = bin/pstdklambda-genesis -- GitLab