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
d5859753
Commit
d5859753
authored
Dec 18, 2020
by
Laurent Montel
😁
Browse files
Extract load tool button
parent
95f4b6be
Changes
5
Hide whitespace changes
Inline
Side-by-side
autotests/kdebugsettingsdialogtest.cpp
View file @
d5859753
...
...
@@ -19,8 +19,9 @@
*/
#include
"kdebugsettingsdialogtest.h"
#include
"../src/kdebugsettingsdialog.h"
#include
"../src/categorywarning.h"
#include
"kdebugsettingsdialog.h"
#include
"categorywarning.h"
#include
"loadtoolbutton.h"
#include
<QDialogButtonBox>
#include
<QPushButton>
#include
<QTabWidget>
...
...
@@ -55,7 +56,7 @@ void KDebugSettingsDialogTest::shouldHaveDefaultValue()
}
auto
saveAs
=
buttonBox
->
findChild
<
QToolButton
*>
(
QStringLiteral
(
"saveas_button"
));
QVERIFY
(
saveAs
);
auto
load
=
buttonBox
->
findChild
<
Q
ToolButton
*>
(
QStringLiteral
(
"load_button"
));
auto
load
=
buttonBox
->
findChild
<
Load
ToolButton
*>
(
QStringLiteral
(
"load_button"
));
QVERIFY
(
load
);
QVERIFY
(
load
->
menu
());
auto
insertCategories
=
buttonBox
->
findChild
<
QPushButton
*>
(
QStringLiteral
(
"insert_button"
));
...
...
src/CMakeLists.txt
View file @
d5859753
...
...
@@ -26,6 +26,7 @@ set(kdebugsettings_LIB_SRCS
environmentsettingsrulespage.cpp
kdeapplicationtreelistwidget.cpp
categorywarning.cpp
loadtoolbutton.cpp
${
kdebugsettings_debug_SRCS
}
)
...
...
src/kdebugsettingsdialog.cpp
View file @
d5859753
...
...
@@ -26,7 +26,7 @@
#include
"categorywarning.h"
#include
"loadcategoriesjob.h"
#include
"saverulesjob.h"
#include
"load
groupmenu
.h"
#include
"load
toolbutton
.h"
#include
<KLocalizedString>
#include
<KConfigGroup>
...
...
@@ -78,16 +78,12 @@ KDebugSettingsDialog::KDebugSettingsDialog(QWidget *parent)
buttonBox
->
addButton
(
saveAs
,
QDialogButtonBox
::
ActionRole
);
connect
(
saveAs
,
&
QToolButton
::
clicked
,
this
,
&
KDebugSettingsDialog
::
slotSaveAs
);
QToolButton
*
load
=
new
QToolButton
(
this
);
l
oad
->
setText
(
i18n
(
"Load..."
)
);
L
oad
ToolButton
*
load
=
new
LoadToolButton
(
this
);
load
->
setObjectName
(
QStringLiteral
(
"load_button"
));
buttonBox
->
addButton
(
load
,
QDialogButtonBox
::
ActionRole
);
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
);
connect
(
load
,
&
LoadToolButton
::
loadGroupRequested
,
this
,
&
KDebugSettingsDialog
::
slotLoadGroup
);
QPushButton
*
insertCategories
=
new
QPushButton
(
i18n
(
"Insert..."
),
this
);
insertCategories
->
setObjectName
(
QStringLiteral
(
"insert_button"
));
...
...
src/loadtoolbutton.cpp
0 → 100644
View file @
d5859753
/*
Copyright (c) 2020 Laurent Montel <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
"loadgroupmenu.h"
#include
"loadtoolbutton.h"
#include
<KLocalizedString>
LoadToolButton
::
LoadToolButton
(
QWidget
*
parent
)
:
QToolButton
(
parent
)
{
setText
(
i18n
(
"Load..."
));
LoadGroupMenu
*
loadMenu
=
new
LoadGroupMenu
(
this
);
loadMenu
->
setObjectName
(
QStringLiteral
(
"loadMenu"
));
connect
(
loadMenu
,
&
LoadGroupMenu
::
loadGroupRequested
,
this
,
&
LoadToolButton
::
loadGroupRequested
);
setMenu
(
loadMenu
);
}
LoadToolButton
::~
LoadToolButton
()
{
}
src/loadtoolbutton.h
0 → 100644
View file @
d5859753
/*
Copyright (c) 2020 Laurent Montel <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 LOADTOOLBUTTON_H
#define LOADTOOLBUTTON_H
#include
<QToolButton>
#include
"libkdebugsettings_private_export.h"
class
LIBKDEBUGSETTINGS_EXPORT_TEST_EXPORT
LoadToolButton
:
public
QToolButton
{
Q_OBJECT
public:
explicit
LoadToolButton
(
QWidget
*
parent
=
nullptr
);
~
LoadToolButton
()
override
;
Q_SIGNALS:
void
loadGroupRequested
(
const
QString
&
fullPath
);
};
#endif // LOADTOOLBUTTON_H
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