X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=pirpanelmanager.cpp;h=c3dcaa5f336bb80300e2403408e71f03e5a9e00c;hb=HEAD;hp=c8c64b29a3970db514d048faea9285e981220d38;hpb=a755f0efc0ba10848d26e1aed7f9933ccdcbb59e;p=pierogi diff --git a/pirpanelmanager.cpp b/pirpanelmanager.cpp index c8c64b2..c3dcaa5 100644 --- a/pirpanelmanager.cpp +++ b/pirpanelmanager.cpp @@ -15,7 +15,10 @@ #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" @@ -25,7 +28,7 @@ // Debugging: //#include -//#include +#include PIRPanelManager::PIRPanelManager( MainWindow *mw): @@ -44,7 +47,10 @@ PIRPanelManager::PIRPanelManager( audioDeviceForm(0), cameraForm(0), roombaForm(0), + userForm(0), + macroForm(0), powerSearchForm(0), + advancedForm(0), altMainPanelFlag(false), currentTabsName(Universal_Tabs), mainWindow(mw) @@ -52,7 +58,16 @@ PIRPanelManager::PIRPanelManager( QSettings settings("pietrzak.org", "Pierogi"); if (settings.contains("currentTabsName")) { - currentTabsName = PIRTabBarName(settings.value("currentTabsName").toInt()); + int tabVal = settings.value("currentTabsName").toInt(); + + if (tabVal >= Last_Tabs_Marker) + { + currentTabsName = Universal_Tabs; + } + else + { + currentTabsName = PIRTabBarName(tabVal); + } } // Set up the panel names: @@ -98,9 +113,18 @@ PIRPanelManager::PIRPanelManager( 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; @@ -147,9 +171,18 @@ PIRPanelManager::PIRPanelManager( 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; @@ -159,6 +192,7 @@ PIRPanelManager::PIRPanelManager( 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; @@ -169,7 +203,7 @@ PIRPanelManager::PIRPanelManager( pset.push_back(Keypad_Panel); pset.push_back(Menu_Panel); pset.push_back(TV_Panel); - pset.push_back(Adjust_Panel); + pset.push_back(Input_Panel); tabLists[TV_Tabs] = pset; // The video media collection: @@ -179,6 +213,7 @@ PIRPanelManager::PIRPanelManager( 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: @@ -210,10 +245,20 @@ PIRPanelManager::PIRPanelManager( 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; } @@ -256,7 +301,7 @@ void PIRPanelManager::updateTabSet() void PIRPanelManager::enableButtons( - const PIRKeysetManager *keyset, + PIRKeysetManager *keyset, unsigned int id) { mainForm->enableButtons(keyset, id); @@ -266,7 +311,7 @@ void PIRPanelManager::enableButtons( void PIRPanelManager::enableButtons( - const PIRKeysetManager *keyset, + PIRKeysetManager *keyset, unsigned int currentID, unsigned int defaultID) { @@ -277,7 +322,7 @@ void PIRPanelManager::enableButtons( void PIRPanelManager::commonEnableButtons( - const PIRKeysetManager *keyset, + PIRKeysetManager *keyset, unsigned int id) { utilityForm->enableButtons(keyset, id); @@ -296,6 +341,15 @@ void PIRPanelManager::commonEnableButtons( // Also, set the label in the power search form: powerSearchForm->setKeysetName(mainWindow->getCurrentFullName()); + + // Set up the advanced parameters: + advancedForm->setupForm(keyset, id); +} + + +void PIRPanelManager::updateUserButtons() +{ + userForm->setupButtons(); } @@ -382,3 +436,54 @@ void PIRPanelManager::setupTabs( currentTabsName = name; updateTabSet(); } + + +void PIRPanelManager::gotoPreviousTabs() +{ + PIRTabsCollection::const_iterator i = tabLists.find(currentTabsName); + + if (i == tabLists.end()) + { + // Couldn't find currentTabsName! Throw an error here? + return; + } + + if (i == tabLists.begin()) + { + // Already at first collection, nothing to do: + return; + } + + --i; + currentTabsName = i->first; + updateTabSet(); +} + + +void PIRPanelManager::gotoNextTabs() +{ + PIRTabsCollection::const_iterator i = tabLists.find(currentTabsName); + + if (i == tabLists.end()) + { + // Couldn't find currentTabsName! Throw an error? + return; + } + + ++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(); +}