summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-09-16 13:31:56 (GMT)
committerMontel Laurent <montel@kde.org>2016-09-16 13:31:56 (GMT)
commite7230b12f697f4f638880688f9f0d99dff31d6a9 (patch)
tree2e6af9c4c841fe1f3d7070e99d5587ebb6e58c91
parent24b134a1e27eb2b4d6cabc1a627ed795b04b9df0 (diff)
Start to implement rename categories
-rw-r--r--autotests/CMakeLists.txt2
-rw-r--r--autotests/renamecategorytest.cpp34
-rw-r--r--autotests/renamecategorytest.h34
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/kdebugsettingsutil.cpp5
-rw-r--r--src/kdebugsettingsutil.h4
-rw-r--r--src/renamecategory.cpp31
-rw-r--r--src/renamecategory.h44
8 files changed, 155 insertions, 0 deletions
diff --git a/autotests/CMakeLists.txt b/autotests/CMakeLists.txt
index 952dfa5..5996425 100644
--- a/autotests/CMakeLists.txt
+++ b/autotests/CMakeLists.txt
@@ -17,6 +17,7 @@ set(full_source_file
../src/loggingcategory.cpp
../src/kdeloggingcategory.cpp
../src/loadcategoriesjob.cpp
+ ../src/renamecategory.cpp
${CMAKE_BINARY_DIR}/src/kdebugsettings_debug.cpp
)
@@ -51,3 +52,4 @@ add_unittest( kdeapplicationtreelistwidgettest.cpp "../src/loggingcategory.cpp;.
add_unittest( categorywarningtest.cpp "../src/categorywarning.cpp")
add_unittest( loggingcategorytest.cpp "../src/loggingcategory.cpp")
add_unittest( loadcategoriesjobtest.cpp "../src/loadcategoriesjob.cpp;../src/loggingcategory.cpp;../src/kdeloggingcategory.cpp;../src/kdebugsettings_debug.cpp;../src/kdebugsettingsutil.cpp")
+add_unittest( renamecategorytest.cpp "../src/renamecategory.cpp")
diff --git a/autotests/renamecategorytest.cpp b/autotests/renamecategorytest.cpp
new file mode 100644
index 0000000..b24c751
--- /dev/null
+++ b/autotests/renamecategorytest.cpp
@@ -0,0 +1,34 @@
+/*
+ Copyright (c) 2016 Montel Laurent <montel@kde.org>
+
+ This library is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Library General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or (at your
+ option) any later version.
+
+ This library is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
+ License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+
+*/
+#include "renamecategorytest.h"
+#include <QTest>
+
+RenameCategoryTest::RenameCategoryTest(QObject *parent)
+ : QObject(parent)
+{
+
+}
+
+RenameCategoryTest::~RenameCategoryTest()
+{
+
+}
+
+QTEST_MAIN(RenameCategoryTest)
diff --git a/autotests/renamecategorytest.h b/autotests/renamecategorytest.h
new file mode 100644
index 0000000..8f6f8ce
--- /dev/null
+++ b/autotests/renamecategorytest.h
@@ -0,0 +1,34 @@
+/*
+ Copyright (c) 2016 Montel Laurent <montel@kde.org>
+
+ This library is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Library General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or (at your
+ option) any later version.
+
+ This library is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
+ License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+
+*/
+
+#ifndef RENAMECATEGORYTEST_H
+#define RENAMECATEGORYTEST_H
+
+#include <QObject>
+
+class RenameCategoryTest : public QObject
+{
+ Q_OBJECT
+public:
+ explicit RenameCategoryTest(QObject *parent = Q_NULLPTR);
+ ~RenameCategoryTest();
+};
+
+#endif // RENAMECATEGORYTEST_H
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a98a073..a371943 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -16,6 +16,7 @@ set(kdebugsettings_SRCS
loggingcategory.cpp
kdeloggingcategory.cpp
loadcategoriesjob.cpp
+ renamecategory.cpp
)
ecm_qt_declare_logging_category(kdebugsettings_SRCS HEADER kdebugsettings_debug.h IDENTIFIER KDEBUGSETTINGS_LOG CATEGORY_NAME log_kdebugsettings)
diff --git a/src/kdebugsettingsutil.cpp b/src/kdebugsettingsutil.cpp
index 1b0448b..5c1048f 100644
--- a/src/kdebugsettingsutil.cpp
+++ b/src/kdebugsettingsutil.cpp
@@ -22,6 +22,11 @@
#include "kdebugsettings_debug.h"
#include <QFile>
+RenameCategory KDebugSettingsUtil::parseRenameCategories(QString line)
+{
+ return {};
+}
+
KdeLoggingCategory KDebugSettingsUtil::parseLineKdeLoggingCategory(QString line)
{
KdeLoggingCategory category;
diff --git a/src/kdebugsettingsutil.h b/src/kdebugsettingsutil.h
index f287188..a412605 100644
--- a/src/kdebugsettingsutil.h
+++ b/src/kdebugsettingsutil.h
@@ -26,6 +26,8 @@
#include <QDebug>
#include "kdeloggingcategory.h"
#include "loggingcategory.h"
+#include "renamecategory.h"
+
namespace KDebugSettingsUtil
{
@@ -107,6 +109,8 @@ KdeLoggingCategory::List readLoggingCategoriesForInserting(const QString &filena
QList<LoadLoggingCategory> readLoggingQtCategories(const QString &filename);
KDebugSettingsUtil::LineLoggingQtCategory parseLineLoggingQtCategory(const QString &line);
+RenameCategory parseRenameCategories(QString line);
+
}
Q_DECLARE_METATYPE(KDebugSettingsUtil::LoadLoggingCategory::LogType)
diff --git a/src/renamecategory.cpp b/src/renamecategory.cpp
new file mode 100644
index 0000000..2c5103b
--- /dev/null
+++ b/src/renamecategory.cpp
@@ -0,0 +1,31 @@
+/*
+ Copyright (c) 2016 Montel Laurent <montel@kde.org>
+
+ This library is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Library General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or (at your
+ option) any later version.
+
+ This library is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
+ License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+
+*/
+
+#include "renamecategory.h"
+
+bool RenameCategory::operator ==(const RenameCategory &other) const
+{
+ return (originalName == other.originalName) && (newName == other.newName);
+}
+
+bool RenameCategory::isValid() const
+{
+ return !originalName.isEmpty() && !newName.isEmpty();
+}
diff --git a/src/renamecategory.h b/src/renamecategory.h
new file mode 100644
index 0000000..f4b70bd
--- /dev/null
+++ b/src/renamecategory.h
@@ -0,0 +1,44 @@
+/*
+ Copyright (c) 2016 Montel Laurent <montel@kde.org>
+
+ This library is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Library General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or (at your
+ option) any later version.
+
+ This library is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
+ License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+
+*/
+#ifndef RENAMECATEGORY_H
+#define RENAMECATEGORY_H
+
+#include <QVector>
+#include <QString>
+#include <QObject>
+
+struct RenameCategory
+{
+public:
+ RenameCategory() {
+
+ }
+
+ typedef QVector<RenameCategory> List;
+ bool operator ==(const RenameCategory &other) const;
+ bool isValid() const;
+
+ QString originalName;
+ QString newName;
+};
+Q_DECLARE_TYPEINFO(RenameCategory, Q_MOVABLE_TYPE);
+Q_DECLARE_METATYPE(RenameCategory)
+
+#endif // RENAMECATEGORY_H