| 88 | } |
| 89 | |
| 90 | void GameListSettingsWidget::addPathToTable(const std::string& path, bool recursive) |
| 91 | { |
| 92 | const int row = m_ui.searchDirectoryList->rowCount(); |
| 93 | m_ui.searchDirectoryList->insertRow(row); |
| 94 | |
| 95 | QTableWidgetItem* item = new QTableWidgetItem(); |
| 96 | item->setText(QString::fromStdString(path)); |
| 97 | item->setFlags(item->flags() & ~(Qt::ItemIsEditable)); |
| 98 | m_ui.searchDirectoryList->setItem(row, 0, item); |
| 99 | |
| 100 | QCheckBox* cb = new QCheckBox(m_ui.searchDirectoryList); |
| 101 | m_ui.searchDirectoryList->setCellWidget(row, 1, cb); |
| 102 | cb->setChecked(recursive); |
| 103 | |
| 104 | connect(cb, &QCheckBox::checkStateChanged, this, [item](Qt::CheckState state) { |
| 105 | const std::string path(item->text().toStdString()); |
| 106 | if (state == Qt::Checked) |
| 107 | { |
| 108 | Host::RemoveBaseValueFromStringList("GameList", "Paths", path.c_str()); |
| 109 | Host::AddBaseValueToStringList("GameList", "RecursivePaths", path.c_str()); |
| 110 | } |
| 111 | else |
| 112 | { |
| 113 | Host::RemoveBaseValueFromStringList("GameList", "RecursivePaths", path.c_str()); |
| 114 | Host::AddBaseValueToStringList("GameList", "Paths", path.c_str()); |
| 115 | } |
| 116 | Host::CommitBaseSettingChanges(); |
| 117 | }); |
| 118 | } |
| 119 | |
| 120 | void GameListSettingsWidget::refreshDirectoryList() |
| 121 | { |