Skip to content

Commit

Permalink
Merge branch 'master' into rempt/T4121-improve-palette-format
Browse files Browse the repository at this point in the history
  • Loading branch information
hallarempt committed Mar 14, 2017
2 parents 0cf11ea + ec671ef commit 5f1d09e
Show file tree
Hide file tree
Showing 117 changed files with 976 additions and 537 deletions.
4 changes: 4 additions & 0 deletions krita/data/templates/animation/.directory
@@ -1,11 +1,15 @@
[Desktop Entry]
Name=Animation Templates
Name[ca]=Plantilles d'animació
Name[ca@valencia]=Plantilles d'animació
Name[cs]=Šablony animací:
Name[en_GB]=Animation Templates
Name[es]=Plantillas de animación
Name[it]=Modelli di animazioni
Name[nl]=Animatiesjablonen
Name[pl]=Szablony animacji
Name[pt]=Modelos de Animações
Name[pt_BR]=Modelos de animação
Name[sv]=Animeringsmallar
Name[uk]=Шаблони анімацій
Name[x-test]=xxAnimation Templatesxx
Expand Down
1 change: 1 addition & 0 deletions krita/data/templates/animation/Anim-Jp-EN.desktop
Expand Up @@ -14,6 +14,7 @@ Name[ja]=日本式アニメ(英語版)
Name[nl]=Animatie-Japans-En
Name[pl]=Animacja-Japońska-En
Name[pt]=Animação-Japonês-EN
Name[pt_BR]=Animation-Japanese-En
Name[ru]=Анимация-японская-англ
Name[sk]=Animation-Japanese-En
Name[sv]=Animering-japanska-en
Expand Down
1 change: 1 addition & 0 deletions krita/data/templates/animation/Anim-Jp-JP.desktop
Expand Up @@ -14,6 +14,7 @@ Name[ja]=日本式アニメ(日本語版)
Name[nl]=Animatie-Japans-JP
Name[pl]=Animacja-Japońska-JP
Name[pt]=Animação-Japonês-JP
Name[pt_BR]=Animation-Japanese-JP
Name[ru]=Анимация-японская-японск
Name[sk]=Animation-Japanese-JP
Name[sv]=Animering-japanska-jp
Expand Down
80 changes: 80 additions & 0 deletions krita/dtd/document-info.dtd
@@ -0,0 +1,80 @@
<!-- $Id$

This is an XML document type definition (DTD) for the documentinfo.xml files which
are used by all Calligra-1.1 and 1.1.1 programs, to store information about the
document (e.g. title and abstract) and its author.

ChangeLog:
Initial version (for calligra-1.1.1) written by David Faure <faure@kde.org>.
-->

<!--
The document-info for a Calligra document contains one main element for each tab of
the "Document Info" dialog. As of Calligra-1.1, this includes: author and about.
A third page, "log" is planned for the future.
-->
<!ELEMENT document-info
(author?, about?, log?)>

<!--
The "author" element stores information about the author of the document.
-->
<!ELEMENT author
(full-name?, initial?, title?, company?, email?, telephone?, telephone-work?, fax?, country?, postal-code?, city?, street?, position?)>

<!ELEMENT full-name
(#PCDATA)>
<!ELEMENT initial
(#PCDATA)>
<!ELEMENT title
(#PCDATA)>
<!ELEMENT company
(#PCDATA)>
<!ELEMENT email
(#PCDATA)>
<!ELEMENT telephone
(#PCDATA)>
<!ELEMENT telephone-work
(#PCDATA)>
<!ELEMENT fax
(#PCDATA)>
<!ELEMENT country
(#PCDATA)>
<!ELEMENT postal-code
(#PCDATA)>
<!ELEMENT city
(#PCDATA)>
<!ELEMENT street
(#PCDATA)>
<!ELEMENT position
(#PCDATA)>

<!--
The "about" element contains information about the document itself.
This includes an optional title for the document, and an optional abstract.
-->
<!ELEMENT about
(abstract?, title?, keyword?, subject?, initial-creator?,
editing-cycles?, creation-date?, date?)>
<!ELEMENT abstract
(#PCDATA)>
<!--title already defined above-->
<!ELEMENT keyword
(#PCDATA)>
<!ELEMENT subject
(#PCDATA)>
<!ELEMENT initial-creator
(#PCDATA)>
<!ELEMENT editing-cycles
(#PCDATA)>
<!ELEMENT creation-date
(#PCDATA)>
<!ELEMENT date
(#PCDATA)>

<!--
The "log" element is unused at the moment.
-->
<!ELEMENT log
EMPTY>

71 changes: 43 additions & 28 deletions krita/main.cc
Expand Up @@ -52,8 +52,8 @@
#include <kis_tablet_support_win.h>

#elif defined HAVE_X11
#include <kis_tablet_support_x11.h>
#include <kis_xi2_event_filter.h>
#include <kis_tablet_support_x11.h>
#include <kis_xi2_event_filter.h>
#endif

#if defined HAVE_KCRASH
Expand Down Expand Up @@ -119,9 +119,18 @@ extern "C" int main(int argc, char **argv)
QCoreApplication::setAttribute(Qt::AA_DontCreateNativeWidgetSiblings, true);
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true);

const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);


#if QT_VERSION >= 0x050600
if (!qgetenv("KRITA_HIDPI").isEmpty()) {
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
{
QSettings kritarc(configPath + QStringLiteral("/kritaopenglrc"), QSettings::IniFormat);
if (kritarc.value("EnableHiDPI", false).toBool()) {
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
}
if (!qgetenv("KRITA_HIDPI").isEmpty()) {
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
}
}
#endif

Expand All @@ -142,31 +151,32 @@ extern "C" int main(int argc, char **argv)

// Now that the paths are set, set the language. First check the override from the langage
// selection dialog.
const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
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());
{
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");
Expand Down Expand Up @@ -226,7 +236,7 @@ extern "C" int main(int argc, char **argv)
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));
splash = new KisSplashScreen(app.applicationVersion(), QPixmap(splash_holidays_xpm));
}
else {
splash = new KisSplashScreen(app.applicationVersion(), QPixmap(splash_screen_xpm));
Expand Down Expand Up @@ -257,6 +267,11 @@ extern "C" int main(int argc, char **argv)

int state = app.exec();

{
QSettings kritarc(configPath + QStringLiteral("/kritaopenglrc"), QSettings::IniFormat);
kritarc.setValue("canvasState", "OPENGL_SUCCESS");
}

return state;
}

1 change: 1 addition & 0 deletions libs/flake/CMakeLists.txt
Expand Up @@ -198,6 +198,7 @@ set(kritaflake_SRCS
svg/SvgShapeFactory.cpp

FlakeDebug.cpp
tests/MockShapes.cpp
)

ki18n_wrap_ui(kritaflake_SRCS
Expand Down
15 changes: 11 additions & 4 deletions libs/flake/KoCanvasBase.cpp
Expand Up @@ -19,6 +19,8 @@
*/

#include <QRectF>
#include <QPointer>
#include <QDebug>

#include "KoCanvasBase.h"
#include "KoCanvasResourceManager.h"
Expand All @@ -33,7 +35,8 @@
class Q_DECL_HIDDEN KoCanvasBase::Private
{
public:
Private() : shapeController(0),
Private()
: shapeController(0),
resourceManager(0),
isResourceManagerShared(false),
controller(0),
Expand All @@ -48,8 +51,8 @@ class Q_DECL_HIDDEN KoCanvasBase::Private
}
delete snapGuide;
}
KoShapeController *shapeController;
KoCanvasResourceManager *resourceManager;
QPointer<KoShapeController> shapeController;
QPointer<KoCanvasResourceManager> resourceManager;
bool isResourceManagerShared;
KoCanvasController *controller;
KoSnapGuide *snapGuide;
Expand All @@ -68,6 +71,7 @@ KoCanvasBase::KoCanvasBase(KoShapeBasedDocumentBase *shapeBasedDocument, KoCanva

KoCanvasBase::~KoCanvasBase()
{
d->shapeController->reset();
delete d;
}

Expand All @@ -78,7 +82,10 @@ QPointF KoCanvasBase::viewToDocument(const QPointF &viewPoint) const

KoShapeController *KoCanvasBase::shapeController() const
{
return d->shapeController;
if (d->shapeController)
return d->shapeController;
else
return 0;
}

void KoCanvasBase::disconnectCanvasObserver(QObject *object)
Expand Down
7 changes: 4 additions & 3 deletions libs/flake/KoCanvasBase.h
Expand Up @@ -42,19 +42,20 @@ class KoSnapGuide;

class QWidget;
class QCursor;
class QObject;
class QPointF;
class QRectF;
class QSizeF;

#include <QObject>

/**
* KoCanvasBase is the interface actual application canvas classes
* should implement. Flake tools know about the canvas, so they can
* do things like scroll, redraw, set a cursor etc.
*/
class KRITAFLAKE_EXPORT KoCanvasBase
class KRITAFLAKE_EXPORT KoCanvasBase : public QObject
{

Q_OBJECT
public:

/**
Expand Down
17 changes: 11 additions & 6 deletions libs/flake/KoCanvasControllerWidget.cpp
Expand Up @@ -144,16 +144,18 @@ void KoCanvasControllerWidget::Private::activate()
if (!observerProvider) {
return;
}

KoCanvasBase *canvas = q->canvas();
Q_FOREACH (KoCanvasObserverBase *docker, observerProvider->canvasObservers()) {
KoCanvasObserverBase *observer = dynamic_cast<KoCanvasObserverBase*>(docker);
if (observer) {
observer->setObservedCanvas(q->canvas());
observer->setObservedCanvas(canvas);
}
}

}

void KoCanvasControllerWidget::Private::unsetCanvas()
void KoCanvasControllerWidget::Private::unsetCanvas(KoCanvasBase *canvas)
{
QWidget *parent = q;
while (parent->parentWidget()) {
Expand All @@ -165,8 +167,10 @@ void KoCanvasControllerWidget::Private::unsetCanvas()
}
Q_FOREACH (KoCanvasObserverBase *docker, observerProvider->canvasObservers()) {
KoCanvasObserverBase *observer = dynamic_cast<KoCanvasObserverBase*>(docker);
if (observer && observer->observedCanvas() == q->canvas()) {
observer->unsetObservedCanvas();
if (observer) {
if (!canvas || observer->observedCanvas() == q->canvas()) {
observer->unsetObservedCanvas();
}
}
}
}
Expand Down Expand Up @@ -207,7 +211,7 @@ KoCanvasControllerWidget::KoCanvasControllerWidget(KActionCollection * actionCol

KoCanvasControllerWidget::~KoCanvasControllerWidget()
{
d->unsetCanvas();
d->unsetCanvas(0);
delete d;
}

Expand Down Expand Up @@ -247,7 +251,7 @@ void KoCanvasControllerWidget::setCanvas(KoCanvasBase *canvas)
{
Q_ASSERT(canvas); // param is not null
if (d->canvas) {
d->unsetCanvas();
d->unsetCanvas(canvas);
proxyObject->emitCanvasRemoved(this);
canvas->setCanvasController(0);
d->canvas->canvasWidget()->removeEventFilter(this);
Expand All @@ -266,6 +270,7 @@ void KoCanvasControllerWidget::setCanvas(KoCanvasBase *canvas)

KoCanvasBase* KoCanvasControllerWidget::canvas() const
{
if (d->canvas.isNull()) return 0;
return d->canvas;
}

Expand Down
4 changes: 2 additions & 2 deletions libs/flake/KoCanvasControllerWidget_p.h
Expand Up @@ -55,10 +55,10 @@ class Q_DECL_HIDDEN KoCanvasControllerWidget::Private
void emitPointerPositionChangedSignals(QEvent *event);

void activate();
void unsetCanvas();
void unsetCanvas(KoCanvasBase *canvas);

KoCanvasControllerWidget *q;
KoCanvasBase *canvas;
QPointer<KoCanvasBase> canvas;
Viewport *viewportWidget;
bool ignoreScrollSignals;
bool zoomWithWheel;
Expand Down
4 changes: 3 additions & 1 deletion libs/flake/KoCanvasObserverBase.cpp
Expand Up @@ -18,6 +18,8 @@
*/

#include "KoCanvasObserverBase.h"
#include <QPointer>
#include <KoCanvasBase.h>

class KoCanvasObserverBasePrivate
{
Expand All @@ -29,7 +31,7 @@ class KoCanvasObserverBasePrivate
~KoCanvasObserverBasePrivate()
{}

KoCanvasBase* canvas;
QPointer<KoCanvasBase> canvas;
};

KoCanvasObserverBase::KoCanvasObserverBase()
Expand Down

0 comments on commit 5f1d09e

Please sign in to comment.