Commit d037215a authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

Rename VlmcDebug to VlmcLogger

parent 42d286f1
......@@ -41,7 +41,7 @@ SET(VLMC_SRCS
Tools/QSingleton.hpp
Tools/Singleton.hpp
Tools/Toggleable.hpp
Tools/VlmcDebug.cpp
Tools/VlmcLogger.cpp
Workflow/AudioClipWorkflow.cpp
Workflow/ClipWorkflow.cpp
Workflow/ClipHelper.cpp
......
......@@ -36,7 +36,7 @@
#include "config.h"
#include "Library.h"
#include "About.h"
#include "VlmcDebug.h"
#include "VlmcLogger.h"
#include "EffectsEngine/EffectsEngine.h"
#include "MainWorkflow.h"
......@@ -73,7 +73,7 @@ MainWindow::MainWindow( QWidget *parent ) :
m_ui.setupUi( this );
//We only install message handler here cause it uses configuration.
VlmcDebug::getInstance()->setup();
VlmcLogger::getInstance()->setup();
//VLC Instance:
LibVLCpp::Instance::getInstance();
......
......@@ -24,7 +24,7 @@
#include "vlc/vlc.h"
#include "SettingsManager.h"
#include "VlmcDebug.h"
#include "VlmcLogger.h"
#include <QVector>
......@@ -43,9 +43,9 @@ Instance::Instance( QObject* parent /*= NULL*/ ) : QObject( parent )
<< "--no-disable-screensaver"; //No need to disable the screensaver, and save a thread.
int debugLevel = VLMC_GET_INT( "private/LogLevel" );
if ( debugLevel == VlmcDebug::Debug )
if ( debugLevel == VlmcLogger::Debug )
argv << "-vv";
else if ( debugLevel == VlmcDebug::Verbose )
else if ( debugLevel == VlmcLogger::Verbose )
argv << "-v";
m_internalPtr = libvlc_new( argv.count(), &argv.front() );
......
/*****************************************************************************
* VlmcDebug.cpp: Debug tools for VLMC
* VlmcLogger.cpp: Debug tools for VLMC
*****************************************************************************
* Copyright (C) 2008-2010 VideoLAN
*
......@@ -21,18 +21,18 @@
*****************************************************************************/
#include "SettingsManager.h"
#include "VlmcDebug.h"
#include "VlmcLogger.h"
#include <QCoreApplication>
#include <QDesktopServices>
#include <QStringList>
#include <QThread>
VlmcDebug::VlmcDebug() : m_logFile( NULL )
VlmcLogger::VlmcLogger() : m_logFile( NULL )
{
//setup log level :
{
SettingValue* logLevel = VLMC_CREATE_PREFERENCE( SettingValue::Int, "private/LogLevel", (int)VlmcDebug::Quiet,
SettingValue* logLevel = VLMC_CREATE_PREFERENCE( SettingValue::Int, "private/LogLevel", (int)VlmcLogger::Quiet,
"", "", SettingValue::Private | SettingValue::Clamped );
logLevel->setLimits((int)Debug, (int)Verbose);
// Purposedly destroying the setting value, as we need to use the manager for other operations.
......@@ -40,11 +40,11 @@ VlmcDebug::VlmcDebug() : m_logFile( NULL )
}
QStringList args = qApp->arguments();
if ( args.indexOf( QRegExp( "-vv+" ) ) >= 0 )
m_currentLogLevel = VlmcDebug::Debug;
m_currentLogLevel = VlmcLogger::Debug;
else if ( args.contains( "-v" ) == true )
m_currentLogLevel = VlmcDebug::Verbose;
m_currentLogLevel = VlmcLogger::Verbose;
else
m_currentLogLevel = VlmcDebug::Quiet;
m_currentLogLevel = VlmcLogger::Quiet;
SettingsManager* settingsManager = SettingsManager::getInstance();
settingsManager->setValue( "private/LogLevel", m_currentLogLevel, SettingsManager::Vlmc );
settingsManager->watchValue( "private/LogLevel", this, SLOT(logLevelChanged( const QVariant& )),
......@@ -80,26 +80,26 @@ VlmcDebug::VlmcDebug() : m_logFile( NULL )
// }
}
VlmcDebug::~VlmcDebug()
VlmcLogger::~VlmcLogger()
{
if ( m_logFile )
fclose( m_logFile );
}
void
VlmcDebug::setup()
VlmcLogger::setup()
{
qInstallMsgHandler( VlmcDebug::vlmcMessageHandler );
qInstallMsgHandler( VlmcLogger::vlmcMessageHandler );
}
void
VlmcDebug::logLevelChanged( const QVariant &logLevel )
VlmcLogger::logLevelChanged( const QVariant &logLevel )
{
Q_ASSERT_X(logLevel.toInt() >= (int)VlmcDebug::Debug &&
logLevel.toInt() <= (int)VlmcDebug::Quiet,
Q_ASSERT_X(logLevel.toInt() >= (int)VlmcLogger::Debug &&
logLevel.toInt() <= (int)VlmcLogger::Quiet,
"Setting log level", "Invalid value for log level");
m_currentLogLevel = (VlmcDebug::LogLevel)logLevel.toInt();
m_currentLogLevel = (VlmcLogger::LogLevel)logLevel.toInt();
}
/*********************************************************************
......@@ -107,7 +107,7 @@ VlmcDebug::logLevelChanged( const QVariant &logLevel )
*********************************************************************/
void
VlmcDebug::writeToFile(const char *msg)
VlmcLogger::writeToFile(const char *msg)
{
flockfile( m_logFile );
fputs( msg, m_logFile );
......@@ -116,12 +116,12 @@ VlmcDebug::writeToFile(const char *msg)
}
void
VlmcDebug::vlmcMessageHandler( QtMsgType type, const char* msg )
VlmcLogger::vlmcMessageHandler( QtMsgType type, const char* msg )
{
//FIXME: This is ok as long as we guarantee no log message will arrive after
// we uninstall the hook
VlmcDebug* self = VlmcDebug::getInstance();
VlmcLogger* self = VlmcLogger::getInstance();
if ( self->m_logFile != NULL )
{
//FIXME: Messages are not guaranteed to arrive in order
......
/*****************************************************************************
* VlmcDebug.h: Debug tools for VLMC
* VlmcLogger.h: Debug tools for VLMC
*****************************************************************************
* Copyright (C) 2008-2010 VideoLAN
*
......@@ -34,7 +34,7 @@
* \warning Do not use qDebug() qWarning() etc... from here, unless you know exactly what you're doing
* Chances are very high that you end up with a stack overflow !!
*/
class VlmcDebug : public QObject, public Singleton<VlmcDebug>
class VlmcLogger : public QObject, public Singleton<VlmcLogger>
{
Q_OBJECT
......@@ -52,8 +52,8 @@ class VlmcDebug : public QObject, public Singleton<VlmcDebug>
static void vlmcMessageHandler( QtMsgType type, const char* msg );
void setup();
private:
VlmcDebug();
virtual ~VlmcDebug();
VlmcLogger();
virtual ~VlmcLogger();
void writeToFile(const char* msg);
FILE* m_logFile;
......@@ -62,7 +62,7 @@ class VlmcDebug : public QObject, public Singleton<VlmcDebug>
private slots:
void logLevelChanged( const QVariant& logLevel );
friend class Singleton<VlmcDebug>;
friend class Singleton<VlmcLogger>;
};
#endif // VLMCDEBUG_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment