Commit 3378890d authored by Laurent Montel's avatar Laurent Montel 😁

improve++

parent 3f4b6c49
......@@ -9,7 +9,8 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_D
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Widgets Test)
find_package(KF5 REQUIRED COMPONENTS
CoreAddons
Config
Config
ConfigWidgets
DBusAddons
I18n
GuiAddons
......
......@@ -10,6 +10,7 @@ macro(add_unittest _source _additionalsource)
Qt5::Test
KF5::I18n
Qt5::Widgets
KF5::ConfigCore
)
endmacro ()
......@@ -17,4 +18,3 @@ add_unittest( kdebugsettingsdialogtest.cpp "../src/kdebugsettingsdialog.cpp")
add_unittest( kdeapplicationdebugsettingpagetest.cpp "../src/kdeapplicationdebugsettingpage.cpp")
add_unittest( customdebugsettingspagetest.cpp "../src/customdebugsettingspage.cpp")
add_unittest( kdeapplicationlistwidgettest.cpp "../src/kdeapplicationlistwidget.cpp")
......@@ -21,6 +21,7 @@
#include "kdeapplicationdebugsettingpagetest.h"
#include "../src/kdeapplicationdebugsettingpage.h"
#include <qlistwidget.h>
#include <qpushbutton.h>
#include <qtest.h>
KDeApplicationDebugSettingPageTest::KDeApplicationDebugSettingPageTest(QObject *parent)
......@@ -39,6 +40,12 @@ void KDeApplicationDebugSettingPageTest::shouldHaveDefaultValue()
KDeApplicationDebugSettingPage page;
QListWidget *listWidget = page.findChild<QListWidget *>(QStringLiteral("listwidget"));
QVERIFY(listWidget);
QPushButton *selectAll = page.findChild<QPushButton *>(QStringLiteral("selectall"));
QVERIFY(selectAll);
QPushButton *deselectAll = page.findChild<QPushButton *>(QStringLiteral("deselectall"));
QVERIFY(deselectAll);
}
QTEST_MAIN(KDeApplicationDebugSettingPageTest)
......@@ -19,6 +19,7 @@
*/
#include "kdeapplicationlistwidgettest.h"
#include "../src/kdeapplicationlistwidget.h"
#include <qtest.h>
KDeApplicationListWidgetTest::KDeApplicationListWidgetTest(QObject *parent)
......@@ -32,4 +33,10 @@ KDeApplicationListWidgetTest::~KDeApplicationListWidgetTest()
}
void KDeApplicationListWidgetTest::shouldHaveDefaultValue()
{
KDeApplicationListWidget widgetList;
QCOMPARE(widgetList.count(), 0);
}
QTEST_MAIN(KDeApplicationListWidgetTest)
......@@ -29,6 +29,8 @@ class KDeApplicationListWidgetTest : public QObject
public:
explicit KDeApplicationListWidgetTest(QObject *parent = 0);
~KDeApplicationListWidgetTest();
private Q_SLOTS:
void shouldHaveDefaultValue();
};
#endif // KDEAPPLICATIONLISTWIDGETTEST_H
......@@ -7,7 +7,7 @@ set(kdebugsettings_SRCS
add_executable(kdebugsettings ${kdebugsettings_SRCS})
target_link_libraries(kdebugsettings Qt5::Widgets KF5::I18n KF5::DBusAddons KF5::CoreAddons)
target_link_libraries(kdebugsettings Qt5::Widgets KF5::I18n KF5::DBusAddons KF5::CoreAddons KF5::ConfigCore)
install(TARGETS kdebugsettings ${INSTALL_TARGETS_DEFAULT_ARGS} )
......
......@@ -21,6 +21,7 @@
#include "kdeapplicationdebugsettingpage.h"
#include <KLocalizedString>
#include <QListWidget>
#include <QPushButton>
#include <QVBoxLayout>
KDeApplicationDebugSettingPage::KDeApplicationDebugSettingPage(QWidget *parent)
......@@ -33,6 +34,18 @@ KDeApplicationDebugSettingPage::KDeApplicationDebugSettingPage(QWidget *parent)
mListWidget->setObjectName(QStringLiteral("listwidget"));
mainLayout->addWidget(mListWidget);
QHBoxLayout *buttonLayout = new QHBoxLayout;
mainLayout->addLayout(buttonLayout);
mSelectAll = new QPushButton(i18n("Select All"));
mSelectAll->setObjectName(QStringLiteral("selectall"));
buttonLayout->addWidget(mSelectAll);
connect(mSelectAll, &QAbstractButton::clicked, this, &KDeApplicationDebugSettingPage::slotSelectAll);
mDeselectAll = new QPushButton(i18n("Deselect All"));
mDeselectAll->setObjectName(QStringLiteral("deselectall"));
buttonLayout->addWidget(mDeselectAll);
connect(mSelectAll, &QAbstractButton::clicked, this, &KDeApplicationDebugSettingPage::slotDeselectAll);
}
KDeApplicationDebugSettingPage::~KDeApplicationDebugSettingPage()
......@@ -40,3 +53,12 @@ KDeApplicationDebugSettingPage::~KDeApplicationDebugSettingPage()
}
void KDeApplicationDebugSettingPage::slotSelectAll()
{
}
void KDeApplicationDebugSettingPage::slotDeselectAll()
{
}
......@@ -23,14 +23,20 @@
#include <QWidget>
class QListWidget;
class QPushButton;
class KDeApplicationDebugSettingPage : public QWidget
{
Q_OBJECT
public:
explicit KDeApplicationDebugSettingPage(QWidget *parent = Q_NULLPTR);
~KDeApplicationDebugSettingPage();
private slots:
void slotSelectAll();
void slotDeselectAll();
private:
QListWidget *mListWidget;
QPushButton *mSelectAll;
QPushButton *mDeselectAll;
};
#endif // KDEAPPLICATIONDEBUGSETTINGPAGE_H
......@@ -21,6 +21,8 @@
#include "kdebugsettingsdialog.h"
#include <KLocalizedString>
#include <KConfigGroup>
#include <KSharedConfig>
#include <QDialogButtonBox>
#include <QTabWidget>
......@@ -41,10 +43,27 @@ KDebugSettingsDialog::KDebugSettingsDialog(QWidget *parent)
connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
mainLayout->addWidget(buttonBox);
readConfig();
}
KDebugSettingsDialog::~KDebugSettingsDialog()
{
saveConfig();
}
void KDebugSettingsDialog::readConfig()
{
KConfigGroup group(KSharedConfig::openConfig(), "KDebugSettingsDialog");
const QSize size = group.readEntry("Size", QSize(600, 400));
if (size.isValid()) {
resize(size);
}
}
void KDebugSettingsDialog::saveConfig()
{
KConfigGroup group(KSharedConfig::openConfig(), "KDebugSettingsDialog");
group.writeEntry("Size", size());
group.sync();
}
......@@ -31,6 +31,8 @@ public:
explicit KDebugSettingsDialog(QWidget *parent=Q_NULLPTR);
~KDebugSettingsDialog();
private:
void saveConfig();
void readConfig();
QTabWidget *mTabWidget;
};
......
/*
Copyright (c) 2015 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 "kdebugsettingsutil.h"
void KDebugSettingsUtil::readLoggingCategories(const QString &filename)
{
//TODO
}
/*
Copyright (c) 2015 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 KDEBUGSETTINGSUTIL_H
#define KDEBUGSETTINGSUTIL_H
#include <QString>
namespace KDebugSettingsUtil {
void readLoggingCategories(const QString &filename);
}
#endif // KDEBUGSETTINGSUTIL_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