summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 9cd2809..fe9ce9c 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,5 +1,5 @@
/* smplayer, GUI front-end for mplayer.
- Copyright (C) 2006-2009 Ricardo Villalba <rvm@escomposlinux.org>
+ Copyright (C) 2006-2010 Ricardo Villalba <rvm@escomposlinux.org>
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
@@ -42,6 +42,8 @@ using namespace Global;
BaseGui * basegui_instance = 0;
+QFile output_log;
+
void myMessageOutput( QtMsgType type, const char *msg ) {
static QStringList saved_lines;
static QString orig_line;
@@ -105,6 +107,22 @@ void myMessageOutput( QtMsgType type, const char *msg ) {
// GUI is not created yet, save lines for later
saved_lines.append(line2);
}
+
+ if (pref) {
+ if (pref->save_smplayer_log) {
+ // Save log to file
+ if (!output_log.isOpen()) {
+ // FIXME: the config path may not be initialized if USE_LOCKS is not defined
+ output_log.setFileName( Paths::configPath() + "/smplayer_log.txt" );
+ output_log.open(QIODevice::WriteOnly);
+ }
+ if (output_log.isOpen()) {
+ QString l = line2 + "\r\n";
+ output_log.write(l.toUtf8().constData());
+ output_log.flush();
+ }
+ }
+ }
}
#if USE_LOCKS
@@ -267,6 +285,8 @@ int main( int argc, char ** argv )
basegui_instance = 0;
delete smplayer;
+ if (output_log.isOpen()) output_log.close();
+
return r;
}