mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-14 05:47:14 +02:00
WIP
This commit is contained in:
@ -27,6 +27,7 @@ set(FORMS
|
||||
forms/form_tab_advanced.ui
|
||||
forms/form_tab_settings.ui
|
||||
forms/form_tab_debugging.ui
|
||||
forms/form_tab_messages.ui
|
||||
)
|
||||
|
||||
qt4_wrap_ui(FORMS_H ${FORMS})
|
||||
|
@ -24,59 +24,115 @@
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
<width>775</width>
|
||||
<height>345</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" rowspan="2">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</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 row="1" column="1" colspan="3">
|
||||
<widget class="QTextEdit" name="dispLog">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2" colspan="2">
|
||||
<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">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>1000</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<tabstops>
|
||||
<tabstop>btnSave</tabstop>
|
||||
<tabstop>btnClear</tabstop>
|
||||
<tabstop>dispCommand</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="../include/icons.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
@ -8,7 +8,7 @@ class qTabDataOutput:public QWidget, private Ui::TabDataOutputObject{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
qTabDataOutput(QWidget *parent,multiSlsDetector* detector);
|
||||
qTabDataOutput(QWidget *parent, multiSlsDetector* detector);
|
||||
~qTabDataOutput();
|
||||
void Refresh();
|
||||
|
||||
|
@ -1,18 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include "ui_form_tab_messages.h"
|
||||
#include "qDebugStream.h"
|
||||
|
||||
class QTextEdit;
|
||||
class QPushButton;
|
||||
|
||||
class qTabMessages:public QWidget{
|
||||
class qTabMessages:public QWidget, private Ui::TabMessagesObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
qTabMessages(QWidget* parent);
|
||||
~qTabMessages();
|
||||
void Refresh();
|
||||
|
||||
private slots:
|
||||
void ExecuteCommand();
|
||||
void customEvent(QEvent *e);
|
||||
void SaveLog();
|
||||
void ClearLog();
|
||||
@ -20,9 +20,6 @@ private slots:
|
||||
private:
|
||||
void SetupWidgetWindow();
|
||||
void Initialization();
|
||||
|
||||
QTextEdit *dispLog;
|
||||
QPushButton *btnSave;
|
||||
QPushButton *btnClear;
|
||||
void PrintNextLine();
|
||||
};
|
||||
|
||||
|
@ -608,6 +608,7 @@ void qDetectorMain::Refresh(int index) {
|
||||
tabDeveloper->Refresh();
|
||||
break;
|
||||
case MESSAGES:
|
||||
tabMessages->Refresh();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1,57 +1,30 @@
|
||||
#include "qTabMessages.h"
|
||||
#include "qDefs.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QTextEdit>
|
||||
#include <QPushButton>
|
||||
#include <QEvent>
|
||||
#include <QFile>
|
||||
#include <QFileDialog>
|
||||
#include <QGridLayout>
|
||||
#include <QTextStream>
|
||||
#include <QDir>
|
||||
#include <QProcess>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
qTabMessages::qTabMessages(QWidget *parent) : QWidget(parent),
|
||||
dispLog(nullptr), btnSave(nullptr), btnClear(nullptr) {
|
||||
qTabMessages::qTabMessages(QWidget *parent) : QWidget(parent) {
|
||||
setupUi(this);
|
||||
SetupWidgetWindow();
|
||||
FILE_LOG(logDEBUG) << "Messages ready";
|
||||
}
|
||||
|
||||
qTabMessages::~qTabMessages() {
|
||||
if (dispLog)
|
||||
delete dispLog;
|
||||
if (btnSave)
|
||||
delete btnSave;
|
||||
if (btnClear)
|
||||
delete btnClear;
|
||||
qTabMessages::~qTabMessages() {}
|
||||
|
||||
void qTabMessages::Refresh() {
|
||||
dispCommand->clear();
|
||||
}
|
||||
|
||||
void qTabMessages::SetupWidgetWindow() {
|
||||
QGridLayout *gridLayout = new QGridLayout(this);
|
||||
|
||||
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);
|
||||
|
||||
PrintNextLine();
|
||||
qDebugStream(std::cout, this);
|
||||
qDebugStream(std::cerr, this);
|
||||
|
||||
@ -61,6 +34,29 @@ void qTabMessages::SetupWidgetWindow() {
|
||||
void qTabMessages::Initialization() {
|
||||
connect(btnSave, SIGNAL(clicked()), this, SLOT(SaveLog()));
|
||||
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) {
|
||||
@ -96,3 +92,4 @@ void qTabMessages::ClearLog() {
|
||||
dispLog->clear();
|
||||
FILE_LOG(logINFO) << "Log Cleared";
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user