Add a "headless" build type which does not depend on QtGui/QtWidgets

This commit is contained in:
Hector Martin 2020-06-03 14:10:50 +09:00
parent dc7a844f0b
commit 1651a8d065
15 changed files with 170 additions and 93 deletions

View file

@ -10,10 +10,15 @@ CONFIG += qt \
thread \ thread \
release release
QT += widgets \ QT += network \
network \
xml xml
!contains(CONFIG, "headless") {
QT += widgets
} else {
QT -= gui
}
TRANSLATIONS = src/res/translation/translation_de_DE.ts \ TRANSLATIONS = src/res/translation/translation_de_DE.ts \
src/res/translation/translation_fr_FR.ts \ src/res/translation/translation_fr_FR.ts \
src/res/translation/translation_pt_PT.ts \ src/res/translation/translation_pt_PT.ts \
@ -324,25 +329,18 @@ win32 {
RCC_DIR = src/res RCC_DIR = src/res
RESOURCES += src/resources.qrc RESOURCES += src/resources.qrc
FORMS += src/clientdlgbase.ui \ FORMS_GUI = src/clientdlgbase.ui \
src/serverdlgbase.ui \ src/serverdlgbase.ui \
src/clientsettingsdlgbase.ui \ src/clientsettingsdlgbase.ui \
src/chatdlgbase.ui \ src/chatdlgbase.ui \
src/connectdlgbase.ui \ src/connectdlgbase.ui \
src/aboutdlgbase.ui src/aboutdlgbase.ui
HEADERS += src/audiomixerboard.h \ HEADERS += src/buffer.h \
src/buffer.h \
src/channel.h \ src/channel.h \
src/chatdlg.h \
src/client.h \ src/client.h \
src/clientsettingsdlg.h \
src/connectdlg.h \
src/global.h \ src/global.h \
src/clientdlg.h \
src/serverdlg.h \
src/multicolorled.h \ src/multicolorled.h \
src/multicolorledbar.h \
src/protocol.h \ src/protocol.h \
src/server.h \ src/server.h \
src/serverlist.h \ src/serverlist.h \
@ -352,13 +350,21 @@ HEADERS += src/audiomixerboard.h \
src/soundbase.h \ src/soundbase.h \
src/testbench.h \ src/testbench.h \
src/util.h \ src/util.h \
src/analyzerconsole.h \
src/recorder/jamrecorder.h \ src/recorder/jamrecorder.h \
src/recorder/creaperproject.h \ src/recorder/creaperproject.h \
src/recorder/cwavestream.h \ src/recorder/cwavestream.h \
src/historygraph.h \ src/historygraph.h \
src/signalhandler.h src/signalhandler.h
HEADERS_GUI = src/audiomixerboard.h \
src/chatdlg.h \
src/clientsettingsdlg.h \
src/connectdlg.h \
src/clientdlg.h \
src/serverdlg.h \
src/multicolorledbar.h \
src/analyzerconsole.h
HEADERS_OPUS = libs/opus/celt/arch.h \ HEADERS_OPUS = libs/opus/celt/arch.h \
libs/opus/celt/bands.h \ libs/opus/celt/bands.h \
libs/opus/celt/celt.h \ libs/opus/celt/celt.h \
@ -430,18 +436,10 @@ HEADERS_OPUS_X86 = libs/opus/celt/x86/celt_lpc_sse.h \
libs/opus/celt/x86/vq_sse.h \ libs/opus/celt/x86/vq_sse.h \
libs/opus/celt/x86/x86cpu.h libs/opus/celt/x86/x86cpu.h
SOURCES += src/audiomixerboard.cpp \ SOURCES += src/buffer.cpp \
src/buffer.cpp \
src/channel.cpp \ src/channel.cpp \
src/chatdlg.cpp \
src/client.cpp \ src/client.cpp \
src/clientsettingsdlg.cpp \
src/connectdlg.cpp \
src/clientdlg.cpp \
src/serverdlg.cpp \
src/main.cpp \ src/main.cpp \
src/multicolorled.cpp \
src/multicolorledbar.cpp \
src/protocol.cpp \ src/protocol.cpp \
src/server.cpp \ src/server.cpp \
src/serverlist.cpp \ src/serverlist.cpp \
@ -451,12 +449,21 @@ SOURCES += src/audiomixerboard.cpp \
src/socket.cpp \ src/socket.cpp \
src/soundbase.cpp \ src/soundbase.cpp \
src/util.cpp \ src/util.cpp \
src/analyzerconsole.cpp \
src/recorder/jamrecorder.cpp \ src/recorder/jamrecorder.cpp \
src/recorder/creaperproject.cpp \ src/recorder/creaperproject.cpp \
src/recorder/cwavestream.cpp \ src/recorder/cwavestream.cpp \
src/historygraph.cpp src/historygraph.cpp
SOURCES_GUI = src/audiomixerboard.cpp \
src/chatdlg.cpp \
src/clientsettingsdlg.cpp \
src/connectdlg.cpp \
src/clientdlg.cpp \
src/serverdlg.cpp \
src/multicolorled.cpp \
src/multicolorledbar.cpp \
src/analyzerconsole.cpp
SOURCES_OPUS = libs/opus/celt/bands.c \ SOURCES_OPUS = libs/opus/celt/bands.c \
libs/opus/celt/celt.c \ libs/opus/celt/celt.c \
libs/opus/celt/celt_decoder.c \ libs/opus/celt/celt_decoder.c \
@ -985,6 +992,14 @@ DISTFILES_OPUS += libs/opus/AUTHORS \
libs/opus/celt/arm/armopts.s.in \ libs/opus/celt/arm/armopts.s.in \
libs/opus/celt/arm/celt_pitch_xcorr_arm.s \ libs/opus/celt/arm/celt_pitch_xcorr_arm.s \
!contains(CONFIG, "headless") {
HEADERS += $$HEADERS_GUI
SOURCES += $$SOURCES_GUI
FORMS += $$FORMS_GUI
} else {
DEFINES += HEADLESS
}
# use external OPUS library if requested # use external OPUS library if requested
contains(CONFIG, "opus_shared_lib") { contains(CONFIG, "opus_shared_lib") {
message(OPUS codec is used from a shared library.) message(OPUS codec is used from a shared library.)

View file

@ -28,7 +28,6 @@
#include <QHostInfo> #include <QHostInfo>
#include <QString> #include <QString>
#include <QDateTime> #include <QDateTime>
#include <QMessageBox>
#ifdef USE_OPUS_SHARED_LIB #ifdef USE_OPUS_SHARED_LIB
# include "opus/opus_custom.h" # include "opus/opus_custom.h"
#else #else

View file

@ -33,6 +33,7 @@
#include <QRadioButton> #include <QRadioButton>
#include <QMenuBar> #include <QMenuBar>
#include <QLayout> #include <QLayout>
#include <QMessageBox>
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) #if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
# include <QVersionNumber> # include <QVersionNumber>
#endif #endif

View file

@ -34,6 +34,7 @@
#include <QMenuBar> #include <QMenuBar>
#include <QLayout> #include <QLayout>
#include <QButtonGroup> #include <QButtonGroup>
#include <QMessageBox>
#include "global.h" #include "global.h"
#include "client.h" #include "client.h"
#include "multicolorled.h" #include "multicolorled.h"

View file

@ -299,6 +299,7 @@ void AHistoryGraph::AddMarker ( const SHistoryData& curHistoryData )
/* JPEG History Graph implementation ******************************************/ /* JPEG History Graph implementation ******************************************/
#ifndef HEADLESS
CJpegHistoryGraph::CJpegHistoryGraph ( const int iMaxDaysHistory ) : CJpegHistoryGraph::CJpegHistoryGraph ( const int iMaxDaysHistory ) :
AHistoryGraph ( iMaxDaysHistory ), AHistoryGraph ( iMaxDaysHistory ),
PlotPixmap ( 1, 1, QImage::Format_RGB32 ), PlotPixmap ( 1, 1, QImage::Format_RGB32 ),
@ -401,6 +402,7 @@ void CJpegHistoryGraph::point ( const unsigned int x, const unsigned int y, cons
PlotPainter.setPen ( QPen ( QBrush( QColor ( colour ) ), size ) ); PlotPainter.setPen ( QPen ( QBrush( QColor ( colour ) ), size ) );
PlotPainter.drawPoint ( x, y ); PlotPainter.drawPoint ( x, y );
} }
#endif
/* SVG History Graph implementation *******************************************/ /* SVG History Graph implementation *******************************************/

View file

@ -34,8 +34,10 @@
#include "util.h" #include "util.h"
// for CJpegHistoryGraph // for CJpegHistoryGraph
#ifndef HEADLESS
# include <QImage> # include <QImage>
# include <QPainter> # include <QPainter>
#endif
// for CSvgHistoryGraph // for CSvgHistoryGraph
#include <QXmlStreamWriter> #include <QXmlStreamWriter>
@ -134,6 +136,7 @@ protected:
/* Implementations ************************************************************/ /* Implementations ************************************************************/
#ifndef HEADLESS
class CJpegHistoryGraph : public QObject, virtual public AHistoryGraph class CJpegHistoryGraph : public QObject, virtual public AHistoryGraph
{ {
Q_OBJECT Q_OBJECT
@ -157,6 +160,7 @@ private:
public slots: public slots:
void OnTimerDailyUpdate() { Update(); } void OnTimerDailyUpdate() { Update(); }
}; };
#endif
class CSvgHistoryGraph : public QObject, virtual public AHistoryGraph class CSvgHistoryGraph : public QObject, virtual public AHistoryGraph
{ {

View file

@ -22,15 +22,18 @@
* *
\******************************************************************************/ \******************************************************************************/
#include <QApplication> #include <QCoreApplication>
#include <QMessageBox>
#include <QDir> #include <QDir>
#include <QTextStream> #include <QTextStream>
#include <QTranslator> #include <QTranslator>
#include <QLibraryInfo> #include <QLibraryInfo>
#include "global.h" #include "global.h"
#ifndef HEADLESS
# include <QApplication>
# include <QMessageBox>
# include "clientdlg.h" # include "clientdlg.h"
# include "serverdlg.h" # include "serverdlg.h"
#endif
#include "settings.h" #include "settings.h"
#include "testbench.h" #include "testbench.h"
#include "util.h" #include "util.h"
@ -471,7 +474,7 @@ int main ( int argc, char** argv )
if ( ( !strcmp ( argv[i], "--version" ) ) || if ( ( !strcmp ( argv[i], "--version" ) ) ||
( !strcmp ( argv[i], "-v" ) ) ) ( !strcmp ( argv[i], "-v" ) ) )
{ {
tsConsole << CAboutDlg::GetVersionAndNameStr ( false ) << endl; tsConsole << GetVersionAndNameStr ( false ) << endl;
exit ( 1 ); exit ( 1 );
} }
@ -499,6 +502,14 @@ int main ( int argc, char** argv )
#endif #endif
} }
#ifdef HEADLESS
if (bUseGUI)
{
bUseGUI = false;
tsConsole << "No GUI support compiled. Running in headless mode." << endl;
}
#endif
// Dependencies ------------------------------------------------------------ // Dependencies ------------------------------------------------------------
// per definition: if we are in "GUI" server mode and no central server // per definition: if we are in "GUI" server mode and no central server
@ -523,9 +534,13 @@ int main ( int argc, char** argv )
// Application/GUI setup --------------------------------------------------- // Application/GUI setup ---------------------------------------------------
// Application object // Application object
#ifdef HEADLESS
QCoreApplication* pApp = new QCoreApplication ( argc, argv );
#else
QCoreApplication* pApp = bUseGUI QCoreApplication* pApp = bUseGUI
? new QApplication ( argc, argv ) ? new QApplication ( argc, argv )
: new QCoreApplication ( argc, argv ); : new QCoreApplication ( argc, argv );
#endif
#ifdef ANDROID #ifdef ANDROID
// special Android coded needed for record audio permission handling // special Android coded needed for record audio permission handling
@ -602,6 +617,7 @@ int main ( int argc, char** argv )
CSettings Settings ( &Client, strIniFileName ); CSettings Settings ( &Client, strIniFileName );
Settings.Load(); Settings.Load();
#ifndef HEADLESS
if ( bUseGUI ) if ( bUseGUI )
{ {
// GUI object // GUI object
@ -619,9 +635,10 @@ int main ( int argc, char** argv )
pApp->exec(); pApp->exec();
} }
else else
#endif
{ {
// only start application without using the GUI // only start application without using the GUI
tsConsole << CAboutDlg::GetVersionAndNameStr ( false ) << endl; tsConsole << GetVersionAndNameStr ( false ) << endl;
pApp->exec(); pApp->exec();
} }
@ -645,6 +662,7 @@ int main ( int argc, char** argv )
bDisconnectAllClientsOnQuit, bDisconnectAllClientsOnQuit,
bUseDoubleSystemFrameSize, bUseDoubleSystemFrameSize,
eLicenceType ); eLicenceType );
#ifndef HEADLESS
if ( bUseGUI ) if ( bUseGUI )
{ {
// load settings from init-file // load settings from init-file
@ -671,9 +689,10 @@ int main ( int argc, char** argv )
pApp->exec(); pApp->exec();
} }
else else
#endif
{ {
// only start application without using the GUI // only start application without using the GUI
tsConsole << CAboutDlg::GetVersionAndNameStr ( false ) << endl; tsConsole << GetVersionAndNameStr ( false ) << endl;
// update serverlist // update serverlist
Server.UpdateServerList(); Server.UpdateServerList();
@ -686,6 +705,7 @@ int main ( int argc, char** argv )
catch ( CGenErr generr ) catch ( CGenErr generr )
{ {
// show generic error // show generic error
#ifndef HEADLESS
if ( bUseGUI ) if ( bUseGUI )
{ {
QMessageBox::critical ( nullptr, QMessageBox::critical ( nullptr,
@ -695,6 +715,7 @@ int main ( int argc, char** argv )
nullptr ); nullptr );
} }
else else
#endif
{ {
tsConsole << generr.GetErrorText() << endl; tsConsole << generr.GetErrorText() << endl;
} }

View file

@ -24,12 +24,14 @@
#pragma once #pragma once
#ifndef HEADLESS
# include <QFrame> # include <QFrame>
# include <QPixmap> # include <QPixmap>
# include <QTimer> # include <QTimer>
# include <QLayout> # include <QLayout>
# include <QProgressBar> # include <QProgressBar>
# include <QStackedLayout> # include <QStackedLayout>
#endif
#include "util.h" #include "util.h"
#include "global.h" #include "global.h"
@ -42,6 +44,7 @@
/* Classes ********************************************************************/ /* Classes ********************************************************************/
#ifndef HEADLESS
class CMultiColorLEDBar : public QWidget class CMultiColorLEDBar : public QWidget
{ {
Q_OBJECT Q_OBJECT
@ -95,3 +98,4 @@ protected:
CVector<cLED*> vecpLEDs; CVector<cLED*> vecpLEDs;
QProgressBar* pProgressBar; QProgressBar* pProgressBar;
}; };
#endif

View file

@ -47,14 +47,16 @@ void CServerLogging::Start ( const QString& strLoggingFileName )
void CServerLogging::EnableHistory ( const QString& strHistoryFileName ) void CServerLogging::EnableHistory ( const QString& strHistoryFileName )
{ {
if ( strHistoryFileName.right ( 4 ).compare ( ".svg", Qt::CaseInsensitive ) == 0 ) #ifndef HEADLESS
{ if ( strHistoryFileName.right ( 4 ).compare ( ".svg", Qt::CaseInsensitive ) != 0 )
SvgHistoryGraph.Start ( strHistoryFileName );
}
else
{ {
JpegHistoryGraph.Start ( strHistoryFileName ); JpegHistoryGraph.Start ( strHistoryFileName );
} }
else
#endif
{
SvgHistoryGraph.Start ( strHistoryFileName );
}
} }
void CServerLogging::AddNewConnection ( const QHostAddress& ClientInetAddr ) void CServerLogging::AddNewConnection ( const QHostAddress& ClientInetAddr )
@ -68,7 +70,9 @@ void CServerLogging::AddNewConnection ( const QHostAddress& ClientInetAddr )
*this << strLogStr; // in log file *this << strLogStr; // in log file
// add element to history // add element to history
#ifndef HEADLESS
JpegHistoryGraph.Add ( QDateTime::currentDateTime(), ClientInetAddr ); JpegHistoryGraph.Add ( QDateTime::currentDateTime(), ClientInetAddr );
#endif
SvgHistoryGraph.Add ( QDateTime::currentDateTime(), ClientInetAddr ); SvgHistoryGraph.Add ( QDateTime::currentDateTime(), ClientInetAddr );
} }
@ -82,10 +86,14 @@ 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
#ifndef HEADLESS
JpegHistoryGraph.Add ( QDateTime::currentDateTime(), AHistoryGraph::HIT_SERVER_STOP ); JpegHistoryGraph.Add ( QDateTime::currentDateTime(), AHistoryGraph::HIT_SERVER_STOP );
#endif
SvgHistoryGraph.Add ( QDateTime::currentDateTime(), AHistoryGraph::HIT_SERVER_STOP ); SvgHistoryGraph.Add ( QDateTime::currentDateTime(), AHistoryGraph::HIT_SERVER_STOP );
#ifndef HEADLESS
JpegHistoryGraph.Update(); JpegHistoryGraph.Update();
#endif
SvgHistoryGraph.Update(); SvgHistoryGraph.Update();
} }
@ -133,7 +141,9 @@ void CServerLogging::ParseLogFile ( const QString& strFileName )
if ( strAddress.isEmpty() ) if ( strAddress.isEmpty() )
{ {
// server stop // server stop
#ifndef HEADLESS
JpegHistoryGraph.Add ( curDateTime, AHistoryGraph::HIT_SERVER_STOP ); JpegHistoryGraph.Add ( curDateTime, AHistoryGraph::HIT_SERVER_STOP );
#endif
SvgHistoryGraph.Add ( curDateTime, CSvgHistoryGraph::HIT_SERVER_STOP ); SvgHistoryGraph.Add ( curDateTime, CSvgHistoryGraph::HIT_SERVER_STOP );
} }
else else
@ -144,7 +154,9 @@ void CServerLogging::ParseLogFile ( const QString& strFileName )
if ( curAddress.setAddress ( strlistCurLine.at ( 1 ).trimmed() ) ) if ( curAddress.setAddress ( strlistCurLine.at ( 1 ).trimmed() ) )
{ {
// new client connection // new client connection
#ifndef HEADLESS
JpegHistoryGraph.Add ( curDateTime, curAddress ); JpegHistoryGraph.Add ( curDateTime, curAddress );
#endif
SvgHistoryGraph.Add ( curDateTime, curAddress ); SvgHistoryGraph.Add ( curDateTime, curAddress );
} }
} }
@ -152,7 +164,9 @@ void CServerLogging::ParseLogFile ( const QString& strFileName )
} }
} }
#ifndef HEADLESS
JpegHistoryGraph.Update(); JpegHistoryGraph.Update();
#endif
SvgHistoryGraph.Update(); SvgHistoryGraph.Update();
} }

View file

@ -39,7 +39,9 @@ class CServerLogging
{ {
public: public:
CServerLogging ( const int iMaxDaysHistory ) : CServerLogging ( const int iMaxDaysHistory ) :
#ifndef HEADLESS
JpegHistoryGraph ( iMaxDaysHistory ), JpegHistoryGraph ( iMaxDaysHistory ),
#endif
SvgHistoryGraph ( iMaxDaysHistory ), SvgHistoryGraph ( iMaxDaysHistory ),
bDoLogging ( false ), bDoLogging ( false ),
File ( DEFAULT_LOG_FILE_NAME ) {} File ( DEFAULT_LOG_FILE_NAME ) {}
@ -56,7 +58,9 @@ protected:
void operator<< ( const QString& sNewStr ); void operator<< ( const QString& sNewStr );
QString CurTimeDatetoLogString(); QString CurTimeDatetoLogString();
#ifndef HEADLESS
CJpegHistoryGraph JpegHistoryGraph; CJpegHistoryGraph JpegHistoryGraph;
#endif
CSvgHistoryGraph SvgHistoryGraph; CSvgHistoryGraph SvgHistoryGraph;
bool bDoLogging; bool bDoLogging;
QFile File; QFile File;

View file

@ -25,7 +25,6 @@
#pragma once #pragma once
#include <QObject> #include <QObject>
#include <QMessageBox>
#include <QThread> #include <QThread>
#include <QMutex> #include <QMutex>
#include <vector> #include <vector>

View file

@ -22,6 +22,10 @@
* *
\******************************************************************************/ \******************************************************************************/
#ifndef HEADLESS
# include <QMessageBox>
#endif
#include "soundbase.h" #include "soundbase.h"
@ -137,6 +141,7 @@ QString CSoundBase::SetDev ( const int iNewDev )
// the same driver is used but the driver properties seems to // the same driver is used but the driver properties seems to
// have changed so that they are not compatible to our // have changed so that they are not compatible to our
// software anymore // software anymore
#ifndef HEADLESS
QMessageBox::critical ( QMessageBox::critical (
nullptr, APP_NAME, QString ( tr ( "The audio driver properties " nullptr, APP_NAME, QString ( tr ( "The audio driver properties "
"have changed to a state which is incompatible with this " "have changed to a state which is incompatible with this "
@ -145,6 +150,7 @@ QString CSoundBase::SetDev ( const int iNewDev )
strErrorMessage + strErrorMessage +
QString ( "</b><br><br>" + tr ( "Please restart the software." ) ), QString ( "</b><br><br>" + tr ( "Please restart the software." ) ),
tr ( "Close" ), nullptr ); tr ( "Close" ), nullptr );
#endif
_exit ( 0 ); _exit ( 0 );
} }

View file

@ -26,7 +26,6 @@
#include <QThread> #include <QThread>
#include <QString> #include <QString>
#include <QMessageBox>
#include "global.h" #include "global.h"
#include "util.h" #include "util.h"

View file

@ -371,6 +371,7 @@ void CAudioReverb::Process ( CVector<int16_t>& vecsStereoInOut,
* GUI Utilities * * GUI Utilities *
\******************************************************************************/ \******************************************************************************/
// About dialog ---------------------------------------------------------------- // About dialog ----------------------------------------------------------------
#ifndef HEADLESS
CAboutDlg::CAboutDlg ( QWidget* parent ) : QDialog ( parent ) CAboutDlg::CAboutDlg ( QWidget* parent ) : QDialog ( parent )
{ {
setupUi ( this ); setupUi ( this );
@ -455,43 +456,6 @@ CAboutDlg::CAboutDlg ( QWidget* parent ) : QDialog ( parent )
setWindowTitle ( tr ( "About " ) + APP_NAME ); setWindowTitle ( tr ( "About " ) + APP_NAME );
} }
QString CAboutDlg::GetVersionAndNameStr ( const bool bWithHtml )
{
QString strVersionText = "";
// name, short description and GPL hint
if ( bWithHtml )
{
strVersionText += "<b>";
}
else
{
strVersionText += " *** ";
}
strVersionText += APP_NAME + tr ( ", Version " ) + VERSION;
if ( bWithHtml )
{
strVersionText += "</b><br>";
}
else
{
strVersionText += "\n *** ";
}
if ( !bWithHtml )
{
strVersionText += tr ( "Internet Jam Session Software" );
strVersionText += "\n *** ";
}
strVersionText += tr ( "Released under the GNU General Public License (GPL)" );
return strVersionText;
}
// Licence dialog -------------------------------------------------------------- // Licence dialog --------------------------------------------------------------
CLicenceDlg::CLicenceDlg ( QWidget* parent ) : QDialog ( parent ) CLicenceDlg::CLicenceDlg ( QWidget* parent ) : QDialog ( parent )
{ {
@ -886,6 +850,7 @@ CHelpMenu::CHelpMenu ( const bool bIsClient, QWidget* parent ) : QMenu ( tr ( "&
addAction ( tr ( "&About..." ), this, SLOT ( OnHelpAbout() ) ); addAction ( tr ( "&About..." ), this, SLOT ( OnHelpAbout() ) );
} }
#endif
/******************************************************************************\ /******************************************************************************\
* Other Classes * * Other Classes *
@ -1428,3 +1393,39 @@ void DebugError ( const QString& pchErDescr,
printf ( "\nDebug error! For more information see test/DebugError.dat\n" ); printf ( "\nDebug error! For more information see test/DebugError.dat\n" );
exit ( 1 ); exit ( 1 );
} }
QString GetVersionAndNameStr ( const bool bWithHtml )
{
QString strVersionText = "";
// name, short description and GPL hint
if ( bWithHtml )
{
strVersionText += "<b>";
}
else
{
strVersionText += " *** ";
}
strVersionText += APP_NAME + QCoreApplication::tr ( ", Version " ) + VERSION;
if ( bWithHtml )
{
strVersionText += "</b><br>";
}
else
{
strVersionText += "\n *** ";
}
if ( !bWithHtml )
{
strVersionText += QCoreApplication::tr ( "Internet Jam Session Software" );
strVersionText += "\n *** ";
}
strVersionText += QCoreApplication::tr ( "Released under the GNU General Public License (GPL)" );
return strVersionText;
}

View file

@ -24,9 +24,11 @@
#pragma once #pragma once
#include <QCoreApplication>
#include <QTcpSocket> #include <QTcpSocket>
#include <QHostAddress> #include <QHostAddress>
#include <QHostInfo> #include <QHostInfo>
#ifndef HEADLESS
# include <QMenu> # include <QMenu>
# include <QWhatsThis> # include <QWhatsThis>
# include <QTextBrowser> # include <QTextBrowser>
@ -35,8 +37,9 @@
# include <QComboBox> # include <QComboBox>
# include <QLineEdit> # include <QLineEdit>
# include <QDateTime> # include <QDateTime>
#include <QFile>
# include <QDesktopServices> # include <QDesktopServices>
#endif
#include <QFile>
#include <QUrl> #include <QUrl>
#include <QLocale> #include <QLocale>
#include <QElapsedTimer> #include <QElapsedTimer>
@ -56,7 +59,9 @@ using namespace std; // because of the library: "vector"
#else #else
# include <sys/time.h> # include <sys/time.h>
#endif #endif
#ifndef HEADLESS
# include "ui_aboutdlgbase.h" # include "ui_aboutdlgbase.h"
#endif
class CClient; // forward declaration of CClient class CClient; // forward declaration of CClient
@ -100,6 +105,7 @@ inline int CalcBitRateBitsPerSecFromCodedBytes ( const int iCeltNumCodedBytes,
return ( SYSTEM_SAMPLE_RATE_HZ * iCeltNumCodedBytes * 8 ) / iFrameSize; return ( SYSTEM_SAMPLE_RATE_HZ * iCeltNumCodedBytes * 8 ) / iFrameSize;
} }
QString GetVersionAndNameStr ( const bool bWithHtml = true );
/******************************************************************************\ /******************************************************************************\
@ -408,6 +414,7 @@ template<class TData> void CMovingAv<TData>::Add ( const TData tNewD )
/******************************************************************************\ /******************************************************************************\
* GUI Utilities * * GUI Utilities *
\******************************************************************************/ \******************************************************************************/
#ifndef HEADLESS
// About dialog ---------------------------------------------------------------- // About dialog ----------------------------------------------------------------
class CAboutDlg : public QDialog, private Ui_CAboutDlgBase class CAboutDlg : public QDialog, private Ui_CAboutDlgBase
{ {
@ -416,7 +423,6 @@ class CAboutDlg : public QDialog, private Ui_CAboutDlgBase
public: public:
CAboutDlg ( QWidget* parent = nullptr ); CAboutDlg ( QWidget* parent = nullptr );
static QString GetVersionAndNameStr ( const bool bWithHtml = true );
}; };
@ -484,6 +490,7 @@ public slots:
void OnHelpSoftwareMan() { QDesktopServices::openUrl ( QUrl ( SOFTWARE_MANUAL_URL ) ); } void OnHelpSoftwareMan() { QDesktopServices::openUrl ( QUrl ( SOFTWARE_MANUAL_URL ) ); }
}; };
#endif
// Console writer factory ------------------------------------------------------ // Console writer factory ------------------------------------------------------
// this class was written by pljones // this class was written by pljones