Advanced Settings Panel
[pierogi] / pirpanelmanager.cpp
index 7b340bc..c3dcaa5 100644 (file)
@@ -1,7 +1,5 @@
 #include "pirpanelmanager.h"
 
-#include "pirpanelselectionform.h"
-
 #include "forms/pirmainform.h"
 #include "forms/piraltmainform.h"
 #include "forms/pirutilityform.h"
 #include "forms/pirinputform.h"
 #include "forms/piradjustform.h"
 #include "forms/pirairconditionerform.h"
-#include "forms/pirfavoritesform.h"
+#include "forms/piraudiodeviceform.h"
+#include "forms/pircameraform.h"
+#include "forms/pirroombaform.h"
+#include "forms/piruserform.h"
+#include "forms/pirmacroform.h"
+#include "forms/pirpowersearchform.h"
+#include "forms/piradvancedform.h"
 
 #include "mainwindow.h"
 
 #include <QSettings>
+#include <QDialogButtonBox>
+#include <QPushButton>
 
 // Debugging:
 //#include <QMaemo5InformationBox>
 #include <iostream>
 
-PIRPanelManager::PIRPanelManager(MainWindow *mw)
-  : mainForm(0),
+PIRPanelManager::PIRPanelManager(
+  MainWindow *mw):
+    mainForm(0),
     altMainForm(0),
     utilityForm(0),
     keypadForm(0),
@@ -37,10 +44,32 @@ PIRPanelManager::PIRPanelManager(MainWindow *mw)
     inputForm(0),
     adjustForm(0),
     acForm(0),
-    favoritesForm(0),
+    audioDeviceForm(0),
+    cameraForm(0),
+    roombaForm(0),
+    userForm(0),
+    macroForm(0),
+    powerSearchForm(0),
+    advancedForm(0),
     altMainPanelFlag(false),
+    currentTabsName(Universal_Tabs),
     mainWindow(mw)
 {
+  QSettings settings("pietrzak.org", "Pierogi");
+  if (settings.contains("currentTabsName"))
+  {
+    int tabVal = settings.value("currentTabsName").toInt();
+
+    if (tabVal >= Last_Tabs_Marker)
+    {
+      currentTabsName = Universal_Tabs;
+    }
+    else
+    {
+      currentTabsName = PIRTabBarName(tabVal);
+    }
+  }
+
   // Set up the panel names:
   shortPanelNames[Main_Panel] = "Main";
   longPanelNames[Main_Panel] =
@@ -75,22 +104,161 @@ PIRPanelManager::PIRPanelManager(MainWindow *mw)
   shortPanelNames[AC_Panel] = "AC";
   longPanelNames[AC_Panel] =
     "A/C Panel - air conditioner controls";
-  shortPanelNames[Favorites_Panel] = "Favorites";
-  longPanelNames[Favorites_Panel] =
-    "Favorites Panel - memorized keysets";
-
-  activePanels[Main_Panel] = false;
-  activePanels[Utility_Panel]= false;
-  activePanels[Keypad_Panel]= false;
-  activePanels[Menu_Panel]= false;
-  activePanels[Media_Panel]= false;
-  activePanels[Media2_Panel]= false;
-  activePanels[Record_Panel]= false;
-  activePanels[TV_Panel]= false;
-  activePanels[Input_Panel]= false;
-  activePanels[Adjust_Panel]= false;
-  activePanels[AC_Panel]= false;
-  activePanels[Favorites_Panel]= false;
+  shortPanelNames[Audio_Panel] = "Audio";
+  longPanelNames[Audio_Panel] =
+    "Audio Device Panel - various audio related buttons";
+  shortPanelNames[Camera_Panel] = "Camera";
+  longPanelNames[Camera_Panel] =
+    "Camera Panel - simple shutter controls";
+  shortPanelNames[Roomba_Panel] = "Roomba";
+  longPanelNames[Roomba_Panel] =
+    "Roomba Panel - robotic vacuum cleaner controls";
+  shortPanelNames[User_Panel] = "User";
+  longPanelNames[User_Panel] =
+    "User Panel - macro control buttons";
+  shortPanelNames[Macro_Panel] = "Edit Macro Contents";
+  longPanelNames[Macro_Panel] =
+    "Edit Macros Panel - create, delete, edit, and manage macros";
+  shortPanelNames[PowerSearch_Panel] = "Keyset Search";
+  longPanelNames[PowerSearch_Panel] =
+    "Keyset Search Panel - execute power button in each keyset";
+  shortPanelNames[Advanced_Panel] = "Advanced Settings";
+  longPanelNames[Advanced_Panel] =
+    "Advanced Settings - allows adjustment of protocol settings";
+
+  mainForm = new PIRMainForm(mainWindow);
+  panels[Main_Panel] = mainForm;
+
+  altMainForm = new PIRAltMainForm(mainWindow);
+  panels[Alt_Main_Panel] = altMainForm;
+
+  utilityForm = new PIRUtilityForm(mainWindow);
+  panels[Utility_Panel] = utilityForm;
+
+  keypadForm = new PIRKeypadForm(mainWindow);
+  panels[Keypad_Panel] = keypadForm;
+
+  menuForm = new PIRMenuForm(mainWindow);
+  panels[Menu_Panel] = menuForm;
+
+  mediaForm = new PIRMediaForm(mainWindow);
+  panels[Media_Panel] = mediaForm;
+
+  media2Form = new PIRMedia2Form(mainWindow);
+  panels[Media2_Panel] = media2Form;
+
+  recordForm = new PIRRecordForm(mainWindow);
+  panels[Record_Panel] = recordForm;
+
+  tvForm = new PIRTVForm(mainWindow);
+  panels[TV_Panel] = tvForm;
+
+  inputForm = new PIRInputForm(mainWindow);
+  panels[Input_Panel] = inputForm;
+
+  adjustForm = new PIRAdjustForm(mainWindow);
+  panels[Adjust_Panel] = adjustForm;
+
+  acForm = new PIRAirConditionerForm(mainWindow);
+  panels[AC_Panel] = acForm;
+
+  audioDeviceForm = new PIRAudioDeviceForm(mainWindow);
+  panels[Audio_Panel] = audioDeviceForm;
+
+  cameraForm = new PIRCameraForm(mainWindow);
+  panels[Camera_Panel] = cameraForm;
+
+  roombaForm = new PIRRoombaForm(mainWindow);
+  panels[Roomba_Panel] = roombaForm;
+
+  userForm = new PIRUserForm(mainWindow);
+  panels[User_Panel] = userForm;
+
+  macroForm = new PIRMacroForm(mainWindow);
+  panels[Macro_Panel] = macroForm;
+
+  powerSearchForm = new PIRPowerSearchForm(mainWindow);
+  panels[PowerSearch_Panel] = powerSearchForm;
+
+  advancedForm = new PIRAdvancedForm();
+  panels[Advanced_Panel] = advancedForm;
+
+  // Set up the panel collections:
+  PIRPanelNameList pset;
+
+  // The universal collection:
+  pset.push_back(Main_Panel);
+  pset.push_back(Utility_Panel);
+  pset.push_back(Keypad_Panel);
+  pset.push_back(Menu_Panel);
+  pset.push_back(Media_Panel);
+  pset.push_back(User_Panel);
+//  pset.push_back(Input_Panel);
+  tabLists[Universal_Tabs] = pset;
+
+  // The TV collection:
+  pset.clear();
+  pset.push_back(Main_Panel);
+  pset.push_back(Utility_Panel);
+  pset.push_back(Keypad_Panel);
+  pset.push_back(Menu_Panel);
+  pset.push_back(TV_Panel);
+  pset.push_back(Input_Panel);
+  tabLists[TV_Tabs] = pset;
+
+  // The video media collection:
+  pset.clear();
+  pset.push_back(Main_Panel);
+  pset.push_back(Menu_Panel);
+  pset.push_back(Media_Panel);
+  pset.push_back(Media2_Panel);
+  pset.push_back(Input_Panel);
+  pset.push_back(Adjust_Panel);
+  tabLists[VideoMedia_Tabs] = pset;
+
+  // Audio panel collection:
+  pset.clear();
+  pset.push_back(Main_Panel);
+  pset.push_back(Keypad_Panel);
+  pset.push_back(Media_Panel);
+  pset.push_back(Audio_Panel);
+  tabLists[Audio_Tabs] = pset;
+
+  // The air conditioner collection:
+  pset.clear();
+  pset.push_back(AC_Panel);
+  tabLists[AC_Tabs] = pset;
+
+  // The recording collection:
+  pset.clear();
+  pset.push_back(Record_Panel);
+  pset.push_back(Keypad_Panel);
+  tabLists[Record_Tabs] = pset;
+
+  // The camera control collection:
+  pset.clear();
+  pset.push_back(Camera_Panel);
+  tabLists[Camera_Tabs] = pset;
+
+  // The Roomba collection:
+  pset.clear();
+  pset.push_back(Roomba_Panel);
+  tabLists[Roomba_Tabs] = pset;
+
+  // The Macro Management collection:
+  pset.clear();
+  pset.push_back(Macro_Panel);
+  tabLists[Macro_Tabs] = pset;
+
+  // The Power Search collection:
+  pset.clear();
+  pset.push_back(PowerSearch_Panel);
+  tabLists[PowerSearch_Tabs] = pset;
+
+  // The Advanced Settings collection:
+  pset.clear();
+  pset.push_back(Advanced_Panel);
+  tabLists[Advanced_Tabs] = pset;
 }
 
 
@@ -104,183 +272,84 @@ PIRPanelManager::~PIRPanelManager()
 }
 
 
-void PIRPanelManager::setupPanels(
-  PIRPanelSelectionForm *psf)
+void PIRPanelManager::updateTabSet()
 {
   QSettings settings("pietrzak.org", "Pierogi");
+  settings.setValue("currentTabsName", currentTabsName);
 
-  settings.beginGroup("Panels");
-
-  // Do the panel settings exist? (We'll check for "Main_Panel".)
-  if (!settings.contains(shortPanelNames[Main_Panel]))
-  {
-    // A default set of panels:
-    psf->setCheckBox(Main_Panel, true);
-    psf->setCheckBox(Utility_Panel, true);
-    psf->setCheckBox(Keypad_Panel, true);
-    psf->setCheckBox(Menu_Panel, true);
-    psf->setCheckBox(Media_Panel, true);
-    psf->setCheckBox(Favorites_Panel, true);
-  }
-  else
-  {
-    psf->setCheckBox(
-      Main_Panel,
-      settings.value(shortPanelNames[Main_Panel]).toBool());
-
-    if (settings.contains(shortPanelNames[Utility_Panel]))
-    {
-      psf->setCheckBox(
-        Utility_Panel,
-        settings.value(shortPanelNames[Utility_Panel]).toBool());
-    }
-
-    if (settings.contains(shortPanelNames[Keypad_Panel]))
-    {
-      psf->setCheckBox(
-        Keypad_Panel,
-        settings.value(shortPanelNames[Keypad_Panel]).toBool());
-    }
-
-    if (settings.contains(shortPanelNames[Menu_Panel]))
-    {
-      psf->setCheckBox(
-        Menu_Panel,
-        settings.value(shortPanelNames[Menu_Panel]).toBool());
-    }
+  mainWindow->disableUpdates();
+  mainWindow->clearTabs();
 
-    if (settings.contains(shortPanelNames[Media_Panel]))
-    {
-      psf->setCheckBox(
-        Media_Panel,
-        settings.value(shortPanelNames[Media_Panel]).toBool());
-    }
-
-    if (settings.contains(shortPanelNames[Media2_Panel]))
-    {
-      psf->setCheckBox(
-        Media2_Panel,
-        settings.value(shortPanelNames[Media2_Panel]).toBool());
-    }
+  PIRPanelNameList::const_iterator i = tabLists[currentTabsName].begin();
 
-    if (settings.contains(shortPanelNames[Record_Panel]))
-    {
-      psf->setCheckBox(
-        Record_Panel,
-        settings.value(shortPanelNames[Record_Panel]).toBool());
-    }
-
-    if (settings.contains(shortPanelNames[TV_Panel]))
-    {
-      psf->setCheckBox(
-        TV_Panel,
-        settings.value(shortPanelNames[TV_Panel]).toBool());
-    }
-
-    if (settings.contains(shortPanelNames[Input_Panel]))
-    {
-      psf->setCheckBox(
-        Input_Panel,
-        settings.value(shortPanelNames[Input_Panel]).toBool());
-    }
-
-    if (settings.contains(shortPanelNames[Adjust_Panel]))
+  while (i != tabLists[currentTabsName].end())
+  {
+    if ((*i == Main_Panel) && altMainPanelFlag)
     {
-      psf->setCheckBox(
-        Adjust_Panel,
-        settings.value(shortPanelNames[Adjust_Panel]).toBool());
+      mainWindow->addTab(altMainForm, shortPanelNames[Main_Panel]);
     }
-
-    if (settings.contains(shortPanelNames[AC_Panel]))
+    else
     {
-      psf->setCheckBox(
-        AC_Panel,
-        settings.value(shortPanelNames[AC_Panel]).toBool());
+      mainWindow->addTab(panels[*i], shortPanelNames[*i]);
     }
 
-    if (settings.contains(shortPanelNames[Favorites_Panel]))
-    {
-      psf->setCheckBox(
-        Favorites_Panel,
-        settings.value(shortPanelNames[Favorites_Panel]).toBool());
-    }
+    ++i;
   }
 
-  settings.endGroup();
+  mainWindow->enableUpdates();
 }
 
 
 void PIRPanelManager::enableButtons(
-  const PIRKeysetManager *keyset,
+  PIRKeysetManager *keyset,
   unsigned int id)
 {
-  if (altMainPanelFlag)
-  {
-    if (altMainForm) altMainForm->enableButtons(keyset, id);
-  }
-  else
-  {
-    if (mainForm) mainForm->enableButtons(keyset, id);
-  }
-  if (utilityForm) utilityForm->enableButtons(keyset, id);
-  if (keypadForm) keypadForm->enableButtons(keyset, id);
-  if (menuForm) menuForm->enableButtons(keyset, id);
-  if (mediaForm) mediaForm->enableButtons(keyset, id);
-  if (media2Form) media2Form->enableButtons(keyset, id);
-  if (recordForm) recordForm->enableButtons(keyset, id);
-  if (tvForm) tvForm->enableButtons(keyset, id);
-  if (inputForm) inputForm->enableButtons(keyset, id);
-  if (adjustForm) adjustForm->enableButtons(keyset, id);
-  if (acForm) acForm->enableButtons(keyset, id);
+  mainForm->enableButtons(keyset, id);
+  altMainForm->enableButtons(keyset, id);
+  commonEnableButtons(keyset, id);
 }
 
 
-void PIRPanelManager::managePanel(
-  PIRPanelName name,
-  int state)
+void PIRPanelManager::enableButtons(
+  PIRKeysetManager *keyset,
+  unsigned int currentID,
+  unsigned int defaultID)
 {
-  int currentPanel = 0;
-  int displayCount = 0;
-
-//  PIRPanelList::iterator i = panelList.begin();
-  while (currentPanel < Last_Panel_Marker)
-  {
-    if (currentPanel == name)
-    {
-      break;
-    }
-    else if (activePanels[PIRPanelName(currentPanel)])
-    {
-      ++displayCount;
-    }
-
-    ++currentPanel;
-  }
-
-  if (currentPanel == Last_Panel_Marker)
-  {
-    // should throw an error message here!!!
-    return;
-  }
+  mainForm->enableButtons(keyset, currentID, defaultID);
+  altMainForm->enableButtons(keyset, currentID, defaultID);
+  commonEnableButtons(keyset, currentID);
+}
 
-  QSettings settings("pietrzak.org", "Pierogi");
 
-  settings.beginGroup("Panels");
+void PIRPanelManager::commonEnableButtons(
+  PIRKeysetManager *keyset,
+  unsigned int id)
+{
+  utilityForm->enableButtons(keyset, id);
+  keypadForm->enableButtons(keyset, id);
+  menuForm->enableButtons(keyset, id);
+  mediaForm->enableButtons(keyset, id);
+  media2Form->enableButtons(keyset, id);
+  recordForm->enableButtons(keyset, id);
+  tvForm->enableButtons(keyset, id);
+  inputForm->enableButtons(keyset, id);
+  adjustForm->enableButtons(keyset, id);
+  acForm->enableButtons(keyset, id);
+  audioDeviceForm->enableButtons(keyset, id);
+  cameraForm->enableButtons(keyset, id);
+  roombaForm->enableButtons(keyset, id);
+
+  // Also, set the label in the power search form:
+  powerSearchForm->setKeysetName(mainWindow->getCurrentFullName());
+
+  // Set up the advanced parameters:
+  advancedForm->setupForm(keyset, id);
+}
 
-  if (state == Qt::Unchecked && activePanels[PIRPanelName(currentPanel)])
-  {
-    hidePanel(name, displayCount);
-    activePanels[PIRPanelName(currentPanel)] = false;
-    settings.setValue(shortPanelNames[PIRPanelName(currentPanel)], false);
-  }
-  else if (state == Qt::Checked && !activePanels[PIRPanelName(currentPanel)])
-  {
-    showPanel(name, displayCount);
-    activePanels[PIRPanelName(currentPanel)] = true;
-    settings.setValue(shortPanelNames[PIRPanelName(currentPanel)], true);
-  }
 
-  settings.endGroup();
+void PIRPanelManager::updateUserButtons()
+{
+  userForm->setupButtons();
 }
 
 
@@ -294,20 +363,7 @@ void PIRPanelManager::useMainPanel()
 
   altMainPanelFlag = false;
 
-  // Is the main panel currently active?
-  if (activePanels[Main_Panel])
-  {
-    mainWindow->removePanel(0, altMainForm);
-    if (!mainForm)
-    {
-      mainForm = new PIRMainForm(mainWindow);
-    }
-
-    mainWindow->insertPanel(0, mainForm, longPanelNames[Main_Panel]);
-    mainWindow->selectPanel(0);
-  }
-
-  mainWindow->enableButtons();
+  updateTabSet();
 }
 
 
@@ -321,324 +377,113 @@ void PIRPanelManager::useAltMainPanel()
 
   altMainPanelFlag = true;
 
-  // Is the main panel currently active?
-  if (activePanels[Main_Panel])
-  {
-    mainWindow->removePanel(0, mainForm);
-    if (!altMainForm)
-    {
-      altMainForm = new PIRAltMainForm(mainWindow);
-    }
+  updateTabSet();
+}
 
-    mainWindow->insertPanel(0, altMainForm, longPanelNames[Main_Panel]);
-    mainWindow->selectPanel(0);
-  }
 
-  mainWindow->enableButtons();
+/*
+void PIRPanelManager::setupUniversalTabs()
+{
+  if (currentTabsName == Universal_Tabs) return;
+
+  currentTabsName = Universal_Tabs;
+  updateTabSet();
 }
 
 
-void PIRPanelManager::hidePanel(
-  PIRPanelName name,
-  int index)
+void PIRPanelManager::setupTVTabs()
 {
-  switch (name)
-  {
-    case Main_Panel:
-      if (altMainPanelFlag)
-      {
-        if (altMainForm) mainWindow->removePanel(index, altMainForm);
-      }
-      else
-      {
-        if (mainForm) mainWindow->removePanel(index, mainForm);
-      }
-      break;
-
-    case Utility_Panel:
-      if (utilityForm) mainWindow->removePanel(index, utilityForm);
-      break;
-
-    case Keypad_Panel:
-      if (keypadForm) mainWindow->removePanel(index, keypadForm);
-      break;
-
-    case Menu_Panel:
-      if (menuForm) mainWindow->removePanel(index, menuForm);
-      break;
-
-    case Media_Panel:
-      if (mediaForm) mainWindow->removePanel(index, mediaForm);
-      break;
-
-    case Media2_Panel:
-      if (media2Form) mainWindow->removePanel(index, media2Form);
-      break;
-
-    case Record_Panel:
-      if (recordForm) mainWindow->removePanel(index, recordForm);
-      break;
-
-    case TV_Panel:
-      if (tvForm) mainWindow->removePanel(index, tvForm);
-      break;
-
-    case Input_Panel:
-      if (inputForm) mainWindow->removePanel(index, inputForm);
-      break;
-
-    case Adjust_Panel:
-      if (adjustForm) mainWindow->removePanel(index, adjustForm);
-      break;
-
-    case AC_Panel:
-      if (acForm) mainWindow->removePanel(index, acForm);
-      break;
-
-    case Favorites_Panel:
-      if (favoritesForm) mainWindow->removePanel(index, favoritesForm);
-      break;
-
-    default:
-      return; 
-      break;
-  }
+  if (currentTabsName == TV_Tabs) return;
+
+  currentTabsName = TV_Tabs;
+  updateTabSet();
 }
 
 
-void PIRPanelManager::showPanel(
-  PIRPanelName name,
-  int index)
+void PIRPanelManager::setupVideoTabs()
 {
-  switch (name)
-  {
-    case Main_Panel:
-      if (altMainPanelFlag)
-      {
-        if (!altMainForm)
-        {
-          altMainForm = new PIRAltMainForm(mainWindow);
-          mainWindow->enableButtons();
-        }
-
-        mainWindow->insertPanel(
-          index,
-          altMainForm,
-          longPanelNames[Main_Panel]);
-      }
-      else
-      {
-        if (!mainForm)
-        {
-          mainForm = new PIRMainForm(mainWindow);
-          mainWindow->enableButtons();
-        }
-
-        mainWindow->insertPanel(
-          index,
-          mainForm,
-          longPanelNames[Main_Panel]);
-      }
-
-      break;
-
-    case Utility_Panel:
-      if (!utilityForm)
-      {
-        utilityForm = new PIRUtilityForm(mainWindow);
-        mainWindow->enableButtons();
-      }
-
-      mainWindow->insertPanel(
-        index,
-        utilityForm,
-        longPanelNames[Utility_Panel]);
-
-      break;
-
-    case Keypad_Panel:
-      if (!keypadForm)
-      {
-        keypadForm = new PIRKeypadForm(mainWindow);
-        mainWindow->enableButtons();
-      }
-
-      mainWindow->insertPanel(
-        index,
-        keypadForm,
-        longPanelNames[Keypad_Panel]);
-
-      break;
-
-    case Menu_Panel:
-      if (!menuForm)
-      {
-        menuForm = new PIRMenuForm(mainWindow);
-        mainWindow->enableButtons();
-      }
-
-      mainWindow->insertPanel(
-        index,
-        menuForm,
-        longPanelNames[Menu_Panel]);
-
-      break;
-
-    case Media_Panel:
-      if (!mediaForm)
-      {
-        mediaForm = new PIRMediaForm(mainWindow);
-        mainWindow->enableButtons();
-      }
-
-      mainWindow->insertPanel(
-        index,
-        mediaForm,
-        longPanelNames[Media_Panel]);
-
-      break;
-
-    case Media2_Panel:
-      if (!media2Form)
-      {
-        media2Form = new PIRMedia2Form(mainWindow);
-        mainWindow->enableButtons();
-      }
-
-      mainWindow->insertPanel(
-        index,
-        media2Form,
-        longPanelNames[Media2_Panel]);
-
-      break;
-
-    case Record_Panel:
-      if (!recordForm)
-      {
-        recordForm = new PIRRecordForm(mainWindow);
-        mainWindow->enableButtons();
-      }
-
-      mainWindow->insertPanel(
-        index,
-        recordForm,
-        longPanelNames[Record_Panel]);
-
-      break;
-
-    case TV_Panel:
-      if (!tvForm)
-      {
-        tvForm = new PIRTVForm(mainWindow);
-        mainWindow->enableButtons();
-      }
-
-      mainWindow->insertPanel(
-        index,
-        tvForm,
-        longPanelNames[TV_Panel]);
-
-      break;
-
-    case Input_Panel:
-      if (!inputForm)
-      {
-        inputForm = new PIRInputForm(mainWindow);
-        mainWindow->enableButtons();
-      }
-
-      mainWindow->insertPanel(
-        index,
-        inputForm,
-        longPanelNames[Input_Panel]);
-
-      break;
-
-    case Adjust_Panel:
-      if (!adjustForm)
-      {
-        adjustForm = new PIRAdjustForm(mainWindow);
-        mainWindow->enableButtons();
-      }
-
-      mainWindow->insertPanel(
-        index,
-        adjustForm,
-        longPanelNames[Adjust_Panel]);
-
-      break;
-
-    case AC_Panel:
-      if (!acForm)
-      {
-        acForm = new PIRAirConditionerForm(mainWindow);
-        mainWindow->enableButtons();
-      }
-
-      mainWindow->insertPanel(
-        index,
-        acForm,
-        longPanelNames[AC_Panel]);
-
-      break;
-
-    case Favorites_Panel:
-      if (!favoritesForm)
-      {
-        favoritesForm = new PIRFavoritesForm(mainWindow);
-        mainWindow->enableButtons();
-      }
-
-      mainWindow->insertPanel(
-        index,
-        favoritesForm,
-        longPanelNames[Favorites_Panel]);
-
-      break;
-
-    default:
-      break;
-  }
+  if (currentTabsName == VideoMedia_Tabs) return;
+
+  currentTabsName = VideoMedia_Tabs;
+  updateTabSet();
+}
+
+
+void PIRPanelManager::setupACTabs()
+{
+  if (currentTabsName == AC_Tabs) return;
+
+  currentTabsName = AC_Tabs;
+  updateTabSet();
 }
 
 
-void PIRPanelManager::selectPrevFavKeyset()
+void PIRPanelManager::setupRecordTabs()
 {
-  // If the favorites form doesn't exist, no need to continue:
-  if (!favoritesForm) return;
+  if (currentTabsName == Record_Tabs) return;
 
-  favoritesForm->selectPrevFavKeyset();
+  currentTabsName = Record_Tabs;
+  updateTabSet();
 }
+*/
 
 
-void PIRPanelManager::selectNextFavKeyset()
+void PIRPanelManager::setupTabs(
+  PIRTabBarName name)
 {
-  // If the favorites form doesn't exist, no need to continue:
-  if (!favoritesForm) return;
+  if (currentTabsName == name) return;
 
-  favoritesForm->selectNextFavKeyset();
+  currentTabsName = name;
+  updateTabSet();
 }
 
 
-void PIRPanelManager::addFavoritesItem(
-  PIRKeysetWidgetItem *item)
+void PIRPanelManager::gotoPreviousTabs()
 {
-  if (!favoritesForm)
+  PIRTabsCollection::const_iterator i = tabLists.find(currentTabsName);
+
+  if (i == tabLists.end())
   {
-    favoritesForm = new PIRFavoritesForm(mainWindow);
+    // Couldn't find currentTabsName!  Throw an error here?
+    return;
   }
 
-  favoritesForm->addItem(item);
+  if (i == tabLists.begin())
+  {
+    // Already at first collection, nothing to do:
+    return;
+  }
+
+  --i;
+  currentTabsName = i->first;
+  updateTabSet();
 }
 
 
-QListWidget *PIRPanelManager::getFavoritesListWidget()
+void PIRPanelManager::gotoNextTabs()
 {
-  if (!favoritesForm)
+  PIRTabsCollection::const_iterator i = tabLists.find(currentTabsName);
+
+  if (i == tabLists.end())
   {
-    favoritesForm = new PIRFavoritesForm(mainWindow);
+    // Couldn't find currentTabsName!  Throw an error?
+    return;
   }
 
-  return favoritesForm->getFavoritesListWidget();
+  ++i;
+
+  if (i == tabLists.end())
+  {
+    // We're already at the last collection, nothing to do:
+    return;
+  }
+
+  currentTabsName = i->first;
+  updateTabSet();
 }
 
+
+QComboBox *PIRPanelManager::getKeysetComboBox()
+{
+  return macroForm->getKeysetComboBox();
+}