Dev.... GUI, Log dispatcher, etc...
This commit is contained in:
parent
0f43eae694
commit
c888a889f2
83
Otarcik_CAN/Sources/GeneralMessagesLogDispatcher.cpp
Normal file
83
Otarcik_CAN/Sources/GeneralMessagesLogDispatcher.cpp
Normal file
@ -0,0 +1,83 @@
|
||||
#include "GeneralMessagesLogDispatcher.h"
|
||||
|
||||
|
||||
|
||||
//singleton instantiation
|
||||
CGeneralMessagesLogDispatcher CGeneralMessagesLogDispatcher::mSingleton;
|
||||
|
||||
|
||||
CGeneralMessagesLogDispatcher::CGeneralMessagesLogDispatcher()
|
||||
{
|
||||
mGeneralStatusPageHandle = 0;
|
||||
|
||||
mNbLinesInGUILog = 0;
|
||||
|
||||
}
|
||||
|
||||
CGeneralMessagesLogDispatcher::~CGeneralMessagesLogDispatcher()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int CGeneralMessagesLogDispatcher::AddLogMessage(QString LogLine, bool AddToGUILogPanel)
|
||||
{
|
||||
//TODO: Add text to log file...
|
||||
|
||||
LogLine.remove('\n');
|
||||
LogLine.remove('\r');
|
||||
LogLine.append('\n');
|
||||
|
||||
|
||||
|
||||
if(AddToGUILogPanel == true)
|
||||
{
|
||||
if(mNbLinesInGUILog == GENERAL_MESSAGES_MAX_LOG_LINES)
|
||||
{
|
||||
//Make shure we are able to remove first line
|
||||
int FirstLineLength = mGeneralMsgGUILog.indexOf(QChar('\n'));
|
||||
if(FirstLineLength != -1)
|
||||
{
|
||||
mGeneralMsgGUILog.remove(0,FirstLineLength+1);
|
||||
mGeneralMsgGUILog.append(LogLine);
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug("Something fucked-up happened in CGeneralMessagesLogDispatch::AddLogMessage");
|
||||
return RET_GENERAL_ERROR;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mGeneralMsgGUILog.append(LogLine);
|
||||
mNbLinesInGUILog++;
|
||||
}
|
||||
|
||||
if(mGeneralStatusPageHandle != 0)
|
||||
{
|
||||
mGeneralStatusPageHandle->SetGeneralMsgText(mGeneralMsgGUILog);
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug("Someone forgot to assing their pointers in CGeneralMessagesLogDispatch::AddLogMessage!! This needs to be fixed");
|
||||
return RET_GENERAL_ERROR;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
int CGeneralMessagesLogDispatcher::BindGuiPageHandle(CGeneralStatusPage *Handle)
|
||||
{
|
||||
if(Handle == 0)
|
||||
{
|
||||
return RET_GENERAL_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
mGeneralStatusPageHandle = Handle;
|
||||
}
|
||||
|
||||
return RET_OK;
|
||||
|
||||
}
|
||||
30
Otarcik_CAN/Sources/GeneralMessagesLogDispatcher.h
Normal file
30
Otarcik_CAN/Sources/GeneralMessagesLogDispatcher.h
Normal file
@ -0,0 +1,30 @@
|
||||
#ifndef GENERALMESSAGESLOGDISPATCHER_H
|
||||
#define GENERALMESSAGESLOGDISPATCHER_H
|
||||
|
||||
#include <QString>
|
||||
#include "defines.h"
|
||||
#include "GeneralStatusPage.h"
|
||||
|
||||
|
||||
class CGeneralMessagesLogDispatcher
|
||||
{
|
||||
public:
|
||||
|
||||
//CGeneralMessagesLogDispatcher is a singleton class
|
||||
static CGeneralMessagesLogDispatcher* instance(){return &mSingleton;}
|
||||
static CGeneralMessagesLogDispatcher mSingleton;
|
||||
|
||||
CGeneralMessagesLogDispatcher();
|
||||
virtual ~CGeneralMessagesLogDispatcher();
|
||||
|
||||
int AddLogMessage(QString LogLine, bool AddToGUILogPanel = true);
|
||||
CGeneralStatusPage *mGeneralStatusPageHandle;
|
||||
int BindGuiPageHandle(CGeneralStatusPage *Handle);
|
||||
|
||||
private:
|
||||
QString mGeneralMsgGUILog;
|
||||
unsigned int mNbLinesInGUILog; //Keep the count of lines displayed in the GUI so we don't EVER buffer overrun
|
||||
|
||||
};
|
||||
|
||||
#endif // GENERALMESSAGESLOGDISPATCHER_H
|
||||
20
Otarcik_CAN/Sources/Gui/GeneralStatusPage.cpp
Normal file
20
Otarcik_CAN/Sources/Gui/GeneralStatusPage.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
#include "GeneralStatusPage.h"
|
||||
#include "ui_GeneralStatusPage.h"
|
||||
|
||||
CGeneralStatusPage::CGeneralStatusPage(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::CGeneralStatusPage)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
CGeneralStatusPage::~CGeneralStatusPage()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
int CGeneralStatusPage::SetGeneralMsgText(QString Txt)
|
||||
{
|
||||
ui->mGenMsgTextEdit->setText(Txt);
|
||||
return RET_OK;
|
||||
}
|
||||
27
Otarcik_CAN/Sources/Gui/GeneralStatusPage.h
Normal file
27
Otarcik_CAN/Sources/Gui/GeneralStatusPage.h
Normal file
@ -0,0 +1,27 @@
|
||||
#ifndef GENERALSTATUSPAGE_H
|
||||
#define GENERALSTATUSPAGE_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "defines.h"
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class CGeneralStatusPage;
|
||||
}
|
||||
|
||||
class CGeneralStatusPage : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CGeneralStatusPage(QWidget *parent = 0);
|
||||
~CGeneralStatusPage();
|
||||
|
||||
int SetGeneralMsgText(QString Txt);
|
||||
|
||||
|
||||
private:
|
||||
Ui::CGeneralStatusPage *ui;
|
||||
};
|
||||
|
||||
#endif // GENERALSTATUSPAGE_H
|
||||
29
Otarcik_CAN/Sources/Gui/GeneralStatusPage.ui
Normal file
29
Otarcik_CAN/Sources/Gui/GeneralStatusPage.ui
Normal file
@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CGeneralStatusPage</class>
|
||||
<widget class="QWidget" name="CGeneralStatusPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1147</width>
|
||||
<height>492</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<widget class="QTextEdit" name="mGenMsgTextEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>660</x>
|
||||
<y>30</y>
|
||||
<width>441</width>
|
||||
<height>451</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@ -1,24 +1,446 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CMainWindow</class>
|
||||
<widget class="QMainWindow" name="CMainWindow">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
<width>1186</width>
|
||||
<height>511</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>CMainWindow</string>
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Button">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>203</red>
|
||||
<green>203</green>
|
||||
<blue>203</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Light">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Midlight">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>229</red>
|
||||
<green>229</green>
|
||||
<blue>229</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Dark">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>101</red>
|
||||
<green>101</green>
|
||||
<blue>101</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Mid">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>135</red>
|
||||
<green>135</green>
|
||||
<blue>135</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Text">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="BrightText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ButtonText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Base">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>206</red>
|
||||
<green>206</green>
|
||||
<blue>206</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>240</red>
|
||||
<green>240</green>
|
||||
<blue>240</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Shadow">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="AlternateBase">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>229</red>
|
||||
<green>229</green>
|
||||
<blue>229</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ToolTipBase">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>220</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ToolTipText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Button">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>203</red>
|
||||
<green>203</green>
|
||||
<blue>203</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Light">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Midlight">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>229</red>
|
||||
<green>229</green>
|
||||
<blue>229</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Dark">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>101</red>
|
||||
<green>101</green>
|
||||
<blue>101</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Mid">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>135</red>
|
||||
<green>135</green>
|
||||
<blue>135</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Text">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="BrightText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ButtonText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Base">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>206</red>
|
||||
<green>206</green>
|
||||
<blue>206</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>240</red>
|
||||
<green>240</green>
|
||||
<blue>240</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Shadow">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="AlternateBase">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>229</red>
|
||||
<green>229</green>
|
||||
<blue>229</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ToolTipBase">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>220</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ToolTipText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>101</red>
|
||||
<green>101</green>
|
||||
<blue>101</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Button">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>203</red>
|
||||
<green>203</green>
|
||||
<blue>203</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Light">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Midlight">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>229</red>
|
||||
<green>229</green>
|
||||
<blue>229</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Dark">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>101</red>
|
||||
<green>101</green>
|
||||
<blue>101</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Mid">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>135</red>
|
||||
<green>135</green>
|
||||
<blue>135</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Text">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>101</red>
|
||||
<green>101</green>
|
||||
<blue>101</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="BrightText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ButtonText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>101</red>
|
||||
<green>101</green>
|
||||
<blue>101</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Base">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>240</red>
|
||||
<green>240</green>
|
||||
<blue>240</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>240</red>
|
||||
<green>240</green>
|
||||
<blue>240</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Shadow">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="AlternateBase">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>203</red>
|
||||
<green>203</green>
|
||||
<blue>203</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ToolTipBase">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>220</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ToolTipText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Otracik</string>
|
||||
</property>
|
||||
<property name="windowOpacity">
|
||||
<double>3.000000000000000</double>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QMenuBar" name="menuBar" />
|
||||
<widget class="QToolBar" name="mainToolBar" />
|
||||
<widget class="QWidget" name="centralWidget"/>
|
||||
<widget class="QStatusBar" name="statusBar"/>
|
||||
</widget>
|
||||
<layoutDefault spacing="6" margin="11" />
|
||||
<pixmapfunction></pixmapfunction>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@ -6,9 +6,18 @@ CMainWindow::CMainWindow(QWidget *parent) :
|
||||
ui(new Ui::CMainWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
mGeneralStatusPage = new CGeneralStatusPage(this);
|
||||
mMainWindowWidget = new QTabWidget(this);
|
||||
|
||||
setCentralWidget(mMainWindowWidget);
|
||||
mMainWindowWidget->addTab(mGeneralStatusPage,"Status");
|
||||
|
||||
resize(1700,768);
|
||||
}
|
||||
|
||||
CMainWindow::~CMainWindow()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
@ -2,6 +2,9 @@
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QTabWidget>
|
||||
#include "GeneralStatusPage.h"
|
||||
#include <QTextEdit>
|
||||
|
||||
namespace Ui {
|
||||
class CMainWindow;
|
||||
@ -15,6 +18,10 @@ public:
|
||||
explicit CMainWindow(QWidget *parent = 0);
|
||||
~CMainWindow();
|
||||
|
||||
QTabWidget *mMainWindowWidget;
|
||||
CGeneralStatusPage *mGeneralStatusPage;
|
||||
|
||||
|
||||
private:
|
||||
Ui::CMainWindow *ui;
|
||||
};
|
||||
|
||||
@ -12,6 +12,14 @@ COtarcikCan::~COtarcikCan()
|
||||
|
||||
int COtarcikCan::Start()
|
||||
{
|
||||
w.show();
|
||||
|
||||
CGeneralMessagesLogDispatcher::instance()->BindGuiPageHandle(w.mGeneralStatusPage);
|
||||
|
||||
|
||||
|
||||
CGeneralMessagesLogDispatcher::instance()->AddLogMessage("OtarcikCan modules starting...");
|
||||
|
||||
mPCANInterface->Init();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2,7 +2,9 @@
|
||||
#define OTARCIKCAN_H
|
||||
|
||||
#include <QObject>
|
||||
#include "MainWindow.h"
|
||||
#include "PCANInterface.h"
|
||||
#include "GeneralMessagesLogDispatcher.h"
|
||||
|
||||
class COtarcikCan : public QObject
|
||||
{
|
||||
@ -10,6 +12,7 @@ class COtarcikCan : public QObject
|
||||
public:
|
||||
explicit COtarcikCan(QObject *parent = 0);
|
||||
~COtarcikCan();
|
||||
CMainWindow w;
|
||||
|
||||
int Start();
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
#include "PCANInterface.h"
|
||||
#include "GeneralMessagesLogDispatcher.h"
|
||||
|
||||
CPCANInterface::CPCANInterface(QObject *parent) : QObject(parent)
|
||||
{
|
||||
@ -16,6 +17,8 @@ int CPCANInterface::Init()
|
||||
char strMsg[256];
|
||||
CAN_GetErrorText(Result, 0, strMsg);
|
||||
qDebug("%s",strMsg);
|
||||
CGeneralMessagesLogDispatcher::instance()->AddLogMessage(strMsg);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,4 +1,25 @@
|
||||
#ifndef DEFINES_H
|
||||
#define DEFINES_H
|
||||
|
||||
|
||||
|
||||
#define GENERAL_MESSAGES_MAX_LOG_LINES 5000 //The number of lines of general status log we keep in the general status window (avoids fucking up because you know.... RAM)
|
||||
|
||||
enum eOtarcikGeneralReturns
|
||||
{
|
||||
RET_OK = 0,
|
||||
RET_GENERAL_ERROR,
|
||||
|
||||
|
||||
|
||||
RET_MAX_ERROR
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // DEFINES_H
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
#include "MainWindow.h"
|
||||
#include <QApplication>
|
||||
#include "OtarcikCan.h"
|
||||
|
||||
@ -6,11 +5,10 @@
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
CMainWindow w;
|
||||
COtarcikCan OtarcikCanProgram; //Instanciate the program
|
||||
|
||||
|
||||
w.show();
|
||||
|
||||
OtarcikCanProgram.Start();
|
||||
|
||||
|
||||
|
||||
51
Otarcik_CAN/ui_GeneralStatusPage.h
Normal file
51
Otarcik_CAN/ui_GeneralStatusPage.h
Normal file
@ -0,0 +1,51 @@
|
||||
/********************************************************************************
|
||||
** Form generated from reading UI file 'GeneralStatusPage.ui'
|
||||
**
|
||||
** Created by: Qt User Interface Compiler version 5.14.2
|
||||
**
|
||||
** WARNING! All changes made in this file will be lost when recompiling UI file!
|
||||
********************************************************************************/
|
||||
|
||||
#ifndef UI_GENERALSTATUSPAGE_H
|
||||
#define UI_GENERALSTATUSPAGE_H
|
||||
|
||||
#include <QtCore/QVariant>
|
||||
#include <QtWidgets/QApplication>
|
||||
#include <QtWidgets/QTextEdit>
|
||||
#include <QtWidgets/QWidget>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class Ui_CGeneralStatusPage
|
||||
{
|
||||
public:
|
||||
QTextEdit *mGenMsgTextEdit;
|
||||
|
||||
void setupUi(QWidget *CGeneralStatusPage)
|
||||
{
|
||||
if (CGeneralStatusPage->objectName().isEmpty())
|
||||
CGeneralStatusPage->setObjectName(QString::fromUtf8("CGeneralStatusPage"));
|
||||
CGeneralStatusPage->resize(1147, 492);
|
||||
mGenMsgTextEdit = new QTextEdit(CGeneralStatusPage);
|
||||
mGenMsgTextEdit->setObjectName(QString::fromUtf8("mGenMsgTextEdit"));
|
||||
mGenMsgTextEdit->setGeometry(QRect(660, 30, 441, 451));
|
||||
|
||||
retranslateUi(CGeneralStatusPage);
|
||||
|
||||
QMetaObject::connectSlotsByName(CGeneralStatusPage);
|
||||
} // setupUi
|
||||
|
||||
void retranslateUi(QWidget *CGeneralStatusPage)
|
||||
{
|
||||
CGeneralStatusPage->setWindowTitle(QCoreApplication::translate("CGeneralStatusPage", "Form", nullptr));
|
||||
} // retranslateUi
|
||||
|
||||
};
|
||||
|
||||
namespace Ui {
|
||||
class CGeneralStatusPage: public Ui_CGeneralStatusPage {};
|
||||
} // namespace Ui
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // UI_GENERALSTATUSPAGE_H
|
||||
@ -12,9 +12,7 @@
|
||||
#include <QtCore/QVariant>
|
||||
#include <QtWidgets/QApplication>
|
||||
#include <QtWidgets/QMainWindow>
|
||||
#include <QtWidgets/QMenuBar>
|
||||
#include <QtWidgets/QStatusBar>
|
||||
#include <QtWidgets/QToolBar>
|
||||
#include <QtWidgets/QWidget>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -22,8 +20,6 @@ QT_BEGIN_NAMESPACE
|
||||
class Ui_CMainWindow
|
||||
{
|
||||
public:
|
||||
QMenuBar *menuBar;
|
||||
QToolBar *mainToolBar;
|
||||
QWidget *centralWidget;
|
||||
QStatusBar *statusBar;
|
||||
|
||||
@ -31,13 +27,75 @@ public:
|
||||
{
|
||||
if (CMainWindow->objectName().isEmpty())
|
||||
CMainWindow->setObjectName(QString::fromUtf8("CMainWindow"));
|
||||
CMainWindow->resize(400, 300);
|
||||
menuBar = new QMenuBar(CMainWindow);
|
||||
menuBar->setObjectName(QString::fromUtf8("menuBar"));
|
||||
CMainWindow->setMenuBar(menuBar);
|
||||
mainToolBar = new QToolBar(CMainWindow);
|
||||
mainToolBar->setObjectName(QString::fromUtf8("mainToolBar"));
|
||||
CMainWindow->addToolBar(mainToolBar);
|
||||
CMainWindow->setEnabled(true);
|
||||
CMainWindow->resize(1186, 511);
|
||||
QPalette palette;
|
||||
QBrush brush(QColor(0, 0, 0, 255));
|
||||
brush.setStyle(Qt::SolidPattern);
|
||||
palette.setBrush(QPalette::Active, QPalette::WindowText, brush);
|
||||
QBrush brush1(QColor(203, 203, 203, 255));
|
||||
brush1.setStyle(Qt::SolidPattern);
|
||||
palette.setBrush(QPalette::Active, QPalette::Button, brush1);
|
||||
QBrush brush2(QColor(255, 255, 255, 255));
|
||||
brush2.setStyle(Qt::SolidPattern);
|
||||
palette.setBrush(QPalette::Active, QPalette::Light, brush2);
|
||||
QBrush brush3(QColor(229, 229, 229, 255));
|
||||
brush3.setStyle(Qt::SolidPattern);
|
||||
palette.setBrush(QPalette::Active, QPalette::Midlight, brush3);
|
||||
QBrush brush4(QColor(101, 101, 101, 255));
|
||||
brush4.setStyle(Qt::SolidPattern);
|
||||
palette.setBrush(QPalette::Active, QPalette::Dark, brush4);
|
||||
QBrush brush5(QColor(135, 135, 135, 255));
|
||||
brush5.setStyle(Qt::SolidPattern);
|
||||
palette.setBrush(QPalette::Active, QPalette::Mid, brush5);
|
||||
palette.setBrush(QPalette::Active, QPalette::Text, brush);
|
||||
palette.setBrush(QPalette::Active, QPalette::BrightText, brush2);
|
||||
palette.setBrush(QPalette::Active, QPalette::ButtonText, brush);
|
||||
QBrush brush6(QColor(206, 206, 206, 255));
|
||||
brush6.setStyle(Qt::SolidPattern);
|
||||
palette.setBrush(QPalette::Active, QPalette::Base, brush6);
|
||||
QBrush brush7(QColor(240, 240, 240, 255));
|
||||
brush7.setStyle(Qt::SolidPattern);
|
||||
palette.setBrush(QPalette::Active, QPalette::Window, brush7);
|
||||
palette.setBrush(QPalette::Active, QPalette::Shadow, brush);
|
||||
palette.setBrush(QPalette::Active, QPalette::AlternateBase, brush3);
|
||||
QBrush brush8(QColor(255, 255, 220, 255));
|
||||
brush8.setStyle(Qt::SolidPattern);
|
||||
palette.setBrush(QPalette::Active, QPalette::ToolTipBase, brush8);
|
||||
palette.setBrush(QPalette::Active, QPalette::ToolTipText, brush);
|
||||
palette.setBrush(QPalette::Inactive, QPalette::WindowText, brush);
|
||||
palette.setBrush(QPalette::Inactive, QPalette::Button, brush1);
|
||||
palette.setBrush(QPalette::Inactive, QPalette::Light, brush2);
|
||||
palette.setBrush(QPalette::Inactive, QPalette::Midlight, brush3);
|
||||
palette.setBrush(QPalette::Inactive, QPalette::Dark, brush4);
|
||||
palette.setBrush(QPalette::Inactive, QPalette::Mid, brush5);
|
||||
palette.setBrush(QPalette::Inactive, QPalette::Text, brush);
|
||||
palette.setBrush(QPalette::Inactive, QPalette::BrightText, brush2);
|
||||
palette.setBrush(QPalette::Inactive, QPalette::ButtonText, brush);
|
||||
palette.setBrush(QPalette::Inactive, QPalette::Base, brush6);
|
||||
palette.setBrush(QPalette::Inactive, QPalette::Window, brush7);
|
||||
palette.setBrush(QPalette::Inactive, QPalette::Shadow, brush);
|
||||
palette.setBrush(QPalette::Inactive, QPalette::AlternateBase, brush3);
|
||||
palette.setBrush(QPalette::Inactive, QPalette::ToolTipBase, brush8);
|
||||
palette.setBrush(QPalette::Inactive, QPalette::ToolTipText, brush);
|
||||
palette.setBrush(QPalette::Disabled, QPalette::WindowText, brush4);
|
||||
palette.setBrush(QPalette::Disabled, QPalette::Button, brush1);
|
||||
palette.setBrush(QPalette::Disabled, QPalette::Light, brush2);
|
||||
palette.setBrush(QPalette::Disabled, QPalette::Midlight, brush3);
|
||||
palette.setBrush(QPalette::Disabled, QPalette::Dark, brush4);
|
||||
palette.setBrush(QPalette::Disabled, QPalette::Mid, brush5);
|
||||
palette.setBrush(QPalette::Disabled, QPalette::Text, brush4);
|
||||
palette.setBrush(QPalette::Disabled, QPalette::BrightText, brush2);
|
||||
palette.setBrush(QPalette::Disabled, QPalette::ButtonText, brush4);
|
||||
palette.setBrush(QPalette::Disabled, QPalette::Base, brush7);
|
||||
palette.setBrush(QPalette::Disabled, QPalette::Window, brush7);
|
||||
palette.setBrush(QPalette::Disabled, QPalette::Shadow, brush);
|
||||
palette.setBrush(QPalette::Disabled, QPalette::AlternateBase, brush1);
|
||||
palette.setBrush(QPalette::Disabled, QPalette::ToolTipBase, brush8);
|
||||
palette.setBrush(QPalette::Disabled, QPalette::ToolTipText, brush);
|
||||
CMainWindow->setPalette(palette);
|
||||
CMainWindow->setWindowOpacity(3.000000000000000);
|
||||
CMainWindow->setAutoFillBackground(true);
|
||||
centralWidget = new QWidget(CMainWindow);
|
||||
centralWidget->setObjectName(QString::fromUtf8("centralWidget"));
|
||||
CMainWindow->setCentralWidget(centralWidget);
|
||||
@ -52,7 +110,7 @@ public:
|
||||
|
||||
void retranslateUi(QMainWindow *CMainWindow)
|
||||
{
|
||||
CMainWindow->setWindowTitle(QCoreApplication::translate("CMainWindow", "CMainWindow", nullptr));
|
||||
CMainWindow->setWindowTitle(QCoreApplication::translate("CMainWindow", "Otracik", nullptr));
|
||||
} // retranslateUi
|
||||
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user