mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-17 07:17:13 +02:00
WIP
This commit is contained in:
@ -27,6 +27,7 @@ set(FORMS
|
|||||||
forms/form_tab_advanced.ui
|
forms/form_tab_advanced.ui
|
||||||
forms/form_tab_settings.ui
|
forms/form_tab_settings.ui
|
||||||
forms/form_tab_debugging.ui
|
forms/form_tab_debugging.ui
|
||||||
|
forms/form_tab_messages.ui
|
||||||
)
|
)
|
||||||
|
|
||||||
qt4_wrap_ui(FORMS_H ${FORMS})
|
qt4_wrap_ui(FORMS_H ${FORMS})
|
||||||
|
@ -24,59 +24,115 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>16777215</width>
|
<width>775</width>
|
||||||
<height>16777215</height>
|
<height>345</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="0" column="0">
|
<item row="1" column="1" colspan="3">
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
<widget class="QTextEdit" name="dispLog">
|
||||||
<item row="1" column="0">
|
<property name="focusPolicy">
|
||||||
<widget class="QLabel" name="label">
|
<enum>Qt::NoFocus</enum>
|
||||||
<property name="text">
|
</property>
|
||||||
<string>TextLabel</string>
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1" rowspan="2">
|
<item row="2" column="2" colspan="2">
|
||||||
<spacer name="horizontalSpacer">
|
<widget class="QLineEdit" name="dispCommand">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>25</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="3">
|
||||||
|
<widget class="QPushButton" name="btnClear">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>35</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Clear</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../include/icons.qrc">
|
||||||
|
<normaloff>:/icons/images/erase.png</normaloff>:/icons/images/erase.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QPushButton" name="btnSave">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>35</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Save</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../include/icons.qrc">
|
||||||
|
<normaloff>:/icons/images/save.png</normaloff>:/icons/images/save.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Command:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::Fixed</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>20</width>
|
<width>1000</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2">
|
|
||||||
<widget class="QLineEdit" name="lineEdit"/>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0" rowspan="2">
|
|
||||||
<widget class="QLabel" name="label_2">
|
|
||||||
<property name="text">
|
|
||||||
<string>TextLabel</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="2">
|
|
||||||
<widget class="QLineEdit" name="lineEdit_2"/>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0" colspan="3">
|
|
||||||
<widget class="QTextEdit" name="textEdit"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<tabstops>
|
||||||
|
<tabstop>btnSave</tabstop>
|
||||||
|
<tabstop>btnClear</tabstop>
|
||||||
|
<tabstop>dispCommand</tabstop>
|
||||||
|
</tabstops>
|
||||||
|
<resources>
|
||||||
|
<include location="../include/icons.qrc"/>
|
||||||
|
</resources>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
@ -8,7 +8,7 @@ class qTabDataOutput:public QWidget, private Ui::TabDataOutputObject{
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
qTabDataOutput(QWidget *parent,multiSlsDetector* detector);
|
qTabDataOutput(QWidget *parent, multiSlsDetector* detector);
|
||||||
~qTabDataOutput();
|
~qTabDataOutput();
|
||||||
void Refresh();
|
void Refresh();
|
||||||
|
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "ui_form_tab_messages.h"
|
||||||
#include "qDebugStream.h"
|
#include "qDebugStream.h"
|
||||||
|
|
||||||
class QTextEdit;
|
class qTabMessages:public QWidget, private Ui::TabMessagesObject {
|
||||||
class QPushButton;
|
|
||||||
|
|
||||||
class qTabMessages:public QWidget{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
qTabMessages(QWidget* parent);
|
qTabMessages(QWidget* parent);
|
||||||
~qTabMessages();
|
~qTabMessages();
|
||||||
|
void Refresh();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void ExecuteCommand();
|
||||||
void customEvent(QEvent *e);
|
void customEvent(QEvent *e);
|
||||||
void SaveLog();
|
void SaveLog();
|
||||||
void ClearLog();
|
void ClearLog();
|
||||||
@ -20,9 +20,6 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
void SetupWidgetWindow();
|
void SetupWidgetWindow();
|
||||||
void Initialization();
|
void Initialization();
|
||||||
|
void PrintNextLine();
|
||||||
QTextEdit *dispLog;
|
|
||||||
QPushButton *btnSave;
|
|
||||||
QPushButton *btnClear;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -608,6 +608,7 @@ void qDetectorMain::Refresh(int index) {
|
|||||||
tabDeveloper->Refresh();
|
tabDeveloper->Refresh();
|
||||||
break;
|
break;
|
||||||
case MESSAGES:
|
case MESSAGES:
|
||||||
|
tabMessages->Refresh();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,57 +1,30 @@
|
|||||||
#include "qTabMessages.h"
|
#include "qTabMessages.h"
|
||||||
#include "qDefs.h"
|
#include "qDefs.h"
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
#include <QTextEdit>
|
|
||||||
#include <QPushButton>
|
|
||||||
#include <QEvent>
|
#include <QEvent>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QGridLayout>
|
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
|
#include <QDir>
|
||||||
|
#include <QProcess>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
qTabMessages::qTabMessages(QWidget *parent) : QWidget(parent),
|
qTabMessages::qTabMessages(QWidget *parent) : QWidget(parent) {
|
||||||
dispLog(nullptr), btnSave(nullptr), btnClear(nullptr) {
|
setupUi(this);
|
||||||
SetupWidgetWindow();
|
SetupWidgetWindow();
|
||||||
FILE_LOG(logDEBUG) << "Messages ready";
|
FILE_LOG(logDEBUG) << "Messages ready";
|
||||||
}
|
}
|
||||||
|
|
||||||
qTabMessages::~qTabMessages() {
|
qTabMessages::~qTabMessages() {}
|
||||||
if (dispLog)
|
|
||||||
delete dispLog;
|
void qTabMessages::Refresh() {
|
||||||
if (btnSave)
|
dispCommand->clear();
|
||||||
delete btnSave;
|
|
||||||
if (btnClear)
|
|
||||||
delete btnClear;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabMessages::SetupWidgetWindow() {
|
void qTabMessages::SetupWidgetWindow() {
|
||||||
QGridLayout *gridLayout = new QGridLayout(this);
|
PrintNextLine();
|
||||||
|
|
||||||
dispLog = new QTextEdit(this);
|
|
||||||
dispLog->setReadOnly(true);
|
|
||||||
dispLog->setFocusPolicy(Qt::NoFocus);
|
|
||||||
dispLog->setTextColor(Qt::darkBlue);
|
|
||||||
|
|
||||||
btnSave = new QPushButton("Save Log ", this);
|
|
||||||
btnSave->setFocusPolicy(Qt::NoFocus);
|
|
||||||
btnSave->setFixedWidth(100);
|
|
||||||
btnSave->setIcon(QIcon(":/icons/images/save.png"));
|
|
||||||
|
|
||||||
btnClear = new QPushButton("Clear ", this);
|
|
||||||
btnClear->setFocusPolicy(Qt::NoFocus);
|
|
||||||
btnClear->setFixedWidth(100);
|
|
||||||
btnClear->setIcon(QIcon(":/icons/images/erase.png"));
|
|
||||||
|
|
||||||
gridLayout->addItem(new QSpacerItem(15, 10, QSizePolicy::Fixed, QSizePolicy::Fixed), 0, 0);
|
|
||||||
gridLayout->addWidget(btnSave, 1, 0, 1, 1);
|
|
||||||
gridLayout->addWidget(btnClear, 1, 4, 1, 1);
|
|
||||||
gridLayout->addItem(new QSpacerItem(15, 10, QSizePolicy::Fixed, QSizePolicy::Fixed), 2, 0);
|
|
||||||
gridLayout->addWidget(dispLog, 3, 0, 1, 5);
|
|
||||||
|
|
||||||
qDebugStream(std::cout, this);
|
qDebugStream(std::cout, this);
|
||||||
qDebugStream(std::cerr, this);
|
qDebugStream(std::cerr, this);
|
||||||
|
|
||||||
@ -61,6 +34,29 @@ void qTabMessages::SetupWidgetWindow() {
|
|||||||
void qTabMessages::Initialization() {
|
void qTabMessages::Initialization() {
|
||||||
connect(btnSave, SIGNAL(clicked()), this, SLOT(SaveLog()));
|
connect(btnSave, SIGNAL(clicked()), this, SLOT(SaveLog()));
|
||||||
connect(btnClear, SIGNAL(clicked()), this, SLOT(ClearLog()));
|
connect(btnClear, SIGNAL(clicked()), this, SLOT(ClearLog()));
|
||||||
|
connect(dispCommand, SIGNAL(editingFinished()), this, SLOT(ExecuteCommand()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void qTabMessages::ExecuteCommand() {
|
||||||
|
QString command = dispCommand->text();
|
||||||
|
dispLog->append(command);
|
||||||
|
dispCommand->clear();
|
||||||
|
|
||||||
|
// take 1st string as program
|
||||||
|
QStringList arguments;
|
||||||
|
|
||||||
|
QProcess *myProcess = new QProcess(this);
|
||||||
|
myProcess->start(command, arguments);
|
||||||
|
|
||||||
|
// print readall
|
||||||
|
QByteArray result = myProcess.readAll();
|
||||||
|
|
||||||
|
PrintNextLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
void qTabMessages::PrintNextLine() {
|
||||||
|
QString path = QDir::cleanPath(QDir::currentPath());
|
||||||
|
dispLog->append(QString("\n") + path + QString("$"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabMessages::customEvent(QEvent *e) {
|
void qTabMessages::customEvent(QEvent *e) {
|
||||||
@ -96,3 +92,4 @@ void qTabMessages::ClearLog() {
|
|||||||
dispLog->clear();
|
dispLog->clear();
|
||||||
FILE_LOG(logINFO) << "Log Cleared";
|
FILE_LOG(logINFO) << "Log Cleared";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user