Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
Plasma Desktop
Commits
56da07c4
Commit
56da07c4
authored
Jan 16, 2021
by
Antonio Rojas
Browse files
Port kcm-joystick away from kdelibs4support
parent
d7624e78
Changes
5
Hide whitespace changes
Inline
Side-by-side
kcms/hardware/joystick/CMakeLists.txt
View file @
56da07c4
...
...
@@ -20,7 +20,6 @@ target_link_libraries(kcm_joystick
KF5::KCMUtils
KF5::I18n
KF5::KIOWidgets
KF5::KDELibs4Support
)
install
(
TARGETS kcm_joystick DESTINATION
${
KDE_INSTALL_PLUGINDIR
}
)
...
...
kcms/hardware/joystick/caldialog.cpp
View file @
56da07c4
...
...
@@ -24,31 +24,41 @@
#include
<QTimer>
#include
<QApplication>
#include
<QVBoxLayout>
#include
<QPushButton>
#include
<QDialogButtonBox>
#include
<KLocalizedString>
#include
<KMessageBox>
#include
<KDebug>
#include
<KVBox>
//--------------------------------------------------------------
CalDialog
::
CalDialog
(
QWidget
*
parent
,
JoyDevice
*
joy
)
:
K
Dialog
(
parent
),
:
Q
Dialog
(
parent
),
joydev
(
joy
)
{
setObjectName
(
QStringLiteral
(
"calibrateDialog"
)
);
setModal
(
true
);
setCaption
(
i18n
(
"Calibration"
)
);
setButtons
(
Cancel
|
User1
);
setDefaultButton
(
User1
);
setButtonGuiItem
(
User1
,
KGuiItem
(
i18n
(
"Next"
)
)
);
setWindowTitle
(
i18n
(
"Calibration"
)
);
K
VBox
*
main
=
new
K
VBox
(
this
);
setMainWidget
(
main
);
Q
VBox
Layout
*
main
=
new
Q
VBox
Layout
(
this
);
main
->
setSpacing
(
0
);
text
=
new
QLabel
(
main
);
text
=
new
QLabel
(
this
);
text
->
setMinimumHeight
(
200
);
valueLbl
=
new
QLabel
(
main
);
connect
(
this
,
&
KDialog
::
user1Clicked
,
this
,
&
CalDialog
::
slotUser1
);
valueLbl
=
new
QLabel
(
this
);
main
->
addWidget
(
text
);
main
->
addWidget
(
valueLbl
);
QDialogButtonBox
*
buttonBox
=
new
QDialogButtonBox
(
this
);
buttonBox
->
addButton
(
QDialogButtonBox
::
Cancel
);
QPushButton
*
Next
=
buttonBox
->
addButton
(
i18n
(
"Next"
),
QDialogButtonBox
::
ApplyRole
);
Next
->
setDefault
(
true
);
main
->
addWidget
(
buttonBox
);
setLayout
(
main
);
connect
(
Next
,
&
QPushButton
::
clicked
,
this
,
&
CalDialog
::
slotNext
);
}
//--------------------------------------------------------------
...
...
@@ -187,7 +197,7 @@ void CalDialog::waitButton(int axis, bool press, int &lastVal)
//--------------------------------------------------------------
// Next button
void
CalDialog
::
slot
User1
()
void
CalDialog
::
slot
Next
()
{
setResult
(
-
2
);
}
...
...
kcms/hardware/joystick/caldialog.h
View file @
56da07c4
...
...
@@ -23,13 +23,13 @@
#include
<QLabel>
#include
<
K
Dialog>
#include
<
Q
Dialog>
class
JoyDevice
;
// the dialog which tells the user all steps to calibrate the device
class
CalDialog
:
public
K
Dialog
class
CalDialog
:
public
Q
Dialog
{
Q_OBJECT
...
...
@@ -42,7 +42,7 @@ class CalDialog : public KDialog
void
waitButton
(
int
axis
,
bool
press
,
int
&
lastVal
);
private
Q_SLOTS
:
virtual
void
slot
User1
();
virtual
void
slot
Next
();
private:
JoyDevice
*
joydev
;
...
...
kcms/hardware/joystick/joystick.cpp
View file @
56da07c4
...
...
@@ -24,9 +24,9 @@
#include
"joydevice.h"
#include
<KAboutData>
#include
<KGlobal>
#include
<KLocalizedString>
#include
<KDialog>
#include
<QDialog>
#include
<QStyle>
#include
<stdio.h>
#include
<KPluginFactory>
...
...
@@ -71,7 +71,7 @@ Joystick::Joystick(QWidget *parent, const QVariantList &)
QVBoxLayout
*
top
=
new
QVBoxLayout
(
this
);
top
->
setContentsMargins
(
0
,
0
,
0
,
0
);
top
->
setSpacing
(
KDialog
::
s
pacing
Hint
(
));
top
->
setSpacing
(
style
()
->
pixelMetric
(
QStyle
::
PM_DefaultLayoutS
pacing
));
top
->
addWidget
(
joyWidget
);
}
...
...
kcms/hardware/joystick/joywidget.cpp
View file @
56da07c4
...
...
@@ -32,17 +32,16 @@
#include
<QHBoxLayout>
#include
<QVBoxLayout>
#include
<QHeaderView>
#include
<QApplication>
#include
<QStyle>
#include
<KLocalizedString>
#include
<KDialog>
#include
<KMessageBox>
#include
<KComboBox>
#include
<KUrlCompletion>
#include
<KMessageWidget>
#include
<stdio.h>
#include
<KVBox>
#include
<KDebug>
//--------------------------------------------------------------
static
QString
PRESSED
=
I18N_NOOP
(
"PRESSED"
);
...
...
@@ -65,7 +64,8 @@ JoyWidget::JoyWidget(QWidget *parent)
:
QWidget
(
parent
),
idle
(
nullptr
),
joydev
(
nullptr
)
{
QVBoxLayout
*
mainVbox
=
new
QVBoxLayout
(
this
);
mainVbox
->
setSpacing
(
KDialog
::
spacingHint
());
int
defaultSpacing
=
style
()
->
pixelMetric
(
QStyle
::
PM_DefaultLayoutSpacing
);
mainVbox
->
setSpacing
(
defaultSpacing
);
mainVbox
->
setContentsMargins
(
0
,
0
,
0
,
0
);
// create area to show an icon + message if no joystick was detected
...
...
@@ -80,7 +80,7 @@ JoyWidget::JoyWidget(QWidget *parent)
}
QHBoxLayout
*
devHbox
=
new
QHBoxLayout
;
devHbox
->
setSpacing
(
KDialog
::
spacingHint
()
);
devHbox
->
setSpacing
(
defaultSpacing
);
devHbox
->
addWidget
(
new
QLabel
(
i18n
(
"Device:"
)));
devHbox
->
addWidget
(
device
=
new
KComboBox
(
true
));
...
...
@@ -93,13 +93,13 @@ JoyWidget::JoyWidget(QWidget *parent)
devHbox
->
setStretchFactor
(
device
,
3
);
QHBoxLayout
*
hbox
=
new
QHBoxLayout
;
hbox
->
setSpacing
(
KDialog
::
spacingHint
()
);
hbox
->
setSpacing
(
defaultSpacing
);
mainVbox
->
addLayout
(
devHbox
);
mainVbox
->
addLayout
(
hbox
);
QVBoxLayout
*
vboxLeft
=
new
QVBoxLayout
;
vboxLeft
->
setSpacing
(
KDialog
::
spacingHint
()
);
vboxLeft
->
setSpacing
(
defaultSpacing
);
vboxLeft
->
addWidget
(
new
QLabel
(
i18nc
(
"Cue for deflection of the stick"
,
"Position:"
)));
vboxLeft
->
addWidget
(
xyPos
=
new
PosWidget
);
...
...
@@ -107,10 +107,10 @@ JoyWidget::JoyWidget(QWidget *parent)
connect
(
trace
,
&
QAbstractButton
::
toggled
,
this
,
&
JoyWidget
::
traceChanged
);
QVBoxLayout
*
vboxMid
=
new
QVBoxLayout
;
vboxMid
->
setSpacing
(
KDialog
::
spacingHint
()
);
vboxMid
->
setSpacing
(
defaultSpacing
);
QVBoxLayout
*
vboxRight
=
new
QVBoxLayout
;
vboxRight
->
setSpacing
(
KDialog
::
spacingHint
()
);
vboxRight
->
setSpacing
(
defaultSpacing
);
// calculate the column width we need
QFontMetrics
fm
(
font
());
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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