Git commit 9221369a1f0db6d69a3f2b10eb19c334b5455c88 by Jeremy Whiting. Committed on 29/08/2015 at 20:24. Pushed by whiting into branch 'frameworks'. Port away from KGlobal::config(). Port away from KPushButton and KNumInput. Port away from deprecated Phonon api. Use KHelpMenu to show about and manual. M +16 -20 kmousetool/kmousetool.cpp M +2 -2 kmousetool/kmousetool.h M +213 -186 kmousetool/kmousetoolui.ui M +1 -1 kmousetool/main.cpp http://commits.kde.org/kmousetool/9221369a1f0db6d69a3f2b10eb19c334b5455c88 diff --git a/kmousetool/kmousetool.cpp b/kmousetool/kmousetool.cpp index 9c3292d..96495d0 100644 --- a/kmousetool/kmousetool.cpp +++ b/kmousetool/kmousetool.cpp @@ -34,6 +34,7 @@ #include #include = +#include #include #include #include @@ -43,9 +44,7 @@ #include #include #include -#include #include -#include #include #include #include @@ -216,12 +215,12 @@ void KMouseTool::playTickSound() if (!playSound) return; = - mplayer->setCurrentSource(mSoundFileName); + mplayer->setCurrentSource(QUrl::fromLocalFile(mSoundFileName)); mplayer->play(); } = KMouseTool::KMouseTool(QWidget *parent, const char *name) - : QWidget(parent) + : QWidget(parent), helpMenu(new KHelpMenu(NULL)) { setupUi(this); setObjectName( QLatin1String( name )); @@ -237,16 +236,16 @@ KMouseTool::KMouseTool(QWidget *parent, const char *n= ame) connect(cbStart, SIGNAL(stateChanged(int)), this, SLOT(settingsChanged= ())); = connect(buttonStartStop, SIGNAL(clicked()), this, SLOT(startStopSelect= ed())); - buttonDefault->setGuiItem(KStandardGuiItem::defaults()); + KGuiItem::assign(buttonDefault, KStandardGuiItem::defaults()); connect(buttonDefault, SIGNAL(clicked()), this, SLOT(defaultSelected()= )); connect(buttonReset, SIGNAL(clicked()), this, SLOT(resetSelected())); - buttonApply->setGuiItem(KStandardGuiItem::apply()); + KGuiItem::assign(buttonApply, KStandardGuiItem::apply()); connect(buttonApply, SIGNAL(clicked()), this, SLOT(applySelected())); - buttonHelp->setGuiItem(KStandardGuiItem::help()); + KGuiItem::assign(buttonHelp, KStandardGuiItem::help()); connect(buttonHelp, SIGNAL(clicked()), this, SLOT(helpSelected())); - buttonClose->setGuiItem(KStandardGuiItem::close()); + KGuiItem::assign(buttonClose, KStandardGuiItem::close()); connect(buttonClose, SIGNAL(clicked()), this, SLOT(closeSelected())); - buttonQuit->setGuiItem(KStandardGuiItem::quit()); + KGuiItem::assign(buttonQuit, KStandardGuiItem::quit()); connect(buttonQuit, SIGNAL(clicked()), this, SLOT(quitSelected())); = // When we first start, it's nice to not click immediately. @@ -261,8 +260,6 @@ KMouseTool::KMouseTool(QWidget *parent, const char *nam= e) connect(trayIcon, SIGNAL(aboutSelected()), this, SLOT(aboutSelected())= ); connect(trayIcon, SIGNAL(helpSelected()), this, SLOT(helpSelected())); connect(trayIcon, SIGNAL(quitSelected()), this, SLOT(quitSelected())); - -// aboutDlg =3D new KAboutApplicationDialog (KGlobal::mainComponent().a= boutData()); } = KMouseTool::~KMouseTool() @@ -429,7 +426,7 @@ bool KMouseTool::applySettings() // Save options to kmousetoolrc file void KMouseTool::loadOptions() { - KConfigGroup cfg =3D KGlobal::config()->group("UserOptions"); + KConfigGroup cfg =3D KSharedConfig::openConfig()->group("UserOptions"); = playSound =3D cfg.readEntry("AudibleClick", false); smart_drag_on =3D cfg.readEntry("SmartDrag", false); @@ -457,9 +454,9 @@ void KMouseTool::saveOptions() int x =3D p.x(); int y =3D p.y(); = - KConfigGroup cfg =3D KGlobal::config()->group("ProgramOptions"); + KConfigGroup cfg =3D KSharedConfig::openConfig()->group("ProgramOption= s"); cfg.writeEntry("Version", KMOUSETOOL_VERSION); - cfg =3D KGlobal::config()->group("UserOptions"); + cfg =3D KSharedConfig::openConfig()->group("UserOptions"); cfg.writeEntry("x", x); cfg.writeEntry("y", y); cfg.writeEntry("strokesEnabled", strokesEnabled); @@ -540,7 +537,7 @@ void KMouseTool::applySelected() // Buttons at the bottom of the dialog void KMouseTool::helpSelected() { - KHelpClient::invokeHelp(); + helpMenu->appHelpActivated(); } = void KMouseTool::closeSelected() @@ -595,8 +592,7 @@ void KMouseTool::configureSelected() = void KMouseTool::aboutSelected() { -#pragma warning FIXME port to KF5 -// aboutDlg->show(); + helpMenu->aboutApplication(); } = = @@ -608,12 +604,12 @@ KMouseToolTray::KMouseToolTray (QWidget *parent) : KS= tatusNotifierItem(parent) contextMenu()->addSeparator(); QAction* act; act =3D contextMenu()->addAction (i18n("&Configure KMouseTool..."), th= is, SIGNAL(configureSelected())); - act->setIcon(KIcon(QLatin1String( "configure" ))); + act->setIcon(QIcon::fromTheme(QLatin1String( "configure" ))); contextMenu()->addSeparator(); act =3D contextMenu()->addAction (i18n("KMousetool &Handbook"), this, = SIGNAL(helpSelected())); - act->setIcon(KIcon(QLatin1String( "help-contents" ))); + act->setIcon(QIcon::fromTheme(QLatin1String( "help-contents" ))); act =3D contextMenu()->addAction (i18n("&About KMouseTool"), this, SIG= NAL(aboutSelected())); - act->setIcon(KIcon(QLatin1String( "kmousetool" ))); + act->setIcon(QIcon::fromTheme(QLatin1String( "kmousetool" ))); } = KMouseToolTray::~KMouseToolTray() { diff --git a/kmousetool/kmousetool.h b/kmousetool/kmousetool.h index 222ab8d..3a8dbd8 100644 --- a/kmousetool/kmousetool.h +++ b/kmousetool/kmousetool.h @@ -36,7 +36,7 @@ class QLabel; class QAction; class KAudioPlayer; -class KAboutApplicationDialog; +class KHelpMenu; class KMouseToolTray; = namespace Phonon @@ -80,7 +80,7 @@ private: Phonon::MediaObject *mplayer; KMouseToolTray *trayIcon; = - KAboutApplicationDialog *aboutDlg; + KHelpMenu *helpMenu; = /** * Initialize all variables diff --git a/kmousetool/kmousetoolui.ui b/kmousetool/kmousetoolui.ui index e0e2ec3..0427669 100644 --- a/kmousetool/kmousetoolui.ui +++ b/kmousetool/kmousetoolui.ui @@ -1,7 +1,8 @@ - + + KMouseToolUI - - + + 0 0 @@ -9,25 +10,34 @@ 478 - + KMouseTool - - + + 11 - + + 11 + + + 11 + + + 11 + + 6 - + - + Qt::Vertical - + QSizePolicy::Expanding - + 20 30 @@ -35,35 +45,53 @@ - - - + + + Settings - - + + + 11 + + 11 - + + 11 + + + 11 + + 6 - - - + + + + 0 + + + 0 + + + 0 + + 0 - + 6 - + - + Qt::Horizontal - + QSizePolicy::Fixed - + 16 20 @@ -71,152 +99,107 @@ - - - - + + + + 0 0 - - Drag t&ime (1/10 sec): + + &Drag time (1/10 sec): - + dragTimeEdit - - - - - 1 - 0 - - - - 1 - - - 40 - - - 3 - - - - - - - - 1 - 0 - - - - 1 - - - 40 - - - 5 - - - - - - + + + &Minimum movement: - + movementEdit - - - - - 1 - 0 - - - - 1 - - - 40 - - - - - - + + + &Enable strokes - - - - + + + + 0 0 - - D&well time (1/10 sec): + + Dwell &time (1/10 sec): - + dwellTimeEdit - - - + + + Smar&t drag - + true - - - + + + 6 - + + 0 + + + 0 + + + 0 + + 0 - - + + &Defaults - - + + &Reset - + Qt::Horizontal - + QSizePolicy::Expanding - + 31 20 @@ -225,70 +208,133 @@ - - + + &Apply - - - + + + Start with &KDE - - - + + + A&udible click + + + + + 1 + 0 + + + + 1 + + + 40 + + + 3 + + + + + + + + 1 + 0 + + + + 1 + + + 40 + + + 5 + + + + + + + + 1 + 0 + + + + 1 + + + 40 + + + - - - + + + 6 - + + 0 + + + 0 + + + 0 + + 0 - - - + + + 0 0 - + KMouseTool will run as a background application after you = close this dialog. To change the settings again, restart KMouseTool or use = the KDE system tray. - + false - + Qt::AlignJustify|Qt::AlignVCenter - + true - + Qt::Horizontal - + QSizePolicy::Fixed - + 8 8 @@ -297,44 +343,53 @@ - - - + + + 0 0 - + &Start - - - + + + 6 - + + 0 + + + 0 + + + 0 + + 0 - - + + &Help - + Qt::Horizontal - + QSizePolicy::Expanding - + 241 20 @@ -343,15 +398,15 @@ - - + + &Close - - + + &Quit @@ -360,21 +415,9 @@ - - - KIntSpinBox - QSpinBox -
knuminput.h
-
- - KPushButton - QPushButton -
kpushbutton.h
-
-
- knuminput.h - kpushbutton.h + knuminput.h + kpushbutton.h @@ -384,27 +427,11 @@ dragTimeLabel setEnabled(bool) - - 20 - 20 - - - 20 - 20 - - - - - cbDrag - toggled(bool) - dragTimeEdit - setEnabled(bool) - - + 20 20 - + 20 20 diff --git a/kmousetool/main.cpp b/kmousetool/main.cpp index 7a103ad..3115c99 100644 --- a/kmousetool/main.cpp +++ b/kmousetool/main.cpp @@ -59,7 +59,7 @@ int main(int argc, char *argv[]) = KMouseTool *kmousetool =3D new KMouseTool(); = - if (!KGlobal::config()->group("UserOptions").readEntry("IsMinimized", = false)) + if (!KSharedConfig::openConfig()->group("UserOptions").readEntry("IsMi= nimized", false)) kmousetool->show(); = return a.exec();