cleanup: Use ShowAndGetInput for CGUIDialogOK usage where appropriate
authorjmarshallnz <jmarshallnz@svn>
Sun, 12 Sep 2010 07:20:44 +0000 (07:20 +0000)
committerjmarshallnz <jmarshallnz@svn>
Sun, 12 Sep 2010 07:20:44 +0000 (07:20 +0000)
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@33687 568bbfeb-2a22-0410-94d2-cc84cf5bfa90

xbmc/GUIPassword.cpp
xbmc/GUIWindowMusicBase.cpp
xbmc/GUIWindowVideoBase.cpp
xbmc/MusicDatabase.cpp
xbmc/utils/TuxBoxUtil.cpp

index 571d57a..0f7fca2 100644 (file)
@@ -146,15 +146,7 @@ bool CGUIPassword::CheckStartUpLock()
         strLabel.Format("%i %s",iLeft,strLabel1.c_str());
 
         // PopUp OK and Display: MasterLock mode has changed but no no Mastercode has been set!
-        CGUIDialogOK *dlg = (CGUIDialogOK *)g_windowManager.GetWindow(WINDOW_DIALOG_OK);
-        if (!dlg)
-          return false;
-
-        dlg->SetHeading( g_localizeStrings.Get(20076) );
-        dlg->SetLine( 0, g_localizeStrings.Get(12367) );
-        dlg->SetLine( 1, g_localizeStrings.Get(12368) );
-        dlg->SetLine( 2, strLabel);
-        dlg->DoModal();
+        CGUIDialogOK::ShowAndGetInput(20076, 12367, 12368, strLabel);
       }
       else
         i=g_passwordManager.iMasterLockRetriesLeft;
@@ -295,15 +287,7 @@ void CGUIPassword::UpdateMasterLockRetryCount(bool bResetCount)
     CStdString dlgLine1 = "";
     if (0 < g_passwordManager.iMasterLockRetriesLeft)
       dlgLine1.Format("%d %s", g_passwordManager.iMasterLockRetriesLeft, g_localizeStrings.Get(12343));
-    CGUIDialogOK *dialog = (CGUIDialogOK *)g_windowManager.GetWindow(WINDOW_DIALOG_OK); // Tell user they entered a bad password
-    if (dialog)
-    {
-      dialog->SetHeading(20075);
-      dialog->SetLine(0, 12345);
-      dialog->SetLine(1, dlgLine1);
-      dialog->SetLine(2, 0);
-      dialog->DoModal();
-    }
+    CGUIDialogOK::ShowAndGetInput(20075, 12345, dlgLine1, 0);
   }
   else
     g_passwordManager.iMasterLockRetriesLeft = g_guiSettings.GetInt("masterlock.maxretries"); // user entered correct mastercode, reset retries to max allowed
index bb47843..2b0a862 100644 (file)
@@ -1037,14 +1037,7 @@ void CGUIWindowMusicBase::OnRipCD()
 #endif
     }
     else
-    {
-      CGUIDialogOK* pDlgOK = (CGUIDialogOK*)g_windowManager.GetWindow(WINDOW_DIALOG_OK);
-      pDlgOK->SetHeading(257); // Error
-      pDlgOK->SetLine(0, g_localizeStrings.Get(20099)); //
-      pDlgOK->SetLine(1, ""); //
-      pDlgOK->SetLine(2, "");
-      pDlgOK->DoModal();
-    }
+      CGUIDialogOK::ShowAndGetInput(257, 20099, 0, 0);
   }
 }
 
@@ -1061,14 +1054,7 @@ void CGUIWindowMusicBase::OnRipTrack(int iItem)
 #endif
     }
     else
-    {
-      CGUIDialogOK* pDlgOK = (CGUIDialogOK*)g_windowManager.GetWindow(WINDOW_DIALOG_OK);
-      pDlgOK->SetHeading(257); // Error
-      pDlgOK->SetLine(0, g_localizeStrings.Get(20099)); //
-      pDlgOK->SetLine(1, ""); //
-      pDlgOK->SetLine(2, "");
-      pDlgOK->DoModal();
-    }
+      CGUIDialogOK::ShowAndGetInput(257, 20099, 0, 0);
   }
 }
 
index 7d28287..7c30e66 100644 (file)
@@ -676,18 +676,7 @@ bool CGUIWindowVideoBase::ShowIMDB(CFileItem *item, const ScraperPtr &info2)
           m_database.Close();
           return listNeedsUpdating; // user cancelled
         }
-        OutputDebugString("failed to get details\n");
-        // show dialog...
-        CGUIDialogOK *pDlgOK = (CGUIDialogOK*)g_windowManager.GetWindow(WINDOW_DIALOG_OK);
-        if (pDlgOK)
-        {
-          pDlgOK->SetHeading(195);
-          pDlgOK->SetLine(0, movieName);
-          pDlgOK->SetLine(1, "");
-          pDlgOK->SetLine(2, "");
-          pDlgOK->SetLine(3, "");
-          pDlgOK->DoModal();
-        }
+        CGUIDialogOK::ShowAndGetInput(195, movieName, 0, 0);
         m_database.Close();
         return listNeedsUpdating;
       }
@@ -1773,16 +1762,7 @@ void CGUIWindowVideoBase::AddToDatabase(int iItem)
   m_database.Close();
 
   // done...
-  CGUIDialogOK *pDialog = (CGUIDialogOK*)g_windowManager.GetWindow(WINDOW_DIALOG_OK);
-  if (pDialog)
-  {
-    pDialog->SetHeading(20177); // Done
-    pDialog->SetLine(0, movie.m_strTitle);
-    pDialog->SetLine(1, movie.m_strGenre);
-    pDialog->SetLine(2, movie.m_strIMDBNumber);
-    pDialog->SetLine(3, "");
-    pDialog->DoModal();
-  }
+  CGUIDialogOK::ShowAndGetInput(20177, movie.m_strTitle, movie.m_strGenre, movie.m_strIMDBNumber);
 
   // library view cache needs to be cleared
   CUtil::DeleteVideoDatabaseDirectoryCache();
index c7f4294..3690535 100644 (file)
@@ -2358,18 +2358,9 @@ bool CMusicDatabase::LookupCDDBInfo(bool bRequery/*=false*/)
         pCdInfo->SetNoCDDBInfo();
         pDialogProgress->Close();
         // ..no, an error occured, display it to the user
-        CGUIDialogOK *pDialogOK = (CGUIDialogOK *)g_windowManager.GetWindow(WINDOW_DIALOG_OK);
-        if (pDialogOK)
-        {
-          CStdString strErrorText;
-          strErrorText.Format("[%d] %s", cddb.getLastError(), cddb.getLastErrorText());
-
-          pDialogOK->SetHeading(255);
-          pDialogOK->SetLine(0, 257); //ERROR
-          pDialogOK->SetLine(1, strErrorText.c_str() );
-          pDialogOK->SetLine(2, "");
-          pDialogOK->DoModal();
-        }
+        CStdString strErrorText;
+        strErrorText.Format("[%d] %s", cddb.getLastError(), cddb.getLastErrorText());
+        CGUIDialogOK::ShowAndGetInput(255, 257, strErrorText, 0);
       }
     } // if ( !cddb.queryCDinfo( pCdInfo ) )
     pDialogProgress->Close();
index e1f9eb9..2510a51 100644 (file)
@@ -154,17 +154,9 @@ bool CTuxBoxUtil::CreateNewItem(const CFileItem& item, CFileItem& item_new)
       CLog::Log(LOGDEBUG, "%s ---------------------------------------------------------", __FUNCTION__);
       CLog::Log(LOGDEBUG, "%s - WARNING: Zaping Failed no Zap Point found!", __FUNCTION__);
       CLog::Log(LOGDEBUG, "%s ---------------------------------------------------------", __FUNCTION__);
-      CGUIDialogOK *dialog = (CGUIDialogOK *)g_windowManager.GetWindow(WINDOW_DIALOG_OK);
-      if (dialog)
-      {
-        CStdString strText;
-        strText.Format(g_localizeStrings.Get(21334).c_str(), item.GetLabel());
-        dialog->SetHeading( 21331 );
-        dialog->SetLine( 0, strText);
-        dialog->SetLine( 1, 21333 );
-        dialog->SetLine( 2, "" );
-        dialog->DoModal();
-      }
+      CStdString strText;
+      strText.Format(g_localizeStrings.Get(21334).c_str(), item.GetLabel());
+      CGUIDialogOK::ShowAndGetInput(21331, strText, 21333, 0);
     }
   }
   return false;