| 58 | } |
| 59 | |
| 60 | void EditCustom::refreshDisplay() { |
| 61 | int index; |
| 62 | if(ui->treeWidget->selectedItems().isEmpty()) |
| 63 | index=0; |
| 64 | else if(ui->treeWidget->selectedItems().first()->data(1,Qt::DisplayRole).isNull()) |
| 65 | index=0; |
| 66 | else |
| 67 | index=ui->treeWidget->selectedItems().first()->data(1,Qt::DisplayRole).toInt(); |
| 68 | |
| 69 | //ui->treeWidget->itemAt(index,index)->setSelected(true); |
| 70 | |
| 71 | static const QRegularExpression RegEx(";(.*)"); |
| 72 | switch(index) { |
| 73 | case 0: |
| 74 | ui->textEdit->setPlainText(c->getPage()); |
| 75 | ui->comboBox->clear(); |
| 76 | ui->comboBox->addItem("Files","%Files%"); |
| 77 | break; |
| 78 | case 1: |
| 79 | ui->textEdit->setPlainText(c->getFile()); |
| 80 | ui->comboBox->clear(); |
| 81 | for(int i=0;i<Stream_Max;i++) { |
| 82 | ui->comboBox->addItem(wstring2QString(C->StreamName((stream_t)i)),"%"+wstring2QString(C->StreamName((stream_t)i))+"%"); |
| 83 | } |
| 84 | break; |
| 85 | default: |
| 86 | ui->textEdit->setPlainText(c->getStream(index-2)); |
| 87 | QString s = wstring2QString(C->Parameters()); |
| 88 | s.replace("\r\n","\n").replace("\r","\n"); |
| 89 | s.remove(0,s.indexOf(wstring2QString(C->StreamName((stream_t)(index-2)))+"\n")); |
| 90 | s.truncate((s.indexOf("\n\n")==-1?s.size():s.indexOf("\n\n"))); |
| 91 | QStringList sl = s.split("\n"); |
| 92 | sl.removeAt(0); |
| 93 | sl.replaceInStrings(RegEx,""); |
| 94 | ui->comboBox->clear(); |
| 95 | for (int i=0; i<sl.size(); ++i) { |
| 96 | ui->comboBox->addItem(sl.at(i),"%"+sl.at(i)+"%"); |
| 97 | } |
| 98 | break; |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | void EditCustom::saveText() { |
| 103 | int index; |
nothing calls this directly
no test coverage detected