X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fgui%2Fcontrollertab.cpp;h=fe4c62b3e964b5384d2670f086ab18500e9f99f1;hb=32f569e1bd09f5d7f07005d119f6408805106381;hp=89a678f380ddff453bce1b412735ba527813c5a2;hpb=2e7108fbe3b1a8a42f155069e4648d43fda57789;p=virtualjaguar diff --git a/src/gui/controllertab.cpp b/src/gui/controllertab.cpp index 89a678f..fe4c62b 100644 --- a/src/gui/controllertab.cpp +++ b/src/gui/controllertab.cpp @@ -222,21 +222,32 @@ void ControllerTab::AddMapName(void) // Add mapping... profileNum = freeProfile; profile[profileNum].device = deviceList->itemData(deviceList->currentIndex()).toInt(); - strncpy(profile[profileNum].mapName, text.toAscii().data(), 31); + strncpy(profile[profileNum].mapName, text.toUtf8().data(), 31); 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); }