+ int freeProfile = GetFreeProfile();
+
+ if (freeProfile == -1)
+ {
+ // Oh crap, we're out of room! Alert the media!
+ // (Really, tho, we should pop this up *before* asking for user input.
+ // Which we now do!)
+#if 0
+ QMessageBox msg;
+ msg.setText(QString(tr("Can't create any more profiles!")));
+ msg.setIcon(QMessageBox::Warning);
+ msg.exec();
+#else
+ QMessageBox::warning(this, tr("Houston, we have a problem..."), tr("Can't create any more profiles!"));
+#endif
+
+ return;
+ }
+
+ QString text = QInputDialog::getText(this, tr("Add Map Name"), tr("Map name:"), QLineEdit::Normal);
+
+ if (text.isEmpty())
+ return;
+
+ // Add mapping...
+ profileNum = freeProfile;
+ profile[profileNum].device = deviceList->itemData(deviceList->currentIndex()).toInt();
+ strncpy(profile[profileNum].mapName, text.toAscii().data(), 31);
+ profile[profileNum].mapName[31] = 0;
+ profile[profileNum].preferredController = CONTROLLER1;
+
+ for(int i=BUTTON_FIRST; i<BUTTON_LAST; i++)
+ profile[profileNum].map[i] = '*';
+
+ mapNameList->addItem(text, profileNum);
+ mapNameList->setCurrentIndex(mapNameList->count() - 1);