added server logging files
This commit is contained in:
parent
e11c2cc09a
commit
d17e9422f3
5 changed files with 167 additions and 0 deletions
|
@ -18,6 +18,7 @@ llcon_SOURCES = ../src/buffer.cpp \
|
||||||
../src/multicolorled.cpp \
|
../src/multicolorled.cpp \
|
||||||
../src/multicolorledbar.cpp \
|
../src/multicolorledbar.cpp \
|
||||||
../src/audiomixerboard.cpp \
|
../src/audiomixerboard.cpp \
|
||||||
|
../src/serverlogging.cpp \
|
||||||
../src/soundbase.cpp \
|
../src/soundbase.cpp \
|
||||||
sound.cpp \
|
sound.cpp \
|
||||||
../src/buffer.h \
|
../src/buffer.h \
|
||||||
|
@ -35,6 +36,7 @@ llcon_SOURCES = ../src/buffer.cpp \
|
||||||
../src/multicolorled.h \
|
../src/multicolorled.h \
|
||||||
../src/multicolorledbar.h \
|
../src/multicolorledbar.h \
|
||||||
../src/audiomixerboard.h \
|
../src/audiomixerboard.h \
|
||||||
|
../src/serverlogging.h \
|
||||||
../src/testbench.h \
|
../src/testbench.h \
|
||||||
../src/soundbase.h \
|
../src/soundbase.h \
|
||||||
../src/llconserverdlg.h \
|
../src/llconserverdlg.h \
|
||||||
|
|
11
src/main.cpp
11
src/main.cpp
|
@ -32,6 +32,12 @@
|
||||||
#include "testbench.h"
|
#include "testbench.h"
|
||||||
|
|
||||||
|
|
||||||
|
// TEST
|
||||||
|
#include "serverlogging.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Implementation **************************************************************
|
// Implementation **************************************************************
|
||||||
// these pointers are only used for the post-event routine
|
// these pointers are only used for the post-event routine
|
||||||
QApplication* pApp = NULL;
|
QApplication* pApp = NULL;
|
||||||
|
@ -158,6 +164,11 @@ int main ( int argc, char** argv )
|
||||||
//CTestbench Testbench ( "127.0.0.1", LLCON_DEFAULT_PORT_NUMBER );
|
//CTestbench Testbench ( "127.0.0.1", LLCON_DEFAULT_PORT_NUMBER );
|
||||||
|
|
||||||
|
|
||||||
|
// TEST
|
||||||
|
//CServerLogging ServerLogging;
|
||||||
|
//exit(1);
|
||||||
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if ( bIsClient )
|
if ( bIsClient )
|
||||||
|
|
106
src/serverlogging.cpp
Executable file
106
src/serverlogging.cpp
Executable file
|
@ -0,0 +1,106 @@
|
||||||
|
/******************************************************************************\
|
||||||
|
* Copyright (c) 2004-2009
|
||||||
|
*
|
||||||
|
* Author(s):
|
||||||
|
* Volker Fischer
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
|
* the terms of the GNU General Public License as published by the Free Software
|
||||||
|
* Foundation; either version 2 of the License, or (at your option) any later
|
||||||
|
* version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
|
* details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with
|
||||||
|
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
\******************************************************************************/
|
||||||
|
|
||||||
|
#include "serverlogging.h"
|
||||||
|
|
||||||
|
|
||||||
|
/* Implementation *************************************************************/
|
||||||
|
CServerLogging::CServerLogging()
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
// constants defining the plot properties
|
||||||
|
const int iYAxisStart = 0;
|
||||||
|
const int iYAxisEnd = 24;
|
||||||
|
const int iNumTicksX = 10;
|
||||||
|
const int iNumTicksY = 5;
|
||||||
|
const int iPlotWidth = 500;
|
||||||
|
const int iPlotHeight = 500;
|
||||||
|
const int iGridFrameOffset = 10;
|
||||||
|
const QColor PlotBackgroundColor ( Qt::white ); // white background
|
||||||
|
const QColor PlotFrameColor ( Qt::black ); // black frame
|
||||||
|
const QColor PlotGridColor ( Qt::gray ); // gray grid
|
||||||
|
const QColor PlotTextColor ( Qt::black ); // black text
|
||||||
|
|
||||||
|
|
||||||
|
// create base pixmap for plot
|
||||||
|
QRect PlotCanvasRect ( QPoint ( 0, 0 ), QPoint ( iPlotWidth, iPlotHeight ) );
|
||||||
|
QPixmap PlotPixmap ( PlotCanvasRect.size() );
|
||||||
|
PlotPixmap.fill ( PlotBackgroundColor ); // fill background
|
||||||
|
|
||||||
|
// create painter for plot
|
||||||
|
QPainter PlotPainter ( &PlotPixmap );
|
||||||
|
|
||||||
|
|
||||||
|
// create actual plot region (grid frame) ----------------------------------
|
||||||
|
QRect PlotGridFrame (
|
||||||
|
PlotCanvasRect.x() + iGridFrameOffset,
|
||||||
|
PlotCanvasRect.y() + iGridFrameOffset,
|
||||||
|
PlotCanvasRect.width() - 2 * iGridFrameOffset,
|
||||||
|
PlotCanvasRect.height() - 2 * iGridFrameOffset );
|
||||||
|
|
||||||
|
PlotPainter.setPen ( PlotFrameColor );
|
||||||
|
PlotPainter.drawRect ( PlotGridFrame );
|
||||||
|
|
||||||
|
// grid (ticks) for x-axis
|
||||||
|
const int iXSpace = PlotGridFrame.width() / ( iNumTicksX - 1 );
|
||||||
|
for ( i = 0; i < ( iNumTicksX - 2 ); i++ )
|
||||||
|
{
|
||||||
|
const int iCurX = PlotGridFrame.x() + iXSpace * ( i + 1 );
|
||||||
|
|
||||||
|
// text
|
||||||
|
PlotPainter.setPen ( PlotTextColor );
|
||||||
|
// TODO
|
||||||
|
|
||||||
|
// grid
|
||||||
|
PlotPainter.setPen ( PlotGridColor );
|
||||||
|
PlotPainter.drawLine ( iCurX, PlotGridFrame.y(),
|
||||||
|
iCurX, PlotGridFrame.bottom() );
|
||||||
|
}
|
||||||
|
|
||||||
|
// grid (ticks) for y-axis
|
||||||
|
const int iYSpace = PlotGridFrame.height() / ( iNumTicksY - 1 );
|
||||||
|
for ( i = 0; i < ( iNumTicksY - 2 ); i++ )
|
||||||
|
{
|
||||||
|
const int iCurY = PlotGridFrame.y() + iYSpace * ( i + 1 );
|
||||||
|
|
||||||
|
// text
|
||||||
|
PlotPainter.setPen ( PlotTextColor );
|
||||||
|
PlotPainter.setFont ( QFont ( "Arial", 10 ) );
|
||||||
|
PlotPainter.drawText ( QPoint ( PlotGridFrame.x(), iCurY ),
|
||||||
|
QString().setNum ( ( iYAxisEnd - iYAxisStart ) / iNumTicksY * i ) );
|
||||||
|
|
||||||
|
|
||||||
|
// grid
|
||||||
|
PlotPainter.setPen ( PlotGridColor );
|
||||||
|
PlotPainter.drawLine ( PlotGridFrame.x(), iCurY,
|
||||||
|
PlotGridFrame.right(), iCurY );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// save plot as a file
|
||||||
|
PlotPixmap.save ( "test.jpg", "JPG", 90 );
|
||||||
|
|
||||||
|
}
|
40
src/serverlogging.h
Executable file
40
src/serverlogging.h
Executable file
|
@ -0,0 +1,40 @@
|
||||||
|
/******************************************************************************\
|
||||||
|
* Copyright (c) 2004-2009
|
||||||
|
*
|
||||||
|
* Author(s):
|
||||||
|
* Volker Fischer
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
|
* the terms of the GNU General Public License as published by the Free Software
|
||||||
|
* Foundation; either version 2 of the License, or (at your option) any later
|
||||||
|
* version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
|
* details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with
|
||||||
|
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
\******************************************************************************/
|
||||||
|
|
||||||
|
#if !defined ( SERVERLOGGING_HOIHOKIH83JH8_3_43445KJIUHF1912__INCLUDED_ )
|
||||||
|
#define SERVERLOGGING_HOIHOKIH83JH8_3_43445KJIUHF1912__INCLUDED_
|
||||||
|
|
||||||
|
#include <qpixmap.h>
|
||||||
|
#include <qpainter.h>
|
||||||
|
#include "global.h"
|
||||||
|
|
||||||
|
|
||||||
|
/* Classes ********************************************************************/
|
||||||
|
class CServerLogging
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CServerLogging();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* !defined ( SERVERLOGGING_HOIHOKIH83JH8_3_43445KJIUHF1912__INCLUDED_ ) */
|
|
@ -509,6 +509,10 @@
|
||||||
/>
|
/>
|
||||||
</FileConfiguration>
|
</FileConfiguration>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\src\serverlogging.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\src\settings.cpp"
|
RelativePath="..\src\settings.cpp"
|
||||||
>
|
>
|
||||||
|
@ -1006,6 +1010,10 @@
|
||||||
RelativePath="..\src\server.h"
|
RelativePath="..\src\server.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\src\serverlogging.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\src\settings.h"
|
RelativePath="..\src\settings.h"
|
||||||
>
|
>
|
||||||
|
|
Loading…
Reference in a new issue