Index: mythtv/programs/mythtv-setup/startprompt.cpp
===================================================================
--- mythtv/programs/mythtv-setup/startprompt.cpp	(revision 0)
+++ mythtv/programs/mythtv-setup/startprompt.cpp	(revision 0)
@@ -0,0 +1,142 @@
+// ANSI C
+#include <cstdlib>
+
+// POSIX
+#include <unistd.h>
+
+// qt
+#include <QApplication>
+#include <QKeyEvent>
+#include <QLabel>
+#include <QEvent>
+
+// myth
+#include "libmythtv/videosource.h"
+#include "libmythui/mythprogressdialog.h"
+#include "channeleditor.h"
+#include "compat.h"
+#include "exitcodes.h"
+#include "lcddevice.h"
+#include "mythcontext.h"
+#include "mythdbcon.h"
+#include "mythdirs.h"
+#include "myththemedmenu.h"
+#include "mythuihelper.h"
+#include "programinfo.h"
+#include "uitypes.h"
+
+#include "backendsettings.h"
+#include "startprompt.h"
+#include "libmythtv/videosource.h"
+
+#include <QApplication>
+
+// MythTV stuff
+#include "exitcodes.h"
+#include "mythcontext.h"
+#include "mythdialogbox.h"
+#include "mythmainwindow.h"
+#include "mythscreenstack.h"
+#include "remoteutil.h"
+
+#include "checksetup.h"
+#include "exitprompt.h"
+
+struct StartPrompterPrivate
+{
+    StartPrompterPrivate()
+    {
+        stk = GetMythMainWindow()->GetStack("popup stack");
+    }
+
+    MythScreenStack *stk;
+};
+
+StartPrompter::StartPrompter()
+{
+    m_d = new StartPrompterPrivate;
+}
+
+StartPrompter::~StartPrompter()
+{
+    delete m_d;
+}
+
+void StartPrompter::handleStart()
+{
+    // Offer to stop the backend if sensible
+    if (gContext->BackendIsRunning() && gContext->IsMasterHost())
+    {
+        backendRunningPrompt();
+    }    
+}
+
+void StartPrompter::leaveBackendRunning()
+{
+    VERBOSE(VB_GENERAL, "Continuing with backend running");
+    gContext->SetSetting("AutoRestartBackend", "0");
+}
+
+void StartPrompter::stopBackend()
+{
+    VERBOSE(VB_GENERAL, "Trying to stop backend");
+
+    QString commandString = gContext->GetSetting("BackendStopCommand");
+    if (!commandString.isEmpty())
+    {
+        myth_system(commandString);
+    }
+    gContext->SetSetting("AutoRestartBackend", "1");
+}
+
+void StartPrompter::backendRunningPrompt(void)
+{
+    bool backendIsRecording = false;
+    // Get recording status
+    if (!gContext->IsConnectedToMaster())
+    {
+        gContext->ConnectToMasterServer(false);
+        backendIsRecording = RemoteGetRecordingStatus(NULL, false);
+    }
+    
+    QString warning = tr("WARNING: The backend is currently running.")+"\n\n"+
+                      tr("Changing existing card inputs, deleting anything, "
+                     "or scanning for channels may not work.")+"\n\n";
+    if (backendIsRecording)
+    {
+        warning += tr("Recording Status: RECORDING.")+"\n"+
+                   tr("If you stop the backend now these recordings will be stopped!");
+    }
+    else
+    {
+        warning += tr("Recording Status: None.");
+    }
+
+    MythDialogBox *dia = new MythDialogBox(warning, m_d->stk, "actionmenu");
+
+    if (!dia->Create())
+    {
+        VERBOSE(VB_IMPORTANT, "Can't create Prompt dialog?");
+        delete dia;
+        quit();
+    }
+
+    // This is a hack so that the button clicks target the correct slot:
+    dia->SetReturnEvent(this, QString());
+
+    m_d->stk->AddScreen(dia);
+
+    QString commandString = gContext->GetSetting("BackendStopCommand");
+    if (!commandString.isEmpty())
+    {
+        // Only show option to stop backend if command is defined.
+        dia->AddButton(tr("Stop Backend and Continue"), SLOT(stopBackend()));
+    }
+    dia->AddButton(tr("Continue"), SLOT(leaveBackendRunning()));
+    dia->AddButton(tr("Exit"), SLOT(quit()));
+}
+
+void StartPrompter::quit()
+{
+    qApp->exit(GENERIC_EXIT_OK);
+}
Index: mythtv/programs/mythtv-setup/startprompt.h
===================================================================
--- mythtv/programs/mythtv-setup/startprompt.h	(revision 0)
+++ mythtv/programs/mythtv-setup/startprompt.h	(revision 0)
@@ -0,0 +1,28 @@
+#ifndef SETUPDIALOG_H_
+#define SETUPDIALOG_H_
+
+#include <QObject>
+
+class StartPrompter : public QObject
+{
+    Q_OBJECT
+
+  public:
+    StartPrompter();
+    ~StartPrompter();
+
+  public slots:
+    void handleStart();
+    void backendRunningPrompt();
+    void leaveBackendRunning();
+    void stopBackend();
+    void quit();
+
+  private:
+    StartPrompter(const StartPrompter &);
+
+  private:
+    struct StartPrompterPrivate *m_d;
+};
+
+#endif
\ No newline at end of file
Index: mythtv/programs/mythtv-setup/mythtv-setup.pro
===================================================================
--- mythtv/programs/mythtv-setup/mythtv-setup.pro	(revision 20658)
+++ mythtv/programs/mythtv-setup/mythtv-setup.pro	(working copy)
@@ -22,6 +22,8 @@
     DEFINES += USING_BACKEND
 }
 
+HEADERS += startprompt.h
+SOURCES += startprompt.cpp
 # Input
 HEADERS += backendsettings.h   checksetup.h   exitprompt.h importicons.h
 HEADERS += channeleditor.h
Index: mythtv/programs/mythtv-setup/exitprompt.cpp
===================================================================
--- mythtv/programs/mythtv-setup/exitprompt.cpp	(revision 20658)
+++ mythtv/programs/mythtv-setup/exitprompt.cpp	(working copy)
@@ -8,6 +8,7 @@
 #include "mythmainwindow.h"
 #include "mythscreenstack.h"
 #include "remoteutil.h"
+#include "mythsystem.h"
 
 #include "checksetup.h"
 #include "exitprompt.h"
@@ -94,8 +95,24 @@
 
 void ExitPrompter::quit()
 {
-    if (gContext->BackendIsRunning())
-        RemoteSendMessage("CLEAR_SETTINGS_CACHE");
+    // If the backend was stopped restart it here
+    if (gContext->GetSetting("AutoRestartBackend") == "1")
+    {
+        QString commandString = gContext->GetSetting("BackendStartCommand");
+        if (!commandString.isEmpty())
+        {
+            VERBOSE(VB_IMPORTANT, "backendrestart"+commandString);
+            myth_system(commandString);
+        }
+    }
+    else
+    {
+        // No need to run this if the backend has just restarted
+        if (gContext->BackendIsRunning())
+        {
+            RemoteSendMessage("CLEAR_SETTINGS_CACHE");
+        }
+    }
 
     qApp->exit(GENERIC_EXIT_OK);
 }
Index: mythtv/programs/mythtv-setup/main.cpp
===================================================================
--- mythtv/programs/mythtv-setup/main.cpp	(revision 20658)
+++ mythtv/programs/mythtv-setup/main.cpp	(working copy)
@@ -31,10 +31,12 @@
 #include "libmythtv/remoteutil.h"
 #include "backendsettings.h"
 #include "checksetup.h"
+#include "startprompt.h"
 
 using namespace std;
 
 ExitPrompter   *exitPrompt = NULL;
+StartPrompter   *startPrompt = NULL;
 
 void SetupMenuCallback(void* data, QString& selection)
 {
@@ -508,27 +510,10 @@
         return GENERIC_EXIT_DB_OUTOFDATE;
     }
 
-    QString warn =
-        QObject::tr("WARNING") + ": " +
-        QObject::tr("MythTV has detected that the backend is running.")+"\n\n"+
-        QObject::tr("Changing existing card inputs, deleting anything, "
-                    "or scanning for channels may not work.");
+    if (!startPrompt)
+            startPrompt = new StartPrompter();
+        startPrompt->handleStart();
 
-    bool backendIsRunning = gContext->BackendIsRunning();
-
-    if (backendIsRunning)
-    {
-        DialogCode val = MythPopupBox::Show2ButtonPopup(
-            mainWindow, QObject::tr("WARNING"), warn,
-            QObject::tr("Continue"),
-            QObject::tr("Exit"), kDialogCodeButton0);
-
-        if (kDialogCodeButton1 == val)
-        {
-            return GENERIC_EXIT_OK;
-        }
-    }
-
     REG_KEY("qt", "DELETE", "Delete", "D");
     REG_KEY("qt", "EDIT", "Edit", "E");
 
