Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
#include "lcddevice.h"
#include "langsettings.h"
#include "mythtranslation.h"
#include "commandlineparser.h"
#include "mythfrontend_commandlineparser.h"
#include "tvremoteutil.h"
#include "channelutil.h"

Expand Down Expand Up @@ -2233,5 +2233,9 @@ void handleSIGUSR2(void)
GetMythMainWindow()->RestartInputHandlers();
}

#include "main.moc"
/*
include Qt MOC output for Q_OBJECT class defined in this file;
filenames must match.
*/
#include "mythfrontend.moc"
/* vim: set expandtab tabstop=4 shiftwidth=4: */
6 changes: 3 additions & 3 deletions mythtv/programs/mythfrontend/mythfrontend.pro
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ HEADERS += videoplayercommand.h videopopups.h
HEADERS += videofilter.h videolist.h
HEADERS += videoplayersettings.h videodlg.h
HEADERS += videoglobalsettings.h upnpscanner.h
HEADERS += commandlineparser.h idlescreen.h
HEADERS += mythfrontend_commandlineparser.h idlescreen.h
HEADERS += gallerythumbview.h galleryslideview.h
HEADERS += galleryconfig.h galleryviews.h
HEADERS += galleryslide.h gallerytransitions.h
HEADERS += galleryinfo.h prevreclist.h
HEADERS += settingshelper.h

SOURCES += main.cpp playbackbox.cpp viewscheduled.cpp audiogeneralsettings.cpp
SOURCES += mythfrontend.cpp playbackbox.cpp viewscheduled.cpp audiogeneralsettings.cpp
SOURCES += globalsettings.cpp manualschedule.cpp programrecpriority.cpp
SOURCES += channelrecpriority.cpp statusbox.cpp networkcontrol.cpp
SOURCES += mediarenderer.cpp mythfexml.cpp playbackboxlistitem.cpp
Expand All @@ -74,7 +74,7 @@ SOURCES += videoplayercommand.cpp videopopups.cpp
SOURCES += videofilter.cpp videolist.cpp
SOURCES += videoplayersettings.cpp videodlg.cpp
SOURCES += videoglobalsettings.cpp upnpscanner.cpp
SOURCES += commandlineparser.cpp idlescreen.cpp
SOURCES += mythfrontend_commandlineparser.cpp idlescreen.cpp
SOURCES += gallerythumbview.cpp galleryslideview.cpp
SOURCES += galleryconfig.cpp galleryviews.cpp
SOURCES += galleryslide.cpp gallerytransitions.cpp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <QString>

#include "mythcorecontext.h"
#include "commandlineparser.h"
#include "mythfrontend_commandlineparser.h"

MythFrontendCommandLineParser::MythFrontendCommandLineParser() :
MythCommandLineParser(MYTH_APPNAME_MYTHFRONTEND)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "jobqueue.h"
#include "mythdbcon.h"
#include "mythversion.h"
#include "commandlineparser.h"
#include "mythjobqueue_commandlineparser.h"
#include "compat.h"
#include "mythsystemevent.h"
#include "mythlogging.h"
Expand Down
4 changes: 2 additions & 2 deletions mythtv/programs/mythjobqueue/mythjobqueue.pro
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ INSTALLS = target
QMAKE_CLEAN += $(TARGET)

# Input
HEADERS += commandlineparser.h
HEADERS += mythjobqueue_commandlineparser.h

SOURCES += main.cpp commandlineparser.cpp
SOURCES += mythjobqueue.cpp mythjobqueue_commandlineparser.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <QString>

#include "mythcorecontext.h"
#include "commandlineparser.h"
#include "mythjobqueue_commandlineparser.h"

MythJobQueueCommandLineParser::MythJobQueueCommandLineParser() :
MythCommandLineParser(MYTH_APPNAME_MYTHJOBQUEUE)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "tv_play.h"
#include "compat.h"
#include "mythtranslation.h"
#include "commandlineparser.h"
#include "mythlcdserver_commandlineparser.h"
#include "signalhandling.h"

#include "lcdserver.h"
Expand Down
4 changes: 2 additions & 2 deletions mythtv/programs/mythlcdserver/mythlcdserver.pro
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ target.path = $${PREFIX}/bin

INSTALLS += target

HEADERS += lcdserver.h lcdprocclient.h commandlineparser.h
HEADERS += lcdserver.h lcdprocclient.h mythlcdserver_commandlineparser.h

SOURCES += main.cpp lcdserver.cpp lcdprocclient.cpp commandlineparser.cpp
SOURCES += mythlcdserver.cpp lcdserver.cpp lcdprocclient.cpp mythlcdserver_commandlineparser.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <QString>

#include "mythcorecontext.h"
#include "commandlineparser.h"
#include "mythlcdserver_commandlineparser.h"

MythLCDServerCommandLineParser::MythLCDServerCommandLineParser() :
MythCommandLineParser(MYTH_APPNAME_MYTHLCDSERVER)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "mythlogging.h"
#include "mythversion.h"
#include "mythsystemevent.h"
#include "commandlineparser.h"
#include "mythmediaserver_commandlineparser.h"
#include "signalhandling.h"
#include "cleanupguard.h"

Expand Down
4 changes: 2 additions & 2 deletions mythtv/programs/mythmediaserver/mythmediaserver.pro
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ INSTALLS = target
QMAKE_CLEAN += $(TARGET)

# Input
HEADERS += commandlineparser.h controlrequesthandler.h
SOURCES += main.cpp commandlineparser.cpp controlrequesthandler.cpp
HEADERS += mythmediaserver_commandlineparser.h controlrequesthandler.h
SOURCES += mythmediaserver.cpp mythmediaserver_commandlineparser.cpp controlrequesthandler.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <QString>

#include "mythcorecontext.h"
#include "commandlineparser.h"
#include "mythmediaserver_commandlineparser.h"

MythMediaServerCommandLineParser::MythMediaServerCommandLineParser() :
MythCommandLineParser(MYTH_APPNAME_MYTHMEDIASERVER)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "jobqueue.h"
#include "mythtranslation.h"
#include "mythconfig.h"
#include "commandlineparser.h"
#include "mythmetadatalookup_commandlineparser.h"
#include "mythlogging.h"
#include "signalhandling.h"
#include "cleanupguard.h"
Expand Down
4 changes: 2 additions & 2 deletions mythtv/programs/mythmetadatalookup/mythmetadatalookup.pro
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ INSTALLS = target
QMAKE_CLEAN += $(TARGET)

# Input
HEADERS += lookup.h commandlineparser.h
SOURCES += main.cpp lookup.cpp commandlineparser.cpp
HEADERS += lookup.h mythmetadatalookup_commandlineparser.h
SOURCES += mythmetadatalookup.cpp lookup.cpp mythmetadatalookup_commandlineparser.cpp

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <QList>

#include "mythcorecontext.h"
#include "commandlineparser.h"
#include "mythmetadatalookup_commandlineparser.h"

MythMetadataLookupCommandLineParser::MythMetadataLookupCommandLineParser() :
MythCommandLineParser(MYTH_APPNAME_MYTHMETADATALOOKUP)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include "programinfo.h"
#include "dbcheck.h"
#include "previewgenerator.h"
#include "commandlineparser.h"
#include "mythpreviewgen_commandlineparser.h"
#include "mythsystemevent.h"
#include "mythlogging.h"
#include "signalhandling.h"
Expand Down
4 changes: 2 additions & 2 deletions mythtv/programs/mythpreviewgen/mythpreviewgen.pro
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ INSTALLS = target

QMAKE_CLEAN += $(TARGET)

HEADERS += commandlineparser.h
HEADERS += mythpreviewgen_commandlineparser.h

SOURCES += main.cpp commandlineparser.cpp
SOURCES += mythpreviewgen.cpp mythpreviewgen_commandlineparser.cpp

using_oss:DEFINES += USING_OSS

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <QString>

#include "mythcorecontext.h"
#include "commandlineparser.h"
#include "mythpreviewgen_commandlineparser.h"

MythPreviewGeneratorCommandLineParser::MythPreviewGeneratorCommandLineParser() :
MythCommandLineParser(MYTH_APPNAME_MYTHPREVIEWGEN)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "mythcontext.h"
#include "mythdbcon.h"
#include "mythversion.h"
#include "commandlineparser.h"
#include "mythscreenwizard_commandlineparser.h"
#include "compat.h"
#include "mythsystemevent.h"
#include "mythlogging.h"
Expand Down
4 changes: 2 additions & 2 deletions mythtv/programs/mythscreenwizard/mythscreenwizard.pro
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ INSTALLS = target
QMAKE_CLEAN += $(TARGET)

# Input
HEADERS += commandlineparser.h screenwizard.h
HEADERS += mythscreenwizard_commandlineparser.h screenwizard.h

SOURCES += main.cpp commandlineparser.cpp screenwizard.cpp
SOURCES += mythscreenwizard.cpp mythscreenwizard_commandlineparser.cpp screenwizard.cpp

using_x11:DEFINES += USING_X11
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <QString>

#include "mythcorecontext.h"
#include "commandlineparser.h"
#include "mythscreenwizard_commandlineparser.h"

MythScreenWizardCommandLineParser::MythScreenWizardCommandLineParser() :
MythCommandLineParser(MYTH_APPNAME_MYTHSCREENWIZARD)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "tvremoteutil.h"
#include "compat.h"
#include "mythlogging.h"
#include "commandlineparser.h"
#include "mythshutdown_commandlineparser.h"
#include "programinfo.h"
#include "signalhandling.h"

Expand Down
4 changes: 2 additions & 2 deletions mythtv/programs/mythshutdown/mythshutdown.pro
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ INSTALLS = target
QMAKE_CLEAN += $(TARGET)

# Input
HEADERS += commandlineparser.h
SOURCES += main.cpp commandlineparser.cpp
HEADERS += mythshutdown_commandlineparser.h
SOURCES += mythshutdown.cpp mythshutdown_commandlineparser.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <QString>

#include "mythcorecontext.h"
#include "commandlineparser.h"
#include "mythshutdown_commandlineparser.h"

MythShutdownCommandLineParser::MythShutdownCommandLineParser() :
MythCommandLineParser(MYTH_APPNAME_MYTHSHUTDOWN)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "remotefile.h"
#include "mythtranslation.h"
#include "mythlogging.h"
#include "commandlineparser.h"
#include "mythtranscode_commandlineparser.h"
#include "recordinginfo.h"
#include "signalhandling.h"
#include "HLS/httplivestream.h"
Expand Down
6 changes: 3 additions & 3 deletions mythtv/programs/mythtranscode/mythtranscode.pro
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ QMAKE_CFLAGS += -w
macx: QMAKE_CFLAGS -= -O3 -O2 -O1 -Os

# Input
SOURCES += main.cpp transcode.cpp mpeg2fix.cpp
SOURCES += mythtranscode.cpp transcode.cpp mpeg2fix.cpp
SOURCES += audioreencodebuffer.cpp cutter.cpp videodecodebuffer.cpp
SOURCES += commandlineparser.cpp
SOURCES += mythtranscode_commandlineparser.cpp
SOURCES += external/replex/element.cpp external/replex/mpg_common.cpp
SOURCES += external/replex/multiplex.cpp external/replex/pes.cpp
SOURCES += external/replex/ringbuffer.cpp external/replex/ts.cpp
SOURCES += mythtranscodeplayer.cpp

HEADERS += mpeg2fix.h transcodedefs.h commandlineparser.h
HEADERS += mpeg2fix.h transcodedefs.h mythtranscode_commandlineparser.h
HEADERS += audioreencodebuffer.h cutter.h videodecodebuffer.h
HEADERS += external/replex/element.h external/replex/mpg_common.h
HEADERS += external/replex/multiplex.h external/replex/pes.h
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <QString>

#include "mythcorecontext.h"
#include "commandlineparser.h"
#include "mythtranscode_commandlineparser.h"

MythTranscodeCommandLineParser::MythTranscodeCommandLineParser() :
MythCommandLineParser(MYTH_APPNAME_MYTHTRANSCODE)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include "startprompt.h"
#include "mythsystemevent.h"
#include "expertsettingseditor.h"
#include "commandlineparser.h"
#include "mythtv-setup_commandlineparser.h"
#include "profilegroup.h"
#include "signalhandling.h"
#include "mythmiscutil.h"
Expand Down
4 changes: 2 additions & 2 deletions mythtv/programs/mythtv-setup/mythtv-setup.pro
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ using_backend {
# Input
HEADERS += backendsettings.h channeleditor.h checksetup.h
HEADERS += exitprompt.h importicons.h startprompt.h
HEADERS += expertsettingseditor.h commandlineparser.h
HEADERS += expertsettingseditor.h mythtv-setup_commandlineparser.h

SOURCES += backendsettings.cpp channeleditor.cpp checksetup.cpp
SOURCES += exitprompt.cpp importicons.cpp startprompt.cpp
SOURCES += main.cpp commandlineparser.cpp
SOURCES += mythtv-setup.cpp mythtv-setup_commandlineparser.cpp

macx {
mac_bundle {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <QString>

#include "mythcorecontext.h"
#include "commandlineparser.h"
#include "mythtv-setup_commandlineparser.h"

MythTVSetupCommandLineParser::MythTVSetupCommandLineParser() :
MythCommandLineParser(MYTH_APPNAME_MYTHTV_SETUP)
Expand Down
File renamed without changes.
135 changes: 0 additions & 135 deletions mythtv/programs/mythutil/main.cpp

This file was deleted.

2 changes: 1 addition & 1 deletion mythtv/programs/mythutil/musicmetautils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ extern "C" {
}

// mythutils headers
#include "commandlineparser.h"
#include "mythutil_commandlineparser.h"
#include "musicmetautils.h"

static int UpdateMeta(const MythUtilCommandLineParser &cmdline)
Expand Down
125 changes: 125 additions & 0 deletions mythtv/programs/mythutil/mythutil.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,33 @@
// Qt includes
#include <QtGlobal>
#ifndef _WIN32
#include <QCoreApplication>
#else
#include <QApplication>
#endif
#include <QDateTime>
#include <QString>

// libmyth* includes
#include "mythconfig.h"
#include "exitcodes.h"
#include "mythcontext.h"
#include "mythversion.h"
#include "mythlogging.h"

// Local includes
#include "mythutil.h"
#include "mythutil_commandlineparser.h"
#include "backendutils.h"
#include "eitutils.h"
#include "fileutils.h"
#include "mpegutils.h"
#include "jobutils.h"
#include "markuputils.h"
#include "messageutils.h"
#include "musicmetautils.h"
#include "recordingutils.h"
#include "signalhandling.h"

bool GetProgramInfo(const MythUtilCommandLineParser &cmdline,
ProgramInfo &pginfo)
Expand Down Expand Up @@ -48,4 +69,108 @@ bool GetProgramInfo(const MythUtilCommandLineParser &cmdline,
return true;
}

int main(int argc, char *argv[])
{
MythUtilCommandLineParser cmdline;
if (!cmdline.Parse(argc, argv))
{
cmdline.PrintHelp();
return GENERIC_EXIT_INVALID_CMDLINE;
}

// default to quiet operation for pidcounter and pidfilter
QString defaultVerbose = "general";
LogLevel_t defaultLevel = LOG_INFO;
if (cmdline.toBool("pidcounter") || cmdline.toBool("pidfilter"))
{
if (!cmdline.toBool("verbose"))
{
verboseString = defaultVerbose = "";
verboseMask = 0;
}
if (!cmdline.toBool("loglevel"))
logLevel = defaultLevel = LOG_ERR;
}


if (cmdline.toBool("showhelp"))
{
cmdline.PrintHelp();
return GENERIC_EXIT_OK;
}

if (cmdline.toBool("showversion"))
{
MythUtilCommandLineParser::PrintVersion();
return GENERIC_EXIT_OK;
}

#ifndef _WIN32
QCoreApplication a(argc, argv);
#else
// MINGW application needs a window to receive messages
// such as socket notifications :[
QApplication a(argc, argv);
#endif

QCoreApplication::setApplicationName(MYTH_APPNAME_MYTHUTIL);

int retval = cmdline.ConfigureLogging(defaultVerbose);
if (retval != GENERIC_EXIT_OK)
return retval;

if (!cmdline.toBool("loglevel"))
logLevel = defaultLevel;

#ifndef _WIN32
SignalHandler::Init();
#endif

gContext = new MythContext(MYTH_BINARY_VERSION);
if (!gContext->Init(false))
{
LOG(VB_GENERAL, LOG_ERR, "Failed to init MythContext, exiting.");
return GENERIC_EXIT_NO_MYTHCONTEXT;
}

cmdline.ApplySettingsOverride();

UtilMap utilMap;

registerBackendUtils(utilMap);
registerEITUtils(utilMap);
registerFileUtils(utilMap);
registerMPEGUtils(utilMap);
registerJobUtils(utilMap);
registerMarkupUtils(utilMap);
registerMessageUtils(utilMap);
registerMusicUtils(utilMap);
registerRecordingUtils(utilMap);

bool cmdFound = false;
int cmdResult = GENERIC_EXIT_OK;
UtilMap::iterator i;
for (i = utilMap.begin(); i != utilMap.end(); ++i)
{
if (cmdline.toBool(i.key()))
{
cmdResult = (i.value())(cmdline);
cmdFound = true;
break;
}
}

if(!cmdFound)
{
cmdline.PrintHelp();
cmdResult = GENERIC_EXIT_INVALID_CMDLINE;
}

delete gContext;

SignalHandler::Done();

return cmdResult;
}

/* vim: set expandtab tabstop=4 shiftwidth=4: */
2 changes: 1 addition & 1 deletion mythtv/programs/mythutil/mythutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "programinfo.h"

// Local includes
#include "commandlineparser.h"
#include "mythutil_commandlineparser.h"

using UtilFunc = int (*)(const MythUtilCommandLineParser &cmdline);
using UtilMap = QMap<QString, UtilFunc>;
Expand Down
4 changes: 2 additions & 2 deletions mythtv/programs/mythutil/mythutil.pro
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ INCLUDEPATH += ../../libs/libmythbase
QMAKE_CLEAN += $(TARGET)

# Input
HEADERS += mythutil.h commandlineparser.h
HEADERS += mythutil.h mythutil_commandlineparser.h
HEADERS += backendutils.h fileutils.h jobutils.h markuputils.h
HEADERS += messageutils.h mpegutils.h musicmetautils.h
HEADERS += recordingutils.h
SOURCES += main.cpp mythutil.cpp commandlineparser.cpp
SOURCES += mythutil.cpp mythutil_commandlineparser.cpp
SOURCES += backendutils.cpp fileutils.cpp jobutils.cpp markuputils.cpp
SOURCES += messageutils.cpp mpegutils.cpp musicmetautils.cpp eitutils.cpp
SOURCES += recordingutils.cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "mythcorecontext.h"

// local headers
#include "commandlineparser.h"
#include "mythutil_commandlineparser.h"

MythUtilCommandLineParser::MythUtilCommandLineParser() :
MythCommandLineParser(MYTH_APPNAME_MYTHUTIL)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "exitcodes.h"
#include "compat.h"
#include "lcddevice.h"
#include "commandlineparser.h"
#include "mythwelcome_commandlineparser.h"
#include "mythlogging.h"
#include "signalhandling.h"
#include "mythdisplay.h"
Expand Down
4 changes: 2 additions & 2 deletions mythtv/programs/mythwelcome/mythwelcome.pro
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ INSTALLS = target
QMAKE_CLEAN += $(TARGET)

# Input
HEADERS += welcomedialog.h welcomesettings.h commandlineparser.h
SOURCES += main.cpp welcomedialog.cpp welcomesettings.cpp commandlineparser.cpp
HEADERS += welcomedialog.h welcomesettings.h mythwelcome_commandlineparser.h
SOURCES += mythwelcome.cpp welcomedialog.cpp welcomesettings.cpp mythwelcome_commandlineparser.cpp

macx {
mac_bundle {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <QString>

#include "mythcorecontext.h"
#include "commandlineparser.h"
#include "mythwelcome_commandlineparser.h"

MythWelcomeCommandLineParser::MythWelcomeCommandLineParser() :
MythCommandLineParser(MYTH_APPNAME_MYTHWELCOME)
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion themestringstool/themestrings.pro
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ TEMPLATE = app
CONFIG -= moc

# Input
SOURCES += main.cpp
SOURCES += themestrings.cpp

QT += xml
QT += widgets