Commit e7230b12 authored by Laurent Montel's avatar Laurent Montel 😁

Start to implement rename categories

parent 24b134a1
......@@ -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")
/*
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)
/*
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
......@@ -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)
......
......@@ -22,6 +22,11 @@
#include "kdebugsettings_debug.h"
#include <QFile>
RenameCategory KDebugSettingsUtil::parseRenameCategories(QString line)
{
return {};
}
KdeLoggingCategory KDebugSettingsUtil::parseLineKdeLoggingCategory(QString line)
{
KdeLoggingCategory category;
......
......@@ -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)
......
/*
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();
}
/*
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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment