Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'mythsystem-rewrite'

  • Loading branch information...
commit 0f063f53b8cbe078c973105ec2125cae541a4be9 2 parents eab21fb + fceaa99
@Beirdo Beirdo authored
Showing with 3,340 additions and 1,857 deletions.
  1. +2 −0  README
  2. +9 −9 mythplugins/mytharchive/mytharchive/archiveutil.cpp
  3. +9 −7 mythplugins/mytharchive/mytharchive/exportnative.cpp
  4. +8 −5 mythplugins/mytharchive/mytharchive/importnative.cpp
  5. +5 −3 mythplugins/mytharchive/mytharchive/logviewer.cpp
  6. +15 −11 mythplugins/mytharchive/mytharchive/mythburn.cpp
  7. +1 −1  mythplugins/mytharchive/mytharchive/recordingselector.cpp
  8. +4 −6 mythplugins/mytharchive/mytharchive/thumbfinder.cpp
  9. +72 −21 mythplugins/mytharchive/mytharchive/videoselector.cpp
  10. +4 −7 mythplugins/mytharchive/mytharchive/videoselector.h
  11. +32 −24 mythplugins/mytharchive/mytharchivehelper/main.cpp
  12. +6 −6 mythplugins/mytharchive/theme/default-wide/mytharchive-ui.xml
  13. +3 −4 mythplugins/mytharchive/theme/default-wide/mythburn-ui.xml
  14. +6 −6 mythplugins/mytharchive/theme/default/mytharchive-ui.xml
  15. +3 −4 mythplugins/mytharchive/theme/default/mythburn-ui.xml
  16. 0  mythplugins/mythbrowser/i18n/mythbrowser_fr.ts
  17. +9 −24 mythplugins/mythgallery/dcrawplugin/dcrawhandler.cpp
  18. +7 −3 mythplugins/mythgallery/mythgallery/thumbgenerator.cpp
  19. +25 −33 mythplugins/mythgame/mythgame/gamehandler.cpp
  20. +1 −3 mythplugins/mythgame/mythgame/gamehandler.h
  21. +1 −2  mythplugins/mythgame/mythgame/main.cpp
  22. 0  mythplugins/mythmusic/contrib/import/itunes/it2m.c
  23. 0  mythplugins/mythmusic/contrib/import/itunes/it2m.h
  24. 0  mythplugins/mythmusic/i18n/mythmusic_fi.ts
  25. +2 −16 mythplugins/mythmusic/mythmusic/cdrip.cpp
  26. +6 −7 mythplugins/mythmusic/mythmusic/databasebox.cpp
  27. +0 −1  mythplugins/mythmusic/mythmusic/globalsettings.cpp
  28. +1 −1  mythplugins/mythmusic/mythmusic/lameencoder.cpp
  29. +1 −1  mythplugins/mythmusic/mythmusic/metadata.cpp
  30. +15 −7 mythplugins/mythmusic/mythmusic/musiccommon.cpp
  31. +2 −1  mythplugins/mythmusic/mythmusic/musiccommon.h
  32. +2 −0  mythplugins/mythmusic/mythmusic/playbackbox.cpp
  33. +161 −113 mythplugins/mythmusic/mythmusic/playlist.cpp
  34. +11 −1 mythplugins/mythmusic/mythmusic/playlist.h
  35. +0 −1  mythplugins/mythnetvision/mythnetvision/netsearch.cpp
  36. +0 −1  mythplugins/mythnetvision/mythnetvision/netsearch.h
  37. +0 −1  mythplugins/mythnetvision/mythnetvision/nettree.cpp
  38. +0 −1  mythplugins/mythvideo/mythvideo/metadatasettings.cpp
  39. 0  mythplugins/mythweather/i18n/mythweather_fi.ts
  40. +1 −1  mythplugins/mythweather/mythweather/mythweather.pro
  41. +4 −19 mythplugins/mythweather/mythweather/sourceManager.cpp
  42. +132 −211 mythplugins/mythweather/mythweather/weatherSource.cpp
  43. +8 −14 mythplugins/mythweather/mythweather/weatherSource.h
  44. +1 −1  mythplugins/mythweather/mythweather/weatherUtils.h
  45. 0  mythplugins/mythzoneminder/mythzoneminder.pro
  46. 0  mythplugins/mythzoneminder/mythzoneminder/mythzoneminder.pro
  47. +1 −1  mythtv/filters/quickdnr/quickdnr.pro
  48. BIN  mythtv/i18n/mythfrontend_en_gb.qm
  49. +1 −1  mythtv/i18n/mythfrontend_en_gb.ts
  50. BIN  mythtv/i18n/mythfrontend_fr.qm
  51. +1 −1  mythtv/i18n/mythfrontend_fr.ts
  52. BIN  mythtv/i18n/mythfrontend_pt.qm
  53. +1 −1  mythtv/i18n/mythfrontend_pt.ts
  54. +17 −15 mythtv/libs/libmyth/dbutil.cpp
  55. +1 −1  mythtv/libs/libmyth/libmyth.pro
  56. +19 −33 mythtv/libs/libmyth/mediamonitor-unix.cpp
  57. +1 −1  mythtv/libs/libmyth/mythcontext.cpp
  58. +4 −2 mythtv/libs/libmyth/mythmedia.cpp
  59. +0 −1  mythtv/libs/libmyth/mythrssmanager.cpp
  60. +0 −1  mythtv/libs/libmyth/mythrssmanager.h
  61. +39 −52 mythtv/libs/libmyth/netgrabbermanager.cpp
  62. +4 −8 mythtv/libs/libmyth/netgrabbermanager.h
  63. +0 −1  mythtv/libs/libmyth/rssparse.cpp
  64. +1 −1  mythtv/libs/libmyth/rssparse.h
  65. +54 −6 mythtv/libs/libmyth/util.cpp
  66. +4 −0 mythtv/libs/libmyth/util.h
  67. +9 −6 mythtv/libs/libmythdb/compat.h
  68. +81 −80 mythtv/libs/libmythdb/exitcodes.h
  69. +9 −133 mythtv/libs/libmythdb/lcddevice.cpp
  70. +7 −1 mythtv/libs/libmythdb/libmythdb.pro
  71. +5 −3 mythtv/libs/libmythdb/mythcorecontext.cpp
  72. +3 −2 mythtv/libs/libmythdb/mythdbcon.cpp
  73. +254 −352 mythtv/libs/libmythdb/mythsystem.cpp
  74. +165 −16 mythtv/libs/libmythdb/mythsystem.h
  75. +809 −0 mythtv/libs/libmythdb/system-unix.cpp
  76. +100 −0 mythtv/libs/libmythdb/system-unix.h
  77. +713 −0 mythtv/libs/libmythdb/system-windows.cpp
  78. +103 −0 mythtv/libs/libmythdb/system-windows.h
  79. +14 −11 mythtv/libs/libmythmetadata/metadatadownload.cpp
  80. +5 −7 mythtv/libs/libmythmetadata/parentalcontrols.cpp
  81. +2 −118 mythtv/libs/libmythtv/avformatdecoder.cpp
  82. +11 −10 mythtv/libs/libmythtv/channelbase.cpp
  83. +7 −5 mythtv/libs/libmythtv/channelbase.h
  84. +49 −108 mythtv/libs/libmythtv/datadirect.cpp
  85. +5 −5 mythtv/libs/libmythtv/datadirect.h
  86. +4 −4 mythtv/libs/libmythtv/jobqueue.cpp
  87. +2 −1  mythtv/libs/libmythtv/mythsystemevent.cpp
  88. +6 −4 mythtv/libs/libmythtv/previewgenerator.cpp
  89. +0 −6 mythtv/libs/libmythtv/subtitlescreen.cpp
  90. +1 −5 mythtv/libs/libmythtv/textsubtitleparser.h
  91. +71 −5 mythtv/libs/libmythtv/tv_play.cpp
  92. +0 −1  mythtv/libs/libmythtv/tv_play.h
  93. +25 −33 mythtv/libs/libmythtv/videosource.cpp
  94. +4 −9 mythtv/libs/libmythui/lirc.cpp
  95. +5 −3 mythtv/libs/libmythui/lirc_client.c
  96. 0  mythtv/libs/libmythupnp/upnpexp.h
  97. +35 −48 mythtv/programs/mythbackend/httpstatus.cpp
  98. +7 −5 mythtv/programs/mythbackend/mythxml.cpp
  99. +8 −8 mythtv/programs/mythbackend/scheduler.cpp
  100. +6 −3 mythtv/programs/mythcommflag/TemplateFinder.cpp
  101. +49 −88 mythtv/programs/mythfilldatabase/filldata.cpp
  102. +2 −17 mythtv/programs/mythfrontend/main.cpp
  103. +2 −10 mythtv/programs/mythshutdown/main.cpp
  104. +14 −0 mythtv/programs/mythtranscode/mpeg2fix.cpp
  105. +0 −1  mythtv/programs/mythtranscode/mythtranscode.pro
  106. +0 −2  mythtv/programs/mythtranscode/replex/replex.pro
  107. +26 −39 mythtv/programs/mythwelcome/welcomedialog.cpp
  108. +0 −1  mythtv/themes/MythCenter-wide/base.xml
  109. +2 −1  mythtv/themes/MythCenter-wide/menu-ui.xml
  110. +1 −1  mythtv/themes/MythCenter-wide/video-ui.xml
  111. +0 −1  mythtv/themes/MythCenter/base.xml
  112. +2 −1  mythtv/themes/MythCenter/menu-ui.xml
  113. 0  mythtv/themes/default/htmls/notfound.html
  114. 0  mythtv/themes/default/progressbar_fill2.png
  115. 0  mythtv/themes/mythuitheme.xsd
View
2  README
@@ -0,0 +1,2 @@
+Empty README.
+
View
18 mythplugins/mytharchive/mytharchive/archiveutil.cpp
@@ -20,6 +20,8 @@ using namespace std;
#include <mythmainwindow.h>
#include <mythdialogbox.h>
#include <util.h>
+#include <mythsystem.h>
+#include <exitcodes.h>
// mytharchive
#include "archiveutil.h"
@@ -102,7 +104,7 @@ void checkTempDirectory()
if (!dir.exists())
{
dir.mkdir(tempDir);
- if( !chmod(qPrintable(tempDir), 0777) )
+ if( chmod(qPrintable(tempDir), 0777) )
VERBOSE(VB_IMPORTANT, QString("Failed to change permissions on archive directory: %1")
.arg(strerror(errno)));
}
@@ -111,7 +113,7 @@ void checkTempDirectory()
if (!dir.exists())
{
dir.mkdir(workDir);
- if( !chmod(qPrintable(workDir), 0777) )
+ if( chmod(qPrintable(workDir), 0777) )
VERBOSE(VB_IMPORTANT, QString("Failed to change permissions on archive work directory: %1")
.arg(strerror(errno)));
}
@@ -120,7 +122,7 @@ void checkTempDirectory()
if (!dir.exists())
{
dir.mkdir(logDir);
- if( !chmod(qPrintable(logDir), 0777) )
+ if( chmod(qPrintable(logDir), 0777) )
VERBOSE(VB_IMPORTANT, QString("Failed to change permissions on archive log directory: %1")
.arg(strerror(errno)));
@@ -129,7 +131,7 @@ void checkTempDirectory()
if (!dir.exists())
{
dir.mkdir(configDir);
- if( !chmod(qPrintable(configDir), 0777) )
+ if( chmod(qPrintable(configDir), 0777) )
VERBOSE(VB_IMPORTANT, QString("Failed to change permissions on archive config directory: %1")
.arg(strerror(errno)));
}
@@ -233,16 +235,14 @@ bool getFileDetails(ArchiveItem *a)
inFile.replace("\"", "\\\"");
inFile.replace("`", "\\`");
- QString outFile = tempDir + "/work/file.xml";
+ QString outFile = tempDir + "work/file.xml";
// call mytharchivehelper to get files stream info etc.
QString command = QString("mytharchivehelper -i \"%1\" \"%2\" %3 > /dev/null 2>&1")
.arg(inFile).arg(outFile).arg(lenMethod);
- int res = system(qPrintable(command));
- if (WIFEXITED(res))
- res = WEXITSTATUS(res);
- if (res != 0)
+ uint flags = kMSDontBlockInputDevs | kMSDontDisableDrawing;
+ if (myth_system(command, flags) != GENERIC_EXIT_OK)
return false;
QDomDocument doc("mydocument");
View
16 mythplugins/mytharchive/mytharchive/exportnative.cpp
@@ -22,6 +22,8 @@
#include <mythuibuttonlist.h>
#include <mythuiprogressbar.h>
#include <mythmainwindow.h>
+#include <mythsystem.h>
+#include <exitcodes.h>
// mytharchive
#include "exportnative.h"
@@ -464,17 +466,17 @@ void ExportNative::runScript()
commandline = "mytharchivehelper -n " + configDir + "/mydata.xml"; // job file
commandline += " > " + logDir + "/progress.log 2>&1 &"; // Logs
- int state = system(qPrintable(commandline));
-
- if (state != 0)
+ uint flags = kMSRunBackground | kMSDontBlockInputDevs |
+ kMSDontDisableDrawing;
+ uint retval = myth_system(commandline, flags);
+ if (retval != GENERIC_EXIT_RUNNING && retval != GENERIC_EXIT_OK)
{
ShowOkPopup(QObject::tr("It was not possible to create the DVD. "
"An error occured when running the scripts") );
+ return;
}
- else
- {
- showLogViewer();
- }
+
+ showLogViewer();
}
void ExportNative::handleAddRecording()
View
13 mythplugins/mytharchive/mytharchive/importnative.cpp
@@ -16,6 +16,8 @@
#include <mythuibutton.h>
#include <mythuibuttonlist.h>
#include <mythdialogbox.h>
+#include <mythsystem.h>
+#include <exitcodes.h>
// mytharchive
#include "importnative.h"
@@ -426,16 +428,17 @@ void ImportNative::finishedPressed()
commandline = "mytharchivehelper -f \"" + m_xmlFile + "\" " + chanID;
commandline += " > " + logDir + "/progress.log 2>&1 &";
- int state = system(qPrintable(commandline));
-
- if (state != 0)
+ uint flags = kMSRunBackground | kMSDontBlockInputDevs |
+ kMSDontDisableDrawing;
+ uint retval = myth_system(commandline, flags);
+ if (retval != GENERIC_EXIT_RUNNING && retval != GENERIC_EXIT_OK)
{
ShowOkPopup(tr("It was not possible to import the Archive. "
" An error occured when running 'mytharchivehelper'") );
return;
}
- else
- showLogViewer();
+
+ showLogViewer();
m_previousScreen->Close();
Close();
View
8 mythplugins/mytharchive/mytharchive/logviewer.cpp
@@ -153,12 +153,14 @@ void LogViewer::updateLogItem(MythUIButtonListItem *item)
void LogViewer::cancelClicked(void)
{
QString tempDir = gCoreContext->GetSetting("MythArchiveTempDir", "");
+ QFile lockFile(tempDir + "/logs/mythburncancel.lck");
- QString command("echo Cancel > " + tempDir + "/logs/mythburncancel.lck");
- int res = system(qPrintable(command));
- if (WIFEXITED(res) == 0)
+ if (!lockFile.open(QIODevice::WriteOnly | QIODevice::Truncate))
VERBOSE(VB_IMPORTANT, "LogViewer: Failed to create mythburncancel.lck file");
+ lockFile.write("Cancel\n\r");
+ lockFile.close();
+
ShowOkPopup(QObject::tr("Background creation has been asked to stop.\n"
"This may take a few minutes."));
}
View
26 mythplugins/mytharchive/mytharchive/mythburn.cpp
@@ -25,6 +25,9 @@
#include <mythuicheckbox.h>
#include <mythuibuttonlist.h>
#include <mythuiprogressbar.h>
+#include <util.h>
+#include <mythsystem.h>
+#include <exitcodes.h>
// mytharchive
#include "archiveutil.h"
@@ -36,6 +39,8 @@
#include "videoselector.h"
#include "logviewer.h"
+using namespace std;
+
MythBurn::MythBurn(MythScreenStack *parent,
MythScreenType *destinationScreen,
MythScreenType *themeScreen,
@@ -49,12 +54,8 @@ MythBurn::MythBurn(MythScreenStack *parent,
// remove any old thumb images
QString thumbDir = getTempDirectory() + "/config/thumbs";
QDir dir(thumbDir);
- if (dir.exists())
- {
- int res = system(qPrintable("rm -rf " + thumbDir));
- if (!WIFEXITED(res) || WEXITSTATUS(res))
- VERBOSE(VB_IMPORTANT, "MythBurn: Failed to clear thumb directory");
- }
+ if (dir.exists() && !RemoveDirectory(dir))
+ VERBOSE(VB_IMPORTANT, "MythBurn: Failed to clear thumb directory");
m_bCreateISO = false;
m_bDoBurn = false;
@@ -942,9 +943,10 @@ void MythBurn::runScript()
gCoreContext->SaveSetting("MythArchiveLastRunStatus", "Running");
- int state = system(qPrintable(commandline));
-
- if (state != 0)
+ uint flags = kMSRunBackground | kMSDontBlockInputDevs |
+ kMSDontDisableDrawing;
+ uint retval = myth_system(commandline, flags);
+ if (retval != GENERIC_EXIT_RUNNING && retval != GENERIC_EXIT_OK)
{
ShowOkPopup(tr("It was not possible to create the DVD. "
" An error occured when running the scripts"));
@@ -1195,9 +1197,11 @@ void BurnMenu::doBurn(int mode)
commandline = "mytharchivehelper -b " + sArchiveFormat +
" " + sEraseDVDRW + " " + sNativeFormat;
commandline += " > " + logDir + "/progress.log 2>&1 &";
- int state = system(qPrintable(commandline));
- if (state != 0)
+ uint flags = kMSRunBackground | kMSDontBlockInputDevs |
+ kMSDontDisableDrawing;
+ uint retval = myth_system(commandline, flags);
+ if (retval != GENERIC_EXIT_RUNNING && retval != GENERIC_EXIT_OK)
{
showWarningDialog(QObject::tr("It was not possible to run "
"mytharchivehelper to burn the DVD."));
View
2  mythplugins/mytharchive/mytharchive/recordingselector.cpp
@@ -116,7 +116,7 @@ bool RecordingSelector::Create(void)
void RecordingSelector::Init(void)
{
- QString message = tr("Retrieving Recording List.\nPlease Wait...");
+ QString message = tr("Retrieving Recording List. Please Wait...");
MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
View
10 mythplugins/mytharchive/mytharchive/thumbfinder.cpp
@@ -352,22 +352,20 @@ QString ThumbFinder::createThumbDir(void)
if (!dir.exists())
{
dir.mkdir(thumbDir);
- if( !chmod(qPrintable(thumbDir), 0777) )
+ if( chmod(qPrintable(thumbDir), 0777) )
VERBOSE(VB_IMPORTANT, QString("ThumbFinder: Failed to change permissions on thumb directory: %1")
.arg(strerror(errno)));
}
- int x = 0;
QString path;
- do
+ for (int x = 1; dir.exists(); x++)
{
- x++;
path = QString(thumbDir + "/%1").arg(x);
dir.setPath(path);
- } while (dir.exists());
+ }
dir.mkdir(path);
- if( !chmod(qPrintable(path), 0777) )
+ if( chmod(qPrintable(path), 0777) )
VERBOSE(VB_IMPORTANT, QString("ThumbFinder: Failed to change permissions on thumb directory: %1")
.arg(strerror(errno)));
View
93 mythplugins/mytharchive/mytharchive/videoselector.cpp
@@ -28,12 +28,8 @@ VideoSelector::VideoSelector(MythScreenStack *parent, QList<ArchiveItem *> *arch
:MythScreenType(parent, "VideoSelector")
{
m_archiveList = archiveList;
- m_currentParentalLevel = ParentalLevel::plNone;
+ m_currentParentalLevel = 1;
m_videoList = NULL;
-
- m_parentalLevelChecker = new ParentalLevelChangeChecker();
- connect(m_parentalLevelChecker, SIGNAL(SigResultReady(bool, ParentalLevel::Level)),
- this, SLOT(parentalLevelChanged(bool, ParentalLevel::Level)));
}
VideoSelector::~VideoSelector(void)
@@ -44,8 +40,6 @@ VideoSelector::~VideoSelector(void)
while (!m_selectedList.isEmpty())
delete m_selectedList.takeFirst();
m_selectedList.clear();
-
- delete m_parentalLevelChecker;
}
bool VideoSelector::Create(void)
@@ -92,8 +86,6 @@ bool VideoSelector::Create(void)
SetFocusWidget(m_videoButtonList);
- setParentalLevel(ParentalLevel::plLowest);
-
updateSelectedList();
updateVideoList();
@@ -120,19 +112,19 @@ bool VideoSelector::keyPressEvent(QKeyEvent *event)
}
else if (action == "1")
{
- setParentalLevel(ParentalLevel::plLowest);
+ setParentalLevel(1);
}
else if (action == "2")
{
- setParentalLevel(ParentalLevel::plLow);
+ setParentalLevel(2);
}
else if (action == "3")
{
- setParentalLevel(ParentalLevel::plMedium);
+ setParentalLevel(3);
}
else if (action == "4")
{
- setParentalLevel(ParentalLevel::plHigh);
+ setParentalLevel(4);
}
else
handled = false;
@@ -529,20 +521,79 @@ void VideoSelector::updateSelectedList()
}
}
-void VideoSelector::setParentalLevel(ParentalLevel::Level level)
+void VideoSelector::setParentalLevel(int which_level)
{
- m_parentalLevelChecker->Check(m_currentParentalLevel, level);
+ if (which_level < 1)
+ which_level = 1;
+
+ if (which_level > 4)
+ which_level = 4;
+
+ if ((which_level > m_currentParentalLevel) && !checkParentPassword())
+ which_level = m_currentParentalLevel;
+
+
+ if (m_currentParentalLevel != which_level)
+ {
+ m_currentParentalLevel = which_level;
+ updateVideoList();
+ m_plText->SetText(QString::number(which_level));
+ }
}
-void VideoSelector::parentalLevelChanged(bool passwordValid, ParentalLevel::Level newLevel)
+bool VideoSelector::checkParentPassword()
{
- if (passwordValid)
+ QDateTime curr_time = QDateTime::currentDateTime();
+ QString last_time_stamp = gCoreContext->GetSetting("VideoPasswordTime");
+ QString password = gCoreContext->GetSetting("VideoAdminPassword");
+ if (password.length() < 1)
{
- m_currentParentalLevel = newLevel;
- updateVideoList();
- m_plText->SetText(QString::number(newLevel));
+ return true;
+ }
+
+ // See if we recently (and succesfully) asked for a password
+ if (last_time_stamp.length() < 1)
+ {
+ // Probably first time used
}
else
- ShowOkPopup(tr("You need to enter a valid password for this parental level"));
+ {
+ QDateTime last_time = QDateTime::fromString(last_time_stamp,
+ Qt::TextDate);
+ if (last_time.secsTo(curr_time) < 120)
+ {
+ // Two minute window
+ last_time_stamp = curr_time.toString(Qt::TextDate);
+ gCoreContext->SetSetting("VideoPasswordTime", last_time_stamp);
+ gCoreContext->SaveSetting("VideoPasswordTime", last_time_stamp);
+ return true;
+ }
+ }
+
+ // See if there is a password set
+ if (password.length() > 0)
+ {
+ bool ok = false;
+ MythPasswordDialog *pwd = new MythPasswordDialog(tr("Parental Pin:"),
+ &ok,
+ password,
+ GetMythMainWindow());
+ pwd->exec();
+ pwd->deleteLater();
+ if (ok)
+ {
+ // All is good
+ last_time_stamp = curr_time.toString(Qt::TextDate);
+ gCoreContext->SetSetting("VideoPasswordTime", last_time_stamp);
+ gCoreContext->SaveSetting("VideoPasswordTime", last_time_stamp);
+ return true;
+ }
+ }
+ else
+ {
+ return true;
+ }
+
+ return false;
}
View
11 mythplugins/mytharchive/mytharchive/videoselector.h
@@ -12,7 +12,6 @@
// mythtv
#include <mythscreentype.h>
-#include <metadata/parentalcontrols.h>
// mytharchive
#include "archiveutil.h"
@@ -23,6 +22,7 @@ class MythUIButton;
class MythUIButtonList;
class MythUIButtonListItem;
+
typedef struct
{
int id;
@@ -62,23 +62,20 @@ class VideoSelector : public MythScreenType
void titleChanged(MythUIButtonListItem *item);
void toggleSelected(MythUIButtonListItem *item);
- void parentalLevelChanged(bool passwordValid, ParentalLevel::Level newLevel);
-
private:
void updateVideoList(void);
void updateSelectedList(void);
void getVideoList(void);
void wireUpTheme(void);
std::vector<VideoInfo *> *getVideoListFromDB(void);
- void setParentalLevel(ParentalLevel::Level level);
-
- ParentalLevelChangeChecker *m_parentalLevelChecker;
+ bool checkParentPassword(void);
+ void setParentalLevel(int which_level);
QList<ArchiveItem *> *m_archiveList;
std::vector<VideoInfo *> *m_videoList;
QList<VideoInfo *> m_selectedList;
- ParentalLevel::Level m_currentParentalLevel;
+ int m_currentParentalLevel;
MythUIText *m_plText;
MythUIButtonList *m_videoButtonList;
View
56 mythplugins/mytharchive/mytharchivehelper/main.cpp
@@ -59,6 +59,9 @@ using namespace std;
#include <programinfo.h>
#include <mythdirs.h>
#include <mythconfig.h>
+#include <mythsystem.h>
+#include <util.h>
+
extern "C" {
#include <avcodec.h>
#include <avformat.h>
@@ -91,11 +94,14 @@ NativeArchive::NativeArchive(void)
{
// create the lock file so the UI knows we're running
QString tempDir = getTempDirectory();
- QString command = QString("echo %1 > " + tempDir +
- "/logs/mythburn.lck").arg(getpid());
- int res = system(qPrintable(command));
- if (WIFEXITED(res) == 0)
+ QFile file(tempDir + "/logs/mythburn.lck");
+
+ if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate))
VERBOSE(VB_IMPORTANT, "NativeArchive: Failed to create lock file");
+
+ QString pid = QString("%1").arg(getpid());
+ file.write(pid.toAscii());
+ file.close();
}
NativeArchive::~NativeArchive(void)
@@ -198,10 +204,8 @@ static bool createISOImage(QString &sourceDirectory)
QString command = mkisofs + " -R -J -V 'MythTV Archive' -o ";
command += tempDirectory + "mythburn.iso " + sourceDirectory;
- int res = system(qPrintable(command));
- if (WIFEXITED(res))
- res = WEXITSTATUS(res);
- if (res != 0)
+ uint res = myth_system(command);
+ if (res != GENERIC_EXIT_OK)
{
VERBOSE(VB_JOBQUEUE, QString("ERROR: Failed while running mkisofs. Result: %1")
.arg(res));
@@ -256,15 +260,13 @@ static int burnISOImage(int mediaType, bool bEraseDVDRW, bool nativeFormat)
}
}
- int res = system(qPrintable(command));
- if (WIFEXITED(res))
- res = WEXITSTATUS(res);
- if (res == 0)
- VERBOSE(VB_JOBQUEUE, "Finished burning ISO image");
- else
+ uint res = myth_system(command);
+ if (res != GENERIC_EXIT_OK)
VERBOSE(VB_JOBQUEUE,
QString("ERROR: Failed while running growisofs. Result: %1")
.arg(res));
+ else
+ VERBOSE(VB_JOBQUEUE, "Finished burning ISO image");
return res;
}
@@ -348,9 +350,13 @@ int NativeArchive::doNativeArchive(const QString &jobFile)
saveDirectory += "work/";
- int res = system(qPrintable("rm -fr " + saveDirectory + "*"));
- if (!WIFEXITED(res) || WEXITSTATUS(res))
- VERBOSE(VB_IMPORTANT, "NativeArchive: Failed to clear work directory");
+ QDir dir(saveDirectory);
+ if (dir.exists())
+ {
+ if (!RemoveDirectory(dir))
+ VERBOSE(VB_IMPORTANT, "NativeArchive: Failed to clear work directory");
+ }
+ dir.mkpath(saveDirectory);
}
VERBOSE(VB_JOBQUEUE, QString("Saving files to : %1").arg(saveDirectory));
@@ -445,7 +451,9 @@ int NativeArchive::exportRecording(QDomElement &itemNode,
// create the directory to hold this items files
QDir dir(saveDirectory + title);
if (!dir.exists())
- dir.mkdir(saveDirectory + title);
+ dir.mkpath(saveDirectory + title);
+ if (!dir.exists())
+ VERBOSE(VB_IMPORTANT, strerror(errno));
VERBOSE(VB_JOBQUEUE, "Creating xml file for " + title);
QDomDocument doc("MYTHARCHIVEITEM");
@@ -1880,7 +1888,7 @@ static int grabThumbnail(QString inFile, QString thumbList, QString outFile, int
unsigned char *outputbuf = new unsigned char[bufflen];
int frameNo = -1, thumbCount = 0;
- int frameFinished = 0;
+ int frameFinished;
int keyFrame;
while (av_read_frame(inputFC, &pkt) >= 0)
@@ -1893,7 +1901,7 @@ static int grabThumbnail(QString inFile, QString thumbList, QString outFile, int
thumbCount++;
avcodec_flush_buffers(codecCtx);
- avcodec_decode_video2(codecCtx, frame, &frameFinished, &pkt);
+ avcodec_decode_video(codecCtx, frame, &frameFinished, pkt.data, pkt.size);
keyFrame = frame->key_frame;
while (!frameFinished || !keyFrame)
@@ -1905,7 +1913,7 @@ static int grabThumbnail(QString inFile, QString thumbList, QString outFile, int
if (pkt.stream_index == videostream)
{
frameNo++;
- avcodec_decode_video2(codecCtx, frame, &frameFinished, &pkt);
+ avcodec_decode_video(codecCtx, frame, &frameFinished, pkt.data, pkt.size);
keyFrame = frame->key_frame;
}
}
@@ -1964,9 +1972,9 @@ static int grabThumbnail(QString inFile, QString thumbList, QString outFile, int
if (pkt.stream_index == videostream)
{
frameNo++;
- avcodec_decode_video2(codecCtx, frame,
+ avcodec_decode_video(codecCtx, frame,
&frameFinished,
- &pkt);
+ pkt.data, pkt.size);
}
}
}
@@ -2873,7 +2881,7 @@ int main(int argc, char **argv)
else
showUsage();
- return res;
+ exit(res);
}
View
12 mythplugins/mytharchive/theme/default-wide/mytharchive-ui.xml
@@ -147,7 +147,7 @@ Common MythArchive window definitions
</statetype>
</state>
<state name="selectedactive" from="active">
- <shape name="background">
+ <shape name="buttonbackground">
<area>0,0,100%,100%</area>
<fill style="gradient">
<gradient start="#52CA38" end="#349838" />
@@ -155,7 +155,7 @@ Common MythArchive window definitions
</shape>
</state>
<state name="selectedinactive" from="active">
- <shape name="background">
+ <shape name="buttonbackground">
<area>0,0,100%,100%</area>
<fill style="gradient">
<gradient start="#52CA38" end="#349838" alpha="100" />
@@ -261,7 +261,7 @@ Common MythArchive window definitions
</statetype>
</state>
<state name="selectedactive" from="active">
- <shape name="background">
+ <shape name="buttonbackground">
<area>0,0,100%,100%</area>
<fill style="gradient">
<gradient start="#52CA38" end="#349838" />
@@ -269,7 +269,7 @@ Common MythArchive window definitions
</shape>
</state>
<state name="selectedinactive" from="active">
- <shape name="background">
+ <shape name="buttonbackground">
<area>0,0,100%,100%</area>
<fill style="gradient">
<gradient start="#52CA38" end="#349838" alpha="100" />
@@ -333,7 +333,7 @@ Common MythArchive window definitions
</statetype>
</state>
<state name="selectedactive" from="active">
- <shape name="background">
+ <shape name="buttonbackground">
<area>0,0,100%,100%</area>
<fill style="gradient">
<gradient start="#52CA38" end="#349838" />
@@ -341,7 +341,7 @@ Common MythArchive window definitions
</shape>
</state>
<state name="selectedinactive" from="active">
- <shape name="background">
+ <shape name="buttonbackground">
<area>0,0,100%,100%</area>
<fill style="gradient">
<gradient start="#52CA38" end="#349838" alpha="100" />
View
7 mythplugins/mytharchive/theme/default-wide/mythburn-ui.xml
@@ -10,10 +10,9 @@ MythArchive GUI theme
<window name="profilepopup">
<area>-1,-1,413,426</area>
- <shape name="background" from="basebackground">
- <area>0,0,413,426</area>
- <fill color="#000000" alpha="220" />
- </shape>
+ <imagetype name="box">
+ <filename>mz_function_popup.png</filename>
+ </imagetype>
<textarea name="title" from="basetextarea">
<area>20,20,360,40</area>
View
12 mythplugins/mytharchive/theme/default/mytharchive-ui.xml
@@ -146,7 +146,7 @@ Common MythArchive window definitions
</statetype>
</state>
<state name="selectedactive" from="active">
- <shape name="background">
+ <shape name="buttonbackground">
<area>0,0,100%,100%</area>
<fill style="gradient">
<gradient start="#52CA38" end="#349838" />
@@ -154,7 +154,7 @@ Common MythArchive window definitions
</shape>
</state>
<state name="selectedinactive" from="active">
- <shape name="background">
+ <shape name="buttonbackground">
<area>0,0,100%,100%</area>
<fill style="gradient">
<gradient start="#52CA38" end="#349838" alpha="100" />
@@ -259,7 +259,7 @@ Common MythArchive window definitions
</statetype>
</state>
<state name="selectedactive" from="active">
- <shape name="background">
+ <shape name="buttonbackground">
<area>0,0,100%,100%</area>
<fill style="gradient">
<gradient start="#52CA38" end="#349838" />
@@ -267,7 +267,7 @@ Common MythArchive window definitions
</shape>
</state>
<state name="selectedinactive" from="active">
- <shape name="background">
+ <shape name="buttonbackground">
<area>0,0,100%,100%</area>
<fill style="gradient">
<gradient start="#52CA38" end="#349838" alpha="100" />
@@ -330,7 +330,7 @@ Common MythArchive window definitions
</statetype>
</state>
<state name="selectedactive" from="active">
- <shape name="background">
+ <shape name="buttonbackground">
<area>0,0,100%,100%</area>
<fill style="gradient">
<gradient start="#52CA38" end="#349838" />
@@ -338,7 +338,7 @@ Common MythArchive window definitions
</shape>
</state>
<state name="selectedinactive" from="active">
- <shape name="background">
+ <shape name="buttonbackground">
<area>0,0,100%,100%</area>
<fill style="gradient">
<gradient start="#52CA38" end="#349838" alpha="100" />
View
7 mythplugins/mytharchive/theme/default/mythburn-ui.xml
@@ -10,10 +10,9 @@ MythArchive GUI theme
<window name="profilepopup">
<area>-1,-1,413,426</area>
- <shape name="background" from="basebackground">
- <area>0,0,413,426</area>
- <fill color="#000000" alpha="220" />
- </shape>
+ <imagetype name="box">
+ <filename>mz_function_popup.png</filename>
+ </imagetype>
<textarea name="title" from="basetextarea">
<area>20,20,360,40</area>
View
0  mythplugins/mythbrowser/i18n/mythbrowser_fr.ts 100644 → 100755
File mode changed
View
33 mythplugins/mythgallery/dcrawplugin/dcrawhandler.cpp
@@ -8,8 +8,9 @@
#include <QFile>
#include <QImage>
#include <QIODevice>
-#include <QProcess>
#include <QString>
+#include "mythsystem.h"
+#include "exitcodes.h"
namespace
{
@@ -36,19 +37,8 @@ bool DcrawHandler::canRead() const
// MythGallery anyway. So for simplicity we give up.
return false;
- QProcess process(NULL);
- QString program = "dcraw";
- QStringList arguments;
- arguments << "-i" << path;
- process.start(program, arguments, QIODevice::NotOpen);
-
- bool finished = process.waitForFinished();
- if (!finished)
- return false;
- if (process.exitStatus() != QProcess::NormalExit)
- return false;
- bool success = (process.exitCode() == 0);
- return success;
+ QString command = "dcraw -i " + path;
+ return (myth_system(command) == GENERIC_EXIT_OK);
}
bool DcrawHandler::read(QImage *image)
@@ -62,25 +52,20 @@ bool DcrawHandler::read(QImage *image)
// MythGallery anyway. So for simplicity we give up.
return false;
- QProcess process(NULL);
- QString program = "dcraw";
QStringList arguments;
arguments << "-c" << "-w" << "-W";
#ifdef ICC_PROFILE
arguments << "-p" << ICC_PROFILE;
#endif // ICC_PROFILE
arguments << path;
- process.start(program, arguments, QIODevice::ReadOnly);
- bool finished = process.waitForFinished();
- if (!finished)
- return false;
- if (process.exitStatus() != QProcess::NormalExit)
- return false;
- if (process.exitCode() != 0)
+ uint flags = kMSRunShell | kMSStdOut | kMSBuffered;
+ MythSystem ms("dcraw", arguments, flags);
+ ms.Run();
+ if (ms.Wait() != GENERIC_EXIT_OK)
return false;
- QByteArray buffer = process.readAll();
+ QByteArray buffer = ms.ReadAll();
if (buffer.isEmpty())
return false;
View
10 mythplugins/mythgallery/mythgallery/thumbgenerator.cpp
@@ -37,6 +37,8 @@
#include "config.h"
#include "thumbgenerator.h"
#include "galleryutil.h"
+#include "mythsystem.h"
+#include "exitcodes.h"
#ifdef EXIF_SUPPORT
#include <libexif/exif-data.h>
@@ -297,10 +299,12 @@ void ThumbGenerator::loadFile(QImage& image, const QFileInfo& fi)
if (tmpDir.exists())
{
- QString cmd = "cd \"" + tmpDir.absolutePath() +
- "\"; mplayer -nosound -frames 1 -vo png:z=6 \"" +
+ QString cmd = "mplayer -nosound -frames 1 -vo png:z=6 \"" +
fi.absoluteFilePath() + "\"";
- if (myth_system(cmd) == 0)
+ MythSystem ms(cmd, kMSRunShell);
+ ms.SetDirectory(tmpDir.absolutePath());
+ ms.Run();
+ if (ms.Wait() == GENERIC_EXIT_OK)
{
QFileInfo thumb(tmpDir.filePath("00000001.png"));
if (thumb.exists())
View
58 mythplugins/mythgame/mythgame/gamehandler.cpp
@@ -586,20 +586,32 @@ int GameHandler::buildFileCount(QString directory, GameHandler *handler)
void GameHandler::clearAllGameData(void)
{
- MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
- MythDialogBox *clearPopup = new MythDialogBox(tr("This will clear all game metadata "
- "from the database. Are you sure you "
- "want to do this?"), popupStack, "clearAllPopup");
-
- if (clearPopup->Create())
+ QStringList buttonText;
+ buttonText += QObject::tr("No");
+ buttonText += QObject::tr("Yes");
+
+ DialogCode result = MythPopupBox::ShowButtonPopup(
+ GetMythMainWindow(),
+ QObject::tr("Are you sure?"),
+ QString(QObject::tr("This will clear all Game Meta Data\n"
+ "from the database. Are you sure you\n"
+ "want to do this?" )),
+ buttonText, kDialogCodeButton0);
+
+ switch (result)
{
- clearPopup->SetReturnEvent(this, "clearAllPopup");
- clearPopup->AddButton(tr("No"));
- clearPopup->AddButton(tr("Yes"));
- popupStack->AddScreen(clearPopup);
- }
- else
- delete clearPopup;
+ case kDialogCodeRejected:
+ case kDialogCodeButton0:
+ default:
+ // Do Nothing
+ break;
+ case kDialogCodeButton1:
+ MSqlQuery query(MSqlQuery::InitCon());
+ if (!query.exec("DELETE FROM gamemetadata;"))
+ MythDB::DBError("GameHandler::clearAllGameData - "
+ "delete gamemetadata", query);
+ break;
+ };
}
void GameHandler::buildFileList(QString directory, GameHandler *handler,
@@ -938,25 +950,5 @@ void GameHandler::customEvent(QEvent *event)
break;
};
}
- else if (resultid == "clearAllPopup")
- {
- int buttonNum = dce->GetResult();
- switch (buttonNum)
- {
- case 1:
- clearAllMetadata();
- break;
- default:
- break;
- }
- }
}
}
-
-void GameHandler::clearAllMetadata(void)
-{
- MSqlQuery query(MSqlQuery::InitCon());
- if (!query.exec("DELETE FROM gamemetadata;"))
- MythDB::DBError("GameHandler::clearAllGameData - "
- "delete gamemetadata", query);
-}
View
4 mythplugins/mythgame/mythgame/gamehandler.h
@@ -81,7 +81,7 @@ class GameHandler : public QObject
void UpdateGameDB(GameHandler *handler);
void VerifyGameDB(GameHandler *handler);
- void clearAllGameData(void);
+ static void clearAllGameData(void);
static int buildFileCount(QString directory, GameHandler *handler);
void buildFileList(QString directory, GameHandler *handler,
@@ -108,8 +108,6 @@ class GameHandler : public QObject
uint GamePlayerID() const { return gameplayerid; }
QString GameType() const { return gametype; }
- void clearAllMetadata(void);
-
protected:
static GameHandler* GetHandler(RomInfo *rominfo);
static GameHandler* GetHandlerByName(QString systemname);
View
3  mythplugins/mythgame/mythgame/main.cpp
@@ -51,8 +51,7 @@ static void GameCallback(void *data, QString &selection)
}
if (sel == "clear_game_data")
{
- GameHandler *handler = new GameHandler();
- handler->clearAllGameData();
+ GameHandler::clearAllGameData();
}
}
View
0  mythplugins/mythmusic/contrib/import/itunes/it2m.c 100644 → 100755
File mode changed
View
0  mythplugins/mythmusic/contrib/import/itunes/it2m.h 100644 → 100755
File mode changed
View
0  mythplugins/mythmusic/i18n/mythmusic_fi.ts 100644 → 100755
File mode changed
View
18 mythplugins/mythmusic/mythmusic/cdrip.cpp
@@ -43,6 +43,7 @@ using namespace std;
#include <mythuibutton.h>
#include <mythuiprogressbar.h>
#include <mythuibuttonlist.h>
+#include <mythsystem.h>
// MythUI headers
#include <mythtv/libmythui/mythscreenstack.h>
@@ -326,22 +327,7 @@ void CDRipperThread::run(void)
QString PostRipCDScript = gCoreContext->GetSetting("PostCDRipScript");
if (!PostRipCDScript.isEmpty())
- {
- VERBOSE(VB_IMPORTANT,
- QString("PostCDRipScript: %1").arg(PostRipCDScript));
- pid_t child = fork();
- if (child < 0)
- {
- perror("fork");
- }
- else if (child == 0)
- {
- QByteArray script = PostRipCDScript.toAscii();
- execl("/bin/sh", "sh", "-c", script.constData(), NULL);
- perror("exec");
- _exit(1);
- }
- }
+ myth_system(PostRipCDScript);
QApplication::postEvent(
m_parent, new RipStatusEvent(RipStatusEvent::kFinishedEvent, ""));
View
13 mythplugins/mythmusic/mythmusic/databasebox.cpp
@@ -19,6 +19,8 @@ using namespace std;
#include <uitypes.h>
#include <uilistbtntype.h>
#include <mythmediamonitor.h>
+#include <mythsystem.h>
+#include <exitcodes.h>
// mythmusic
#include "metadata.h"
@@ -43,6 +45,7 @@ DatabaseBox::DatabaseBox(MythMainWindow *parent,
{
VERBOSE(VB_IMPORTANT, "We are not going to get very far with a null "
"pointer to metadata");
+ // TODO: is this OK?
exit(0);
}
@@ -438,15 +441,11 @@ void DatabaseBox::BlankCDRW()
record_progress->setProgress(1);
- QString cmd = QString("cdrecord -v dev= %1 -blank=%2")
+ QString cmd = QString("cdrecord -v dev=%1 -blank=%2")
.arg(scsidev).arg(blanktype);
+ uint flags = kMSRunShell | kMSDontBlockInputDevs | kMSDontDisableDrawing;
- VERBOSE(VB_GENERAL, QString("DatabaseBox::BlankCDRW()") +
- QString(" cmd: '%1'").arg(cmd));
-
- QByteArray command = cmd.toAscii();
- errno = 0;
- if (system(command.constData()) < 0 && errno)
+ if (myth_system(cmd, flags) != GENERIC_EXIT_OK)
{
VERBOSE(VB_IMPORTANT, QString("DatabaseBox::BlankCDRW()") +
QString(" cmd: '%1' Failed!").arg(cmd));
View
1  mythplugins/mythmusic/mythmusic/globalsettings.cpp
@@ -15,7 +15,6 @@
#include <QLabel>
#include <QKeyEvent>
#include <QEvent>
-#include <QProcess>
#include <QStringList>
#include <Q3HBoxLayout>
#include <Q3VBoxLayout>
View
2  mythplugins/mythmusic/mythmusic/lameencoder.cpp
@@ -36,7 +36,7 @@
using namespace std;
-static int write_buffer(char *buf, int bufsize, FILE *fp)
+int write_buffer(char *buf, int bufsize, FILE *fp)
{
return fwrite(buf, 1, bufsize, fp);
}
View
2  mythplugins/mythmusic/mythmusic/metadata.cpp
@@ -37,7 +37,7 @@ bool operator!=(const Metadata& a, const Metadata& b)
return false;
}
-static bool meta_less_than(const Metadata *item1, const Metadata *item2)
+bool meta_less_than(const Metadata *item1, const Metadata *item2)
{
return item1->compare(item2) < 0;
}
View
22 mythplugins/mythmusic/mythmusic/musiccommon.cpp 100644 → 100755
@@ -235,7 +235,7 @@ bool MusicCommon::CreateCommon(void)
#endif
m_controlVolume = gCoreContext->GetNumSetting("MythControlsVolume");
- updateVolume();
+ updateVolume(gPlayer->getVolume(), gPlayer->isMuted());
if (m_movingTracksState)
m_movingTracksState->DisplayState("off");
@@ -263,7 +263,6 @@ bool MusicCommon::CreateCommon(void)
void MusicCommon::switchView(int view)
{
- (void) view;
#if 0
MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
@@ -592,7 +591,6 @@ void MusicCommon::showVolume(void)
void MusicCommon::showSpeed(bool show)
{
- (void) show;
#if 0
if (speed_status)
{
@@ -1111,13 +1109,17 @@ void MusicCommon::customEvent(QEvent *event)
}
else if (event->type() == MusicPlayerEvent::VolumeChangeEvent)
{
- updateVolume();
+ MusicPlayerEvent *mpe = (MusicPlayerEvent*)(event);
+ updateVolume(mpe->Volume, mpe->IsMuted);
}
else if (event->type() == MusicPlayerEvent::TrackRemovedEvent)
{
//FIXME should just remove the list item
if (m_currentPlaylist)
{
+ MusicPlayerEvent *mpe = (MusicPlayerEvent*)(event);
+// int trackID = mpe->TrackID;
+ // FIXME: should restore track position
int pos = m_currentPlaylist->GetCurrentPos();
int topPos = m_currentPlaylist->GetTopItemPos();
updateUIPlaylist();
@@ -1130,6 +1132,8 @@ void MusicCommon::customEvent(QEvent *event)
{
if (m_currentPlaylist)
{
+ MusicPlayerEvent *mpe = (MusicPlayerEvent*)(event);
+// int trackID = mpe->TrackID;
int pos = m_currentPlaylist->GetCurrentPos();
int topPos = m_currentPlaylist->GetTopItemPos();
updateUIPlaylist();
@@ -1140,6 +1144,7 @@ void MusicCommon::customEvent(QEvent *event)
}
else if (event->type() == MusicPlayerEvent::AllTracksRemovedEvent)
{
+ MusicPlayerEvent *mpe = (MusicPlayerEvent*)(event);
updateUIPlaylist();
updatePlaylistStats();
}
@@ -1168,7 +1173,7 @@ void MusicCommon::customEvent(QEvent *event)
}
}
-void MusicCommon::updateVolume(void)
+void MusicCommon::updateVolume(uint volume, bool muted)
{
if (!m_controlVolume)
{
@@ -1190,14 +1195,12 @@ void MusicCommon::updateVolume(void)
if (m_muteState)
{
- bool muted = gPlayer->isMuted();
m_muteState->DisplayState(muted ? "on" : "off");
}
}
void MusicCommon::editTrackInfo(Metadata *mdata)
{
- (void) mdata;
#if 0
if (!mdata)
return;
@@ -1524,6 +1527,11 @@ bool MythMusicVolumeDialog::keyPressEvent(QKeyEvent *event)
return handled;
}
+void MythMusicVolumeDialog::customEvent(QEvent *event)
+{
+
+}
+
void MythMusicVolumeDialog::increaseVolume(void)
{
gPlayer->incVolume();
View
3  mythplugins/mythmusic/mythmusic/musiccommon.h 100644 → 100755
@@ -79,7 +79,7 @@ class MPUBLIC MusicCommon : public MythScreenType
void toggleMute(void);
void toggleUpmix(void);
void showVolume(void);
- void updateVolume(void);
+ void updateVolume(uint volume, bool muted);
void showSpeed(bool show);
void startVisualizer(void);
@@ -160,6 +160,7 @@ class MPUBLIC MythMusicVolumeDialog : public MythScreenType
bool Create(void);
bool keyPressEvent(QKeyEvent *event);
+ void customEvent(QEvent *event);
protected:
void increaseVolume(void);
View
2  mythplugins/mythmusic/mythmusic/playbackbox.cpp
@@ -127,6 +127,7 @@ PlaybackBoxMusic::PlaybackBoxMusic(MythMainWindow *parent, QString window_name,
{
VERBOSE(VB_IMPORTANT, "playbackbox.o: Could not find a button to "
"assign focus to. What's in your theme?");
+ // TODO: is this OK?
exit(0);
}
}
@@ -2272,6 +2273,7 @@ void PlaybackBoxMusic::wireUpTheme()
{
VERBOSE(VB_IMPORTANT, "playbackbox.o: Couldn't find a music tree list "
"in your theme");
+ // TODO: is this OK?
exit(0);
}
connect(music_tree_list, SIGNAL(nodeSelected(int, IntVector*)),
View
274 mythplugins/mythmusic/mythmusic/playlist.cpp
@@ -9,7 +9,7 @@ using namespace std;
#include <QApplication>
#include <QTextStream>
#include <QFileInfo>
-#include <Q3Process>
+#include <QObject>
#include "playlist.h"
#include "playlistcontainer.h"
@@ -19,6 +19,8 @@ using namespace std;
#include <mythdb.h>
#include <compat.h>
#include <mythmediamonitor.h>
+#include <mythsystem.h>
+#include <exitcodes.h>
const char *kID0err = "Song with ID of 0 in playlist, this shouldn't happen.";
@@ -1215,6 +1217,90 @@ void Playlist::computeSize(double &size_in_MB, double &size_in_sec)
}
}
+void Playlist::cdrecordData(int fd)
+{
+ if (!progress || !proc)
+ return;
+
+ QByteArray buf;
+ if (fd == 1)
+ {
+ buf = proc->ReadAll();
+
+ // I would just use the QTextStream::readLine(), but wodim uses \r
+ // to update the same line, so I'm splitting it on \r or \n
+ // Track 01: 6 of 147 MB written (fifo 100%) [buf 99%] 16.3x.
+ QString data(buf);
+ QStringList list = data.split(QRegExp("[\\r\\n]"),
+ QString::SkipEmptyParts);
+
+ for (int i = 0; i < list.size(); i++)
+ {
+ QString line = list.at(i);
+
+ if (line.mid(15, 2) == "of")
+ {
+ int mbdone = line.mid(10, 5).trimmed().toInt();
+ int mbtotal = line.mid(17, 5).trimmed().toInt();
+
+ if (mbtotal > 0)
+ {
+ progress->setProgress((mbdone * 100) / mbtotal);
+ }
+ }
+ }
+ }
+ else
+ {
+ buf = proc->ReadAllErr();
+
+ QTextStream text(buf);
+
+ while (!text.atEnd())
+ {
+ QString err = text.readLine();
+ if (err.contains("Drive needs to reload the media") ||
+ err.contains("Input/output error.") ||
+ err.contains("No disk / Wrong disk!"))
+ {
+ VERBOSE(VB_IMPORTANT, err);
+ proc->Term();
+ }
+ }
+ }
+}
+
+void Playlist::mkisofsData(int fd)
+{
+ if (!progress || !proc)
+ return;
+
+ QByteArray buf;
+ if (fd == 1)
+ buf = proc->ReadAll();
+ else
+ {
+ buf = proc->ReadAllErr();
+
+ QTextStream text(buf);
+
+ while (!text.atEnd())
+ {
+ QString line = text.readLine();
+ if (line[6] == '%')
+ {
+ line = line.mid(0, 3);
+ progress->setProgress(line.trimmed().toInt());
+ }
+ }
+ }
+}
+
+void Playlist::processExit(uint retval)
+{
+ procExitVal = retval;
+}
+
int Playlist::CreateCDMP3(void)
{
// Check & get global settings
@@ -1330,141 +1416,103 @@ int Playlist::CreateCDMP3(void)
reclistfile.close();
- MythProgressDialog *progress;
progress = new MythProgressDialog(QObject::tr("Creating CD File System"),
100);
progress->setProgress(1);
- QStringList args("mkisofs");
- args += "-graft-points";
- args += "-path-list";
- args += tmprecordlist;
- args += "-o";
- args += tmprecordisofs;
- args += "-J";
- args += "-R";
+ QStringList args;
+ QString command;
+
+ command = "mkisofs";
+ args << "-graft-points";
+ args << "-path-list";
+ args << tmprecordlist;
+ args << "-o";
+ args << tmprecordisofs;
+ args << "-J";
+ args << "-R";
- VERBOSE(VB_GENERAL, "Running: " + args.join(" "));
+ uint flags = kMSRunShell | kMSStdErr | kMSBuffered |
+ kMSDontDisableDrawing | kMSDontBlockInputDevs |
+ kMSRunBackground;
- bool retval = 0;
+ proc = new MythSystem(command, args, flags);
- Q3Process isofs(args);
+ connect(proc, SIGNAL(readDataReady(int)), this, SLOT(mkisofsData(int)),
+ Qt::DirectConnection);
+ connect(proc, SIGNAL(finished()), this, SLOT(processExit()),
+ Qt::DirectConnection);
+ connect(proc, SIGNAL(error(uint)), this, SLOT(processExit(uint)),
+ Qt::DirectConnection);
+
+ procExitVal = GENERIC_EXIT_RUNNING;
+ proc->Run();
+
+ while( procExitVal == GENERIC_EXIT_RUNNING )
+ usleep( 100000 );
+
+ uint retval = procExitVal;
+
+ progress->Close();
+ progress->deleteLater();
+ proc->disconnect();
+ delete proc;
- if (isofs.start())
+ if (retval)
{
- while (1)
- {
- while (isofs.canReadLineStderr())
- {
- QString buf = isofs.readLineStderr();
- if (buf[6] == '%')
- {
- buf = buf.mid(0, 3);
- progress->setProgress(buf.trimmed().toInt());
- }
- }
- if (isofs.isRunning())
- {
- qApp->processEvents();
- usleep(100000);
- }
- else
- {
- if (!isofs.normalExit())
- {
- VERBOSE(VB_IMPORTANT, "Unable to run 'mkisofs'");
- retval = 1;
- }
- break;
- }
- }
+ VERBOSE(VB_IMPORTANT, QString("Unable to run mkisofs: returns %1")
+ .arg(retval));
}
else
{
- VERBOSE(VB_IMPORTANT, "Unable to run 'mkisofs'");
- retval = 1;
- }
+ progress = new MythProgressDialog(QObject::tr("Burning CD"), 100);
+ progress->setProgress(2);
- progress->Close();
- progress->deleteLater();
+ command = "cdrecord";
+ args = QStringList();
+ args << "-v";
+ //args << "-dummy";
+ args << QString("dev=%1").arg(scsidev);
- progress = new MythProgressDialog(QObject::tr("Burning CD"), 100);
- progress->setProgress(2);
+ if (writespeed.toInt() > 0)
+ {
+ args << "-speed=";
+ args << writespeed;
+ }
- args = QStringList("cdrecord");
- args += "-v";
- //args += "-dummy";
- args += "dev=";
- args += scsidev;
+ args << "-data";
+ args << tmprecordisofs;
- if (writespeed.toInt() > 0)
- {
- args += "-speed=";
- args += writespeed;
- }
+ flags = kMSRunShell | kMSStdErr | kMSStdOut | kMSBuffered |
+ kMSDontDisableDrawing | kMSDontBlockInputDevs |
+ kMSRunBackground;
- args += "-data";
- args += tmprecordisofs;
+ proc = new MythSystem(command, args, flags);
+ connect(proc, SIGNAL(readDataReady(int)),
+ this, SLOT(cdrecordData(int)), Qt::DirectConnection);
+ connect(proc, SIGNAL(finished()),
+ this, SLOT(processExit()), Qt::DirectConnection);
+ connect(proc, SIGNAL(error(uint)),
+ this, SLOT(processExit(uint)), Qt::DirectConnection);
+ procExitVal = GENERIC_EXIT_RUNNING;
+ proc->Run();
- VERBOSE(VB_GENERAL, "Running: " + args.join(" "));
+ while( procExitVal == GENERIC_EXIT_RUNNING )
+ usleep( 100000 );
- Q3Process burn(args);
+ retval = procExitVal;
- if (burn.start())
- {
- while (1)
- {
- while (burn.canReadLineStderr())
- {
- QString err = burn.readLineStderr();
- if (err == "cdrecord: Drive needs to reload the media" ||
- err == "cdrecord: Input/output error." ||
- err == "cdrecord: No disk / Wrong disk!")
- {
- VERBOSE(VB_IMPORTANT, err);
- burn.kill();
- retval = 1;
- }
- }
- while (burn.canReadLineStdout())
- {
- QString line = burn.readLineStdout();
- if (line.mid(15, 2) == "of")
- {
- int mbdone = line.mid(10, 5).trimmed().toInt();
- int mbtotal = line.mid(17, 5).trimmed().toInt();
-
- if (mbtotal > 0)
- {
- progress->setProgress((mbdone * 100) / mbtotal);
- }
- }
- }
+ progress->Close();
+ progress->deleteLater();
+ proc->disconnect();
+ delete proc;
- if (burn.isRunning())
- {
- qApp->processEvents();
- usleep(10000);
- }
- else
- {
- if (!burn.normalExit())
- {
- VERBOSE(VB_IMPORTANT, "Unable to run 'cdrecord'");
- retval = 1;
- }
- break;
- }
+ if (retval)
+ {
+ VERBOSE(VB_IMPORTANT, QString("Unable to run cdrecord: returns %1")
+ .arg(retval));
}
}
- else
- {
- VERBOSE(VB_IMPORTANT, "Unable to run 'cdrecord'");
- retval = 1;
- }
-
- progress->Close();
- progress->deleteLater();
QFile::remove(tmprecordlist);
QFile::remove(tmprecordisofs);
View
12 mythplugins/mythmusic/mythmusic/playlist.h
@@ -79,8 +79,10 @@ class Track
bool cd_flag;
};
-class Playlist
+class Playlist : public QObject
{
+ Q_OBJECT
+
public:
Playlist(AllMusic *all_music_ptr);
~Playlist();
@@ -152,6 +154,11 @@ class Playlist
int CreateCDMP3(void);
int CreateCDAudio(void);
+ private slots:
+ void mkisofsData(int fd);
+ void cdrecordData(int fd);
+ void processExit(uint retval = 0);
+
private:
QString removeDuplicateTracks(const QString &new_songlist);
int playlistid;
@@ -162,6 +169,9 @@ class Playlist
AllMusic *all_available_music;
PlaylistContainer *parent;
bool changed;
+ MythProgressDialog *progress;
+ MythSystem *proc;
+ uint procExitVal;
};
#endif
View
1  mythplugins/mythnetvision/mythnetvision/netsearch.cpp
@@ -4,7 +4,6 @@
// qt
#include <QString>
-#include <QProcess>
#include <QMetaType>
#include <QDateTime>
#include <QFileInfo>
View
1  mythplugins/mythnetvision/mythnetvision/netsearch.h
@@ -66,7 +66,6 @@ class NetSearch : public MythScreenType
MythDownloadManager *m_download;
MetadataImageDownload *m_imageDownload;
QFile *m_file;
- QProcess *m_externaldownload;
QString m_currentSearch;
int m_currentGrabber;
View
1  mythplugins/mythnetvision/mythnetvision/nettree.cpp
@@ -1,6 +1,5 @@
// qt
#include <QString>
-#include <QProcess>
#include <QFileInfo>
#include <QtAlgorithms>
View
1  mythplugins/mythvideo/mythvideo/metadatasettings.cpp
@@ -2,7 +2,6 @@
// qt
#include <QString>
-#include <QProcess>
// myth
#include <mythcontext.h>
View
0  mythplugins/mythweather/i18n/mythweather_fi.ts 100644 → 100755
File mode changed
View
2  mythplugins/mythweather/mythweather/mythweather.pro
@@ -5,7 +5,7 @@ include ( ../../programs-libs.pro )
QT += sql xml
TEMPLATE = lib
-CONFIG += plugin thread debug
+CONFIG += plugin thread
TARGET = mythweather
target.path = $${LIBDIR}/mythtv/plugins
INSTALLS += target
View
23 mythplugins/mythweather/mythweather/sourceManager.cpp
@@ -65,8 +65,9 @@ bool SourceManager::findScriptsDB()
si->id = db.value(0).toInt();
si->name = db.value(1).toString();
si->updateTimeout = db.value(2).toUInt() * 1000;
- si->scriptTimeout = db.value(3).toUInt() * 1000;
- si->fileInfo = fi;
+ si->scriptTimeout = db.value(3).toUInt();
+ si->path = fi.absolutePath();
+ si->program = fi.absoluteFilePath();
si->author = db.value(5).toString();
si->version = db.value(6).toString();
si->email = db.value(7).toString();
@@ -202,16 +203,6 @@ ScriptInfo *SourceManager::getSourceByName(const QString &name)
if (src->name == name)
{
return src;
- // src = new ScriptInfo;
- // src->name = m_scripts[i]->name;
- // src->version = m_scripts[i]->version;
- // src->author = m_scripts[i]->author;
- // src->email = m_scripts[i]->email;
- // src->types = m_scripts[i]->types;
- // src->file = new QFileInfo(*m_scripts[i]->file);
- // src->scriptTimeout = m_scripts[i]->scriptTimeout;
- // src->updateTimeout = m_scripts[i]->updateTimeout;
- // src->id = m_scripts[i]->id;
}
}
@@ -297,13 +288,7 @@ void SourceManager::doUpdate(bool forceUpdate)
for (int x = 0; x < m_sources.size(); x++)
{
src = m_sources.at(x);
- if (src->isRunning())
- {
- VERBOSE(VB_GENERAL, tr("Script %1 is still running when trying to do update, "
- "Make sure it isn't hanging, make sure timeout values are sane... "
- "Not running this time around").arg(src->getName()));
- }
- else if (src->inUse())
+ if (src->inUse())
src->startUpdate(forceUpdate);
}
}
View
343 mythplugins/mythweather/mythweather/weatherSource.cpp
@@ -12,6 +12,8 @@
#include <mythdb.h>
#include <compat.h>
#include <mythdirs.h>
+#include <mythsystem.h>
+#include <exitcodes.h>
// MythWeather headers
#include "weatherScreen.h"
@@ -24,45 +26,31 @@ QStringList WeatherSource::ProbeTypes(QString workingDirectory,
const QString loc_err =
QString("WeatherSource::ProbeTypes(%1 %2), Error: ")
.arg(program).arg(arguments.join(" "));
-
- QProcess proc;
- proc.setWorkingDirectory(workingDirectory);
- proc.start(program, arguments);
-
QStringList types;
- if (!proc.waitForStarted())
- {
- VERBOSE(VB_IMPORTANT, loc_err + "Cannot run script");
- return types;
- }
- proc.waitForFinished();
-
- if (QProcess::NormalExit != proc.exitStatus())
+ uint flags = kMSRunShell | kMSStdOut | kMSBuffered |
+ kMSDontDisableDrawing | kMSDontBlockInputDevs;
+ MythSystem ms(program, arguments, flags);
+ ms.SetDirectory(workingDirectory);
+ ms.Run();
+ if (ms.Wait() != GENERIC_EXIT_OK)
{
- VERBOSE(VB_IMPORTANT, loc_err + "Script Crashed");
+ VERBOSE(VB_IMPORTANT, loc_err + "Cannot run script");
return types;
}
- if (proc.exitCode())
- {
- VERBOSE(VB_IMPORTANT, loc_err +
- QString("Script Returned error %1")
- .arg(proc.exitCode()));
- VERBOSE(VB_IMPORTANT, proc.readAllStandardError());
- return types;
- }
+ QByteArray result = ms.ReadAll();
+ QTextStream text(result);
- proc.setReadChannel(QProcess::StandardOutput);
- while (proc.canReadLine())
+ while (!text.atEnd())
{
- QByteArray tmp = proc.readLine();
+ QString tmp = text.readLine();
while (tmp.endsWith('\n') || tmp.endsWith('\r'))
tmp.chop(1);
if (!tmp.isEmpty())
- types += QString(tmp);
+ types += tmp;
}
if (types.empty())
@@ -84,44 +72,30 @@ bool WeatherSource::ProbeTimeouts(QString workingDirectory,
updateTimeout = DEFAULT_UPDATE_TIMEOUT;
scriptTimeout = DEFAULT_SCRIPT_TIMEOUT;
- QProcess proc;
- proc.setWorkingDirectory(workingDirectory);
- proc.start(program, arguments);
-
- if (!proc.waitForStarted())
+ uint flags = kMSRunShell | kMSStdOut | kMSBuffered |
+ kMSDontDisableDrawing | kMSDontBlockInputDevs;
+ MythSystem ms(program, arguments, flags);
+ ms.SetDirectory(workingDirectory);
+ ms.Run();
+ if (ms.Wait() != GENERIC_EXIT_OK)
{
VERBOSE(VB_IMPORTANT, loc_err + "Cannot run script");
return false;
}
- proc.waitForFinished();
-
- if (QProcess::NormalExit != proc.exitStatus())
- {
- VERBOSE(VB_IMPORTANT, loc_err + "Script Crashed");
- return false;
- }
-
- if (proc.exitCode())
- {
- VERBOSE(VB_IMPORTANT, loc_err +
- QString("Script Returned error %1")
- .arg(proc.exitCode()));
- VERBOSE(VB_IMPORTANT, proc.readAllStandardError());
- return false;
- }
+ QByteArray result = ms.ReadAll();
+ QTextStream text(result);
- proc.setReadChannel(QProcess::StandardOutput);
QStringList lines;
- while (proc.canReadLine())
+ while (!text.atEnd())
{
- QByteArray tmp = proc.readLine();
+ QString tmp = text.readLine();
while (tmp.endsWith('\n') || tmp.endsWith('\r'))
tmp.chop(1);
if (!tmp.isEmpty())
- lines += QString(tmp);
+ lines << tmp;
}
if (lines.empty())
@@ -149,60 +123,43 @@ bool WeatherSource::ProbeTimeouts(QString workingDirectory,
}
updateTimeout = ut * 1000;
- scriptTimeout = st * 1000;
+ scriptTimeout = st;
return true;
}
-bool WeatherSource::ProbeInfo(QString workingDirectory,
- QString program,
- ScriptInfo &info)
+bool WeatherSource::ProbeInfo(ScriptInfo &info)
{
QStringList arguments("-v");
const QString loc_err =
QString("WeatherSource::ProbeInfo(%1 %2), Error: ")
- .arg(program).arg(arguments.join(" "));
-
- QProcess proc;
- proc.setWorkingDirectory(workingDirectory);
- proc.setReadChannel(QProcess::StandardOutput);
- proc.start(program, arguments);
+ .arg(info.program).arg(arguments.join(" "));
- if (!proc.waitForStarted())
+ uint flags = kMSRunShell | kMSStdOut | kMSBuffered |
+ kMSDontDisableDrawing | kMSDontBlockInputDevs;
+ MythSystem ms(info.program, arguments, flags);
+ ms.SetDirectory(info.path);
+ ms.Run();
+ if (ms.Wait() != GENERIC_EXIT_OK)
{
VERBOSE(VB_IMPORTANT, loc_err + "Cannot run script");
return false;
}
- proc.waitForFinished();
-
- if (QProcess::NormalExit != proc.exitStatus())
- {
- VERBOSE(VB_IMPORTANT, loc_err + "Script Crashed");
- return false;
- }
-
- if (proc.exitCode())
- {
- VERBOSE(VB_IMPORTANT, loc_err +
- QString("Script Returned error %1")
- .arg(proc.exitCode()));
- VERBOSE(VB_IMPORTANT, proc.readAllStandardError());
- return false;
- }
+ QByteArray result = ms.ReadAll();
+ QTextStream text(result);
- proc.setReadChannel(QProcess::StandardOutput);
QStringList lines;
- while (proc.canReadLine())
+ while (!text.atEnd())
{
- QByteArray tmp = proc.readLine();
+ QString tmp = text.readLine();
while (tmp.endsWith('\n') || tmp.endsWith('\r'))
tmp.chop(1);
if (!tmp.isEmpty())
- lines += QString(tmp);
+ lines << tmp;
}
if (lines.empty())
@@ -244,12 +201,11 @@ ScriptInfo *WeatherSource::ProbeScript(const QFileInfo &fi)
if (!fi.isReadable() || !fi.isExecutable())
return NULL;
- QString workingDirectory = fi.absolutePath();
- QString program = fi.absoluteFilePath();
-
ScriptInfo info;
- info.fileInfo = fi;
- if (!WeatherSource::ProbeInfo(workingDirectory, program, info))
+ info.path = fi.absolutePath();
+ info.program = fi.absoluteFilePath();
+
+ if (!WeatherSource::ProbeInfo(info))
return NULL;
MSqlQuery db(MSqlQuery::InitCon());