diff --git a/krita/main.cc b/krita/main.cc index 83da7ed187..f25fc08202 100644 --- a/krita/main.cc +++ b/krita/main.cc @@ -1,291 +1,278 @@ /* * Copyright (c) 1999 Matthias Elter * Copyright (c) 2002 Patrick Julien * Copyright (c) 2015 Boudewijn Rempt * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include #include #include #include #include #include #include #include #include -#include #include #include #include #include #include #include #include "data/splash/splash_screen.xpm" #include "data/splash/splash_holidays.xpm" #include "KisDocument.h" #include "kis_splash_screen.h" #include "KisPart.h" #include "KisApplicationArguments.h" #include #include "input/KisQtWidgetsTweaker.h" #if defined Q_OS_WIN #include #include #include #elif defined HAVE_X11 #include #include #endif #if defined HAVE_KCRASH #include #elif defined USE_DRMINGW namespace { void tryInitDrMingw() { wchar_t path[MAX_PATH]; QString pathStr = QCoreApplication::applicationDirPath().replace(L'/', L'\\') + QStringLiteral("\\exchndl.dll"); if (pathStr.size() > MAX_PATH - 1) { return; } int pathLen = pathStr.toWCharArray(path); path[pathLen] = L'\0'; // toWCharArray doesn't add NULL terminator HMODULE hMod = LoadLibraryW(path); if (!hMod) { return; } // No need to call ExcHndlInit since the crash handler is installed on DllMain auto myExcHndlSetLogFileNameA = reinterpret_cast(GetProcAddress(hMod, "ExcHndlSetLogFileNameA")); if (!myExcHndlSetLogFileNameA) { return; } // Set the log file path to %LocalAppData%\kritacrash.log QString logFile = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation).replace(L'/', L'\\') + QStringLiteral("\\kritacrash.log"); myExcHndlSetLogFileNameA(logFile.toLocal8Bit()); } } // namespace #endif extern "C" int main(int argc, char **argv) { // The global initialization of the random generator qsrand(time(0)); bool runningInKDE = !qgetenv("KDE_FULL_SESSION").isEmpty(); #if defined HAVE_X11 qputenv("QT_QPA_PLATFORM", "xcb"); #endif - /** - * Disable debug output by default. (krita.input enables tablet debugging.) - * Debug logs can be controlled by an environment variable QT_LOGGING_RULES. - * - * As an example, to get full debug output, run the following: - * export QT_LOGGING_RULES="krita*=true"; krita - * - * See: http://doc.qt.io/qt-5/qloggingcategory.html - */ - QLoggingCategory::setFilterRules("krita*.debug=false\n" - "krita*.warning=true\n" - "krita.tabletlog=true"); // A per-user unique string, without /, because QLocalServer cannot use names with a / in it QString key = "Krita3" + QDesktopServices::storageLocation(QDesktopServices::HomeLocation).replace("/", "_"); key = key.replace(":", "_").replace("\\","_"); QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true); QCoreApplication::setAttribute(Qt::AA_DontCreateNativeWidgetSiblings, true); QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true); const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation); bool singleApplication = true; bool enableOpenGLDebug = false; bool openGLDebugSynchronous = false; { QSettings kritarc(configPath + QStringLiteral("/kritadisplayrc"), QSettings::IniFormat); singleApplication = kritarc.value("EnableSingleApplication", true).toBool(); #if QT_VERSION >= 0x050600 if (kritarc.value("EnableHiDPI", false).toBool()) { QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); } if (!qgetenv("KRITA_HIDPI").isEmpty()) { QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); } #endif if (!qgetenv("KRITA_OPENGL_DEBUG").isEmpty()) { enableOpenGLDebug = true; } else { enableOpenGLDebug = kritarc.value("EnableOpenGLDebug", false).toBool(); } if (enableOpenGLDebug && (qgetenv("KRITA_OPENGL_DEBUG") == "sync" || kritarc.value("OpenGLDebugSynchronous", false).toBool())) { openGLDebugSynchronous = true; } } KisOpenGL::setDefaultFormat(enableOpenGLDebug, openGLDebugSynchronous); KLocalizedString::setApplicationDomain("krita"); // first create the application so we can create a pixmap KisApplication app(key, argc, argv); #ifdef Q_OS_LINUX qputenv("XDG_DATA_DIRS", QFile::encodeName(KoResourcePaths::getApplicationRoot() + "share") + ":" + qgetenv("XDG_DATA_DIRS")); #else qputenv("XDG_DATA_DIRS", QFile::encodeName(KoResourcePaths::getApplicationRoot() + "share")); #endif qDebug() << "Setting XDG_DATA_DIRS" << qgetenv("XDG_DATA_DIRS"); qDebug() << "Available translations" << KLocalizedString::availableApplicationTranslations(); qDebug() << "Available domain translations" << KLocalizedString::availableDomainTranslations("krita"); // Now that the paths are set, set the language. First check the override from the langage // selection dialog. { QSettings languageoverride(configPath + QStringLiteral("/klanguageoverridesrc"), QSettings::IniFormat); languageoverride.beginGroup(QStringLiteral("Language")); QString language = languageoverride.value(qAppName(), "").toString(); qDebug() << "Override language:" << language; if (!language.isEmpty()) { KLocalizedString::setLanguages(language.split(":")); // And override Qt's locale, too qputenv("LANG", language.split(":").first().toUtf8()); QLocale locale(language.split(":").first()); QLocale::setDefault(locale); qDebug() << "Qt ui languages" << locale.uiLanguages(); } else { // And if there isn't one, check the one set by the system. // XXX: This doesn't work, for some !@#$% reason. QLocale locale = QLocale::system(); if (locale.bcp47Name() != QStringLiteral("en")) { qputenv("LANG", locale.bcp47Name().toLatin1()); KLocalizedString::setLanguages(QStringList() << locale.bcp47Name()); } } } #ifdef Q_OS_WIN QDir appdir(KoResourcePaths::getApplicationRoot()); QString path = qgetenv("PATH"); qputenv("PATH", QFile::encodeName(appdir.absolutePath() + "/bin" + ";" + appdir.absolutePath() + "/lib" + ";" + appdir.absolutePath() + "/Frameworks" + ";" + appdir.absolutePath() + ";" + path)); qDebug() << "PATH" << qgetenv("PATH"); #endif if (qApp->applicationDirPath().contains(KRITA_BUILD_DIR)) { qFatal("FATAL: You're trying to run krita from the build location. You can only run Krita from the installation location."); } #if defined HAVE_KCRASH KCrash::initialize(); #elif defined USE_DRMINGW tryInitDrMingw(); #endif // If we should clear the config, it has to be done as soon as possible after // KisApplication has been created. Otherwise the config file may have been read // and stored in a KConfig object we have no control over. app.askClearConfig(); KisApplicationArguments args(app); if (singleApplication && app.isRunning()) { // only pass arguments to main instance if they are not for batch processing // any batch processing would be done in this separate instance const bool batchRun = (args.print() || args.exportAs() || args.exportAsPdf()); if (!batchRun) { QByteArray ba = args.serialize(); if (app.sendMessage(ba)) { return 0; } } } if (!runningInKDE) { // Icons in menus are ugly and distracting app.setAttribute(Qt::AA_DontShowIconsInMenus); } #if defined HAVE_X11 app.installNativeEventFilter(KisXi2EventFilter::instance()); #endif app.installEventFilter(KisQtWidgetsTweaker::instance()); // then create the pixmap from an xpm: we cannot get the // location of our datadir before we've started our components, // so use an xpm. QDate currentDate = QDate::currentDate(); QWidget *splash = 0; if (currentDate > QDate(currentDate.year(), 12, 4) || currentDate < QDate(currentDate.year(), 1, 9)) { splash = new KisSplashScreen(app.applicationVersion(), QPixmap(splash_holidays_xpm)); } else { splash = new KisSplashScreen(app.applicationVersion(), QPixmap(splash_screen_xpm)); } app.setSplashScreen(splash); #if defined Q_OS_WIN KisTabletSupportWin::init(); // app.installNativeEventFilter(new KisTabletSupportWin()); #endif if (!app.start(args)) { return 1; } #if QT_VERSION >= 0x050700 app.setAttribute(Qt::AA_CompressHighFrequencyEvents, false); #endif // Set up remote arguments. QObject::connect(&app, SIGNAL(messageReceived(QByteArray,QObject*)), &app, SLOT(remoteArguments(QByteArray,QObject*))); QObject::connect(&app, SIGNAL(fileOpenRequest(QString)), &app, SLOT(fileOpenRequested(QString))); int state = app.exec(); { QSettings kritarc(configPath + QStringLiteral("/kritadisplayrc"), QSettings::IniFormat); kritarc.setValue("canvasState", "OPENGL_SUCCESS"); } return state; } diff --git a/libs/flake/FlakeDebug.cpp b/libs/flake/FlakeDebug.cpp index 33348f8f47..4cdef2ffff 100644 --- a/libs/flake/FlakeDebug.cpp +++ b/libs/flake/FlakeDebug.cpp @@ -1,27 +1,27 @@ /* * Copyright (c) 2015 Boudewijn Rempt * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "FlakeDebug.h" const QLoggingCategory &FLAKE_LOG() \ { - static const QLoggingCategory category("krita.lib.flake"); + static const QLoggingCategory category("krita.lib.flake", QtInfoMsg); return category; } diff --git a/libs/global/kis_debug.cpp b/libs/global/kis_debug.cpp index 8f347d50e7..0597ff130f 100644 --- a/libs/global/kis_debug.cpp +++ b/libs/global/kis_debug.cpp @@ -1,115 +1,115 @@ /* * Copyright (c) 2014 Dmitry Kazakov * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "kis_debug.h" #include "config-debug.h" #if HAVE_BACKTRACE #include #ifdef __GNUC__ #define HAVE_BACKTRACE_DEMANGLE #include #endif #endif #include #if HAVE_BACKTRACE static QString maybeDemangledName(char *name) { #ifdef HAVE_BACKTRACE_DEMANGLE const int len = strlen(name); QByteArray in = QByteArray::fromRawData(name, len); const int mangledNameStart = in.indexOf("(_"); if (mangledNameStart >= 0) { const int mangledNameEnd = in.indexOf('+', mangledNameStart + 2); if (mangledNameEnd >= 0) { int status; // if we forget about this line and the one that undoes its effect we don't change the // internal data of the QByteArray::fromRawData() ;) name[mangledNameEnd] = 0; char *demangled = abi::__cxa_demangle(name + mangledNameStart + 1, 0, 0, &status); name[mangledNameEnd] = '+'; if (demangled) { QString ret = QString::fromLatin1(name, mangledNameStart + 1) + QString::fromLatin1(demangled) + QString::fromLatin1(name + mangledNameEnd, len - mangledNameEnd); free(demangled); return ret; } } } #endif return QString::fromLatin1(name); } #endif QString kisBacktrace() { QString s; #if HAVE_BACKTRACE void *trace[256]; int n = backtrace(trace, 256); if (!n) { return s; } char **strings = backtrace_symbols(trace, n); s = QLatin1String("[\n"); for (int i = 0; i < n; ++i) s += QString::number(i) + QLatin1String(": ") + maybeDemangledName(strings[i]) + QLatin1Char('\n'); s += QLatin1String("]\n"); if (strings) { free(strings); } #endif return s; } -Q_LOGGING_CATEGORY(_30009, "krita.lib.resources") -Q_LOGGING_CATEGORY(_41000, "krita.general") -Q_LOGGING_CATEGORY(_41001, "krita.core") -Q_LOGGING_CATEGORY(_41002, "krita.registry") -Q_LOGGING_CATEGORY(_41003, "krita.tools") -Q_LOGGING_CATEGORY(_41004, "krita.tiles") -Q_LOGGING_CATEGORY(_41005, "krita.filters") -Q_LOGGING_CATEGORY(_41006, "krita.plugins") -Q_LOGGING_CATEGORY(_41007, "krita.ui") -Q_LOGGING_CATEGORY(_41008, "krita.file") -Q_LOGGING_CATEGORY(_41009, "krita.math") -Q_LOGGING_CATEGORY(_41010, "krita.render") -Q_LOGGING_CATEGORY(_41011, "krita.scripting") -Q_LOGGING_CATEGORY(_41012, "krita.input") -Q_LOGGING_CATEGORY(_41013, "krita.action") -Q_LOGGING_CATEGORY(_41014, "krita.tabletlog") -Q_LOGGING_CATEGORY(_41015, "krita.opengl") +Q_LOGGING_CATEGORY(_30009, "krita.lib.resources", QtInfoMsg) +Q_LOGGING_CATEGORY(_41000, "krita.general", QtInfoMsg) +Q_LOGGING_CATEGORY(_41001, "krita.core", QtInfoMsg) +Q_LOGGING_CATEGORY(_41002, "krita.registry", QtInfoMsg) +Q_LOGGING_CATEGORY(_41003, "krita.tools", QtInfoMsg) +Q_LOGGING_CATEGORY(_41004, "krita.tiles", QtInfoMsg) +Q_LOGGING_CATEGORY(_41005, "krita.filters", QtInfoMsg) +Q_LOGGING_CATEGORY(_41006, "krita.plugins", QtInfoMsg) +Q_LOGGING_CATEGORY(_41007, "krita.ui", QtInfoMsg) +Q_LOGGING_CATEGORY(_41008, "krita.file", QtInfoMsg) +Q_LOGGING_CATEGORY(_41009, "krita.math", QtInfoMsg) +Q_LOGGING_CATEGORY(_41010, "krita.render", QtInfoMsg) +Q_LOGGING_CATEGORY(_41011, "krita.scripting", QtInfoMsg) +Q_LOGGING_CATEGORY(_41012, "krita.input", QtInfoMsg) +Q_LOGGING_CATEGORY(_41013, "krita.action", QtInfoMsg) +Q_LOGGING_CATEGORY(_41014, "krita.tabletlog", QtDebugMsg) +Q_LOGGING_CATEGORY(_41015, "krita.opengl", QtInfoMsg) QString __methodName(const char *_prettyFunction) { std::string prettyFunction(_prettyFunction); size_t colons = prettyFunction.find("::"); size_t begin = prettyFunction.substr(0,colons).rfind(" ") + 1; size_t end = prettyFunction.rfind("(") - begin; return QString(std::string(prettyFunction.substr(begin,end) + "()").c_str()); } diff --git a/libs/koplugin/KritaPluginDebug.cpp b/libs/koplugin/KritaPluginDebug.cpp index e69a461e5c..eb0ed8e539 100644 --- a/libs/koplugin/KritaPluginDebug.cpp +++ b/libs/koplugin/KritaPluginDebug.cpp @@ -1,27 +1,27 @@ /* * Copyright (c) 2015 Boudewijn Rempt * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "KritaPluginDebug.h" const QLoggingCategory &PLUGIN_LOG() \ { - static const QLoggingCategory category("krita.lib.plugin"); + static const QLoggingCategory category("krita.lib.plugin", QtInfoMsg); return category; } diff --git a/libs/odf/OdfDebug.cpp b/libs/odf/OdfDebug.cpp index 6caa0f153d..d8a6d69fe4 100644 --- a/libs/odf/OdfDebug.cpp +++ b/libs/odf/OdfDebug.cpp @@ -1,27 +1,27 @@ /* * Copyright (c) 2015 Boudewijn Rempt * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "OdfDebug.h" const QLoggingCategory &ODF_LOG() \ { - static const QLoggingCategory category("krita.lib.odf"); + static const QLoggingCategory category("krita.lib.odf", QtInfoMsg); return category; } diff --git a/libs/pigment/DebugPigment.cpp b/libs/pigment/DebugPigment.cpp index a75300d8a1..e7e928b037 100644 --- a/libs/pigment/DebugPigment.cpp +++ b/libs/pigment/DebugPigment.cpp @@ -1,26 +1,26 @@ /* * Copyright (c) 2015 Boudewijn Rempt * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "DebugPigment.h" const QLoggingCategory &PIGMENT_log() \ { - static const QLoggingCategory category("krita.lib.pigment"); + static const QLoggingCategory category("krita.lib.pigment", QtInfoMsg); return category; } diff --git a/libs/store/StoreDebug.cpp b/libs/store/StoreDebug.cpp index b0ca6330c3..336fe45f5f 100644 --- a/libs/store/StoreDebug.cpp +++ b/libs/store/StoreDebug.cpp @@ -1,27 +1,27 @@ /* * Copyright (c) 2015 Boudewijn Rempt * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "StoreDebug.h" const QLoggingCategory &STORE_LOG() \ { - static const QLoggingCategory category("krita.lib.store"); + static const QLoggingCategory category("krita.lib.store", QtInfoMsg); return category; } diff --git a/libs/vectorimage/VectorImageDebug.cpp b/libs/vectorimage/VectorImageDebug.cpp index 771c549f6a..bc780b12e7 100644 --- a/libs/vectorimage/VectorImageDebug.cpp +++ b/libs/vectorimage/VectorImageDebug.cpp @@ -1,26 +1,26 @@ /* * Copyright (c) 2015 Boudewijn Rempt * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "VectorImageDebug.h" const QLoggingCategory &VECTOR_IMAGE_LOG() \ { - static const QLoggingCategory category("krita.lib.vectorimage"); + static const QLoggingCategory category("krita.lib.vectorimage", QtInfoMsg); return category; } diff --git a/libs/widgets/WidgetsDebug.cpp b/libs/widgets/WidgetsDebug.cpp index 878892daa4..905436231c 100644 --- a/libs/widgets/WidgetsDebug.cpp +++ b/libs/widgets/WidgetsDebug.cpp @@ -1,27 +1,27 @@ /* * Copyright (c) 2015 Boudewijn Rempt * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "WidgetsDebug.h" const QLoggingCategory &WIDGETS_LOG() \ { - static const QLoggingCategory category("krita.lib.widgets"); + static const QLoggingCategory category("krita.lib.widgets", QtInfoMsg); return category; } diff --git a/libs/widgetutils/WidgetUtilsDebug.cpp b/libs/widgetutils/WidgetUtilsDebug.cpp index ee4dd7f7ea..58a6288569 100644 --- a/libs/widgetutils/WidgetUtilsDebug.cpp +++ b/libs/widgetutils/WidgetUtilsDebug.cpp @@ -1,27 +1,27 @@ /* * Copyright (c) 2015 Boudewijn Rempt * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "WidgetUtilsDebug.h" const QLoggingCategory &KRITAWIDGETUTILS_LOG() { - static const QLoggingCategory category("krita.lib.widgetutils"); + static const QLoggingCategory category("krita.lib.widgetutils", QtInfoMsg); return category; } diff --git a/plugins/extensions/pykrita/kritarunner/main.cpp b/plugins/extensions/pykrita/kritarunner/main.cpp index caf5eabd1d..9a2ac54ff5 100644 --- a/plugins/extensions/pykrita/kritarunner/main.cpp +++ b/plugins/extensions/pykrita/kritarunner/main.cpp @@ -1,123 +1,119 @@ /* * Copyright (c) 2016 Boudewijn Rempt * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include #include #include #include #include #include #include #include "kis_md5_generator.h" #include #include #include extern "C" int main(int argc, char **argv) { // The global initialization of the random generator qsrand(time(0)); KLocalizedString::setApplicationDomain("kritarunner"); QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true); KisOpenGL::setDefaultFormat(); - QLoggingCategory::setFilterRules("krita*.debug=false\n" - "krita*.warning=false\n" - "krita.tabletlog=false"); - // first create the application so we can create a pixmap KisApplication app("kritarunner", argc, argv); app.setApplicationDisplayName("Krita Script Runner"); app.setApplicationName("kritarunner"); app.setOrganizationDomain("krita.org"); QCommandLineParser parser; parser.setApplicationDescription("kritarunner executes one python script and then returns."); parser.addVersionOption(); parser.addHelpOption(); QCommandLineOption scriptOption(QStringList() << "s" << "script", "The script to run. Do not append the .py extension.", "script"); parser.addOption(scriptOption); QCommandLineOption functionOption(QStringList() << "f" << "function", "The function to call (by default __main__ is called).", "function", "__main__"); parser.addOption(functionOption); parser.addPositionalArgument("[argument(s)]", "The argumetns for the script"); parser.process(app); if (!parser.isSet(scriptOption)) { qDebug("No script given, aborting."); return 1; } qDebug() << "running:" << parser.value(scriptOption) << parser.value(functionOption); qDebug() << parser.positionalArguments(); KoHashGeneratorProvider::instance()->setGenerator("MD5", new KisMD5Generator()); KoGlobal::initialize(); app.addResourceTypes(); app.loadResources(); app.loadPlugins(); QByteArray pythonPath = qgetenv("PYTHONPATH"); qDebug() << "\tPython path:" << pythonPath; qDebug() << "Creating engine"; PyKrita::Engine engine; QString r = engine.tryInitializeGetFailureReason(); if (!r.isEmpty()) { qDebug("Could not initialize the Python engine"); return 1; } qDebug() << "Try to import the pykrita module"; PyKrita::Python py = PyKrita::Python(); PyObject* pykritaPackage = py.moduleImport("pykrita"); pykritaPackage = py.moduleImport("krita"); if (!pykritaPackage) { qDebug("Cannot load the PyKrita module, aborting"); return 1; } PyObject *argsList = PyList_New(0); Q_FOREACH(const QString arg, parser.positionalArguments()) { PyObject* const u = py.unicode(arg); PyList_Append(argsList, u); Py_DECREF(u); } PyObject *args = PyTuple_New(1); PyTuple_SetItem(args, 0, argsList); py.functionCall(parser.value(functionOption).toUtf8().constData(), parser.value(scriptOption).toUtf8().constData(), args); Py_DECREF(argsList); Py_DECREF(args); app.quit(); return 0; } diff --git a/plugins/flake/textshape/kotext/TextDebug.cpp b/plugins/flake/textshape/kotext/TextDebug.cpp index d862bb1987..0bb3587900 100644 --- a/plugins/flake/textshape/kotext/TextDebug.cpp +++ b/plugins/flake/textshape/kotext/TextDebug.cpp @@ -1,27 +1,27 @@ /* * Copyright (c) 2015 Boudewijn Rempt * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "TextDebug.h" const QLoggingCategory &TEXT_LOG() \ { - static const QLoggingCategory category("krita.lib.text"); + static const QLoggingCategory category("krita.lib.text", QtInfoMsg); return category; } diff --git a/plugins/flake/textshape/textlayout/TextLayoutDebug.cpp b/plugins/flake/textshape/textlayout/TextLayoutDebug.cpp index 0d8800dd71..95a95c04f3 100644 --- a/plugins/flake/textshape/textlayout/TextLayoutDebug.cpp +++ b/plugins/flake/textshape/textlayout/TextLayoutDebug.cpp @@ -1,27 +1,27 @@ /* * Copyright (c) 2015 Boudewijn Rempt * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "TextLayoutDebug.h" const QLoggingCategory &TEXT_LAYOUT_LOG() \ { - static const QLoggingCategory category("krita.lib.textlayout"); + static const QLoggingCategory category("krita.lib.textlayout", QtInfoMsg); return category; }