MCPcopy Create free account
hub / github.com/AntiMicroX/antimicrox / loadConfigFile

Method loadConfigFile

src/gui/joytabwidget.cpp:1345–1382  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1343}
1344
1345void 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
1384void JoyTabWidget::showQuickSetDialog()
1385{

Callers

nothing calls this directly

Calls 3

getProfileNameFunction · 0.85
isDeviceEditedMethod · 0.80
getJoyNumberMethod · 0.45

Tested by

no test coverage detected