Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Daniel Masato 2020-03-23 19:45:03 +00:00
commit adbb850a2f
9 changed files with 57 additions and 21 deletions

1
.gitignore vendored
View File

@ -16,6 +16,7 @@ ui_*.h
moc_predefs.h moc_predefs.h
src/res/qrc_resources.cpp src/res/qrc_resources.cpp
windows/ASIOSDK2 windows/ASIOSDK2
windows/VC_redist.x64.exe
debug/ debug/
jamulus.sln jamulus.sln
jamulus.vcxproj jamulus.vcxproj

View File

@ -92,6 +92,9 @@ LED bar: lbr
// file name for logging file // file name for logging file
#define DEFAULT_LOG_FILE_NAME "Jamulussrvlog.txt" #define DEFAULT_LOG_FILE_NAME "Jamulussrvlog.txt"
// default oldest item to draw in history graph (days ago)
#define DEFAULT_DAYS_HISTORY 60
// default server address // default server address
#define DEFAULT_SERVER_ADDRESS "jamulus.fischvolk.de" #define DEFAULT_SERVER_ADDRESS "jamulus.fischvolk.de"
#define DEFAULT_SERVER_NAME "Central Server" #define DEFAULT_SERVER_NAME "Central Server"

View File

@ -27,11 +27,12 @@
/* Abstract class *************************************************************/ /* Abstract class *************************************************************/
AHistoryGraph::AHistoryGraph() : AHistoryGraph::AHistoryGraph ( const int iMaxDaysHistory ) :
sFileName ( "" ), sFileName ( "" ),
bDoHistory ( false ), bDoHistory ( false ),
vHistoryDataFifo ( NUM_ITEMS_HISTORY ), vHistoryDataFifo ( NUM_ITEMS_HISTORY ),
iNumTicksX ( 0 ), // number of days in history iNumTicksX ( 0 ), // number of days in history
iHistMaxDays ( iMaxDaysHistory ),
BackgroundColor ( "white" ), // background BackgroundColor ( "white" ), // background
FrameColor ( "black" ), // frame FrameColor ( "black" ), // frame
@ -67,8 +68,8 @@ AHistoryGraph::AHistoryGraph() :
iTextOffsetToGrid ( 3 ), iTextOffsetToGrid ( 3 ),
iTextOffsetX ( 18 ), iTextOffsetX ( 18 ),
iMarkerSizeNewCon ( 11 ), iMarkerSizeNewCon ( 10 ),
iMarkerSizeServSt ( 8 ) iMarkerSizeServSt ( 6 )
{ {
} }
@ -136,7 +137,7 @@ void AHistoryGraph::Update ( )
curDate = QDate::currentDate(); curDate = QDate::currentDate();
// set oldest date to draw // set oldest date to draw
QDate minDate = curDate.addDays ( MAX_DAYS_HISTORY * -1 ); QDate minDate = curDate.addDays ( iHistMaxDays * -1 );
// get oldest date in history // get oldest date in history
QDate oldestDate = curDate.addDays ( 1 ); // one day in the future QDate oldestDate = curDate.addDays ( 1 ); // one day in the future
@ -298,9 +299,9 @@ void AHistoryGraph::AddMarker ( const SHistoryData& curHistoryData )
/* JPEG History Graph implementation ******************************************/ /* JPEG History Graph implementation ******************************************/
CJpegHistoryGraph::CJpegHistoryGraph() : CJpegHistoryGraph::CJpegHistoryGraph ( const int iMaxDaysHistory ) :
AHistoryGraph(), AHistoryGraph ( iMaxDaysHistory ),
PlotPixmap ( 1, 1, QImage::Format_RGB32 ), PlotPixmap ( 1, 1, QImage::Format_RGB32 ),
iAxisFontWeight ( -1 ) iAxisFontWeight ( -1 )
{ {
// scale pixmap to correct size // scale pixmap to correct size
@ -403,9 +404,9 @@ void CJpegHistoryGraph::point ( const unsigned int x, const unsigned int y, cons
/* SVG History Graph implementation *******************************************/ /* SVG History Graph implementation *******************************************/
CSvgHistoryGraph::CSvgHistoryGraph() : CSvgHistoryGraph::CSvgHistoryGraph ( const int iMaxDaysHistory ) :
AHistoryGraph(), AHistoryGraph ( iMaxDaysHistory ),
svgImage ( "" ), svgImage ( "" ),
svgStreamWriter ( &svgImage ) svgStreamWriter ( &svgImage )
{ {
// set SVG veiwBox to correct size to ensure correct scaling // set SVG veiwBox to correct size to ensure correct scaling

View File

@ -44,10 +44,7 @@
/* Definitions ****************************************************************/ /* Definitions ****************************************************************/
// number of history items to store // number of history items to store
#define NUM_ITEMS_HISTORY 4800 #define NUM_ITEMS_HISTORY 20000
// oldest item to draw
#define MAX_DAYS_HISTORY 60
/* Interface ******************************************************************/ /* Interface ******************************************************************/
@ -61,7 +58,7 @@ public:
HIT_SERVER_STOP HIT_SERVER_STOP
}; };
AHistoryGraph(); AHistoryGraph ( const int iMaxDaysHistory );
~AHistoryGraph() { } ~AHistoryGraph() { }
void Start ( const QString& sNewFileName ); void Start ( const QString& sNewFileName );
@ -89,6 +86,7 @@ protected:
bool bDoHistory; bool bDoHistory;
CFIFO<SHistoryData> vHistoryDataFifo; CFIFO<SHistoryData> vHistoryDataFifo;
unsigned int iNumTicksX; // Class global, not sure why unsigned int iNumTicksX; // Class global, not sure why
int iHistMaxDays;
QString BackgroundColor; QString BackgroundColor;
QString FrameColor; QString FrameColor;
@ -141,7 +139,7 @@ class CJpegHistoryGraph : public QObject, virtual public AHistoryGraph
Q_OBJECT Q_OBJECT
public: public:
CJpegHistoryGraph(); CJpegHistoryGraph ( const int iMaxDaysHistory );
virtual void Update ( ); virtual void Update ( );
protected: protected:
@ -165,7 +163,7 @@ class CSvgHistoryGraph : public QObject, virtual public AHistoryGraph
Q_OBJECT Q_OBJECT
public: public:
CSvgHistoryGraph(); CSvgHistoryGraph ( const int iMaxDaysHistory );
virtual void Update(); virtual void Update();
protected: protected:

View File

@ -53,6 +53,7 @@ int main ( int argc, char** argv )
bool bCentServPingServerInList = false; bool bCentServPingServerInList = false;
bool bNoAutoJackConnect = false; bool bNoAutoJackConnect = false;
int iNumServerChannels = DEFAULT_USED_NUM_CHANNELS; int iNumServerChannels = DEFAULT_USED_NUM_CHANNELS;
int iMaxDaysHistory = DEFAULT_DAYS_HISTORY;
int iCtrlMIDIChannel = INVALID_MIDI_CH; int iCtrlMIDIChannel = INVALID_MIDI_CH;
quint16 iPortNumber = LLCON_DEFAULT_PORT_NUMBER; quint16 iPortNumber = LLCON_DEFAULT_PORT_NUMBER;
ELicenceType eLicenceType = LT_NO_LICENCE; ELicenceType eLicenceType = LT_NO_LICENCE;
@ -129,6 +130,25 @@ int main ( int argc, char** argv )
} }
// Maximum days in history display -------------------------------------
if ( GetNumericArgument ( tsConsole,
argc,
argv,
i,
"-D",
"--histdays",
1,
366,
rDbleArgument ) )
{
iMaxDaysHistory = static_cast<int> ( rDbleArgument );
tsConsole << "- maximum days in history display: "
<< iMaxDaysHistory << endl;
continue;
}
// Start minimized ----------------------------------------------------- // Start minimized -----------------------------------------------------
if ( GetFlagArgument ( argv, if ( GetFlagArgument ( argv,
@ -496,6 +516,7 @@ int main ( int argc, char** argv )
// Server: // Server:
// actual server object // actual server object
CServer Server ( iNumServerChannels, CServer Server ( iNumServerChannels,
iMaxDaysHistory,
strLoggingFileName, strLoggingFileName,
iPortNumber, iPortNumber,
strHTMLStatusFileName, strHTMLStatusFileName,
@ -610,6 +631,7 @@ QString UsageArguments ( char **argv )
" -w, --welcomemessage welcome message on connect (server only)\n" " -w, --welcomemessage welcome message on connect (server only)\n"
" -y, --history enable connection history and set file\n" " -y, --history enable connection history and set file\n"
" name (server only)\n" " name (server only)\n"
" -D, --histdays number of days of history to display (server only)\n"
" -z, --startminimized start minimizied (server only)\n" " -z, --startminimized start minimizied (server only)\n"
" --ctrlmidich MIDI controller channel to listen (client only)" " --ctrlmidich MIDI controller channel to listen (client only)"
"\nExample: " + QString ( argv[0] ) + " -l -inifile myinifile.ini\n"; "\nExample: " + QString ( argv[0] ) + " -l -inifile myinifile.ini\n";

View File

@ -198,6 +198,7 @@ void CHighPrecisionTimer::run()
// CServer implementation ****************************************************** // CServer implementation ******************************************************
CServer::CServer ( const int iNewMaxNumChan, CServer::CServer ( const int iNewMaxNumChan,
const int iMaxDaysHistory,
const QString& strLoggingFileName, const QString& strLoggingFileName,
const quint16 iPortNumber, const quint16 iPortNumber,
const QString& strHTMLStatusFileName, const QString& strHTMLStatusFileName,
@ -212,6 +213,7 @@ CServer::CServer ( const int iNewMaxNumChan,
const ELicenceType eNLicenceType ) : const ELicenceType eNLicenceType ) :
iMaxNumChannels ( iNewMaxNumChan ), iMaxNumChannels ( iNewMaxNumChan ),
Socket ( this, iPortNumber ), Socket ( this, iPortNumber ),
Logging ( iMaxDaysHistory ),
JamRecorder ( strRecordingDirName ), JamRecorder ( strRecordingDirName ),
bEnableRecording ( !strRecordingDirName.isEmpty() ), bEnableRecording ( !strRecordingDirName.isEmpty() ),
bWriteStatusHTMLFile ( false ), bWriteStatusHTMLFile ( false ),

View File

@ -119,6 +119,7 @@ class CServer : public QObject
public: public:
CServer ( const int iNewMaxNumChan, CServer ( const int iNewMaxNumChan,
const int iMaxDaysHistory,
const QString& strLoggingFileName, const QString& strLoggingFileName,
const quint16 iPortNumber, const quint16 iPortNumber,
const QString& strHTMLStatusFileName, const QString& strHTMLStatusFileName,

View File

@ -82,8 +82,8 @@ void CServerLogging::AddServerStopped()
*this << strLogStr; // in log file *this << strLogStr; // in log file
// add element to history and update on server stop // add element to history and update on server stop
JpegHistoryGraph.Add ( QDateTime::currentDateTime(), CJpegHistoryGraph::HIT_SERVER_STOP ); JpegHistoryGraph.Add ( QDateTime::currentDateTime(), AHistoryGraph::HIT_SERVER_STOP );
SvgHistoryGraph.Add ( QDateTime::currentDateTime(), CJpegHistoryGraph::HIT_SERVER_STOP ); SvgHistoryGraph.Add ( QDateTime::currentDateTime(), AHistoryGraph::HIT_SERVER_STOP );
JpegHistoryGraph.Update(); JpegHistoryGraph.Update();
SvgHistoryGraph.Update(); SvgHistoryGraph.Update();
@ -140,7 +140,7 @@ void CServerLogging::ParseLogFile ( const QString& strFileName )
if ( strAddress.isEmpty() ) if ( strAddress.isEmpty() )
{ {
// server stop // server stop
JpegHistoryGraph.Add ( curDateTime, CJpegHistoryGraph::HIT_SERVER_STOP ); JpegHistoryGraph.Add ( curDateTime, AHistoryGraph::HIT_SERVER_STOP );
SvgHistoryGraph.Add ( curDateTime, CSvgHistoryGraph::HIT_SERVER_STOP ); SvgHistoryGraph.Add ( curDateTime, CSvgHistoryGraph::HIT_SERVER_STOP );
} }
else else

View File

@ -38,8 +38,12 @@
class CServerLogging class CServerLogging
{ {
public: public:
CServerLogging() : bDoLogging ( false ), CServerLogging ( const int iMaxDaysHistory ) :
JpegHistoryGraph ( iMaxDaysHistory ),
SvgHistoryGraph ( iMaxDaysHistory ),
bDoLogging ( false ),
File ( DEFAULT_LOG_FILE_NAME ) {} File ( DEFAULT_LOG_FILE_NAME ) {}
virtual ~CServerLogging(); virtual ~CServerLogging();
void Start ( const QString& strLoggingFileName ); void Start ( const QString& strLoggingFileName );
@ -56,4 +60,8 @@ protected:
CSvgHistoryGraph SvgHistoryGraph; CSvgHistoryGraph SvgHistoryGraph;
bool bDoLogging; bool bDoLogging;
QFile File; QFile File;
private:
int iHistNumItems;
int iHistMaxDays;
}; };