From db2c89587cec00966bd8ecfe962019245b4a5ab9 Mon Sep 17 00:00:00 2001 From: Raymond Wagner Date: Mon, 5 Sep 2011 02:39:37 -0400 Subject: [PATCH] Add --[no-]mouse-cursor command line option This adds an option to mythfrontend and mythtv-setup to allow manual selection of whether the mouse cursor is hidden or not. This implements a database option override in the same manner as the --windowed function. This bumps the ABI version. --- .../libmythbase/mythcommandlineparser.cpp | 41 +++++++++++++++---- .../libs/libmythbase/mythcommandlineparser.h | 3 +- mythtv/libs/libmythbase/mythversion.h | 2 +- .../programs/mythavtest/commandlineparser.cpp | 2 +- .../mythfrontend/commandlineparser.cpp | 3 +- .../mythtv-setup/commandlineparser.cpp | 3 +- 6 files changed, 40 insertions(+), 14 deletions(-) diff --git a/mythtv/libs/libmythbase/mythcommandlineparser.cpp b/mythtv/libs/libmythbase/mythcommandlineparser.cpp index 6dc2335746f..ca74c246307 100644 --- a/mythtv/libs/libmythbase/mythcommandlineparser.cpp +++ b/mythtv/libs/libmythbase/mythcommandlineparser.cpp @@ -61,22 +61,32 @@ int GetTermWidth(void) const char* NamedOptType(int type) { - if (type == kEnd) + switch (type) + { + case kEnd: return "kEnd"; - else if (type == kEmpty) + + case kEmpty: return "kEmpty"; - else if (type == kOptOnly) + + case kOptOnly: return "kOptOnly"; - else if (type == kOptVal) + + case kOptVal: return "kOptVal"; - else if (type == kArg) + + case kArg: return "kArg"; - else if (type == kPassthrough) + + case kPassthrough: return "kPassthrough"; - else if (type == kInvalid) + + case kInvalid: return "kInvalid"; - return "kUnknown"; + default: + return "kUnknown"; + } } typedef struct helptmp { @@ -677,6 +687,11 @@ QMap MythCommandLineParser::GetSettingsOverride(void) else if (toBool("notwindowed")) smap["RunFrontendInWindow"] = "0"; + if (toBool("mousecursor")) + smap["HideMouseCursor"] = "0"; + else if (toBool("nomousecursor")) + smap["HideMouseCursor"] = "1"; + m_overridesImported = true; if (!smap.isEmpty()) @@ -909,7 +924,7 @@ void MythCommandLineParser::addVersion(void) "and compiled options."); } -void MythCommandLineParser::addWindowed(bool def) +void MythCommandLineParser::addWindowed(void) { add(QStringList( QStringList() << "-nw" << "--no-windowed" ), "notwindowed", false, @@ -918,6 +933,14 @@ void MythCommandLineParser::addWindowed(bool def) false, "Force application to run in a window.", ""); } +void MythCommandLineParser::addMouse(void) +{ + add("--mouse-cursor", "mousecursor", false, + "Force visibility of the mouse cursor.", ""); + add("--no-mouse-cursor", "nomousecursor", false, + "Force the mouse cursor to be hidden.", ""); +} + void MythCommandLineParser::addDaemon(void) { add(QStringList( QStringList() << "-d" << "--daemon" ), "daemon", false, diff --git a/mythtv/libs/libmythbase/mythcommandlineparser.h b/mythtv/libs/libmythbase/mythcommandlineparser.h index 4f07e6714b9..6856d24f27c 100644 --- a/mythtv/libs/libmythbase/mythcommandlineparser.h +++ b/mythtv/libs/libmythbase/mythcommandlineparser.h @@ -155,7 +155,8 @@ class MBASE_PUBLIC MythCommandLineParser void addHelp(void); void addVersion(void); - void addWindowed(bool); + void addWindowed(void); + void addMouse(void); void addDaemon(void); void addSettingsOverride(void); void addRecording(void); diff --git a/mythtv/libs/libmythbase/mythversion.h b/mythtv/libs/libmythbase/mythversion.h index cdacccc725a..307062f70d0 100644 --- a/mythtv/libs/libmythbase/mythversion.h +++ b/mythtv/libs/libmythbase/mythversion.h @@ -12,7 +12,7 @@ /// Update this whenever the plug-in API changes. /// Including changes in the libmythbase, libmyth, libmythtv, libmythav* and /// libmythui class methods used by plug-ins. -#define MYTH_BINARY_VERSION "0.25.20110829-2" +#define MYTH_BINARY_VERSION "0.25.20110905-1" /** \brief Increment this whenever the MythTV network protocol changes. * diff --git a/mythtv/programs/mythavtest/commandlineparser.cpp b/mythtv/programs/mythavtest/commandlineparser.cpp index 0148fd77590..fb011cd6939 100644 --- a/mythtv/programs/mythavtest/commandlineparser.cpp +++ b/mythtv/programs/mythavtest/commandlineparser.cpp @@ -22,7 +22,7 @@ void MythAVTestCommandLineParser::LoadArguments(void) addHelp(); addSettingsOverride(); addVersion(); - addWindowed(false); + addWindowed(); addGeometry(); addDisplay(); addLogging(); diff --git a/mythtv/programs/mythfrontend/commandlineparser.cpp b/mythtv/programs/mythfrontend/commandlineparser.cpp index 293901f257e..732151075f9 100644 --- a/mythtv/programs/mythfrontend/commandlineparser.cpp +++ b/mythtv/programs/mythfrontend/commandlineparser.cpp @@ -15,7 +15,8 @@ void MythFrontendCommandLineParser::LoadArguments(void) allowArgs(); addHelp(); addVersion(); - addWindowed(false); + addWindowed(); + addMouse(); addSettingsOverride(); addGeometry(); addDisplay(); diff --git a/mythtv/programs/mythtv-setup/commandlineparser.cpp b/mythtv/programs/mythtv-setup/commandlineparser.cpp index 66e674378c9..88154adaff2 100644 --- a/mythtv/programs/mythtv-setup/commandlineparser.cpp +++ b/mythtv/programs/mythtv-setup/commandlineparser.cpp @@ -23,7 +23,8 @@ void MythTVSetupCommandLineParser::LoadArguments(void) addHelp(); addSettingsOverride(); addVersion(); - addWindowed(false); + addWindowed(); + addMouse(); addGeometry(); addDisplay(); addLogging();