Commit 56da07c4 authored by Antonio Rojas's avatar Antonio Rojas
Browse files

Port kcm-joystick away from kdelibs4support

parent d7624e78
......@@ -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} )
......
......@@ -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)
: KDialog( parent ),
: QDialog( parent ),
joydev(joy)
{
setObjectName( QStringLiteral("calibrateDialog") );
setModal( true );
setCaption( i18n("Calibration") );
setButtons( Cancel | User1 );
setDefaultButton( User1 );
setButtonGuiItem( User1, KGuiItem( i18n("Next") ) );
setWindowTitle( i18n("Calibration") );
KVBox *main = new KVBox( this );
setMainWidget( main );
QVBoxLayout *main = new QVBoxLayout( 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::slotUser1()
void CalDialog::slotNext()
{
setResult(-2);
}
......
......@@ -23,13 +23,13 @@
#include <QLabel>
#include <KDialog>
#include <QDialog>
class JoyDevice;
// the dialog which tells the user all steps to calibrate the device
class CalDialog : public KDialog
class CalDialog : public QDialog
{
Q_OBJECT
......@@ -42,7 +42,7 @@ class CalDialog : public KDialog
void waitButton(int axis, bool press, int &lastVal);
private Q_SLOTS:
virtual void slotUser1();
virtual void slotNext();
private:
JoyDevice *joydev;
......
......@@ -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::spacingHint());
top->setSpacing(style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
top->addWidget(joyWidget);
}
......
......@@ -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());
......
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