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 ...@@ -20,7 +20,6 @@ target_link_libraries(kcm_joystick
KF5::KCMUtils KF5::KCMUtils
KF5::I18n KF5::I18n
KF5::KIOWidgets KF5::KIOWidgets
KF5::KDELibs4Support
) )
install(TARGETS kcm_joystick DESTINATION ${KDE_INSTALL_PLUGINDIR} ) install(TARGETS kcm_joystick DESTINATION ${KDE_INSTALL_PLUGINDIR} )
......
...@@ -24,31 +24,41 @@ ...@@ -24,31 +24,41 @@
#include <QTimer> #include <QTimer>
#include <QApplication> #include <QApplication>
#include <QVBoxLayout>
#include <QPushButton>
#include <QDialogButtonBox>
#include <KLocalizedString> #include <KLocalizedString>
#include <KMessageBox> #include <KMessageBox>
#include <KDebug>
#include <KVBox>
//-------------------------------------------------------------- //--------------------------------------------------------------
CalDialog::CalDialog(QWidget *parent, JoyDevice *joy) CalDialog::CalDialog(QWidget *parent, JoyDevice *joy)
: KDialog( parent ), : QDialog( parent ),
joydev(joy) joydev(joy)
{ {
setObjectName( QStringLiteral("calibrateDialog") ); setObjectName( QStringLiteral("calibrateDialog") );
setModal( true ); setModal( true );
setCaption( i18n("Calibration") ); setWindowTitle( i18n("Calibration") );
setButtons( Cancel | User1 );
setDefaultButton( User1 );
setButtonGuiItem( User1, KGuiItem( i18n("Next") ) );
KVBox *main = new KVBox( this ); QVBoxLayout *main = new QVBoxLayout( this );
setMainWidget( main ); main->setSpacing(0);
text = new QLabel(main); text = new QLabel( this );
text->setMinimumHeight(200); text->setMinimumHeight(200);
valueLbl = new QLabel(main); valueLbl = new QLabel( this );
connect(this,&KDialog::user1Clicked,this,&CalDialog::slotUser1);
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) ...@@ -187,7 +197,7 @@ void CalDialog::waitButton(int axis, bool press, int &lastVal)
//-------------------------------------------------------------- //--------------------------------------------------------------
// Next button // Next button
void CalDialog::slotUser1() void CalDialog::slotNext()
{ {
setResult(-2); setResult(-2);
} }
......
...@@ -23,13 +23,13 @@ ...@@ -23,13 +23,13 @@
#include <QLabel> #include <QLabel>
#include <KDialog> #include <QDialog>
class JoyDevice; class JoyDevice;
// the dialog which tells the user all steps to calibrate the device // the dialog which tells the user all steps to calibrate the device
class CalDialog : public KDialog class CalDialog : public QDialog
{ {
Q_OBJECT Q_OBJECT
...@@ -42,7 +42,7 @@ class CalDialog : public KDialog ...@@ -42,7 +42,7 @@ class CalDialog : public KDialog
void waitButton(int axis, bool press, int &lastVal); void waitButton(int axis, bool press, int &lastVal);
private Q_SLOTS: private Q_SLOTS:
virtual void slotUser1(); virtual void slotNext();
private: private:
JoyDevice *joydev; JoyDevice *joydev;
......
...@@ -24,9 +24,9 @@ ...@@ -24,9 +24,9 @@
#include "joydevice.h" #include "joydevice.h"
#include <KAboutData> #include <KAboutData>
#include <KGlobal>
#include <KLocalizedString> #include <KLocalizedString>
#include <KDialog> #include <QDialog>
#include <QStyle>
#include <stdio.h> #include <stdio.h>
#include <KPluginFactory> #include <KPluginFactory>
...@@ -71,7 +71,7 @@ Joystick::Joystick(QWidget *parent, const QVariantList &) ...@@ -71,7 +71,7 @@ Joystick::Joystick(QWidget *parent, const QVariantList &)
QVBoxLayout *top = new QVBoxLayout(this); QVBoxLayout *top = new QVBoxLayout(this);
top->setContentsMargins(0, 0, 0, 0); top->setContentsMargins(0, 0, 0, 0);
top->setSpacing(KDialog::spacingHint()); top->setSpacing(style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
top->addWidget(joyWidget); top->addWidget(joyWidget);
} }
......
...@@ -32,17 +32,16 @@ ...@@ -32,17 +32,16 @@
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QHeaderView> #include <QHeaderView>
#include <QApplication>
#include <QStyle>
#include <KLocalizedString> #include <KLocalizedString>
#include <KDialog>
#include <KMessageBox> #include <KMessageBox>
#include <KComboBox> #include <KComboBox>
#include <KUrlCompletion> #include <KUrlCompletion>
#include <KMessageWidget> #include <KMessageWidget>
#include <stdio.h> #include <stdio.h>
#include <KVBox>
#include <KDebug>
//-------------------------------------------------------------- //--------------------------------------------------------------
static QString PRESSED = I18N_NOOP("PRESSED"); static QString PRESSED = I18N_NOOP("PRESSED");
...@@ -65,7 +64,8 @@ JoyWidget::JoyWidget(QWidget *parent) ...@@ -65,7 +64,8 @@ JoyWidget::JoyWidget(QWidget *parent)
: QWidget(parent), idle(nullptr), joydev(nullptr) : QWidget(parent), idle(nullptr), joydev(nullptr)
{ {
QVBoxLayout *mainVbox = new QVBoxLayout(this); 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); mainVbox->setContentsMargins(0, 0, 0, 0);
// create area to show an icon + message if no joystick was detected // create area to show an icon + message if no joystick was detected
...@@ -80,7 +80,7 @@ JoyWidget::JoyWidget(QWidget *parent) ...@@ -80,7 +80,7 @@ JoyWidget::JoyWidget(QWidget *parent)
} }
QHBoxLayout *devHbox = new QHBoxLayout; QHBoxLayout *devHbox = new QHBoxLayout;
devHbox->setSpacing(KDialog::spacingHint()); devHbox->setSpacing(defaultSpacing);
devHbox->addWidget(new QLabel(i18n("Device:"))); devHbox->addWidget(new QLabel(i18n("Device:")));
devHbox->addWidget(device = new KComboBox(true)); devHbox->addWidget(device = new KComboBox(true));
...@@ -93,13 +93,13 @@ JoyWidget::JoyWidget(QWidget *parent) ...@@ -93,13 +93,13 @@ JoyWidget::JoyWidget(QWidget *parent)
devHbox->setStretchFactor(device, 3); devHbox->setStretchFactor(device, 3);
QHBoxLayout *hbox = new QHBoxLayout; QHBoxLayout *hbox = new QHBoxLayout;
hbox->setSpacing(KDialog::spacingHint()); hbox->setSpacing(defaultSpacing);
mainVbox->addLayout(devHbox); mainVbox->addLayout(devHbox);
mainVbox->addLayout(hbox); mainVbox->addLayout(hbox);
QVBoxLayout *vboxLeft = new QVBoxLayout; 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(new QLabel(i18nc("Cue for deflection of the stick", "Position:")));
vboxLeft->addWidget(xyPos = new PosWidget); vboxLeft->addWidget(xyPos = new PosWidget);
...@@ -107,10 +107,10 @@ JoyWidget::JoyWidget(QWidget *parent) ...@@ -107,10 +107,10 @@ JoyWidget::JoyWidget(QWidget *parent)
connect(trace, &QAbstractButton::toggled, this, &JoyWidget::traceChanged); connect(trace, &QAbstractButton::toggled, this, &JoyWidget::traceChanged);
QVBoxLayout *vboxMid = new QVBoxLayout; QVBoxLayout *vboxMid = new QVBoxLayout;
vboxMid->setSpacing(KDialog::spacingHint()); vboxMid->setSpacing(defaultSpacing);
QVBoxLayout *vboxRight = new QVBoxLayout; QVBoxLayout *vboxRight = new QVBoxLayout;
vboxRight->setSpacing(KDialog::spacingHint()); vboxRight->setSpacing(defaultSpacing);
// calculate the column width we need // calculate the column width we need
QFontMetrics fm(font()); 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