| 161 | } |
| 162 | |
| 163 | int CDlgSettingsTerminal::AddShell(QString szShell, const QString &name) |
| 164 | { |
| 165 | int nIndex = 0; |
| 166 | QString szName = name; |
| 167 | QFileInfo fi(szShell); |
| 168 | if(!fi.exists()) |
| 169 | { |
| 170 | qCritical(log) << "The shell is not exist:" << szShell; |
| 171 | return -1; |
| 172 | } |
| 173 | if(szName.isEmpty()) |
| 174 | szName = fi.baseName(); |
| 175 | |
| 176 | nIndex = ui->cbShellName->findText(szName, Qt::MatchFixedString); |
| 177 | if(-1 == nIndex) { |
| 178 | ui->cbShellName->addItem(szName, szShell); |
| 179 | nIndex = ui->cbShellName->findText(szName, Qt::MatchFixedString); |
| 180 | } |
| 181 | |
| 182 | ui->cbShellName->setItemData(nIndex, szShell, Qt::ToolTipRole); |
| 183 | ui->cbShellName->setItemData(nIndex, szShell, Qt::StatusTipRole); |
| 184 | ui->cbShellName->setCurrentIndex(nIndex); |
| 185 | |
| 186 | return 0; |
| 187 | } |
| 188 | |
| 189 | void CDlgSettingsTerminal::on_pbShellBrowse_clicked() |
| 190 | { |