refresh the view using the current projectPath
| 103 | |
| 104 | // refresh the view using the current projectPath |
| 105 | void |
| 106 | ProjectView::refresh() |
| 107 | { |
| 108 | // put all files into "Content"-ListView |
| 109 | QDir workPath(m_projPath); |
| 110 | QStringList files = workPath.entryList(QStringList() << "*", QDir::Files, QDir::Name); |
| 111 | QStringList::iterator it; |
| 112 | QString extName, fileName; |
| 113 | QList<QStandardItem *> columnData; |
| 114 | |
| 115 | // update project name in header as it may have changed |
| 116 | QStringList header; |
| 117 | header << tr("Content of %1").arg(m_projName) << tr("Note"); |
| 118 | m_model->setHorizontalHeaderLabels(header); |
| 119 | |
| 120 | for (int i=0; i<m_model->rowCount(); i++) { |
| 121 | // delete_childrens |
| 122 | m_model->item(i, 0)->removeRows(0, m_model->item(i, 0)->rowCount()); |
| 123 | } |
| 124 | |
| 125 | #define APPEND_CHILD(category, data) \ |
| 126 | m_model->item(category, 0)->appendRow(data); |
| 127 | |
| 128 | for(it = files.begin(); it != files.end(); ++it) { |
| 129 | fileName = (*it).toAscii(); |
| 130 | extName = QFileInfo(workPath.filePath(fileName)).suffix(); |
| 131 | |
| 132 | columnData.clear(); |
| 133 | QStandardItem * d = new QStandardItem(fileName); |
| 134 | if (QucsSettings.ShowDescriptionProjectTree) |
| 135 | { // In case of the ShowDescriptionProjectTree property is set, |
| 136 | // it reads the schematic header looking for the message to be displayed |
| 137 | // and the variable which sets the visibility of the frame |
| 138 | QString description = ReadDescription(workPath.absoluteFilePath(fileName)); |
| 139 | d->setToolTip(description); |
| 140 | } |
| 141 | columnData.append(d); |
| 142 | |
| 143 | if(extName == "dat") { |
| 144 | APPEND_CHILD(0, columnData); |
| 145 | } |
| 146 | else if(extName == "dpl") { |
| 147 | APPEND_CHILD(1, columnData); |
| 148 | } |
| 149 | else if(extName == "v") { |
| 150 | APPEND_CHILD(2, columnData); |
| 151 | } |
| 152 | else if(extName == "va") { |
| 153 | APPEND_CHILD(3, columnData); |
| 154 | } |
| 155 | else if((extName == "vhdl") || (extName == "vhd")) { |
| 156 | APPEND_CHILD(4, columnData); |
| 157 | } |
| 158 | else if((extName == "m") || (extName == "oct")) { |
| 159 | APPEND_CHILD(5, columnData); |
| 160 | } |
| 161 | else if(extName == "sch") { |
| 162 | // test if it's a valid schematic file |
nothing calls this directly
no test coverage detected