| 64 | }; |
| 65 | |
| 66 | bool IDE::event(QEvent *e) |
| 67 | { |
| 68 | switch (e->type()) { |
| 69 | case QEvent::FileOpen: |
| 70 | { |
| 71 | QString file = static_cast<QFileOpenEvent*>(e)->file(); |
| 72 | if (file.endsWith(".mzp")) { |
| 73 | PMap::iterator it = projects.find(file); |
| 74 | if (it==projects.end()) { |
| 75 | MainWindow* mw = qobject_cast<MainWindow*>(activeWindow()); |
| 76 | if (mw==nullptr) { |
| 77 | mw = new MainWindow(file); |
| 78 | mw->show(); |
| 79 | } else { |
| 80 | mw->openProject(file); |
| 81 | } |
| 82 | } else { |
| 83 | it.value()->raise(); |
| 84 | it.value()->activateWindow(); |
| 85 | } |
| 86 | } else { |
| 87 | MainWindow* curw = qobject_cast<MainWindow*>(activeWindow()); |
| 88 | if (curw != nullptr && (curw->isEmptyProject() || curw==lastDefaultProject)) { |
| 89 | curw->openFile(file); |
| 90 | lastDefaultProject = curw; |
| 91 | } else { |
| 92 | QStringList files; |
| 93 | files << file; |
| 94 | MainWindow* mw = new MainWindow(files); |
| 95 | if (curw!=nullptr) { |
| 96 | QPoint p = curw->pos(); |
| 97 | mw->move(p.x()+20, p.y()+20); |
| 98 | } |
| 99 | mw->show(); |
| 100 | lastDefaultProject = mw; |
| 101 | } |
| 102 | } |
| 103 | return true; |
| 104 | } |
| 105 | default: |
| 106 | return QApplication::event(e); |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | void IDE::checkUpdate(void) { |
| 111 | QSettings settings; |
nothing calls this directly
no test coverage detected