Hello Hugo and everyone,<br><br>I have update the man page and help string in <a href="http://git.videolan.org/?p=vlmc.git;a=commit;h=a1252b597b2cd3628e61d11abc818fde50eb85cb">http://git.videolan.org/?p=vlmc.git;a=commit;h=a1252b597b2cd3628e61d11abc818fde50eb85cb</a><br>
Do you want to introduce a cmd line options like:<br>vlmc --verbose <level><br>or, vlmc -v <level><br>or like,<br>vlmc --debug <level><br>vlmc -d <level><br>or, vlmc --logfile etc etc... Ideas?<br>
<br>How about introducing a debugging API to be used throughout VLMC instead of qDebug() with colours logging info (time, address etc. as in VLC)<br>Perhaps we can modify and use VlmcDebug... and use it just like qDebug() << ...<br>
<br>Also, an option to log outputs etc. to a file... giving explicit path in VLMC preferences (so perhaps user can decide...),<br>uncomment and work on some code in VlmcDebug.<br><br>Best Regards,<br>Rohit Yadav<br><br><div class="gmail_quote">
On Mon, Oct 11, 2010 at 4:40 AM, <span dir="ltr"><<a href="mailto:git@videolan.org">git@videolan.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
vlmc | branch: master | Hugo Beauzée-Luyssen <<a href="mailto:beauze.h@gmail.com">beauze.h@gmail.com</a>> | Mon Oct 11 01:09:34 2010 +0200| [f4d792068750583b777049bacf230b5142b28ee2] | committer: Hugo Beauzée-Luyssen<br>
<br>
VLC debug level can now be set through the command line.<br>
<br>
This will ease the pain when asking a user to enable vlc's log...<br>
<br>
> <a href="http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=f4d792068750583b777049bacf230b5142b28ee2" target="_blank">http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=f4d792068750583b777049bacf230b5142b28ee2</a><br>
---<br>
<br>
src/Gui/MainWindow.cpp | 2 +-<br>
src/LibVLCpp/VLCInstance.cpp | 12 +++++++++++-<br>
src/Settings/SettingsManager.h | 2 ++<br>
src/Tools/VlmcDebug.cpp | 29 +++++++++++++++--------------<br>
src/Tools/VlmcDebug.h | 7 +++++++<br>
5 files changed, 36 insertions(+), 16 deletions(-)<br>
<br>
diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp<br>
index 96e057d..eaf40f1 100644<br>
--- a/src/Gui/MainWindow.cpp<br>
+++ b/src/Gui/MainWindow.cpp<br>
@@ -73,7 +73,7 @@ MainWindow::MainWindow( QWidget *parent ) :<br>
m_ui.setupUi( this );<br>
<br>
//We only install message handler here cause it uses configuration.<br>
-// VlmcDebug::getInstance()->setup();<br>
+ VlmcDebug::getInstance()->setup();<br>
<br>
//VLC Instance:<br>
LibVLCpp::Instance::getInstance();<br>
diff --git a/src/LibVLCpp/VLCInstance.cpp b/src/LibVLCpp/VLCInstance.cpp<br>
index 96717e5..61a64d9 100644<br>
--- a/src/LibVLCpp/VLCInstance.cpp<br>
+++ b/src/LibVLCpp/VLCInstance.cpp<br>
@@ -23,13 +23,16 @@<br>
#include "VLCInstance.h"<br>
#include "vlc/vlc.h"<br>
<br>
+#include "SettingsManager.h"<br>
+#include "VlmcDebug.h"<br>
+<br>
using namespace LibVLCpp;<br>
<br>
Instance::Instance( QObject* parent /*= NULL*/ ) : QObject( parent )<br>
{<br>
char const *argv[] =<br>
{<br>
-// "-vvvvv",<br>
+ "", //Keep this array entry empty. It will be replaced later if required.<br>
// "--ffmpeg-debug", "3",<br>
"--no-skip-frames",<br>
// "--intf", "dummy",<br>
@@ -42,6 +45,13 @@ Instance::Instance( QObject* parent /*= NULL*/ ) : QObject( parent )<br>
};<br>
int argc = sizeof( argv ) / sizeof( *argv );<br>
<br>
+ int debugLevel = VLMC_GET_INT( "private/LogLevel" );<br>
+ qDebug() << debugLevel;<br>
+ if ( debugLevel == VlmcDebug::Debug )<br>
+ argv[0] = "-vv";<br>
+ else if ( debugLevel == VlmcDebug::Verbose )<br>
+ argv[0] = "-v";<br>
+<br>
m_internalPtr = libvlc_new( argc, argv );<br>
Q_ASSERT_X( m_internalPtr != NULL, "LibVLCpp::Instance::Instance()",<br>
"Can't launch VLMC without a valid LibVLC instance. Please check your VLC installation" );<br>
diff --git a/src/Settings/SettingsManager.h b/src/Settings/SettingsManager.h<br>
index 3bbf1ee..65975ee 100644<br>
--- a/src/Settings/SettingsManager.h<br>
+++ b/src/Settings/SettingsManager.h<br>
@@ -90,6 +90,8 @@ SettingsManager::getInstance()->createVar( type, key, defaultValue, name, \<br>
//Convenience maccros :<br>
#define VLMC_CREATE_PRIVATE_PREFERENCE_STRING( key, defaultValue ) \<br>
VLMC_CREATE_PREFERENCE( SettingValue::String, key, defaultValue, "", "", SettingValue::Private )<br>
+#define VLMC_CREATE_PRIVATE_PREFERENCE_INT( key, defaultValue ) \<br>
+ VLMC_CREATE_PREFERENCE( SettingValue::Int, key, defaultValue, "", "", SettingValue::Private )<br>
#define VLMC_CREATE_PRIVATE_PROJECT_STRING( key, defaultValue ) \<br>
VLMC_CREATE_PROJECT_VAR( SettingValue::String, key, defaultValue, "", "", SettingValue::Private )<br>
#define VLMC_CREATE_PREFERENCE_PASSWORD( key, defaultValue, name, desc ) \<br>
diff --git a/src/Tools/VlmcDebug.cpp b/src/Tools/VlmcDebug.cpp<br>
index 9bbbe9d..6adb3ec 100644<br>
--- a/src/Tools/VlmcDebug.cpp<br>
+++ b/src/Tools/VlmcDebug.cpp<br>
@@ -29,24 +29,25 @@<br>
VlmcDebug::VlmcDebug() : m_logFile( NULL )<br>
{<br>
//setup log level :<br>
+ VLMC_CREATE_PRIVATE_PREFERENCE_INT( "private/LogLevel", 0 );<br>
QStringList args = qApp->arguments();<br>
- if ( args.indexOf( QRegExp( "-vvv*" ) ) >= 0 )<br>
- SettingsManager::getInstance()->setValue( "private/LogLevel", QtDebugMsg, SettingsManager::Vlmc );<br>
+ if ( args.indexOf( QRegExp( "-vv+" ) ) >= 0 )<br>
+ SettingsManager::getInstance()->setValue( "private/LogLevel", VlmcDebug::Debug, SettingsManager::Vlmc );<br>
else if ( args.contains( "-v" ) == true )<br>
- SettingsManager::getInstance()->setValue( "private/LogLevel", QtWarningMsg, SettingsManager::Vlmc );<br>
+ SettingsManager::getInstance()->setValue( "private/LogLevel", VlmcDebug::Verbose, SettingsManager::Vlmc );<br>
else<br>
- SettingsManager::getInstance()->setValue( "private/LogLevel", QtCriticalMsg, SettingsManager::Vlmc );<br>
+ SettingsManager::getInstance()->setValue( "private/LogLevel", VlmcDebug::Quiet, SettingsManager::Vlmc );<br>
<br>
- int pos = args.indexOf( QRegExp( "--logfile=.*" ) );<br>
- if ( pos > 0 )<br>
- {<br>
- QString arg = args[pos];<br>
- QString logFile = arg.mid( 10 );<br>
- if ( logFile.length() <= 0 )<br>
- qWarning() << tr("Invalid value supplied for argument --logfile" );<br>
- else<br>
- SettingsManager::getInstance()->setValue( "private/LogFile", logFile, SettingsManager::Vlmc );<br>
- }<br>
+// int pos = args.indexOf( QRegExp( "--logfile=.*" ) );<br>
+// if ( pos > 0 )<br>
+// {<br>
+// QString arg = args[pos];<br>
+// QString logFile = arg.mid( 10 );<br>
+// if ( logFile.length() <= 0 )<br>
+// qWarning() << tr("Invalid value supplied for argument --logfile" );<br>
+// else<br>
+// SettingsManager::getInstance()->setValue( "private/LogFile", logFile, SettingsManager::Vlmc );<br>
+// }<br>
<br>
<br>
// QVariant setVal = SettingsManager::getInstance()->value( "private/LogFile", "log.vlmc", SettingsManager::Vlmc );<br>
diff --git a/src/Tools/VlmcDebug.h b/src/Tools/VlmcDebug.h<br>
index 2f4eee7..85ba9c5 100644<br>
--- a/src/Tools/VlmcDebug.h<br>
+++ b/src/Tools/VlmcDebug.h<br>
@@ -38,6 +38,13 @@ class VlmcDebug : public QObject, public Singleton<VlmcDebug><br>
Q_OBJECT<br>
<br>
public:<br>
+ enum VerboseLevel<br>
+ {<br>
+ Quiet,<br>
+ Verbose,<br>
+ Debug<br>
+ };<br>
+<br>
static void vlmcMessageHandler( QtMsgType type, const char* msg );<br>
void setup();<br>
private:<br>
<br>
_______________________________________________<br>
Vlmc-devel mailing list<br>
<a href="mailto:Vlmc-devel@videolan.org">Vlmc-devel@videolan.org</a><br>
<a href="http://mailman.videolan.org/listinfo/vlmc-devel" target="_blank">http://mailman.videolan.org/listinfo/vlmc-devel</a><br>
</blockquote></div><br>