| 1343 | } |
| 1344 | |
| 1345 | void JoyTabWidget::loadConfigFile(QString fileLocation) |
| 1346 | { |
| 1347 | checkForUnsavedProfile(-1); |
| 1348 | |
| 1349 | if (!m_joystick->isDeviceEdited()) |
| 1350 | { |
| 1351 | int numberRecentProfiles = m_settings->value("NumberRecentProfiles", DEFAULTNUMBERPROFILES).toInt(); |
| 1352 | QFileInfo fileinfo(fileLocation); |
| 1353 | if (fileinfo.exists() && ((fileinfo.suffix() == "xml") || (fileinfo.suffix() == "amgp"))) |
| 1354 | { |
| 1355 | qDebug() << "Loading config file: " << fileLocation; |
| 1356 | int searchIndex = configBox->findData(fileinfo.absoluteFilePath()); |
| 1357 | if (searchIndex == -1) |
| 1358 | { |
| 1359 | disconnectCheckUnsavedEvent(); |
| 1360 | disconnectMainComboBoxEvents(); |
| 1361 | |
| 1362 | if ((numberRecentProfiles > 0) && (configBox->count() == (numberRecentProfiles + 1))) |
| 1363 | { |
| 1364 | configBox->removeItem(numberRecentProfiles - 1); |
| 1365 | // configBox->removeItem(5); |
| 1366 | } |
| 1367 | configBox->insertItem(1, PadderCommon::getProfileName(fileinfo), fileinfo.absoluteFilePath()); |
| 1368 | |
| 1369 | reconnectCheckUnsavedEvent(); |
| 1370 | reconnectMainComboBoxEvents(); |
| 1371 | |
| 1372 | configBox->setCurrentIndex(1); |
| 1373 | emit joystickConfigChanged(m_joystick->getJoyNumber()); |
| 1374 | } else if (searchIndex != configBox->currentIndex()) |
| 1375 | { |
| 1376 | configBox->setCurrentIndex(searchIndex); |
| 1377 | emit joystickConfigChanged(m_joystick->getJoyNumber()); |
| 1378 | } |
| 1379 | qDebug() << "Config file loaded"; |
| 1380 | } |
| 1381 | } |
| 1382 | } |
| 1383 | |
| 1384 | void JoyTabWidget::showQuickSetDialog() |
| 1385 | { |
nothing calls this directly
no test coverage detected