mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-14 22:07:12 +02:00
WIP
This commit is contained in:
@ -1,72 +1,28 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "qDefs.h"
|
|
||||||
#include "qDebugStream.h"
|
#include "qDebugStream.h"
|
||||||
class qDetectorMain;
|
|
||||||
|
|
||||||
#include <QWidget>
|
class QTextEdit;
|
||||||
#include <QTextEdit>
|
class QPushButton;
|
||||||
#include <QEvent>
|
|
||||||
#include <QPushButton>
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*@short sets up the Messages parameters
|
|
||||||
*/
|
|
||||||
class qTabMessages:public QWidget{
|
class qTabMessages:public QWidget{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
|
||||||
* The constructor
|
|
||||||
* @param parent parent widget
|
|
||||||
*/
|
|
||||||
qTabMessages(QWidget* parent);
|
qTabMessages(QWidget* parent);
|
||||||
|
|
||||||
/**
|
|
||||||
* Destructor
|
|
||||||
*/
|
|
||||||
~qTabMessages();
|
~qTabMessages();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
/**
|
|
||||||
* Stream log to textedit in GUI
|
|
||||||
*/
|
|
||||||
void customEvent(QEvent *e);
|
void customEvent(QEvent *e);
|
||||||
|
|
||||||
/**
|
|
||||||
* Save Log to File
|
|
||||||
*/
|
|
||||||
void SaveLog();
|
void SaveLog();
|
||||||
|
|
||||||
/**
|
|
||||||
* Clear Log to File
|
|
||||||
*/
|
|
||||||
void ClearLog();
|
void ClearLog();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets up the widget
|
|
||||||
*/
|
|
||||||
void SetupWidgetWindow();
|
void SetupWidgetWindow();
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets up all the slots and signals
|
|
||||||
*/
|
|
||||||
void Initialization();
|
void Initialization();
|
||||||
|
|
||||||
|
|
||||||
/** The qDetectorMain object */
|
|
||||||
qDetectorMain *myMainTab;
|
|
||||||
|
|
||||||
/** Log of executed commands */
|
|
||||||
QTextEdit *dispLog;
|
QTextEdit *dispLog;
|
||||||
|
|
||||||
/** To save the log to file */
|
|
||||||
QPushButton *btnSave;
|
QPushButton *btnSave;
|
||||||
|
|
||||||
/** To clear the log to file */
|
|
||||||
QPushButton *btnClear;
|
QPushButton *btnClear;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
#include "qTabMessages.h"
|
#include "qTabMessages.h"
|
||||||
#include "qDetectorMain.h"
|
#include "qDefs.h"
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QTextEdit>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QEvent>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
@ -9,21 +13,17 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|
||||||
qTabMessages::qTabMessages(QWidget *parent) : QWidget(parent) {
|
qTabMessages::qTabMessages(QWidget *parent) : QWidget(parent) {
|
||||||
SetupWidgetWindow();
|
SetupWidgetWindow();
|
||||||
Initialization();
|
Initialization();
|
||||||
FILE_LOG(logDEBUG) << "Messages ready";
|
FILE_LOG(logDEBUG) << "Messages ready";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
qTabMessages::~qTabMessages() {
|
qTabMessages::~qTabMessages() {
|
||||||
delete dispLog;
|
delete dispLog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void qTabMessages::SetupWidgetWindow() {
|
void qTabMessages::SetupWidgetWindow() {
|
||||||
/** Layout */
|
|
||||||
QGridLayout *gridLayout = new QGridLayout(this);
|
QGridLayout *gridLayout = new QGridLayout(this);
|
||||||
|
|
||||||
dispLog = new QTextEdit(this);
|
dispLog = new QTextEdit(this);
|
||||||
@ -47,17 +47,15 @@ void qTabMessages::SetupWidgetWindow() {
|
|||||||
gridLayout->addItem(new QSpacerItem(15, 10, QSizePolicy::Fixed, QSizePolicy::Fixed), 2, 0);
|
gridLayout->addItem(new QSpacerItem(15, 10, QSizePolicy::Fixed, QSizePolicy::Fixed), 2, 0);
|
||||||
gridLayout->addWidget(dispLog, 3, 0, 1, 5);
|
gridLayout->addWidget(dispLog, 3, 0, 1, 5);
|
||||||
|
|
||||||
qDebugStream *qout = new qDebugStream(std::cout, this);
|
qDebugStream(std::cout, this);
|
||||||
qDebugStream *qerr = new qDebugStream(std::cerr, this);
|
qDebugStream(std::cerr, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void qTabMessages::customEvent(QEvent *e) {
|
void qTabMessages::customEvent(QEvent *e) {
|
||||||
if (e->type() == (STREAMEVENT)) {
|
if (e->type() == (STREAMEVENT)) {
|
||||||
QString temp = ((qStreamEvent *)e)->getString();
|
QString temp = ((qStreamEvent *)e)->getString();
|
||||||
@ -65,7 +63,6 @@ void qTabMessages::customEvent(QEvent *e) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void qTabMessages::SaveLog() {
|
void qTabMessages::SaveLog() {
|
||||||
QString fName = QString(""); //FIXME:current directory?
|
QString fName = QString(""); //FIXME:current directory?
|
||||||
fName = fName + "/LogFile.txt";
|
fName = fName + "/LogFile.txt";
|
||||||
@ -88,7 +85,6 @@ void qTabMessages::SaveLog() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void qTabMessages::ClearLog() {
|
void qTabMessages::ClearLog() {
|
||||||
dispLog->clear();
|
dispLog->clear();
|
||||||
FILE_LOG(logINFO) << "Log Cleared";
|
FILE_LOG(logINFO) << "Log Cleared";
|
||||||
|
Reference in New Issue
Block a user