[mythtv] [Patch] MediaMonitor enabling

J. Donavan Stanley jdonavan at jdonavan.net
Fri Jan 16 09:26:07 EST 2004


This patch adds a configuration setting (and checkbox) to enable the 
media monitor.
-------------- next part --------------
Index: globalsettings.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythfrontend/globalsettings.cpp,v
retrieving revision 1.125
diff -u -r1.125 globalsettings.cpp
--- globalsettings.cpp	14 Jan 2004 22:00:55 -0000	1.125
+++ globalsettings.cpp	16 Jan 2004 11:25:29 -0000
@@ -1366,6 +1366,18 @@
     };
 };
 
+class EnableMediaMon: public CheckBoxSetting, public GlobalSetting {
+public:
+    EnableMediaMon():
+        GlobalSetting("MonitorDrives") {
+        setLabel(QObject::tr("Monitor CD/DVD"));
+        setHelpText(QObject::tr("This enables support for monitoring "
+                    "your CD/DVD drives for new disks and launching"
+                    "the proper plugin to handle them."));
+        setValue(false);
+    };
+};
+
 class XboxBlinkBIN: public ComboBoxSetting, public GlobalSetting {
 public:
     XboxBlinkBIN():
@@ -1475,6 +1487,7 @@
     general->addChild(new SetupPinCodeRequired());
     general->addChild(new SetupPinCode());
     general->addChild(new EnableXbox());
+    general->addChild(new EnableMediaMon());
     addChild(general);
 }
 
Index: main.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythfrontend/main.cpp,v
retrieving revision 1.129
diff -u -r1.129 main.cpp
--- main.cpp	15 Jan 2004 03:10:16 -0000	1.129
+++ main.cpp	16 Jan 2004 11:25:32 -0000
@@ -41,6 +41,8 @@
 MythContext *gContext;
 XBox *xbox = NULL;
 
+
+
 void startGuide(void)
 {
     QString startchannel = gContext->GetSetting("DefaultTVChannel");
@@ -563,7 +565,7 @@
 {
     QString lcd_host;
     int lcd_port;
-
+    MediaMonitor* mon = NULL;
     QApplication a(argc, argv);
     QTranslator translator( 0 );
 
@@ -821,21 +823,24 @@
     qApp->lock();
     qApp->unlock();
 
-#if 0
-    MediaMonitor mon( NULL, 500, true );
-    mon.addFSTab();
-    VERBOSE( VB_ALL, QString("Starting media monitor.") );
-    mon.startMonitoring();
-#endif
+    if (gContext->GetNumSetting("MonitorDrives") == 1) {
+	mon = new MediaMonitor( NULL, 500, true );
+	mon->addFSTab();
+	VERBOSE( VB_ALL, QString("Starting media monitor.") );
+	mon->startMonitoring();
+    }
+
 
     int exitstatus = RunMenu(themedir);
 
     if (exitstatus == HALT)
         haltnow();
 
-#if 0
-    mon.stopMonitoring();
-#endif
+    if(mon) {
+	mon->stopMonitoring();
+	delete mon;
+    }
+
     delete gContext;
     return exitstatus;
 }


More information about the mythtv-dev mailing list