[calligra] /: Make kowidgets kdelibs4support-free
Boudewijn Rempt
boud at valdyas.org
Tue Sep 15 09:02:18 BST 2015
Git commit 8d771da3224621514cf39213755ba1149019d1e7 by Boudewijn Rempt.
Committed on 15/09/2015 at 07:21.
Pushed by rempt into branch 'master'.
Make kowidgets kdelibs4support-free
This breaks komain, which is now unported again...
CCMAIL:calligra-devel at kde.org
There is also a big todo left for the resourceserverprovider.
QStandardPaths and KStandardDirs have one really big difference:
KStandardDirs allows you to define a resource type and add different
locations to look for those resources, QStandardPaths doesn't.
The porting guide says to simply look in all those places when
using QStandardPaths::locate, but that doesn't work, of course, for
us, because our resource loading code is all generic.
So this needs thought...
M +1 -1 CalligraProducts.cmake
M +4 -2 libs/widgets/CMakeLists.txt
M +2 -2 libs/widgets/KoColorPopupAction.cpp
M +1 -1 libs/widgets/KoColorPopupButton.cpp
M +1 -2 libs/widgets/KoColorSetWidget.cpp
M +1 -1 libs/widgets/KoColorSetWidget_p.h
M +9 -9 libs/widgets/KoCsvImportDialog.cpp
M +1 -1 libs/widgets/KoDockWidgetTitleBar.cpp
M +1 -1 libs/widgets/KoDockWidgetTitleBarButton.cpp
M +1 -1 libs/widgets/KoDockWidgetTitleBar_p.h
M +1 -1 libs/widgets/KoDocumentInfoDlg.cpp
M +1 -1 libs/widgets/KoDocumentInfoPropsPage.cpp
M +5 -3 libs/widgets/KoDpi.cpp
M +2 -1 libs/widgets/KoDpi.h
M +5 -3 libs/widgets/KoDualColorButton.cpp
M +7 -6 libs/widgets/KoEditColorSetDialog.cpp
M +2 -2 libs/widgets/KoFileDialog.cpp
M +3 -3 libs/widgets/KoGlobal.cpp
M +1 -1 libs/widgets/KoIconToolTip.cpp
M +4 -2 libs/widgets/KoModeBox.cpp
M +1 -1 libs/widgets/KoModeBoxDocker.cpp
M +1 -1 libs/widgets/KoPageLayoutDialog.cpp
M +1 -1 libs/widgets/KoPageLayoutWidget.cpp
M +1 -1 libs/widgets/KoPagePreviewWidget.cpp
M +1 -1 libs/widgets/KoPositionSelector.cpp
M +3 -2 libs/widgets/KoResourceItemChooserSync.cpp
M +2 -2 libs/widgets/KoResourceItemChooserSync.h
M +1 -1 libs/widgets/KoResourceSelector.cpp
M +30 -19 libs/widgets/KoResourceServer.h
M +20 -19 libs/widgets/KoResourceServerProvider.cpp
M +2 -2 libs/widgets/KoResourceServerProvider.h
M +10 -9 libs/widgets/KoResourceTagStore.cpp
M +1 -1 libs/widgets/KoResourceTagStore.h
M +2 -2 libs/widgets/KoResourceTaggingManager.cpp
M +1 -1 libs/widgets/KoRuler.cpp
M +1 -1 libs/widgets/KoRulerController.cpp
M +2 -2 libs/widgets/KoRulerController_p.h
M +2 -2 libs/widgets/KoSliderCombo.cpp
M +1 -1 libs/widgets/KoSliderCombo_p.h
M +3 -3 libs/widgets/KoToolBox.cpp
M +1 -1 libs/widgets/KoToolBoxLayout_p.h
M +3 -3 libs/widgets/KoToolDocker.cpp
M +10 -10 libs/widgets/KoUnitDoubleSpinBox.cpp
M +2 -2 libs/widgets/KoZoomAction.cpp
M +3 -3 libs/widgets/KoZoomController.cpp
M +1 -1 libs/widgets/KoZoomController_p.h
M +1 -1 libs/widgets/KoZoomHandler.cpp
M +1 -1 libs/widgets/KoZoomInput.cpp
C +6 -18 libs/widgets/WidgetsDebug.cpp [from: libs/widgets/tests/zoomcontroller_test.cpp - 057% similarity]
C +11 -19 libs/widgets/WidgetsDebug.h [from: libs/widgets/tests/zoomcontroller_test.cpp - 056% similarity]
M +1 -1 libs/widgets/tests/KoResourceTaggingTest.cpp
M +1 -1 libs/widgets/tests/zoomcontroller_test.cpp
M +1 -1 libs/widgets/tests/zoomhandler_test.cpp
http://commits.kde.org/calligra/8d771da3224621514cf39213755ba1149019d1e7
diff --git a/CalligraProducts.cmake b/CalligraProducts.cmake
index 13c8dc6..8383ef5 100644
--- a/CalligraProducts.cmake
+++ b/CalligraProducts.cmake
@@ -67,7 +67,7 @@ calligra_define_product(LIB_KOVECTORIMAGE "libkovectorimage")
# calligra libs
calligra_define_product(LIB_CALLIGRA "Calligra core libs" REQUIRES BUILDTOOL_RNG2CPP)
-calligra_define_product(LIB_KOMAIN "Lib for one-file-per-window apps" REQUIRES LIB_CALLIGRA)
+calligra_define_product(LIB_KOMAIN "Lib for one-file-per-window apps" UNPORTED REQUIRES LIB_CALLIGRA)
calligra_define_product(LIB_KOPAGEAPP "Lib for paged documents" REQUIRES LIB_CALLIGRA LIB_KOMAIN)
calligra_define_product(LIB_KOODF2 "libkoodf2" REQUIRES LIB_CALLIGRA)
calligra_define_product(LIB_KOODFREADER "libkoodfreader" REQUIRES LIB_KOODF2 LIB_CALLIGRA)
diff --git a/libs/widgets/CMakeLists.txt b/libs/widgets/CMakeLists.txt
index c9fd8a1..9f6761c 100644
--- a/libs/widgets/CMakeLists.txt
+++ b/libs/widgets/CMakeLists.txt
@@ -90,6 +90,8 @@ set(kowidgets_LIB_SRCS
KoTableView.cpp
KoIconUtils.cpp
+
+ WidgetsDebug.cpp
)
ki18n_wrap_ui( kowidgets_LIB_SRCS
@@ -106,7 +108,7 @@ ki18n_wrap_ui( kowidgets_LIB_SRCS
add_library(kowidgets SHARED ${kowidgets_LIB_SRCS})
generate_export_header(kowidgets BASE_NAME kowidgets)
-target_link_libraries(kowidgets kotext pigmentcms kowidgetutils KF5::KDELibs4Support)
+target_link_libraries(kowidgets kotext pigmentcms kowidgetutils KF5::GuiAddons KF5::WidgetsAddons KF5::ConfigCore KF5::Codecs KF5::IconThemes)
if(GHNS)
target_link_libraries(kowidgets KF5::NewStuff)
@@ -117,7 +119,7 @@ if(X11_FOUND)
endif()
-target_link_libraries(kowidgets LINK_INTERFACE_LIBRARIES kotext pigmentcms kowidgetutils KF5::KDELibs4Support)
+target_link_libraries(kowidgets LINK_INTERFACE_LIBRARIES kotext pigmentcms kowidgetutils)
set_target_properties(kowidgets PROPERTIES
VERSION ${GENERIC_CALLIGRA_LIB_VERSION} SOVERSION ${GENERIC_CALLIGRA_LIB_SOVERSION}
diff --git a/libs/widgets/KoColorPopupAction.cpp b/libs/widgets/KoColorPopupAction.cpp
index f5d5282..5582d1d 100644
--- a/libs/widgets/KoColorPopupAction.cpp
+++ b/libs/widgets/KoColorPopupAction.cpp
@@ -29,7 +29,7 @@
#include <KoColorSpaceRegistry.h>
#include <KoColor.h>
-#include <kdebug.h>
+#include <WidgetsDebug.h>
#include <klocalizedstring.h>
#include <QPainter>
@@ -138,7 +138,7 @@ void KoColorPopupAction::setCurrentColor( const QColor &_color )
{
#ifndef NDEBUG
if (!_color.isValid()) {
- kWarning(30004) << "Invalid color given, defaulting to black";
+ warnWidgets << "Invalid color given, defaulting to black";
}
#endif
const QColor color(_color.isValid() ? _color : QColor(0,0,0,255));
diff --git a/libs/widgets/KoColorPopupButton.cpp b/libs/widgets/KoColorPopupButton.cpp
index 63138f0..b846730 100644
--- a/libs/widgets/KoColorPopupButton.cpp
+++ b/libs/widgets/KoColorPopupButton.cpp
@@ -23,7 +23,7 @@
#include <QStyle>
#include <QStyleOptionToolButton>
-#include "kdebug.h"
+#include "WidgetsDebug.h"
KoColorPopupButton::KoColorPopupButton(QWidget *parent)
: QToolButton(parent)
diff --git a/libs/widgets/KoColorSetWidget.cpp b/libs/widgets/KoColorSetWidget.cpp
index 7feb9c9..9bfa0a8 100644
--- a/libs/widgets/KoColorSetWidget.cpp
+++ b/libs/widgets/KoColorSetWidget.cpp
@@ -35,9 +35,8 @@
#include <QPointer>
#include <QScrollArea>
-#include <kglobal.h>
#include <klocalizedstring.h>
-#include <kdebug.h>
+#include <ksharedconfig.h>
#include <KoColorSet.h>
#include <KoColorPatch.h>
diff --git a/libs/widgets/KoColorSetWidget_p.h b/libs/widgets/KoColorSetWidget_p.h
index eb05a7c..7148862 100644
--- a/libs/widgets/KoColorSetWidget_p.h
+++ b/libs/widgets/KoColorSetWidget_p.h
@@ -38,7 +38,7 @@
#include <QScrollArea>
#include <klocalizedstring.h>
-#include <kdebug.h>
+#include <WidgetsDebug.h>
#include <KoColorSet.h>
diff --git a/libs/widgets/KoCsvImportDialog.cpp b/libs/widgets/KoCsvImportDialog.cpp
index df27a25..25be30e 100644
--- a/libs/widgets/KoCsvImportDialog.cpp
+++ b/libs/widgets/KoCsvImportDialog.cpp
@@ -30,10 +30,10 @@
// KDE
#include <kcharsets.h>
#include <kconfig.h>
-#include <kdebug.h>
+#include <WidgetsDebug.h>
#include <klocalizedstring.h>
#include <kmessagebox.h>
-#include <kglobal.h>
+#include <ksharedconfig.h>
#include "ui_KoCsvImportDialog.h"
@@ -98,7 +98,7 @@ KoCsvImportDialog::KoCsvImportDialog(QWidget* parent)
QStringList encodings;
encodings << i18nc( "Descriptive encoding name", "Recommended ( %1 )" ,"UTF-8" );
encodings << i18nc( "Descriptive encoding name", "Locale ( %1 )" ,QString(QTextCodec::codecForLocale()->name() ));
- encodings += KGlobal::charsets()->descriptiveEncodingNames();
+ encodings += KCharsets::charsets()->descriptiveEncodingNames();
// Add a few non-standard encodings, which might be useful for text files
const QString description(i18nc("Descriptive encoding name","Other ( %1 )"));
encodings << description.arg("Apple Roman"); // Apple
@@ -328,7 +328,7 @@ void KoCsvImportDialog::Private::fillTable()
int maxColumn = 1;
row = column = 1;
QTextStream inputStream(data, QIODevice::ReadOnly);
- kDebug(30501) <<"Encoding:" << codec->name();
+ debugWidgets <<"Encoding:" << codec->name();
inputStream.setCodec( codec );
int delimiterIndex = 0;
@@ -688,7 +688,7 @@ void KoCsvImportDialog::delimiterClicked(int id)
else if (id == group->id(d->dialog->m_radioSemicolon))
d->delimiter = ';';
- kDebug(30501) << "Delimiter" << d->delimiter << "selected.";
+ debugWidgets << "Delimiter" << d->delimiter << "selected.";
d->fillTable();
}
@@ -745,8 +745,8 @@ void KoCsvImportDialog::ignoreDuplicatesChanged(int)
QTextCodec* KoCsvImportDialog::Private::updateCodec() const
{
- const QString strCodec( KGlobal::charsets()->encodingForName( dialog->comboBoxEncoding->currentText() ) );
- kDebug(30501) <<"Encoding:" << strCodec;
+ const QString strCodec( KCharsets::charsets()->encodingForName( dialog->comboBoxEncoding->currentText() ) );
+ debugWidgets <<"Encoding:" << strCodec;
bool ok = false;
QTextCodec* codec = QTextCodec::codecForName( strCodec.toUtf8() );
@@ -758,14 +758,14 @@ QTextCodec* KoCsvImportDialog::Private::updateCodec() const
}
else
{
- codec = KGlobal::charsets()->codecForName( strCodec, ok );
+ codec = KCharsets::charsets()->codecForName( strCodec, ok );
}
// Still nothing?
if ( !codec || !ok )
{
// Default: UTF-8
- kWarning(30502) << "Cannot find encoding:" << strCodec;
+ warnWidgets << "Cannot find encoding:" << strCodec;
// ### TODO: what parent to use?
KMessageBox::error( 0, i18n("Cannot find encoding: %1", strCodec ) );
return 0;
diff --git a/libs/widgets/KoDockWidgetTitleBar.cpp b/libs/widgets/KoDockWidgetTitleBar.cpp
index 512c94e..22d7074 100644
--- a/libs/widgets/KoDockWidgetTitleBar.cpp
+++ b/libs/widgets/KoDockWidgetTitleBar.cpp
@@ -25,7 +25,7 @@
#include <KoIcon.h>
#include <KoIconUtils.h>
-#include <kdebug.h>
+#include <WidgetsDebug.h>
#include <klocalizedstring.h>
#include <QAbstractButton>
diff --git a/libs/widgets/KoDockWidgetTitleBarButton.cpp b/libs/widgets/KoDockWidgetTitleBarButton.cpp
index 7bc74f9..8ffc6ad 100644
--- a/libs/widgets/KoDockWidgetTitleBarButton.cpp
+++ b/libs/widgets/KoDockWidgetTitleBarButton.cpp
@@ -20,7 +20,7 @@
#include "KoDockWidgetTitleBarButton.h"
-#include <kdebug.h>
+#include <WidgetsDebug.h>
#include <QAbstractButton>
#include <QAction>
diff --git a/libs/widgets/KoDockWidgetTitleBar_p.h b/libs/widgets/KoDockWidgetTitleBar_p.h
index 3851f8c..f61c0b1 100644
--- a/libs/widgets/KoDockWidgetTitleBar_p.h
+++ b/libs/widgets/KoDockWidgetTitleBar_p.h
@@ -25,7 +25,7 @@
#include <KoIcon.h>
-#include <kdebug.h>
+#include <WidgetsDebug.h>
#include <QAbstractButton>
#include <QAction>
diff --git a/libs/widgets/KoDocumentInfoDlg.cpp b/libs/widgets/KoDocumentInfoDlg.cpp
index 2ddf21f..4b9b57b 100644
--- a/libs/widgets/KoDocumentInfoDlg.cpp
+++ b/libs/widgets/KoDocumentInfoDlg.cpp
@@ -33,7 +33,7 @@
#include <klocalizedstring.h>
-#include <kglobal.h>
+
#include <kmessagebox.h>
#include <kmainwindow.h>
#include <KoDialog.h>
diff --git a/libs/widgets/KoDocumentInfoPropsPage.cpp b/libs/widgets/KoDocumentInfoPropsPage.cpp
index 8606399..3ea91b8 100644
--- a/libs/widgets/KoDocumentInfoPropsPage.cpp
+++ b/libs/widgets/KoDocumentInfoPropsPage.cpp
@@ -27,7 +27,7 @@
#include "KoDocumentInfo.h"
#include "KoDocumentInfoDlg.h"
#include <QUrl>
-#include <kdebug.h>
+#include <WidgetsDebug.h>
class KoDocumentInfoPropsPage::KoDocumentInfoPropsPagePrivate
{
diff --git a/libs/widgets/KoDpi.cpp b/libs/widgets/KoDpi.cpp
index 413dab0..57700f5 100644
--- a/libs/widgets/KoDpi.cpp
+++ b/libs/widgets/KoDpi.cpp
@@ -22,6 +22,7 @@
#include "KoDpi.h"
#include <QFontInfo>
+
#ifdef HAVE_X11
#include <QX11Info>
#else
@@ -29,11 +30,12 @@
#include <QDesktopWidget>
#endif
-#include <kglobal.h>
+#include <QGlobalStatic>
+
+Q_GLOBAL_STATIC(KoDpi, s_instance)
KoDpi* KoDpi::self()
{
- K_GLOBAL_STATIC(KoDpi, s_instance)
return s_instance;
}
@@ -63,7 +65,7 @@ KoDpi::~KoDpi()
void KoDpi::setDPI(int x, int y)
{
- //kDebug(30006) << x <<"," << y;
+ //debugWidgets << x <<"," << y;
KoDpi* s = self();
s->m_dpiX = x;
s->m_dpiY = y;
diff --git a/libs/widgets/KoDpi.h b/libs/widgets/KoDpi.h
index 737a85b..b8ec82b 100644
--- a/libs/widgets/KoDpi.h
+++ b/libs/widgets/KoDpi.h
@@ -34,6 +34,7 @@
class KOWIDGETS_EXPORT KoDpi
{
public:
+ KoDpi();
/// For KoApplication
static void initialize() {
(void)self(); // I don't want to make KoDpi instances public, so self() is private
@@ -54,7 +55,7 @@ public:
private:
static KoDpi* self();
- KoDpi();
+
int m_dpiX;
int m_dpiY;
diff --git a/libs/widgets/KoDualColorButton.cpp b/libs/widgets/KoDualColorButton.cpp
index a2d5774..b7458b1 100644
--- a/libs/widgets/KoDualColorButton.cpp
+++ b/libs/widgets/KoDualColorButton.cpp
@@ -24,7 +24,7 @@
#include "dcolorarrow.xbm"
#include "dcolorreset.xpm"
-#include <kcolordialog.h>
+#include <QColorDialog>
#include <QBitmap>
#include <QBrush>
@@ -271,7 +271,8 @@ void KoDualColorButton::mouseReleaseEvent( QMouseEvent *event )
if(d->tmpSelection == Foreground ) {
if( d->popDialog) {
QColor c = d->displayRenderer->toQColor(d->foregroundColor);
- if (KColorDialog::getColor(c, this) == KColorDialog::Accepted) {
+ c = QColorDialog::getColor(c, this) ;
+ if (c.isValid()) {
d->foregroundColor = d->displayRenderer->approximateFromRenderedQColor(c);
emit foregroundColorChanged(d->foregroundColor);
}
@@ -287,7 +288,8 @@ void KoDualColorButton::mouseReleaseEvent( QMouseEvent *event )
if(d->tmpSelection == Background ) {
if( d->popDialog) {
QColor c = d->displayRenderer->toQColor(d->backgroundColor);
- if (KColorDialog::getColor(c, this) == KColorDialog::Accepted) {
+ c = QColorDialog::getColor(c, this);
+ if (c.isValid()) {
d->backgroundColor = d->displayRenderer->approximateFromRenderedQColor(c);
emit backgroundColorChanged(d->backgroundColor);
}
diff --git a/libs/widgets/KoEditColorSetDialog.cpp b/libs/widgets/KoEditColorSetDialog.cpp
index 04a5bfd..a6990ba 100644
--- a/libs/widgets/KoEditColorSetDialog.cpp
+++ b/libs/widgets/KoEditColorSetDialog.cpp
@@ -24,10 +24,10 @@
#include <QScrollArea>
#include <QHBoxLayout>
#include <QFileInfo>
+#include <QColorDialog>
+#include <QInputDialog>
#include <klocalizedstring.h>
-#include <kcolordialog.h>
-#include <kinputdialog.h>
#include <kmessagebox.h>
#include <KoColorSet.h>
@@ -36,7 +36,7 @@
#include <KoFileDialog.h>
// debug
-#include <kdebug.h>
+#include <WidgetsDebug.h>
KoEditColorSetWidget::KoEditColorSetWidget(const QList<KoColorSet *> &palettes, const QString &activePalette, QWidget *parent)
: QWidget(parent),
@@ -151,11 +151,12 @@ void KoEditColorSetWidget::setTextLabel(KoColorPatch *patch)
void KoEditColorSetWidget::addColor()
{
QColor color;
- int result = KColorDialog::getColor(color);
- if (result == KColorDialog::Accepted) {
+
+ color = QColorDialog::getColor(color);
+ if (color.isValid()) {
KoColorSetEntry newEntry;
newEntry.color = KoColor(color, KoColorSpaceRegistry::instance()->rgb8());
- newEntry.name = KInputDialog::getText(i18n("Add Color To Palette"), i18n("Color name:"));
+ newEntry.name = QInputDialog::getText(this, i18n("Add Color To Palette"), i18n("Color name:"));
KoColorPatch *patch = new KoColorPatch(widget.patchesFrame);
patch->setColor(newEntry.color);
connect(patch, SIGNAL(triggered(KoColorPatch *)), this, SLOT(setTextLabel(KoColorPatch *)));
diff --git a/libs/widgets/KoFileDialog.cpp b/libs/widgets/KoFileDialog.cpp
index 9f9ac6b..682ded4 100644
--- a/libs/widgets/KoFileDialog.cpp
+++ b/libs/widgets/KoFileDialog.cpp
@@ -24,10 +24,10 @@
#include <QImageReader>
#include <QClipboard>
-#include <kglobal.h>
#include <kconfiggroup.h>
-
+#include <ksharedconfig.h>
#include <klocalizedstring.h>
+
#include <QUrl>
#include <QMimeDatabase>
#include <QMimeType>
diff --git a/libs/widgets/KoGlobal.cpp b/libs/widgets/KoGlobal.cpp
index b781c39..4d424f2 100644
--- a/libs/widgets/KoGlobal.cpp
+++ b/libs/widgets/KoGlobal.cpp
@@ -28,7 +28,7 @@
#include <QFontDatabase>
#include <QGlobalStatic>
-#include <kdebug.h>
+#include <WidgetsDebug.h>
#include <kconfiggroup.h>
#include <klocalizedstring.h>
#include <ksharedconfig.h>
@@ -67,8 +67,8 @@ QFont KoGlobal::_defaultFont()
Q_ASSERT(m_pointSize != -1);
font.setPointSize(m_pointSize);
}
- //kDebug( 30003 )<<"QFontInfo(font).pointSize() :"<<QFontInfo(font).pointSize();
- //kDebug( 30003 )<<"font.name() :"<<font.family ();
+ //debugWidgets<<"QFontInfo(font).pointSize() :"<<QFontInfo(font).pointSize();
+ //debugWidgets<<"font.name() :"<<font.family ();
return font;
}
diff --git a/libs/widgets/KoIconToolTip.cpp b/libs/widgets/KoIconToolTip.cpp
index 6ae3849..0aa4ceb 100644
--- a/libs/widgets/KoIconToolTip.cpp
+++ b/libs/widgets/KoIconToolTip.cpp
@@ -26,7 +26,7 @@
#include <KoResourceModel.h>
-// #include <kdebug.h>
+// #include <WidgetsDebug.h>
QTextDocument *KoIconToolTip::createDocument( const QModelIndex &index )
{
diff --git a/libs/widgets/KoModeBox.cpp b/libs/widgets/KoModeBox.cpp
index aad4e46..9136d36 100644
--- a/libs/widgets/KoModeBox.cpp
+++ b/libs/widgets/KoModeBox.cpp
@@ -27,11 +27,11 @@
#include <KoToolManager.h>
#include <KoShapeLayer.h>
-#include <kdebug.h>
#include <kconfiggroup.h>
#include <klocalizedstring.h>
#include <kselectaction.h>
-#include <kglobal.h>
+#include <ksharedconfig.h>
+
#include <QIcon>
#include <QMap>
@@ -51,6 +51,8 @@
#include <QScrollBar>
#include <QFontDatabase>
+#include <WidgetsDebug.h>
+
class KoModeBox::Private
{
public:
diff --git a/libs/widgets/KoModeBoxDocker.cpp b/libs/widgets/KoModeBoxDocker.cpp
index 1234e28..d025ef0 100644
--- a/libs/widgets/KoModeBoxDocker.cpp
+++ b/libs/widgets/KoModeBoxDocker.cpp
@@ -23,7 +23,7 @@
#include "KoModeBox_p.h"
#include <KoCanvasController.h>
-#include <kdebug.h>
+#include <WidgetsDebug.h>
KoModeBoxDocker::KoModeBoxDocker(KoModeBox *modeBox)
diff --git a/libs/widgets/KoPageLayoutDialog.cpp b/libs/widgets/KoPageLayoutDialog.cpp
index 5385deb..b95e12f 100644
--- a/libs/widgets/KoPageLayoutDialog.cpp
+++ b/libs/widgets/KoPageLayoutDialog.cpp
@@ -23,7 +23,7 @@
#include "KoPagePreviewWidget.h"
#include <klocalizedstring.h>
-#include <kdebug.h>
+#include <WidgetsDebug.h>
#include <QCheckBox>
#include <QDialogButtonBox>
diff --git a/libs/widgets/KoPageLayoutWidget.cpp b/libs/widgets/KoPageLayoutWidget.cpp
index f22c64c..1ef807c 100644
--- a/libs/widgets/KoPageLayoutWidget.cpp
+++ b/libs/widgets/KoPageLayoutWidget.cpp
@@ -222,7 +222,7 @@ void KoPageLayoutWidget::marginsChanged()
d->pageLayout.bindingSide = left;
d->pageLayout.pageEdge = right;
}
- // kDebug() << " " << d->pageLayout.left <<"|"<< d->pageLayout.bindingSide << "," <<
+ // debugWidgets << " " << d->pageLayout.left <<"|"<< d->pageLayout.bindingSide << "," <<
// d->pageLayout.right << "|"<< d->pageLayout.pageEdge;
emit layoutChanged(d->pageLayout);
d->allowSignals = true;
diff --git a/libs/widgets/KoPagePreviewWidget.cpp b/libs/widgets/KoPagePreviewWidget.cpp
index 537aaad..006b933 100644
--- a/libs/widgets/KoPagePreviewWidget.cpp
+++ b/libs/widgets/KoPagePreviewWidget.cpp
@@ -26,7 +26,7 @@
#include <KoColumns.h>
#include <QPainter>
-#include <kdebug.h>
+#include <WidgetsDebug.h>
class Q_DECL_HIDDEN KoPagePreviewWidget::Private
{
diff --git a/libs/widgets/KoPositionSelector.cpp b/libs/widgets/KoPositionSelector.cpp
index cb70e84..ce5123f 100644
--- a/libs/widgets/KoPositionSelector.cpp
+++ b/libs/widgets/KoPositionSelector.cpp
@@ -24,7 +24,7 @@
#include <QGridLayout>
#include <QButtonGroup>
#include <QPainter>
-#include <kdebug.h>
+#include <WidgetsDebug.h>
#include <QStyleOption>
#define GAP 0
diff --git a/libs/widgets/KoResourceItemChooserSync.cpp b/libs/widgets/KoResourceItemChooserSync.cpp
index accab88..befe316 100644
--- a/libs/widgets/KoResourceItemChooserSync.cpp
+++ b/libs/widgets/KoResourceItemChooserSync.cpp
@@ -20,7 +20,9 @@
#include "KoResourceItemChooserSync.h"
-#include <kglobal.h>
+#include <QGlobalStatic>
+
+Q_GLOBAL_STATIC(KoResourceItemChooserSync, s_instance)
struct Q_DECL_HIDDEN KoResourceItemChooserSync::Private
{
@@ -40,7 +42,6 @@ KoResourceItemChooserSync::~KoResourceItemChooserSync()
KoResourceItemChooserSync* KoResourceItemChooserSync::instance()
{
- K_GLOBAL_STATIC(KoResourceItemChooserSync, s_instance);
return s_instance;
}
diff --git a/libs/widgets/KoResourceItemChooserSync.h b/libs/widgets/KoResourceItemChooserSync.h
index 28761f6..42ab0cd 100644
--- a/libs/widgets/KoResourceItemChooserSync.h
+++ b/libs/widgets/KoResourceItemChooserSync.h
@@ -35,8 +35,8 @@ class KOWIDGETS_EXPORT KoResourceItemChooserSync : public QObject
{
Q_OBJECT
public:
+ KoResourceItemChooserSync();
virtual ~KoResourceItemChooserSync();
-
static KoResourceItemChooserSync* instance();
/// Gets the base length
@@ -53,7 +53,7 @@ Q_SIGNALS:
void baseLenghtChanged(int length);
private:
- KoResourceItemChooserSync();
+
KoResourceItemChooserSync(const KoResourceItemChooserSync&);
KoResourceItemChooserSync operator=(const KoResourceItemChooserSync&);
diff --git a/libs/widgets/KoResourceSelector.cpp b/libs/widgets/KoResourceSelector.cpp
index 523b86d..7cb24e4 100644
--- a/libs/widgets/KoResourceSelector.cpp
+++ b/libs/widgets/KoResourceSelector.cpp
@@ -29,7 +29,7 @@
#include <QMouseEvent>
#include <QStyledItemDelegate>
-#include <kdebug.h>
+#include <WidgetsDebug.h>
class Q_DECL_HIDDEN KoResourceSelector::Private
{
diff --git a/libs/widgets/KoResourceServer.h b/libs/widgets/KoResourceServer.h
index 36dfe20..a7c6e33 100644
--- a/libs/widgets/KoResourceServer.h
+++ b/libs/widgets/KoResourceServer.h
@@ -31,8 +31,10 @@
#include <QList>
#include <QFileInfo>
#include <QDir>
-#include <kglobal.h>
-#include <kstandarddirs.h>
+#include <QApplication>
+#include <QDirIterator>
+
+#include <ksharedconfig.h>
#include <QTemporaryFile>
#include <QDomDocument>
@@ -43,7 +45,7 @@
#include "kowidgets_export.h"
-#include <kdebug.h>
+#include <WidgetsDebug.h>
class KoResource;
@@ -55,7 +57,7 @@ class KOWIDGETS_EXPORT KoResourceServerBase {
public:
/**
* Constructs a KoResourceServerBase
- * @param resource type, has to be the same as used by KStandardDirs
+ * @param resource type
* @param extensions the file extensions separate by ':', e.g. "*.kgr:*.svg:*.ggr"
*/
KoResourceServerBase(const QString& type, const QString& extensions)
@@ -84,7 +86,16 @@ public:
QStringList fileNames;
foreach (const QString &extension, extensionList) {
- fileNames += KGlobal::dirs()->findAllResources(type().toLatin1(), extension, KStandardDirs::Recursive | KStandardDirs::NoDuplicates);
+ QStringList files;
+ const QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, type(), QStandardPaths::LocateDirectory);
+ Q_FOREACH (const QString& dir, dirs) {
+ QDirIterator it(dir, QStringList() << QStringLiteral("*.") + extension);
+ while (it.hasNext()) {
+ files.append(it.next());
+ }
+ }
+
+
}
return fileNames;
@@ -136,7 +147,7 @@ public:
KoResourceServer(const QString& type, const QString& extensions)
: KoResourceServerBase(type, extensions)
{
- m_blackListFile = KStandardDirs::locateLocal("data", "krita/" + type + ".blacklist");
+ m_blackListFile = QStandardPaths::locate(QStandardPaths::AppDataLocation, type + ".blacklist");
m_blackListFileNames = readBlackListFile();
m_tagStore = new KoResourceTagStore(this);
m_tagStore->loadTags();
@@ -214,7 +225,7 @@ public:
notifyResourceAdded(resource);
}
else {
- kWarning() << "Loading resource " << front << "failed";
+ warnWidgets << "Loading resource " << front << "failed";
Policy::deleteResource(resource);
}
}
@@ -228,14 +239,14 @@ public:
observer->syncTaggedResourceView();
}
- kDebug(30009) << "done loading resources for type " << type();
+ debugWidgets << "done loading resources for type " << type();
}
/// Adds an already loaded resource to the server
bool addResource(PointerType resource, bool save = true, bool infront = false) {
if (!resource->valid()) {
- kWarning(30009) << "Tried to add an invalid resource!";
+ warnWidgets << "Tried to add an invalid resource!";
return false;
}
@@ -249,16 +260,16 @@ public:
if (fileInfo.exists()) {
QString filename = fileInfo.path() + "/" + fileInfo.baseName() + "XXXXXX" + "." + fileInfo.suffix();
- kDebug() << "fileName is " << filename;
+ debugWidgets << "fileName is " << filename;
QTemporaryFile file(filename);
if (file.open()) {
- kDebug() << "now " << file.fileName();
+ debugWidgets << "now " << file.fileName();
resource->setFilename(file.fileName());
}
}
if (!resource->save()) {
- kWarning(30009) << "Could not save resource!";
+ warnWidgets << "Could not save resource!";
return false;
}
}
@@ -294,7 +305,7 @@ public:
writeBlackListFile();
}
else{
- kWarning(30009)<<"Doesn't contain filename";
+ warnWidgets<<"Doesn't contain filename";
return false;
}
@@ -350,7 +361,7 @@ public:
/// Returns path where to save user defined and imported resources to
virtual QString saveLocation() {
- return KGlobal::dirs()->saveLocation(type().toLatin1());
+ return QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/" + type();
}
/**
@@ -370,7 +381,7 @@ public:
PointerType resource = createResource( filename );
resource->load();
if (!resource->valid()) {
- kWarning(30009) << "Import failed! Resource is not valid";
+ warnWidgets << "Import failed! Resource is not valid";
Policy::deleteResource(resource);
return false;
@@ -407,7 +418,7 @@ public:
PointerType resource = resourceByFilename(fi.fileName());
if (!resource) {
- kWarning(30009) << "Resource file do not exist ";
+ warnWidgets << "Resource file do not exist ";
return;
}
@@ -615,13 +626,13 @@ protected:
QDomDocument doc;
if (!doc.setContent(&f)) {
- kWarning() << "The file could not be parsed.";
+ warnWidgets << "The file could not be parsed.";
return filenameList;
}
QDomElement root = doc.documentElement();
if (root.tagName() != "resourceFilesList") {
- kWarning() << "The file doesn't seem to be of interest.";
+ warnWidgets << "The file doesn't seem to be of interest.";
return filenameList;
}
@@ -644,7 +655,7 @@ protected:
QFile f(m_blackListFile);
if (!f.open(QIODevice::WriteOnly | QIODevice::Text)) {
- kWarning() << "Cannot write meta information to '" << m_blackListFile << "'." << endl;
+ warnWidgets << "Cannot write meta information to '" << m_blackListFile << "'." << endl;
return;
}
diff --git a/libs/widgets/KoResourceServerProvider.cpp b/libs/widgets/KoResourceServerProvider.cpp
index 4015a80..f357e70 100644
--- a/libs/widgets/KoResourceServerProvider.cpp
+++ b/libs/widgets/KoResourceServerProvider.cpp
@@ -26,9 +26,8 @@
#include <QFileInfo>
#include <QStringList>
#include <QDir>
-
-#include <kglobal.h>
-#include <kstandarddirs.h>
+#include <QStandardPaths>
+#include <QGlobalStatic>
#include "KoSegmentGradient.h"
#include "KoStopGradient.h"
@@ -160,23 +159,24 @@ struct Q_DECL_HIDDEN KoResourceServerProvider::Private
KoResourceServerProvider::KoResourceServerProvider() : d(new Private)
{
- KGlobal::dirs()->addResourceType("ko_patterns", "data", "krita/patterns/", true);
- KGlobal::dirs()->addResourceDir("ko_patterns", "/usr/share/create/patterns/gimp");
- KGlobal::dirs()->addResourceDir("ko_patterns", QDir::homePath() + QString("/.create/patterns/gimp"));
+// QT5TODO: How to configure QStandardPaths to look in places other than the default ones?
+// KGlobal::dirs()->addResourceType("ko_patterns", "data", "krita/patterns/", true);
+// KGlobal::dirs()->addResourceDir("ko_patterns", "/usr/share/create/patterns/gimp");
+// KGlobal::dirs()->addResourceDir("ko_patterns", QDir::homePath() + QString("/.create/patterns/gimp"));
- KGlobal::dirs()->addResourceType("ko_gradients", "data", "karbon/gradients/");
- KGlobal::dirs()->addResourceType("ko_gradients", "data", "krita/gradients/", true);
- KGlobal::dirs()->addResourceDir("ko_gradients", "/usr/share/create/gradients/gimp");
- KGlobal::dirs()->addResourceDir("ko_gradients", QDir::homePath() + QString("/.create/gradients/gimp"));
+// KGlobal::dirs()->addResourceType("ko_gradients", "data", "karbon/gradients/");
+// KGlobal::dirs()->addResourceType("ko_gradients", "data", "krita/gradients/", true);
+// KGlobal::dirs()->addResourceDir("ko_gradients", "/usr/share/create/gradients/gimp");
+// KGlobal::dirs()->addResourceDir("ko_gradients", QDir::homePath() + QString("/.create/gradients/gimp"));
- KGlobal::dirs()->addResourceType("ko_palettes", "data", "calligra/palettes/");
- KGlobal::dirs()->addResourceType("ko_palettes", "data", "karbon/palettes/");
- KGlobal::dirs()->addResourceType("ko_palettes", "data", "krita/palettes/", true);
+// KGlobal::dirs()->addResourceType("ko_palettes", "data", "calligra/palettes/");
+// KGlobal::dirs()->addResourceType("ko_palettes", "data", "karbon/palettes/");
+// KGlobal::dirs()->addResourceType("ko_palettes", "data", "krita/palettes/", true);
- KGlobal::dirs()->addResourceDir("ko_palettes", "/usr/share/create/swatches");
- KGlobal::dirs()->addResourceDir("ko_palettes", QDir::homePath() + QString("/.create/swatches"));
+// KGlobal::dirs()->addResourceDir("ko_palettes", "/usr/share/create/swatches");
+// KGlobal::dirs()->addResourceDir("ko_palettes", QDir::homePath() + QString("/.create/swatches"));
- d->patternServer = new KoResourceServerSimpleConstruction<KoPattern>("ko_patterns", "*.pat:*.jpg:*.gif:*.png:*.tif:*.xpm:*.bmp" );
+ d->patternServer = new KoResourceServerSimpleConstruction<KoPattern>("patterns", "*.pat:*.jpg:*.gif:*.png:*.tif:*.xpm:*.bmp" );
if (!QFileInfo(d->patternServer->saveLocation()).exists()) {
QDir().mkpath(d->patternServer->saveLocation());
}
@@ -187,7 +187,7 @@ KoResourceServerProvider::KoResourceServerProvider() : d(new Private)
d->patternThread->wait();
}
- d->gradientServer = new GradientResourceServer("ko_gradients", "*.kgr:*.svg:*.ggr");
+ d->gradientServer = new GradientResourceServer("gradients", "*.kgr:*.svg:*.ggr");
if (!QFileInfo(d->gradientServer->saveLocation()).exists()) {
QDir().mkpath(d->gradientServer->saveLocation());
}
@@ -198,7 +198,7 @@ KoResourceServerProvider::KoResourceServerProvider() : d(new Private)
d->gradientThread->wait();
}
- d->paletteServer = new KoResourceServerSimpleConstruction<KoColorSet>("ko_palettes", "*.gpl:*.pal:*.act:*.aco:*.css:*.colors");
+ d->paletteServer = new KoResourceServerSimpleConstruction<KoColorSet>("palettes", "*.gpl:*.pal:*.act:*.aco:*.css:*.colors");
if (!QFileInfo(d->paletteServer->saveLocation()).exists()) {
QDir().mkpath(d->paletteServer->saveLocation());
}
@@ -223,9 +223,10 @@ KoResourceServerProvider::~KoResourceServerProvider()
delete d;
}
+Q_GLOBAL_STATIC(KoResourceServerProvider, s_instance);
+
KoResourceServerProvider* KoResourceServerProvider::instance()
{
- K_GLOBAL_STATIC(KoResourceServerProvider, s_instance);
return s_instance;
}
diff --git a/libs/widgets/KoResourceServerProvider.h b/libs/widgets/KoResourceServerProvider.h
index 63e2b7c..9e31500 100644
--- a/libs/widgets/KoResourceServerProvider.h
+++ b/libs/widgets/KoResourceServerProvider.h
@@ -26,7 +26,7 @@
#include <QThread>
-#include <kdebug.h>
+#include <WidgetsDebug.h>
#include "KoResourceServer.h"
#include "KoPattern.h"
@@ -75,6 +75,7 @@ class KOWIDGETS_EXPORT KoResourceServerProvider : public QObject
Q_OBJECT
public:
+ KoResourceServerProvider();
virtual ~KoResourceServerProvider();
static KoResourceServerProvider* instance();
@@ -84,7 +85,6 @@ public:
KoResourceServer<KoColorSet>* paletteServer(bool block = true);
private:
- KoResourceServerProvider();
KoResourceServerProvider(const KoResourceServerProvider&);
KoResourceServerProvider operator=(const KoResourceServerProvider&);
diff --git a/libs/widgets/KoResourceTagStore.cpp b/libs/widgets/KoResourceTagStore.cpp
index d216c17..3ef0f4f 100644
--- a/libs/widgets/KoResourceTagStore.cpp
+++ b/libs/widgets/KoResourceTagStore.cpp
@@ -22,12 +22,13 @@
#include <QDebug>
#include <QStringList>
-#include <kstandarddirs.h>
#include <QFile>
#include <QDir>
-#include <KoResourceServer.h>
+#include <QStandardPaths>
#include <QDomDocument>
+#include <KoResourceServer.h>
+
class Q_DECL_HIDDEN KoResourceTagStore::Private
{
@@ -174,7 +175,7 @@ QStringList KoResourceTagStore::searchTag(const QString& query) const
void KoResourceTagStore::loadTags()
{
- QStringList tagFiles = KGlobal::dirs()->findAllResources("data", "krita/tags/" + d->resourceServer->type() + "_tags.xml");
+ QStringList tagFiles = QStandardPaths::locateAll(QStandardPaths::AppDataLocation, "tags/" + d->resourceServer->type() + "_tags.xml");
foreach(const QString &tagFile, tagFiles) {
readXMLFile(tagFile);
}
@@ -184,7 +185,7 @@ void KoResourceTagStore::writeXMLFile(const QString &tagstore)
{
QFile f(tagstore);
if (!f.open(QIODevice::WriteOnly | QIODevice::Text)) {
- kWarning() << "Cannot write meta information to '" << tagstore << "'.";
+ warnWidgets << "Cannot write meta information to '" << tagstore << "'.";
return;
}
QDomDocument doc;
@@ -252,7 +253,7 @@ void KoResourceTagStore::readXMLFile(const QString &tagstore)
if (QFile::exists(tagstore)) {
inputFile = tagstore;
} else {
- inputFile = KStandardDirs::locateLocal("data", "krita/tags.xml");
+ inputFile = QStandardPaths::locate(QStandardPaths::AppDataLocation, "tags.xml");
}
QFile f(inputFile);
@@ -262,13 +263,13 @@ void KoResourceTagStore::readXMLFile(const QString &tagstore)
QDomDocument doc;
if (!doc.setContent(&f)) {
- kWarning() << "The file could not be parsed.";
+ warnWidgets << "The file could not be parsed.";
return;
}
QDomElement root = doc.documentElement();
if (root.tagName() != "tags") {
- kWarning() << "The file doesn't seem to be of interest.";
+ warnWidgets << "The file doesn't seem to be of interest.";
return;
}
@@ -320,7 +321,7 @@ void KoResourceTagStore::readXMLFile(const QString &tagstore)
KoResource *res = 0;
if (resByMd5 && resByFileName && (resByMd5 != resByFileName)) {
- kWarning() << "MD5sum and filename point to different resources -- was the resource renamed? We go with md5";
+ warnWidgets << "MD5sum and filename point to different resources -- was the resource renamed? We go with md5";
res = resByMd5;
}
else if (!resByMd5 && resByFileName) {
@@ -380,5 +381,5 @@ QStringList KoResourceTagStore::removeAdjustedFileNames(QStringList fileNamesLis
void KoResourceTagStore::serializeTags()
{
- writeXMLFile(KStandardDirs::locateLocal("data", "krita/tags/" + d->resourceServer->type() + "_tags.xml"));
+ writeXMLFile(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/tags/" + d->resourceServer->type() + "_tags.xml");
}
diff --git a/libs/widgets/KoResourceTagStore.h b/libs/widgets/KoResourceTagStore.h
index 84b5574..b6b375a 100644
--- a/libs/widgets/KoResourceTagStore.h
+++ b/libs/widgets/KoResourceTagStore.h
@@ -22,7 +22,7 @@
#define KORESOURCETAGSTORE_H
-#include <kdebug.h>
+#include <WidgetsDebug.h>
#include "kowidgets_export.h"
class KoResourceServerBase;
diff --git a/libs/widgets/KoResourceTaggingManager.cpp b/libs/widgets/KoResourceTaggingManager.cpp
index 9e0e8e2..49e1785 100644
--- a/libs/widgets/KoResourceTaggingManager.cpp
+++ b/libs/widgets/KoResourceTaggingManager.cpp
@@ -29,10 +29,10 @@
#include <QMessageBox>
#include <QPointer>
-#include <kdebug.h>
+#include <WidgetsDebug.h>
#include <klocalizedstring.h>
-#include <kglobal.h>
+#include <ksharedconfig.h>
#include "KoTagFilterWidget.h"
#include "KoTagChooserWidget.h"
diff --git a/libs/widgets/KoRuler.cpp b/libs/widgets/KoRuler.cpp
index b36293b..702c7ed 100644
--- a/libs/widgets/KoRuler.cpp
+++ b/libs/widgets/KoRuler.cpp
@@ -28,7 +28,7 @@
#include <KoToolManager.h>
#include <klocalizedstring.h>
-#include <kdebug.h>
+#include <WidgetsDebug.h>
#include <QPainter>
#include <QResizeEvent>
diff --git a/libs/widgets/KoRulerController.cpp b/libs/widgets/KoRulerController.cpp
index b1bc188..52d42ae 100644
--- a/libs/widgets/KoRulerController.cpp
+++ b/libs/widgets/KoRulerController.cpp
@@ -25,7 +25,7 @@
#include <KoCanvasResourceManager.h>
#include <KoTextDocument.h>
-#include <kdebug.h>
+#include <WidgetsDebug.h>
#include <QVariant>
#include <QTextOption>
diff --git a/libs/widgets/KoRulerController_p.h b/libs/widgets/KoRulerController_p.h
index 36bbfae..2e6c48d 100644
--- a/libs/widgets/KoRulerController_p.h
+++ b/libs/widgets/KoRulerController_p.h
@@ -26,7 +26,7 @@
#include <KoCanvasResourceManager.h>
#include <KoTextDocument.h>
-#include <kdebug.h>
+#include <WidgetsDebug.h>
#include <QVariant>
#include <QTextOption>
@@ -143,7 +143,7 @@ public:
currentTabIndex = tabList.count();
tabList << currentTab;
} else {
- kWarning(32500) << "Unexpected input from tabChanged signal";
+ warnWidgets << "Unexpected input from tabChanged signal";
Q_ASSERT(false);
return;
}
diff --git a/libs/widgets/KoSliderCombo.cpp b/libs/widgets/KoSliderCombo.cpp
index d7c714e..f3d7873 100644
--- a/libs/widgets/KoSliderCombo.cpp
+++ b/libs/widgets/KoSliderCombo.cpp
@@ -35,9 +35,9 @@
#include <QDoubleSpinBox>
#include <QDesktopWidget>
-#include <kglobal.h>
+
#include <klocalizedstring.h>
-#include <kdebug.h>
+#include <WidgetsDebug.h>
KoSliderCombo::KoSliderCombo(QWidget *parent)
: QComboBox(parent)
diff --git a/libs/widgets/KoSliderCombo_p.h b/libs/widgets/KoSliderCombo_p.h
index 589b4fd..93e010c 100644
--- a/libs/widgets/KoSliderCombo_p.h
+++ b/libs/widgets/KoSliderCombo_p.h
@@ -38,7 +38,7 @@
#include <QDesktopWidget>
#include <klocalizedstring.h>
-#include <kdebug.h>
+#include <WidgetsDebug.h>
class KoSliderComboContainer : public QMenu
{
diff --git a/libs/widgets/KoToolBox.cpp b/libs/widgets/KoToolBox.cpp
index 17bb0ee..dc734f3 100644
--- a/libs/widgets/KoToolBox.cpp
+++ b/libs/widgets/KoToolBox.cpp
@@ -35,9 +35,9 @@
#include <QAction>
#include <klocalizedstring.h>
-#include <kdebug.h>
+#include <WidgetsDebug.h>
#include <kconfiggroup.h>
-#include <kglobal.h>
+#include <ksharedconfig.h>
#include <KoCanvasController.h>
#include <KoShapeLayer.h>
@@ -171,7 +171,7 @@ void KoToolBox::setActiveTool(KoCanvasController *canvas, int id)
button->setChecked(true);
}
else {
- kWarning(30004) << "KoToolBox::setActiveTool(" << id << "): no such button found";
+ warnWidgets << "KoToolBox::setActiveTool(" << id << "): no such button found";
}
}
diff --git a/libs/widgets/KoToolBoxLayout_p.h b/libs/widgets/KoToolBoxLayout_p.h
index c71ab46..9814678 100644
--- a/libs/widgets/KoToolBoxLayout_p.h
+++ b/libs/widgets/KoToolBoxLayout_p.h
@@ -21,7 +21,7 @@
#ifndef _KO_TOOLBOX_LAYOUT_H_
#define _KO_TOOLBOX_LAYOUT_H_
-#include <kdebug.h>
+#include <WidgetsDebug.h>
#include <QLayout>
#include <QMap>
#include <QRect>
diff --git a/libs/widgets/KoToolDocker.cpp b/libs/widgets/KoToolDocker.cpp
index e56d6d4..14c03a1 100644
--- a/libs/widgets/KoToolDocker.cpp
+++ b/libs/widgets/KoToolDocker.cpp
@@ -26,11 +26,10 @@
#include <KoIcon.h>
#include <klocalizedstring.h>
-#include <kdebug.h>
-#include <QIcon>
#include <kconfiggroup.h>
-#include <kglobal.h>
+#include <ksharedconfig.h>
+#include <QIcon>
#include <QApplication>
#include <QPointer>
#include <QGridLayout>
@@ -43,6 +42,7 @@
#include <QToolButton>
#include <QTabWidget>
+#include <WidgetsDebug.h>
class Q_DECL_HIDDEN KoToolDocker::Private
{
diff --git a/libs/widgets/KoUnitDoubleSpinBox.cpp b/libs/widgets/KoUnitDoubleSpinBox.cpp
index e80e9ea..d5e018e 100644
--- a/libs/widgets/KoUnitDoubleSpinBox.cpp
+++ b/libs/widgets/KoUnitDoubleSpinBox.cpp
@@ -23,8 +23,8 @@
#include <KoUnit.h>
-#include <kdebug.h>
-#include <kglobal.h>
+#include <WidgetsDebug.h>
+
#include <klocalizedstring.h>
#ifdef Q_OS_WIN
@@ -74,7 +74,7 @@ KoUnitDoubleSpinBox::~KoUnitDoubleSpinBox()
QValidator::State KoUnitDoubleSpinBox::validate(QString &input, int &pos) const
{
#ifdef DEBUG_VALIDATOR
- kDebug(30004) <<"KoUnitDoubleSpinBox::validate :" << input <<" at" << pos;
+ debugWidgets <<"KoUnitDoubleSpinBox::validate :" << input <<" at" << pos;
#else
Q_UNUSED(pos);
#endif
@@ -86,7 +86,7 @@ QValidator::State KoUnitDoubleSpinBox::validate(QString &input, int &pos) const
{
// Nothing like an unit? The user is probably editing the unit
#ifdef DEBUG_VALIDATOR
- kDebug(30004) <<"Intermediate (no unit)";
+ debugWidgets <<"Intermediate (no unit)";
#endif
return QValidator::Intermediate;
}
@@ -96,7 +96,7 @@ QValidator::State KoUnitDoubleSpinBox::validate(QString &input, int &pos) const
const QString unitName ( regexp.cap( 1 ).trimmed().toLower() );
#ifdef DEBUG_VALIDATOR
- kDebug(30004) <<"Split:" << number <<":" << unitName <<":";
+ debugWidgets <<"Split:" << number <<":" << unitName <<":";
#endif
const double value = valueFromText( number );
@@ -110,14 +110,14 @@ QValidator::State KoUnitDoubleSpinBox::validate(QString &input, int &pos) const
{
// Probably the user is trying to edit the unit
#ifdef DEBUG_VALIDATOR
- kDebug(30004) <<"Intermediate (unknown unit)";
+ debugWidgets <<"Intermediate (unknown unit)";
#endif
return QValidator::Intermediate;
}
}
else
{
- kWarning(30004) << "Not a number: " << number;
+ warnWidgets << "Not a number: " << number;
return QValidator::Invalid;
}
newVal = KoUnit::ptToUnit( newVal, d->unit );
@@ -197,7 +197,7 @@ void KoUnitDoubleSpinBox::setMinMaxStep( double min, double max, double step )
QString KoUnitDoubleSpinBox::textFromValue( double value ) const
{
- //kDebug(30004) <<"textFromValue:" << QString::number( value, 'f', 12 ) <<" =>" << num;
+ //debugWidgets <<"textFromValue:" << QString::number( value, 'f', 12 ) <<" =>" << num;
//const QString num(QString("%1%2").arg(QLocale().toString(value, d->precision ), m_unit.symbol()));
//const QString num ( QString( "%1").arg( QLocale().toString( value, d->precision )) );
return QLocale().toString( value, decimals() );
@@ -217,9 +217,9 @@ double KoUnitDoubleSpinBox::valueFromText( const QString& str ) const
// const double dbl = KGlobal::locale()->readNumber( str2, &ok );
//#ifdef DEBUG_VALUEFROMTEXT
// if ( ok )
-// kDebug(30004) <<"valueFromText:" << str <<": => :" << str2 <<": =>" << QString::number( dbl, 'f', 12 );
+// debugWidgets <<"valueFromText:" << str <<": => :" << str2 <<": =>" << QString::number( dbl, 'f', 12 );
// else
-// kWarning(30004) << "valueFromText error:" << str << ": => :" << str2 << ":";
+// warnWidgets << "valueFromText error:" << str << ": => :" << str2 << ":";
//#endif
// return dbl;
}
diff --git a/libs/widgets/KoZoomAction.cpp b/libs/widgets/KoZoomAction.cpp
index 39aa6b0..52713c9 100644
--- a/libs/widgets/KoZoomAction.cpp
+++ b/libs/widgets/KoZoomAction.cpp
@@ -38,9 +38,9 @@
#include <QButtonGroup>
#include <QComboBox>
-#include <kglobal.h>
+
#include <klocalizedstring.h>
-#include <kdebug.h>
+#include <WidgetsDebug.h>
#include <math.h>
diff --git a/libs/widgets/KoZoomController.cpp b/libs/widgets/KoZoomController.cpp
index 7b81a4f..9ec9a9c 100644
--- a/libs/widgets/KoZoomController.cpp
+++ b/libs/widgets/KoZoomController.cpp
@@ -25,7 +25,7 @@
#include <kactioncollection.h>
#include <klocalizedstring.h>
-#include <kdebug.h>
+#include <WidgetsDebug.h>
#include <KoZoomHandler.h>
#include <KoCanvasBase.h>
@@ -198,9 +198,9 @@ void KoZoomController::setZoom(KoZoomMode::Mode mode, qreal zoom, qreal resoluti
#ifdef DEBUG
if(! d->documentSize.isValid())
- kWarning(30004) << "Setting zoom while there is no document size set, this will fail";
+ warnWidgets << "Setting zoom while there is no document size set, this will fail";
else if (d->pageSize.width() > d->documentSize.width() || d->pageSize.height() > d->documentSize.height())
- kWarning(30004) << "ZoomController; Your page size is larger than your document size (" <<
+ warnWidgets << "ZoomController; Your page size is larger than your document size (" <<
d->pageSize << " > " << d->documentSize << ")\n";
#endif
diff --git a/libs/widgets/KoZoomController_p.h b/libs/widgets/KoZoomController_p.h
index b88c18b..088a7bc 100644
--- a/libs/widgets/KoZoomController_p.h
+++ b/libs/widgets/KoZoomController_p.h
@@ -26,7 +26,7 @@
#include <KoZoomController.h>
#include <klocalizedstring.h>
-#include <kdebug.h>
+#include <WidgetsDebug.h>
#include <KoZoomHandler.h>
#include <KoCanvasBase.h>
diff --git a/libs/widgets/KoZoomHandler.cpp b/libs/widgets/KoZoomHandler.cpp
index 13eb9d8..44aa647 100644
--- a/libs/widgets/KoZoomHandler.cpp
+++ b/libs/widgets/KoZoomHandler.cpp
@@ -20,7 +20,7 @@
*/
#include "KoZoomHandler.h"
-#include <kdebug.h>
+#include <WidgetsDebug.h>
#include <KoUnit.h> // for POINT_TO_INCH
#include <KoDpi.h>
#include <QPointF>
diff --git a/libs/widgets/KoZoomInput.cpp b/libs/widgets/KoZoomInput.cpp
index d6c27f5..1e38461 100644
--- a/libs/widgets/KoZoomInput.cpp
+++ b/libs/widgets/KoZoomInput.cpp
@@ -18,7 +18,7 @@
#include "KoZoomInput.h"
-#include <kdebug.h>
+#include <WidgetsDebug.h>
#include <klocalizedstring.h>
#include <QComboBox>
diff --git a/libs/widgets/tests/zoomcontroller_test.cpp b/libs/widgets/WidgetsDebug.cpp
similarity index 57%
copy from libs/widgets/tests/zoomcontroller_test.cpp
copy to libs/widgets/WidgetsDebug.cpp
index f752d55..1124ddf 100644
--- a/libs/widgets/tests/zoomcontroller_test.cpp
+++ b/libs/widgets/WidgetsDebug.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007-2010 Boudewijn Rempt <boud at valdyas.org>
+ * Copyright (c) 2015 Boudewijn Rempt <boud at valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,24 +16,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#include "zoomcontroller_test.h"
+#include "WidgetsDebug.h"
-#include <QTest>
-#include <QCoreApplication>
-
-#include <kactioncollection.h>
-#include <kdebug.h>
-
-#include "KoCanvasControllerWidget.h"
-#include "KoZoomHandler.h"
-#include "KoZoomController.h"
-
-void zoomcontroller_test::testApi()
+const QLoggingCategory &WIDGETS_LOG() \
{
- KoZoomHandler zoomHandler;
- KoZoomController zoomController(new KoCanvasControllerWidget(0), &zoomHandler, new KActionCollection(this), KoZoomAction::AspectMode);
- Q_UNUSED(zoomController);
-
+ static const QLoggingCategory category("calligra.lib.widgets");
+ return category;
}
-QTEST_MAIN(zoomcontroller_test)
+
diff --git a/libs/widgets/tests/zoomcontroller_test.cpp b/libs/widgets/WidgetsDebug.h
similarity index 56%
copy from libs/widgets/tests/zoomcontroller_test.cpp
copy to libs/widgets/WidgetsDebug.h
index f752d55..9348da8 100644
--- a/libs/widgets/tests/zoomcontroller_test.cpp
+++ b/libs/widgets/WidgetsDebug.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007-2010 Boudewijn Rempt <boud at valdyas.org>
+ * Copyright (c) 2015 Boudewijn Rempt <boud at valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -15,25 +15,17 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+#ifndef WIDGETS_DEBUG_H_
+#define WIDGETS_DEBUG_H_
-#include "zoomcontroller_test.h"
+#include <QDebug>
+#include <QLoggingCategory>
+#include <kowidgets_export.h>
-#include <QTest>
-#include <QCoreApplication>
+extern const KOWIDGETS_EXPORT QLoggingCategory &WIDGETS_LOG();
-#include <kactioncollection.h>
-#include <kdebug.h>
+#define debugWidgets qCDebug(WIDGETS_LOG)
+#define warnWidgets qCWarning(WIDGETS_LOG)
+#define errorWidgets qCCritical(WIDGETS_LOG)
-#include "KoCanvasControllerWidget.h"
-#include "KoZoomHandler.h"
-#include "KoZoomController.h"
-
-void zoomcontroller_test::testApi()
-{
- KoZoomHandler zoomHandler;
- KoZoomController zoomController(new KoCanvasControllerWidget(0), &zoomHandler, new KActionCollection(this), KoZoomAction::AspectMode);
- Q_UNUSED(zoomController);
-
-}
-
-QTEST_MAIN(zoomcontroller_test)
+#endif
diff --git a/libs/widgets/tests/KoResourceTaggingTest.cpp b/libs/widgets/tests/KoResourceTaggingTest.cpp
index d4a1cc2..1354c74 100644
--- a/libs/widgets/tests/KoResourceTaggingTest.cpp
+++ b/libs/widgets/tests/KoResourceTaggingTest.cpp
@@ -22,7 +22,7 @@
#include <QCoreApplication>
#include <kactioncollection.h>
-#include <kdebug.h>
+#include <WidgetsDebug.h>
#include "KoResource.h"
#include "KoResourceServerProvider.h"
diff --git a/libs/widgets/tests/zoomcontroller_test.cpp b/libs/widgets/tests/zoomcontroller_test.cpp
index f752d55..23fe2e3 100644
--- a/libs/widgets/tests/zoomcontroller_test.cpp
+++ b/libs/widgets/tests/zoomcontroller_test.cpp
@@ -22,7 +22,7 @@
#include <QCoreApplication>
#include <kactioncollection.h>
-#include <kdebug.h>
+#include <WidgetsDebug.h>
#include "KoCanvasControllerWidget.h"
#include "KoZoomHandler.h"
diff --git a/libs/widgets/tests/zoomhandler_test.cpp b/libs/widgets/tests/zoomhandler_test.cpp
index 8e2b362..e4dc0c2 100644
--- a/libs/widgets/tests/zoomhandler_test.cpp
+++ b/libs/widgets/tests/zoomhandler_test.cpp
@@ -21,7 +21,7 @@
#include <QTest>
#include <QCoreApplication>
-#include <kdebug.h>
+#include <WidgetsDebug.h>
#include "KoZoomHandler.h"
#include "KoDpi.h"
More information about the calligra-devel
mailing list