Skip to content

Commit

Permalink
Add new MythSystem. Rename old MythSystem to MythSystemLegacy.
Browse files Browse the repository at this point in the history
This commit creates a new simplifed and less ambiguous MythSystem API.
The old MythSystem has been renamed MythSystemLegacy and provides
the current implementation for the new MythSystem.

The next steps are:
   Complete unit tests for new MythSystem,
     fixing bugs as they are found & enhancing MythSystemLegacy as necessary.
   Port code over to the new MythSystem interface.
   Get a windows buildbot running.
   Eliminate MythSystemLegacy unit tests.
   Refactor MythSystemLegacy to support only the new interface.
   Eliminate any unneccesary abstractions.
  • Loading branch information
daniel-kristjansson committed Jun 2, 2013
1 parent 27b78ab commit 3afaff0
Show file tree
Hide file tree
Showing 91 changed files with 1,616 additions and 1,041 deletions.
2 changes: 1 addition & 1 deletion mythplugins/mytharchive/mytharchive/archiveutil.cpp
Expand Up @@ -20,7 +20,7 @@ using namespace std;
#include <mythmainwindow.h>
#include <mythdialogbox.h>
#include <mythdate.h>
#include <mythsystem.h>
#include <mythsystemlegacy.h>
#include <exitcodes.h>
#include <mythlogging.h>

Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mytharchive/mytharchive/exportnative.cpp
Expand Up @@ -22,7 +22,7 @@
#include <mythuibuttonlist.h>
#include <mythuiprogressbar.h>
#include <mythmainwindow.h>
#include <mythsystem.h>
#include <mythsystemlegacy.h>
#include <exitcodes.h>

// mytharchive
Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mytharchive/mytharchive/importnative.cpp
Expand Up @@ -16,7 +16,7 @@
#include <mythuibutton.h>
#include <mythuibuttonlist.h>
#include <mythdialogbox.h>
#include <mythsystem.h>
#include <mythsystemlegacy.h>
#include <exitcodes.h>
#include <mythdate.h>

Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mytharchive/mytharchive/main.cpp
Expand Up @@ -22,7 +22,7 @@ using namespace std;
#include <mythversion.h>
#include <mythplugin.h>
#include <mythcoreutil.h>
#include <mythsystem.h>
#include <mythsystemlegacy.h>
#include <myththemedmenu.h>
#include <mythuihelper.h>
#include <mythdialogbox.h>
Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mytharchive/mytharchive/mythburn.cpp
Expand Up @@ -26,7 +26,7 @@
#include <mythuibuttonlist.h>
#include <mythuiprogressbar.h>
#include <mythdate.h>
#include <mythsystem.h>
#include <mythsystemlegacy.h>
#include <mythmiscutil.h>
#include <exitcodes.h>

Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mytharchive/mytharchivehelper/main.cpp
Expand Up @@ -62,7 +62,7 @@ using namespace std;
#include <programinfo.h>
#include <mythdirs.h>
#include <mythconfig.h>
#include <mythsystem.h>
#include <mythsystemlegacy.h>
#include <mythdate.h>
#include <mythlogging.h>

Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mythbrowser/mythbrowser/bookmarkmanager.cpp
Expand Up @@ -12,7 +12,7 @@ using namespace std;
#include <mythdirs.h>
#include <mythuicheckbox.h>
#include <mythuibuttonlist.h>
#include <mythsystem.h>
#include <mythsystemlegacy.h>

// mythbrowser
#include "bookmarkmanager.h"
Expand Down
6 changes: 3 additions & 3 deletions mythplugins/mythgallery/dcrawplugin/dcrawhandler.cpp
Expand Up @@ -10,7 +10,7 @@
#include <QIODevice>
#include <QString>

#include "mythsystem.h"
#include "mythsystemlegacy.h"
#include "exitcodes.h"
#include "../mythgallery/galleryutil.h"
#include "mythlogging.h"
Expand Down Expand Up @@ -64,7 +64,7 @@ bool DcrawHandler::read(QImage *image)
arguments << path;

uint flags = kMSRunShell | kMSStdOut | kMSBuffered;
MythSystem ms("dcraw", arguments, flags);
MythSystemLegacy ms("dcraw", arguments, flags);
ms.Run();
if (ms.Wait() != GENERIC_EXIT_OK)
return false;
Expand All @@ -84,7 +84,7 @@ int DcrawHandler::loadThumbnail(QImage *image, QString fileName)
arguments << "'" + fileName + "'";

uint flags = kMSRunShell | kMSStdOut | kMSBuffered;
MythSystem ms("dcraw", arguments, flags);
MythSystemLegacy ms("dcraw", arguments, flags);
ms.Run();
if (ms.Wait() != GENERIC_EXIT_OK)
return -1;
Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mythgallery/mythgallery/iconview.cpp
Expand Up @@ -37,7 +37,7 @@ using namespace std;
// MythTV headers
#include <mythdate.h>
#include <mythdbcon.h>
#include <mythsystem.h>
#include <mythsystemlegacy.h>
#include <mythcontext.h>
#include <mythlogging.h>
#include <mythmainwindow.h>
Expand Down
4 changes: 2 additions & 2 deletions mythplugins/mythgallery/mythgallery/thumbgenerator.cpp
Expand Up @@ -39,7 +39,7 @@
#include "config.h"
#include "thumbgenerator.h"
#include "galleryutil.h"
#include "mythsystem.h"
#include "mythsystemlegacy.h"
#include "exitcodes.h"
#include "mythlogging.h"

Expand Down Expand Up @@ -304,7 +304,7 @@ void ThumbGenerator::loadFile(QImage& image, const QFileInfo& fi)
args << "--infile" << '"' + fi.absoluteFilePath() + '"';
args << "--outfile" << '"' + tmpDir.filePath(thumbFile) + '"';

MythSystem ms(cmd, args, kMSRunShell);
MythSystemLegacy ms(cmd, args, kMSRunShell);
ms.SetDirectory(tmpDir.absolutePath());
ms.Run();
if (ms.Wait() == GENERIC_EXIT_OK)
Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mythgame/mythgame/gamehandler.cpp
Expand Up @@ -9,7 +9,7 @@

#include <mythdb.h>
#include <mythdbcon.h>
#include <mythsystem.h>
#include <mythsystemlegacy.h>
#include <mythcontext.h>
#include <mythdialogs.h>
#include <mythuihelper.h>
Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mythmusic/mythmusic/cdrip.cpp
Expand Up @@ -39,7 +39,7 @@ using namespace std;
#include <mythuibutton.h>
#include <mythuiprogressbar.h>
#include <mythuibuttonlist.h>
#include <mythsystem.h>
#include <mythsystemlegacy.h>

// MythUI headers
#include <mythtv/libmythui/mythscreenstack.h>
Expand Down
6 changes: 3 additions & 3 deletions mythplugins/mythmusic/mythmusic/playlist.cpp
Expand Up @@ -24,7 +24,7 @@ using namespace std;
#include <compat.h>
#include <mythmediamonitor.h>
#include <mythmiscutil.h>
#include <mythsystem.h>
#include <mythsystemlegacy.h>
#include <exitcodes.h>

const char *kID0err = "Song with ID of 0 in playlist, this shouldn't happen.";
Expand Down Expand Up @@ -1336,7 +1336,7 @@ int Playlist::CreateCDMP3(void)
kMSDontDisableDrawing | kMSDontBlockInputDevs |
kMSRunBackground;

m_proc = new MythSystem(command, args, flags);
m_proc = new MythSystemLegacy(command, args, flags);

connect(m_proc, SIGNAL(readDataReady(int)), this, SLOT(mkisofsData(int)),
Qt::DirectConnection);
Expand Down Expand Up @@ -1387,7 +1387,7 @@ int Playlist::CreateCDMP3(void)
kMSDontDisableDrawing | kMSDontBlockInputDevs |
kMSRunBackground;

m_proc = new MythSystem(command, args, flags);
m_proc = new MythSystemLegacy(command, args, flags);
connect(m_proc, SIGNAL(readDataReady(int)),
this, SLOT(cdrecordData(int)), Qt::DirectConnection);
connect(m_proc, SIGNAL(finished()),
Expand Down
4 changes: 2 additions & 2 deletions mythplugins/mythmusic/mythmusic/playlist.h
Expand Up @@ -13,7 +13,7 @@

class PlaylistContainer;
class Playlist;
class MythSystem;
class MythSystemLegacy;

enum InsertPLOption
{
Expand Down Expand Up @@ -129,7 +129,7 @@ class Playlist : public QObject
bool m_changed;
bool m_doSave;
MythProgressDialog *m_progress;
MythSystem *m_proc;
MythSystemLegacy *m_proc;
uint m_procExitVal;
};

Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mythnetvision/mythnetvision/netsearch.cpp
Expand Up @@ -14,7 +14,7 @@
#include <mythcontext.h>
#include <mythdbcon.h>
#include <mythdirs.h>
#include <mythsystem.h>
#include <mythsystemlegacy.h>
#include <mythprogressdialog.h>
#include <storagegroup.h>
#include <remotefile.h>
Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mythnetvision/mythnetvision/nettree.cpp
Expand Up @@ -8,7 +8,7 @@
#include <mythdb.h>
#include <mythcontext.h>
#include <mythdirs.h>
#include <mythsystem.h>
#include <mythsystemlegacy.h>
#include <remoteutil.h>
#include <remotefile.h>
#include <mythprogressdialog.h>
Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mythnews/mythnews/mythnews.cpp
Expand Up @@ -19,7 +19,7 @@
#include <mythdialogbox.h>
#include <mythcontext.h>
#include <mythuiimage.h>
#include <mythsystem.h>
#include <mythsystemlegacy.h>
#include <mythuitext.h>
#include <mythdate.h>
#include <mythdirs.h>
Expand Down
12 changes: 6 additions & 6 deletions mythplugins/mythweather/mythweather/weatherSource.cpp
Expand Up @@ -12,7 +12,7 @@
#include <mythdb.h>
#include <compat.h>
#include <mythdirs.h>
#include <mythsystem.h>
#include <mythsystemlegacy.h>
#include <exitcodes.h>

// MythWeather headers
Expand All @@ -29,7 +29,7 @@ QStringList WeatherSource::ProbeTypes(QString workingDirectory,

uint flags = kMSRunShell | kMSStdOut | kMSBuffered |
kMSDontDisableDrawing | kMSDontBlockInputDevs;
MythSystem ms(program, arguments, flags);
MythSystemLegacy ms(program, arguments, flags);
ms.SetDirectory(workingDirectory);
ms.Run();
if (ms.Wait() != GENERIC_EXIT_OK)
Expand Down Expand Up @@ -72,7 +72,7 @@ bool WeatherSource::ProbeTimeouts(QString workingDirectory,

uint flags = kMSRunShell | kMSStdOut | kMSBuffered |
kMSDontDisableDrawing | kMSDontBlockInputDevs;
MythSystem ms(program, arguments, flags);
MythSystemLegacy ms(program, arguments, flags);
ms.SetDirectory(workingDirectory);
ms.Run();
if (ms.Wait() != GENERIC_EXIT_OK)
Expand Down Expand Up @@ -135,7 +135,7 @@ bool WeatherSource::ProbeInfo(ScriptInfo &info)

uint flags = kMSRunShell | kMSStdOut | kMSBuffered |
kMSDontDisableDrawing | kMSDontBlockInputDevs;
MythSystem ms(info.program, arguments, flags);
MythSystemLegacy ms(info.program, arguments, flags);
ms.SetDirectory(info.path);
ms.Run();
if (ms.Wait() != GENERIC_EXIT_OK)
Expand Down Expand Up @@ -385,7 +385,7 @@ QStringList WeatherSource::getLocationList(const QString &str)

uint flags = kMSRunShell | kMSStdOut | kMSBuffered |
kMSDontDisableDrawing | kMSDontBlockInputDevs;
MythSystem ms(program, args, flags);
MythSystemLegacy ms(program, args, flags);
ms.SetDirectory(m_info->path);
ms.Run();

Expand Down Expand Up @@ -487,7 +487,7 @@ void WeatherSource::startUpdate(bool forceUpdate)

uint flags = kMSRunShell | kMSStdOut | kMSBuffered | kMSRunBackground |
kMSDontDisableDrawing | kMSDontBlockInputDevs;
m_ms = new MythSystem(program, args, flags);
m_ms = new MythSystemLegacy(program, args, flags);
m_ms->SetDirectory(m_info->path);

connect(m_ms, SIGNAL(finished()), this, SLOT(processExit()));
Expand Down
4 changes: 2 additions & 2 deletions mythplugins/mythweather/mythweather/weatherSource.h
Expand Up @@ -5,7 +5,7 @@
#include <QObject>
#include <QTimer>
#include <QFileInfo>
#include "mythsystem.h"
#include "mythsystemlegacy.h"

// MythWeather headers
#include "weatherUtils.h"
Expand Down Expand Up @@ -90,7 +90,7 @@ class WeatherSource : public QObject
bool m_ready;
bool m_inuse;
ScriptInfo *m_info;
MythSystem *m_ms;
MythSystemLegacy *m_ms;
QString m_dir;
QString m_locale;
QString m_cachefile;
Expand Down
6 changes: 3 additions & 3 deletions mythtv/libs/libmyth/mediamonitor-unix.cpp
Expand Up @@ -40,7 +40,7 @@ using namespace std;
#include "mythcdrom.h"
#include "mythhdd.h"
#include "mythlogging.h"
#include "mythsystem.h"
#include "mythsystemlegacy.h"
#include "exitcodes.h"

#if HAVE_LIBUDEV
Expand Down Expand Up @@ -372,8 +372,8 @@ QString MediaMonitorUnix::GetDeviceFile(const QString &sysfs)
if (VERBOSE_LEVEL_CHECK(VB_MEDIA, LOG_DEBUG))
flags |= kMSStdErr;

// TODO: change this to a MythSystem on the stack?
MythSystem *udevinfo = new MythSystem("udevinfo", args, flags);
// TODO: change this to a MythSystemLegacy on the stack?
MythSystemLegacy *udevinfo = new MythSystemLegacy("udevinfo", args, flags);
udevinfo->Run(4);
if( udevinfo->Wait() != GENERIC_EXIT_OK )
{
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmyth/mythcontext.cpp
Expand Up @@ -36,7 +36,7 @@ using namespace std;
#include "mythxmlclient.h"
#include "upnp.h"
#include "mythlogging.h"
#include "mythsystem.h"
#include "mythsystemlegacy.h"
#include "mythmiscutil.h"

#include "mythplugin.h"
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmyth/mythmediamonitor.cpp
Expand Up @@ -23,7 +23,7 @@ using namespace std;
#include "mythdate.h"
#include "mythlogging.h"
#include "mythmainwindow.h"
#include "mythsystem.h"
#include "mythsystemlegacy.h"
#include "mythmiscutil.h"

#ifdef USING_DARWIN_DA
Expand Down
10 changes: 5 additions & 5 deletions mythtv/libs/libmyth/netgrabbermanager.cpp
Expand Up @@ -6,11 +6,11 @@

#include "mythdirs.h"
#include "mythcontext.h"
#include "mythsystem.h"
#include "mythsystemlegacy.h"
#include "exitcodes.h"
#include "mythdate.h"
#include "mythlogging.h"
#include "mythsystem.h"
#include "mythsystemlegacy.h"

#include "netgrabbermanager.h"
#include "netutils.h"
Expand Down Expand Up @@ -50,7 +50,7 @@ void GrabberScript::run()
QMutexLocker locker(&m_lock);

QString commandline = m_commandline;
MythSystem getTree(commandline, QStringList("-T"),
MythSystemLegacy getTree(commandline, QStringList("-T"),
kMSRunShell | kMSStdOut | kMSBuffered);
getTree.Run(900);
uint status = getTree.Wait();
Expand Down Expand Up @@ -264,7 +264,7 @@ void Search::executeSearch(const QString &script, const QString &query, uint pag
resetSearch();

LOG(VB_GENERAL, LOG_DEBUG, "Search::executeSearch");
m_searchProcess = new MythSystem();
m_searchProcess = new MythSystemLegacy();

connect(m_searchProcess, SIGNAL(finished()),
this, SLOT(slotProcessSearchExit()));
Expand All @@ -283,7 +283,7 @@ void Search::executeSearch(const QString &script, const QString &query, uint pag

args.append("-S");
QString term = query;
args.append(MythSystem::ShellEscape(term));
args.append(MythSystemLegacy::ShellEscape(term));

LOG(VB_GENERAL, LOG_DEBUG, LOC +
QString("Internet Search Query: %1 %2") .arg(cmd).arg(args.join(" ")));
Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmyth/netgrabbermanager.h
Expand Up @@ -11,7 +11,7 @@

#include "rssparse.h"
#include "mythexp.h"
#include "mythsystem.h"
#include "mythsystemlegacy.h"

class MPUBLIC GrabberScript : public QObject, public MThread
{
Expand Down Expand Up @@ -160,7 +160,7 @@ class MPUBLIC Search : public QObject

private:

MythSystem *m_searchProcess;
MythSystemLegacy *m_searchProcess;

QByteArray m_data;
QDomDocument m_document;
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythbase/dbutil.cpp
Expand Up @@ -20,7 +20,7 @@
#include "mythdb.h"
#include "mythdirs.h"
#include "mythlogging.h"
#include "mythsystem.h"
#include "mythsystemlegacy.h"
#include "exitcodes.h"

#define LOC QString("DBUtil: ")
Expand Down

0 comments on commit 3afaff0

Please sign in to comment.