X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fgui%2Fcontrollertab.cpp;h=bd73c2b0f8bc8e3afdc0c9c2df6b572f02e86407;hb=77430278bc7300a9ad84bdc2e40615c1d510dc78;hp=89a678f380ddff453bce1b412735ba527813c5a2;hpb=e310c1d53915d306d8aa9a1bed9bac489bd30b03;p=virtualjaguar diff --git a/src/gui/controllertab.cpp b/src/gui/controllertab.cpp index 89a678f..bd73c2b 100644 --- a/src/gui/controllertab.cpp +++ b/src/gui/controllertab.cpp @@ -226,17 +226,28 @@ void ControllerTab::AddMapName(void) profile[profileNum].mapName[31] = 0; profile[profileNum].preferredSlot = CONTROLLER1; - for(int i=BUTTON_FIRST; iaddItem(text, profileNum); +#if 0 mapNameList->setCurrentIndex(mapNameList->count() - 1); +#else + int selection = mapNameList->count() - 1; + mapNameList->setCurrentIndex(selection); + ChangeMapName(selection); + // We just added a new mapping, so enable the delete button! + deleteMapName->setDisabled(false); +#endif } void ControllerTab::DeleteMapName(void) { - QMessageBox::StandardButton retVal = QMessageBox::question(this, tr("Remove Mapping"), tr("Are you sure you want to remove this mapping?"), QMessageBox::No | QMessageBox::Yes, QMessageBox::No); + QString msg = QString("Map name: %1\n\nAre you sure you want to remove this mapping?").arg(profile[profileNum].mapName); + +// QMessageBox::StandardButton retVal = QMessageBox::question(this, tr("Remove Mapping"), tr("Are you sure you want to remove this mapping?"), QMessageBox::No | QMessageBox::Yes, QMessageBox::No); + QMessageBox::StandardButton retVal = QMessageBox::question(this, tr("Remove Mapping"), msg, QMessageBox::No | QMessageBox::Yes, QMessageBox::No); if (retVal == QMessageBox::No) return; @@ -245,5 +256,11 @@ void ControllerTab::DeleteMapName(void) int profileToRemove = profileNum; mapNameList->removeItem(index); DeleteProfile(profileToRemove); + // We need to reload the profile that we move to after deleting the current + // one... + ChangeMapName(mapNameList->currentIndex()); + // If we get down to one profile left for the device, we need to make sure + // that the user can't delete it! + deleteMapName->setDisabled(mapNameList->count() == 1 ? true : false); }