diff --git a/linux/Makefile.am b/linux/Makefile.am index 3231a007..403ab9d0 100755 --- a/linux/Makefile.am +++ b/linux/Makefile.am @@ -18,6 +18,7 @@ llcon_SOURCES = ../src/buffer.cpp \ ../src/multicolorled.cpp \ ../src/multicolorledbar.cpp \ ../src/audiomixerboard.cpp \ + ../src/serverlogging.cpp \ ../src/soundbase.cpp \ sound.cpp \ ../src/buffer.h \ @@ -35,6 +36,7 @@ llcon_SOURCES = ../src/buffer.cpp \ ../src/multicolorled.h \ ../src/multicolorledbar.h \ ../src/audiomixerboard.h \ + ../src/serverlogging.h \ ../src/testbench.h \ ../src/soundbase.h \ ../src/llconserverdlg.h \ diff --git a/src/main.cpp b/src/main.cpp index 3d989ec0..04f30b88 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -32,6 +32,12 @@ #include "testbench.h" +// TEST +#include "serverlogging.h" + + + + // Implementation ************************************************************** // these pointers are only used for the post-event routine QApplication* pApp = NULL; @@ -158,6 +164,11 @@ int main ( int argc, char** argv ) //CTestbench Testbench ( "127.0.0.1", LLCON_DEFAULT_PORT_NUMBER ); +// TEST +//CServerLogging ServerLogging; +//exit(1); + + try { if ( bIsClient ) diff --git a/src/serverlogging.cpp b/src/serverlogging.cpp new file mode 100755 index 00000000..52229d2a --- /dev/null +++ b/src/serverlogging.cpp @@ -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 ); + +} diff --git a/src/serverlogging.h b/src/serverlogging.h new file mode 100755 index 00000000..1b4924f3 --- /dev/null +++ b/src/serverlogging.h @@ -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 +#include +#include "global.h" + + +/* Classes ********************************************************************/ +class CServerLogging +{ +public: + CServerLogging(); +}; + +#endif /* !defined ( SERVERLOGGING_HOIHOKIH83JH8_3_43445KJIUHF1912__INCLUDED_ ) */ diff --git a/windows/llcon.vcproj b/windows/llcon.vcproj index 22788327..3bd86b1f 100755 --- a/windows/llcon.vcproj +++ b/windows/llcon.vcproj @@ -509,6 +509,10 @@ /> + + @@ -1006,6 +1010,10 @@ RelativePath="..\src\server.h" > + +