Commit e9a77ef1 authored by Luigi Toscano's avatar Luigi Toscano

Merge remote-tracking branch 'origin/frameworks'

parents 1ed46a9d bc247307
project(kmousetool)
find_package(KDE4 REQUIRED)
include (KDE4Defaults)
include (MacroLibrary)
cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR)
set (QT_MIN_VERSION "5.3.0")
find_package (ECM 1.3.0 REQUIRED NO_MODULE)
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
include(CheckIncludeFiles)
include(KDEInstallDirs)
include(ECMInstallIcons)
include(KDECMakeSettings)
include(KDECompilerSettings)
include(FeatureSummary)
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Core Gui Widgets)
find_package (KF5 REQUIRED
DBusAddons
DocTools
I18n
IconThemes
Notifications
XmlGui
)
find_package(Phonon4Qt5 REQUIRED NO_MODULE)
add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
add_definitions( -DQT_NO_CAST_FROM_ASCII )
add_definitions( -DQT_NO_CAST_TO_ASCII )
add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES})
if(Q_WS_X11)
macro_log_feature(X11_XTest_FOUND "libXtst" "X11 Testing Resource extension library" "http://xorg.freedesktop.org" TRUE "" "Needed to build kmousetool.")
include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR})
if(X11_XTest_FOUND)
find_package(X11 REQUIRED)
if(X11_XTest_FOUND)
add_subdirectory( doc )
add_subdirectory( kmousetool )
endif(X11_XTest_FOUND)
else(Q_WS_X11)
message(FATAL_ERROR "kmousetool needs an X11-based system.")
endif(Q_WS_X11)
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
macro_display_feature_log()
endif(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
endif(X11_XTest_FOUND)
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
......@@ -29,7 +29,9 @@ MouseTool Options:
with Smart Drag, but as of version 0.8, the latency is too high.
By the time you hear the click, you're doing something else.
This will be fixed in the next version.
Start with KDE -- When this is enabled, MouseTool will start each time KDE starts.
Start with desktop session
-- When this is enabled, MouseTool will start each time the desktop session
starts.
Enable Strokes -- When this is enabled, you can generate right- or double-clicks
using mouse strokes.
......
########### install files ###############
#
kde4_create_handbook(index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en SUBDIR kmousetool)
kde4_create_manpage(man-kmousetool.1.docbook 1 INSTALL_DESTINATION ${MAN_INSTALL_DIR})
kdoctools_create_handbook(index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en SUBDIR kmousetool)
kdoctools_create_manpage(man-kmousetool.1.docbook 1 INSTALL_DESTINATION ${MAN_INSTALL_DIR})
<?xml version="1.0" ?>
<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.2-Based Variant V1.1//EN" "dtd/kdex.dtd" [
<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.5-Based Variant V1.1//EN" "dtd/kdedbx45.dtd" [
<!ENTITY kmousetool '<application>KMouseTool</application>'>
<!ENTITY kappname "&kmousetool;">
<!ENTITY package "kdeaccessibility">
......@@ -172,15 +172,11 @@ can be modified afterwards.)
</listitem>
</varlistentry>
<varlistentry>
<term><guilabel>Start with KDE</guilabel>
<term><guilabel>Start with desktop session</guilabel>
</term>
<listitem>
<para>When this is enabled, &kmousetool; will start each
time &kde; starts. At the moment, this only works under
&kde;. Under GNOME or other Window Managers, see the
documentation for the Window Manager itself to see how to
start a program automatically when you start the windowing
system.</para>
time the session of the desktop starts.</para>
</listitem>
</varlistentry>
<varlistentry>
......
<?xml version="1.0" ?>
<!DOCTYPE refentry PUBLIC "-//KDE//DTD DocBook XML V4.2-Based Variant V1.1//EN" "dtd/kdex.dtd" [
<!DOCTYPE refentry PUBLIC "-//KDE//DTD DocBook XML V4.5-Based Variant V1.1//EN" "dtd/kdedbx45.dtd" [
<!ENTITY kmousetool '<application>KMouseTool</application>'>
<!ENTITY % English "INCLUDE">
]>
......
......@@ -6,19 +6,33 @@ add_subdirectory( pics )
########### next target ###############
include_directories(${PHONON_INCLUDE_DIR} ${X11_INCLUDE_DIR})
set(kmousetool_SRCS mtstroke.cpp kmousetool.cpp main.cpp )
kde4_add_ui_files(kmousetool_SRCS kmousetoolui.ui )
ki18n_wrap_ui(kmousetool_SRCS kmousetoolui.ui )
kde4_add_executable(kmousetool ${kmousetool_SRCS})
add_executable(kmousetool ${kmousetool_SRCS})
target_link_libraries(kmousetool ${KDE4_KDEUI_LIBS} ${KDE4_PHONON_LIBS} ${X11_XTest_LIB} ${X11_Xext_LIB} ${X11_LIBRARIES})
target_link_libraries(kmousetool
Qt5::Core
Qt5::Gui
Qt5::Widgets
${PHONON_LIBRARIES}
KF5::DBusAddons
KF5::I18n
KF5::IconThemes
KF5::Notifications
KF5::XmlGui
${X11_XTest_LIB}
${X11_Xext_LIB}
${X11_LIBRARIES})
install(TARGETS kmousetool ${INSTALL_TARGETS_DEFAULT_ARGS} )
########### install files ###############
install( PROGRAMS kmousetool.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} )
install( PROGRAMS org.kde.kmousetool.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} )
install( FILES mousetool_tap.wav DESTINATION ${DATA_INSTALL_DIR}/kmousetool/sounds )
This diff is collapsed.
......@@ -22,10 +22,10 @@
#ifndef KMOUSETOOL_H
#define KMOUSETOOL_H
#include <QtCore/QDir>
#include <QtGui/QLabel>
#include <QtCore/QTimerEvent>
#include <QtGui/QWidget>
#include <QDir>
#include <QLabel>
#include <QTimerEvent>
#include <QWidget>
#include "version.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
......@@ -174,7 +174,7 @@ public:
* current mouse position to its previous position to see
* whether to send a down click, and up click, or wait.
*/
void timerEvent (QTimerEvent *e);
void timerEvent (QTimerEvent *e) Q_DECL_OVERRIDE;
/**
* This generates a normal click event --
......
This diff is collapsed.
......@@ -17,51 +17,59 @@
* *
***************************************************************************/
#include <kcmdlineargs.h>
#include <kaboutdata.h>
#include <klocale.h>
#include <kstandarddirs.h>
#include <kuniqueapplication.h>
#include <QtDBus/QtDBus>
#include <QtGui/QMessageBox>
#include <kconfig.h>
#include <kglobal.h>
#include "kmousetool.h"
#include <KAboutData>
#include <KConfigGroup>
#include <KDBusService>
#include <KLocalizedString>
#include <KSharedConfig>
#include <QCommandLineParser>
static const char description[] = I18N_NOOP("KMouseTool");
// INSERT A DESCRIPTION FOR YOUR APPLICATION HERE
int main(int argc, char *argv[])
{
KAboutData aboutData( "kmousetool", 0, ki18n("KMouseTool"),
KMOUSETOOL_VERSION, ki18n(description), KAboutData::License_GPL,
ki18n("(c) 2002-2003, Jeff Roush\n(c) 2003, Gunnar Schmidt"), KLocalizedString(), "http://www.mousetool.com", "gunnar@schmi-dt.de");
QApplication::setApplicationName(QStringLiteral("kmousetool"));
QApplication::setApplicationVersion(QStringLiteral(KMOUSETOOL_VERSION));
QApplication::setOrganizationDomain(QStringLiteral("kde.org"));
KLocalizedString::setApplicationDomain("kmousetool");
QApplication::setApplicationDisplayName(i18n("kmousetool"));
QApplication app(argc, argv);
aboutData.addAuthor(ki18n("Gunnar Schmidt"), ki18n("Current maintainer"), "gunnar@schmi-dt.de", "http://www.schmi-dt.de");
aboutData.addAuthor(ki18n("Olaf Schmidt"), ki18n("Usability improvements"), "ojschmidt@kde.org");
aboutData.addAuthor(ki18n("Jeff Roush"), ki18n("Original author"), "jeff@mousetool.com", "http://www.mousetool.com");
KAboutData aboutData(QStringLiteral("kmousetool"),
i18n("KMouseTool"),
QStringLiteral(KMOUSETOOL_VERSION),
i18n(description),
KAboutLicense::GPL,
i18n("(c) 2002-2003, Jeff Roush\n(c) 2003, Gunnar Schmidt"),
QString(),
QStringLiteral("http://www.mousetool.com"),
QStringLiteral("gunnar@schmi-dt.de"));
aboutData.addCredit(ki18n("Joe Betts"));
aboutData.setOrganizationDomain("kde.org");
KCmdLineArgs::init( argc, argv, &aboutData );
aboutData.addAuthor(i18n("Gunnar Schmidt"), i18n("Current maintainer"), QStringLiteral("gunnar@schmi-dt.de"), QStringLiteral("http://www.schmi-dt.de"));
aboutData.addAuthor(i18n("Olaf Schmidt"), i18n("Usability improvements"), QStringLiteral("ojschmidt@kde.org"));
aboutData.addAuthor(i18n("Jeff Roush"), i18n("Original author"), QStringLiteral("jeff@mousetool.com"), QStringLiteral("http://www.mousetool.com"));
KCmdLineOptions options;
KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
KUniqueApplication::addCmdLineOptions();
KUniqueApplication::setApplicationName(QLatin1String( "kmousetool" ));
aboutData.addCredit(i18n("Joe Betts"));
aboutData.setOrganizationDomain("kde.org");
QCommandLineParser parser;
KAboutData::setApplicationData(aboutData);
parser.addVersionOption();
parser.addHelpOption();
//PORTING SCRIPT: adapt aboutdata variable if necessary
aboutData.setupCommandLine(&parser);
parser.process(app);
aboutData.processCommandLine(&parser);
if (!KUniqueApplication::start()) {
fprintf(stderr, "KMouseTool is already running !\n");
exit(0);
}
KUniqueApplication a;
KDBusService service(KDBusService::Unique, &app);
KMouseTool *kmousetool = new KMouseTool();
if (!KGlobal::config()->group("UserOptions").readEntry("IsMinimized", false))
if (!KSharedConfig::openConfig()->group("UserOptions").readEntry("IsMinimized", false))
kmousetool->show();
return a.exec();
return app.exec();
}
......@@ -22,10 +22,11 @@
#include <iostream>
// these are for locating the stroke information file
#include <kstandarddirs.h>
// #include <string>
#include <QStandardPaths>
using namespace std;
......@@ -187,7 +188,7 @@ void MTStroke::getExtent()
bool MTStroke::readSequence()
{
QString strokefilename;
strokefilename = KStandardDirs::locate("config", QLatin1String( "kmousetool_strokes.txt" ) );
strokefilename = QStandardPaths::locate(QStandardPaths::ConfigLocation, QStringLiteral( "kmousetool_strokes.txt" ) );
if (strokefilename.isEmpty()) {
// make default
if (sequenceMap.size()==0)
......@@ -195,7 +196,7 @@ bool MTStroke::readSequence()
writeSequence();
return false;
}
ifstream infile (strokefilename.toAscii().constData());
ifstream infile (strokefilename.toLatin1().constData());
if (!infile) {
// make default
if (sequenceMap.size()==0)
......@@ -223,9 +224,9 @@ bool MTStroke::readSequence()
bool MTStroke::writeSequence()
{
QString strokefilename;
strokefilename = KStandardDirs::locateLocal("config", QLatin1String( "kmousetool_strokes.txt" ));
strokefilename = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QLatin1String("/kmousetool_strokes.txt" );
ofstream outfile (strokefilename.toAscii(), ios::out);
ofstream outfile (strokefilename.toLatin1(), ios::out);
if (!outfile) {
return false;
}
......
# KDE Config File
[Desktop Entry]
Type=Application
Exec=kmousetool -caption %c %i
Exec=kmousetool -qwindowtitle %c
Icon=kmousetool
X-DocPath=kmousetool/index.html
Comment=Clicks the mouse for you, reducing the effects of RSI
......@@ -218,4 +217,5 @@ GenericName[x-test]=xxAutomatic Mouse Clickxx
GenericName[zh_CN]=自动鼠标点击
GenericName[zh_TW]=自動滑鼠點擊
Categories=Qt;KDE;Utility;Accessibility;
X-DBUS-ServiceName=org.kde.kmousetool
kde4_install_icons( ${ICON_INSTALL_DIR} )
ecm_install_icons(ICONS
16-actions-kmousetool_off.png
16-actions-kmousetool_on.png
16-apps-kmousetool.png
32-actions-kmousetool_off.png
32-actions-kmousetool_on.png
32-apps-kmousetool.png
DESTINATION ${ICON_INSTALL_DIR}
THEME hicolor
)
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