2006-12-18 15:39:33 +01:00
|
|
|
/******************************************************************************\
|
2009-02-22 12:07:18 +01:00
|
|
|
* Copyright (c) 2004-2009
|
2006-12-18 15:39:33 +01:00
|
|
|
*
|
|
|
|
* 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 "util.h"
|
|
|
|
|
|
|
|
|
|
|
|
/* Implementation *************************************************************/
|
2008-01-26 15:55:38 +01:00
|
|
|
// Input level meter implementation --------------------------------------------
|
2009-02-14 01:46:58 +01:00
|
|
|
void CStereoSignalLevelMeter::Update ( CVector<double>& vecdAudio )
|
2006-12-18 15:39:33 +01:00
|
|
|
{
|
2009-02-14 01:46:58 +01:00
|
|
|
// get the stereo vector size
|
|
|
|
const int iStereoVecSize = vecdAudio.Size();
|
2006-12-18 15:39:33 +01:00
|
|
|
|
2009-02-13 22:28:39 +01:00
|
|
|
// Get maximum of current block
|
|
|
|
//
|
|
|
|
// Speed optimization:
|
|
|
|
// - we only make use of the positive values and ignore the negative ones
|
|
|
|
// -> we do not need to call the fabs() function
|
|
|
|
// - we only evaluate every third sample
|
|
|
|
//
|
|
|
|
// With these speed optimizations we might loose some information in
|
|
|
|
// special cases but for the average music signals the following code
|
|
|
|
// should give good results.
|
|
|
|
//
|
2009-02-14 01:46:58 +01:00
|
|
|
double dMaxL = 0.0;
|
|
|
|
double dMaxR = 0.0;
|
|
|
|
for ( int i = 0; i < iStereoVecSize; i += 6 ) // 2 * 3 = 6 -> stereo
|
2006-12-18 15:39:33 +01:00
|
|
|
{
|
2009-02-14 01:46:58 +01:00
|
|
|
// left channel
|
|
|
|
if ( dMaxL < vecdAudio[i] )
|
2006-11-25 15:46:57 +01:00
|
|
|
{
|
2009-02-14 01:46:58 +01:00
|
|
|
dMaxL = vecdAudio[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
// right channel
|
|
|
|
if ( dMaxR < vecdAudio[i + 1] )
|
|
|
|
{
|
|
|
|
dMaxR = vecdAudio[i + 1];
|
2006-12-18 15:39:33 +01:00
|
|
|
}
|
2009-02-13 22:28:39 +01:00
|
|
|
}
|
2006-12-18 15:39:33 +01:00
|
|
|
|
2009-02-14 01:46:58 +01:00
|
|
|
dCurLevelL = UpdateCurLevel ( dCurLevelL, dMaxL );
|
|
|
|
dCurLevelR = UpdateCurLevel ( dCurLevelR, dMaxR );
|
|
|
|
}
|
|
|
|
|
|
|
|
double CStereoSignalLevelMeter::UpdateCurLevel ( double dCurLevel, const double& dMax )
|
|
|
|
{
|
2009-02-13 22:28:39 +01:00
|
|
|
// decrease max with time
|
|
|
|
if ( dCurLevel >= METER_FLY_BACK )
|
|
|
|
{
|
|
|
|
// TODO calculate factor from sample rate
|
|
|
|
dCurLevel *= 0.99;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
dCurLevel = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// update current level -> only use maximum
|
|
|
|
if ( dMax > dCurLevel )
|
|
|
|
{
|
2009-02-14 01:46:58 +01:00
|
|
|
return dMax;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return dCurLevel;
|
2006-12-18 15:39:33 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-02-14 01:46:58 +01:00
|
|
|
double CStereoSignalLevelMeter::CalcLogResult ( const double& dLinearLevel )
|
2006-12-18 15:39:33 +01:00
|
|
|
{
|
2009-02-14 01:46:58 +01:00
|
|
|
const double dNormMicLevel = dLinearLevel / _MAXSHORT;
|
2006-12-18 15:39:33 +01:00
|
|
|
|
2007-09-08 12:45:14 +02:00
|
|
|
// logarithmic measure
|
2006-11-25 15:46:57 +01:00
|
|
|
if ( dNormMicLevel > 0 )
|
2006-12-18 15:39:33 +01:00
|
|
|
{
|
2006-11-25 15:46:57 +01:00
|
|
|
return 20.0 * log10 ( dNormMicLevel );
|
2006-12-18 15:39:33 +01:00
|
|
|
}
|
2006-11-25 15:46:57 +01:00
|
|
|
else
|
2006-12-18 15:39:33 +01:00
|
|
|
{
|
2007-09-08 12:45:14 +02:00
|
|
|
return -100000.0; // large negative value
|
2006-12-18 15:39:33 +01:00
|
|
|
}
|
|
|
|
}
|
2006-02-18 23:05:46 +01:00
|
|
|
|
|
|
|
|
2008-01-26 15:55:38 +01:00
|
|
|
// CRC -------------------------------------------------------------------------
|
2007-09-08 12:45:14 +02:00
|
|
|
void CCRC::Reset()
|
2006-02-18 23:05:46 +01:00
|
|
|
{
|
2006-11-25 15:46:57 +01:00
|
|
|
/* Init state shift-register with ones. Set all registers to "1" with
|
|
|
|
bit-wise not operation */
|
|
|
|
iStateShiftReg = ~uint32_t ( 0 );
|
2006-02-18 23:05:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void CCRC::AddByte ( const uint8_t byNewInput )
|
|
|
|
{
|
2006-11-25 15:46:57 +01:00
|
|
|
for ( int i = 0; i < 8; i++ )
|
|
|
|
{
|
2007-09-08 12:45:14 +02:00
|
|
|
// shift bits in shift-register for transistion
|
2006-11-25 15:46:57 +01:00
|
|
|
iStateShiftReg <<= 1;
|
|
|
|
|
|
|
|
/* Take bit, which was shifted out of the register-size and place it
|
|
|
|
at the beginning (LSB)
|
|
|
|
(If condition is not satisfied, implicitely a "0" is added) */
|
|
|
|
if ( ( iStateShiftReg & iBitOutMask) > 0 )
|
|
|
|
{
|
|
|
|
iStateShiftReg |= 1;
|
|
|
|
}
|
|
|
|
|
2007-09-08 12:45:14 +02:00
|
|
|
// add new data bit to the LSB
|
2006-11-25 15:46:57 +01:00
|
|
|
if ( ( byNewInput & ( 1 << ( 8 - i - 1 ) ) ) > 0 )
|
|
|
|
{
|
|
|
|
iStateShiftReg ^= 1;
|
|
|
|
}
|
|
|
|
|
2007-09-08 12:45:14 +02:00
|
|
|
// add mask to shift-register if first bit is true
|
2006-11-25 15:46:57 +01:00
|
|
|
if ( iStateShiftReg & 1 )
|
|
|
|
{
|
|
|
|
iStateShiftReg ^= iPoly;
|
|
|
|
}
|
|
|
|
}
|
2006-02-18 23:05:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t CCRC::GetCRC()
|
|
|
|
{
|
2007-09-08 12:45:14 +02:00
|
|
|
// return inverted shift-register (1's complement)
|
2006-11-25 15:46:57 +01:00
|
|
|
iStateShiftReg = ~iStateShiftReg;
|
2006-02-18 23:05:46 +01:00
|
|
|
|
2007-09-08 12:45:14 +02:00
|
|
|
// remove bit which where shifted out of the shift-register frame
|
2006-11-25 15:46:57 +01:00
|
|
|
return iStateShiftReg & ( iBitOutMask - 1 );
|
2006-02-18 23:05:46 +01:00
|
|
|
}
|
2006-01-28 12:29:22 +01:00
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************\
|
|
|
|
* Audio Reverberation *
|
|
|
|
\******************************************************************************/
|
|
|
|
/*
|
2006-11-25 15:46:57 +01:00
|
|
|
The following code is based on "JCRev: John Chowning's reverberator class"
|
|
|
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2004
|
|
|
|
which is in "The Synthesis ToolKit in C++ (STK)"
|
|
|
|
http://ccrma.stanford.edu/software/stk
|
|
|
|
|
|
|
|
Original description:
|
|
|
|
This class is derived from the CLM JCRev function, which is based on the use
|
|
|
|
of networks of simple allpass and comb delay filters. This class implements
|
|
|
|
three series allpass units, followed by four parallel comb filters, and two
|
|
|
|
decorrelation delay lines in parallel at the output.
|
2006-01-28 12:29:22 +01:00
|
|
|
*/
|
2006-12-06 22:10:24 +01:00
|
|
|
CAudioReverb::CAudioReverb ( const double rT60 )
|
2006-01-28 12:29:22 +01:00
|
|
|
{
|
2006-12-06 22:10:24 +01:00
|
|
|
int delay, i;
|
|
|
|
|
2007-09-08 12:45:14 +02:00
|
|
|
// delay lengths for 44100 Hz sample rate
|
2006-12-06 22:10:24 +01:00
|
|
|
int lengths[9] = { 1777, 1847, 1993, 2137, 389, 127, 43, 211, 179 };
|
2008-08-05 22:59:01 +02:00
|
|
|
const double scaler = (double) SYSTEM_SAMPLE_RATE / 44100.0;
|
2006-01-28 12:29:22 +01:00
|
|
|
|
2006-12-06 22:10:24 +01:00
|
|
|
if ( scaler != 1.0 )
|
2006-11-25 15:46:57 +01:00
|
|
|
{
|
2006-12-06 22:10:24 +01:00
|
|
|
for ( i = 0; i < 9; i++ )
|
2006-11-25 15:46:57 +01:00
|
|
|
{
|
2006-12-06 22:10:24 +01:00
|
|
|
delay = (int) floor ( scaler * lengths[i] );
|
2006-01-28 12:29:22 +01:00
|
|
|
|
2006-12-06 22:10:24 +01:00
|
|
|
if ( ( delay & 1 ) == 0 )
|
|
|
|
{
|
2006-11-25 15:46:57 +01:00
|
|
|
delay++;
|
2006-12-06 22:10:24 +01:00
|
|
|
}
|
2006-01-28 12:29:22 +01:00
|
|
|
|
2006-12-06 22:10:24 +01:00
|
|
|
while ( !isPrime ( delay ) )
|
|
|
|
{
|
2006-11-25 15:46:57 +01:00
|
|
|
delay += 2;
|
2006-12-06 22:10:24 +01:00
|
|
|
}
|
2006-01-28 12:29:22 +01:00
|
|
|
|
2006-11-25 15:46:57 +01:00
|
|
|
lengths[i] = delay;
|
|
|
|
}
|
|
|
|
}
|
2006-01-28 12:29:22 +01:00
|
|
|
|
2006-12-06 22:10:24 +01:00
|
|
|
for ( i = 0; i < 3; i++ )
|
|
|
|
{
|
|
|
|
allpassDelays_[i].Init ( lengths[i + 4] );
|
|
|
|
}
|
2006-01-28 12:29:22 +01:00
|
|
|
|
2006-12-06 22:10:24 +01:00
|
|
|
for ( i = 0; i < 4; i++ )
|
|
|
|
{
|
|
|
|
combDelays_[i].Init ( lengths[i] );
|
|
|
|
}
|
2006-01-28 12:29:22 +01:00
|
|
|
|
2006-12-06 22:10:24 +01:00
|
|
|
setT60 ( rT60 );
|
2006-11-25 15:46:57 +01:00
|
|
|
allpassCoefficient_ = (double) 0.7;
|
|
|
|
Clear();
|
2006-01-28 12:29:22 +01:00
|
|
|
}
|
|
|
|
|
2006-12-06 22:10:24 +01:00
|
|
|
bool CAudioReverb::isPrime ( const int number )
|
2006-01-28 12:29:22 +01:00
|
|
|
{
|
|
|
|
/*
|
2006-11-25 15:46:57 +01:00
|
|
|
Returns true if argument value is prime. Taken from "class Effect" in
|
|
|
|
"STK abstract effects parent class".
|
2006-01-28 12:29:22 +01:00
|
|
|
*/
|
2006-12-06 22:10:24 +01:00
|
|
|
if ( number == 2 )
|
|
|
|
{
|
2006-11-25 15:46:57 +01:00
|
|
|
return true;
|
2006-12-06 22:10:24 +01:00
|
|
|
}
|
2006-11-25 15:46:57 +01:00
|
|
|
|
2006-12-06 22:10:24 +01:00
|
|
|
if ( number & 1 )
|
2006-11-25 15:46:57 +01:00
|
|
|
{
|
2006-12-06 22:10:24 +01:00
|
|
|
for ( int i = 3; i < (int) sqrt ( (double) number ) + 1; i += 2 )
|
2006-11-25 15:46:57 +01:00
|
|
|
{
|
2006-12-06 22:10:24 +01:00
|
|
|
if ( ( number % i ) == 0 )
|
|
|
|
{
|
2006-11-25 15:46:57 +01:00
|
|
|
return false;
|
2006-12-06 22:10:24 +01:00
|
|
|
}
|
2006-11-25 15:46:57 +01:00
|
|
|
}
|
|
|
|
|
2006-12-06 22:10:24 +01:00
|
|
|
return true; // prime
|
2006-11-25 15:46:57 +01:00
|
|
|
}
|
|
|
|
else
|
2006-12-06 22:10:24 +01:00
|
|
|
{
|
|
|
|
return false; // even
|
|
|
|
}
|
2006-01-28 12:29:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void CAudioReverb::Clear()
|
|
|
|
{
|
2006-12-06 22:10:24 +01:00
|
|
|
// reset and clear all internal state
|
|
|
|
allpassDelays_[0].Reset ( 0 );
|
|
|
|
allpassDelays_[1].Reset ( 0 );
|
|
|
|
allpassDelays_[2].Reset ( 0 );
|
|
|
|
combDelays_[0].Reset ( 0 );
|
|
|
|
combDelays_[1].Reset ( 0 );
|
|
|
|
combDelays_[2].Reset ( 0 );
|
|
|
|
combDelays_[3].Reset ( 0 );
|
2006-01-28 12:29:22 +01:00
|
|
|
}
|
|
|
|
|
2006-12-06 22:10:24 +01:00
|
|
|
void CAudioReverb::setT60 ( const double rT60 )
|
2006-01-28 12:29:22 +01:00
|
|
|
{
|
2006-12-06 22:10:24 +01:00
|
|
|
// set the reverberation T60 decay time
|
|
|
|
for ( int i = 0; i < 4; i++ )
|
2006-11-25 15:46:57 +01:00
|
|
|
{
|
2006-12-06 22:10:24 +01:00
|
|
|
combCoefficient_[i] = pow ( (double) 10.0, (double) ( -3.0 *
|
2008-08-05 22:59:01 +02:00
|
|
|
combDelays_[i].Size() / ( rT60 * SYSTEM_SAMPLE_RATE ) ) );
|
2006-11-25 15:46:57 +01:00
|
|
|
}
|
2006-01-28 12:29:22 +01:00
|
|
|
}
|
|
|
|
|
2006-12-06 22:10:24 +01:00
|
|
|
double CAudioReverb::ProcessSample ( const double input )
|
2006-01-28 12:29:22 +01:00
|
|
|
{
|
2006-12-06 22:10:24 +01:00
|
|
|
// compute one output sample
|
2006-11-25 15:46:57 +01:00
|
|
|
double temp, temp0, temp1, temp2;
|
|
|
|
|
|
|
|
temp = allpassDelays_[0].Get();
|
|
|
|
temp0 = allpassCoefficient_ * temp;
|
|
|
|
temp0 += input;
|
2006-12-06 22:10:24 +01:00
|
|
|
allpassDelays_[0].Add ( (int) temp0 );
|
|
|
|
temp0 = - ( allpassCoefficient_ * temp0 ) + temp;
|
2006-11-25 15:46:57 +01:00
|
|
|
|
|
|
|
temp = allpassDelays_[1].Get();
|
|
|
|
temp1 = allpassCoefficient_ * temp;
|
|
|
|
temp1 += temp0;
|
2006-12-06 22:10:24 +01:00
|
|
|
allpassDelays_[1].Add ( (int) temp1 );
|
|
|
|
temp1 = - ( allpassCoefficient_ * temp1 ) + temp;
|
2006-11-25 15:46:57 +01:00
|
|
|
|
|
|
|
temp = allpassDelays_[2].Get();
|
|
|
|
temp2 = allpassCoefficient_ * temp;
|
|
|
|
temp2 += temp1;
|
2006-12-06 22:10:24 +01:00
|
|
|
allpassDelays_[2].Add ( (int) temp2 );
|
|
|
|
temp2 = - ( allpassCoefficient_ * temp2 ) + temp;
|
2006-11-25 15:46:57 +01:00
|
|
|
|
2006-12-06 22:10:24 +01:00
|
|
|
const double temp3 = temp2 + ( combCoefficient_[0] * combDelays_[0].Get() );
|
|
|
|
const double temp4 = temp2 + ( combCoefficient_[1] * combDelays_[1].Get() );
|
|
|
|
const double temp5 = temp2 + ( combCoefficient_[2] * combDelays_[2].Get() );
|
|
|
|
const double temp6 = temp2 + ( combCoefficient_[3] * combDelays_[3].Get() );
|
2006-11-25 15:46:57 +01:00
|
|
|
|
2006-12-06 22:10:24 +01:00
|
|
|
combDelays_[0].Add ( (int) temp3 );
|
|
|
|
combDelays_[1].Add ( (int) temp4 );
|
|
|
|
combDelays_[2].Add ( (int) temp5 );
|
|
|
|
combDelays_[3].Add ( (int) temp6 );
|
2006-11-25 15:46:57 +01:00
|
|
|
|
2006-12-06 22:10:24 +01:00
|
|
|
return ( temp3 + temp4 + temp5 + temp6 ) * (double) 0.5;
|
2006-01-28 12:29:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************\
|
|
|
|
* GUI utilities *
|
|
|
|
\******************************************************************************/
|
2008-01-26 15:55:38 +01:00
|
|
|
// About dialog ----------------------------------------------------------------
|
2008-01-14 23:14:17 +01:00
|
|
|
CAboutDlg::CAboutDlg ( QWidget* parent ) : QDialog ( parent )
|
2006-01-28 12:29:22 +01:00
|
|
|
{
|
2008-01-14 23:14:17 +01:00
|
|
|
setupUi ( this );
|
|
|
|
|
2007-09-08 12:45:14 +02:00
|
|
|
// set the text for the about dialog html text control
|
|
|
|
TextViewCredits->setText (
|
|
|
|
"<p>" // general description of llcon software
|
2006-11-25 15:46:57 +01:00
|
|
|
"<big><b>llcon</b> " + tr("Client/Server communication tool to enable "
|
|
|
|
"musician to play together through a conventional broadband internet "
|
|
|
|
"connection (like DSL).") + "</big>"
|
|
|
|
"</p><br>"
|
2007-09-08 12:45:14 +02:00
|
|
|
"<p><font face=\"courier\">" // GPL header text
|
2006-11-25 15:46:57 +01:00
|
|
|
"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.<br>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.<br>You should have received a copy of the GNU General Public "
|
|
|
|
"License along with his program; if not, write to the Free Software "
|
|
|
|
"Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 "
|
|
|
|
"USA"
|
|
|
|
"</font></p><br>"
|
2009-05-01 12:06:07 +02:00
|
|
|
"<p><b>" + // libraries used by this compilation of llcon
|
|
|
|
tr("llcon uses the following libraries, resources or code snippets:") +
|
2006-11-25 15:46:57 +01:00
|
|
|
"</b></p>"
|
|
|
|
"<ul>"
|
2008-07-20 10:55:49 +02:00
|
|
|
"<li>Qt cross-platform application framework: <i>http://trolltech.com</li>"
|
|
|
|
"<li>Audio reverberation code: by Perry R. Cook and Gary P. Scavone, "
|
2009-05-01 12:06:07 +02:00
|
|
|
"1995 - 2004 (taken from <i>The Synthesis ToolKit in C++ (STK)</i>)</li>"
|
2008-08-09 16:35:44 +02:00
|
|
|
"<li>ADPCM coders by Erik de Castro Lopo</li>"
|
2006-11-25 15:46:57 +01:00
|
|
|
"<li>Parts from Dream DRM Receiver by Volker Fischer and Alexander "
|
2009-05-01 12:06:07 +02:00
|
|
|
"Kurpiers: <i>http://drm.sf.net</i></li>"
|
|
|
|
"<li>Some pixmaps are from <i>Clker.com - vector clip art online, "
|
|
|
|
"royalty free & public domain</i></li>"
|
2006-11-25 15:46:57 +01:00
|
|
|
"</ul>"
|
|
|
|
"</center><br>");
|
|
|
|
|
2007-09-08 12:45:14 +02:00
|
|
|
// set version number in about dialog
|
|
|
|
TextLabelVersion->setText ( GetVersionAndNameStr() );
|
2006-02-18 13:19:27 +01:00
|
|
|
}
|
|
|
|
|
2006-02-18 14:36:55 +01:00
|
|
|
QString CAboutDlg::GetVersionAndNameStr ( const bool bWithHtml )
|
2006-02-18 13:19:27 +01:00
|
|
|
{
|
2006-11-25 15:46:57 +01:00
|
|
|
QString strVersionText = "";
|
|
|
|
|
|
|
|
// name, short description and GPL hint
|
|
|
|
if ( bWithHtml )
|
|
|
|
{
|
|
|
|
strVersionText += "<center><b>";
|
|
|
|
}
|
|
|
|
|
2007-09-08 12:45:14 +02:00
|
|
|
strVersionText += tr ( "llcon, Version " ) + VERSION;
|
2006-11-25 15:46:57 +01:00
|
|
|
|
|
|
|
if ( bWithHtml )
|
|
|
|
{
|
|
|
|
strVersionText += "</b><br>";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
strVersionText += "\n";
|
|
|
|
}
|
|
|
|
|
2007-09-08 12:45:14 +02:00
|
|
|
strVersionText += tr ( "llcon, Low-Latency (internet) CONnection" );
|
2006-11-25 15:46:57 +01:00
|
|
|
|
|
|
|
if ( bWithHtml )
|
|
|
|
{
|
|
|
|
strVersionText += "<br>";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
strVersionText += "\n";
|
|
|
|
}
|
|
|
|
|
2007-09-08 12:45:14 +02:00
|
|
|
strVersionText += tr ( "Under the GNU General Public License (GPL)" );
|
2006-11-25 15:46:57 +01:00
|
|
|
|
|
|
|
if ( bWithHtml )
|
|
|
|
{
|
|
|
|
strVersionText += "</center>";
|
|
|
|
}
|
|
|
|
|
|
|
|
return strVersionText;
|
2006-01-28 12:29:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-01-26 15:55:38 +01:00
|
|
|
// Help menu -------------------------------------------------------------------
|
2008-01-15 21:07:55 +01:00
|
|
|
CLlconHelpMenu::CLlconHelpMenu ( QWidget* parent ) : QMenu ( "&?", parent )
|
2006-01-28 12:29:22 +01:00
|
|
|
{
|
2007-09-08 12:45:14 +02:00
|
|
|
// standard help menu consists of about and what's this help
|
2008-01-15 21:07:55 +01:00
|
|
|
addAction ( tr ( "What's &This" ), this,
|
|
|
|
SLOT ( OnHelpWhatsThis() ), QKeySequence ( Qt::SHIFT + Qt::Key_F1 ) );
|
|
|
|
|
|
|
|
addSeparator();
|
|
|
|
addAction ( tr ( "&About..." ), this, SLOT ( OnHelpAbout() ) );
|
2006-01-28 12:29:22 +01:00
|
|
|
}
|
2006-02-18 23:05:46 +01:00
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************\
|
|
|
|
* Global functions implementation *
|
|
|
|
\******************************************************************************/
|
2008-01-26 15:55:38 +01:00
|
|
|
void DebugError ( const QString& pchErDescr, const QString& pchPar1Descr,
|
|
|
|
const double dPar1, const QString& pchPar2Descr,
|
2007-09-08 12:45:14 +02:00
|
|
|
const double dPar2 )
|
2006-02-18 23:05:46 +01:00
|
|
|
{
|
2008-01-26 15:55:38 +01:00
|
|
|
QFile File ( "DebugError.dat" );
|
|
|
|
if ( File.open ( QIODevice::Append ) )
|
|
|
|
{
|
|
|
|
// append new line in logging file
|
|
|
|
QTextStream out ( &File );
|
|
|
|
out << pchErDescr << " ### " <<
|
|
|
|
pchPar1Descr << ": " << QString().setNum ( dPar1, 'f', 2 ) <<
|
|
|
|
" ### " <<
|
|
|
|
pchPar2Descr << ": " << QString().setNum ( dPar2, 'f', 2 ) <<
|
|
|
|
endl;
|
|
|
|
|
|
|
|
File.close();
|
|
|
|
}
|
2007-09-08 12:45:14 +02:00
|
|
|
printf ( "\nDebug error! For more information see test/DebugError.dat\n" );
|
|
|
|
exit ( 1 );
|
2006-02-18 23:05:46 +01:00
|
|
|
}
|