From 6b9630657cb4f713106b70a5373945b92c593bfc Mon Sep 17 00:00:00 2001 From: l10n daemon script Date: Thu, 23 Feb 2017 06:07:23 +0100 Subject: [PATCH 01/42] SVN_SILENT made messages (.desktop file) - always resolve ours In case of conflict in i18n, keep the version of the branch "ours" To resolve a particular conflict, "git checkout --ours path/to/file.desktop" --- krita/data/templates/animation/.directory | 2 ++ 1 file changed, 2 insertions(+) diff --git a/krita/data/templates/animation/.directory b/krita/data/templates/animation/.directory index 1fd8826e051..21b5c99cdf2 100644 --- a/krita/data/templates/animation/.directory +++ b/krita/data/templates/animation/.directory @@ -1,6 +1,8 @@ [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[it]=Modelli di animazioni Name[nl]=Animatiesjablonen From 3e9799262c7e3d89ad567ab1723c5def23bda55c Mon Sep 17 00:00:00 2001 From: Boudewijn Rempt Date: Thu, 23 Feb 2017 15:47:51 +0100 Subject: [PATCH 02/42] Add spaces between words --- .../phongbumpmap/kis_phong_bumpmap_filter.cpp | 24 +++++++++---------- .../filters/phongbumpmap/wdgphongbumpmap.ui | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/plugins/filters/phongbumpmap/kis_phong_bumpmap_filter.cpp b/plugins/filters/phongbumpmap/kis_phong_bumpmap_filter.cpp index 4b7695d9627..21959aeed25 100644 --- a/plugins/filters/phongbumpmap/kis_phong_bumpmap_filter.cpp +++ b/plugins/filters/phongbumpmap/kis_phong_bumpmap_filter.cpp @@ -33,8 +33,8 @@ #include "kis_painter.h" KisFilterPhongBumpmap::KisFilterPhongBumpmap() - : KisFilter(KoID("phongbumpmap" , i18n("PhongBumpmap")), - KisFilter::categoryMap(), i18n("&PhongBumpmap...")) + : KisFilter(KoID("phongbumpmap" , i18n("Phong Bumpmap")), + KisFilter::categoryMap(), i18n("&Phong Bumpmap...")) { setColorSpaceIndependence(TO_LAB16); setSupportsPainting(true); @@ -52,7 +52,7 @@ void KisFilterPhongBumpmap::processImpl(KisPaintDeviceSP device, if (progressUpdater) progressUpdater->setProgress(0); QString userChosenHeightChannel = config->getString(PHONG_HEIGHT_CHANNEL, "FAIL"); - bool m_usenormalmap = config->getBool(USE_NORMALMAP_IS_ENABLED); + bool m_usenormalmap = config->getBool(USE_NORMALMAP_IS_ENABLED); if (userChosenHeightChannel == "FAIL") { qDebug("FIX YOUR FILTER"); @@ -99,7 +99,7 @@ void KisFilterPhongBumpmap::processImpl(KisPaintDeviceSP device, quint8 *bumpmapDataPointer = bumpmap.data(); quint32 ki = KoChannelInfo::displayPositionToChannelIndex(m_heightChannel->displayPosition(), device->colorSpace()->channels()); PhongPixelProcessor tileRenderer(pixelsOfInputArea, config); - + if (progressUpdater) progressUpdater->setProgress(2); @@ -132,7 +132,7 @@ void KisFilterPhongBumpmap::processImpl(KisPaintDeviceSP device, const int tileHeightMinus1 = inputArea.height() - 1; const int tileWidthMinus1 = inputArea.width() - 1; - + // Foreach INNER pixel in tile for (int y = 1; y < tileHeightMinus1; ++y) { for (int x = 1; x < tileWidthMinus1; ++x) { @@ -140,12 +140,12 @@ void KisFilterPhongBumpmap::processImpl(KisPaintDeviceSP device, posdown = (y - 1) * inputArea.width() + x; posleft = y * inputArea.width() + x - 1; posright = y * inputArea.width() + x + 1; - + memcpy(bumpmapDataPointer, tileRenderer.IlluminatePixelFromHeightmap(posup, posdown, posleft, posright).data(), pixelSize); - + bumpmapDataPointer += pixelSize; } } @@ -161,13 +161,13 @@ void KisFilterPhongBumpmap::processImpl(KisPaintDeviceSP device, memcpy(bumpmapDataPointer, tileRenderer.IlluminatePixelFromNormalmap(current_pixel_values[2], current_pixel_values[1], current_pixel_values[0]).data(), pixelSize); - + curPixel++; //pointer that crashes here, but not in the other if statement. bumpmapDataPointer += pixelSize; - - - + + + } while (iterator->nextPixel()); iterator->nextRow(); @@ -184,7 +184,7 @@ void KisFilterPhongBumpmap::processImpl(KisPaintDeviceSP device, outputArea.x(), outputArea.y(), outputArea.width(), outputArea.height()); //device->prepareClone(bumpmapPaintDevice); //device->makeCloneFrom(bumpmapPaintDevice, bumpmapPaintDevice->extent()); // THIS COULD BE BUG GY - + delete leaker; if (progressUpdater) progressUpdater->setProgress(100); } diff --git a/plugins/filters/phongbumpmap/wdgphongbumpmap.ui b/plugins/filters/phongbumpmap/wdgphongbumpmap.ui index 7c1e8438ff8..27393b62b60 100644 --- a/plugins/filters/phongbumpmap/wdgphongbumpmap.ui +++ b/plugins/filters/phongbumpmap/wdgphongbumpmap.ui @@ -402,7 +402,7 @@ - Use Normalmap + Use Normal map false From a9acf35ab0a00eb0a97ec7a85ee153c4fc33a303 Mon Sep 17 00:00:00 2001 From: Boudewijn Rempt Date: Fri, 24 Feb 2017 15:17:39 +0100 Subject: [PATCH 03/42] Properly implement the hidpi switch This uses QSettings, because kconfig only works when we already have an application, and by then it's too late to set the flag. --- krita/main.cc | 12 +- libs/ui/dialogs/kis_dlg_preferences.cc | 3 + libs/ui/forms/wdggeneralsettings.ui | 330 +++++++++++-------------- 3 files changed, 150 insertions(+), 195 deletions(-) diff --git a/krita/main.cc b/krita/main.cc index 44785e451ed..6882c1ff8ea 100644 --- a/krita/main.cc +++ b/krita/main.cc @@ -52,8 +52,8 @@ #include #elif defined HAVE_X11 - #include - #include +#include +#include #endif #if defined HAVE_KCRASH @@ -119,7 +119,12 @@ 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 + QSettings kritarc(configPath + QStringLiteral("/kritarc"), QSettings::IniFormat); + if (kritarc.value("EnableHiDPI", false).toBool()) { + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + } if (!qgetenv("KRITA_HIDPI").isEmpty()) { QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); } @@ -142,7 +147,6 @@ 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(); @@ -226,7 +230,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)); diff --git a/libs/ui/dialogs/kis_dlg_preferences.cc b/libs/ui/dialogs/kis_dlg_preferences.cc index fccce9d34f1..3003738cec3 100644 --- a/libs/ui/dialogs/kis_dlg_preferences.cc +++ b/libs/ui/dialogs/kis_dlg_preferences.cc @@ -130,6 +130,7 @@ GeneralTab::GeneralTab(QWidget *_parent, const char *_name) m_backgroundimage->setText(cfg.getMDIBackgroundImage()); m_chkCanvasMessages->setChecked(cfg.showCanvasMessages()); m_chkCompressKra->setChecked(cfg.compressKra()); + m_chkHiDPI->setChecked(cfg.readEntry("EnableHiDPI", false)); m_radioToolOptionsInDocker->setChecked(cfg.toolOptionsInDocker()); m_chkSwitchSelectionCtrlAlt->setChecked(cfg.switchSelectionCtrlAlt()); m_chkConvertOnImport->setChecked(cfg.convertToImageColorspaceOnImport()); @@ -164,6 +165,7 @@ void GeneralTab::setDefault() m_backgroundimage->setText(cfg.getMDIBackgroundImage(true)); m_chkCanvasMessages->setChecked(cfg.showCanvasMessages(true)); m_chkCompressKra->setChecked(cfg.compressKra(true)); + m_chkHiDPI->setChecked(true); m_radioToolOptionsInDocker->setChecked(cfg.toolOptionsInDocker(true)); m_chkSwitchSelectionCtrlAlt->setChecked(cfg.switchSelectionCtrlAlt(true)); m_chkConvertOnImport->setChecked(cfg.convertToImageColorspaceOnImport(true)); @@ -1013,6 +1015,7 @@ bool KisDlgPreferences::editPreferences() cfg.setBackupFile(dialog->m_general->m_backupFileCheckBox->isChecked()); cfg.setShowCanvasMessages(dialog->m_general->showCanvasMessages()); cfg.setCompressKra(dialog->m_general->compressKra()); + cfg.writeEntry("EnableHiDPI", dialog->m_general->m_chkHiDPI->isChecked()); cfg.setToolOptionsInDocker(dialog->m_general->toolOptionsInDocker()); cfg.setSwitchSelectionCtrlAlt(dialog->m_general->switchSelectionCtrlAlt()); cfg.setConvertToImageColorspaceOnImport(dialog->m_general->convertToImageColorspaceOnImport()); diff --git a/libs/ui/forms/wdggeneralsettings.ui b/libs/ui/forms/wdggeneralsettings.ui index d07bd91b5d3..f475a196b31 100644 --- a/libs/ui/forms/wdggeneralsettings.ui +++ b/libs/ui/forms/wdggeneralsettings.ui @@ -29,7 +29,7 @@ - 3 + 0 @@ -147,232 +147,180 @@ Window - - - - - Qt::Vertical - - - - 20 - 40 - + + + + + + 0 + 0 + - - - - - - 10 + + Multiple Document Mode: - - 10 + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - 10 + + + + + + + 0 + 0 + - - 10 + + 1 - - 10 + + + Subwindows + + + + + Tabs + + + + + + + + Background Image (overrides color): - - - - - 0 - 0 - + + + + + + + + + 200 + 0 + - - Multiple Document Mode: + + QFrame::StyledPanel - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Window Background: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - 200 - 0 - - - - QFrame::StyledPanel - - - QFrame::Sunken - - - - - - - - - - ... - - - - - - - - 0 - 0 - - - - Clear - - - - - - - - - - 0 - 0 - + + QFrame::Sunken - - + + - Background Image (overrides color): + ... - - + + - + 0 0 - - 1 + + Clear - - - Subwindows - - - - - Tabs - - - - - - - - - 0 - 0 - - - - - - - - - - - Don't show contents when moving sub-windows - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - - - - - - - Show on-canvas popup messages: - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - + + + + Window Background: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + + + + + + + Don't show contents when moving sub-windows: + + + + + + + + 0 + 0 + + + + + + + + + + + Show on-canvas popup messages: + + + + + + + + + + + + - Qt::Horizontal + Qt::Vertical - 40 - 20 + 20 + 40 + + + + + + + + + + + Enable Hi-DPI support: + + + From 94fec8c9f29a9284c2080834c9a355fba227567a Mon Sep 17 00:00:00 2001 From: l10n daemon script Date: Sat, 25 Feb 2017 06:16:43 +0100 Subject: [PATCH 04/42] SVN_SILENT made messages (.desktop file) - always resolve ours In case of conflict in i18n, keep the version of the branch "ours" To resolve a particular conflict, "git checkout --ours path/to/file.desktop" --- krita/data/templates/animation/.directory | 1 + krita/data/templates/animation/Anim-Jp-EN.desktop | 1 + krita/data/templates/animation/Anim-Jp-JP.desktop | 1 + packaging/linux/snap/setup/gui/krita.desktop | 1 + 4 files changed, 4 insertions(+) diff --git a/krita/data/templates/animation/.directory b/krita/data/templates/animation/.directory index 21b5c99cdf2..e97c8024d7e 100644 --- a/krita/data/templates/animation/.directory +++ b/krita/data/templates/animation/.directory @@ -8,6 +8,7 @@ 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 diff --git a/krita/data/templates/animation/Anim-Jp-EN.desktop b/krita/data/templates/animation/Anim-Jp-EN.desktop index 5734b9c4e33..46f2baa38f8 100644 --- a/krita/data/templates/animation/Anim-Jp-EN.desktop +++ b/krita/data/templates/animation/Anim-Jp-EN.desktop @@ -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 diff --git a/krita/data/templates/animation/Anim-Jp-JP.desktop b/krita/data/templates/animation/Anim-Jp-JP.desktop index 4a773fea09b..166deb207f1 100644 --- a/krita/data/templates/animation/Anim-Jp-JP.desktop +++ b/krita/data/templates/animation/Anim-Jp-JP.desktop @@ -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 diff --git a/packaging/linux/snap/setup/gui/krita.desktop b/packaging/linux/snap/setup/gui/krita.desktop index 1ca80debea0..86bb57a2e18 100755 --- a/packaging/linux/snap/setup/gui/krita.desktop +++ b/packaging/linux/snap/setup/gui/krita.desktop @@ -109,6 +109,7 @@ Comment[it]=Programma di manipolazione delle immagini basato su pixel per Callig Comment[nl]=Afbeeldingsbewerkingsprogramma gebaseerd op pixels voor de Calligra Suite Comment[pl]=Program do obróbki obrazów na poziomie pikseli dla Pakietu Calligra Comment[pt]='Plugin' de manipulação de imagens em pixels para o Calligra Stage +Comment[pt_BR]=Programa de manipulação de imagens baseado em pixels para o Calligra Suite Comment[ru]=Программа редактирования пиксельной анимации для the Calligra Suite Comment[sk]=Program na manipuláciu s pixelmi pre Calligra Suite Comment[sv]=Bildpunktsbaserat bildbehandlingsprogram för Calligra-sviten From c933a0a77ffb88bd399cf2f213f8e15af72dbc15 Mon Sep 17 00:00:00 2001 From: Scott Petrovic Date: Sun, 26 Feb 2017 13:18:47 -0600 Subject: [PATCH 05/42] make the color as mask enabled by default for the stamp and clipboard. this is used 90 percent of the time --- plugins/paintops/libpaintop/kis_clipboard_brush_widget.cpp | 3 ++- plugins/paintops/libpaintop/kis_custom_brush_widget.cpp | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/paintops/libpaintop/kis_clipboard_brush_widget.cpp b/plugins/paintops/libpaintop/kis_clipboard_brush_widget.cpp index e2346f550cd..0920a5f7b8c 100644 --- a/plugins/paintops/libpaintop/kis_clipboard_brush_widget.cpp +++ b/plugins/paintops/libpaintop/kis_clipboard_brush_widget.cpp @@ -89,8 +89,9 @@ void KisClipboardBrushWidget::slotCreateBrush() if(m_brush == 0) { buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); - } else { + } else { buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true); + colorAsmask->setChecked(true); // initializing this has to happen here since we need a valid brush for it to work } } diff --git a/plugins/paintops/libpaintop/kis_custom_brush_widget.cpp b/plugins/paintops/libpaintop/kis_custom_brush_widget.cpp index 65ead643eee..6f6b2a8002e 100644 --- a/plugins/paintops/libpaintop/kis_custom_brush_widget.cpp +++ b/plugins/paintops/libpaintop/kis_custom_brush_widget.cpp @@ -63,8 +63,10 @@ KisCustomBrushWidget::KisCustomBrushWidget(QWidget *parent, const QString& capti connect(this, SIGNAL(accepted()), SLOT(slotAddPredefined())); connect(brushStyle, SIGNAL(activated(int)), this, SLOT(slotUpdateCurrentBrush(int))); - connect(colorAsMask, SIGNAL(toggled(bool)), this, SLOT(slotUpdateUseColorAsMask(bool))); + connect(colorAsMask, SIGNAL(toggled(bool)), this, SLOT(slotUpdateUscColorAsMask(bool))); + + colorAsMask->setChecked(true); // use color as mask by default. This is by far the most common way to make tip. spacingWidget->setSpacing(true, 1.0); connect(spacingWidget, SIGNAL(sigSpacingChanged()), SLOT(slotSpacingChanged())); } From d5fb2c85dd6dbf1ce808db1d7d709fd45e772aee Mon Sep 17 00:00:00 2001 From: "L. E. Segovia" Date: Mon, 27 Feb 2017 00:45:22 +0100 Subject: [PATCH 06/42] Fix CMYK colorspace palette loading This patch is for the remainder of T4488 Differential Revision: https://phabricator.kde.org/D3629 --- libs/pigment/KoCmykColorSpaceTraits.h | 118 ++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) diff --git a/libs/pigment/KoCmykColorSpaceTraits.h b/libs/pigment/KoCmykColorSpaceTraits.h index 657c50157f8..a81385468f0 100644 --- a/libs/pigment/KoCmykColorSpaceTraits.h +++ b/libs/pigment/KoCmykColorSpaceTraits.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2006-2007 Cyrille Berger + * Copyright (c) 2016 L. E. Segovia * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -104,14 +105,131 @@ struct KoCmykU16Traits : public KoCmykTraits { #include struct KoCmykF16Traits : public KoCmykTraits { + static constexpr float MAX_CHANNEL_CMYK = 100; + + inline static QString normalisedChannelValueText(const quint8 *pixel, quint32 channelIndex) { + return channelValueText(pixel, channelIndex); + } + + inline static void normalisedChannelsValue(const quint8 *pixel, QVector &channels) { + Q_ASSERT((int)channels.count() == (int)parent::channels_nb); + channels_type c; + for (uint i = 0; i < parent::channels_nb; i++) { + c = parent::nativeArray(pixel)[i]; + channels[i] = (qreal)c; + } + } + + inline static void fromNormalisedChannelsValue(quint8 *pixel, const QVector &values) { + Q_ASSERT((int)values.count() == (int)parent::channels_nb); + channels_type c; + for (uint i = 0; i < parent::channels_nb; i++) { + float b = 0; + switch(i) { + case c_pos: + case m_pos: + case y_pos: + case k_pos: + b = qBound((float)0, + (float)KoColorSpaceMathsTraits::unitValue * values[i], + (float)MAX_CHANNEL_CMYK); + break; + default: + b = qBound((float)KoColorSpaceMathsTraits::min, + (float)KoColorSpaceMathsTraits::unitValue * values[i], + (float)KoColorSpaceMathsTraits::max); + break; + } + c = (channels_type)b; + parent::nativeArray(pixel)[i] = c; + } + } }; #endif struct KoCmykF32Traits : public KoCmykTraits { + static constexpr float MAX_CHANNEL_CMYK = 100; + + inline static QString normalisedChannelValueText(const quint8 *pixel, quint32 channelIndex) { + return channelValueText(pixel, channelIndex); + } + + inline static void normalisedChannelsValue(const quint8 *pixel, QVector &channels) { + Q_ASSERT((int)channels.count() == (int)parent::channels_nb); + channels_type c; + for (uint i = 0; i < parent::channels_nb; i++) { + c = parent::nativeArray(pixel)[i]; + channels[i] = (qreal)c; + } + } + + inline static void fromNormalisedChannelsValue(quint8 *pixel, const QVector &values) { + Q_ASSERT((int)values.count() == (int)parent::channels_nb); + channels_type c; + for (uint i = 0; i < parent::channels_nb; i++) { + float b = 0; + switch(i) { + case c_pos: + case m_pos: + case y_pos: + case k_pos: + b = qBound((float)0, + (float)KoColorSpaceMathsTraits::unitValue * values[i], + (float)MAX_CHANNEL_CMYK); + break; + default: + b = qBound((float)KoColorSpaceMathsTraits::min, + (float)KoColorSpaceMathsTraits::unitValue * values[i], + (float)KoColorSpaceMathsTraits::max); + break; + } + c = (channels_type)b; + parent::nativeArray(pixel)[i] = c; + } + } }; struct KoCmykF64Traits : public KoCmykTraits { + static constexpr double MAX_CHANNEL_CMYK = 100; + + inline static QString normalisedChannelValueText(const quint8 *pixel, quint32 channelIndex) { + return channelValueText(pixel, channelIndex); + } + + inline static void normalisedChannelsValue(const quint8 *pixel, QVector &channels) { + Q_ASSERT((int)channels.count() == (int)parent::channels_nb); + channels_type c; + for (uint i = 0; i < parent::channels_nb; i++) { + c = parent::nativeArray(pixel)[i]; + channels[i] = (qreal)c; + } + } + + inline static void fromNormalisedChannelsValue(quint8 *pixel, const QVector &values) { + Q_ASSERT((int)values.count() == (int)parent::channels_nb); + channels_type c; + for (uint i = 0; i < parent::channels_nb; i++) { + float b = 0; + switch(i) { + case c_pos: + case m_pos: + case y_pos: + case k_pos: + b = qBound((double)0, + (double)KoColorSpaceMathsTraits::unitValue * values[i], + (double)MAX_CHANNEL_CMYK); + break; + default: + b = qBound((double)KoColorSpaceMathsTraits::min, + (double)KoColorSpaceMathsTraits::unitValue * values[i], + (double)KoColorSpaceMathsTraits::max); + break; + } + c = (channels_type)b; + parent::nativeArray(pixel)[i] = c; + } + } }; From 4763f5e524c0cc08f38dae4b1a89d28a2649a985 Mon Sep 17 00:00:00 2001 From: Dimitar Dimitrov Date: Mon, 27 Feb 2017 00:54:54 +0100 Subject: [PATCH 07/42] Proper change of color space and profile for image through "Image properties" dialog BUGS: 322444 Differential Revision: https://phabricator.kde.org/D4328 --- .../commands/kis_image_set_projection_color_space_command.cpp | 1 + libs/image/kis_image.cc | 1 + 2 files changed, 2 insertions(+) diff --git a/libs/image/commands/kis_image_set_projection_color_space_command.cpp b/libs/image/commands/kis_image_set_projection_color_space_command.cpp index e4d2a3293fc..3eb9b8dfd7d 100644 --- a/libs/image/commands/kis_image_set_projection_color_space_command.cpp +++ b/libs/image/commands/kis_image_set_projection_color_space_command.cpp @@ -32,6 +32,7 @@ KisImageSetProjectionColorSpaceCommand::KisImageSetProjectionColorSpaceCommand(K if (imageSP) { m_beforeColorSpace = imageSP->colorSpace(); m_afterColorSpace = afterColorSpace; + imageSP->setProjectionColorSpace(m_afterColorSpace); } } diff --git a/libs/image/kis_image.cc b/libs/image/kis_image.cc index cc422bb0818..b6f98865702 100644 --- a/libs/image/kis_image.cc +++ b/libs/image/kis_image.cc @@ -885,6 +885,7 @@ void KisImage::convertProjectionColorSpace(const KoColorSpace *dstColorSpace) void KisImage::setProjectionColorSpace(const KoColorSpace * colorSpace) { m_d->colorSpace = colorSpace; + assignImageProfile(colorSpace->profile()); m_d->rootLayer->resetCache(); m_d->signalRouter.emitNotification(ColorSpaceChangedSignal); } From 6f614b5ff29189f367f887dcceeb9bd7646d99af Mon Sep 17 00:00:00 2001 From: Boudewijn Rempt Date: Mon, 27 Feb 2017 12:13:57 +0100 Subject: [PATCH 08/42] Delete KisView on closing a view. This first makes KoCanvasBase a QObject; that used to be impossible because other calligra applications canvas classes multiply inherited QWidget and KoCanvasBase. That is no longer a consideration. Then every local use of a pointer to KoCanvasBase or KisCanvas2 is protected by QPointer. Now every canvas observer knows when a canvas has disappeared. But the canvas is deleted before the canvascontroller widget; that means that when deleting the canvas, the canvas controller widget would get confused because the canvas observers' canvas has already been deleted: unsetCanvas wouldn't be called on the canvas observers, so the logic here is now that if unsetCanvas is called when deleting the canvas controller widget, unsetCanvas is always called on all observers. Note: no dockers crash even if unsetCanvas isn't called at the right time, but it's still proper to call unsetCanvas to allow dockers to clean up things like local models linked to the layer model. --- libs/flake/CMakeLists.txt | 1 + libs/flake/KoCanvasBase.cpp | 15 ++++++--- libs/flake/KoCanvasBase.h | 7 ++-- libs/flake/KoCanvasControllerWidget.cpp | 17 ++++++---- libs/flake/KoCanvasControllerWidget_p.h | 4 +-- libs/flake/KoCanvasObserverBase.cpp | 4 ++- libs/flake/KoCanvasResourceManager.cpp | 4 +-- libs/flake/KoShapeBasedDocumentBase.cpp | 4 ++- libs/flake/KoShapeController.cpp | 6 ++++ libs/flake/KoShapeController.h | 10 +++++- libs/flake/tests/MockShapes.cpp | 3 ++ libs/flake/tests/MockShapes.h | 14 +++++--- libs/ui/KisMainWindow.cpp | 4 +-- libs/ui/KisPaletteModel.h | 7 ++-- libs/ui/KisView.cpp | 4 +-- libs/ui/canvas/kis_canvas2.h | 2 +- libs/ui/canvas/kis_infinity_manager.h | 6 +++- .../kis_paintop_transformation_connector.h | 5 +-- libs/ui/flake/kis_shape_layer_canvas.cpp | 3 +- libs/ui/flake/kis_shape_layer_canvas.h | 2 +- libs/ui/flake/kis_shape_selection_canvas.h | 2 +- libs/ui/input/kis_input_manager_p.h | 4 +-- libs/ui/kis_action_manager.cpp | 1 - libs/ui/kis_node_model.cpp | 28 ++++++++-------- libs/ui/kis_zoom_manager.cc | 6 ++-- libs/ui/tool/kis_selection_tool_helper.h | 6 ++-- .../RulerAssistant/kis_ruler_assistant_tool.h | 14 ++++---- ...kis_animation_curve_channel_list_model.cpp | 33 ++++++++++++------- .../kis_animation_curve_channel_list_model.h | 1 + .../animation/kis_animation_curve_docker.cpp | 5 +-- .../animation/timeline_frames_model.cpp | 4 +-- .../channeldocker/channeldocker_dock.h | 7 ++-- plugins/dockers/channeldocker/channelmodel.h | 7 ++-- .../colorslider/kis_color_slider_dock.cpp | 2 +- .../colorslider/kis_color_slider_dock.h | 5 +-- .../colorslider/kis_color_slider_input.h | 9 ++--- .../colorslider/kis_color_slider_widget.h | 7 ++-- plugins/dockers/colorslider/kis_hsv_slider.h | 4 ++- .../compositiondocker_dock.h | 8 +++-- .../dockers/defaultdockers/kis_layer_box.cpp | 2 +- .../dockers/defaultdockers/kis_layer_box.h | 2 +- .../dockers/digitalmixer/digitalmixer_dock.h | 6 +++- .../dockers/histogram/histogramdocker_dock.h | 7 ++-- plugins/dockers/historydocker/HistoryDock.cpp | 19 ++++++++--- plugins/dockers/historydocker/HistoryDock.h | 2 +- plugins/dockers/historydocker/KisUndoModel.h | 5 ++- .../dockers/imagedocker/imagedocker_dock.h | 6 ++-- plugins/dockers/lut/lutdocker_dock.h | 7 ++-- .../dockers/overview/overviewdocker_dock.h | 6 ++-- plugins/dockers/overview/overviewwidget.h | 7 ++-- .../palettedocker/palettedocker_dock.cpp | 2 +- .../palettedocker/palettedocker_dock.h | 6 ++-- .../presetdocker/presetdocker_dock.cpp | 4 +-- .../dockers/presetdocker/presetdocker_dock.h | 5 +-- .../presethistory/presethistory_dock.h | 7 ++-- .../shapeproperties/ShapePropertiesDocker.cpp | 3 +- .../smallcolorselector_dock.h | 5 ++- .../specificcolorselector_dock.h | 5 +-- .../tasksetdocker/tasksetdocker_dock.h | 11 ++++--- .../ArtisticTextToolSelection.h | 6 ++-- plugins/flake/textshape/ReferencesTool.h | 6 ++-- plugins/flake/textshape/ReviewTool.h | 6 ++-- .../textshape/commands/ShowChangesCommand.h | 8 +++-- .../kotext/InsertInlineObjectActionBase_p.h | 6 ++-- .../kotext/commands/TextPasteCommand.h | 5 +-- .../defaulttool/ShapeMoveStrategy.h | 6 ++-- .../filterEffectTool/FilterEffectEditWidget.h | 6 ++-- .../tool_transform2/kis_tool_transform.h | 8 ++--- 68 files changed, 291 insertions(+), 158 deletions(-) create mode 100644 libs/flake/tests/MockShapes.cpp diff --git a/libs/flake/CMakeLists.txt b/libs/flake/CMakeLists.txt index e9a3bbde8ad..437b4c0c626 100644 --- a/libs/flake/CMakeLists.txt +++ b/libs/flake/CMakeLists.txt @@ -198,6 +198,7 @@ set(kritaflake_SRCS svg/SvgShapeFactory.cpp FlakeDebug.cpp + tests/MockShapes.cpp ) ki18n_wrap_ui(kritaflake_SRCS diff --git a/libs/flake/KoCanvasBase.cpp b/libs/flake/KoCanvasBase.cpp index 4624eaf1f7f..01d3f85940d 100644 --- a/libs/flake/KoCanvasBase.cpp +++ b/libs/flake/KoCanvasBase.cpp @@ -19,6 +19,8 @@ */ #include +#include +#include #include "KoCanvasBase.h" #include "KoCanvasResourceManager.h" @@ -33,7 +35,8 @@ class Q_DECL_HIDDEN KoCanvasBase::Private { public: - Private() : shapeController(0), + Private() + : shapeController(0), resourceManager(0), isResourceManagerShared(false), controller(0), @@ -48,8 +51,8 @@ class Q_DECL_HIDDEN KoCanvasBase::Private } delete snapGuide; } - KoShapeController *shapeController; - KoCanvasResourceManager *resourceManager; + QPointer shapeController; + QPointer resourceManager; bool isResourceManagerShared; KoCanvasController *controller; KoSnapGuide *snapGuide; @@ -68,6 +71,7 @@ KoCanvasBase::KoCanvasBase(KoShapeBasedDocumentBase *shapeBasedDocument, KoCanva KoCanvasBase::~KoCanvasBase() { + d->shapeController->reset(); delete d; } @@ -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) diff --git a/libs/flake/KoCanvasBase.h b/libs/flake/KoCanvasBase.h index 880cb544525..d8fad1ed95c 100644 --- a/libs/flake/KoCanvasBase.h +++ b/libs/flake/KoCanvasBase.h @@ -42,19 +42,20 @@ class KoSnapGuide; class QWidget; class QCursor; -class QObject; class QPointF; class QRectF; class QSizeF; +#include + /** * 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: /** diff --git a/libs/flake/KoCanvasControllerWidget.cpp b/libs/flake/KoCanvasControllerWidget.cpp index b94cd533e24..d2164b01f87 100644 --- a/libs/flake/KoCanvasControllerWidget.cpp +++ b/libs/flake/KoCanvasControllerWidget.cpp @@ -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(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()) { @@ -165,8 +167,10 @@ void KoCanvasControllerWidget::Private::unsetCanvas() } Q_FOREACH (KoCanvasObserverBase *docker, observerProvider->canvasObservers()) { KoCanvasObserverBase *observer = dynamic_cast(docker); - if (observer && observer->observedCanvas() == q->canvas()) { - observer->unsetObservedCanvas(); + if (observer) { + if (!canvas || observer->observedCanvas() == q->canvas()) { + observer->unsetObservedCanvas(); + } } } } @@ -207,7 +211,7 @@ KoCanvasControllerWidget::KoCanvasControllerWidget(KActionCollection * actionCol KoCanvasControllerWidget::~KoCanvasControllerWidget() { - d->unsetCanvas(); + d->unsetCanvas(0); delete d; } @@ -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); @@ -266,6 +270,7 @@ void KoCanvasControllerWidget::setCanvas(KoCanvasBase *canvas) KoCanvasBase* KoCanvasControllerWidget::canvas() const { + if (d->canvas.isNull()) return 0; return d->canvas; } diff --git a/libs/flake/KoCanvasControllerWidget_p.h b/libs/flake/KoCanvasControllerWidget_p.h index 5529f0b5880..b715738c980 100644 --- a/libs/flake/KoCanvasControllerWidget_p.h +++ b/libs/flake/KoCanvasControllerWidget_p.h @@ -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 canvas; Viewport *viewportWidget; bool ignoreScrollSignals; bool zoomWithWheel; diff --git a/libs/flake/KoCanvasObserverBase.cpp b/libs/flake/KoCanvasObserverBase.cpp index b3e9a192fde..c56538b7bc2 100644 --- a/libs/flake/KoCanvasObserverBase.cpp +++ b/libs/flake/KoCanvasObserverBase.cpp @@ -18,6 +18,8 @@ */ #include "KoCanvasObserverBase.h" +#include +#include class KoCanvasObserverBasePrivate { @@ -29,7 +31,7 @@ class KoCanvasObserverBasePrivate ~KoCanvasObserverBasePrivate() {} - KoCanvasBase* canvas; + QPointer canvas; }; KoCanvasObserverBase::KoCanvasObserverBase() diff --git a/libs/flake/KoCanvasResourceManager.cpp b/libs/flake/KoCanvasResourceManager.cpp index 45f2189de4a..79b3a932796 100644 --- a/libs/flake/KoCanvasResourceManager.cpp +++ b/libs/flake/KoCanvasResourceManager.cpp @@ -36,8 +36,8 @@ class Q_DECL_HIDDEN KoCanvasResourceManager::Private }; KoCanvasResourceManager::KoCanvasResourceManager(QObject *parent) - : QObject(parent), - d(new Private()) + : QObject(parent) + , d(new Private()) { const KoColorSpace* cs = KoColorSpaceRegistry::instance()->rgb8(); setForegroundColor(KoColor(Qt::black, cs)); diff --git a/libs/flake/KoShapeBasedDocumentBase.cpp b/libs/flake/KoShapeBasedDocumentBase.cpp index fc13c9e9c02..68836073838 100644 --- a/libs/flake/KoShapeBasedDocumentBase.cpp +++ b/libs/flake/KoShapeBasedDocumentBase.cpp @@ -19,6 +19,8 @@ * Boston, MA 02110-1301, USA. */ +#include + #include "KoShapeBasedDocumentBase.h" #include "KoDocumentResourceManager.h" #include "KoShapeRegistry.h" @@ -59,7 +61,7 @@ class KoShapeBasedDocumentBasePrivate delete resourceManager; } - KoDocumentResourceManager *resourceManager; + QPointer resourceManager; }; KoShapeBasedDocumentBase::KoShapeBasedDocumentBase() diff --git a/libs/flake/KoShapeController.cpp b/libs/flake/KoShapeController.cpp index 7d4559247ad..840cabd9451 100644 --- a/libs/flake/KoShapeController.cpp +++ b/libs/flake/KoShapeController.cpp @@ -136,6 +136,12 @@ KoShapeController::~KoShapeController() delete d; } +void KoShapeController::reset() +{ + d->canvas = 0; + d->shapeBasedDocument = 0; +} + KUndo2Command* KoShapeController::addShape(KoShape *shape, KUndo2Command *parent) { return d->addShape(shape, true, parent); diff --git a/libs/flake/KoShapeController.h b/libs/flake/KoShapeController.h index 42f7d450689..793fa9ffd01 100644 --- a/libs/flake/KoShapeController.h +++ b/libs/flake/KoShapeController.h @@ -24,6 +24,7 @@ #include "kritaflake_export.h" +#include #include #include @@ -42,8 +43,10 @@ class KoDocumentResourceManager; * from this class for maintaining the list of shapes in the document. So no tool gets * to access the application directly. */ -class KRITAFLAKE_EXPORT KoShapeController +class KRITAFLAKE_EXPORT KoShapeController : public QObject { + Q_OBJECT + public: /** * Create a new Controller; typically not called by applications, only @@ -55,6 +58,11 @@ class KRITAFLAKE_EXPORT KoShapeController /// destructor ~KoShapeController(); + /** + * @brief reset sets the canvas and shapebased document to 0. + */ + void reset(); + /** * @brief Add a shape to the document. * If the shape has no parent, the active layer will become its parent. diff --git a/libs/flake/tests/MockShapes.cpp b/libs/flake/tests/MockShapes.cpp new file mode 100644 index 00000000000..cac20249437 --- /dev/null +++ b/libs/flake/tests/MockShapes.cpp @@ -0,0 +1,3 @@ +#include + +#include diff --git a/libs/flake/tests/MockShapes.h b/libs/flake/tests/MockShapes.h index 9f6da0bdb07..c4878b8a591 100644 --- a/libs/flake/tests/MockShapes.h +++ b/libs/flake/tests/MockShapes.h @@ -30,7 +30,10 @@ #include "KoSnapData.h" #include "KoUnit.h" -class MockShape : public KoShape +#include "kritaflake_export.h" + + +class KRITAFLAKE_EXPORT MockShape : public KoShape { public: MockShape() : paintedCount(0) {} @@ -47,7 +50,7 @@ class MockShape : public KoShape int paintedCount; }; -class MockContainer : public KoShapeContainer +class KRITAFLAKE_EXPORT MockContainer : public KoShapeContainer { public: MockContainer(KoShapeContainerModel *model = 0) : KoShapeContainer(model), paintedCount(0) {} @@ -65,7 +68,7 @@ class MockContainer : public KoShapeContainer int paintedCount; }; -class MockGroup : public KoShapeGroup +class KRITAFLAKE_EXPORT MockGroup : public KoShapeGroup { void paintComponent(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &) { Q_UNUSED(painter); @@ -75,8 +78,9 @@ class MockGroup : public KoShapeGroup class KoToolProxy; -class MockCanvas : public KoCanvasBase +class KRITAFLAKE_EXPORT MockCanvas : public KoCanvasBase { + Q_OBJECT public: MockCanvas(KoShapeBasedDocumentBase *aKoShapeBasedDocumentBase =0)//made for TestSnapStrategy.cpp : KoCanvasBase(aKoShapeBasedDocumentBase), m_shapeManager(new KoShapeManager(this)) {} @@ -124,7 +128,7 @@ class MockCanvas : public KoCanvasBase qreal m_vert; }; -class MockShapeController : public KoShapeBasedDocumentBase +class KRITAFLAKE_EXPORT MockShapeController : public KoShapeBasedDocumentBase { public: void addShape(KoShape* shape) { diff --git a/libs/ui/KisMainWindow.cpp b/libs/ui/KisMainWindow.cpp index a83b591a853..283596fab48 100644 --- a/libs/ui/KisMainWindow.cpp +++ b/libs/ui/KisMainWindow.cpp @@ -702,7 +702,7 @@ void KisMainWindow::updateCaption() if (!d->mdiArea->activeSubWindow()) { updateCaption(QString(), false); } - else { + else if (d->activeView && d->activeView->document()){ QString caption( d->activeView->document()->caption() ); if (d->readOnly) { caption += ' ' + i18n("(write protected)"); @@ -2033,7 +2033,7 @@ void KisMainWindow::updateWindowMenu() QList windows = d->mdiArea->subWindowList(); for (int i = 0; i < windows.size(); ++i) { QPointerchild = qobject_cast(windows.at(i)->widget()); - if (child) { + if (child && child->document()) { QString text; if (i < 9) { text = i18n("&%1 %2", i + 1, child->document()->url().toDisplayString()); diff --git a/libs/ui/KisPaletteModel.h b/libs/ui/KisPaletteModel.h index 413f0b54ee0..de073121e69 100644 --- a/libs/ui/KisPaletteModel.h +++ b/libs/ui/KisPaletteModel.h @@ -20,13 +20,16 @@ #ifndef KIS_PALETTEMODEL_H #define KIS_PALETTEMODEL_H +#include #include +#include + #include #include "kritaui_export.h" class KoColorSet; -class KoColorDisplayRendererInterface; + class KRITAUI_EXPORT KisPaletteModel : public QAbstractTableModel { @@ -59,7 +62,7 @@ private Q_SLOTS: private: KoColorSet* m_colorSet; - KoColorDisplayRendererInterface *m_displayRenderer; + QPointer m_displayRenderer; }; #endif diff --git a/libs/ui/KisView.cpp b/libs/ui/KisView.cpp index be34b208471..e58d0fc4082 100644 --- a/libs/ui/KisView.cpp +++ b/libs/ui/KisView.cpp @@ -269,9 +269,9 @@ KisView::~KisView() d->viewManager->filterManager()->cancel(); } } - - KisPart::instance()->removeView(this); KoToolManager::instance()->removeCanvasController(&d->canvasController); + KisPart::instance()->removeView(this); + delete d; } diff --git a/libs/ui/canvas/kis_canvas2.h b/libs/ui/canvas/kis_canvas2.h index d0fe7de592a..95512d9aa6f 100644 --- a/libs/ui/canvas/kis_canvas2.h +++ b/libs/ui/canvas/kis_canvas2.h @@ -60,7 +60,7 @@ class KoViewConverter; * the widget it contains, which may be either a QPainter based * canvas, or an OpenGL based canvas: that are the real widgets. */ -class KRITAUI_EXPORT KisCanvas2 : public QObject, public KoCanvasBase +class KRITAUI_EXPORT KisCanvas2 : public KoCanvasBase { Q_OBJECT diff --git a/libs/ui/canvas/kis_infinity_manager.h b/libs/ui/canvas/kis_infinity_manager.h index 349b5a20ee6..ef25bebf753 100644 --- a/libs/ui/canvas/kis_infinity_manager.h +++ b/libs/ui/canvas/kis_infinity_manager.h @@ -20,9 +20,13 @@ #define __KIS_INFINITY_MANAGER_H #include "kis_canvas_decoration.h" + +#include #include #include +#include + class KisView; static const QString INFINITY_DECORATION_ID = "infinity-decorations"; @@ -62,7 +66,7 @@ public Q_SLOTS: QVector m_sideRects; - KisCanvas2 *m_canvas; + QPointer m_canvas; }; #endif /* __KIS_INFINITY_MANAGER_H */ diff --git a/libs/ui/canvas/kis_paintop_transformation_connector.h b/libs/ui/canvas/kis_paintop_transformation_connector.h index 397b1ba9740..68c751ee0a9 100644 --- a/libs/ui/canvas/kis_paintop_transformation_connector.h +++ b/libs/ui/canvas/kis_paintop_transformation_connector.h @@ -20,8 +20,9 @@ #define __KIS_PAINTOP_TRANSFORMATION_CONNECTOR_H #include +#include -class KisCanvas2; +#include class KisPaintopTransformationConnector : public QObject { @@ -36,7 +37,7 @@ public Q_SLOTS: void slotCanvasResourceChanged(int key, const QVariant &resource); private: - KisCanvas2 *m_canvas; + QPointer m_canvas; }; #endif /* __KIS_PAINTOP_TRANSFORMATION_CONNECTOR_H */ diff --git a/libs/ui/flake/kis_shape_layer_canvas.cpp b/libs/ui/flake/kis_shape_layer_canvas.cpp index f12859621c4..ca4ed20e05a 100644 --- a/libs/ui/flake/kis_shape_layer_canvas.cpp +++ b/libs/ui/flake/kis_shape_layer_canvas.cpp @@ -40,8 +40,7 @@ //#define DEBUG_REPAINT KisShapeLayerCanvas::KisShapeLayerCanvas(KisShapeLayer *parent, KisImageWSP image) - : QObject() - , KoCanvasBase(0) + : KoCanvasBase(0) , m_isDestroying(false) , m_viewConverter(new KisImageViewConverter(image)) , m_shapeManager(new KoShapeManager(this)) diff --git a/libs/ui/flake/kis_shape_layer_canvas.h b/libs/ui/flake/kis_shape_layer_canvas.h index 6b45fec6bd6..a497222a25d 100644 --- a/libs/ui/flake/kis_shape_layer_canvas.h +++ b/libs/ui/flake/kis_shape_layer_canvas.h @@ -39,7 +39,7 @@ class KisImageViewConverter; * Do NOT give this canvas to tools or to the KoCanvasController, it's * not made for that. */ -class KisShapeLayerCanvas : public QObject, public KoCanvasBase +class KisShapeLayerCanvas : public KoCanvasBase { Q_OBJECT public: diff --git a/libs/ui/flake/kis_shape_selection_canvas.h b/libs/ui/flake/kis_shape_selection_canvas.h index 5cac711ca08..7fa652d6dc8 100644 --- a/libs/ui/flake/kis_shape_selection_canvas.h +++ b/libs/ui/flake/kis_shape_selection_canvas.h @@ -33,7 +33,7 @@ class KoUnit; /** * Dummy canvas just to have a shapemanager for the shape selection */ -class KisShapeSelectionCanvas : public QObject, public KoCanvasBase +class KisShapeSelectionCanvas : public KoCanvasBase { Q_OBJECT public: diff --git a/libs/ui/input/kis_input_manager_p.h b/libs/ui/input/kis_input_manager_p.h index 46229392ed6..f14e9051c75 100644 --- a/libs/ui/input/kis_input_manager_p.h +++ b/libs/ui/input/kis_input_manager_p.h @@ -54,7 +54,7 @@ class KisInputManager::Private KisInputManager *q; - KisCanvas2 *canvas = 0; + QPointer canvas = 0; KisToolProxy *toolProxy = 0; bool forwardAllEventsToTool = false; @@ -118,7 +118,7 @@ class KisInputManager::Private private: KisInputManager::Private *d; - QMap canvasResolver; + QMap> canvasResolver; int eatOneMouseStroke; KisTimedSignalThreshold focusSwitchThreshold; KisSignalAutoConnectionsStore thresholdConnections; diff --git a/libs/ui/kis_action_manager.cpp b/libs/ui/kis_action_manager.cpp index 741c5773e02..82692284d66 100644 --- a/libs/ui/kis_action_manager.cpp +++ b/libs/ui/kis_action_manager.cpp @@ -133,7 +133,6 @@ void KisActionManager::slotActionAddedToCollection(QAction *action) * directly to the action collection when a document is created. Here we * catch these cases */ - KisActionRegistry::instance()->updateShortcut(action->objectName(), action); } diff --git a/libs/ui/kis_node_model.cpp b/libs/ui/kis_node_model.cpp index 83d319d62c8..f5ef58b8389 100644 --- a/libs/ui/kis_node_model.cpp +++ b/libs/ui/kis_node_model.cpp @@ -22,6 +22,7 @@ #include #include +#include #include @@ -39,7 +40,7 @@ #include #include #include - +#include #include "kis_dummies_facade_base.h" #include "kis_node_dummies_graph.h" @@ -63,14 +64,14 @@ struct KisNodeModel::Private QTimer updateTimer; KisModelIndexConverterBase *indexConverter = 0; - KisDummiesFacadeBase *dummiesFacade = 0; + QPointer dummiesFacade = 0; bool needFinishRemoveRows = false; bool needFinishInsertRows = false; bool showRootLayer = false; bool showGlobalSelection = false; QPersistentModelIndex activeNodeIndex; - KisNodeDummy* parentOfRemovedNode = 0; + QPointer parentOfRemovedNode = 0; }; KisNodeModel::KisNodeModel(QObject * parent) @@ -95,7 +96,10 @@ KisNodeSP KisNodeModel::nodeFromIndex(const QModelIndex &index) const Q_ASSERT(index.isValid()); KisNodeDummy *dummy = m_d->indexConverter->dummyFromIndex(index); - return dummy->node(); + if (dummy) { + return dummy->node(); + } + return 0; } QModelIndex KisNodeModel::indexFromNode(KisNodeSP node) const @@ -247,16 +251,14 @@ void KisNodeModel::connectDummies(KisNodeDummy *dummy, bool needConnect) void KisNodeModel::setDummiesFacade(KisDummiesFacadeBase *dummiesFacade, KisImageWSP image, KisShapeController *shapeController, KisNodeSelectionAdapter *nodeSelectionAdapter, KisNodeInsertionAdapter *nodeInsertionAdapter) { - KisDummiesFacadeBase *oldDummiesFacade; - KisShapeController *oldShapeController; - oldShapeController = m_d->shapeController; - oldDummiesFacade = m_d->dummiesFacade; + QPointer oldDummiesFacade(m_d->dummiesFacade); + KisShapeController *oldShapeController = m_d->shapeController; m_d->shapeController = shapeController; m_d->nodeSelectionAdapter = nodeSelectionAdapter; m_d->nodeInsertionAdapter = nodeInsertionAdapter; - if(oldDummiesFacade && m_d->image) { + if (oldDummiesFacade && m_d->image) { m_d->image->disconnect(this); oldDummiesFacade->disconnect(this); connectDummies(m_d->dummiesFacade->rootDummy(), false); @@ -267,9 +269,9 @@ void KisNodeModel::setDummiesFacade(KisDummiesFacadeBase *dummiesFacade, KisImag m_d->parentOfRemovedNode = 0; resetIndexConverter(); - if(m_d->dummiesFacade) { + if (m_d->dummiesFacade) { KisNodeDummy *rootDummy = m_d->dummiesFacade->rootDummy(); - if(rootDummy) { + if (rootDummy) { connectDummies(rootDummy, true); } @@ -285,12 +287,12 @@ void KisNodeModel::setDummiesFacade(KisDummiesFacadeBase *dummiesFacade, KisImag connect(m_d->dummiesFacade, SIGNAL(sigDummyChanged(KisNodeDummy*)), SLOT(slotDummyChanged(KisNodeDummy*))); - if(m_d->image.isValid()) { + if (m_d->image.isValid()) { connect(m_d->image, SIGNAL(sigIsolatedModeChanged()), SLOT(slotIsolatedModeChanged())); } } - if(m_d->dummiesFacade != oldDummiesFacade || m_d->shapeController != oldShapeController) { + if (m_d->dummiesFacade != oldDummiesFacade || m_d->shapeController != oldShapeController) { reset(); } } diff --git a/libs/ui/kis_zoom_manager.cc b/libs/ui/kis_zoom_manager.cc index 9d58bfd21e6..fe08dac64e6 100644 --- a/libs/ui/kis_zoom_manager.cc +++ b/libs/ui/kis_zoom_manager.cc @@ -239,8 +239,10 @@ void KisZoomManager::setRulersTrackMouse(bool value) void KisZoomManager::applyRulersUnit(const KoUnit &baseUnit) { - m_horizontalRuler->setUnit(KoUnit(baseUnit.type(), m_view->image()->xRes())); - m_verticalRuler->setUnit(KoUnit(baseUnit.type(), m_view->image()->yRes())); + if (m_view && m_view->image()) { + m_horizontalRuler->setUnit(KoUnit(baseUnit.type(), m_view->image()->xRes())); + m_verticalRuler->setUnit(KoUnit(baseUnit.type(), m_view->image()->yRes())); + } } void KisZoomManager::setMinMaxZoom() diff --git a/libs/ui/tool/kis_selection_tool_helper.h b/libs/ui/tool/kis_selection_tool_helper.h index a469699fa7f..33fd9280207 100644 --- a/libs/ui/tool/kis_selection_tool_helper.h +++ b/libs/ui/tool/kis_selection_tool_helper.h @@ -20,12 +20,14 @@ #include +#include + #include "kundo2magicstring.h" #include "kis_layer.h" #include "kis_selection.h" +#include "kis_canvas2.h" class KoShape; -class KisCanvas2; /** * XXX: Doc! @@ -49,7 +51,7 @@ class KRITAUI_EXPORT KisSelectionToolHelper bool tryDeselectCurrentSelection(const QRectF selectionViewRect, SelectionAction action); private: - KisCanvas2* m_canvas; + QPointer m_canvas; KisImageSP m_image; KisLayerSP m_layer; KUndo2MagicString m_name; diff --git a/plugins/assistants/RulerAssistant/kis_ruler_assistant_tool.h b/plugins/assistants/RulerAssistant/kis_ruler_assistant_tool.h index b2da63109fa..99d0dd6da99 100644 --- a/plugins/assistants/RulerAssistant/kis_ruler_assistant_tool.h +++ b/plugins/assistants/RulerAssistant/kis_ruler_assistant_tool.h @@ -18,15 +18,17 @@ #ifndef _KIS_RULER_ASSISTANT_TOOL_H_ #define _KIS_RULER_ASSISTANT_TOOL_H_ -#include +#include + #include -#include "kis_painting_assistant.h" -#include "ui_AssistantsToolOptions.h" #include -#include +#include +#include "kis_painting_assistant.h" +#include +#include -class KisCanvas2; +#include "ui_AssistantsToolOptions.h" class KisRulerAssistantTool : public KisTool { @@ -77,7 +79,7 @@ private Q_SLOTS: virtual void paint(QPainter& gc, const KoViewConverter &converter); protected: - KisCanvas2* m_canvas; + QPointer m_canvas; QList m_handles, m_sideHandles; KisPaintingAssistantHandleSP m_handleDrag; KisPaintingAssistantHandleSP m_handleCombine; diff --git a/plugins/dockers/animation/kis_animation_curve_channel_list_model.cpp b/plugins/dockers/animation/kis_animation_curve_channel_list_model.cpp index be65141bdd0..89821f91b09 100644 --- a/plugins/dockers/animation/kis_animation_curve_channel_list_model.cpp +++ b/plugins/dockers/animation/kis_animation_curve_channel_list_model.cpp @@ -79,6 +79,7 @@ KisAnimationCurveChannelListModel::KisAnimationCurveChannelListModel(KisAnimatio KisAnimationCurveChannelListModel::~KisAnimationCurveChannelListModel() { qDeleteAll(m_d->items); + m_d->items.clear(); } void KisAnimationCurveChannelListModel::setDummiesFacade(KisDummiesFacadeBase *facade) @@ -89,20 +90,21 @@ void KisAnimationCurveChannelListModel::setDummiesFacade(KisDummiesFacadeBase *f void KisAnimationCurveChannelListModel::selectedNodesChanged(const KisNodeList &nodes) { // Remove unselected nodes - for (int i=m_d->items.count()-1; i >= 0; i--) { + for (int i = m_d->items.count()-1; i >= 0; i--) { NodeListItem *item = m_d->items.at(i); - - if (!nodes.contains(item->dummy->node())) { - beginRemoveRows(QModelIndex(), i, i); - m_d->items.removeAt(i); - endRemoveRows(); - - Q_FOREACH(KisAnimationCurve *curve, item->curves) { - m_d->curvesModel->removeCurve(curve); + if (item && item->dummy) { + if (!nodes.contains(item->dummy->node())) { + beginRemoveRows(QModelIndex(), i, i); + m_d->items.removeAt(i); + endRemoveRows(); + + Q_FOREACH(KisAnimationCurve *curve, item->curves) { + m_d->curvesModel->removeCurve(curve); + } + + item->dummy->node()->disconnect(this); + delete item; } - - item->dummy->node()->disconnect(this); - delete item; } } @@ -238,3 +240,10 @@ bool KisAnimationCurveChannelListModel::setData(const QModelIndex &index, const return false; } + + +void KisAnimationCurveChannelListModel::clear() +{ + qDeleteAll(m_d->items); + m_d->items.clear(); +} diff --git a/plugins/dockers/animation/kis_animation_curve_channel_list_model.h b/plugins/dockers/animation/kis_animation_curve_channel_list_model.h index 832d47418d9..eb0509ab5bd 100644 --- a/plugins/dockers/animation/kis_animation_curve_channel_list_model.h +++ b/plugins/dockers/animation/kis_animation_curve_channel_list_model.h @@ -51,6 +51,7 @@ class KisAnimationCurveChannelListModel : public QAbstractItemModel public Q_SLOTS: void selectedNodesChanged(const KisNodeList &nodes); + void clear(); void keyframeChannelAddedToNode(KisKeyframeChannel *channel); private: diff --git a/plugins/dockers/animation/kis_animation_curve_docker.cpp b/plugins/dockers/animation/kis_animation_curve_docker.cpp index d6cc75044af..3ea1b758961 100644 --- a/plugins/dockers/animation/kis_animation_curve_docker.cpp +++ b/plugins/dockers/animation/kis_animation_curve_docker.cpp @@ -101,7 +101,7 @@ KisAnimationCurveDocker::KisAnimationCurveDocker() KisAnimationCurveDocker::~KisAnimationCurveDocker() {} -void KisAnimationCurveDocker::setCanvas(KoCanvasBase * canvas) +void KisAnimationCurveDocker::setCanvas(KoCanvasBase *canvas) { if (canvas && m_d->canvas == canvas) return; @@ -114,7 +114,7 @@ void KisAnimationCurveDocker::setCanvas(KoCanvasBase * canvas) m_d->canvas = dynamic_cast(canvas); setEnabled(m_d->canvas != 0); - if(m_d->canvas) { + if (m_d->canvas) { KisDocument *doc = static_cast(m_d->canvas->imageView()->document()); KisShapeController *kritaShapeController = dynamic_cast(doc->shapeController()); m_d->channelListModel->setDummiesFacade(kritaShapeController); @@ -128,6 +128,7 @@ void KisAnimationCurveDocker::setCanvas(KoCanvasBase * canvas) m_d->channelListModel, SLOT(selectedNodesChanged(KisNodeList)) ); + m_d->channelListModel->clear(); m_d->channelListModel->selectedNodesChanged(m_d->canvas->viewManager()->nodeManager()->selectedNodes()); } } diff --git a/plugins/dockers/animation/timeline_frames_model.cpp b/plugins/dockers/animation/timeline_frames_model.cpp index d649712a00c..47c821f734c 100644 --- a/plugins/dockers/animation/timeline_frames_model.cpp +++ b/plugins/dockers/animation/timeline_frames_model.cpp @@ -63,7 +63,7 @@ struct TimelineFramesModel::Private int activeLayerIndex; - KisDummiesFacadeBase *dummiesFacade; + QPointer dummiesFacade; KisImageWSP image; bool needFinishInsertRows; bool needFinishRemoveRows; @@ -229,7 +229,7 @@ void TimelineFramesModel::setDummiesFacade(KisDummiesFacadeBase *dummiesFacade, { KisDummiesFacadeBase *oldDummiesFacade = m_d->dummiesFacade; - if (m_d->dummiesFacade) { + if (m_d->dummiesFacade && m_d->image) { m_d->image->animationInterface()->disconnect(this); m_d->image->disconnect(this); m_d->dummiesFacade->disconnect(this); diff --git a/plugins/dockers/channeldocker/channeldocker_dock.h b/plugins/dockers/channeldocker/channeldocker_dock.h index e2ba26cf126..7a2543e94c1 100644 --- a/plugins/dockers/channeldocker/channeldocker_dock.h +++ b/plugins/dockers/channeldocker/channeldocker_dock.h @@ -18,12 +18,15 @@ #ifndef CHANNELDOCKER_DOCK_H #define CHANNELDOCKER_DOCK_H +#include #include + #include +#include + class ChannelModel; class QTableView; -class KisCanvas2; class KisSignalCompressor; class KisIdleWatcher; @@ -46,7 +49,7 @@ private Q_SLOTS: private: KisIdleWatcher* m_imageIdleWatcher; KisSignalCompressor *m_compressor; - KisCanvas2 *m_canvas; + QPointer m_canvas; QTableView *m_channelTable; ChannelModel *m_model; }; diff --git a/plugins/dockers/channeldocker/channelmodel.h b/plugins/dockers/channeldocker/channelmodel.h index 7e7a09014fb..ac9f1f61595 100644 --- a/plugins/dockers/channeldocker/channelmodel.h +++ b/plugins/dockers/channeldocker/channelmodel.h @@ -20,10 +20,13 @@ #include #include +#include + +#include #include class KoColorSpace; -class KisCanvas2; + class ChannelModel : public QAbstractTableModel { @@ -56,7 +59,7 @@ public Q_SLOTS: void updateThumbnails(); private: - KisCanvas2* m_canvas; + QPointer m_canvas; QVector m_thumbnails; QSize m_thumbnailSizeLimit; int m_oversampleRatio; diff --git a/plugins/dockers/colorslider/kis_color_slider_dock.cpp b/plugins/dockers/colorslider/kis_color_slider_dock.cpp index f949ce7732c..d1e939009df 100644 --- a/plugins/dockers/colorslider/kis_color_slider_dock.cpp +++ b/plugins/dockers/colorslider/kis_color_slider_dock.cpp @@ -46,7 +46,7 @@ ColorSliderDock::ColorSliderDock() { } -void ColorSliderDock::setCanvas(KoCanvasBase * canvas) +void ColorSliderDock::setCanvas(KoCanvasBase *canvas) { setEnabled(canvas != 0); diff --git a/plugins/dockers/colorslider/kis_color_slider_dock.h b/plugins/dockers/colorslider/kis_color_slider_dock.h index ae2650afc0b..4e80411f725 100644 --- a/plugins/dockers/colorslider/kis_color_slider_dock.h +++ b/plugins/dockers/colorslider/kis_color_slider_dock.h @@ -20,13 +20,14 @@ #define _COLORSLIDER_DOCK_H_ #include +#include #include #include "kis_signal_auto_connection.h" #include +#include class KisViewManager; -class KisCanvas2; class KisColorSliderWidget; class ColorSliderDock : public QDockWidget, public KoCanvasObserverBase @@ -42,7 +43,7 @@ public Q_SLOTS: void udpateSliders(); private: - KisCanvas2 *m_canvas; + QPointer m_canvas; KisViewManager *m_view; KisColorSliderWidget* m_colorSliders; KisSignalAutoConnectionsStore m_canvasConnections; diff --git a/plugins/dockers/colorslider/kis_color_slider_input.h b/plugins/dockers/colorslider/kis_color_slider_input.h index 2b4b0c7f705..b9da0d3addc 100644 --- a/plugins/dockers/colorslider/kis_color_slider_input.h +++ b/plugins/dockers/colorslider/kis_color_slider_input.h @@ -20,9 +20,11 @@ #define _KIS_COLOR_SLIDER_INPUT_H_ #include +#include + #include "KoColorDisplayRendererInterface.h" -#include "kis_canvas2.h" +#include "kis_canvas2.h" class KoColor; class QWidget; @@ -32,7 +34,6 @@ class KisHSVSlider; class KisDisplayColorConverter; - class KisColorSliderInput : public QWidget { Q_OBJECT @@ -48,7 +49,7 @@ class KisColorSliderInput : public QWidget const int m_type; KoColor* m_color; KoColorDisplayRendererInterface *m_displayRenderer; - KisCanvas2* m_canvas; + QPointer m_canvas; KisHSVSlider* m_hsvSlider; }; @@ -61,7 +62,7 @@ class KisHSXColorSliderInput : public KisColorSliderInput KisDisplayColorConverter* converter() const; protected: virtual QWidget* createInput(); - KisCanvas2* m_canvas; + QPointer m_canvas; public Q_SLOTS: void setValue(double); void update(); diff --git a/plugins/dockers/colorslider/kis_color_slider_widget.h b/plugins/dockers/colorslider/kis_color_slider_widget.h index 92c7f33e912..c3e39490d2c 100644 --- a/plugins/dockers/colorslider/kis_color_slider_widget.h +++ b/plugins/dockers/colorslider/kis_color_slider_widget.h @@ -21,9 +21,12 @@ #define _KIS_COLOR_SLIDER_WIDGET_H_ #include -#include "kis_canvas2.h" +#include + #include +#include "kis_canvas2.h" + class KoColorSpace; class KoColorDisplayRendererInterface; class QVBoxLayout; @@ -67,7 +70,7 @@ private Q_SLOTS: KisSignalCompressor *m_updateCompressor; KisSignalCompressor *m_configCompressor; KoColorDisplayRendererInterface *m_displayRenderer; - KisCanvas2 *m_canvas; + QPointer m_canvas; KisColorSliderInput* hsvH; KisColorSliderInput* hsvS; KisColorSliderInput* hsvV; diff --git a/plugins/dockers/colorslider/kis_hsv_slider.h b/plugins/dockers/colorslider/kis_hsv_slider.h index 88db3a89fbe..daf4ed620de 100644 --- a/plugins/dockers/colorslider/kis_hsv_slider.h +++ b/plugins/dockers/colorslider/kis_hsv_slider.h @@ -22,6 +22,8 @@ #ifndef KIS_HSVSLIDER_H #define KIS_HSVSLIDER_H +#include + #include #include "KoColorDisplayRendererInterface.h" #include "kis_canvas2.h" @@ -54,7 +56,7 @@ class KisHSVSlider : public KSelector private: qreal R, G, B, Gamma; KoColorDisplayRendererInterface *m_displayRenderer; - KisCanvas2* m_canvas; + QPointer m_canvas; }; #endif diff --git a/plugins/dockers/compositiondocker/compositiondocker_dock.h b/plugins/dockers/compositiondocker/compositiondocker_dock.h index 2537051d85f..161aa6185cb 100644 --- a/plugins/dockers/compositiondocker/compositiondocker_dock.h +++ b/plugins/dockers/compositiondocker/compositiondocker_dock.h @@ -20,11 +20,15 @@ #include #include +#include + #include + +#include + #include "ui_wdgcompositiondocker.h" class CompositionModel; -class KisCanvas2; class KisAction; class CompositionDockerDock : public QDockWidget, public KoCanvasObserverBase, public Ui_WdgCompositionDocker { @@ -51,7 +55,7 @@ private Q_SLOTS: void renameComposition(); private: - KisCanvas2 *m_canvas; + QPointer m_canvas; CompositionModel *m_model; QVector m_actions; diff --git a/plugins/dockers/defaultdockers/kis_layer_box.cpp b/plugins/dockers/defaultdockers/kis_layer_box.cpp index ca5fb89f82c..d660ea93f0f 100644 --- a/plugins/dockers/defaultdockers/kis_layer_box.cpp +++ b/plugins/dockers/defaultdockers/kis_layer_box.cpp @@ -295,7 +295,7 @@ void KisLayerBox::setMainWindow(KisViewManager* kisview) void KisLayerBox::setCanvas(KoCanvasBase *canvas) { - if(m_canvas == canvas) + if (m_canvas == canvas) return; setEnabled(canvas != 0); diff --git a/plugins/dockers/defaultdockers/kis_layer_box.h b/plugins/dockers/defaultdockers/kis_layer_box.h index d2a2975d07c..f00fdb0396e 100644 --- a/plugins/dockers/defaultdockers/kis_layer_box.h +++ b/plugins/dockers/defaultdockers/kis_layer_box.h @@ -140,7 +140,7 @@ private Q_SLOTS: KisNodeSP findNonHidableNode(KisNodeSP startNode); private: - KisCanvas2* m_canvas; + QPointer m_canvas; QMenu *m_newLayerMenu; KisImageWSP m_image; QPointer m_nodeModel; diff --git a/plugins/dockers/digitalmixer/digitalmixer_dock.h b/plugins/dockers/digitalmixer/digitalmixer_dock.h index 21677b3d544..ce144464725 100644 --- a/plugins/dockers/digitalmixer/digitalmixer_dock.h +++ b/plugins/dockers/digitalmixer/digitalmixer_dock.h @@ -18,10 +18,14 @@ #ifndef _DIGITALMIXER_DOCK_H_ #define _DIGITALMIXER_DOCK_H_ +#include #include + #include #include +#include + class KoColorPopupAction; class KoColorSlider; class KoColorPatch; @@ -43,7 +47,7 @@ private Q_SLOTS: void colorSliderChanged(int i); void targetColorChanged(int); private: - KoCanvasBase* m_canvas; + QPointer m_canvas; KoColor m_currentColor; KoColorPatch* m_currentColorPatch; struct Mixer { diff --git a/plugins/dockers/histogram/histogramdocker_dock.h b/plugins/dockers/histogram/histogramdocker_dock.h index 62bd11bdb66..5227cf04e2b 100644 --- a/plugins/dockers/histogram/histogramdocker_dock.h +++ b/plugins/dockers/histogram/histogramdocker_dock.h @@ -19,11 +19,14 @@ #define _HISTOGRAM_DOCK_H_ #include +#include + #include + #include +#include class QVBoxLayout; -class KisCanvas2; class KisHistogramView; class KisIdleWatcher; class KoHistogramProducer; @@ -50,7 +53,7 @@ public Q_SLOTS: QVBoxLayout *m_layout; KisIdleWatcher *m_imageIdleWatcher; HistogramDockerWidget *m_histogramWidget; - KisCanvas2 *m_canvas; + QPointer m_canvas; }; diff --git a/plugins/dockers/historydocker/HistoryDock.cpp b/plugins/dockers/historydocker/HistoryDock.cpp index f253d7f0018..ce36a274cb8 100644 --- a/plugins/dockers/historydocker/HistoryDock.cpp +++ b/plugins/dockers/historydocker/HistoryDock.cpp @@ -50,12 +50,14 @@ HistoryDock::HistoryDock() setWindowTitle(i18n("Undo History")); } -void HistoryDock::setCanvas(KoCanvasBase *canvas) { - +void HistoryDock::setCanvas(KoCanvasBase *canvas) +{ setEnabled(canvas != 0); - - KisCanvas2* myCanvas = dynamic_cast( canvas ); - if (myCanvas) { + QPointer myCanvas = dynamic_cast(canvas); + if (myCanvas + && myCanvas->shapeController() + && myCanvas->shapeController()->resourceManager() + && myCanvas->shapeController()->resourceManager()->undoStack()) { KUndo2Stack* undoStack = canvas->shapeController()->resourceManager()->undoStack(); m_undoView->setStack(undoStack); @@ -73,3 +75,10 @@ void HistoryDock::configure() DlgConfigureHistoryDock dlg(m_undoView, m_undoView->stack(), this); dlg.exec(); } + +void HistoryDock::unsetCanvas() +{ + m_historyCanvas = 0; + setEnabled(false); + m_undoView->setStack(0); +} diff --git a/plugins/dockers/historydocker/HistoryDock.h b/plugins/dockers/historydocker/HistoryDock.h index 8e531b7b5a7..a8d6ed88441 100644 --- a/plugins/dockers/historydocker/HistoryDock.h +++ b/plugins/dockers/historydocker/HistoryDock.h @@ -43,7 +43,7 @@ class HistoryDock : public QDockWidget, public KoCanvasObserverBase HistoryDock(); QString observerName() { return "HistoryDock"; } virtual void setCanvas(KoCanvasBase *canvas); - virtual void unsetCanvas() { m_historyCanvas = 0; setEnabled(false); m_undoView->setStack(0); } + virtual void unsetCanvas(); private Q_SLOTS: void configure(); diff --git a/plugins/dockers/historydocker/KisUndoModel.h b/plugins/dockers/historydocker/KisUndoModel.h index 41bdb4a74e4..c5547ef818f 100644 --- a/plugins/dockers/historydocker/KisUndoModel.h +++ b/plugins/dockers/historydocker/KisUndoModel.h @@ -56,7 +56,10 @@ #include #include #include +#include + #include + #include "kis_types.h" #include "kis_canvas2.h" #include "KisViewManager.h" @@ -105,7 +108,7 @@ private Q_SLOTS: QItemSelectionModel *m_sel_model; QString m_empty_label; QIcon m_clean_icon; - KisCanvas2* m_canvas; + QPointer m_canvas; QMap m_imageMap; }; #endif diff --git a/plugins/dockers/imagedocker/imagedocker_dock.h b/plugins/dockers/imagedocker/imagedocker_dock.h index 7eccc57a3d4..4710adf0d25 100644 --- a/plugins/dockers/imagedocker/imagedocker_dock.h +++ b/plugins/dockers/imagedocker/imagedocker_dock.h @@ -18,16 +18,18 @@ #ifndef H_IMAGEDOCKER_DOCK_H_ #define H_IMAGEDOCKER_DOCK_H_ +#include #include #include #include #include #include +#include + class QModelIndex; class QFileSystemModel; class QButtonGroup; -class KoCanvasBase; class ImageFilter; class ImageStripScene; class ImageListModel; @@ -94,7 +96,7 @@ private Q_SLOTS: private: QFileSystemModel* m_model; QButtonGroup* m_zoomButtons; - KoCanvasBase* m_canvas; + QPointer m_canvas; ImageFilter* m_proxyModel; ImageListModel* m_imgListModel; QStringList m_history; diff --git a/plugins/dockers/lut/lutdocker_dock.h b/plugins/dockers/lut/lutdocker_dock.h index a9e55f4e90d..b8c6671b288 100644 --- a/plugins/dockers/lut/lutdocker_dock.h +++ b/plugins/dockers/lut/lutdocker_dock.h @@ -21,13 +21,14 @@ #include #include - +#include #include #include #include #include +#include #include "ui_wdglut.h" @@ -37,8 +38,6 @@ namespace OCIO = OCIO_NAMESPACE; - -class KisCanvas2; class BlackWhitePointChooser; #include "ocio_display_filter.h" @@ -102,7 +101,7 @@ private Q_SLOTS: QWidget *m_page; - KisCanvas2 *m_canvas; + QPointer m_canvas; OCIO::ConstConfigRcPtr m_ocioConfig; QSharedPointer m_displayFilter; diff --git a/plugins/dockers/overview/overviewdocker_dock.h b/plugins/dockers/overview/overviewdocker_dock.h index 923f229612a..194aa00ea5c 100644 --- a/plugins/dockers/overview/overviewdocker_dock.h +++ b/plugins/dockers/overview/overviewdocker_dock.h @@ -18,11 +18,13 @@ #ifndef _OVERVIEW_DOCK_H_ #define _OVERVIEW_DOCK_H_ +#include #include #include +#include + class QVBoxLayout; -class KisCanvas2; class OverviewWidget; class OverviewDockerDock : public QDockWidget, public KoCanvasObserverBase { @@ -37,7 +39,7 @@ class OverviewDockerDock : public QDockWidget, public KoCanvasObserverBase { QVBoxLayout *m_layout; OverviewWidget *m_overviewWidget; QWidget *m_zoomSlider; - KisCanvas2 *m_canvas; + QPointer m_canvas; }; diff --git a/plugins/dockers/overview/overviewwidget.h b/plugins/dockers/overview/overviewwidget.h index fa76f68536d..bfb36337aac 100644 --- a/plugins/dockers/overview/overviewwidget.h +++ b/plugins/dockers/overview/overviewwidget.h @@ -22,11 +22,14 @@ #include #include #include +#include + #include #include "kis_idle_watcher.h" #include "kis_simple_stroke_strategy.h" -class KisCanvas2; +#include + class KisSignalCompressor; class KoCanvasBase; @@ -94,7 +97,7 @@ public Q_SLOTS: QPolygonF previewPolygon(); QPixmap m_pixmap; - KisCanvas2 *m_canvas; + QPointer m_canvas; bool m_dragging; QPointF m_lastPos; diff --git a/plugins/dockers/palettedocker/palettedocker_dock.cpp b/plugins/dockers/palettedocker/palettedocker_dock.cpp index f05f43623a4..3b6a42ec913 100644 --- a/plugins/dockers/palettedocker/palettedocker_dock.cpp +++ b/plugins/dockers/palettedocker/palettedocker_dock.cpp @@ -127,7 +127,7 @@ void PaletteDockerDock::setCanvas(KoCanvasBase *canvas) { setEnabled(canvas != 0); if (canvas) { - KisCanvas2 *cv = dynamic_cast(canvas); + KisCanvas2 *cv = qobject_cast(canvas); m_model->setDisplayRenderer(cv->displayColorConverter()->displayRendererInterface()); } m_canvas = static_cast(canvas); diff --git a/plugins/dockers/palettedocker/palettedocker_dock.h b/plugins/dockers/palettedocker/palettedocker_dock.h index 77b129a817e..b39754a0782 100644 --- a/plugins/dockers/palettedocker/palettedocker_dock.h +++ b/plugins/dockers/palettedocker/palettedocker_dock.h @@ -22,16 +22,18 @@ #include #include +#include + #include #include #include #include +#include #include class KisViewManager; class KisCanvasResourceProvider; -class KisCanvas2; class KisWorkspaceResource; class KisColorsetChooser; class KisPaletteModel; @@ -75,7 +77,7 @@ private Q_SLOTS: KoColorSet *m_currentColorSet; KisColorsetChooser *m_colorSetChooser; KisCanvasResourceProvider *m_resourceProvider; - KisCanvas2 *m_canvas; + QPointer m_canvas; }; diff --git a/plugins/dockers/presetdocker/presetdocker_dock.cpp b/plugins/dockers/presetdocker/presetdocker_dock.cpp index 216b1f15887..748958ede7e 100644 --- a/plugins/dockers/presetdocker/presetdocker_dock.cpp +++ b/plugins/dockers/presetdocker/presetdocker_dock.cpp @@ -43,7 +43,7 @@ PresetDockerDock::PresetDockerDock( ) setWidget(m_presetChooser); } -void PresetDockerDock::setCanvas(KoCanvasBase * canvas) +void PresetDockerDock::setCanvas(KoCanvasBase *canvas) { setEnabled(canvas != 0); @@ -66,7 +66,7 @@ void PresetDockerDock::setCanvas(KoCanvasBase * canvas) void PresetDockerDock::canvasResourceChanged(int /*key*/, const QVariant& /*v*/) { - if (m_canvas) { + if (m_canvas && m_canvas->resourceManager()) { sender()->blockSignals(true); KisPaintOpPresetSP preset = m_canvas->resourceManager()->resource(KisCanvasResourceProvider::CurrentPaintOpPreset).value(); if(preset) diff --git a/plugins/dockers/presetdocker/presetdocker_dock.h b/plugins/dockers/presetdocker/presetdocker_dock.h index 03b7446c311..5bb9c1e83f8 100644 --- a/plugins/dockers/presetdocker/presetdocker_dock.h +++ b/plugins/dockers/presetdocker/presetdocker_dock.h @@ -18,11 +18,12 @@ #ifndef _PRESETDOCKER_DOCK_H_ #define _PRESETDOCKER_DOCK_H_ +#include #include #include +#include class KisPaintOpPresetsChooserPopup; -class KisCanvas2; class PresetDockerDock : public QDockWidget, public KoCanvasObserverBase { Q_OBJECT @@ -35,7 +36,7 @@ public Q_SLOTS: void canvasResourceChanged(int key, const QVariant& v); private Q_SLOTS: private: - KisCanvas2* m_canvas; + QPointer m_canvas; KisPaintOpPresetsChooserPopup* m_presetChooser; }; diff --git a/plugins/dockers/presethistory/presethistory_dock.h b/plugins/dockers/presethistory/presethistory_dock.h index 90542f8f348..6f23b8ee05c 100644 --- a/plugins/dockers/presethistory/presethistory_dock.h +++ b/plugins/dockers/presethistory/presethistory_dock.h @@ -19,14 +19,15 @@ #define _PRESETHISTORY_DOCK_H_ #include +#include + #include +#include #include class QListWidget; class QListWidgetItem; -class KisCanvas2; - class PresetHistoryDock : public QDockWidget, public KoCanvasObserverBase { Q_OBJECT @@ -42,7 +43,7 @@ private Q_SLOTS: private: void addPreset(KisPaintOpPresetSP preset); private: - KisCanvas2 *m_canvas; + QPointer m_canvas; QListWidget *m_presetHistory; bool m_block; bool m_initialized; diff --git a/plugins/dockers/shapedockers/shapeproperties/ShapePropertiesDocker.cpp b/plugins/dockers/shapedockers/shapeproperties/ShapePropertiesDocker.cpp index bf602586835..9f765120ec5 100644 --- a/plugins/dockers/shapedockers/shapeproperties/ShapePropertiesDocker.cpp +++ b/plugins/dockers/shapedockers/shapeproperties/ShapePropertiesDocker.cpp @@ -34,6 +34,7 @@ #include #include +#include class ShapePropertiesDocker::Private { @@ -49,7 +50,7 @@ class ShapePropertiesDocker::Private QStackedWidget *widgetStack; KoShape *currentShape; KoShapeConfigWidgetBase *currentPanel; - KoCanvasBase *canvas; + QPointer canvas; }; ShapePropertiesDocker::ShapePropertiesDocker(QWidget *parent) diff --git a/plugins/dockers/smallcolorselector/smallcolorselector_dock.h b/plugins/dockers/smallcolorselector/smallcolorselector_dock.h index c3279498d26..f739f751bdf 100644 --- a/plugins/dockers/smallcolorselector/smallcolorselector_dock.h +++ b/plugins/dockers/smallcolorselector/smallcolorselector_dock.h @@ -18,7 +18,10 @@ #ifndef _SMALLCOLORSELECTOR_DOCK_H_ #define _SMALLCOLORSELECTOR_DOCK_H_ +#include #include + +#include #include class KisSmallColorWidget; @@ -37,7 +40,7 @@ public Q_SLOTS: void canvasResourceChanged(int, const QVariant&); private: KisSmallColorWidget* m_smallColorWidget; - KoCanvasBase* m_canvas; + QPointer m_canvas; }; diff --git a/plugins/dockers/specificcolorselector/specificcolorselector_dock.h b/plugins/dockers/specificcolorselector/specificcolorselector_dock.h index d1dd6305802..bf6e287b149 100644 --- a/plugins/dockers/specificcolorselector/specificcolorselector_dock.h +++ b/plugins/dockers/specificcolorselector/specificcolorselector_dock.h @@ -20,12 +20,13 @@ #define _SPECIFICCOLORSELECTOR_DOCK_H_ #include +#include #include #include +#include class KisViewManager; -class KisCanvas2; class KisSpecificColorSelectorWidget; class SpecificColorSelectorDock : public QDockWidget, public KisMainwindowObserver @@ -40,7 +41,7 @@ class SpecificColorSelectorDock : public QDockWidget, public KisMainwindowObserv virtual void setMainWindow(KisViewManager* kisview); private: - KisCanvas2 *m_canvas; + QPointer m_canvas; KisViewManager *m_view; KisSpecificColorSelectorWidget* m_colorSelector; }; diff --git a/plugins/dockers/tasksetdocker/tasksetdocker_dock.h b/plugins/dockers/tasksetdocker/tasksetdocker_dock.h index e57bb429565..cdab4d40685 100644 --- a/plugins/dockers/tasksetdocker/tasksetdocker_dock.h +++ b/plugins/dockers/tasksetdocker/tasksetdocker_dock.h @@ -20,15 +20,18 @@ #include #include +#include + #include -#include "ui_wdgtasksetdocker.h" #include -#include "taskset_resource.h" +#include + +#include "taskset_resource.h" +#include "ui_wdgtasksetdocker.h" class KoResourceLoaderThread; class TasksetModel; -class KisCanvas2; class TasksetDockerDock : public QDockWidget, public KoCanvasObserverBase, public Ui_WdgTasksetDocker { Q_OBJECT @@ -48,7 +51,7 @@ private Q_SLOTS: void resourceSelected( KoResource * resource ); private: - KisCanvas2 *m_canvas; + QPointer m_canvas; TasksetModel *m_model; bool m_blocked; KoResourceServer* m_rserver; diff --git a/plugins/flake/artistictextshape/ArtisticTextToolSelection.h b/plugins/flake/artistictextshape/ArtisticTextToolSelection.h index 1287e7896e7..4b159adb591 100644 --- a/plugins/flake/artistictextshape/ArtisticTextToolSelection.h +++ b/plugins/flake/artistictextshape/ArtisticTextToolSelection.h @@ -22,9 +22,11 @@ #include #include +#include + +#include class ArtisticTextShape; -class KoCanvasBase; class KoViewConverter; class QPainter; @@ -65,7 +67,7 @@ class ArtisticTextToolSelection : public KoToolSelection /// Returns the outline of the selection in document coordinates QPainterPath outline(); - KoCanvasBase *m_canvas; + QPointer m_canvas; ArtisticTextShape *m_currentShape; ///< the currently selected text shape int m_selectionStart; int m_selectionCount; diff --git a/plugins/flake/textshape/ReferencesTool.h b/plugins/flake/textshape/ReferencesTool.h index e6c1618646b..4e01db1eb7a 100644 --- a/plugins/flake/textshape/ReferencesTool.h +++ b/plugins/flake/textshape/ReferencesTool.h @@ -23,8 +23,10 @@ #include "TextTool.h" #include +#include + +#include -class KoCanvasBase; class TableOfContentsConfigure; class SimpleTableOfContentsWidget; class SimpleFootEndNotesWidget; @@ -101,7 +103,7 @@ private Q_SLOTS: SimpleCitationBibliographyWidget *m_scbw; SimpleLinksWidget *m_slw; LabeledWidget *m_bmark; - KoCanvasBase *m_canvas; + QPointer m_canvas; }; class QAction; diff --git a/plugins/flake/textshape/ReviewTool.h b/plugins/flake/textshape/ReviewTool.h index 6ef37a85f40..17ded8cbf6d 100644 --- a/plugins/flake/textshape/ReviewTool.h +++ b/plugins/flake/textshape/ReviewTool.h @@ -20,7 +20,9 @@ #ifndef REVIEWTOOL_H #define REVIEWTOOL_H -class KoCanvasBase; +#include +#include + class KoPointerEvent; class KoTextEditor; class KoTextShapeData; @@ -61,7 +63,7 @@ public Q_SLOTS: KoTextEditor *m_textEditor; KoTextShapeData *m_textShapeData; - KoCanvasBase *m_canvas; + QPointer m_canvas; TextShape *m_textShape; QAction *m_removeAnnotationAction; KoShape *m_currentAnnotationShape; diff --git a/plugins/flake/textshape/commands/ShowChangesCommand.h b/plugins/flake/textshape/commands/ShowChangesCommand.h index bf20ac27317..2ac4691bd47 100644 --- a/plugins/flake/textshape/commands/ShowChangesCommand.h +++ b/plugins/flake/textshape/commands/ShowChangesCommand.h @@ -22,12 +22,16 @@ #define SHOWCHANGECOMMAND_H #include "KoTextCommandBase.h" + #include +#include #include +#include + class KoChangeTracker; class KoTextEditor; -class KoCanvasBase; + class QTextDocument; @@ -58,7 +62,7 @@ class ShowChangesCommand : public QObject, public KoTextCommandBase KoTextEditor *m_textEditor; bool m_first; bool m_showChanges; - KoCanvasBase *m_canvas; + QPointer m_canvas; QList m_shapeCommands; }; diff --git a/plugins/flake/textshape/kotext/InsertInlineObjectActionBase_p.h b/plugins/flake/textshape/kotext/InsertInlineObjectActionBase_p.h index a6dd41feda8..7b527b2050d 100644 --- a/plugins/flake/textshape/kotext/InsertInlineObjectActionBase_p.h +++ b/plugins/flake/textshape/kotext/InsertInlineObjectActionBase_p.h @@ -21,8 +21,10 @@ #define INSERTINLINEOBJECTACTIONBASE_H #include +#include + +#include -class KoCanvasBase; class KoInlineObject; /** @@ -41,7 +43,7 @@ private Q_SLOTS: protected: virtual KoInlineObject *createInlineObject() = 0; - KoCanvasBase *m_canvas; + QPointer m_canvas; }; #endif diff --git a/plugins/flake/textshape/kotext/commands/TextPasteCommand.h b/plugins/flake/textshape/kotext/commands/TextPasteCommand.h index 8bd673a2ba0..a9158dfdd0e 100644 --- a/plugins/flake/textshape/kotext/commands/TextPasteCommand.h +++ b/plugins/flake/textshape/kotext/commands/TextPasteCommand.h @@ -20,15 +20,16 @@ #ifndef TEXTPASTECOMMAND_H #define TEXTPASTECOMMAND_H +#include #include #include #include +#include class QTextDocument; class KoDocumentRdfBase; class KoShapeController; class QMimeData; -class KoCanvasBase; class TextPasteCommand : public KUndo2Command { @@ -49,7 +50,7 @@ class TextPasteCommand : public KUndo2Command QWeakPointer m_document; KoDocumentRdfBase *m_rdf; KoShapeController *m_shapeController; - KoCanvasBase *m_canvas; + QPointer m_canvas; bool m_pasteAsText; bool m_first; }; diff --git a/plugins/tools/defaulttool/defaulttool/ShapeMoveStrategy.h b/plugins/tools/defaulttool/defaulttool/ShapeMoveStrategy.h index 4cfc4479abe..4e6678682cf 100644 --- a/plugins/tools/defaulttool/defaulttool/ShapeMoveStrategy.h +++ b/plugins/tools/defaulttool/defaulttool/ShapeMoveStrategy.h @@ -24,10 +24,12 @@ #include +#include #include #include -class KoCanvasBase; +#include + class KoToolBase; class KoShape; @@ -57,7 +59,7 @@ class ShapeMoveStrategy : public KoInteractionStrategy QList m_newPositions; QPointF m_start, m_diff, m_initialSelectionPosition, m_initialOffset; QList m_selectedShapes; - KoCanvasBase *m_canvas; + QPointer m_canvas; }; #endif diff --git a/plugins/tools/karbonplugins/tools/filterEffectTool/FilterEffectEditWidget.h b/plugins/tools/karbonplugins/tools/filterEffectTool/FilterEffectEditWidget.h index c5428462bd9..6293b6082a9 100644 --- a/plugins/tools/karbonplugins/tools/filterEffectTool/FilterEffectEditWidget.h +++ b/plugins/tools/karbonplugins/tools/filterEffectTool/FilterEffectEditWidget.h @@ -23,9 +23,11 @@ #include "ui_FilterEffectEditWidget.h" #include "FilterEffectScene.h" #include +#include + +#include class KoShape; -class KoCanvasBase; class KoFilterEffect; class KoFilterEffectStack; @@ -60,7 +62,7 @@ private Q_SLOTS: FilterEffectScene *m_scene; KoShape *m_shape; - KoCanvasBase *m_canvas; + QPointer m_canvas; KoFilterEffectStack *m_effects; ConnectionSource m_currentItem; KComboBox *m_defaultSourceSelector; diff --git a/plugins/tools/tool_transform2/kis_tool_transform.h b/plugins/tools/tool_transform2/kis_tool_transform.h index 407889374e8..0bee4ec5ae6 100644 --- a/plugins/tools/tool_transform2/kis_tool_transform.h +++ b/plugins/tools/tool_transform2/kis_tool_transform.h @@ -30,6 +30,7 @@ #include #include #include +#include #include @@ -40,16 +41,13 @@ #include #include #include +#include #include "tool_transform_args.h" #include "tool_transform_changes_tracker.h" #include "kis_tool_transform_config_widget.h" #include "transform_transaction_properties.h" - - -class KisCanvas2; - class QTouchEvent; class KisTransformStrategyBase; class KisWarpTransformStrategy; @@ -277,7 +275,7 @@ public Q_SLOTS: QPainterPath m_selectionPath; // original (unscaled) selection outline, used for painting decorations KisToolTransformConfigWidget *m_optionsWidget; - KisCanvas2 *m_canvas; + QPointer m_canvas; TransformTransactionProperties m_transaction; TransformChangesTracker m_changesTracker; From 6dc22a547052427490df52bbc79950d12c711e0c Mon Sep 17 00:00:00 2001 From: Boudewijn Rempt Date: Mon, 27 Feb 2017 14:40:50 +0100 Subject: [PATCH 09/42] Change the tooltip: play is play/stop, not play/pause BUG:376875 --- plugins/dockers/animation/animation_docker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/dockers/animation/animation_docker.cpp b/plugins/dockers/animation/animation_docker.cpp index f382d66d4e6..25c7e714872 100644 --- a/plugins/dockers/animation/animation_docker.cpp +++ b/plugins/dockers/animation/animation_docker.cpp @@ -93,7 +93,7 @@ AnimationDocker::AnimationDocker() m_lastFrameAction->setActivationFlags(KisAction::ACTIVE_IMAGE); m_animationWidget->btnLastFrame->setDefaultAction(m_lastFrameAction); - m_playPauseAction = new KisAction(i18n("Play / Pause"), m_animationWidget->btnPlay); + m_playPauseAction = new KisAction(i18n("Play / Stop"), m_animationWidget->btnPlay); m_playPauseAction->setActivationFlags(KisAction::ACTIVE_IMAGE); m_animationWidget->btnPlay->setDefaultAction(m_playPauseAction); From 067fd1d7dff76158bb7326ea96f78da53797591d Mon Sep 17 00:00:00 2001 From: Boudewijn Rempt Date: Mon, 27 Feb 2017 14:44:48 +0100 Subject: [PATCH 10/42] Saving masks actually is not supported yet. --- plugins/impex/psd/psd_export.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/impex/psd/psd_export.cc b/plugins/impex/psd/psd_export.cc index e5369ca4b8b..2448292e4af 100644 --- a/plugins/impex/psd/psd_export.cc +++ b/plugins/impex/psd/psd_export.cc @@ -70,7 +70,7 @@ void psdExport::initializeCapabilities() addCapability(KisExportCheckRegistry::instance()->get("MultiLayerCheck")->create(KisExportCheckBase::SUPPORTED)); addCapability(KisExportCheckRegistry::instance()->get("sRGBProfileCheck")->create(KisExportCheckBase::SUPPORTED)); addCapability(KisExportCheckRegistry::instance()->get("MultiLayerCheck")->create(KisExportCheckBase::SUPPORTED)); - addCapability(KisExportCheckRegistry::instance()->get("NodeTypeCheck/KisTransparencyMask")->create(KisExportCheckBase::SUPPORTED)); + //addCapability(KisExportCheckRegistry::instance()->get("NodeTypeCheck/KisTransparencyMask")->create(KisExportCheckBase::SUPPORTED)); addCapability(KisExportCheckRegistry::instance()->get("ColorModelHomogenousCheck")->create(KisExportCheckBase::UNSUPPORTED, i18nc("image conversion warning", "Your image contains one or more layers with a color model that is different from the image."))); ImageSizeCheckFactory *factory = dynamic_cast(KisExportCheckRegistry::instance()->get("ImageSizeCheck")); From ca91e57c07fee3cdaecd4777c921ebb941603089 Mon Sep 17 00:00:00 2001 From: Boudewijn Rempt Date: Mon, 27 Feb 2017 16:22:29 +0100 Subject: [PATCH 11/42] Make it possible to shift-drag the brushsize beyond 1000 --- libs/ui/tool/kis_tool_freehand.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libs/ui/tool/kis_tool_freehand.cc b/libs/ui/tool/kis_tool_freehand.cc index 82410ca9ce0..e51ac51dbe1 100644 --- a/libs/ui/tool/kis_tool_freehand.cc +++ b/libs/ui/tool/kis_tool_freehand.cc @@ -351,8 +351,7 @@ void KisToolFreehand::continueAlternateAction(KoPointerEvent *event, AlternateAc qreal scaleY = 0; canvas2->coordinatesConverter()->imageScale(&scaleX, &scaleY); - // we have no centralized knowledge of the maximum brush size! - const qreal maxBrushSize = 1000.0; + const qreal maxBrushSize = KisConfig().readEntry("maximumBrushSize", 1000); const qreal effectiveMaxDragSize = 0.5 * screenRect.width(); const qreal effectiveMaxBrushSize = qMin(maxBrushSize, effectiveMaxDragSize / scaleX); From 0ce5542ac3f6d4f00140fe3a63702c56361d1bcc Mon Sep 17 00:00:00 2001 From: Boudewijn Rempt Date: Mon, 27 Feb 2017 18:15:43 +0100 Subject: [PATCH 12/42] Restore the OpenGL crash detection Not all drivers raise an exception if compiling a shader fails, Intel's windows drivers just crash the application. So we need the crash detection back. --- krita/main.cc | 5 ++++- libs/ui/KisApplication.cpp | 12 +++++++++++- libs/ui/kis_config.cc | 4 ++-- libs/ui/opengl/kis_opengl.cpp | 19 +++++++++++++++++++ libs/ui/opengl/kis_opengl_canvas2.cpp | 4 +++- 5 files changed, 39 insertions(+), 5 deletions(-) diff --git a/krita/main.cc b/krita/main.cc index 6882c1ff8ea..19272bba759 100644 --- a/krita/main.cc +++ b/krita/main.cc @@ -120,8 +120,9 @@ extern "C" int main(int argc, char **argv) QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true); const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation); -#if QT_VERSION >= 0x050600 QSettings kritarc(configPath + QStringLiteral("/kritarc"), QSettings::IniFormat); + +#if QT_VERSION >= 0x050600 if (kritarc.value("EnableHiDPI", false).toBool()) { QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); } @@ -261,6 +262,8 @@ extern "C" int main(int argc, char **argv) int state = app.exec(); + kritarc.setValue("canvasState", "OPENGL_SUCCESS"); + return state; } diff --git a/libs/ui/KisApplication.cpp b/libs/ui/KisApplication.cpp index 7e9448ae060..92e63a5f522 100644 --- a/libs/ui/KisApplication.cpp +++ b/libs/ui/KisApplication.cpp @@ -331,9 +331,11 @@ void KisApplication::loadPlugins() bool KisApplication::start(const KisApplicationArguments &args) { + KisConfig cfg; + #if defined(Q_OS_WIN) || defined (Q_OS_OSX) #ifdef ENV32BIT - KisConfig cfg; + if (isWow64() && !cfg.readEntry("WarnedAbout32Bits", false)) { QMessageBox::information(0, i18nc("@title:window", "Krita: Warning"), @@ -346,6 +348,14 @@ bool KisApplication::start(const KisApplicationArguments &args) #endif #endif + QString opengl = cfg.canvasState(); + if (opengl == "OPENGL_NOT_TRIED" ) { + cfg.setCanvasState("TRY_OPENGL"); + } + else if (opengl != "OPENGL_SUCCESS") { + cfg.setCanvasState("OPENGL_FAILED"); + } + setSplashScreenLoadingText(i18n("Initializing Globals")); processEvents(); initializeGlobals(args); diff --git a/libs/ui/kis_config.cc b/libs/ui/kis_config.cc index b419827e058..ccca8f328a7 100644 --- a/libs/ui/kis_config.cc +++ b/libs/ui/kis_config.cc @@ -600,8 +600,8 @@ bool KisConfig::useOpenGL(bool defaultValue) const } //dbgKrita << "use opengl" << m_cfg.readEntry("useOpenGL", true) << "success" << m_cfg.readEntry("canvasState", "OPENGL_SUCCESS"); - QString canvasState = m_cfg.readEntry("canvasState", "OPENGL_SUCCESS"); - return (m_cfg.readEntry("useOpenGL", true) && (canvasState == "OPENGL_SUCCESS" || canvasState == "TRY_OPENGL")); + QString cs = canvasState(); + return (m_cfg.readEntry("useOpenGL", true) && (cs == "OPENGL_SUCCESS" || cs == "TRY_OPENGL")); } void KisConfig::setUseOpenGL(bool useOpenGL) const diff --git a/libs/ui/opengl/kis_opengl.cpp b/libs/ui/opengl/kis_opengl.cpp index a76d2c3562a..a05442a655c 100644 --- a/libs/ui/opengl/kis_opengl.cpp +++ b/libs/ui/opengl/kis_opengl.cpp @@ -148,6 +148,25 @@ void KisOpenGL::initializeContext(QOpenGLContext *ctx) QPixmapCache::setCacheLimit(qMax(minCacheSize, cacheSize)); } + + + /** + * Warn about Intel's broken video drivers + */ +#if defined Q_OS_WIN + KisConfig cfg; + QString renderer = KisOpenGL::renderer(); + if (cfg.useOpenGL() && renderer.startsWith("Intel") && !cfg.readEntry("WarnedAboutIntel", false)) { + QMessageBox::information(0, + i18nc("@title:window", "Krita: Warning"), + i18n("You have an Intel(R) HD Graphics video adapter.\n" + "If you experience problems like a black or blank screen," + "please update your display driver to the latest version.\n\n" + "You can also disable OpenGL rendering in Krita's Settings.\n")); + cfg.writeEntry("WarnedAboutIntel", true); + } +#endif + } // XXX Temporary function to allow LoD on OpenGL3 without triggering diff --git a/libs/ui/opengl/kis_opengl_canvas2.cpp b/libs/ui/opengl/kis_opengl_canvas2.cpp index cd3b0db6d3a..87f4c2f1153 100644 --- a/libs/ui/opengl/kis_opengl_canvas2.cpp +++ b/libs/ui/opengl/kis_opengl_canvas2.cpp @@ -130,8 +130,10 @@ KisOpenGLCanvas2::KisOpenGLCanvas2(KisCanvas2 *canvas, , KisCanvasWidgetBase(canvas, coordinatesConverter) , d(new Private()) { + abort(); + KisConfig cfg; - cfg.writeEntry("canvasState", "OPENGL_STARTED"); + cfg.setCanvasState("OPENGL_STARTED"); d->openGLImageTextures = KisOpenGLImageTextures::getImageTextures(image, From a07ab08b00efc20c524bc674ad0442f30afd6dc1 Mon Sep 17 00:00:00 2001 From: Boudewijn Rempt Date: Mon, 27 Feb 2017 18:33:51 +0100 Subject: [PATCH 13/42] The 32 bits warning makes no sense for OSX --- libs/ui/KisApplication.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/ui/KisApplication.cpp b/libs/ui/KisApplication.cpp index 92e63a5f522..8cb1b6a6418 100644 --- a/libs/ui/KisApplication.cpp +++ b/libs/ui/KisApplication.cpp @@ -333,7 +333,7 @@ bool KisApplication::start(const KisApplicationArguments &args) { KisConfig cfg; -#if defined(Q_OS_WIN) || defined (Q_OS_OSX) +#if defined(Q_OS_WIN) #ifdef ENV32BIT if (isWow64() && !cfg.readEntry("WarnedAbout32Bits", false)) { From ff34bdbed1718d0f53c81af61acaa7c9bb0bbffd Mon Sep 17 00:00:00 2001 From: Boudewijn Rempt Date: Mon, 27 Feb 2017 18:50:38 +0100 Subject: [PATCH 14/42] Remove debugging line & improve message --- libs/ui/opengl/kis_opengl.cpp | 4 ++-- libs/ui/opengl/kis_opengl_canvas2.cpp | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/libs/ui/opengl/kis_opengl.cpp b/libs/ui/opengl/kis_opengl.cpp index a05442a655c..9932779cb64 100644 --- a/libs/ui/opengl/kis_opengl.cpp +++ b/libs/ui/opengl/kis_opengl.cpp @@ -160,9 +160,9 @@ void KisOpenGL::initializeContext(QOpenGLContext *ctx) QMessageBox::information(0, i18nc("@title:window", "Krita: Warning"), i18n("You have an Intel(R) HD Graphics video adapter.\n" - "If you experience problems like a black or blank screen," + "If you experience problems like a crash, a black or blank screen," "please update your display driver to the latest version.\n\n" - "You can also disable OpenGL rendering in Krita's Settings.\n")); + "If Krita crashes, it will disable OpenGL rendering. Please restart Krita in that case.\n After updating your drivers you can re-enable OpenGL in Krita's Settings.\n")); cfg.writeEntry("WarnedAboutIntel", true); } #endif diff --git a/libs/ui/opengl/kis_opengl_canvas2.cpp b/libs/ui/opengl/kis_opengl_canvas2.cpp index 87f4c2f1153..2ef938f379e 100644 --- a/libs/ui/opengl/kis_opengl_canvas2.cpp +++ b/libs/ui/opengl/kis_opengl_canvas2.cpp @@ -130,8 +130,6 @@ KisOpenGLCanvas2::KisOpenGLCanvas2(KisCanvas2 *canvas, , KisCanvasWidgetBase(canvas, coordinatesConverter) , d(new Private()) { - abort(); - KisConfig cfg; cfg.setCanvasState("OPENGL_STARTED"); From 82c2db38093ad9744bb7997627f4147c9d519314 Mon Sep 17 00:00:00 2001 From: Boudewijn Rempt Date: Mon, 27 Feb 2017 19:49:30 +0100 Subject: [PATCH 15/42] Add ellipises: this filter has a dialog --- plugins/filters/gradientmap/krita_filter_gradient_map.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/filters/gradientmap/krita_filter_gradient_map.cpp b/plugins/filters/gradientmap/krita_filter_gradient_map.cpp index 1f4c2869c7b..44fbc58b5ad 100644 --- a/plugins/filters/gradientmap/krita_filter_gradient_map.cpp +++ b/plugins/filters/gradientmap/krita_filter_gradient_map.cpp @@ -35,7 +35,7 @@ #include -KritaFilterGradientMap::KritaFilterGradientMap() : KisFilter(id(), categoryMap(), i18n("&Gradient Map")) +KritaFilterGradientMap::KritaFilterGradientMap() : KisFilter(id(), categoryMap(), i18n("&Gradient Map...")) { setColorSpaceIndependence(FULLY_INDEPENDENT); setShowConfigurationWidget(true); From 0939e8743a701938e484614c9b4a13708caf1edf Mon Sep 17 00:00:00 2001 From: Boudewijn Rempt Date: Mon, 27 Feb 2017 20:19:49 +0100 Subject: [PATCH 16/42] BUG:376262 Don't translate the lens blur shape names Those apparently need to be untranslated for the filter to work. --- plugins/filters/blur/wdg_lens_blur.ui | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/plugins/filters/blur/wdg_lens_blur.ui b/plugins/filters/blur/wdg_lens_blur.ui index dddf13e9207..faacd1eeb7f 100644 --- a/plugins/filters/blur/wdg_lens_blur.ui +++ b/plugins/filters/blur/wdg_lens_blur.ui @@ -6,8 +6,8 @@ 0 0 - 255 - 153 + 262 + 172 @@ -37,32 +37,32 @@ - Triangle + Triangle - Quadrilateral (4) + Quadrilateral (4) - Pentagon (5) + Pentagon (5) - Hexagon (6) + Hexagon (6) - Heptagon (7) + Heptagon (7) - Octagon (8) + Octagon (8) From 4ea9c22e5ef20398e9c27d3162f2a83e43ead2bd Mon Sep 17 00:00:00 2001 From: Scott Petrovic Date: Mon, 27 Feb 2017 18:30:36 -0600 Subject: [PATCH 17/42] fix typo with slot name --- plugins/paintops/libpaintop/kis_custom_brush_widget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/paintops/libpaintop/kis_custom_brush_widget.cpp b/plugins/paintops/libpaintop/kis_custom_brush_widget.cpp index 6f6b2a8002e..c8baa4092db 100644 --- a/plugins/paintops/libpaintop/kis_custom_brush_widget.cpp +++ b/plugins/paintops/libpaintop/kis_custom_brush_widget.cpp @@ -63,7 +63,7 @@ KisCustomBrushWidget::KisCustomBrushWidget(QWidget *parent, const QString& capti connect(this, SIGNAL(accepted()), SLOT(slotAddPredefined())); connect(brushStyle, SIGNAL(activated(int)), this, SLOT(slotUpdateCurrentBrush(int))); - connect(colorAsMask, SIGNAL(toggled(bool)), this, SLOT(slotUpdateUscColorAsMask(bool))); + connect(colorAsMask, SIGNAL(toggled(bool)), this, SLOT(slotUpdateUseColorAsMask(bool))); colorAsMask->setChecked(true); // use color as mask by default. This is by far the most common way to make tip. From dbbf67ef5d86bce2e231ea2f6d5ef3f66d9cade3 Mon Sep 17 00:00:00 2001 From: Boudewijn Rempt Date: Tue, 28 Feb 2017 14:48:23 +0100 Subject: [PATCH 18/42] Fix saving of settings Having a QSettings object open on kritarc for the duration of the application means it saves the settings it originally read on closing, overwriting anything kconfig could have written. --- krita/main.cc | 66 +++++++++++++++++++++++++++++---------------------- 1 file changed, 37 insertions(+), 29 deletions(-) diff --git a/krita/main.cc b/krita/main.cc index 19272bba759..3729e98e9f3 100644 --- a/krita/main.cc +++ b/krita/main.cc @@ -120,14 +120,17 @@ extern "C" int main(int argc, char **argv) QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true); const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation); - QSettings kritarc(configPath + QStringLiteral("/kritarc"), QSettings::IniFormat); + #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); + { + 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 @@ -148,30 +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. - 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"); @@ -262,7 +267,10 @@ extern "C" int main(int argc, char **argv) int state = app.exec(); - kritarc.setValue("canvasState", "OPENGL_SUCCESS"); + { + QSettings kritarc(configPath + QStringLiteral("/kritaopenglrc"), QSettings::IniFormat); + kritarc.setValue("canvasState", "OPENGL_SUCCESS"); + } return state; } From dbdf2f2a42b6db2a5d8415bbf9eb21a6a21a0da8 Mon Sep 17 00:00:00 2001 From: Boudewijn Rempt Date: Tue, 28 Feb 2017 15:22:06 +0100 Subject: [PATCH 19/42] BUG:376993 Don't crash when a file layer is deleted QFileSystemWatcher cannot be deleted in a different thread from where it was created. That did happen when a file layer was deleted after converting it to a paint layer when the undo command was pushed off the stack. This change creates a single static QFileSystemWatcher that all file layers connect to. fileChanged checks that the changed file is the right one before setting the fileChanged flag. --- libs/ui/kis_safe_document_loader.cpp | 27 ++++++++++++++++----------- libs/ui/kis_safe_document_loader.h | 3 +-- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/libs/ui/kis_safe_document_loader.cpp b/libs/ui/kis_safe_document_loader.cpp index 2c746a49ba6..335178de4e3 100644 --- a/libs/ui/kis_safe_document_loader.cpp +++ b/libs/ui/kis_safe_document_loader.cpp @@ -30,6 +30,8 @@ #include "kis_signal_compressor.h" #include "KisPart.h" +Q_GLOBAL_STATIC(QFileSystemWatcher, s_fileSystemWatcher) + struct KisSafeDocumentLoader::Private { Private() @@ -40,11 +42,10 @@ struct KisSafeDocumentLoader::Private } QScopedPointer doc; - QFileSystemWatcher fileWatcher; KisSignalCompressor fileChangedSignalCompressor; QTimer delayedLoadTimer; - bool isLoading; - bool fileChangedFlag; + bool isLoading {true}; + bool fileChangedFlag {false}; QString path; QString temporaryPath; @@ -56,10 +57,10 @@ KisSafeDocumentLoader::KisSafeDocumentLoader(const QString &path, QObject *paren : QObject(parent), m_d(new Private()) { - connect(&m_d->fileWatcher, SIGNAL(fileChanged(QString)), - SLOT(fileChanged())); + connect(s_fileSystemWatcher, SIGNAL(fileChanged(QString)), + SLOT(fileChanged(QString))); - connect(&m_d->fileWatcher, SIGNAL(fileChanged(QString)), + connect(s_fileSystemWatcher, SIGNAL(fileChanged(QString)), &m_d->fileChangedSignalCompressor, SLOT(start())); connect(&m_d->fileChangedSignalCompressor, SIGNAL(timeout()), @@ -76,6 +77,7 @@ KisSafeDocumentLoader::KisSafeDocumentLoader(const QString &path, QObject *paren KisSafeDocumentLoader::~KisSafeDocumentLoader() { + s_fileSystemWatcher->removePath(m_d->path); delete m_d; } @@ -84,11 +86,11 @@ void KisSafeDocumentLoader::setPath(const QString &path) if (path.isEmpty()) return; if (!m_d->path.isEmpty()) { - m_d->fileWatcher.removePath(m_d->path); + s_fileSystemWatcher->removePath(m_d->path); } m_d->path = path; - m_d->fileWatcher.addPath(m_d->path); + s_fileSystemWatcher->addPath(m_d->path); } void KisSafeDocumentLoader::reloadImage() @@ -96,9 +98,11 @@ void KisSafeDocumentLoader::reloadImage() fileChangedCompressed(true); } -void KisSafeDocumentLoader::fileChanged() +void KisSafeDocumentLoader::fileChanged(QString path) { - m_d->fileChangedFlag = true; + if (path == m_d->path) { + m_d->fileChangedFlag = true; + } } void KisSafeDocumentLoader::fileChangedCompressed(bool sync) @@ -164,7 +168,8 @@ void KisSafeDocumentLoader::delayedLoadStart() if (!successfullyLoaded) { // Restart the attempt m_d->fileChangedSignalCompressor.start(); - } else { + } + else { KisPaintDeviceSP paintDevice = new KisPaintDevice(m_d->doc->image()->colorSpace()); KisPaintDeviceSP projection = m_d->doc->image()->projection(); paintDevice->makeCloneFrom(projection, projection->extent()); diff --git a/libs/ui/kis_safe_document_loader.h b/libs/ui/kis_safe_document_loader.h index 5a0ee3de3ee..9d93082ad43 100644 --- a/libs/ui/kis_safe_document_loader.h +++ b/libs/ui/kis_safe_document_loader.h @@ -34,9 +34,8 @@ class KisSafeDocumentLoader : public QObject public: void setPath(const QString &path); void reloadImage(); - private Q_SLOTS: - void fileChanged(); + void fileChanged(QString); void fileChangedCompressed(bool sync = false); void delayedLoadStart(); From a8d5383d5b31fc04f7b4bdc6fc49a40f7c6773bd Mon Sep 17 00:00:00 2001 From: Boudewijn Rempt Date: Wed, 1 Mar 2017 10:21:16 +0100 Subject: [PATCH 20/42] Add the dtd for the document-info file. Weirdly enough, our code still says it should be hosted on the calligra.org website, but it isn't. --- krita/dtd/document-info.dtd | 80 +++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 krita/dtd/document-info.dtd diff --git a/krita/dtd/document-info.dtd b/krita/dtd/document-info.dtd new file mode 100644 index 00000000000..783ee05423b --- /dev/null +++ b/krita/dtd/document-info.dtd @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From b69c194901f915917d6e2be5786ffd6d45fe9cab Mon Sep 17 00:00:00 2001 From: Boudewijn Rempt Date: Wed, 1 Mar 2017 15:52:31 +0100 Subject: [PATCH 21/42] Convert floating point channel depths to 8 bit integer when saving PNG As per warning. This also fixes: BUG: 375217 --- libs/ui/kis_png_converter.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libs/ui/kis_png_converter.cpp b/libs/ui/kis_png_converter.cpp index 4a4975281bc..726d0a6f022 100644 --- a/libs/ui/kis_png_converter.cpp +++ b/libs/ui/kis_png_converter.cpp @@ -911,6 +911,17 @@ KisImageBuilder_Result KisPNGConverter::buildFile(QIODevice* iodevice, const QRe device = tmp; } + if (device->colorSpace()->colorDepthId() == Float16BitsColorDepthID + || device->colorSpace()->colorDepthId() == Float32BitsColorDepthID + || device->colorSpace()->colorDepthId() == Float64BitsColorDepthID) { + const KoColorSpace *dstcs = KoColorSpaceRegistry::instance()->colorSpace(device->colorSpace()->colorModelId().id(), Integer8BitsColorDepthID.id(), ""); + KisPaintDeviceSP tmp = new KisPaintDevice(dstcs); + KisPainter gc(tmp); + gc.bitBlt(imageRect.topLeft(), device, imageRect); + gc.end(); + device = tmp; + } + if (options.forceSRGB) { const KoColorSpace* cs = KoColorSpaceRegistry::instance()->colorSpace(RGBAColorModelID.id(), device->colorSpace()->colorDepthId().id(), "sRGB built-in - (lcms internal)"); device = new KisPaintDevice(*device); From 540dc93b4b73c2adde58e0bdf389c5448df7f3ab Mon Sep 17 00:00:00 2001 From: Boudewijn Rempt Date: Thu, 2 Mar 2017 11:43:50 +0100 Subject: [PATCH 22/42] Inherit from 3.2 core instead of 3.0 This is a problem: OSX needs 3.2 core, the rest 3.0. If we... Try to #ifdef the inheritance, Moc gets awfully confused: In file included from /Users/boud/master/build/libs/ui/kritaui_automoc.cpp:142: /Users/boud/master/build/libs/ui/moc_kis_opengl_canvas2.cpp:94:29: error: unknown type name 'QOpenGLFunctions_3_0'; did you mean 'QOpenGLFunctions'? return static_cast< QOpenGLFunctions_3_0*>(const_cast< KisOpenGLCanvas2*>(this)); ^~~~~~~~~~~~~~~~~~~~ QOpenGLFunctions /Users/boud/master/krita/libs/ui/opengl/kis_opengl_image_textures.h:34:7: note: 'QOpenGLFunctions' declared here class QOpenGLFunctions; ^ In file included from /Users/boud/master/build/libs/ui/kritaui_automoc.cpp:142: /Users/boud/master/build/libs/ui/moc_kis_opengl_canvas2.cpp:94:16: error: static_cast from 'KisOpenGLCanvas2 *' to 'QOpenGLFunctions *', which are not related by inheritance, is not allowed return static_cast< QOpenGLFunctions_3_0*>(const_cast< KisOpenGLCanvas2*>(this)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 errors generated. make[2]: *** [libs/ui/CMakeFiles/kritaui.dir/kritaui_automoc.cpp.o] Error 1 --- libs/ui/opengl/kis_opengl_canvas2.h | 10 +++++----- libs/ui/opengl/kis_opengl_image_textures.h | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/libs/ui/opengl/kis_opengl_canvas2.h b/libs/ui/opengl/kis_opengl_canvas2.h index dd7939f5a42..614f88e9429 100644 --- a/libs/ui/opengl/kis_opengl_canvas2.h +++ b/libs/ui/opengl/kis_opengl_canvas2.h @@ -21,8 +21,7 @@ #define KIS_OPENGL_CANVAS_2_H #include -#include - +#include #include "canvas/kis_canvas_widget_base.h" #include "opengl/kis_opengl_image_textures.h" @@ -42,9 +41,10 @@ class QPainterPath; * in the qpainter canvas. * */ -class KRITAUI_EXPORT KisOpenGLCanvas2 : public QOpenGLWidget, protected QOpenGLFunctions_3_0, public KisCanvasWidgetBase -{ - +class KRITAUI_EXPORT KisOpenGLCanvas2 : public QOpenGLWidget + , public KisCanvasWidgetBase + , protected QOpenGLFunctions_3_2_Core + { Q_OBJECT public: diff --git a/libs/ui/opengl/kis_opengl_image_textures.h b/libs/ui/opengl/kis_opengl_image_textures.h index 55f48458ef2..f54c74c84c6 100644 --- a/libs/ui/opengl/kis_opengl_image_textures.h +++ b/libs/ui/opengl/kis_opengl_image_textures.h @@ -20,6 +20,7 @@ #include #include +#include #include "kritaui_export.h" @@ -31,7 +32,7 @@ #include class KisOpenGLImageTextures; -class QOpenGLFunctions; + typedef KisSharedPtr KisOpenGLImageTexturesSP; class KoColorProfile; From 171bd64a55773afdfe21b7902bff18e4faedff0d Mon Sep 17 00:00:00 2001 From: Boudewijn Rempt Date: Fri, 3 Mar 2017 11:24:02 +0100 Subject: [PATCH 23/42] BUG:346014 Use the same value for the shade selector as in the default kritarc --- .../kis_color_selector_container.cpp | 2 +- .../kis_color_selector_settings.cpp | 26 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/plugins/dockers/advancedcolorselector/kis_color_selector_container.cpp b/plugins/dockers/advancedcolorselector/kis_color_selector_container.cpp index f1eb9fc0743..8d8a57e00e5 100644 --- a/plugins/dockers/advancedcolorselector/kis_color_selector_container.cpp +++ b/plugins/dockers/advancedcolorselector/kis_color_selector_container.cpp @@ -121,7 +121,7 @@ void KisColorSelectorContainer::updateSettings() KConfigGroup cfg = KSharedConfig::openConfig()->group("advancedColorSelector"); m_onDockerResizeSetting = (int)cfg.readEntry("onDockerResize", 0); - QString type = cfg.readEntry("shadeSelectorType", "MyPaint"); + QString type = cfg.readEntry("shadeSelectorType", "Minimal"); QWidget* newShadeSelector; if(type=="MyPaint") diff --git a/plugins/dockers/advancedcolorselector/kis_color_selector_settings.cpp b/plugins/dockers/advancedcolorselector/kis_color_selector_settings.cpp index e1458d2c921..e5f0e1f4d89 100644 --- a/plugins/dockers/advancedcolorselector/kis_color_selector_settings.cpp +++ b/plugins/dockers/advancedcolorselector/kis_color_selector_settings.cpp @@ -219,7 +219,7 @@ void KisColorSelectorSettings::savePreferences() const cfg.writeEntry("shadeSelectorUpdateOnLeftClick", ui->shadeSelectorUpdateOnLeftClick->isChecked()); cfg.writeEntry("shadeSelectorUpdateOnBackground", ui->shadeSelectorUpdateOnBackground->isChecked()); cfg.writeEntry("hidePopupOnClickCheck", ui->hidePopupOnClickCheck->isChecked()); - + //mypaint model int shadeMyPaintComboBoxIndex = ui->ACSshadeSelectorMyPaintColorModelComboBox->currentIndex(); @@ -243,15 +243,15 @@ void KisColorSelectorSettings::savePreferences() const //color selector KisColorSelectorComboBox* cstw = dynamic_cast(ui->colorSelectorConfiguration); cfg.writeEntry("colorSelectorConfiguration", cstw->configuration().toString()); - + cfg.writeEntry("hsxSettingType", ui->colorSelectorTypeComboBox->currentIndex()); - + //luma// cfg.writeEntry("lumaR", ui->l_lumaR->value()); cfg.writeEntry("lumaG", ui->l_lumaG->value()); cfg.writeEntry("lumaB", ui->l_lumaB->value()); cfg.writeEntry("gamma", ui->SP_Gamma->value()); - + //slider// hsxcfg.writeEntry("hsvH", ui->csl_hsvH->isChecked()); hsxcfg.writeEntry("hsvS", ui->csl_hsvS->isChecked()); @@ -305,7 +305,7 @@ void KisColorSelectorSettings::changedColorDocker(int index) ui->advancedColorSelectorOptions->hide(); ui->hotKeyOptions->hide(); ui->colorSliderOptions->show(); - } else { + } else { ui->colorSliderOptions->hide(); ui->advancedColorSelectorOptions->hide(); ui->hotKeyOptions->show(); @@ -443,7 +443,7 @@ void KisColorSelectorSettings::loadPreferences() ui->commonColorsAutoUpdate->setChecked(cfg.readEntry("commonColorsAutoUpdate", false)); //shade selector - QString shadeSelectorType=cfg.readEntry("shadeSelectorType", "MyPaint"); + QString shadeSelectorType=cfg.readEntry("shadeSelectorType", "Minimal"); if ( shadeSelectorType == "MyPaint") { ui->ACSShadeSelectorTypeComboBox->setCurrentIndex(0); @@ -487,13 +487,13 @@ void KisColorSelectorSettings::loadPreferences() //color selector KisColorSelectorComboBox* cstw = dynamic_cast(ui->colorSelectorConfiguration); cstw->setConfiguration(KisColorSelectorConfiguration::fromString(cfg.readEntry("colorSelectorConfiguration", "3|0|5|0"))); // triangle selector - + //luma values// ui->l_lumaR->setValue(cfg.readEntry("lumaR", 0.2126)); ui->l_lumaG->setValue(cfg.readEntry("lumaG", 0.7152)); ui->l_lumaB->setValue(cfg.readEntry("lumaB", 0.0722)); ui->SP_Gamma->setValue(cfg.readEntry("gamma", 2.2)); - + //color sliders// ui->csl_hsvH->setChecked(hsxcfg.readEntry("hsvH", false)); ui->csl_hsvS->setChecked(hsxcfg.readEntry("hsvS", false)); @@ -515,7 +515,7 @@ void KisColorSelectorSettings::loadPreferences() ui->sb_rg->setValue(hotkeycfg.readEntry("steps_redgreen", 10)); ui->sb_by->setValue(hotkeycfg.readEntry("steps_blueyellow", 10)); - + } void KisColorSelectorSettings::loadDefaultPreferences() @@ -557,7 +557,7 @@ void KisColorSelectorSettings::loadDefaultPreferences() ui->commonColorsAutoUpdate->setChecked(false); //shade selector - ui->ACSShadeSelectorTypeComboBox->setCurrentIndex(0); // MyPaint + ui->ACSShadeSelectorTypeComboBox->setCurrentIndex(1); // Minimal ui->ACSshadeSelectorMyPaintColorModelComboBox->setCurrentIndex(0); @@ -576,16 +576,16 @@ void KisColorSelectorSettings::loadDefaultPreferences() // set advanced color selector to use HSV ui->colorSelectorTypeComboBox->setCurrentIndex(0); - + KisColorSelectorComboBox* cstw = dynamic_cast(ui->colorSelectorConfiguration); cstw->setConfiguration(KisColorSelectorConfiguration("3|0|5|0")); // triangle selector - + //luma// ui->l_lumaR->setValue(0.2126); ui->l_lumaG->setValue(0.7152); ui->l_lumaB->setValue(0.0722); ui->SP_Gamma->setValue(2.2); - + //color sliders// ui->csl_hsvH->setChecked(false); ui->csl_hsvS->setChecked(false); From ddeee5850af5494fb575898e0e0e1e7e96767046 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jouni=20Pentik=C3=A4inen?= Date: Fri, 3 Mar 2017 20:31:09 +0200 Subject: [PATCH 24/42] Use copy constructors when duplicating keyframes This helps to ensure that all related data (such as color label) will be copied. BUG:376553 --- libs/image/kis_raster_keyframe_channel.cpp | 19 +++++++++++++++---- libs/image/kis_scalar_keyframe_channel.cpp | 11 +++++++++-- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/libs/image/kis_raster_keyframe_channel.cpp b/libs/image/kis_raster_keyframe_channel.cpp index bacf6cfe4b9..3b8d7c63823 100644 --- a/libs/image/kis_raster_keyframe_channel.cpp +++ b/libs/image/kis_raster_keyframe_channel.cpp @@ -150,13 +150,24 @@ QString KisRasterKeyframeChannel::chooseFrameFilename(int frameId, const QString KisKeyframeSP KisRasterKeyframeChannel::createKeyframe(int time, const KisKeyframeSP copySrc, KUndo2Command *parentCommand) { - int srcFrame = (copySrc != 0) ? frameId(copySrc) : 0; + KisRasterKeyframe *keyframe; - int frameId = m_d->paintDevice->framesInterface()->createFrame((copySrc != 0), srcFrame, QPoint(), parentCommand); + if (!copySrc) { + int frameId = m_d->paintDevice->framesInterface()->createFrame(false, 0, QPoint(), parentCommand); + keyframe = new KisRasterKeyframe(this, time, frameId); + } else { + int srcFrame = frameId(copySrc); + int frameId = m_d->paintDevice->framesInterface()->createFrame(true, srcFrame, QPoint(), parentCommand); - KisKeyframeSP keyframe(new KisRasterKeyframe(this, time, frameId)); + KisRasterKeyframe *srcKeyframe = dynamic_cast(copySrc.data()); + Q_ASSERT(srcKeyframe); + keyframe = new KisRasterKeyframe(srcKeyframe, this); - return keyframe; + keyframe->setTime(time); + keyframe->frameId = frameId; + } + + return toQShared(keyframe); } void KisRasterKeyframeChannel::destroyKeyframe(KisKeyframeSP key, KUndo2Command *parentCommand) diff --git a/libs/image/kis_scalar_keyframe_channel.cpp b/libs/image/kis_scalar_keyframe_channel.cpp index f00ba5741d2..00d6c912a52 100644 --- a/libs/image/kis_scalar_keyframe_channel.cpp +++ b/libs/image/kis_scalar_keyframe_channel.cpp @@ -358,8 +358,15 @@ qreal KisScalarKeyframeChannel::currentValue() const KisKeyframeSP KisScalarKeyframeChannel::createKeyframe(int time, const KisKeyframeSP copySrc, KUndo2Command *parentCommand) { - qreal value = (copySrc.isNull() ? 0 : scalarValue(copySrc)); - return createKeyframe(time, value, parentCommand); + if (copySrc) { + KisScalarKeyframe *srcKeyframe = dynamic_cast(copySrc.data()); + Q_ASSERT(srcKeyframe); + KisScalarKeyframe *keyframe = new KisScalarKeyframe(srcKeyframe, this); + keyframe->setTime(time); + return toQShared(keyframe); + } else { + return createKeyframe(time, 0, parentCommand); + } } KisKeyframeSP KisScalarKeyframeChannel::createKeyframe(int time, qreal value, KUndo2Command *parentCommand) From 87cdf0efb5f49156a94cdafa3717cb1e4dc03a82 Mon Sep 17 00:00:00 2001 From: Dmitry Kazakov Date: Sat, 4 Mar 2017 18:11:29 +0300 Subject: [PATCH 25/42] Add dox to KisCustomModifiersCatcher --- .../animation/kis_custom_modifiers_catcher.h | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/plugins/dockers/animation/kis_custom_modifiers_catcher.h b/plugins/dockers/animation/kis_custom_modifiers_catcher.h index 9b63d449510..03e3538ecae 100644 --- a/plugins/dockers/animation/kis_custom_modifiers_catcher.h +++ b/plugins/dockers/animation/kis_custom_modifiers_catcher.h @@ -22,16 +22,48 @@ #include #include +/** + * @brief The KisCustomModifiersCatcher class is a special utility class that + * tracks custom modifiers pressed. Its main purpose is to avoid manual tracking + * of KeyPress/KeyRelease/FocusIn events in the class and reuse the common code in + * multiple widgets. + * + * ~~~~~~~~~~~~~~~~~~~~{.cpp} + * // in the c-tor of your widget create the catcher, it will automatically + * // connect to the passed parent + * KisCustomModifiersCatcher *catcher = new KisCustomModifiersCatcher(parent); + * + * // Register a tracked modifier + * catcher->addModifier("pan-zoom", Qt::Key_Space); + * + * // in the pointer tracking event handlers just check + * // if the modifier is pressed or not + * bool isPressed = catcher->modifierPressed("pan-zoom"); + * ~~~~~~~~~~~~~~~~~~~~ + */ class KisCustomModifiersCatcher : public QObject { public: + /** + * Create the catcher and connect to the passed widget/object to + * track its key events + */ KisCustomModifiersCatcher(QObject *parent); ~KisCustomModifiersCatcher(); bool eventFilter(QObject* object, QEvent* event); + /** + * @brief addModifier registers a custom modifier + * @param id a unique id string associated with the modifier. Later, you will use this string to fetch the modifier state. + * @param modifier the key to track + */ void addModifier(const QString &id, Qt::Key modifier); + + /** + * @brief modifierPressed returns the state of the tracked modifier + */ bool modifierPressed(const QString &id); private: From cc54555a624c4a9c3d6e20330a9cf72f1f601e84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jouni=20Pentik=C3=A4inen?= Date: Sun, 5 Mar 2017 15:50:14 +0200 Subject: [PATCH 26/42] Fix saving animations Cast into KisRasterKeyframeChannel in KisRasterKeyframe::cloneFor failed as it is called from KisKeyframeChannel constructor. (Even though the channel will be a raster channel) --- libs/image/kis_raster_keyframe_channel.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libs/image/kis_raster_keyframe_channel.cpp b/libs/image/kis_raster_keyframe_channel.cpp index 3b8d7c63823..2c18f15de18 100644 --- a/libs/image/kis_raster_keyframe_channel.cpp +++ b/libs/image/kis_raster_keyframe_channel.cpp @@ -33,7 +33,7 @@ struct KisRasterKeyframe : public KisKeyframe , frameId(frameId) {} - KisRasterKeyframe(const KisRasterKeyframe *rhs, KisRasterKeyframeChannel *channel) + KisRasterKeyframe(const KisRasterKeyframe *rhs, KisKeyframeChannel *channel) : KisKeyframe(rhs, channel) , frameId(rhs->frameId) {} @@ -42,9 +42,7 @@ struct KisRasterKeyframe : public KisKeyframe KisKeyframeSP cloneFor(KisKeyframeChannel *channel) const { - KisRasterKeyframeChannel *rasterChannel = dynamic_cast(channel); - Q_ASSERT(rasterChannel); - return toQShared(new KisRasterKeyframe(this, rasterChannel)); + return toQShared(new KisRasterKeyframe(this, channel)); } }; From b634994e43cebdcc6d394e91e49104f1fffd9e50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jouni=20Pentik=C3=A4inen?= Date: Sun, 5 Mar 2017 16:06:17 +0200 Subject: [PATCH 27/42] Fix rendering a sequence of one animation frame --- libs/ui/kis_animation_exporter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/ui/kis_animation_exporter.cpp b/libs/ui/kis_animation_exporter.cpp index 3d536e0cda3..bf35d690c40 100644 --- a/libs/ui/kis_animation_exporter.cpp +++ b/libs/ui/kis_animation_exporter.cpp @@ -210,8 +210,8 @@ void KisAnimationExporter::frameReadyToSave() result = m_d->saveFrameCallback(time, m_d->tmpDevice, m_d->exportConfiguration); if (!m_d->batchMode) { - emit m_d->document->sigProgress((time - m_d->firstFrame) * 100 / - (m_d->lastFrame - m_d->firstFrame)); + int length = m_d->lastFrame - m_d->firstFrame + 1; + emit m_d->document->sigProgress((time - m_d->firstFrame) * 100 / length); } qDebug() << result << time << m_d->lastFrame; From 028b03728a1a1d27acb07d4f899624029910f910 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jouni=20Pentik=C3=A4inen?= Date: Sun, 5 Mar 2017 16:17:36 +0200 Subject: [PATCH 28/42] Remove failing, unnecessary assert --- libs/ui/KisImportExportFilter.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/libs/ui/KisImportExportFilter.cpp b/libs/ui/KisImportExportFilter.cpp index dd4f62d995d..58cac657db2 100644 --- a/libs/ui/KisImportExportFilter.cpp +++ b/libs/ui/KisImportExportFilter.cpp @@ -63,7 +63,6 @@ KisImportExportFilter::KisImportExportFilter(QObject *parent) KisImportExportFilter::~KisImportExportFilter() { - Q_ASSERT(d->updater); if (d->updater) { d->updater->setProgress(100); } From 1a35c0b0ef0a079a5d99fa4d1fa89fd299d261ee Mon Sep 17 00:00:00 2001 From: Dmitry Kazakov Date: Mon, 6 Mar 2017 13:36:04 +0300 Subject: [PATCH 29/42] Revert "Proper change of color space and profile for image through "Image properties" dialog" This reverts commit 4763f5e524c0cc08f38dae4b1a89d28a2649a985. This commit breaks usual conversion of color spaces. See bug: https://bugs.kde.org/show_bug.cgi?id=377267 BUG:377267 Ref D4328 --- .../commands/kis_image_set_projection_color_space_command.cpp | 1 - libs/image/kis_image.cc | 1 - 2 files changed, 2 deletions(-) diff --git a/libs/image/commands/kis_image_set_projection_color_space_command.cpp b/libs/image/commands/kis_image_set_projection_color_space_command.cpp index 3eb9b8dfd7d..e4d2a3293fc 100644 --- a/libs/image/commands/kis_image_set_projection_color_space_command.cpp +++ b/libs/image/commands/kis_image_set_projection_color_space_command.cpp @@ -32,7 +32,6 @@ KisImageSetProjectionColorSpaceCommand::KisImageSetProjectionColorSpaceCommand(K if (imageSP) { m_beforeColorSpace = imageSP->colorSpace(); m_afterColorSpace = afterColorSpace; - imageSP->setProjectionColorSpace(m_afterColorSpace); } } diff --git a/libs/image/kis_image.cc b/libs/image/kis_image.cc index b6f98865702..cc422bb0818 100644 --- a/libs/image/kis_image.cc +++ b/libs/image/kis_image.cc @@ -885,7 +885,6 @@ void KisImage::convertProjectionColorSpace(const KoColorSpace *dstColorSpace) void KisImage::setProjectionColorSpace(const KoColorSpace * colorSpace) { m_d->colorSpace = colorSpace; - assignImageProfile(colorSpace->profile()); m_d->rootLayer->resetCache(); m_d->signalRouter.emitNotification(ColorSpaceChangedSignal); } From d0076801a792e1bffc6216ab11385094807fdcc8 Mon Sep 17 00:00:00 2001 From: l10n daemon script Date: Wed, 8 Mar 2017 05:56:03 +0100 Subject: [PATCH 30/42] SVN_SILENT made messages (.desktop file) - always resolve ours In case of conflict in i18n, keep the version of the branch "ours" To resolve a particular conflict, "git checkout --ours path/to/file.desktop" --- krita/data/templates/animation/.directory | 1 + 1 file changed, 1 insertion(+) diff --git a/krita/data/templates/animation/.directory b/krita/data/templates/animation/.directory index e97c8024d7e..2faab82dfca 100644 --- a/krita/data/templates/animation/.directory +++ b/krita/data/templates/animation/.directory @@ -4,6 +4,7 @@ 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 From 01c3ca180bff5029da42591d3fa3fb98f0006239 Mon Sep 17 00:00:00 2001 From: Boudewijn Rempt Date: Sat, 11 Mar 2017 13:33:20 +0100 Subject: [PATCH 31/42] Fix build error on Windows --- libs/ui/opengl/kis_opengl.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/libs/ui/opengl/kis_opengl.cpp b/libs/ui/opengl/kis_opengl.cpp index 9932779cb64..b73e26f64de 100644 --- a/libs/ui/opengl/kis_opengl.cpp +++ b/libs/ui/opengl/kis_opengl.cpp @@ -154,7 +154,6 @@ void KisOpenGL::initializeContext(QOpenGLContext *ctx) * Warn about Intel's broken video drivers */ #if defined Q_OS_WIN - KisConfig cfg; QString renderer = KisOpenGL::renderer(); if (cfg.useOpenGL() && renderer.startsWith("Intel") && !cfg.readEntry("WarnedAboutIntel", false)) { QMessageBox::information(0, From 2dd11968aea517ff1766f452d1708312dc8f1c63 Mon Sep 17 00:00:00 2001 From: Boudewijn Rempt Date: Sat, 11 Mar 2017 15:11:05 +0100 Subject: [PATCH 32/42] Fix windows build --- libs/ui/opengl/kis_opengl.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libs/ui/opengl/kis_opengl.cpp b/libs/ui/opengl/kis_opengl.cpp index b73e26f64de..8819ee25d75 100644 --- a/libs/ui/opengl/kis_opengl.cpp +++ b/libs/ui/opengl/kis_opengl.cpp @@ -154,8 +154,7 @@ void KisOpenGL::initializeContext(QOpenGLContext *ctx) * Warn about Intel's broken video drivers */ #if defined Q_OS_WIN - QString renderer = KisOpenGL::renderer(); - if (cfg.useOpenGL() && renderer.startsWith("Intel") && !cfg.readEntry("WarnedAboutIntel", false)) { + if (cfg.useOpenGL() && Renderer.startsWith("Intel") && !cfg.readEntry("WarnedAboutIntel", false)) { QMessageBox::information(0, i18nc("@title:window", "Krita: Warning"), i18n("You have an Intel(R) HD Graphics video adapter.\n" From 98a0c786310fdfcda488405a6ad098d6e8169120 Mon Sep 17 00:00:00 2001 From: Boudewijn Rempt Date: Mon, 13 Mar 2017 11:01:23 +0100 Subject: [PATCH 33/42] Revert "Make the erase mode button follow the blending mode combobox" This broke flipping the stylus. BUG:375878 CCBUG:348290 This reverts commit f1968fd7f55cda3a08aa0488a3b72d186db565e8. --- libs/ui/kis_paintop_box.cc | 6 ------ 1 file changed, 6 deletions(-) diff --git a/libs/ui/kis_paintop_box.cc b/libs/ui/kis_paintop_box.cc index 5aff453d397..fae410d44d3 100644 --- a/libs/ui/kis_paintop_box.cc +++ b/libs/ui/kis_paintop_box.cc @@ -703,12 +703,6 @@ void KisPaintopBox::updateCompositeOp(QString compositeOpID) if (compositeOpID != m_currCompositeOpID) { m_currCompositeOpID = compositeOpID; } - if (compositeOpID == COMPOSITE_ERASE) { - m_eraseModeButton->setChecked(true); - } - else { - m_eraseModeButton->setChecked(false); - } } } From 8679229b666327b0dab2377452ff614084ca5364 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Fazekas?= Date: Mon, 13 Mar 2017 12:11:55 +0100 Subject: [PATCH 34/42] bug 375878 - Eraser will not switch back to brush after turning Wacom pen back around Additional correction to solve this bug --- libs/ui/kis_paintop_box.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libs/ui/kis_paintop_box.cc b/libs/ui/kis_paintop_box.cc index fae410d44d3..6982cc00bce 100644 --- a/libs/ui/kis_paintop_box.cc +++ b/libs/ui/kis_paintop_box.cc @@ -583,7 +583,10 @@ void KisPaintopBox::setCurrentPaintop(KisPaintOpPresetSP preset) //qDebug() << "setCurrentPaintop(); " << preset->name(); if (preset == m_resourceProvider->currentPreset()) { - return; + + if (preset == m_tabletToolMap[m_currTabletToolID].preset) { + return; + } } Q_ASSERT(preset); const KoID& paintop = preset->paintOp(); @@ -754,6 +757,8 @@ void KisPaintopBox::slotInputDeviceChanged(const KoInputDevice& inputDevice) //qDebug() << "slotInputDeviceChanged()" << inputDevice.device() << inputDevice.uniqueTabletId(); + m_currTabletToolID = TabletToolID(inputDevice); + if (toolData == m_tabletToolMap.end()) { KisConfig cfg; KisPaintOpPresetResourceServer *rserver = KisResourceServerProvider::instance()->paintOpPresetServer(false); @@ -786,8 +791,6 @@ void KisPaintopBox::slotInputDeviceChanged(const KoInputDevice& inputDevice) setCurrentPaintop(toolData->paintOpID); } } - - m_currTabletToolID = TabletToolID(inputDevice); } void KisPaintopBox::slotCanvasResourceChanged(int key, const QVariant &value) From 7ae439583e360fb945e7c279e8ccdf823d21ed2b Mon Sep 17 00:00:00 2001 From: Boudewijn Rempt Date: Mon, 13 Mar 2017 13:53:30 +0100 Subject: [PATCH 35/42] Revert "Revert "Make the erase mode button follow the blending mode combobox"" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This was already fixed by László Fazekas, and I hadn't seen that... This reverts commit 98a0c786310fdfcda488405a6ad098d6e8169120. --- libs/ui/kis_paintop_box.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libs/ui/kis_paintop_box.cc b/libs/ui/kis_paintop_box.cc index 6982cc00bce..e7431a55ff2 100644 --- a/libs/ui/kis_paintop_box.cc +++ b/libs/ui/kis_paintop_box.cc @@ -706,6 +706,12 @@ void KisPaintopBox::updateCompositeOp(QString compositeOpID) if (compositeOpID != m_currCompositeOpID) { m_currCompositeOpID = compositeOpID; } + if (compositeOpID == COMPOSITE_ERASE) { + m_eraseModeButton->setChecked(true); + } + else { + m_eraseModeButton->setChecked(false); + } } } From 8239ee5267282062bcb7a9fb0f2587270ed9f2ef Mon Sep 17 00:00:00 2001 From: Boudewijn Rempt Date: Mon, 13 Mar 2017 17:06:32 +0100 Subject: [PATCH 36/42] Better way to force the 3.2 core functions for OSX --- libs/ui/opengl/kis_opengl_canvas2.h | 19 +++++++++++++++++++ plugins/dockers/lut/ocio_display_filter.cpp | 4 ++++ 2 files changed, 23 insertions(+) diff --git a/libs/ui/opengl/kis_opengl_canvas2.h b/libs/ui/opengl/kis_opengl_canvas2.h index 614f88e9429..dc4062cf920 100644 --- a/libs/ui/opengl/kis_opengl_canvas2.h +++ b/libs/ui/opengl/kis_opengl_canvas2.h @@ -21,6 +21,7 @@ #define KIS_OPENGL_CANVAS_2_H #include +#include #include #include "canvas/kis_canvas_widget_base.h" #include "opengl/kis_opengl_image_textures.h" @@ -33,7 +34,14 @@ class KisDisplayColorConverter; class QOpenGLShaderProgram; class QPainterPath; +#ifndef Q_MOC_RUN +#ifndef Q_OS_MAC +#define GLFunctions QOpenGLFunctions_3_0 +#else +#define GLFunctions QOpenGLFunctions_3_2_Core +#endif +#endif /** * KisOpenGLCanvas is the widget that shows the actual image using OpenGL * @@ -41,10 +49,21 @@ class QPainterPath; * in the qpainter canvas. * */ +<<<<<<< HEAD class KRITAUI_EXPORT KisOpenGLCanvas2 : public QOpenGLWidget , public KisCanvasWidgetBase , protected QOpenGLFunctions_3_2_Core { +======= +class KRITAUI_EXPORT KisOpenGLCanvas2 + : public QOpenGLWidget +#ifndef Q_MOC_RUN + , protected GLFunctions +#endif + , public KisCanvasWidgetBase +{ + +>>>>>>> a257e33... Better way to force the 3.2 core functions for OSX Q_OBJECT public: diff --git a/plugins/dockers/lut/ocio_display_filter.cpp b/plugins/dockers/lut/ocio_display_filter.cpp index 3a621896e8d..87339c4ee47 100644 --- a/plugins/dockers/lut/ocio_display_filter.cpp +++ b/plugins/dockers/lut/ocio_display_filter.cpp @@ -273,7 +273,11 @@ void OcioDisplayFilter::updateShader() } // XXX This option can be removed once we move to Qt 5.7+ else if (KisOpenGL::supportsLoD()) { +#ifdef Q_OS_MAC + QOpenGLFunctions_3_2_Core *f = QOpenGLContext::currentContext()->versionFunctions(); +#else QOpenGLFunctions_3_0 *f = QOpenGLContext::currentContext()->versionFunctions(); +#endif updateShaderImpl(f); } else { QOpenGLFunctions_2_0 *f = QOpenGLContext::currentContext()->versionFunctions(); From c381128ab3f55831e43be3955ce24d6dd17aefe1 Mon Sep 17 00:00:00 2001 From: Nicholas LaPointe Date: Mon, 13 Mar 2017 12:23:01 -0400 Subject: [PATCH 37/42] Fix build --- libs/ui/opengl/kis_opengl_canvas2.h | 8 -------- 1 file changed, 8 deletions(-) diff --git a/libs/ui/opengl/kis_opengl_canvas2.h b/libs/ui/opengl/kis_opengl_canvas2.h index dc4062cf920..283162d6189 100644 --- a/libs/ui/opengl/kis_opengl_canvas2.h +++ b/libs/ui/opengl/kis_opengl_canvas2.h @@ -49,12 +49,6 @@ class QPainterPath; * in the qpainter canvas. * */ -<<<<<<< HEAD -class KRITAUI_EXPORT KisOpenGLCanvas2 : public QOpenGLWidget - , public KisCanvasWidgetBase - , protected QOpenGLFunctions_3_2_Core - { -======= class KRITAUI_EXPORT KisOpenGLCanvas2 : public QOpenGLWidget #ifndef Q_MOC_RUN @@ -62,8 +56,6 @@ class KRITAUI_EXPORT KisOpenGLCanvas2 #endif , public KisCanvasWidgetBase { - ->>>>>>> a257e33... Better way to force the 3.2 core functions for OSX Q_OBJECT public: From 8fdf39f6957c3484c9751000ed3693901d7b309b Mon Sep 17 00:00:00 2001 From: Boudewijn Rempt Date: Tue, 14 Mar 2017 09:47:31 +0100 Subject: [PATCH 38/42] Disable copying the image before saving The copy is incomplete, the copy doesn't copy the projection so we need to re-render the image, which makes saving very slow, and we're not saving in the background at this moment, so the copy isn't useful. Note: I have intentionally left the code intact, and added a warning. Saving in the background is still todo. CCBUG:375585, 374345 --- libs/ui/KisDocument.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/libs/ui/KisDocument.cpp b/libs/ui/KisDocument.cpp index f54e28b5bd8..3840916af6f 100644 --- a/libs/ui/KisDocument.cpp +++ b/libs/ui/KisDocument.cpp @@ -1672,11 +1672,15 @@ bool KisDocument::isAutosaving() const bool KisDocument::prepareLocksForSaving() { KisImageSP copiedImage; - + // XXX: Restore this when + // a) cloning works correctly and + // b) doesn't take ages because it needs to refresh its entire graph and finally, + // c) we do use the saving image to save in the background. { Private::SafeSavingLocker locker(d, this); if (locker.successfullyLocked()) { - copiedImage = d->image->clone(true); + + copiedImage = d->image; //->clone(true); } else if (!isAutosaving()) { // even though it is a recovery operation, we should ensure we do not enter saving twice! @@ -1685,8 +1689,8 @@ bool KisDocument::prepareLocksForSaving() if (l.owns_lock()) { d->lastErrorMessage = i18n("The image was still busy while saving. Your saved image might be incomplete."); d->image->lock(); - copiedImage = d->image->clone(true); - copiedImage->initialRefreshGraph(); + copiedImage = d->image; //->clone(true); + //copiedImage->initialRefreshGraph(); d->image->unlock(); } } From e5e91334e289149f38c03a4b10cc2dc8c3cc79bd Mon Sep 17 00:00:00 2001 From: Boudewijn Rempt Date: Tue, 14 Mar 2017 10:11:57 +0100 Subject: [PATCH 39/42] Fine-tune the default setttings for Liquify. Thanks to deevad for the hints. --- plugins/tools/tool_transform2/kis_liquify_properties.h | 4 ++-- .../tool_transform2/kis_tool_transform_config_widget.cpp | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/plugins/tools/tool_transform2/kis_liquify_properties.h b/plugins/tools/tool_transform2/kis_liquify_properties.h index 734b8ffd4e3..aab45b2e13d 100644 --- a/plugins/tools/tool_transform2/kis_liquify_properties.h +++ b/plugins/tools/tool_transform2/kis_liquify_properties.h @@ -40,8 +40,8 @@ class KisLiquifyProperties : boost::equality_comparable KisLiquifyProperties() : m_mode(MOVE), - m_size(50), - m_amount(0.2), + m_size(60), + m_amount(0.05), m_spacing(0.2), m_sizeHasPressure(false), m_amountHasPressure(false), diff --git a/plugins/tools/tool_transform2/kis_tool_transform_config_widget.cpp b/plugins/tools/tool_transform2/kis_tool_transform_config_widget.cpp index 34b1e7cf1a9..96b1c930242 100644 --- a/plugins/tools/tool_transform2/kis_tool_transform_config_widget.cpp +++ b/plugins/tools/tool_transform2/kis_tool_transform_config_widget.cpp @@ -200,12 +200,12 @@ KisToolTransformConfigWidget::KisToolTransformConfigWidget(TransformTransactionP liquifySizeSlider->setRange(KisLiquifyProperties::minSize(), KisLiquifyProperties::maxSize(), 2); liquifySizeSlider->setExponentRatio(4); - liquifySizeSlider->setValue(50.0); + liquifySizeSlider->setValue(60.0); connect(liquifySizeSlider, SIGNAL(valueChanged(qreal)), this, SLOT(liquifySizeChanged(qreal))); liquifySizeSlider->setToolTip(i18nc("@info:tooltip", "Size of the deformation brush")); liquifyAmountSlider->setRange(0.0, 1.0, 2); - liquifyAmountSlider->setValue(1.0); + liquifyAmountSlider->setValue(0.05); connect(liquifyAmountSlider, SIGNAL(valueChanged(qreal)), this, SLOT(liquifyAmountChanged(qreal))); liquifyAmountSlider->setToolTip(i18nc("@info:tooltip", "Amount of the deformation you get")); @@ -214,12 +214,10 @@ KisToolTransformConfigWidget::KisToolTransformConfigWidget(TransformTransactionP connect(liquifyFlowSlider, SIGNAL(valueChanged(qreal)), this, SLOT(liquifyFlowChanged(qreal))); liquifyFlowSlider->setToolTip(i18nc("@info:tooltip", "When in non-buildup mode, shows how fast the deformation limit is reached.")); - buidupModeComboBox->setCurrentIndex(0); // set to build-up mode by default connect(buidupModeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(liquifyBuildUpChanged(int))); buidupModeComboBox->setToolTip(i18nc("@info:tooltip", "Switch between Build Up and Wash mode of painting. Build Up mode adds deformations one on top of the other without any limits. Wash mode gradually deforms the piece to the selected deformation level.")); - liquifySpacingSlider->setRange(0.0, 3.0, 2); liquifySizeSlider->setExponentRatio(3); liquifySpacingSlider->setSingleStep(0.01); From 96ab9d3363a092d06d3f024a48d4362fa1b5f507 Mon Sep 17 00:00:00 2001 From: Boudewijn Rempt Date: Tue, 14 Mar 2017 11:37:55 +0100 Subject: [PATCH 40/42] BUG:376497 Take more care with the KoSelection object Check the pointer, and where we keep a pointer to it locally, use QPointer. --- libs/flake/KoToolProxy.cpp | 4 +- libs/ui/kis_selection_manager.cc | 6 ++- .../shapeproperties/ShapePropertiesDocker.cpp | 8 ++-- .../defaulttool/defaulttool/DefaultTool.cpp | 32 ++++++++------ .../defaulttool/DefaultToolWidget.cpp | 13 +++--- .../defaulttool/SelectionDecorator.cpp | 38 ++++++++-------- .../defaulttool/SelectionDecorator.h | 4 +- .../defaulttool/ShapeResizeStrategy.cpp | 3 ++ .../CalligraphyTool/KarbonCalligraphyTool.cpp | 43 ++++++++++--------- 9 files changed, 86 insertions(+), 65 deletions(-) diff --git a/libs/flake/KoToolProxy.cpp b/libs/flake/KoToolProxy.cpp index 43e13039fd8..3e30f6ccb5f 100644 --- a/libs/flake/KoToolProxy.cpp +++ b/libs/flake/KoToolProxy.cpp @@ -381,7 +381,7 @@ void KoToolProxy::mouseReleaseEvent(QMouseEvent *event, const QPointF &point) KoShapeManager *manager = d->activeTool->canvas()->shapeManager(); Q_ASSERT(manager); // only change the selection if that will not lead to losing a complex selection - if (manager->selection()->count() <= 1) { + if (manager->selection() && manager->selection()->count() <= 1) { KoShape *shape = manager->shapeAt(point); if (shape && !manager->selection()->isSelected(shape)) { // make the clicked shape the active one manager->selection()->deselectAll(); @@ -416,7 +416,7 @@ void KoToolProxy::mouseReleaseEvent(KoPointerEvent* event) KoShapeManager *manager = d->activeTool->canvas()->shapeManager(); Q_ASSERT(manager); // only change the selection if that will not lead to losing a complex selection - if (manager->selection()->count() <= 1) { + if (manager->selection() && manager->selection()->count() <= 1) { KoShape *shape = manager->shapeAt(event->point); if (shape && !manager->selection()->isSelected(shape)) { // make the clicked shape the active one manager->selection()->deselectAll(); diff --git a/libs/ui/kis_selection_manager.cc b/libs/ui/kis_selection_manager.cc index 8057aac8ae7..54ae085a095 100644 --- a/libs/ui/kis_selection_manager.cc +++ b/libs/ui/kis_selection_manager.cc @@ -268,7 +268,11 @@ bool KisSelectionManager::havePixelsInClipboard() bool KisSelectionManager::haveShapesSelected() { - if (m_view && m_view->canvasBase() && m_view->canvasBase()->shapeManager() && m_view->canvasBase()->shapeManager()->selection()->count()) { + if (m_view + && m_view->canvasBase() + && m_view->canvasBase()->shapeManager() + && m_view->canvasBase()->shapeManager()->selection() + && m_view->canvasBase()->shapeManager()->selection()->count()) { return m_view->canvasBase()->shapeManager()->selection()->count() > 0; } return false; diff --git a/plugins/dockers/shapedockers/shapeproperties/ShapePropertiesDocker.cpp b/plugins/dockers/shapedockers/shapeproperties/ShapePropertiesDocker.cpp index 9f765120ec5..bcaff6a69d9 100644 --- a/plugins/dockers/shapedockers/shapeproperties/ShapePropertiesDocker.cpp +++ b/plugins/dockers/shapedockers/shapeproperties/ShapePropertiesDocker.cpp @@ -39,14 +39,14 @@ class ShapePropertiesDocker::Private { public: - Private() + Private() : widgetStack(0) , currentShape(0) , currentPanel(0) - , canvas(0) + , canvas(0) { } - + QStackedWidget *widgetStack; KoShape *currentShape; KoShapeConfigWidgetBase *currentPanel; @@ -100,7 +100,7 @@ void ShapePropertiesDocker::selectionChanged() } KoSelection *selection = d->canvas->shapeManager()->selection(); - if (selection->count() == 1) { + if (selection && selection->count() == 1) { addWidgetForShape(selection->firstSelectedShape()); } else { addWidgetForShape(0); diff --git a/plugins/tools/defaulttool/defaulttool/DefaultTool.cpp b/plugins/tools/defaulttool/defaulttool/DefaultTool.cpp index c018349fab2..02e5e2f2cf2 100644 --- a/plugins/tools/defaulttool/defaulttool/DefaultTool.cpp +++ b/plugins/tools/defaulttool/defaulttool/DefaultTool.cpp @@ -57,6 +57,7 @@ #include +#include #include #include #include @@ -71,8 +72,8 @@ class NopInteractionStrategy : public KoInteractionStrategy { public: - explicit NopInteractionStrategy(KoToolBase *parent) - : KoInteractionStrategy(parent) + explicit NopInteractionStrategy(KoToolBase *parent) + : KoInteractionStrategy(parent) { } @@ -92,16 +93,18 @@ class SelectionHandler : public KoToolSelection : KoToolSelection(parent) , m_selection(parent->koSelection()) { - Q_ASSERT(m_selection); } bool hasSelection() override { - return m_selection->count(); + if (m_selection) { + return m_selection->count(); + } + return false; } private: - KoSelection *m_selection; + QPointer m_selection; }; DefaultTool::DefaultTool(KoCanvasBase *canvas) @@ -346,8 +349,8 @@ void DefaultTool::updateCursor() QCursor cursor = Qt::ArrowCursor; QString statusText; - - if (koSelection()->count() > 0) { // has a selection + KoSelection * selection = koSelection(); + if (selection && selection->count() > 0) { // has a selection bool editable = editableShapesCount(koSelection()->selectedShapes(KoFlake::StrippedSelection)); if (!m_mouseWasInsideHandles) { @@ -457,7 +460,7 @@ void DefaultTool::updateCursor() void DefaultTool::paint(QPainter &painter, const KoViewConverter &converter) { KoInteractionTool::paint(painter, converter); - if (currentStrategy() == 0 && koSelection()->count() > 0) { + if (currentStrategy() == 0 && koSelection() && koSelection()->count() > 0) { SelectionDecorator decorator(m_mouseWasInsideHandles ? m_lastHandle : KoFlake::NoHandle, true, true); decorator.setSelection(koSelection()); @@ -480,7 +483,7 @@ void DefaultTool::mousePressEvent(KoPointerEvent *event) void DefaultTool::mouseMoveEvent(KoPointerEvent *event) { KoInteractionTool::mouseMoveEvent(event); - if (currentStrategy() == 0 && koSelection()->count() > 0) { + if (currentStrategy() == 0 && koSelection() && koSelection()->count() > 0) { QRectF bound = handlesSize(); if (bound.contains(event->point)) { bool inside; @@ -640,7 +643,7 @@ void DefaultTool::keyPressEvent(QKeyEvent *event) void DefaultTool::customMoveEvent(KoPointerEvent *event) { - if (!koSelection()->count()) { + if (koSelection() && koSelection()->count() <= 0) { event->ignore(); return; } @@ -692,8 +695,7 @@ void DefaultTool::customMoveEvent(KoPointerEvent *event) void DefaultTool::repaintDecorations() { - Q_ASSERT(koSelection()); - if (koSelection()->count() > 0) { + if (koSelection() && koSelection()->count() > 0) { canvas()->updateCanvas(handlesSize()); } } @@ -758,7 +760,7 @@ KoFlake::SelectionHandle DefaultTool::handleAt(const QPointF &point, bool *inner KoFlake::NoHandle }; - if (koSelection()->count() == 0) { + if (koSelection() && koSelection()->count() == 0) { return KoFlake::NoHandle; } @@ -793,6 +795,10 @@ KoFlake::SelectionHandle DefaultTool::handleAt(const QPointF &point, bool *inner void DefaultTool::recalcSelectionBox() { + if (!koSelection()) { + return; + } + if (koSelection()->count() == 0) { return; } diff --git a/plugins/tools/defaulttool/defaulttool/DefaultToolWidget.cpp b/plugins/tools/defaulttool/defaulttool/DefaultToolWidget.cpp index 2c6ea52a5f8..5c5b0e7b913 100644 --- a/plugins/tools/defaulttool/defaulttool/DefaultToolWidget.cpp +++ b/plugins/tools/defaulttool/defaulttool/DefaultToolWidget.cpp @@ -93,12 +93,12 @@ void DefaultToolWidget::updatePosition() KoFlake::Position position = positionSelector->position(); KoSelection *selection = m_tool->canvas()->shapeManager()->selection(); - if (selection->count()) { + if (selection && selection->count()) { selPosition = selection->absolutePosition(position); } - positionXSpinBox->setEnabled(selection->count()); - positionYSpinBox->setEnabled(selection->count()); + positionXSpinBox->setEnabled(selection && selection->count()); + positionYSpinBox->setEnabled(selection && selection->count()); if (m_blockSignals) { return; @@ -119,7 +119,7 @@ void DefaultToolWidget::updatePosition() void DefaultToolWidget::positionHasChanged() { KoSelection *selection = m_tool->canvas()->shapeManager()->selection(); - if (!selection->count()) { + if (!selection || selection->count() <= 0) { return; } @@ -147,7 +147,10 @@ void DefaultToolWidget::updateSize() { QSizeF selSize(0, 0); KoSelection *selection = m_tool->canvas()->shapeManager()->selection(); - uint selectionCount = selection->count(); + uint selectionCount = 0; + if (selection && selection->count()) { + selectionCount = selection->count(); + } if (selectionCount) { selSize = selection->boundingRect().size(); } diff --git a/plugins/tools/defaulttool/defaulttool/SelectionDecorator.cpp b/plugins/tools/defaulttool/defaulttool/SelectionDecorator.cpp index 42e0a943719..ab23f8e6536 100644 --- a/plugins/tools/defaulttool/defaulttool/SelectionDecorator.cpp +++ b/plugins/tools/defaulttool/defaulttool/SelectionDecorator.cpp @@ -87,25 +87,27 @@ void SelectionDecorator::paint(QPainter &painter, const KoViewConverter &convert } } - if (m_selection->count() > 1) { - // more than one shape selected, so we need to draw the selection bounding rect - painter.setPen(Qt::blue); - // apply the selection transformation on top of the old painter transformation - painter.setWorldTransform(m_selection->absoluteTransformation(&converter) * painterMatrix); - // apply the zoom factor - KoShape::applyConversion(painter, converter); - // draw the selection bounding rect - painter.drawRect(QRectF(QPointF(), m_selection->size())); - // save the selection bounding rect for later drawing the selection handles - handleArea = QRectF(QPointF(), m_selection->size()); - } else if (m_selection->firstSelectedShape()) { - // only one shape selected, so we compose the correct painter matrix - painter.setWorldTransform(m_selection->firstSelectedShape()->absoluteTransformation(&converter) * painterMatrix); - KoShape::applyConversion(painter, converter); - // save the only selected shapes bounding rect for later drawing the handles - handleArea = QRectF(QPointF(), m_selection->firstSelectedShape()->size()); + if (m_selection) { + if (m_selection->count() > 1) { + // more than one shape selected, so we need to draw the selection bounding rect + painter.setPen(Qt::blue); + // apply the selection transformation on top of the old painter transformation + painter.setWorldTransform(m_selection->absoluteTransformation(&converter) * painterMatrix); + // apply the zoom factor + KoShape::applyConversion(painter, converter); + // draw the selection bounding rect + painter.drawRect(QRectF(QPointF(), m_selection->size())); + // save the selection bounding rect for later drawing the selection handles + handleArea = QRectF(QPointF(), m_selection->size()); + } + else if (m_selection->firstSelectedShape()) { + // only one shape selected, so we compose the correct painter matrix + painter.setWorldTransform(m_selection->firstSelectedShape()->absoluteTransformation(&converter) * painterMatrix); + KoShape::applyConversion(painter, converter); + // save the only selected shapes bounding rect for later drawing the handles + handleArea = QRectF(QPointF(), m_selection->firstSelectedShape()->size()); + } } - painterMatrix = painter.worldTransform(); painter.restore(); diff --git a/plugins/tools/defaulttool/defaulttool/SelectionDecorator.h b/plugins/tools/defaulttool/defaulttool/SelectionDecorator.h index 461480a827c..910fb89b61a 100644 --- a/plugins/tools/defaulttool/defaulttool/SelectionDecorator.h +++ b/plugins/tools/defaulttool/defaulttool/SelectionDecorator.h @@ -24,7 +24,9 @@ #include #include + #include +#include class KoSelection; @@ -72,7 +74,7 @@ class SelectionDecorator bool m_rotationHandles, m_shearHandles; KoFlake::SelectionHandle m_arrows; static KoFlake::Position m_hotPosition; - KoSelection *m_selection; + QPointer m_selection; int m_handleRadius; int m_lineWidth; }; diff --git a/plugins/tools/defaulttool/defaulttool/ShapeResizeStrategy.cpp b/plugins/tools/defaulttool/defaulttool/ShapeResizeStrategy.cpp index eb11570a41b..2921be94b1b 100644 --- a/plugins/tools/defaulttool/defaulttool/ShapeResizeStrategy.cpp +++ b/plugins/tools/defaulttool/defaulttool/ShapeResizeStrategy.cpp @@ -1,6 +1,7 @@ /* This file is part of the KDE project * Copyright (C) 2006-2007 Thomas Zander * Copyright (C) 2007,2011 Jan Hambrecht + * Copyright (C) 2017 Boudewijn Rempt * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -38,7 +39,9 @@ ShapeResizeStrategy::ShapeResizeStrategy(KoToolBase *tool, const QPointF &clicke : KoInteractionStrategy(tool) , m_lastScale(1.0, 1.0) { + Q_ASSERT(tool->canvas()->shapeManager()->selection()); Q_ASSERT(tool->canvas()->shapeManager()->selection()->count() > 0); + QList selectedShapes = tool->canvas()->shapeManager()->selection()->selectedShapes(KoFlake::StrippedSelection); Q_FOREACH (KoShape *shape, selectedShapes) { if (!shape->isEditable()) { diff --git a/plugins/tools/karbonplugins/tools/CalligraphyTool/KarbonCalligraphyTool.cpp b/plugins/tools/karbonplugins/tools/CalligraphyTool/KarbonCalligraphyTool.cpp index f3a86c50673..45f783d41be 100644 --- a/plugins/tools/karbonplugins/tools/CalligraphyTool/KarbonCalligraphyTool.cpp +++ b/plugins/tools/karbonplugins/tools/CalligraphyTool/KarbonCalligraphyTool.cpp @@ -257,7 +257,7 @@ QPointF KarbonCalligraphyTool::calculateNewPoint(const QPointF &mousePos, QPoint } QPointF res = m_selectedPathOutline.pointAtPercent(t) - + m_selectedPath->position(); + + m_selectedPath->position(); *speed = res - m_lastPoint; return res; } @@ -292,9 +292,9 @@ qreal KarbonCalligraphyTool::calculateAngle(const QPointF &oldSpeed, const QPoin qreal oldLength = QLineF(QPointF(0, 0), oldSpeed).length(); qreal newLength = QLineF(QPointF(0, 0), newSpeed).length(); QPointF oldSpeedNorm = !qFuzzyCompare(oldLength + 1, 1) ? - oldSpeed / oldLength : QPointF(0, 0); + oldSpeed / oldLength : QPointF(0, 0); QPointF newSpeedNorm = !qFuzzyCompare(newLength + 1, 1) ? - newSpeed / newLength : QPointF(0, 0); + newSpeed / newLength : QPointF(0, 0); QPointF speed = oldSpeedNorm + newSpeedNorm; // angle solely based on the speed @@ -488,25 +488,26 @@ void KarbonCalligraphyTool::updateSelectedPath() KoPathShape *oldSelectedPath = m_selectedPath; // save old value KoSelection *selection = canvas()->shapeManager()->selection(); + if (selection) { + // null pointer if it the selection isn't a KoPathShape + // or if the selection is empty + m_selectedPath = + dynamic_cast(selection->firstSelectedShape()); + + // or if it's a KoPathShape but with no or more than one subpaths + if (m_selectedPath && m_selectedPath->subpathCount() != 1) { + m_selectedPath = 0; + } - // null pointer if it the selection isn't a KoPathShape - // or if the selection is empty - m_selectedPath = - dynamic_cast(selection->firstSelectedShape()); - - // or if it's a KoPathShape but with no or more than one subpaths - if (m_selectedPath && m_selectedPath->subpathCount() != 1) { - m_selectedPath = 0; - } - - // or if there ora none or more than 1 shapes selected - if (selection->count() != 1) { - m_selectedPath = 0; - } + // or if there ora none or more than 1 shapes selected + if (selection->count() != 1) { + m_selectedPath = 0; + } - // emit signal it there wasn't a selected path and now there is - // or the other way around - if ((m_selectedPath != 0) != (oldSelectedPath != 0)) { - emit pathSelectedChanged(m_selectedPath != 0); + // emit signal it there wasn't a selected path and now there is + // or the other way around + if ((m_selectedPath != 0) != (oldSelectedPath != 0)) { + emit pathSelectedChanged(m_selectedPath != 0); + } } } From 5eb895923bd2d5c8980381959f0b98e4db15f3b3 Mon Sep 17 00:00:00 2001 From: Boudewijn Rempt Date: Tue, 14 Mar 2017 11:54:25 +0100 Subject: [PATCH 41/42] Fix the TestShapeStrokeCommand unittest --- libs/flake/tests/TestShapeStrokeCommand.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/flake/tests/TestShapeStrokeCommand.cpp b/libs/flake/tests/TestShapeStrokeCommand.cpp index f08d48ac3b0..2a1ea004339 100644 --- a/libs/flake/tests/TestShapeStrokeCommand.cpp +++ b/libs/flake/tests/TestShapeStrokeCommand.cpp @@ -63,8 +63,8 @@ void TestShapeStrokeCommand::refCounting() whiteStroke->strokeInsets(shape1, insets); delete cmd2; - delete shape1; - delete whiteStroke; + delete shape1; // This deletes whiteStroke + delete blackStroke; delete redStroke; } From ec671ef2722ee467540d8c026e928976626a9551 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jouni=20Pentik=C3=A4inen?= Date: Tue, 14 Mar 2017 13:19:22 +0200 Subject: [PATCH 42/42] Fix removing color label from multiple frames BUG: 374746 --- plugins/dockers/animation/timeline_frames_view.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/dockers/animation/timeline_frames_view.cpp b/plugins/dockers/animation/timeline_frames_view.cpp index eed64371051..4e0762aa6b3 100644 --- a/plugins/dockers/animation/timeline_frames_view.cpp +++ b/plugins/dockers/animation/timeline_frames_view.cpp @@ -871,16 +871,18 @@ void TimelineFramesView::mousePressEvent(QMouseEvent *event) m_d->frameCreationMenu->exec(event->globalPos()); } } else if (numSelectedItems > 1) { - int labelIndex = 0; + int labelIndex = -1; bool haveFrames = false; Q_FOREACH(QModelIndex index, selectedIndexes()) { haveFrames |= index.data(TimelineFramesModel::FrameExistsRole).toBool(); QVariant colorLabel = index.data(TimelineFramesModel::FrameColorLabelIndexRole); if (colorLabel.isValid()) { - if (labelIndex == 0) { + if (labelIndex == -1) { + // First label labelIndex = colorLabel.toInt(); - } else { - labelIndex = 0; + } else if (labelIndex != colorLabel.toInt()) { + // Mixed colors in selection + labelIndex = -1; break; } }