Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Utilities
KDebugSettings
Commits
dedaa32a
Commit
dedaa32a
authored
Dec 17, 2020
by
Laurent Montel
😁
Browse files
implement load group
parent
6599b89e
Changes
4
Hide whitespace changes
Inline
Side-by-side
autotests/CMakeLists.txt
View file @
dedaa32a
include_directories
(
${
kdebugsettings_BINARY_DIR
}
/src
${
kdebugsettings_BINARY_DIR
}
)
add_definitions
(
-DKDEBUGSETTINGS_DATA_DIR=
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/data"
)
add_definitions
(
-DKDEBUGSETTINGS_BINARY_DATA_DIR=
"
${
CMAKE_CURRENT_BINARY_DIR
}
/data"
)
# convenience macro to add qtest unit tests
macro
(
add_unittest _source _additionalsource
)
set
(
_test
${
_source
}
${
_additionalsource
}
)
...
...
autotests/kdebugsettingsdialogtest.cpp
View file @
dedaa32a
...
...
@@ -26,6 +26,7 @@
#include <QTabWidget>
#include <QStandardPaths>
#include <QTest>
#include <QToolButton>
KDebugSettingsDialogTest
::
KDebugSettingsDialogTest
(
QObject
*
parent
)
:
QObject
(
parent
)
...
...
@@ -54,8 +55,9 @@ void KDebugSettingsDialogTest::shouldHaveDefaultValue()
}
auto
*
saveAs
=
buttonBox
->
findChild
<
QPushButton
*>
(
QStringLiteral
(
"saveas_button"
));
QVERIFY
(
saveAs
);
auto
*
load
=
buttonBox
->
findChild
<
Q
Push
Button
*>
(
QStringLiteral
(
"load_button"
));
auto
*
load
=
buttonBox
->
findChild
<
Q
Tool
Button
*>
(
QStringLiteral
(
"load_button"
));
QVERIFY
(
load
);
QVERIFY
(
load
->
menu
());
auto
*
insertCategories
=
buttonBox
->
findChild
<
QPushButton
*>
(
QStringLiteral
(
"insert_button"
));
QVERIFY
(
insertCategories
);
auto
*
categoryWarning
=
dlg
.
findChild
<
CategoryWarning
*>
(
QStringLiteral
(
"categorywarning"
));
...
...
src/kdebugsettingsdialog.cpp
View file @
dedaa32a
...
...
@@ -26,11 +26,13 @@
#include "categorywarning.h"
#include "loadcategoriesjob.h"
#include "saverulesjob.h"
#include "loadgroupmenu.h"
#include <KLocalizedString>
#include <KConfigGroup>
#include <KSharedConfig>
#include <KMessageBox>
#include <QToolButton>
#include <QFileDialog>
#include <QDialogButtonBox>
...
...
@@ -75,10 +77,16 @@ KDebugSettingsDialog::KDebugSettingsDialog(QWidget *parent)
buttonBox
->
addButton
(
saveAs
,
QDialogButtonBox
::
ActionRole
);
connect
(
saveAs
,
&
QPushButton
::
clicked
,
this
,
&
KDebugSettingsDialog
::
slotSaveAs
);
QPushButton
*
load
=
new
QPushButton
(
i18n
(
"Load..."
),
this
);
QToolButton
*
load
=
new
QToolButton
(
this
);
load
->
setText
(
i18n
(
"Load..."
));
load
->
setObjectName
(
QStringLiteral
(
"load_button"
));
buttonBox
->
addButton
(
load
,
QDialogButtonBox
::
ActionRole
);
connect
(
load
,
&
QPushButton
::
clicked
,
this
,
&
KDebugSettingsDialog
::
slotLoad
);
connect
(
load
,
&
QToolButton
::
clicked
,
this
,
&
KDebugSettingsDialog
::
slotLoad
);
LoadGroupMenu
*
loadMenu
=
new
LoadGroupMenu
(
this
);
loadMenu
->
setObjectName
(
QStringLiteral
(
"loadMenu"
));
connect
(
loadMenu
,
&
LoadGroupMenu
::
loadGroupRequested
,
this
,
&
KDebugSettingsDialog
::
slotLoadGroup
);
load
->
setMenu
(
loadMenu
);
QPushButton
*
insertCategories
=
new
QPushButton
(
i18n
(
"Insert..."
),
this
);
insertCategories
->
setObjectName
(
QStringLiteral
(
"insert_button"
));
...
...
@@ -117,6 +125,14 @@ void KDebugSettingsDialog::saveConfig()
group
.
sync
();
}
void
KDebugSettingsDialog
::
slotLoadGroup
(
const
QString
&
fullPath
)
{
if
(
!
fullPath
.
isEmpty
())
{
mLoggings
.
readCategoriesFiles
(
fullPath
);
updateLogginsCategories
();
}
}
void
KDebugSettingsDialog
::
readQtLoggingFile
()
{
mLoggings
.
readQtLoggingFile
();
...
...
src/kdebugsettingsdialog.h
View file @
dedaa32a
...
...
@@ -54,6 +54,7 @@ private:
void
saveConfig
();
void
readConfig
();
void
updateLogginsCategories
();
void
slotLoadGroup
(
const
QString
&
fullPath
);
KdeLoggingCategory
::
List
mCategoriesList
;
KDebugSettingsLoadingCategories
mLoggings
;
QTabWidget
*
mTabWidget
=
nullptr
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment