Skip to content

Commit 9d9c9ce

Browse files
committed
Remove unused --map flag used for opening only mapping window
1 parent 35250df commit 9d9c9ce

File tree

7 files changed

+2
-208
lines changed

7 files changed

+2
-208
lines changed

src/antimicrosettings.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,6 @@ void AntiMicroSettings::importFromCommandLine(CommandLineUtility &cmdutility)
6363
{
6464
getCmdSettings().setValue("LaunchInTray", 1);
6565
}
66-
if (cmdutility.shouldMapController())
67-
{
68-
getCmdSettings().setValue("DisplaySDLMapping", 1);
69-
}
7066
}
7167
/**
7268
* @brief applies settings from command line to logger

src/commandlineutility.cpp

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ CommandLineUtility::CommandLineUtility(QObject *parent)
4141
unloadProfile = false;
4242
startSetNumber = 0;
4343
listControllers = false;
44-
mappingController = false;
4544
currentLogLevel = Logger::LOG_NONE;
4645

4746
currentListsIndex = 0;
@@ -104,11 +103,7 @@ void CommandLineUtility::parseArguments(const QApplication &parsed_app)
104103
// {"next",
105104
// QCoreApplication::translate("main", "Advance profile loading set
106105
// options")},
107-
// {"map",
108-
// QCoreApplication::translate("main", "Open game controller
109-
// mapping window of selected controller. Value can be
110-
// a controller index or GUID."),
111-
// QCoreApplication::translate("main", "value")},
106+
112107
});
113108

114109
parser.process(parsed_app);
@@ -173,11 +168,6 @@ void CommandLineUtility::parseArguments(const QApplication &parsed_app)
173168
listControllers = true;
174169
}
175170

176-
if (parser.isSet("map"))
177-
{
178-
parseArgsMap(parser);
179-
}
180-
181171
#if (defined(WITH_UINPUT) && defined(WITH_XTEST))
182172

183173
if (parser.isSet("eventgen"))
@@ -380,33 +370,6 @@ void CommandLineUtility::parseArgsStartSet(const QCommandLineParser &parser)
380370
}
381371
}
382372

383-
void CommandLineUtility::parseArgsMap(const QCommandLineParser &parser)
384-
{
385-
QString mapOptionText = parser.value("map");
386-
387-
if (!mapOptionText.isEmpty())
388-
{
389-
bool validNumber = false;
390-
int tempNumber = mapOptionText.toInt(&validNumber);
391-
392-
if (validNumber)
393-
{
394-
controllerNumber = tempNumber;
395-
mappingController = true;
396-
} else if (!mapOptionText.isEmpty())
397-
{
398-
controllerIDString = mapOptionText;
399-
mappingController = true;
400-
} else
401-
{
402-
throw std::runtime_error(QObject::tr("Controller identifier is not a valid value.").toStdString());
403-
}
404-
} else
405-
{
406-
throw std::runtime_error(QObject::tr("No controller was specified.").toStdString());
407-
}
408-
}
409-
410373
bool CommandLineUtility::isLaunchInTrayEnabled() { return launchInTray; }
411374

412375
bool CommandLineUtility::isTrayHidden() { return hideTrayIcon; }
@@ -435,8 +398,6 @@ int CommandLineUtility::getJoyStartSetNumber() { return startSetNumber - 1; }
435398

436399
bool CommandLineUtility::shouldListControllers() { return listControllers; }
437400

438-
bool CommandLineUtility::shouldMapController() { return mappingController; }
439-
440401
QString CommandLineUtility::getEventGenerator() { return eventGenerator; }
441402

442403
Logger::LogLevel CommandLineUtility::getCurrentLogLevel() { return currentLogLevel; }

src/commandlineutility.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ class CommandLineUtility : public QObject
102102
bool isShowRequested();
103103
bool isUnloadRequested();
104104
bool shouldListControllers();
105-
bool shouldMapController();
106105
bool hasProfileInOptions();
107106

108107
int getControllerNumber();
@@ -127,7 +126,6 @@ class CommandLineUtility : public QObject
127126
bool showRequest;
128127
bool unloadProfile;
129128
bool listControllers;
130-
bool mappingController;
131129

132130
int startSetNumber;
133131
int controllerNumber;
@@ -148,7 +146,6 @@ class CommandLineUtility : public QObject
148146
void parseArgsPrControle(const QCommandLineParser &parser);
149147
void parseArgsUnload(const QCommandLineParser &parser);
150148
void parseArgsStartSet(const QCommandLineParser &parser);
151-
void parseArgsMap(const QCommandLineParser &parser);
152149
};
153150

154151
#endif // COMMANDLINEPARSER_H

src/gui/gamecontrollermappingdialog.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -332,14 +332,8 @@ void GameControllerMappingDialog::saveChanges()
332332
settings->setValue(QString("Mappings/%1%2").arg(device->getUniqueIDString()).arg("Disable"), "0");
333333
settings->sync();
334334

335-
bool displayMapping = settings->runtimeValue("DisplaySDLMapping", false).toBool();
336335
settings->getLock()->unlock();
337336

338-
if (displayMapping)
339-
{
340-
PRINT_STDOUT() << generateSDLMappingString();
341-
}
342-
343337
emit mappingUpdate(mappingString, device);
344338
}
345339

src/gui/mainwindow.cpp

Lines changed: 1 addition & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,7 @@ MainWindow::MainWindow(QMap<SDL_JoystickID, InputDevice *> *joysticks, CommandLi
120120
#endif
121121

122122
signalDisconnect = false;
123-
showTrayIcon = !cmdutility->isTrayHidden() && graphical && !cmdutility->shouldListControllers() &&
124-
!cmdutility->shouldMapController();
123+
showTrayIcon = !cmdutility->isTrayHidden() && graphical && !cmdutility->shouldListControllers();
125124

126125
m_joysticks = joysticks;
127126

@@ -174,7 +173,6 @@ MainWindow::MainWindow(QMap<SDL_JoystickID, InputDevice *> *joysticks, CommandLi
174173
connect(ui->actionOptions, &QAction::triggered, this, &MainWindow::openMainSettingsDialog);
175174
connect(ui->actionWiki, &QAction::triggered, this, &MainWindow::openWikiPage);
176175
connect(ui->actionCalibration, &QAction::triggered, this, &MainWindow::openCalibration);
177-
connect(ui->actionGameController_Mapping, &QAction::triggered, this, &MainWindow::openGameControllerMappingWindow);
178176

179177
#if defined(WITH_X11)
180178
if (QApplication::platformName() == QStringLiteral("xcb"))
@@ -299,44 +297,6 @@ void MainWindow::alterConfigFromSettings()
299297
}
300298
}
301299

302-
void MainWindow::controllerMapOpening()
303-
{
304-
if (m_cmdutility->shouldMapController())
305-
{
306-
m_graphical = false;
307-
308-
const QList<ControllerOptionsInfo> tempList = m_cmdutility->getControllerOptionsList();
309-
ControllerOptionsInfo temp = tempList.at(0);
310-
311-
if (temp.hasControllerNumber())
312-
{
313-
int joypadIndex = m_cmdutility->getControllerNumber();
314-
315-
qDebug() << "It was antimicrox --map controllerNumber";
316-
qDebug() << "controllerNumber: " << joypadIndex;
317-
318-
selectControllerJoyTab(joypadIndex);
319-
openGameControllerMappingWindow(true);
320-
} else if (temp.hasControllerID())
321-
{
322-
QString joypadGUID = m_cmdutility->getControllerID();
323-
324-
qDebug() << "It was antimicrox --map controllerID";
325-
qDebug() << "controllerID: " << joypadGUID;
326-
327-
selectControllerJoyTab(joypadGUID);
328-
openGameControllerMappingWindow(true);
329-
} else
330-
{
331-
qDebug() << "Could not find a proper controller identifier. Exiting";
332-
333-
qInfo() << tr("Could not find a proper controller identifier. "
334-
"Exiting.");
335-
qApp->quit();
336-
}
337-
}
338-
}
339-
340300
void MainWindow::fillButtons() { fillButtonsMap(m_joysticks); }
341301

342302
void MainWindow::makeJoystickTabs()
@@ -1468,36 +1428,6 @@ void MainWindow::restartAsElevated()
14681428
}
14691429
#endif
14701430

1471-
void MainWindow::openGameControllerMappingWindow(bool openAsMain)
1472-
{
1473-
int index = ui->tabWidget->currentIndex();
1474-
if (index >= 0)
1475-
{
1476-
JoyTabWidget *joyTab = qobject_cast<JoyTabWidget *>(ui->tabWidget->widget(index)); // static_cast
1477-
InputDevice *joystick = joyTab->getJoystick();
1478-
if (joystick != nullptr)
1479-
{
1480-
GameControllerMappingDialog *dialog = new GameControllerMappingDialog(joystick, m_settings, this);
1481-
1482-
if (openAsMain)
1483-
{
1484-
dialog->setParent(nullptr);
1485-
dialog->setWindowFlags(Qt::Window);
1486-
connect(dialog, &GameControllerMappingDialog::finished, qApp, &QApplication::quit);
1487-
} else
1488-
{
1489-
connect(dialog, &GameControllerMappingDialog::mappingUpdate, this, &MainWindow::propogateMappingUpdate);
1490-
}
1491-
1492-
dialog->show();
1493-
}
1494-
} else if (openAsMain)
1495-
{
1496-
qInfo() << tr("Could not find controller. Exiting.");
1497-
qApp->quit();
1498-
}
1499-
}
1500-
15011431
void MainWindow::propogateMappingUpdate(QString mapping, InputDevice *device) { emit mappingUpdated(mapping, device); }
15021432

15031433
void MainWindow::testMappingUpdateNow(int index, InputDevice *device)
@@ -1806,26 +1736,6 @@ void MainWindow::updateButtonPressed()
18061736

18071737
#endif
18081738

1809-
/**
1810-
* @brief Select appropriate tab with the specified index.
1811-
* @param Index of appropriate tab.
1812-
*/
1813-
void MainWindow::selectControllerJoyTab(int index)
1814-
{
1815-
if ((index > 0) && m_joysticks->contains(index - 1))
1816-
{
1817-
JoyTabWidget *widget = qobject_cast<JoyTabWidget *>(ui->tabWidget->widget(index - 1)); // static_cast
1818-
if (widget != nullptr)
1819-
{
1820-
qDebug() << "JoyTabWidget was not a null pointer in selectControllerJoyTab of index";
1821-
ui->tabWidget->setCurrentIndex(index - 1);
1822-
} else
1823-
{
1824-
qDebug() << "JoyTabWidget was a NULL POINTER in selectControllerJoyTab of index";
1825-
}
1826-
}
1827-
}
1828-
18291739
/**
18301740
* @brief Select appropriate tab that has a device with the specified GUID.
18311741
* @param GUID of joystick device.

src/gui/mainwindow.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,10 @@ class MainWindow : public QMainWindow
107107
void quitProgram();
108108
void changeWindowStatus();
109109
void refreshTabHelperThreads();
110-
void controllerMapOpening();
111110
void testMappingUpdateNow(int index, InputDevice *device);
112111
void removeJoyTab(SDL_JoystickID deviceID);
113112
void addJoyTab(InputDevice *device);
114113
void selectControllerJoyTab(QString GUID);
115-
void selectControllerJoyTab(int index);
116114
void handleInstanceDisconnect();
117115

118116
private slots:
@@ -144,7 +142,6 @@ class MainWindow : public QMainWindow
144142
void restartAsElevated();
145143
#endif
146144

147-
void openGameControllerMappingWindow(bool openAsMain = false);
148145
void propogateMappingUpdate(QString mapping, InputDevice *device);
149146
void autoprofileLoad(AutoProfileInfo *info); // MainConfiguration class
150147
void checkAutoProfileWatcherTimer(); // MainConfiguration class

src/main.cpp

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -479,67 +479,6 @@ int main(int argc, char *argv[])
479479
#endif
480480
delete appLogger;
481481
return 0;
482-
} else if (cmdutility.shouldMapController())
483-
{
484-
PadderCommon::mouseHelperObj.initDeskWid();
485-
QPointer<InputDaemon> joypad_worker = new InputDaemon(joysticks, &settings);
486-
inputEventThread = new QThread;
487-
488-
MainWindow *mainWindow = new MainWindow(joysticks, &cmdutility, &settings);
489-
490-
QObject::connect(&antimicrox, &QApplication::aboutToQuit, mainWindow, &MainWindow::removeJoyTabs);
491-
QObject::connect(&antimicrox, &QApplication::aboutToQuit, joypad_worker.data(), &InputDaemon::quit);
492-
QObject::connect(&antimicrox, &QApplication::aboutToQuit, &PadderCommon::mouseHelperObj, &MouseHelper::deleteDeskWid,
493-
Qt::DirectConnection);
494-
QObject::connect(&antimicrox, &QApplication::aboutToQuit, joypad_worker.data(), &InputDaemon::deleteLater,
495-
Qt::BlockingQueuedConnection);
496-
497-
mainWindow->makeJoystickTabs();
498-
#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
499-
QTimer::singleShot(0, mainWindow, &MainWindow::controllerMapOpening);
500-
#else
501-
QTimer::singleShot(0, mainWindow, SLOT(controllerMapOpening()));
502-
#endif
503-
504-
joypad_worker->startWorker();
505-
506-
joypad_worker->moveToThread(inputEventThread);
507-
PadderCommon::mouseHelperObj.moveToThread(inputEventThread);
508-
inputEventThread->start(QThread::HighPriority);
509-
510-
int app_result = antimicrox.exec();
511-
512-
inputEventThread->quit();
513-
inputEventThread->wait();
514-
515-
delete joysticks;
516-
joysticks = nullptr;
517-
518-
delete localServer;
519-
localServer = nullptr;
520-
521-
delete inputEventThread;
522-
inputEventThread = nullptr;
523-
524-
#ifdef WITH_X11
525-
526-
if (QApplication::platformName() == QStringLiteral("xcb"))
527-
{
528-
X11Extras::getInstance()->closeDisplay();
529-
}
530-
531-
#endif
532-
533-
delete mainWindow;
534-
mainWindow = nullptr;
535-
536-
if (!joypad_worker.isNull())
537-
{
538-
delete joypad_worker;
539-
joypad_worker.clear();
540-
}
541-
delete appLogger;
542-
return app_result;
543482
}
544483

545484
bool status = true;

0 commit comments

Comments
 (0)