Add a new logging system
This commit is contained in:
parent
93eb4dea3f
commit
3eedc916ad
@ -73,6 +73,7 @@ set(SOURCES
|
||||
core/globalshortcutbackend.cpp
|
||||
core/globalshortcuts.cpp
|
||||
core/gnomeglobalshortcutbackend.cpp
|
||||
core/logging.cpp
|
||||
core/mergedproxymodel.cpp
|
||||
core/musicstorage.cpp
|
||||
core/network.cpp
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "boomanalyzer.h"
|
||||
#include "sonogram.h"
|
||||
#include "turbine.h"
|
||||
#include "core/logging.h"
|
||||
|
||||
#include <QMouseEvent>
|
||||
#include <QHBoxLayout>
|
||||
@ -136,7 +137,7 @@ void AnalyzerContainer::ChangeAnalyzer(int id) {
|
||||
QObject* instance = analyzer_types_[id]->newInstance(Q_ARG(QWidget*, this));
|
||||
|
||||
if (!instance) {
|
||||
qWarning() << "Couldn't intialise a new" << analyzer_types_[id]->className();
|
||||
qLog(Warning) << "Couldn't intialise a new" << analyzer_types_[id]->className();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,6 @@ BarAnalyzer::BarAnalyzer( QWidget *parent )
|
||||
|
||||
void BarAnalyzer::resizeEvent( QResizeEvent * e )
|
||||
{
|
||||
qDebug() << "Baranalyzer Resized(" << width() << "x" << height() << ")";
|
||||
init();
|
||||
}
|
||||
|
||||
@ -61,8 +60,6 @@ void BarAnalyzer::init()
|
||||
MAX_DOWN = int(0 -(qMax(1, height() / 50)));
|
||||
MAX_UP = int(qMax(1, height() / 25));
|
||||
|
||||
qDebug() << "BAND_COUNT = " << BAND_COUNT << " MAX_UP = " << MAX_UP << "MAX_DOWN = " << MAX_DOWN;
|
||||
|
||||
barVector.resize( BAND_COUNT, 0 );
|
||||
roofVector.resize( BAND_COUNT, height() -5 );
|
||||
roofVelocityVector.resize( BAND_COUNT, ROOF_VELOCITY_REDUCTION_FACTOR );
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "config.h"
|
||||
#include "commandlineoptions.h"
|
||||
#include "logging.h"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <getopt.h>
|
||||
@ -48,7 +49,10 @@ const char* CommandlineOptions::kHelpText =
|
||||
"\n"
|
||||
"%20:\n"
|
||||
" -o, --show-osd %21\n"
|
||||
" -g, --language <lang> %22\n";
|
||||
" -g, --language <lang> %22\n"
|
||||
" --quiet %23\n"
|
||||
" --verbose %24\n"
|
||||
" --log-levels <levels> %25\n";
|
||||
|
||||
|
||||
CommandlineOptions::CommandlineOptions(int argc, char** argv)
|
||||
@ -62,7 +66,8 @@ CommandlineOptions::CommandlineOptions(int argc, char** argv)
|
||||
seek_by_(0),
|
||||
play_track_at_(-1),
|
||||
show_osd_(false),
|
||||
stun_test_(StunTestNone)
|
||||
stun_test_(StunTestNone),
|
||||
log_levels_(logging::kDefaultLogLevels)
|
||||
{
|
||||
#ifdef Q_OS_DARWIN
|
||||
// Remove -psn_xxx option that Mac passes when opened from Finder.
|
||||
@ -108,6 +113,9 @@ bool CommandlineOptions::Parse() {
|
||||
|
||||
{"show-osd", no_argument, 0, 'o'},
|
||||
{"language", required_argument, 0, 'g'},
|
||||
{"quiet", no_argument, 0, Quiet},
|
||||
{"verbose", no_argument, 0, Verbose},
|
||||
{"log-levels", required_argument, 0, LogLevels},
|
||||
|
||||
{"stun-test", required_argument, 0, 'z'},
|
||||
|
||||
@ -144,24 +152,30 @@ bool CommandlineOptions::Parse() {
|
||||
tr("Play the <n>th track in the playlist"),
|
||||
tr("Other options"),
|
||||
tr("Display the on-screen-display"),
|
||||
tr("Change the language"));
|
||||
tr("Change the language"),
|
||||
tr("Equivalent to --log-levels *:1"),
|
||||
tr("Equivalent to --log-levels *:3"),
|
||||
tr("Comma separated list of class:level, level is 0-3"));
|
||||
|
||||
std::cout << translated_help_text.toLocal8Bit().constData();
|
||||
return false;
|
||||
}
|
||||
|
||||
case 'p': player_action_ = Player_Play; break;
|
||||
case 't': player_action_ = Player_PlayPause; break;
|
||||
case 'u': player_action_ = Player_Pause; break;
|
||||
case 's': player_action_ = Player_Stop; break;
|
||||
case 'r': player_action_ = Player_Previous; break;
|
||||
case 'f': player_action_ = Player_Next; break;
|
||||
case 'a': url_list_action_ = UrlList_Append; break;
|
||||
case 'l': url_list_action_ = UrlList_Load; break;
|
||||
case 'o': show_osd_ = true; break;
|
||||
case 'g': language_ = QString(optarg); break;
|
||||
case VolumeUp: volume_modifier_ = +4; break;
|
||||
case VolumeDown: volume_modifier_ = -4; break;
|
||||
case 'p': player_action_ = Player_Play; break;
|
||||
case 't': player_action_ = Player_PlayPause; break;
|
||||
case 'u': player_action_ = Player_Pause; break;
|
||||
case 's': player_action_ = Player_Stop; break;
|
||||
case 'r': player_action_ = Player_Previous; break;
|
||||
case 'f': player_action_ = Player_Next; break;
|
||||
case 'a': url_list_action_ = UrlList_Append; break;
|
||||
case 'l': url_list_action_ = UrlList_Load; break;
|
||||
case 'o': show_osd_ = true; break;
|
||||
case 'g': language_ = QString(optarg); break;
|
||||
case VolumeUp: volume_modifier_ = +4; break;
|
||||
case VolumeDown: volume_modifier_ = -4; break;
|
||||
case Quiet: log_levels_ = "1"; break;
|
||||
case Verbose: log_levels_ = "3"; break;
|
||||
case LogLevels: log_levels_ = QString(optarg); break;
|
||||
|
||||
case 'v':
|
||||
set_volume_ = QString(optarg).toInt(&ok);
|
||||
@ -252,7 +266,8 @@ QDataStream& operator<<(QDataStream& s, const CommandlineOptions& a) {
|
||||
<< a.seek_by_
|
||||
<< a.play_track_at_
|
||||
<< a.show_osd_
|
||||
<< a.urls_;
|
||||
<< a.urls_
|
||||
<< a.log_levels_;
|
||||
|
||||
return s;
|
||||
}
|
||||
@ -268,7 +283,8 @@ QDataStream& operator>>(QDataStream& s, CommandlineOptions& a) {
|
||||
>> a.seek_by_
|
||||
>> a.play_track_at_
|
||||
>> a.show_osd_
|
||||
>> a.urls_;
|
||||
>> a.urls_
|
||||
>> a.log_levels_;
|
||||
a.player_action_ = CommandlineOptions::PlayerAction(player_action);
|
||||
a.url_list_action_ = CommandlineOptions::UrlListAction(url_list_action);
|
||||
|
||||
|
@ -66,6 +66,7 @@ class CommandlineOptions {
|
||||
bool show_osd() const { return show_osd_; }
|
||||
QList<QUrl> urls() const { return urls_; }
|
||||
QString language() const { return language_; }
|
||||
QString log_levels() const { return log_levels_; }
|
||||
|
||||
StunTestDirection stun_test() const { return stun_test_; }
|
||||
|
||||
@ -81,6 +82,9 @@ class CommandlineOptions {
|
||||
VolumeDown,
|
||||
SeekTo,
|
||||
SeekBy,
|
||||
Quiet,
|
||||
Verbose,
|
||||
LogLevels,
|
||||
};
|
||||
|
||||
QString tr(const char* source_text);
|
||||
@ -102,6 +106,7 @@ class CommandlineOptions {
|
||||
bool show_osd_;
|
||||
QString language_;
|
||||
StunTestDirection stun_test_;
|
||||
QString log_levels_;
|
||||
|
||||
QList<QUrl> urls_;
|
||||
};
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "config.h"
|
||||
#include "crashreporting.h"
|
||||
#include "core/logging.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDir>
|
||||
@ -106,7 +107,7 @@ CrashSender::CrashSender(const QString& path)
|
||||
|
||||
bool CrashSender::Start() {
|
||||
if (!file_->open(QIODevice::ReadOnly)) {
|
||||
qWarning() << "Failed to open crash report" << path_;
|
||||
qLog(Warning) << "Failed to open crash report" << path_;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "database.h"
|
||||
#include "scopedtransaction.h"
|
||||
#include "utilities.h"
|
||||
#include "core/logging.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QDir>
|
||||
@ -237,7 +238,7 @@ void Database::StaticInit() {
|
||||
|
||||
QLibrary library(plugin_path);
|
||||
if (!library.load()) {
|
||||
qDebug() << "QLibrary::load() failed for " << plugin_path;
|
||||
qLog(Error) << "QLibrary::load() failed for " << plugin_path;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -260,7 +261,7 @@ void Database::StaticInit() {
|
||||
!_sqlite3_value_text ||
|
||||
!_sqlite3_result_int64 ||
|
||||
!_sqlite3_user_data) {
|
||||
qDebug() << "Couldn't resolve sqlite symbols";
|
||||
qLog(Error) << "Couldn't resolve sqlite symbols";
|
||||
sLoadedSqliteSymbols = false;
|
||||
} else {
|
||||
sLoadedSqliteSymbols = true;
|
||||
@ -384,7 +385,7 @@ QSqlDatabase Database::Connect() {
|
||||
set_fts_tokenizer.bindValue(":pointer", QByteArray(
|
||||
reinterpret_cast<const char*>(&sFTSTokenizer), sizeof(&sFTSTokenizer)));
|
||||
if (!set_fts_tokenizer.exec()) {
|
||||
qWarning() << "Couldn't register FTS3 tokenizer";
|
||||
qLog(Warning) << "Couldn't register FTS3 tokenizer";
|
||||
}
|
||||
|
||||
// We want Unicode aware LIKE clauses and FTS if possible.
|
||||
@ -456,7 +457,7 @@ void Database::UpdateMainSchema(QSqlDatabase* db) {
|
||||
startup_schema_version_ = schema_version;
|
||||
|
||||
if (schema_version > kSchemaVersion) {
|
||||
qWarning() << "The database schema (version" << schema_version << ") is newer than I was expecting";
|
||||
qLog(Warning) << "The database schema (version" << schema_version << ") is newer than I was expecting";
|
||||
return;
|
||||
}
|
||||
if (schema_version < kSchemaVersion) {
|
||||
@ -469,7 +470,7 @@ void Database::UpdateMainSchema(QSqlDatabase* db) {
|
||||
|
||||
void Database::RecreateAttachedDb(const QString& database_name) {
|
||||
if (!attached_databases_.contains(database_name)) {
|
||||
qWarning() << "Attached database does not exist:" << database_name;
|
||||
qLog(Warning) << "Attached database does not exist:" << database_name;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -482,12 +483,12 @@ void Database::RecreateAttachedDb(const QString& database_name) {
|
||||
QSqlQuery q("DETACH DATABASE :alias", db);
|
||||
q.bindValue(":alias", database_name);
|
||||
if (!q.exec()) {
|
||||
qWarning() << "Failed to detach database" << database_name;
|
||||
qLog(Warning) << "Failed to detach database" << database_name;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!QFile::remove(filename)) {
|
||||
qWarning() << "Failed to remove file" << filename;
|
||||
qLog(Warning) << "Failed to remove file" << filename;
|
||||
}
|
||||
}
|
||||
|
||||
@ -533,7 +534,7 @@ void Database::ExecCommands(const QString &schema, QSqlDatabase &db) {
|
||||
// in the schema files to update all songs tables at once.
|
||||
if (command.contains(kMagicAllSongsTables)) {
|
||||
foreach (const QString& table, tables) {
|
||||
qDebug() << "Updating" << table << "for" << kMagicAllSongsTables;
|
||||
qLog(Info) << "Updating" << table << "for" << kMagicAllSongsTables;
|
||||
QString new_command(command);
|
||||
new_command.replace(kMagicAllSongsTables, table);
|
||||
QSqlQuery query(db.exec(new_command));
|
||||
@ -575,9 +576,9 @@ QStringList Database::SongsTables(QSqlDatabase& db) const {
|
||||
bool Database::CheckErrors(const QSqlQuery& query) {
|
||||
QSqlError last_error = query.lastError();
|
||||
if (last_error.isValid()) {
|
||||
qDebug() << "db error: " << last_error;
|
||||
qDebug() << "faulty query: " << query.lastQuery();
|
||||
qDebug() << "bound values: " << query.boundValues();
|
||||
qLog(Error) << "db error: " << last_error;
|
||||
qLog(Error) << "faulty query: " << query.lastQuery();
|
||||
qLog(Error) << "bound values: " << query.boundValues();
|
||||
|
||||
emit Error("LibraryBackend: " + last_error.text());
|
||||
return true;
|
||||
|
@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "encoding.h"
|
||||
#include "core/logging.h"
|
||||
|
||||
#include <QTextCodec>
|
||||
#include <QtDebug>
|
||||
@ -27,6 +28,7 @@
|
||||
#include <vorbisfile.h>
|
||||
#include <flacfile.h>
|
||||
|
||||
#include "core/logging.h"
|
||||
#include "engines/enginebase.h"
|
||||
|
||||
UniversalEncodingHandler::UniversalEncodingHandler()
|
||||
@ -91,7 +93,7 @@ QTextCodec* UniversalEncodingHandler::Guess(const char* data) {
|
||||
repeats = 0;
|
||||
}
|
||||
if (repeats > 3) {
|
||||
qWarning() << "Heuristic guessed windows-1251";
|
||||
qLog(Warning) << "Heuristic guessed windows-1251";
|
||||
current_codec_ = QTextCodec::codecForName("windows-1251");
|
||||
}
|
||||
}
|
||||
@ -154,7 +156,7 @@ QTextCodec* UniversalEncodingHandler::Guess(const TagLib::String& input) {
|
||||
return NULL;
|
||||
}
|
||||
if (input.isLatin1()) {
|
||||
qWarning() << "Extended ASCII... possibly should be CP866 or windows-1251 instead";
|
||||
qLog(Warning) << "Extended ASCII... possibly should be CP866 or windows-1251 instead";
|
||||
std::string broken = input.toCString(true);
|
||||
std::string fixed = QString::fromUtf8(broken.c_str()).toStdString();
|
||||
QTextCodec* codec = Guess(fixed.c_str());
|
||||
@ -181,16 +183,16 @@ QTextCodec* UniversalEncodingHandler::Guess(const Engine::SimpleMetaBundle& bund
|
||||
|
||||
QString UniversalEncodingHandler::FixEncoding(const TagLib::String& input) {
|
||||
if (input.isLatin1() && !input.isAscii()) {
|
||||
qWarning() << "Extended ASCII... possibly should be CP866 or windows-1251 instead";
|
||||
qLog(Warning) << "Extended ASCII... possibly should be CP866 or windows-1251 instead";
|
||||
std::string broken = input.toCString(true);
|
||||
std::string fixed;
|
||||
if (broken.size() > input.size()) {
|
||||
fixed = QString::fromUtf8(broken.c_str()).toStdString();
|
||||
QTextCodec* codec = Guess(fixed.c_str());
|
||||
if (!codec) {
|
||||
qDebug() << "Could not guess encoding. Using extended ASCII.";
|
||||
qLog(Debug) << "Could not guess encoding. Using extended ASCII.";
|
||||
} else {
|
||||
qDebug() << "Guessed:" << codec->name();
|
||||
qLog(Debug) << "Guessed:" << codec->name();
|
||||
QString foo = codec->toUnicode(fixed.c_str());
|
||||
return foo.trimmed();
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "core/logging.h"
|
||||
|
||||
#ifdef HAVE_GIO
|
||||
# include <gio/gio.h>
|
||||
@ -42,7 +43,7 @@ bool FilesystemMusicStorage::CopyToStorage(const CopyJob& job) {
|
||||
const QString dest_directory = dest_filename.section('/', 0, -2);
|
||||
QDir dir;
|
||||
if (!dir.mkpath(dest_directory)) {
|
||||
qWarning() << "Failed to create directory" << dest_directory;
|
||||
qLog(Warning) << "Failed to create directory" << dest_directory;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "gnomeglobalshortcutbackend.h"
|
||||
#include "globalshortcuts.h"
|
||||
#include "core/logging.h"
|
||||
|
||||
#ifdef QT_DBUS_LIB
|
||||
# include "dbus/gnomesettingsdaemon.h"
|
||||
@ -41,10 +42,10 @@ GnomeGlobalShortcutBackend::GnomeGlobalShortcutBackend(GlobalShortcuts* parent)
|
||||
|
||||
bool GnomeGlobalShortcutBackend::DoRegister() {
|
||||
#ifdef QT_DBUS_LIB
|
||||
qDebug() << __PRETTY_FUNCTION__ << "- starting";
|
||||
qLog(Debug) << "registering";
|
||||
// Check if the GSD service is available
|
||||
if (!QDBusConnection::sessionBus().interface()->isServiceRegistered(kGsdService)) {
|
||||
qDebug() << __PRETTY_FUNCTION__ << "- gnome settings daemon not registered";
|
||||
qLog(Warning) << "gnome settings daemon not registered";
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -56,17 +57,17 @@ bool GnomeGlobalShortcutBackend::DoRegister() {
|
||||
connect(interface_, SIGNAL(MediaPlayerKeyPressed(QString,QString)),
|
||||
this, SLOT(GnomeMediaKeyPressed(QString,QString)));
|
||||
|
||||
qDebug() << __PRETTY_FUNCTION__ << "- complete";
|
||||
qLog(Debug) << "registered";
|
||||
|
||||
return true;
|
||||
#else // QT_DBUS_LIB
|
||||
qDebug() << __PRETTY_FUNCTION__ << "- dbus not available";
|
||||
qLog(Warning) << "dbus not available";
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void GnomeGlobalShortcutBackend::DoUnregister() {
|
||||
qDebug() << __PRETTY_FUNCTION__;
|
||||
qLog(Debug) << "unregister";
|
||||
#ifdef QT_DBUS_LIB
|
||||
// Check if the GSD service is available
|
||||
if (!QDBusConnection::sessionBus().interface()->isServiceRegistered(kGsdService))
|
||||
|
176
src/core/logging.cpp
Normal file
176
src/core/logging.cpp
Normal file
@ -0,0 +1,176 @@
|
||||
/* This file is part of Clementine.
|
||||
Copyright 2010, David Sansome <me@davidsansome.com>
|
||||
|
||||
Clementine 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QDateTime>
|
||||
#include <QStringList>
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#include "logging.h"
|
||||
|
||||
|
||||
namespace logging {
|
||||
|
||||
static Level sDefaultLevel = Level_Debug;
|
||||
static QMap<QString, Level>* sClassLevels = NULL;
|
||||
static QIODevice* sNullDevice = NULL;
|
||||
|
||||
const char* kDefaultLogLevels = "GstEnginePipeline:2,*:3";
|
||||
|
||||
static const char* kMessageHandlerMagic = "__logging_message__";
|
||||
static const int kMessageHandlerMagicLength = strlen(kMessageHandlerMagic);
|
||||
static QtMsgHandler sOriginalMessageHandler = NULL;
|
||||
|
||||
|
||||
static void GLog(const gchar* domain, GLogLevelFlags level,
|
||||
const gchar* message, gpointer user_data) {
|
||||
switch (level) {
|
||||
case G_LOG_FLAG_RECURSION:
|
||||
case G_LOG_FLAG_FATAL:
|
||||
case G_LOG_LEVEL_ERROR:
|
||||
case G_LOG_LEVEL_CRITICAL: qLog(Error) << message; break;
|
||||
case G_LOG_LEVEL_WARNING: qLog(Warning) << message; break;
|
||||
case G_LOG_LEVEL_MESSAGE:
|
||||
case G_LOG_LEVEL_INFO: qLog(Info) << message; break;
|
||||
case G_LOG_LEVEL_DEBUG:
|
||||
default: qLog(Debug) << message; break;
|
||||
}
|
||||
}
|
||||
|
||||
static void MessageHandler(QtMsgType type, const char* message) {
|
||||
if (strncmp(kMessageHandlerMagic, message, kMessageHandlerMagicLength) == 0) {
|
||||
fprintf(stderr, "%s\n", message + kMessageHandlerMagicLength);
|
||||
return;
|
||||
}
|
||||
|
||||
Level level = Level_Debug;
|
||||
switch (type) {
|
||||
case QtFatalMsg:
|
||||
case QtCriticalMsg: level = Level_Error; break;
|
||||
case QtWarningMsg: level = Level_Warning; break;
|
||||
case QtDebugMsg:
|
||||
default: level = Level_Debug; break;
|
||||
}
|
||||
|
||||
foreach (const QString& line, QString::fromLocal8Bit(message).split('\n')) {
|
||||
CreateLogger(level, "unknown", -1) << line.toLocal8Bit().constData();
|
||||
}
|
||||
|
||||
if (type == QtFatalMsg) {
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Init() {
|
||||
delete sClassLevels;
|
||||
delete sNullDevice;
|
||||
|
||||
sClassLevels = new QMap<QString, Level>();
|
||||
sNullDevice = new NullDevice;
|
||||
|
||||
// Glib integration
|
||||
g_log_set_default_handler(&GLog, NULL);
|
||||
|
||||
// Catch other messages from Qt
|
||||
if (!sOriginalMessageHandler) {
|
||||
sOriginalMessageHandler = qInstallMsgHandler(MessageHandler);
|
||||
}
|
||||
}
|
||||
|
||||
void SetLevels(const QString& levels) {
|
||||
if (!sClassLevels)
|
||||
return;
|
||||
|
||||
foreach (const QString& item, levels.split(',')) {
|
||||
const QStringList class_level = item.split(':');
|
||||
|
||||
QString class_name;
|
||||
bool ok = false;
|
||||
int level = Level_Error;
|
||||
|
||||
if (class_level.count() == 1) {
|
||||
level = class_level.last().toInt(&ok);
|
||||
} else if (class_level.count() == 2) {
|
||||
class_name = class_level.first();
|
||||
level = class_level.last().toInt(&ok);
|
||||
}
|
||||
|
||||
if (!ok || level < Level_Error || level > Level_Debug) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (class_name.isEmpty() || class_name == "*") {
|
||||
sDefaultLevel = (Level) level;
|
||||
} else {
|
||||
sClassLevels->insert(class_name, (Level) level);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QDebug CreateLogger(Level level, const char* pretty_function, int line) {
|
||||
// Map the level to a string
|
||||
const char* level_name = NULL;
|
||||
switch (level) {
|
||||
case Level_Debug: level_name = " DEBUG "; break;
|
||||
case Level_Info: level_name = " INFO "; break;
|
||||
case Level_Warning: level_name = " WARN "; break;
|
||||
case Level_Error: level_name = " ERROR "; break;
|
||||
}
|
||||
|
||||
// Get the class name out of the function name.
|
||||
QString class_name = pretty_function;
|
||||
const int paren = class_name.indexOf('(');
|
||||
if (paren != -1) {
|
||||
const int colons = class_name.lastIndexOf("::", paren);
|
||||
if (colons != -1) {
|
||||
class_name = class_name.left(colons);
|
||||
} else {
|
||||
class_name = class_name.left(paren);
|
||||
}
|
||||
}
|
||||
|
||||
const int space = class_name.lastIndexOf(' ');
|
||||
if (space != -1) {
|
||||
class_name = class_name.mid(space+1);
|
||||
}
|
||||
|
||||
// Check the settings to see if we're meant to show or hide this message.
|
||||
Level threshold_level = sDefaultLevel;
|
||||
if (sClassLevels && sClassLevels->contains(class_name)) {
|
||||
threshold_level = sClassLevels->value(class_name);
|
||||
}
|
||||
|
||||
if (level > threshold_level) {
|
||||
return QDebug(sNullDevice);
|
||||
}
|
||||
|
||||
QString function_line = class_name;
|
||||
if (line != -1) {
|
||||
function_line += ":" + QString::number(line);
|
||||
}
|
||||
|
||||
QDebug ret(QtDebugMsg);
|
||||
ret.nospace() << kMessageHandlerMagic
|
||||
<< QDateTime::currentDateTime().toString("hh:mm:ss.zzz").toAscii().constData()
|
||||
<< level_name << function_line.leftJustified(32).toAscii().constData();
|
||||
|
||||
return ret.space();
|
||||
}
|
||||
|
||||
} // namespace logging
|
48
src/core/logging.h
Normal file
48
src/core/logging.h
Normal file
@ -0,0 +1,48 @@
|
||||
/* This file is part of Clementine.
|
||||
Copyright 2010, David Sansome <me@davidsansome.com>
|
||||
|
||||
Clementine 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef LOGGING_H
|
||||
#define LOGGING_H
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
#define qLog(level) \
|
||||
logging::CreateLogger(logging::Level_##level, __PRETTY_FUNCTION__, __LINE__)
|
||||
|
||||
namespace logging {
|
||||
class NullDevice : public QIODevice {
|
||||
protected:
|
||||
qint64 readData(char*, qint64) { return -1; }
|
||||
qint64 writeData(const char*, qint64 len) { return len; }
|
||||
};
|
||||
|
||||
enum Level {
|
||||
Level_Error = 0,
|
||||
Level_Warning,
|
||||
Level_Info,
|
||||
Level_Debug,
|
||||
};
|
||||
|
||||
void Init();
|
||||
void SetLevels(const QString& levels);
|
||||
|
||||
QDebug CreateLogger(Level level, const char* pretty_function, int line);
|
||||
|
||||
extern const char* kDefaultLogLevels;
|
||||
}
|
||||
|
||||
#endif // LOGGING_H
|
@ -38,6 +38,7 @@
|
||||
#include "mac_startup.h"
|
||||
#include "macglobalshortcutbackend.h"
|
||||
#include "utilities.h"
|
||||
#include "core/logging.h"
|
||||
|
||||
#ifdef HAVE_SPARKLE
|
||||
#import <Sparkle/SUUpdater.h>
|
||||
@ -285,7 +286,7 @@ bool MigrateLegacyConfigFiles() {
|
||||
toPath:[NSString stringWithUTF8String: new_config_dir.toUtf8().constData()]
|
||||
error: &error];
|
||||
if (!ret) {
|
||||
qWarning() << [[error localizedDescription] UTF8String];
|
||||
qLog(Warning) << [[error localizedDescription] UTF8String];
|
||||
}
|
||||
moved_dir = true;
|
||||
}
|
||||
@ -295,7 +296,7 @@ bool MigrateLegacyConfigFiles() {
|
||||
QSettings settings;
|
||||
bool ret = QFile::rename(old_config_path, settings.fileName());
|
||||
if (ret) {
|
||||
qWarning() << "Migrated old config file: " << old_config_path << "to: " << settings.fileName();
|
||||
qLog(Warning) << "Migrated old config file: " << old_config_path << "to: " << settings.fileName();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "mpris1.h"
|
||||
#include "mpris_common.h"
|
||||
#include "core/logging.h"
|
||||
#include "covers/artloader.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
@ -51,7 +52,7 @@ Mpris1::Mpris1(PlayerInterface* player, ArtLoader* art_loader, QObject* parent,
|
||||
}
|
||||
|
||||
if (!QDBusConnection::sessionBus().registerService(dbus_service_name_)) {
|
||||
qWarning() << "Failed to register" << dbus_service_name_ << "on the session bus";
|
||||
qLog(Warning) << "Failed to register" << dbus_service_name_ << "on the session bus";
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "mpris_common.h"
|
||||
#include "mpris1.h"
|
||||
#include "mpris2.h"
|
||||
#include "core/logging.h"
|
||||
#include "core/mpris2_player.h"
|
||||
#include "core/mpris2_root.h"
|
||||
#include "core/mpris2_tracklist.h"
|
||||
@ -55,7 +56,7 @@ Mpris2::Mpris2(PlayerInterface* player, ArtLoader* art_loader,
|
||||
new Mpris2Player(this);
|
||||
|
||||
if (!QDBusConnection::sessionBus().registerService(kServiceName)) {
|
||||
qWarning() << "Failed to register" << QString(kServiceName) << "on the session bus";
|
||||
qLog(Warning) << "Failed to register" << QString(kServiceName) << "on the session bus";
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "networkproxyfactory.h"
|
||||
#include "core/logging.h"
|
||||
|
||||
#include <QMutexLocker>
|
||||
#include <QSettings>
|
||||
@ -26,7 +27,7 @@ NetworkProxyFactory::NetworkProxyFactory()
|
||||
urls << QString::fromLocal8Bit(getenv("ALL_PROXY"));
|
||||
urls << QString::fromLocal8Bit(getenv("all_proxy"));
|
||||
|
||||
qDebug() << "Detected system proxy URLs:" << urls;
|
||||
qLog(Debug) << "Detected system proxy URLs:" << urls;
|
||||
|
||||
foreach (const QString& url_str, urls) {
|
||||
if (url_str.isEmpty())
|
||||
@ -85,7 +86,7 @@ QList<QNetworkProxy> NetworkProxyFactory::queryProxy(
|
||||
ret.setType(QNetworkProxy::HttpProxy);
|
||||
else
|
||||
ret.setType(QNetworkProxy::Socks5Proxy);
|
||||
qDebug() << "Using proxy URL:" << env_url_;
|
||||
qLog(Debug) << "Using proxy URL:" << env_url_;
|
||||
}
|
||||
break;
|
||||
#else
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "musicstorage.h"
|
||||
#include "organise.h"
|
||||
#include "taskmanager.h"
|
||||
#include "core/logging.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
@ -87,7 +88,7 @@ void Organise::ProcessSomeFiles() {
|
||||
if (tasks_pending_.isEmpty()) {
|
||||
if (!tasks_transcoding_.isEmpty()) {
|
||||
// Just wait - FileTranscoded will start us off again in a little while
|
||||
qDebug() << "Waiting for transcoding jobs";
|
||||
qLog(Debug) << "Waiting for transcoding jobs";
|
||||
transcode_progress_timer_.start(kTranscodeProgressInterval, this);
|
||||
return;
|
||||
}
|
||||
@ -120,7 +121,7 @@ void Organise::ProcessSomeFiles() {
|
||||
break;
|
||||
|
||||
Task task = tasks_pending_.takeFirst();
|
||||
qDebug() << "Processing" << task.filename_;
|
||||
qLog(Info) << "Processing" << task.filename_;
|
||||
|
||||
// Is it a directory?
|
||||
if (QFileInfo(task.filename_).isDir()) {
|
||||
@ -141,7 +142,7 @@ void Organise::ProcessSomeFiles() {
|
||||
|
||||
// Maybe this file is one that's been transcoded already?
|
||||
if (!task.transcoded_filename_.isEmpty()) {
|
||||
qDebug() << "This file has already been transcoded";
|
||||
qLog(Debug) << "This file has already been transcoded";
|
||||
|
||||
// Set the new filetype on the song so the formatter gets it right
|
||||
song.set_filetype(task.new_filetype_);
|
||||
@ -158,7 +159,7 @@ void Organise::ProcessSomeFiles() {
|
||||
if (dest_type != Song::Type_Unknown) {
|
||||
// Get the preset
|
||||
TranscoderPreset preset = Transcoder::PresetForFileType(dest_type);
|
||||
qDebug() << "Transcoding with" << preset.name_;
|
||||
qLog(Debug) << "Transcoding with" << preset.name_;
|
||||
|
||||
// Get a temporary name for the transcoded file
|
||||
task.transcoded_filename_ = transcode_temp_name_.fileName() + "-" +
|
||||
@ -167,7 +168,7 @@ void Organise::ProcessSomeFiles() {
|
||||
task.new_filetype_ = dest_type;
|
||||
tasks_transcoding_[task.filename_] = task;
|
||||
|
||||
qDebug() << "Transcoding to" << task.transcoded_filename_;
|
||||
qLog(Debug) << "Transcoding to" << task.transcoded_filename_;
|
||||
|
||||
// Start the transcoding - this will happen in the background and
|
||||
// FileTranscoded() will get called when it's done. At that point the
|
||||
@ -271,7 +272,7 @@ void Organise::UpdateProgress() {
|
||||
}
|
||||
|
||||
void Organise::FileTranscoded(const QString& filename, bool success) {
|
||||
qDebug() << "File finished" << filename << success;
|
||||
qLog(Info) << "File finished" << filename << success;
|
||||
transcode_progress_timer_.stop();
|
||||
|
||||
Task task = tasks_transcoding_.take(filename);
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "config.h"
|
||||
#include "player.h"
|
||||
#include "core/logging.h"
|
||||
#include "engines/enginebase.h"
|
||||
#include "engines/gstengine.h"
|
||||
#include "library/librarybackend.h"
|
||||
@ -299,7 +300,7 @@ void Player::SeekTo(int seconds) {
|
||||
engine_->Seek(nanosec);
|
||||
|
||||
// If we seek the track we don't want to submit it to last.fm
|
||||
qDebug() << "Track seeked to" << nanosec << "ns - not scrobbling";
|
||||
qLog(Info) << "Track seeked to" << nanosec << "ns - not scrobbling";
|
||||
if (playlists_->active()->get_lastfm_status() == Playlist::LastFM_New) {
|
||||
playlists_->active()->set_lastfm_status(Playlist::LastFM_Seeked);
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "globalshortcuts.h"
|
||||
#include "qxtglobalshortcutbackend.h"
|
||||
#include "qxtglobalshortcut.h"
|
||||
#include "core/logging.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QtDebug>
|
||||
@ -28,7 +29,7 @@ QxtGlobalShortcutBackend::QxtGlobalShortcutBackend(GlobalShortcuts *parent)
|
||||
}
|
||||
|
||||
bool QxtGlobalShortcutBackend::DoRegister() {
|
||||
qDebug() << __PRETTY_FUNCTION__;
|
||||
qLog(Debug) << "registering";
|
||||
foreach (const GlobalShortcuts::Shortcut& shortcut, manager_->shortcuts().values()) {
|
||||
AddShortcut(shortcut.action);
|
||||
}
|
||||
@ -46,7 +47,7 @@ void QxtGlobalShortcutBackend::AddShortcut(QAction* action) {
|
||||
}
|
||||
|
||||
void QxtGlobalShortcutBackend::DoUnregister() {
|
||||
qDebug() << __PRETTY_FUNCTION__;
|
||||
qLog(Debug) << "unregistering";
|
||||
qDeleteAll(shortcuts_);
|
||||
shortcuts_.clear();
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "scopedtransaction.h"
|
||||
#include "core/logging.h"
|
||||
|
||||
#include <QSqlDatabase>
|
||||
#include <QtDebug>
|
||||
@ -29,14 +30,14 @@ ScopedTransaction::ScopedTransaction(QSqlDatabase* db)
|
||||
|
||||
ScopedTransaction::~ScopedTransaction() {
|
||||
if (pending_) {
|
||||
qDebug() << __PRETTY_FUNCTION__ << "Rolling back transaction";
|
||||
qLog(Warning) << "Rolling back transaction";
|
||||
db_->rollback();
|
||||
}
|
||||
}
|
||||
|
||||
void ScopedTransaction::Commit() {
|
||||
if (!pending_) {
|
||||
qWarning() << "Tried to commit a ScopedTransaction twice";
|
||||
qLog(Warning) << "Tried to commit a ScopedTransaction twice";
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "fmpsparser.h"
|
||||
#include "song.h"
|
||||
#include "core/logging.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@ -248,7 +249,7 @@ QString Song::Decode(const QString& tag, const QTextCodec* codec) {
|
||||
bool Song::HasProperMediaFile() const {
|
||||
#ifndef QT_NO_DEBUG_OUTPUT
|
||||
if (qApp->thread() == QThread::currentThread())
|
||||
qWarning() << Q_FUNC_INFO << "on GUI thread!";
|
||||
qLog(Warning) << "HasProperMediaFile() on GUI thread!";
|
||||
#endif
|
||||
|
||||
QMutexLocker l(&taglib_mutex_);
|
||||
@ -260,7 +261,7 @@ bool Song::HasProperMediaFile() const {
|
||||
void Song::InitFromFile(const QString& filename, int directory_id) {
|
||||
#ifndef QT_NO_DEBUG_OUTPUT
|
||||
if (qApp->thread() == QThread::currentThread())
|
||||
qWarning() << Q_FUNC_INFO << "on GUI thread!";
|
||||
qLog(Warning) << "InitFromFile() on GUI thread!";
|
||||
#endif
|
||||
|
||||
d->init_from_file_ = true;
|
||||
@ -764,7 +765,7 @@ void Song::InitFromLastFM(const lastfm::Track& track) {
|
||||
break;
|
||||
}
|
||||
default:
|
||||
qWarning() << "Type" << value.type() << "not handled";
|
||||
qLog(Warning) << "Type" << value.type() << "not handled";
|
||||
Q_ASSERT(0);
|
||||
break;
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "songloader.h"
|
||||
#include "core/logging.h"
|
||||
#include "core/song.h"
|
||||
#include "library/librarybackend.h"
|
||||
#include "library/sqlrow.h"
|
||||
@ -83,7 +84,7 @@ SongLoader::Result SongLoader::Load(const QUrl& url) {
|
||||
}
|
||||
|
||||
SongLoader::Result SongLoader::LoadLocalPartial(const QString& filename) {
|
||||
qDebug() << "Fast Loading local file" << filename;
|
||||
qLog(Debug) << "Fast Loading local file" << filename;
|
||||
// First check to see if it's a directory - if so we can load all the songs
|
||||
// inside right away.
|
||||
if (QFileInfo(filename).isDir()) {
|
||||
@ -99,7 +100,7 @@ SongLoader::Result SongLoader::LoadLocalPartial(const QString& filename) {
|
||||
|
||||
SongLoader::Result SongLoader::LoadLocal(const QString& filename, bool block,
|
||||
bool ignore_playlists) {
|
||||
qDebug() << "Loading local file" << filename;
|
||||
qLog(Debug) << "Loading local file" << filename;
|
||||
|
||||
// First check to see if it's a directory - if so we can load all the songs
|
||||
// inside right away.
|
||||
@ -129,11 +130,11 @@ SongLoader::Result SongLoader::LoadLocal(const QString& filename, bool block,
|
||||
|
||||
if (parser) {
|
||||
if (ignore_playlists) {
|
||||
qDebug() << "Skipping" << parser->name() << "playlist while loading directory";
|
||||
qLog(Debug) << "Skipping" << parser->name() << "playlist while loading directory";
|
||||
return Success;
|
||||
}
|
||||
|
||||
qDebug() << "Parsing using" << parser->name();
|
||||
qLog(Debug) << "Parsing using" << parser->name();
|
||||
|
||||
// It's a playlist!
|
||||
if (!block) {
|
||||
@ -275,14 +276,14 @@ void SongLoader::StopTypefind() {
|
||||
timeout_timer_->stop();
|
||||
|
||||
if (success_ && parser_) {
|
||||
qDebug() << "Parsing" << url_ << "with" << parser_->name();
|
||||
qLog(Debug) << "Parsing" << url_ << "with" << parser_->name();
|
||||
|
||||
// Parse the playlist
|
||||
QBuffer buf(&buffer_);
|
||||
buf.open(QIODevice::ReadOnly);
|
||||
songs_ = parser_->Load(&buf);
|
||||
} else if (success_) {
|
||||
qDebug() << "Loading" << url_ << "as raw stream";
|
||||
qLog(Debug) << "Loading" << url_ << "as raw stream";
|
||||
|
||||
// It wasn't a playlist - just put the URL in as a stream
|
||||
AddAsRawStream();
|
||||
@ -292,7 +293,7 @@ void SongLoader::StopTypefind() {
|
||||
}
|
||||
|
||||
SongLoader::Result SongLoader::LoadRemote() {
|
||||
qDebug() << "Loading remote file" << url_;
|
||||
qLog(Debug) << "Loading remote file" << url_;
|
||||
|
||||
// It's not a local file so we have to fetch it to see what it is. We use
|
||||
// gstreamer to do this since it handles funky URLs for us (http://, ssh://,
|
||||
@ -312,7 +313,7 @@ SongLoader::Result SongLoader::LoadRemote() {
|
||||
GstElement* source = gst_element_make_from_uri(
|
||||
GST_URI_SRC, url_.toEncoded().constData(), NULL);
|
||||
if (!source) {
|
||||
qWarning() << "Couldn't create gstreamer source element for" << url_.toString();
|
||||
qLog(Warning) << "Couldn't create gstreamer source element for" << url_.toString();
|
||||
return Error;
|
||||
}
|
||||
|
||||
@ -348,7 +349,7 @@ void SongLoader::TypeFound(GstElement*, uint, GstCaps* caps, void* self) {
|
||||
|
||||
// Check the mimetype
|
||||
instance->mime_type_ = gst_structure_get_name(gst_caps_get_structure(caps, 0));
|
||||
qDebug() << "Mime type is" << instance->mime_type_;
|
||||
qLog(Debug) << "Mime type is" << instance->mime_type_;
|
||||
if (instance->mime_type_ == "text/plain" ||
|
||||
instance->mime_type_ == "text/uri-list" ||
|
||||
instance->mime_type_ == "application/xml") {
|
||||
@ -370,7 +371,7 @@ void SongLoader::DataReady(GstPad *, GstBuffer *buf, void *self) {
|
||||
// Append the data to the buffer
|
||||
instance->buffer_.append(reinterpret_cast<const char*>(GST_BUFFER_DATA(buf)),
|
||||
GST_BUFFER_SIZE(buf));
|
||||
qDebug() << "Received total" << instance->buffer_.size() << "bytes";
|
||||
qLog(Debug) << "Received total" << instance->buffer_.size() << "bytes";
|
||||
|
||||
if (instance->state_ == WaitingForMagic &&
|
||||
instance->buffer_.size() >= PlaylistParser::kMagicSize) {
|
||||
@ -419,8 +420,8 @@ void SongLoader::ErrorMessageReceived(GstMessage* msg) {
|
||||
gchar* debugs;
|
||||
|
||||
gst_message_parse_error(msg, &error, &debugs);
|
||||
qDebug() << error->message;
|
||||
qDebug() << debugs;
|
||||
qLog(Error) << error->message;
|
||||
qLog(Error) << debugs;
|
||||
|
||||
QString message_str = error->message;
|
||||
|
||||
@ -466,7 +467,7 @@ void SongLoader::MagicReady() {
|
||||
parser_ = playlist_parser_->ParserForMagic(buffer_, mime_type_);
|
||||
|
||||
if (!parser_) {
|
||||
qWarning() << url_.toString() << "is text, but not a recognised playlist";
|
||||
qLog(Warning) << url_.toString() << "is text, but not a recognised playlist";
|
||||
// It doesn't look like a playlist, so just finish
|
||||
StopTypefindAsync(false);
|
||||
return;
|
||||
@ -474,7 +475,7 @@ void SongLoader::MagicReady() {
|
||||
|
||||
// It is a playlist - we'll get more data and parse the whole thing in
|
||||
// EndOfStreamReached
|
||||
qDebug() << "Magic says" << parser_->name();
|
||||
qLog(Debug) << "Magic says" << parser_->name();
|
||||
if (parser_->name() == "ASX/INI" && url_.scheme() == "http") {
|
||||
// This is actually a weird MS-WMSP stream. Changing the protocol to MMS from
|
||||
// HTTP makes it playable.
|
||||
|
@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "stylesheetloader.h"
|
||||
#include "core/logging.h"
|
||||
|
||||
#include <QtDebug>
|
||||
#include <QFile>
|
||||
@ -38,7 +39,7 @@ void StyleSheetLoader::UpdateStyleSheet(QWidget *widget) {
|
||||
// Load the file
|
||||
QFile file(filename);
|
||||
if (!file.open(QIODevice::ReadOnly)) {
|
||||
qWarning() << __PRETTY_FUNCTION__ << "error opening" << filename;
|
||||
qLog(Warning) << "error opening" << filename;
|
||||
return;
|
||||
}
|
||||
QString contents(file.readAll());
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "timeconstants.h"
|
||||
#include "utilities.h"
|
||||
#include "core/logging.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QDateTime>
|
||||
@ -189,14 +190,14 @@ bool CopyRecursive(const QString& source, const QString& destination) {
|
||||
QDir dir(source);
|
||||
foreach (const QString& child, dir.entryList(QDir::NoDotAndDotDot | QDir::Dirs)) {
|
||||
if (!CopyRecursive(source + "/" + child, dest_path)) {
|
||||
qWarning() << "Failed to copy dir" << source + "/" + child << "to" << dest_path;
|
||||
qLog(Warning) << "Failed to copy dir" << source + "/" + child << "to" << dest_path;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (const QString& child, dir.entryList(QDir::NoDotAndDotDot | QDir::Files)) {
|
||||
if (!QFile::copy(source + "/" + child, dest_path + "/" + child)) {
|
||||
qWarning() << "Failed to copy file" << source + "/" + child << "to" << dest_path;
|
||||
qLog(Warning) << "Failed to copy file" << source + "/" + child << "to" << dest_path;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "devicelister.h"
|
||||
#include "devicemanager.h"
|
||||
#include "core/database.h"
|
||||
#include "core/logging.h"
|
||||
#include "library/library.h"
|
||||
#include "library/librarybackend.h"
|
||||
#include "library/librarymodel.h"
|
||||
@ -39,7 +40,7 @@ ConnectedDevice::ConnectedDevice(const QUrl& url, DeviceLister* lister,
|
||||
model_(NULL),
|
||||
song_count_(0)
|
||||
{
|
||||
qDebug() << __PRETTY_FUNCTION__;
|
||||
qLog(Info) << "connected" << url << unique_id << first_time;
|
||||
|
||||
// Create the backend in the database thread.
|
||||
backend_ = new LibraryBackend();
|
||||
@ -77,7 +78,7 @@ void ConnectedDevice::InitBackendDirectory(
|
||||
Directory dir = backend_->GetAllDirectories()[0];
|
||||
if (dir.path != mount_point) {
|
||||
// The directory is different, commence the munging.
|
||||
qDebug() << "Changing path from" << dir.path << "to" << mount_point;
|
||||
qLog(Info) << "Changing path from" << dir.path << "to" << mount_point;
|
||||
backend_->ChangeDirPath(dir.id, mount_point);
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "config.h"
|
||||
#include "devicekitlister.h"
|
||||
#include "filesystemdevice.h"
|
||||
#include "core/logging.h"
|
||||
#include "core/utilities.h"
|
||||
#include "dbus/udisks.h"
|
||||
#include "dbus/udisksdevice.h"
|
||||
@ -52,7 +53,7 @@ void DeviceKitLister::Init() {
|
||||
reply.waitForFinished();
|
||||
|
||||
if (!reply.isValid()) {
|
||||
qWarning() << "Error enumerating DeviceKit-disks devices:" << reply.error().name() << reply.error().message();
|
||||
qLog(Warning) << "Error enumerating DeviceKit-disks devices:" << reply.error().name() << reply.error().message();
|
||||
interface_.reset();
|
||||
return;
|
||||
}
|
||||
@ -149,7 +150,7 @@ DeviceKitLister::DeviceData DeviceKitLister::ReadDeviceData(
|
||||
OrgFreedesktopUDisksInterface::staticInterfaceName(),
|
||||
path.path(), QDBusConnection::systemBus());
|
||||
if (!device.isValid()) {
|
||||
qWarning() << "Error connecting to the device interface on" << path.path();
|
||||
qLog(Warning) << "Error connecting to the device interface on" << path.path();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -251,7 +252,7 @@ void DeviceKitLister::UnmountDevice(const QString& id) {
|
||||
OrgFreedesktopUDisksInterface::staticInterfaceName(),
|
||||
path, QDBusConnection::systemBus());
|
||||
if (!device.isValid()) {
|
||||
qWarning() << "Error connecting to the device interface on" << path;
|
||||
qLog(Warning) << "Error connecting to the device interface on" << path;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -261,7 +262,7 @@ void DeviceKitLister::UnmountDevice(const QString& id) {
|
||||
OrgFreedesktopUDisksInterface::staticInterfaceName(),
|
||||
drive_path, QDBusConnection::systemBus());
|
||||
if (!drive.isValid()) {
|
||||
qWarning() << "Error connecting to the drive interface on" << drive_path;
|
||||
qLog(Warning) << "Error connecting to the drive interface on" << drive_path;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -183,9 +183,6 @@ QStringList DeviceLister::GuessIconForPath(const QString& path) {
|
||||
Itdb_Device* device = itdb_device_new();
|
||||
itdb_device_set_mountpoint(device, path.toLocal8Bit().constData());
|
||||
const Itdb_IpodInfo* info = itdb_device_get_ipod_info(device);
|
||||
qDebug() << info->model_number
|
||||
<< info->ipod_model
|
||||
<< GetIpodColour(info->ipod_model);
|
||||
|
||||
QString colour = GetIpodColour(info->ipod_model);
|
||||
QString model = GetIpodModel(info->ipod_model);
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "devicemanager.h"
|
||||
#include "devicestatefiltermodel.h"
|
||||
#include "filesystemdevice.h"
|
||||
#include "core/logging.h"
|
||||
#include "core/musicstorage.h"
|
||||
#include "core/taskmanager.h"
|
||||
#include "core/utilities.h"
|
||||
@ -389,7 +390,7 @@ int DeviceManager::FindDeviceByUrl(const QList<QUrl>& urls) const {
|
||||
void DeviceManager::PhysicalDeviceAdded(const QString &id) {
|
||||
DeviceLister* lister = qobject_cast<DeviceLister*>(sender());
|
||||
|
||||
qDebug() << "Device added:" << id;
|
||||
qLog(Info) << "Device added:" << id;
|
||||
|
||||
// Do we have this device already?
|
||||
int i = FindDeviceById(id);
|
||||
@ -438,7 +439,7 @@ void DeviceManager::PhysicalDeviceAdded(const QString &id) {
|
||||
void DeviceManager::PhysicalDeviceRemoved(const QString &id) {
|
||||
DeviceLister* lister = qobject_cast<DeviceLister*>(sender());
|
||||
|
||||
qDebug() << "Device removed:" << id;
|
||||
qLog(Info) << "Device removed:" << id;
|
||||
|
||||
int i = FindDeviceById(id);
|
||||
if (i == -1) {
|
||||
@ -533,7 +534,7 @@ boost::shared_ptr<ConnectedDevice> DeviceManager::Connect(int row) {
|
||||
// Take the first URL that we have a handler for
|
||||
QUrl device_url;
|
||||
foreach (const QUrl& url, urls) {
|
||||
qDebug() << "Connecting" << url;
|
||||
qLog(Info) << "Connecting" << url;
|
||||
|
||||
// Find a device class for this URL's scheme
|
||||
if (device_classes_.contains(url.scheme())) {
|
||||
@ -578,7 +579,7 @@ boost::shared_ptr<ConnectedDevice> DeviceManager::Connect(int row) {
|
||||
ret.reset(static_cast<ConnectedDevice*>(instance));
|
||||
|
||||
if (!ret) {
|
||||
qWarning() << "Could not create device for" << device_url.toString();
|
||||
qLog(Warning) << "Could not create device for" << device_url.toString();
|
||||
} else {
|
||||
ret->Init();
|
||||
|
||||
|
@ -67,5 +67,4 @@ void FilesystemDevice::Init() {
|
||||
}
|
||||
|
||||
FilesystemDevice::~FilesystemDevice() {
|
||||
qDebug() << __PRETTY_FUNCTION__;
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "config.h"
|
||||
#include "giolister.h"
|
||||
#include "core/logging.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QStringList>
|
||||
@ -56,7 +57,7 @@ void OperationFinished(F f, GObject *object, GAsyncResult *result) {
|
||||
f(obj, result, &error);
|
||||
|
||||
if (error) {
|
||||
qDebug() << "Mount/unmount error:" << error->message;
|
||||
qLog(Error) << "Mount/unmount error:" << error->message;
|
||||
g_error_free(error);
|
||||
}
|
||||
}
|
||||
@ -368,7 +369,7 @@ void GioLister::DeviceInfo::ReadMountInfo(GMount* mount) {
|
||||
G_FILE_ATTRIBUTE_FILESYSTEM_SIZE "," G_FILE_ATTRIBUTE_FILESYSTEM_FREE ","
|
||||
G_FILE_ATTRIBUTE_FILESYSTEM_TYPE, NULL, &error);
|
||||
if (error) {
|
||||
qWarning() << error->message;
|
||||
qLog(Warning) << error->message;
|
||||
g_error_free(error);
|
||||
} else {
|
||||
filesystem_size = g_file_info_get_attribute_uint64(
|
||||
@ -387,7 +388,7 @@ void GioLister::DeviceInfo::ReadMountInfo(GMount* mount) {
|
||||
info = g_file_query_info(root, G_FILE_ATTRIBUTE_ID_FILESYSTEM,
|
||||
G_FILE_QUERY_INFO_NONE, NULL, &error);
|
||||
if (error) {
|
||||
qWarning() << error->message;
|
||||
qLog(Warning) << error->message;
|
||||
g_error_free(error);
|
||||
} else {
|
||||
mount_uuid = QString::fromUtf8(g_file_info_get_attribute_string(
|
||||
@ -498,7 +499,7 @@ void GioLister::UpdateDeviceFreeSpace(const QString& id) {
|
||||
GFileInfo* info = g_file_query_filesystem_info(
|
||||
root, G_FILE_ATTRIBUTE_FILESYSTEM_FREE, NULL, &error);
|
||||
if (error) {
|
||||
qWarning() << error->message;
|
||||
qLog(Warning) << error->message;
|
||||
g_error_free(error);
|
||||
} else {
|
||||
device_info.filesystem_free = g_file_info_get_attribute_uint64(
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "devicemanager.h"
|
||||
#include "gpoddevice.h"
|
||||
#include "gpodloader.h"
|
||||
#include "core/logging.h"
|
||||
#include "library/librarybackend.h"
|
||||
#include "library/librarymodel.h"
|
||||
|
||||
@ -114,7 +115,7 @@ bool GPodDevice::CopyToStorage(const CopyJob& job) {
|
||||
itdb_cp_track_to_ipod(track, QDir::toNativeSeparators(job.source_)
|
||||
.toLocal8Bit().constData(), &error);
|
||||
if (error) {
|
||||
qDebug() << "GPodDevice error:" << error->message;
|
||||
qLog(Error) << "copying failed:" << error->message;
|
||||
emit Error(QString::fromUtf8(error->message));
|
||||
g_error_free(error);
|
||||
|
||||
@ -139,7 +140,7 @@ void GPodDevice::WriteDatabase(bool success) {
|
||||
GError* error = NULL;
|
||||
itdb_write(db_, &error);
|
||||
if (error) {
|
||||
qDebug() << "GPodDevice error:" << error->message;
|
||||
qLog(Error) << "writing database failed:" << error->message;
|
||||
emit Error(QString::fromUtf8(error->message));
|
||||
g_error_free(error);
|
||||
} else {
|
||||
@ -186,7 +187,7 @@ bool GPodDevice::RemoveTrackFromITunesDb(const QString& path, const QString& rel
|
||||
}
|
||||
|
||||
if (track == NULL) {
|
||||
qWarning() << "Couldn't find song" << path << "in iTunesDB";
|
||||
qLog(Warning) << "Couldn't find song" << path << "in iTunesDB";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "connecteddevice.h"
|
||||
#include "gpodloader.h"
|
||||
#include "core/logging.h"
|
||||
#include "core/song.h"
|
||||
#include "core/taskmanager.h"
|
||||
#include "library/librarybackend.h"
|
||||
@ -53,7 +54,7 @@ void GPodLoader::LoadDatabase() {
|
||||
// Check for errors
|
||||
if (!db) {
|
||||
if (error) {
|
||||
qDebug() << "GPodLoader error:" << error->message;
|
||||
qLog(Error) << "loading database failed:" << error->message;
|
||||
emit Error(QString::fromUtf8(error->message));
|
||||
g_error_free(error);
|
||||
} else {
|
||||
|
@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "imobiledeviceconnection.h"
|
||||
#include "core/logging.h"
|
||||
|
||||
#include <plist/plist.h>
|
||||
|
||||
@ -26,7 +27,7 @@ iMobileDeviceConnection::iMobileDeviceConnection(const QString& uuid)
|
||||
: device_(NULL), afc_(NULL), afc_port_(0) {
|
||||
idevice_error_t err = idevice_new(&device_, uuid.toUtf8().constData());
|
||||
if (err != IDEVICE_E_SUCCESS) {
|
||||
qWarning() << "idevice error:" << err;
|
||||
qLog(Warning) << "idevice error:" << err;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -37,20 +38,20 @@ iMobileDeviceConnection::iMobileDeviceConnection(const QString& uuid)
|
||||
lockdownd_error_t lockdown_err =
|
||||
lockdownd_client_new_with_handshake(device_, &lockdown, label);
|
||||
if (lockdown_err != LOCKDOWN_E_SUCCESS) {
|
||||
qWarning() << "lockdown error:" << lockdown_err;
|
||||
qLog(Warning) << "lockdown error:" << lockdown_err;
|
||||
return;
|
||||
}
|
||||
|
||||
lockdown_err = lockdownd_start_service(lockdown, "com.apple.afc", &afc_port_);
|
||||
if (lockdown_err != LOCKDOWN_E_SUCCESS) {
|
||||
qWarning() << "lockdown error:" << lockdown_err;
|
||||
qLog(Warning) << "lockdown error:" << lockdown_err;
|
||||
lockdownd_client_free(lockdown);
|
||||
return;
|
||||
}
|
||||
|
||||
afc_error_t afc_err = afc_client_new(device_, afc_port_, &afc_);
|
||||
if (afc_err != 0) {
|
||||
qWarning() << "afc error:" << afc_err;
|
||||
qLog(Warning) << "afc error:" << afc_err;
|
||||
lockdownd_client_free(lockdown);
|
||||
return;
|
||||
}
|
||||
@ -82,7 +83,7 @@ QVariant iMobileDeviceConnection::GetProperty(const QString& property, const QSt
|
||||
lockdownd_error_t lockdown_err =
|
||||
lockdownd_client_new_with_handshake(device_, &lockdown, label);
|
||||
if (lockdown_err != LOCKDOWN_E_SUCCESS) {
|
||||
qWarning() << "lockdown error:" << lockdown_err;
|
||||
qLog(Warning) << "lockdown error:" << lockdown_err;
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
@ -94,7 +95,7 @@ QVariant iMobileDeviceConnection::GetProperty(const QString& property, const QSt
|
||||
lockdownd_client_free(lockdown);
|
||||
|
||||
if (!node) {
|
||||
qWarning() << "get_value failed" << property << domain;
|
||||
qLog(Warning) << "get_value failed" << property << domain;
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
@ -113,7 +114,7 @@ QVariant iMobileDeviceConnection::GetProperty(const QString& property, const QSt
|
||||
}
|
||||
|
||||
default:
|
||||
qWarning() << "Unhandled PList type";
|
||||
qLog(Warning) << "Unhandled PList type";
|
||||
return QVariant();
|
||||
}
|
||||
}
|
||||
@ -199,7 +200,7 @@ QString iMobileDeviceConnection::GetUnusedFilename(
|
||||
}
|
||||
|
||||
if (total_musicdirs <= 0) {
|
||||
qWarning() << "No 'F..'' directories found on iPod";
|
||||
qLog(Warning) << "No 'F..'' directories found on iPod";
|
||||
return QString();
|
||||
}
|
||||
|
||||
@ -209,7 +210,7 @@ QString iMobileDeviceConnection::GetUnusedFilename(
|
||||
dir.sprintf("/iTunes_Control/Music/F%02d", dir_num);
|
||||
|
||||
if (!Exists(dir)) {
|
||||
qWarning() << "Music directory doesn't exist:" << dir;
|
||||
qLog(Warning) << "Music directory doesn't exist:" << dir;
|
||||
return QString();
|
||||
}
|
||||
|
||||
|
@ -16,8 +16,8 @@
|
||||
*/
|
||||
|
||||
#include "macdevicelister.h"
|
||||
|
||||
#include "mtpconnection.h"
|
||||
#include "core/logging.h"
|
||||
|
||||
#include <CoreFoundation/CFRunLoop.h>
|
||||
#include <DiskArbitration/DiskArbitration.h>
|
||||
@ -93,7 +93,7 @@ void MacDeviceLister::Init() {
|
||||
LIBMTP_device_entry_t* devices = NULL;
|
||||
int num = 0;
|
||||
if (LIBMTP_Get_Supported_Devices_List(&devices, &num) != 0) {
|
||||
qWarning() << "Failed to get MTP device list";
|
||||
qLog(Warning) << "Failed to get MTP device list";
|
||||
} else {
|
||||
for (int i = 0; i < num; ++i) {
|
||||
LIBMTP_device_entry_t device = devices[i];
|
||||
@ -143,7 +143,7 @@ void MacDeviceLister::Init() {
|
||||
if (err == KERN_SUCCESS) {
|
||||
USBDeviceAddedCallback(this, it);
|
||||
} else {
|
||||
qWarning() << "Could not add notification on USB device connection";
|
||||
qLog(Warning) << "Could not add notification on USB device connection";
|
||||
}
|
||||
|
||||
err = IOServiceAddMatchingNotification(
|
||||
@ -156,7 +156,7 @@ void MacDeviceLister::Init() {
|
||||
if (err == KERN_SUCCESS) {
|
||||
USBDeviceRemovedCallback(this, it);
|
||||
} else {
|
||||
qWarning() << "Could not add notification USB device removal";
|
||||
qLog(Warning) << "Could not add notification USB device removal";
|
||||
}
|
||||
|
||||
CFRunLoopSourceRef io_source = IONotificationPortGetRunLoopSource(notification_port);
|
||||
@ -303,7 +303,7 @@ quint64 MacDeviceLister::GetFreeSpace(const QUrl& url) {
|
||||
QMutexLocker l(&libmtp_mutex_);
|
||||
MtpConnection connection(url);
|
||||
if (!connection.is_valid()) {
|
||||
qWarning() << "Error connecting to MTP device, couldn't get device free space";
|
||||
qLog(Warning) << "Error connecting to MTP device, couldn't get device free space";
|
||||
return -1;
|
||||
}
|
||||
LIBMTP_devicestorage_t* storage = connection.device()->storage;
|
||||
@ -319,7 +319,7 @@ quint64 MacDeviceLister::GetCapacity(const QUrl& url) {
|
||||
QMutexLocker l(&libmtp_mutex_);
|
||||
MtpConnection connection(url);
|
||||
if (!connection.is_valid()) {
|
||||
qWarning() << "Error connecting to MTP device, couldn't get device capacity";
|
||||
qLog(Warning) << "Error connecting to MTP device, couldn't get device capacity";
|
||||
return -1;
|
||||
}
|
||||
LIBMTP_devicestorage_t* storage = connection.device()->storage;
|
||||
@ -794,7 +794,7 @@ void MacDeviceLister::UnmountDevice(const QString& serial) {
|
||||
void MacDeviceLister::DiskUnmountCallback(
|
||||
DADiskRef disk, DADissenterRef dissenter, void* context) {
|
||||
if (dissenter) {
|
||||
qWarning() << "Another app blocked the unmount";
|
||||
qLog(Warning) << "Another app blocked the unmount";
|
||||
} else {
|
||||
DiskRemovedCallback(disk, context);
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "mtpconnection.h"
|
||||
#include "core/logging.h"
|
||||
|
||||
#include <QRegExp>
|
||||
#include <QtDebug>
|
||||
@ -28,7 +29,7 @@ MtpConnection::MtpConnection(const QUrl& url)
|
||||
QRegExp host_re("^usb-(\\d+)-(\\d+)$");
|
||||
|
||||
if (host_re.indexIn(hostname) == -1) {
|
||||
qWarning() << "Invalid MTP device:" << hostname;
|
||||
qLog(Warning) << "Invalid MTP device:" << hostname;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -55,7 +56,7 @@ MtpConnection::MtpConnection(const QUrl& url)
|
||||
LIBMTP_raw_device_t* raw_devices = NULL;
|
||||
LIBMTP_error_number_t err = LIBMTP_Detect_Raw_Devices(&raw_devices, &count);
|
||||
if (err != LIBMTP_ERROR_NONE) {
|
||||
qWarning() << "MTP error:" << err;
|
||||
qLog(Warning) << "MTP error:" << err;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -69,7 +70,7 @@ MtpConnection::MtpConnection(const QUrl& url)
|
||||
}
|
||||
|
||||
if (!raw_device) {
|
||||
qWarning() << "MTP device not found";
|
||||
qLog(Warning) << "MTP device not found";
|
||||
free(raw_devices);
|
||||
return;
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "mtpconnection.h"
|
||||
#include "mtpdevice.h"
|
||||
#include "mtploader.h"
|
||||
#include "core/logging.h"
|
||||
#include "library/librarybackend.h"
|
||||
#include "library/librarymodel.h"
|
||||
|
||||
@ -177,7 +178,7 @@ bool MtpDevice::GetSupportedFiletypes(QList<Song::FileType>* ret) {
|
||||
QMutexLocker l(&db_busy_);
|
||||
MtpConnection connection(url_);
|
||||
if (!connection.is_valid()) {
|
||||
qWarning() << "Error connecting to MTP device, couldn't get list of supported filetypes";
|
||||
qLog(Warning) << "Error connecting to MTP device, couldn't get list of supported filetypes";
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -211,7 +212,7 @@ bool MtpDevice::GetSupportedFiletypes(QList<Song::FileType>* ret, LIBMTP_mtpdevi
|
||||
*ret << Song::Type_OggFlac;
|
||||
break;
|
||||
default:
|
||||
qDebug() << "Unknown MTP file format" <<
|
||||
qLog(Error) << "Unknown MTP file format" <<
|
||||
LIBMTP_Get_Filetype_Description(LIBMTP_filetype_t(list[i]));
|
||||
break;
|
||||
}
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "wmdmloader.h"
|
||||
#include "wmdmprogress.h"
|
||||
#include "wmdmthread.h"
|
||||
#include "core/logging.h"
|
||||
#include "core/utilities.h"
|
||||
#include "library/librarybackend.h"
|
||||
#include "library/librarymodel.h"
|
||||
@ -133,7 +134,7 @@ bool WmdmDevice::CopyToStorage(const CopyJob& job) {
|
||||
metadata_iface,
|
||||
NULL, // data
|
||||
&new_storage)) {
|
||||
qWarning() << "Couldn't copy file to WMDM device";
|
||||
qLog(Warning) << "Couldn't copy file to WMDM device";
|
||||
metadata_iface->Release();
|
||||
return false;
|
||||
}
|
||||
@ -244,7 +245,7 @@ bool WmdmDevice::GetSupportedFiletypes(QList<Song::FileType>* ret, IWMDMDevice*
|
||||
|
||||
if (device->GetFormatSupport(
|
||||
&formats, &format_count, &mime_types, &mime_count)) {
|
||||
qWarning() << "Unable to get a list of supported formats for device";
|
||||
qLog(Warning) << "Unable to get a list of supported formats for device";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
#include "wmdmlister.h"
|
||||
#include "wmdmthread.h"
|
||||
#include "core/logging.h"
|
||||
#include "core/utilities.h"
|
||||
|
||||
#include <objbase.h>
|
||||
@ -73,7 +74,7 @@ void WmdmLister::Init() {
|
||||
// Fetch the initial list of devices
|
||||
IWMDMEnumDevice* device_it = NULL;
|
||||
if (thread_->manager()->EnumDevices2(&device_it)) {
|
||||
qWarning() << "Error querying WMDM devices";
|
||||
qLog(Warning) << "Error querying WMDM devices";
|
||||
return;
|
||||
}
|
||||
|
||||
@ -87,7 +88,7 @@ void WmdmLister::Init() {
|
||||
break;
|
||||
|
||||
if (device->QueryInterface(IID_IWMDMDevice2, (void**)&device2)) {
|
||||
qWarning() << "Error getting IWMDMDevice2 from device";
|
||||
qLog(Warning) << "Error getting IWMDMDevice2 from device";
|
||||
device->Release();
|
||||
continue;
|
||||
}
|
||||
@ -193,7 +194,7 @@ WmdmLister::DeviceInfo WmdmLister::ReadDeviceInfo(IWMDMDevice2* device) {
|
||||
|
||||
if (storage_it->Next(1, &storage, &storage_fetched) == S_OK) {
|
||||
if (storage->QueryInterface(IID_IWMDMStorage2, (void**)&ret.storage_)) {
|
||||
qWarning() << "Error getting IWMDMStorage2 from storage";
|
||||
qLog(Warning) << "Error getting IWMDMStorage2 from storage";
|
||||
} else {
|
||||
// Get free space information
|
||||
UpdateFreeSpace(&ret);
|
||||
@ -260,7 +261,7 @@ void WmdmLister::GuessDriveLetter(DeviceInfo* info) {
|
||||
|
||||
if (!GetVolumeInformationW(volume_path, name, MAX_PATH,
|
||||
&serial, NULL, NULL, type, MAX_PATH)) {
|
||||
qWarning() << "Error getting volume information for" <<
|
||||
qLog(Warning) << "Error getting volume information for" <<
|
||||
QString::fromWCharArray(volume_path);
|
||||
} else {
|
||||
if (name.ToString() == info->name_ && name.characters() != 0) {
|
||||
@ -297,7 +298,7 @@ bool WmdmLister::CheckDriveLetter(DeviceInfo* info, const QString& drive) {
|
||||
NULL, // flags
|
||||
type, MAX_PATH // fat or ntfs
|
||||
)) {
|
||||
qWarning() << "Error getting volume information for" << drive;
|
||||
qLog(Warning) << "Error getting volume information for" << drive;
|
||||
return false;
|
||||
} else {
|
||||
qDebug() << "Validated drive letter" << drive;
|
||||
@ -436,13 +437,13 @@ void WmdmLister::WMDMDeviceAdded(const QString& canonical_name) {
|
||||
|
||||
IWMDMDevice* device = NULL;
|
||||
if (thread_->manager()->GetDeviceFromCanonicalName(name, &device)) {
|
||||
qWarning() << "Error in GetDeviceFromCanonicalName for" << canonical_name;
|
||||
qLog(Warning) << "Error in GetDeviceFromCanonicalName for" << canonical_name;
|
||||
return;
|
||||
}
|
||||
|
||||
IWMDMDevice2* device2 = NULL;
|
||||
if (device->QueryInterface(IID_IWMDMDevice2, (void**) &device2)) {
|
||||
qWarning() << "Error getting IWMDMDevice2 from device";
|
||||
qLog(Warning) << "Error getting IWMDMDevice2 from device";
|
||||
device->Release();
|
||||
return;
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "wmdmthread.h"
|
||||
#include "core/logging.h"
|
||||
#include "core/utilities.h"
|
||||
|
||||
#include <mswmdm.h>
|
||||
@ -39,26 +40,26 @@ WmdmThread::WmdmThread()
|
||||
IComponentAuthenticate* auth;
|
||||
if (CoCreateInstance(CLSID_MediaDevMgr, NULL, CLSCTX_ALL,
|
||||
IID_IComponentAuthenticate, (void**) &auth)) {
|
||||
qWarning() << "Error creating the IComponentAuthenticate interface";
|
||||
qLog(Warning) << "Error creating the IComponentAuthenticate interface";
|
||||
return;
|
||||
}
|
||||
|
||||
sac_ = CSecureChannelClient_New();
|
||||
if (CSecureChannelClient_SetCertificate(
|
||||
sac_, SAC_CERT_V1, abCert, sizeof(abCert), abPVK, sizeof(abPVK))) {
|
||||
qWarning() << "Error setting SAC certificate";
|
||||
qLog(Warning) << "Error setting SAC certificate";
|
||||
return;
|
||||
}
|
||||
|
||||
CSecureChannelClient_SetInterface(sac_, auth);
|
||||
if (CSecureChannelClient_Authenticate(sac_, SAC_PROTOCOL_V1)) {
|
||||
qWarning() << "Error authenticating with SAC";
|
||||
qLog(Warning) << "Error authenticating with SAC";
|
||||
return;
|
||||
}
|
||||
|
||||
// Create the device manager
|
||||
if (auth->QueryInterface(IID_IWMDeviceManager2, (void**)&device_manager_)) {
|
||||
qWarning() << "Error creating WMDM device manager";
|
||||
qLog(Warning) << "Error creating WMDM device manager";
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -83,7 +84,7 @@ IWMDMDevice* WmdmThread::GetDeviceByCanonicalName(const QString& device_name) {
|
||||
|
||||
IWMDMDevice* device = NULL;
|
||||
if (device_manager_->GetDeviceFromCanonicalName(name, &device)) {
|
||||
qWarning() << "Error in GetDeviceFromCanonicalName for" << device_name;
|
||||
qLog(Warning) << "Error in GetDeviceFromCanonicalName for" << device_name;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "config.h"
|
||||
#include "gstengine.h"
|
||||
#include "gstenginepipeline.h"
|
||||
#include "core/logging.h"
|
||||
#include "core/utilities.h"
|
||||
|
||||
#ifdef HAVE_IMOBILEDEVICE
|
||||
@ -204,7 +205,7 @@ void GstEngine::ConsumeBuffer(GstBuffer* buffer, int pipeline_id) {
|
||||
if (!QMetaObject::invokeMethod(this, "AddBufferToScope",
|
||||
Q_ARG(GstBuffer*, buffer),
|
||||
Q_ARG(int, pipeline_id))) {
|
||||
qWarning() << "Failed to invoke AddBufferToScope on GstEngine";
|
||||
qLog(Warning) << "Failed to invoke AddBufferToScope on GstEngine";
|
||||
}
|
||||
}
|
||||
|
||||
@ -419,14 +420,14 @@ void GstEngine::PlayDone() {
|
||||
// Failure, but we got a redirection URL - try loading that instead
|
||||
QUrl redirect_url = current_pipeline_->redirect_url();
|
||||
if (!redirect_url.isEmpty() && redirect_url != current_pipeline_->url()) {
|
||||
qDebug() << "Redirecting to" << redirect_url;
|
||||
qLog(Info) << "Redirecting to" << redirect_url;
|
||||
current_pipeline_ = CreatePipeline(redirect_url, end_nanosec_);
|
||||
Play(offset_nanosec);
|
||||
return;
|
||||
}
|
||||
|
||||
// Failure - give up
|
||||
qWarning() << "Could not set thread to PLAYING.";
|
||||
qLog(Warning) << "Could not set thread to PLAYING.";
|
||||
current_pipeline_.reset();
|
||||
return;
|
||||
}
|
||||
@ -511,7 +512,7 @@ void GstEngine::SeekNow() {
|
||||
if (current_pipeline_->Seek(seek_pos_))
|
||||
ClearScopeBuffers();
|
||||
else
|
||||
qDebug() << "Seek failed";
|
||||
qLog(Warning) << "Seek failed";
|
||||
}
|
||||
|
||||
void GstEngine::SetEqualizerEnabled(bool enabled) {
|
||||
@ -581,7 +582,7 @@ void GstEngine::HandlePipelineError(int pipeline_id, const QString& message,
|
||||
if (!current_pipeline_.get() || current_pipeline_->id() != pipeline_id)
|
||||
return;
|
||||
|
||||
qWarning() << "Gstreamer error:" << message;
|
||||
qLog(Warning) << "Gstreamer error:" << message;
|
||||
|
||||
current_pipeline_.reset();
|
||||
|
||||
@ -790,7 +791,7 @@ void GstEngine::BackgroundStreamPlayDone() {
|
||||
GstStateChangeReturn ret = watcher->result();
|
||||
|
||||
if (ret == GST_STATE_CHANGE_FAILURE) {
|
||||
qWarning() << "Could not set thread to PLAYING.";
|
||||
qLog(Warning) << "Could not set thread to PLAYING.";
|
||||
background_streams_.remove(stream_id);
|
||||
}
|
||||
}
|
||||
|
@ -17,12 +17,12 @@
|
||||
|
||||
#include <limits>
|
||||
|
||||
#include "gstelementdeleter.h"
|
||||
#include "gstenginepipeline.h"
|
||||
#include "gstengine.h"
|
||||
#include "bufferconsumer.h"
|
||||
#include "gstelementdeleter.h"
|
||||
#include "gstengine.h"
|
||||
#include "gstenginepipeline.h"
|
||||
#include "core/logging.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QtConcurrentRun>
|
||||
|
||||
const int GstEnginePipeline::kGstStateTimeoutNanosecs = 10000000;
|
||||
@ -142,7 +142,7 @@ GstElement* GstEnginePipeline::CreateDecodeBinFromString(const char* pipeline) {
|
||||
int code = error->code;
|
||||
g_error_free(error);
|
||||
|
||||
qWarning() << message;
|
||||
qLog(Warning) << message;
|
||||
emit Error(id(), message, domain, code);
|
||||
|
||||
return NULL;
|
||||
@ -287,6 +287,8 @@ GstEnginePipeline::~GstEnginePipeline() {
|
||||
gboolean GstEnginePipeline::BusCallback(GstBus*, GstMessage* msg, gpointer self) {
|
||||
GstEnginePipeline* instance = reinterpret_cast<GstEnginePipeline*>(self);
|
||||
|
||||
qLog(Debug) << instance->id() << "bus message" << GST_MESSAGE_TYPE_NAME(msg);
|
||||
|
||||
switch (GST_MESSAGE_TYPE(msg)) {
|
||||
case GST_MESSAGE_ERROR:
|
||||
instance->ErrorMessageReceived(msg);
|
||||
@ -310,6 +312,8 @@ gboolean GstEnginePipeline::BusCallback(GstBus*, GstMessage* msg, gpointer self)
|
||||
GstBusSyncReply GstEnginePipeline::BusCallbackSync(GstBus*, GstMessage* msg, gpointer self) {
|
||||
GstEnginePipeline* instance = reinterpret_cast<GstEnginePipeline*>(self);
|
||||
|
||||
qLog(Debug) << instance->id() << "sync bus message" << GST_MESSAGE_TYPE_NAME(msg);
|
||||
|
||||
switch (GST_MESSAGE_TYPE(msg)) {
|
||||
case GST_MESSAGE_EOS:
|
||||
emit instance->EndOfStreamReached(instance->id(), false);
|
||||
@ -371,7 +375,8 @@ void GstEnginePipeline::ErrorMessageReceived(GstMessage* msg) {
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug() << debugstr;
|
||||
qLog(Error) << id() << debugstr;
|
||||
|
||||
emit Error(id(), message, domain, code);
|
||||
}
|
||||
|
||||
@ -434,7 +439,7 @@ void GstEnginePipeline::NewPadCallback(GstElement*, GstPad* pad, gpointer self)
|
||||
GstPad* const audiopad = gst_element_get_pad(instance->audiobin_, "sink");
|
||||
|
||||
if (GST_PAD_IS_LINKED(audiopad)) {
|
||||
qDebug() << "audiopad is already linked. Unlinking old pad.";
|
||||
qLog(Warning) << instance->id() << "audiopad is already linked, unlinking old pad";
|
||||
gst_pad_unlink(audiopad, GST_PAD_PEER(audiopad));
|
||||
}
|
||||
|
||||
@ -503,6 +508,8 @@ bool GstEnginePipeline::HandoffCallback(GstPad*, GstBuffer* buf, gpointer self)
|
||||
bool GstEnginePipeline::EventHandoffCallback(GstPad*, GstEvent* e, gpointer self) {
|
||||
GstEnginePipeline* instance = reinterpret_cast<GstEnginePipeline*>(self);
|
||||
|
||||
qLog(Debug) << instance->id() << "event" << GST_EVENT_TYPE_NAME(e);
|
||||
|
||||
if (GST_EVENT_TYPE(e) == GST_EVENT_NEWSEGMENT && !instance->segment_start_received_) {
|
||||
// The segment start time is used to calculate the proper offset of data
|
||||
// buffers from the start of the stream
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "librarywatcher.h"
|
||||
#include "librarybackend.h"
|
||||
#include "core/logging.h"
|
||||
#include "core/taskmanager.h"
|
||||
#include "playlistparsers/cueparser.h"
|
||||
|
||||
@ -328,7 +329,7 @@ void LibraryWatcher::ScanSubdirectory(
|
||||
|
||||
// the song's changed - reread the metadata from file
|
||||
if (t->ignores_mtime() || changed) {
|
||||
qDebug() << file << "changed";
|
||||
qLog(Debug) << file << "changed";
|
||||
|
||||
// if cue associated...
|
||||
if(!cue_deleted && (matching_song.has_cue() || cue_added)) {
|
||||
@ -346,7 +347,7 @@ void LibraryWatcher::ScanSubdirectory(
|
||||
continue;
|
||||
}
|
||||
|
||||
qDebug() << file << "created";
|
||||
qLog(Debug) << file << "created";
|
||||
// choose an image for the song(s)
|
||||
QString image = ImageForSong(file, album_art);
|
||||
|
||||
@ -363,7 +364,7 @@ void LibraryWatcher::ScanSubdirectory(
|
||||
// Look for deleted songs
|
||||
foreach (const Song& song, songs_in_db) {
|
||||
if (!files_on_disk.contains(song.filename())) {
|
||||
qDebug() << "Song deleted from disk:" << song.filename();
|
||||
qLog(Debug) << "Song deleted from disk:" << song.filename();
|
||||
t->deleted_songs << song;
|
||||
}
|
||||
}
|
||||
@ -510,7 +511,7 @@ void LibraryWatcher::PreserveUserSetData(const QString& file, const QString& ima
|
||||
out->set_art_manual(matching_song.art_manual());
|
||||
|
||||
if (!matching_song.IsMetadataEqual(*out)) {
|
||||
qDebug() << file << "metadata changed";
|
||||
qLog(Debug) << file << "metadata changed";
|
||||
|
||||
// Update the song in the DB
|
||||
t->new_songs << *out;
|
||||
@ -572,7 +573,7 @@ void LibraryWatcher::DirectoryChanged(const QString &subdir) {
|
||||
dir = info.dir;
|
||||
}
|
||||
|
||||
qDebug() << "Subdir" << subdir << "changed under directory" << dir.path << "id" << dir.id;
|
||||
qLog(Debug) << "Subdir" << subdir << "changed under directory" << dir.path << "id" << dir.id;
|
||||
|
||||
// Queue the subdir for rescanning
|
||||
if (!rescan_queue_[dir.id].contains(subdir))
|
||||
|
18
src/main.cpp
18
src/main.cpp
@ -28,6 +28,7 @@
|
||||
#include "core/crashreporting.h"
|
||||
#include "core/database.h"
|
||||
#include "core/encoding.h"
|
||||
#include "core/logging.h"
|
||||
#include "core/mac_startup.h"
|
||||
#include "core/network.h"
|
||||
#include "core/networkproxyfactory.h"
|
||||
@ -123,13 +124,6 @@ void LoadTranslation(const QString& prefix, const QString& path,
|
||||
delete t;
|
||||
}
|
||||
|
||||
void GLog(const gchar* domain,
|
||||
GLogLevelFlags level,
|
||||
const gchar* message,
|
||||
gpointer user_data) {
|
||||
qDebug() << "GLOG" << message;
|
||||
}
|
||||
|
||||
#ifdef HAVE_REMOTE
|
||||
#include <xrme/connection.h>
|
||||
#include "remote/icesession.h"
|
||||
@ -162,7 +156,7 @@ int main(int argc, char *argv[]) {
|
||||
int ret = setrlimit(RLIMIT_NOFILE, &limit);
|
||||
|
||||
if (ret == 0) {
|
||||
qDebug() << "Max fd:" << max_fd;
|
||||
qLog(Debug) << "Max fd:" << max_fd;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -194,8 +188,6 @@ int main(int argc, char *argv[]) {
|
||||
g_type_init();
|
||||
g_set_application_name(QCoreApplication::applicationName().toLocal8Bit());
|
||||
|
||||
g_log_set_default_handler(&GLog, NULL);
|
||||
|
||||
qRegisterMetaType<Directory>("Directory");
|
||||
qRegisterMetaType<DirectoryList>("DirectoryList");
|
||||
qRegisterMetaType<Subdirectory>("Subdirectory");
|
||||
@ -244,7 +236,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
if (a.isRunning()) {
|
||||
if (options.is_empty()) {
|
||||
qDebug() << "Clementine is already running - activating existing window";
|
||||
qLog(Info) << "Clementine is already running - activating existing window";
|
||||
}
|
||||
if (a.sendMessage(options.Serialize(), 5000)) {
|
||||
return 0;
|
||||
@ -319,6 +311,10 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
#endif
|
||||
|
||||
// Initialise logging
|
||||
logging::Init();
|
||||
logging::SetLevels(options.log_levels());
|
||||
|
||||
QtSingleApplication a(argc, argv);
|
||||
#ifdef Q_OS_DARWIN
|
||||
QCoreApplication::setLibraryPaths(
|
||||
|
@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "fingerprinter.h"
|
||||
#include "core/logging.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QEventLoop>
|
||||
@ -52,7 +53,7 @@ GstElement* Fingerprinter::CreateElement(const QString &factory_name,
|
||||
gst_bin_add(GST_BIN(bin), ret);
|
||||
|
||||
if (!ret) {
|
||||
qDebug() << "Couldn't create the gstreamer element" << factory_name;
|
||||
qLog(Warning) << "Couldn't create the gstreamer element" << factory_name;
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -102,7 +103,7 @@ void Fingerprinter::NewPadCallback(GstElement*, GstPad* pad, gboolean, gpointer
|
||||
GstPad* const audiopad = gst_element_get_pad(instance->convert_element_, "sink");
|
||||
|
||||
if (GST_PAD_IS_LINKED(audiopad)) {
|
||||
qDebug() << "audiopad is already linked. Unlinking old pad.";
|
||||
qLog(Warning) << "audiopad is already linked, unlinking old pad";
|
||||
gst_pad_unlink(audiopad, GST_PAD_PEER(audiopad));
|
||||
}
|
||||
|
||||
@ -120,7 +121,7 @@ void Fingerprinter::ReportError(GstMessage* msg) {
|
||||
g_error_free(error);
|
||||
free(debugs);
|
||||
|
||||
qDebug() << "Fingerprinter: Error processing" << filename_ << ":" << message;
|
||||
qLog(Error) << "Error processing" << filename_ << ":" << message;
|
||||
}
|
||||
|
||||
gboolean Fingerprinter::BusCallback(GstBus*, GstMessage* msg, gpointer data) {
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "songloaderinserter.h"
|
||||
#include "songmimedata.h"
|
||||
#include "songplaylistitem.h"
|
||||
#include "core/logging.h"
|
||||
#include "core/modelfuturewatcher.h"
|
||||
#include "library/library.h"
|
||||
#include "library/librarybackend.h"
|
||||
@ -954,7 +955,7 @@ void Playlist::InsertRadioStations(const RadioModel* model,
|
||||
}
|
||||
|
||||
void Playlist::UpdateItems(const SongList& songs) {
|
||||
qDebug() << "Updating playlist with new tracks' info";
|
||||
qLog(Debug) << "Updating playlist with new tracks' info";
|
||||
foreach (const Song& song, songs) {
|
||||
// Update current items list
|
||||
for (int i=0; i<items_.size(); i++) {
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "playlistdelegates.h"
|
||||
#include "queue.h"
|
||||
#include "core/logging.h"
|
||||
#include "core/utilities.h"
|
||||
#include "library/librarybackend.h"
|
||||
#include "widgets/trackslider.h"
|
||||
@ -376,7 +377,7 @@ QString TagCompletionModel::database_column(Playlist::Column column) {
|
||||
case Playlist::Column_Composer: return "composer";
|
||||
case Playlist::Column_Genre: return "genre";
|
||||
default:
|
||||
qWarning() << __PRETTY_FUNCTION__ << "Unknown column" << column;
|
||||
qLog(Warning) << "Unknown column" << column;
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "playlistitem.h"
|
||||
#include "songplaylistitem.h"
|
||||
#include "core/logging.h"
|
||||
#include "library/library.h"
|
||||
#include "library/libraryplaylistitem.h"
|
||||
#include "radio/jamendoplaylistitem.h"
|
||||
@ -46,7 +47,7 @@ PlaylistItem* PlaylistItem::NewFromType(const QString& type) {
|
||||
if (type == "Radio")
|
||||
return new RadioPlaylistItem(type);
|
||||
|
||||
qWarning() << "Invalid PlaylistItem type:" << type;
|
||||
qLog(Warning) << "Invalid PlaylistItem type:" << type;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -58,7 +59,7 @@ PlaylistItem* PlaylistItem::NewFromSongsTable(const QString& table, const Song&
|
||||
if (table == JamendoService::kSongsTable)
|
||||
return new JamendoPlaylistItem(song);
|
||||
|
||||
qWarning() << "Invalid PlaylistItem songs table:" << table;
|
||||
qLog(Warning) << "Invalid PlaylistItem songs table:" << table;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "asxiniparser.h"
|
||||
#include "core/logging.h"
|
||||
|
||||
#include <QTextStream>
|
||||
#include <QtDebug>
|
||||
@ -41,7 +42,7 @@ SongList AsxIniParser::Load(QIODevice *device, const QString& playlist_path, con
|
||||
if (key.startsWith("ref")) {
|
||||
Song song;
|
||||
if (!ParseTrackLocation(value, dir, &song))
|
||||
qWarning() << "Failed to parse location: " << value;
|
||||
qLog(Warning) << "Failed to parse location: " << value;
|
||||
|
||||
// Load the song from the library if it's there.
|
||||
Song library_song = LoadLibrarySong(song.filename());
|
||||
|
@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "cueparser.h"
|
||||
#include "core/logging.h"
|
||||
|
||||
#include <QBuffer>
|
||||
#include <QDateTime>
|
||||
@ -114,7 +115,7 @@ SongList CueParser::Load(QIODevice* device, const QString& playlist_path, const
|
||||
} while(!(line = text_stream.readLine()).isNull());
|
||||
|
||||
if(line.isNull()) {
|
||||
qWarning() << "the .cue file from " << dir_path << " defines no tracks!";
|
||||
qLog(Warning) << "the .cue file from " << dir_path << " defines no tracks!";
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -208,7 +209,7 @@ SongList CueParser::Load(QIODevice* device, const QString& playlist_path, const
|
||||
|
||||
Song current;
|
||||
if (!ParseTrackLocation(entry.file, dir, ¤t)) {
|
||||
qWarning() << "failed to parse location in .cue file from " << dir_path;
|
||||
qLog(Warning) << "failed to parse location in .cue file from " << dir_path;
|
||||
} else {
|
||||
// look for the section in library
|
||||
Song song = LoadLibrarySong(current.filename(), IndexToMarker(entry.index));
|
||||
|
@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "m3uparser.h"
|
||||
#include "core/logging.h"
|
||||
|
||||
#include <QBuffer>
|
||||
#include <QtDebug>
|
||||
@ -39,7 +40,6 @@ SongList M3UParser::Load(QIODevice* device, const QString& playlist_path, const
|
||||
buffer.open(QIODevice::ReadOnly);
|
||||
|
||||
QString line = QString::fromUtf8(buffer.readLine()).trimmed();
|
||||
qDebug() << line;
|
||||
if (line.startsWith("#EXTM3U")) {
|
||||
// This is in extended M3U format.
|
||||
type = EXTENDED;
|
||||
@ -47,12 +47,11 @@ SongList M3UParser::Load(QIODevice* device, const QString& playlist_path, const
|
||||
}
|
||||
|
||||
forever {
|
||||
qDebug() << line;
|
||||
if (line.startsWith('#')) {
|
||||
// Extended info or comment.
|
||||
if (type == EXTENDED && line.startsWith("#EXT")) {
|
||||
if (!ParseMetadata(line, ¤t_metadata)) {
|
||||
qWarning() << "Failed to parse metadata: " << line;
|
||||
qLog(Warning) << "Failed to parse metadata: " << line;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -61,7 +60,7 @@ SongList M3UParser::Load(QIODevice* device, const QString& playlist_path, const
|
||||
|
||||
// Track location.
|
||||
if (!ParseTrackLocation(line, dir, &song)) {
|
||||
qWarning() << "Failed to parse location: " << line;
|
||||
qLog(Warning) << "Failed to parse location: " << line;
|
||||
} else {
|
||||
// Load the song from the library if it's there.
|
||||
Song library_song = LoadLibrarySong(song.filename());
|
||||
|
@ -15,13 +15,14 @@
|
||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "playlistparser.h"
|
||||
#include "xspfparser.h"
|
||||
#include "m3uparser.h"
|
||||
#include "plsparser.h"
|
||||
#include "cueparser.h"
|
||||
#include "asxparser.h"
|
||||
#include "asxiniparser.h"
|
||||
#include "cueparser.h"
|
||||
#include "m3uparser.h"
|
||||
#include "playlistparser.h"
|
||||
#include "plsparser.h"
|
||||
#include "xspfparser.h"
|
||||
#include "core/logging.h"
|
||||
|
||||
#include <QtDebug>
|
||||
|
||||
@ -105,7 +106,7 @@ SongList PlaylistParser::LoadFromFile(const QString& filename) const {
|
||||
// Find a parser that supports this file extension
|
||||
ParserBase* parser = ParserForExtension(info.suffix());
|
||||
if (!parser) {
|
||||
qWarning() << "Unknown filetype:" << filename;
|
||||
qLog(Warning) << "Unknown filetype:" << filename;
|
||||
return SongList();
|
||||
}
|
||||
|
||||
@ -134,7 +135,7 @@ void PlaylistParser::Save(const SongList& songs, const QString& filename) const
|
||||
// Find a parser that supports this file extension
|
||||
ParserBase* parser = ParserForExtension(info.suffix());
|
||||
if (!parser) {
|
||||
qWarning() << "Unknown filetype:" << filename;
|
||||
qLog(Warning) << "Unknown filetype:" << filename;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "plsparser.h"
|
||||
#include "core/logging.h"
|
||||
|
||||
#include <QTextStream>
|
||||
#include <QtDebug>
|
||||
@ -40,7 +41,7 @@ SongList PLSParser::Load(QIODevice *device, const QString& playlist_path, const
|
||||
|
||||
if (key.startsWith("file")) {
|
||||
if (!ParseTrackLocation(value, dir, &songs[n]))
|
||||
qWarning() << "Failed to parse location: " << value;
|
||||
qLog(Warning) << "Failed to parse location: " << value;
|
||||
|
||||
// Load the song from the library if it's there.
|
||||
Song library_song = LoadLibrarySong(songs[n].filename());
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <QHttpRequestHeader>
|
||||
#include <QtDebug>
|
||||
|
||||
#include "core/logging.h"
|
||||
#include "core/network.h"
|
||||
#include "library/librarybackend.h"
|
||||
#include "radio/jamendoplaylistitem.h"
|
||||
@ -106,7 +107,7 @@ void JamendoDynamicPlaylist::Fetch() {
|
||||
}
|
||||
|
||||
if (http.error() != QHttp::NoError) {
|
||||
qWarning() << "HTTP error returned from Jamendo:" << http.errorString()
|
||||
qLog(Warning) << "HTTP error returned from Jamendo:" << http.errorString()
|
||||
<< ", url:" << url.toString();
|
||||
return;
|
||||
}
|
||||
@ -119,7 +120,7 @@ void JamendoDynamicPlaylist::Fetch() {
|
||||
lines, JamendoService::kTrackIdsTable, JamendoService::kTrackIdsColumn);
|
||||
|
||||
if (songs.empty()) {
|
||||
qWarning() << "No songs returned from Jamendo:"
|
||||
qLog(Warning) << "No songs returned from Jamendo:"
|
||||
<< url.toString();
|
||||
return;
|
||||
}
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "qtiocompressor.h"
|
||||
|
||||
#include "core/database.h"
|
||||
#include "core/logging.h"
|
||||
#include "core/mergedproxymodel.h"
|
||||
#include "core/network.h"
|
||||
#include "core/scopedtransaction.h"
|
||||
@ -189,7 +190,7 @@ void JamendoService::DownloadDirectoryFinished() {
|
||||
QtIOCompressor* gzip = new QtIOCompressor(reply);
|
||||
gzip->setStreamFormat(QtIOCompressor::GzipFormat);
|
||||
if (!gzip->open(QIODevice::ReadOnly)) {
|
||||
qWarning() << "Jamendo library not in gzip format";
|
||||
qLog(Warning) << "Jamendo library not in gzip format";
|
||||
delete gzip;
|
||||
return;
|
||||
}
|
||||
@ -265,7 +266,7 @@ void JamendoService::InsertTrackIds(const TrackIdList& ids) const {
|
||||
foreach (int id, ids) {
|
||||
insert.bindValue(":id", id);
|
||||
if (!insert.exec()) {
|
||||
qWarning() << "Query failed" << insert.lastQuery();
|
||||
qLog(Warning) << "Query failed" << insert.lastQuery();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "lastfmstationdialog.h"
|
||||
#include "radiomodel.h"
|
||||
#include "radioplaylistitem.h"
|
||||
#include "core/logging.h"
|
||||
#include "core/song.h"
|
||||
#include "core/taskmanager.h"
|
||||
#include "ui/iconloader.h"
|
||||
@ -289,7 +290,7 @@ void LastFMService::AuthenticateReplyFinished() {
|
||||
settings.setValue("Session", lastfm::ws::SessionKey);
|
||||
settings.setValue("Subscriber", is_subscriber);
|
||||
} catch (std::runtime_error& e) {
|
||||
qDebug() << e.what();
|
||||
qLog(Error) << e.what();
|
||||
emit AuthenticationComplete(false);
|
||||
return;
|
||||
}
|
||||
@ -327,10 +328,10 @@ void LastFMService::UpdateSubscriberStatusFinished() {
|
||||
QSettings settings;
|
||||
settings.beginGroup(kSettingsGroup);
|
||||
settings.setValue("Subscriber", is_subscriber);
|
||||
qDebug() << lastfm::ws::Username << "Subscriber status:" << is_subscriber;
|
||||
qLog(Info) << lastfm::ws::Username << "Subscriber status:" << is_subscriber;
|
||||
emit UpdatedSubscriberStatus(is_subscriber);
|
||||
} catch (std::runtime_error& e) {
|
||||
qDebug() << e.what();
|
||||
qLog(Error) << e.what();
|
||||
}
|
||||
}
|
||||
|
||||
@ -482,7 +483,7 @@ void LastFMService::NowPlaying(const Song &song) {
|
||||
lastfm::MutableTrack mtrack(last_track_);
|
||||
mtrack.setDuration(duration_secs);
|
||||
|
||||
qDebug() << "Scrobbling stream track" << mtrack.title() << "length" << duration_secs;
|
||||
qLog(Info) << "Scrobbling stream track" << mtrack.title() << "length" << duration_secs;
|
||||
scrobbler_->cache(mtrack);
|
||||
scrobbler_->submit();
|
||||
|
||||
@ -600,7 +601,7 @@ void LastFMService::RefreshFriendsFinished() {
|
||||
throw std::runtime_error("");
|
||||
#endif
|
||||
} catch (std::runtime_error& e) {
|
||||
qDebug() << e.what();
|
||||
qLog(Error) << e.what();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -629,7 +630,7 @@ void LastFMService::RefreshNeighboursFinished() {
|
||||
throw std::runtime_error("");
|
||||
#endif
|
||||
} catch (std::runtime_error& e) {
|
||||
qDebug() << e.what();
|
||||
qLog(Error) << e.what();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -760,7 +761,7 @@ void LastFMService::FetchMoreTracks() {
|
||||
void LastFMService::FetchMoreTracksFinished() {
|
||||
QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
|
||||
if (!reply) {
|
||||
qWarning() << "Invalid reply on radio.getPlaylist";
|
||||
qLog(Warning) << "Invalid reply on radio.getPlaylist";
|
||||
emit AsyncLoadFinished(PlaylistItem::SpecialLoadResult(
|
||||
PlaylistItem::SpecialLoadResult::NoMoreTracks, reply->url()));
|
||||
return;
|
||||
@ -823,7 +824,7 @@ void LastFMService::Tune(const lastfm::RadioStation& station) {
|
||||
void LastFMService::TuneFinished() {
|
||||
QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
|
||||
if (!reply) {
|
||||
qWarning() << "Invalid reply on radio.tune";
|
||||
qLog(Warning) << "Invalid reply on radio.tune";
|
||||
emit AsyncLoadFinished(PlaylistItem::SpecialLoadResult(
|
||||
PlaylistItem::SpecialLoadResult::NoMoreTracks, reply->url()));
|
||||
return;
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "magnatuneplaylistitem.h"
|
||||
#include "magnatuneservice.h"
|
||||
#include "radiomodel.h"
|
||||
#include "core/logging.h"
|
||||
#include "core/mergedproxymodel.h"
|
||||
#include "core/network.h"
|
||||
#include "core/song.h"
|
||||
@ -150,7 +151,7 @@ void MagnatuneService::ReloadDatabaseFinished() {
|
||||
|
||||
if (reply->error() != QNetworkReply::NoError) {
|
||||
// TODO: Error handling
|
||||
qDebug() << reply->errorString();
|
||||
qLog(Error) << reply->errorString();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -161,7 +162,7 @@ void MagnatuneService::ReloadDatabaseFinished() {
|
||||
QtIOCompressor gzip(reply);
|
||||
gzip.setStreamFormat(QtIOCompressor::GzipFormat);
|
||||
if (!gzip.open(QIODevice::ReadOnly)) {
|
||||
qWarning() << "Error opening gzip stream";
|
||||
qLog(Warning) << "Error opening gzip stream";
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,6 @@
|
||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "core/mergedproxymodel.h"
|
||||
#include "icecastservice.h"
|
||||
#include "jamendoservice.h"
|
||||
#include "magnatuneservice.h"
|
||||
@ -24,6 +23,8 @@
|
||||
#include "radioservice.h"
|
||||
#include "savedradio.h"
|
||||
#include "somafmservice.h"
|
||||
#include "core/logging.h"
|
||||
#include "core/mergedproxymodel.h"
|
||||
|
||||
#ifdef HAVE_LIBLASTFM
|
||||
#include "lastfmservice.h"
|
||||
@ -61,7 +62,7 @@ RadioModel::RadioModel(BackgroundThread<Database>* db_thread,
|
||||
void RadioModel::AddService(RadioService *service) {
|
||||
QStandardItem* root = service->CreateRootItem();
|
||||
if (!root) {
|
||||
qWarning() << "Radio service" << service->name() << "did not return a root item";
|
||||
qLog(Warning) << "Radio service" << service->name() << "did not return a root item";
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "somafmservice.h"
|
||||
#include "radiomodel.h"
|
||||
#include "core/logging.h"
|
||||
#include "core/network.h"
|
||||
#include "core/taskmanager.h"
|
||||
#include "ui/iconloader.h"
|
||||
@ -103,7 +104,7 @@ void SomaFMService::LoadPlaylistFinished() {
|
||||
|
||||
if (reply->error() != QNetworkReply::NoError) {
|
||||
// TODO: Error handling
|
||||
qDebug() << reply->errorString();
|
||||
qLog(Error) << reply->errorString();
|
||||
emit AsyncLoadFinished(PlaylistItem::SpecialLoadResult(
|
||||
PlaylistItem::SpecialLoadResult::NoMoreTracks, original_url));
|
||||
return;
|
||||
@ -138,7 +139,7 @@ void SomaFMService::RefreshChannelsFinished() {
|
||||
|
||||
if (reply->error() != QNetworkReply::NoError) {
|
||||
// TODO: Error handling
|
||||
qDebug() << reply->errorString();
|
||||
qLog(Error) << reply->errorString();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "icesession.h"
|
||||
#include "core/logging.h"
|
||||
|
||||
#include <QHostAddress>
|
||||
|
||||
@ -35,7 +36,7 @@ bool ICESession::Init() {
|
||||
&ice_cb,
|
||||
&ice_instance_);
|
||||
if (status != PJ_SUCCESS) {
|
||||
qWarning() << "Failed to create ICE instance";
|
||||
qLog(Warning) << "Failed to create ICE instance";
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -147,7 +148,7 @@ void ICESession::StartNegotiation(const xrme::SIPInfo& session) {
|
||||
candidates);
|
||||
|
||||
if (status != PJ_SUCCESS) {
|
||||
qWarning() << "Start negotation failed";
|
||||
qLog(Warning) << "Start negotation failed";
|
||||
} else {
|
||||
qDebug() << "ICE negotiation started";
|
||||
}
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "pythonengine.h"
|
||||
#include "pythonscript.h"
|
||||
#include "sipAPIclementine.h"
|
||||
#include "core/logging.h"
|
||||
#include "covers/coverproviders.h"
|
||||
#include "library/library.h"
|
||||
|
||||
@ -214,7 +215,7 @@ void PythonEngine::RegisterNativeObject(QObject* object) {
|
||||
|
||||
PyFrameObject* frame = PyEval_GetFrame();
|
||||
if (!frame) {
|
||||
qWarning() << __PRETTY_FUNCTION__ << "unable to get stack frame";
|
||||
qLog(Warning) << "unable to get stack frame";
|
||||
return;
|
||||
}
|
||||
while (frame->f_back) {
|
||||
@ -224,7 +225,7 @@ void PythonEngine::RegisterNativeObject(QObject* object) {
|
||||
PyObject* __package__ = PyMapping_GetItemString(
|
||||
frame->f_globals, const_cast<char*>("__package__"));
|
||||
if (!__package__) {
|
||||
qWarning() << __PRETTY_FUNCTION__ << "unable to get __package__";
|
||||
qLog(Warning) << "unable to get __package__";
|
||||
return;
|
||||
}
|
||||
|
||||
@ -234,7 +235,7 @@ void PythonEngine::RegisterNativeObject(QObject* object) {
|
||||
|
||||
Script* script = FindScriptMatchingId(package);
|
||||
if (!script) {
|
||||
qWarning() << __PRETTY_FUNCTION__ << "unable to find script for package" << package;
|
||||
qLog(Warning) << "unable to find script for package" << package;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "config.h"
|
||||
#include "scriptarchive.h"
|
||||
#include "core/logging.h"
|
||||
#include "core/utilities.h"
|
||||
|
||||
#include <QDir>
|
||||
@ -59,7 +60,7 @@ namespace {
|
||||
if (bytes_read == ARCHIVE_FATAL ||
|
||||
bytes_read == ARCHIVE_WARN ||
|
||||
bytes_read == ARCHIVE_RETRY) {
|
||||
qWarning() << "Error reading archive:" << archive_error_string(in);
|
||||
qLog(Warning) << "Error reading archive:" << archive_error_string(in);
|
||||
return;
|
||||
}
|
||||
if (bytes_read == 0) {
|
||||
@ -67,7 +68,7 @@ namespace {
|
||||
}
|
||||
|
||||
if (archive_write_data(out, buf, bytes_read) == -1) {
|
||||
qWarning() << "Error extracting archive:" << archive_error_string(out);
|
||||
qLog(Warning) << "Error extracting archive:" << archive_error_string(out);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "languageengine.h"
|
||||
#include "scriptinfo.h"
|
||||
#include "core/logging.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
@ -38,7 +39,7 @@ void ScriptInfo::InitFromDirectory(const ScriptManager* manager, const QString&
|
||||
|
||||
// Does the file exist?
|
||||
if (!QFile::exists(ini_file)) {
|
||||
qWarning() << "Script definition file not found:" << ini_file;
|
||||
qLog(Warning) << "Script definition file not found:" << ini_file;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -52,7 +53,7 @@ void ScriptInfo::InitFromFile(const ScriptManager* manager,
|
||||
// Open it
|
||||
QSettings s(ini_file, QSettings::IniFormat);
|
||||
if (!s.childGroups().contains(kIniSettingsGroup)) {
|
||||
qWarning() << "Missing" << kIniSettingsGroup << "section in" << ini_file;
|
||||
qLog(Warning) << "Missing" << kIniSettingsGroup << "section in" << ini_file;
|
||||
return;
|
||||
}
|
||||
s.beginGroup(kIniSettingsGroup);
|
||||
@ -61,7 +62,7 @@ void ScriptInfo::InitFromFile(const ScriptManager* manager,
|
||||
QString language_name = s.value("language").toString();
|
||||
LanguageEngine* engine = manager->EngineForLanguage(language_name);
|
||||
if (!engine) {
|
||||
qWarning() << "Unknown language" << language_name << "in" << ini_file;
|
||||
qLog(Warning) << "Unknown language" << language_name << "in" << ini_file;
|
||||
return;
|
||||
}
|
||||
d->language_ = engine->language();
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "scriptinterface.h"
|
||||
#include "scriptmanager.h"
|
||||
#include "uiinterface.h"
|
||||
#include "core/logging.h"
|
||||
#include "core/utilities.h"
|
||||
|
||||
#ifdef HAVE_SCRIPTING_PYTHON
|
||||
@ -61,7 +62,7 @@ ScriptManager::ScriptManager(QObject* parent)
|
||||
QString local_path = Utilities::GetConfigPath(Utilities::Path_Scripts);
|
||||
if (!QFile::exists(local_path)) {
|
||||
if (!QDir().mkpath(local_path)) {
|
||||
qWarning() << "Couldn't create directory" << local_path;
|
||||
qLog(Warning) << "Couldn't create directory" << local_path;
|
||||
}
|
||||
}
|
||||
|
||||
@ -112,7 +113,7 @@ void ScriptManager::MaybeAutoEnable(ScriptInfo* info) {
|
||||
// Find an engine for it
|
||||
LanguageEngine* engine = EngineForLanguage(info->language());
|
||||
if (!engine) {
|
||||
qWarning() << "Unknown language in" << info->path();
|
||||
qLog(Warning) << "Unknown language in" << info->path();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -149,7 +150,7 @@ QMap<QString, ScriptInfo> ScriptManager::LoadAllScriptInfo() const {
|
||||
ScriptInfo info;
|
||||
info.InitFromDirectory(this, path);
|
||||
if (!info.is_valid()) {
|
||||
qWarning() << "Not a valid Clementine script directory, ignoring:"
|
||||
qLog(Warning) << "Not a valid Clementine script directory, ignoring:"
|
||||
<< path;
|
||||
continue;
|
||||
}
|
||||
@ -250,7 +251,7 @@ void ScriptManager::Enable(const QModelIndex& index) {
|
||||
// Find an engine for it
|
||||
LanguageEngine* engine = EngineForLanguage(info->language());
|
||||
if (!engine) {
|
||||
qWarning() << "Unknown language in" << info->path();
|
||||
qLog(Warning) << "Unknown language in" << info->path();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -308,7 +309,7 @@ void ScriptManager::AddLogLine(const QString& who, const QString& message, bool
|
||||
log_lines_plain_ << plain;
|
||||
emit LogLineAdded(html);
|
||||
|
||||
qDebug() << plain.toLocal8Bit().constData();
|
||||
qLog(Info) << plain.toLocal8Bit().constData();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "uiinterface.h"
|
||||
#include "core/logging.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QMenu>
|
||||
@ -28,8 +29,7 @@ UIInterface::UIInterface(QObject* parent)
|
||||
|
||||
void UIInterface::RegisterActionLocation(const QString& id, QMenu* menu, QAction* before) {
|
||||
if (locations_.contains(id)) {
|
||||
qDebug() << __PRETTY_FUNCTION__
|
||||
<< "A location with ID" << id << "was already registered";
|
||||
qLog(Warning) << "A location with ID" << id << "was already registered";
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "generator.h"
|
||||
#include "querygenerator.h"
|
||||
#include "core/logging.h"
|
||||
#include "radio/jamendodynamicplaylist.h"
|
||||
|
||||
#include <QSettings>
|
||||
@ -39,7 +40,7 @@ GeneratorPtr Generator::Create(const QString& type) {
|
||||
else if (type == "Jamendo")
|
||||
return GeneratorPtr(new JamendoDynamicPlaylist);
|
||||
|
||||
qWarning() << "Invalid playlist generator type:" << type;
|
||||
qLog(Warning) << "Invalid playlist generator type:" << type;
|
||||
return GeneratorPtr();
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,6 @@ QString Search::ToSql(const QString& songs_table) const {
|
||||
sql += " LIMIT " + QString::number(limit_);
|
||||
}
|
||||
|
||||
qDebug() << sql;
|
||||
return sql;
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "echonestbiographies.h"
|
||||
#include "songinfotextview.h"
|
||||
#include "core/logging.h"
|
||||
|
||||
#include <echonest/Artist.h>
|
||||
|
||||
@ -64,7 +65,7 @@ void EchoNestBiographies::RequestFinished() {
|
||||
try {
|
||||
request->artist_->parseProfile(reply);
|
||||
} catch (Echonest::ParseError e) {
|
||||
qWarning() << "Error parsing echonest reply:" << e.errorType() << e.what();
|
||||
qLog(Warning) << "Error parsing echonest reply:" << e.errorType() << e.what();
|
||||
}
|
||||
|
||||
QSet<QString> already_seen;
|
||||
|
@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "echonestimages.h"
|
||||
#include "core/logging.h"
|
||||
|
||||
#include <echonest/Artist.h>
|
||||
|
||||
@ -48,7 +49,7 @@ void EchoNestImages::RequestFinished() {
|
||||
try {
|
||||
request->artist_->parseProfile(reply);
|
||||
} catch (Echonest::ParseError e) {
|
||||
qWarning() << "Error parsing echonest reply:" << e.errorType() << e.what();
|
||||
qLog(Warning) << "Error parsing echonest reply:" << e.errorType() << e.what();
|
||||
}
|
||||
|
||||
foreach (const Echonest::ArtistImage& image, request->artist_->images()) {
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "echonestsimilarartists.h"
|
||||
#include "tagwidget.h"
|
||||
#include "core/logging.h"
|
||||
#include "ui/iconloader.h"
|
||||
|
||||
#include <echonest/Artist.h>
|
||||
@ -47,7 +48,7 @@ void EchoNestSimilarArtists::RequestFinished() {
|
||||
try {
|
||||
artists = Echonest::Artist::parseSimilar(reply);
|
||||
} catch (Echonest::ParseError e) {
|
||||
qWarning() << "Error parsing echonest reply:" << e.errorType() << e.what();
|
||||
qLog(Warning) << "Error parsing echonest reply:" << e.errorType() << e.what();
|
||||
}
|
||||
|
||||
if (!artists.isEmpty()) {
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "echonesttags.h"
|
||||
#include "tagwidget.h"
|
||||
#include "core/logging.h"
|
||||
|
||||
#include <echonest/Artist.h>
|
||||
|
||||
@ -49,7 +50,7 @@ void EchoNestTags::RequestFinished() {
|
||||
try {
|
||||
request->artist_->parseProfile(reply);
|
||||
} catch (Echonest::ParseError e) {
|
||||
qWarning() << "Error parsing echonest reply:" << e.errorType() << e.what();
|
||||
qLog(Warning) << "Error parsing echonest reply:" << e.errorType() << e.what();
|
||||
}
|
||||
|
||||
if (!request->artist_->terms().isEmpty()) {
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "songinfofetcher.h"
|
||||
#include "songinfoprovider.h"
|
||||
#include "core/logging.h"
|
||||
|
||||
#include <QSignalMapper>
|
||||
#include <QTimer>
|
||||
@ -98,7 +99,7 @@ void SongInfoFetcher::Timeout(int id) {
|
||||
|
||||
// Cancel any providers that we're still waiting for
|
||||
foreach (SongInfoProvider* provider, waiting_for_[id]) {
|
||||
qDebug() << "Request timed out from info provider" << provider->name();
|
||||
qLog(Info) << "Request timed out from info provider" << provider->name();
|
||||
provider->Cancel(id);
|
||||
}
|
||||
waiting_for_.remove(id);
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "songinfotextview.h"
|
||||
#include "ultimatelyricsprovider.h"
|
||||
#include "core/logging.h"
|
||||
#include "core/network.h"
|
||||
|
||||
#include <QNetworkReply>
|
||||
@ -38,7 +39,7 @@ void UltimateLyricsProvider::FetchInfo(int id, const Song& metadata) {
|
||||
// Get the text codec
|
||||
const QTextCodec* codec = QTextCodec::codecForName(charset_.toAscii().constData());
|
||||
if (!codec) {
|
||||
qWarning() << "Invalid codec" << charset_;
|
||||
qLog(Warning) << "Invalid codec" << charset_;
|
||||
emit Finished(id);
|
||||
return;
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "ultimatelyricsprovider.h"
|
||||
#include "ultimatelyricsreader.h"
|
||||
#include "core/logging.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QFile>
|
||||
@ -30,7 +31,7 @@ UltimateLyricsReader::UltimateLyricsReader(QObject* parent)
|
||||
QList<SongInfoProvider*> UltimateLyricsReader::Parse(const QString& filename) const {
|
||||
QFile file(filename);
|
||||
if (!file.open(QIODevice::ReadOnly)) {
|
||||
qWarning() << "Error opening" << filename;
|
||||
qLog(Warning) << "Error opening" << filename;
|
||||
return QList<SongInfoProvider*>();
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "transcoder.h"
|
||||
#include "core/logging.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QDir>
|
||||
@ -252,7 +253,7 @@ TranscoderPreset Transcoder::PresetForFileType(Song::FileType type) {
|
||||
case Song::Type_Wav:
|
||||
return TranscoderPreset(type, "Wav", "wav", QString(), "audio/x-wav");
|
||||
default:
|
||||
qWarning() << "Unsupported format in Transcoder::PresetForFileType:" << type;
|
||||
qLog(Warning) << "Unsupported format in PresetForFileType:" << type;
|
||||
return TranscoderPreset();
|
||||
}
|
||||
}
|
||||
@ -337,7 +338,7 @@ void Transcoder::NewPadCallback(GstElement*, GstPad* pad, gboolean, gpointer dat
|
||||
GstPad* const audiopad = gst_element_get_pad(state->convert_element_, "sink");
|
||||
|
||||
if (GST_PAD_IS_LINKED(audiopad)) {
|
||||
qDebug() << "audiopad is already linked. Unlinking old pad.";
|
||||
qLog(Debug) << "audiopad is already linked, unlinking old pad";
|
||||
gst_pad_unlink(audiopad, GST_PAD_PEER(audiopad));
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "edittagdialog.h"
|
||||
#include "trackselectiondialog.h"
|
||||
#include "ui_edittagdialog.h"
|
||||
#include "core/logging.h"
|
||||
#include "core/utilities.h"
|
||||
#include "covers/albumcoverloader.h"
|
||||
#include "library/library.h"
|
||||
@ -268,7 +269,7 @@ QVariant EditTagDialog::Data::value(const Song& song, const QString& id) {
|
||||
if (id == "track") return song.track();
|
||||
if (id == "disc") return song.disc();
|
||||
if (id == "year") return song.year();
|
||||
qDebug() << "Unknown ID" << id;
|
||||
qLog(Warning) << "Unknown ID" << id;
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "iconloader.h"
|
||||
#include "core/logging.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QtDebug>
|
||||
@ -50,6 +51,6 @@ QIcon IconLoader::Load(const QString &name) {
|
||||
}
|
||||
|
||||
if (ret.isNull())
|
||||
qWarning() << "Couldn't load icon" << name;
|
||||
qLog(Warning) << "Couldn't load icon" << name;
|
||||
return ret;
|
||||
}
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "core/database.h"
|
||||
#include "core/deletefiles.h"
|
||||
#include "core/globalshortcuts.h"
|
||||
#include "core/logging.h"
|
||||
#include "core/mac_startup.h"
|
||||
#include "core/mergedproxymodel.h"
|
||||
#include "core/mimedata.h"
|
||||
@ -1074,7 +1075,7 @@ void MainWindow::UpdateTrackPosition() {
|
||||
if (playlist->get_lastfm_status() == Playlist::LastFM_New) {
|
||||
#ifdef HAVE_LIBLASTFM
|
||||
if (lastfm_service->IsScrobblingEnabled()) {
|
||||
qDebug() << "Scrobbling at" << scrobble_point;
|
||||
qLog(Info) << "Scrobbling at" << scrobble_point;
|
||||
lastfm_service->Scrobble();
|
||||
}
|
||||
#endif
|
||||
@ -1094,7 +1095,7 @@ void MainWindow::UpdateTrackPosition() {
|
||||
|
||||
// Update the tray icon every 10 seconds
|
||||
if (position % 10 == 0) {
|
||||
qDebug() << "position" << position << "scrobble point" << scrobble_point
|
||||
qLog(Debug) << "position" << position << "scrobble point" << scrobble_point
|
||||
<< "status" << playlist->get_lastfm_status();
|
||||
tray_icon_->SetProgress(double(position) / length * 100);
|
||||
|
||||
@ -2182,7 +2183,7 @@ void MainWindow::ScrobblerStatus(int value) {
|
||||
if (value > 3) {
|
||||
// we're for sure in an error state
|
||||
playlists_->active()->set_lastfm_status(Playlist::LastFM_Error);
|
||||
qWarning() << "Last.fm scrobbling error: " << value;
|
||||
qLog(Warning) << "Last.fm scrobbling error: " << value;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "windows7thumbbar.h"
|
||||
#include "core/logging.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QtDebug>
|
||||
@ -91,7 +92,7 @@ void Windows7ThumbBar::HandleWinEvent(MSG* msg) {
|
||||
// Create the taskbar list for the first time
|
||||
if (CoCreateInstance(CLSID_ITaskbarList, NULL, CLSCTX_ALL,
|
||||
IID_ITaskbarList3, (void**) &taskbar_list_)) {
|
||||
qWarning() << "Error creating the ITaskbarList3 interface";
|
||||
qLog(Warning) << "Error creating the ITaskbarList3 interface";
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
|
||||
#include "fancytabwidget.h"
|
||||
#include "stylehelper.h"
|
||||
#include "core/logging.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
@ -589,7 +590,7 @@ void FancyTabWidget::SetMode(Mode mode) {
|
||||
switch (mode) {
|
||||
case Mode_None:
|
||||
default:
|
||||
qDebug() << "Unknown fancy tab mode" << mode;
|
||||
qLog(Warning) << "Unknown fancy tab mode" << mode;
|
||||
// fallthrough
|
||||
|
||||
case Mode_LargeSidebar: {
|
||||
|
@ -1,36 +1,37 @@
|
||||
/* This file is part of Clementine.
|
||||
Copyright 2010, David Sansome <me@davidsansome.com>
|
||||
|
||||
Clementine 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "osd.h"
|
||||
|
||||
#include <QtDebug>
|
||||
|
||||
void OSD::Init() {
|
||||
}
|
||||
|
||||
bool OSD::SupportsNativeNotifications() {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OSD::SupportsTrayPopups() {
|
||||
return true;
|
||||
}
|
||||
|
||||
void OSD::ShowMessageNative(const QString&, const QString&,
|
||||
const QString&, const QImage&) {
|
||||
qWarning() << __PRETTY_FUNCTION__ << ": NOT IMPLEMENTED";
|
||||
}
|
||||
Copyright 2010, David Sansome <me@davidsansome.com>
|
||||
|
||||
Clementine 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "osd.h"
|
||||
#include "core/logging.h"
|
||||
|
||||
#include <QtDebug>
|
||||
|
||||
void OSD::Init() {
|
||||
}
|
||||
|
||||
bool OSD::SupportsNativeNotifications() {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OSD::SupportsTrayPopups() {
|
||||
return true;
|
||||
}
|
||||
|
||||
void OSD::ShowMessageNative(const QString&, const QString&,
|
||||
const QString&, const QImage&) {
|
||||
qLog(Warning) << "not implemented";
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "config.h"
|
||||
#include "osd.h"
|
||||
#include "core/logging.h"
|
||||
|
||||
#include <QtDebug>
|
||||
|
||||
@ -66,7 +67,7 @@ void OSD::Init() {
|
||||
"/org/freedesktop/Notifications",
|
||||
QDBusConnection::sessionBus()));
|
||||
if (!interface_->isValid()) {
|
||||
qWarning() << "Error connecting to notifications service.";
|
||||
qLog(Warning) << "Error connecting to notifications service.";
|
||||
}
|
||||
#endif // HAVE_DBUS
|
||||
}
|
||||
@ -116,7 +117,7 @@ void OSD::ShowMessageNative(const QString& summary, const QString& message,
|
||||
connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
|
||||
SLOT(CallFinished(QDBusPendingCallWatcher*)));
|
||||
#else // HAVE_DBUS
|
||||
qWarning() << __PRETTY_FUNCTION__ << ": NOT IMPLEMENTED";
|
||||
qLog(Warning) << "not implemented";
|
||||
#endif // HAVE_DBUS
|
||||
}
|
||||
|
||||
@ -126,7 +127,7 @@ void OSD::CallFinished(QDBusPendingCallWatcher* watcher) {
|
||||
|
||||
QDBusPendingReply<uint> reply = *watcher;
|
||||
if (reply.isError()) {
|
||||
qWarning() << "Error sending notification" << reply.error().name();
|
||||
qLog(Warning) << "Error sending notification" << reply.error().name();
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user