| 550 | } |
| 551 | |
| 552 | void IDE::loadLargeFile(const QString &path, QWidget* parent) |
| 553 | { |
| 554 | DMap::iterator it = documents.find(path); |
| 555 | if (it.value()->large) { |
| 556 | QFile file(path); |
| 557 | if (file.open(QFile::ReadOnly | QFile::Text)) { |
| 558 | QTextStream file_stream(&file); |
| 559 | #if QT_VERSION < 0x060000 |
| 560 | file_stream.setCodec("UTF-8"); |
| 561 | #endif |
| 562 | it.value()->td.setPlainText(file_stream.readAll()); |
| 563 | it.value()->large = false; |
| 564 | it.value()->td.setModified(false); |
| 565 | QSet<CodeEditor*>::iterator ed = it.value()->editors.begin(); |
| 566 | for (; ed != it.value()->editors.end(); ++ed) { |
| 567 | (*ed)->loadedLargeFile(); |
| 568 | } |
| 569 | fsWatch.addPath(path); |
| 570 | } else { |
| 571 | QMessageBox::warning(parent, "MiniZinc IDE", |
| 572 | "Could not open file "+path, |
| 573 | QMessageBox::Ok); |
| 574 | } |
| 575 | } |
| 576 | } |
| 577 | |
| 578 | void IDE::registerEditor(const QString& path, CodeEditor* ce) |
| 579 | { |
no test coverage detected