Mercurial > retraceit
comparison src/folderselectdialog.cpp @ 100:7c84242971cb
Don't warn if folders do not match pattern
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Fri, 18 Nov 2016 11:36:14 +0100 |
parents | 0cf81afa82c1 |
children | 8ed21aa68021 |
comparison
equal
deleted
inserted
replaced
99:0cf81afa82c1 | 100:7c84242971cb |
---|---|
205 QStringList columns = mFolderPattern.split(PATTERN_SEPERATOR); | 205 QStringList columns = mFolderPattern.split(PATTERN_SEPERATOR); |
206 mModel->clear(); | 206 mModel->clear(); |
207 mModel->setHorizontalHeaderLabels(columns); | 207 mModel->setHorizontalHeaderLabels(columns); |
208 QDir dir(folder); | 208 QDir dir(folder); |
209 qDebug() << "Folder set to: " << folder; | 209 qDebug() << "Folder set to: " << folder; |
210 QStringList errors; | |
211 foreach (const QString & subfolder, dir.entryList(QDir::Dirs | | 210 foreach (const QString & subfolder, dir.entryList(QDir::Dirs | |
212 QDir::Readable | | 211 QDir::Readable | |
213 QDir::NoDotAndDotDot)) { | 212 QDir::NoDotAndDotDot)) { |
214 qDebug() << "Looking at: " << subfolder; | 213 qDebug() << "Looking at: " << subfolder; |
215 QStringList itemData = subfolder.split(PATTERN_SEPERATOR); | 214 QStringList itemData = subfolder.split(PATTERN_SEPERATOR); |
216 if (itemData.size() != columns.size()) { | 215 if (itemData.size() != columns.size()) { |
217 errors << subfolder; | 216 qDebug() << "Folder does not match pattern: " << subfolder; |
218 continue; | 217 continue; |
219 } | 218 } |
220 QList<QStandardItem*> items; | 219 QList<QStandardItem*> items; |
221 foreach (const QString& part, itemData) { | 220 foreach (const QString& part, itemData) { |
222 QStandardItem * item = new QStandardItem(part); | 221 QStandardItem * item = new QStandardItem(part); |
224 items.append(item); | 223 items.append(item); |
225 } | 224 } |
226 mModel->appendRow(items); | 225 mModel->appendRow(items); |
227 } | 226 } |
228 mSortModel->setSourceModel(mModel); | 227 mSortModel->setSourceModel(mModel); |
229 if (!errors.isEmpty()) { | |
230 QString errMsg = tr("The following folders did not match the pattern: %1").arg(mFolderPattern); | |
231 errMsg += "\n" + errors.join("\n"); | |
232 QMessageBox::warning(this, tr("Failed to parse some folders."), errMsg); | |
233 } | |
234 mView->resizeColumnsToContents(); | 228 mView->resizeColumnsToContents(); |
235 } | 229 } |
236 | 230 |
237 void FolderSelectDialog::wantToAccept() { | 231 void FolderSelectDialog::wantToAccept() { |
238 QItemSelectionModel *selection = mView->selectionModel(); | 232 QItemSelectionModel *selection = mView->selectionModel(); |