| 102 | } |
| 103 | |
| 104 | void ProfileForm::createFile() |
| 105 | { |
| 106 | m_usedItems.clear(); |
| 107 | const auto tool { ui->toolHolder->tool() }; |
| 108 | if (!tool.isValid()) { |
| 109 | tool.errorMessageBox(this); |
| 110 | return; |
| 111 | } |
| 112 | |
| 113 | Paths wPaths; |
| 114 | Paths wRawPaths; |
| 115 | FileInterface const* file = nullptr; |
| 116 | bool skip { true }; |
| 117 | |
| 118 | for (auto* sItem : App::scene()->selectedItems()) { |
| 119 | GraphicsItem* gi = dynamic_cast<GraphicsItem*>(sItem); |
| 120 | switch (static_cast<GiType>(sItem->type())) { |
| 121 | case GiType::DataSolid: |
| 122 | case GiType::DataPath: |
| 123 | if (!file) { |
| 124 | file = gi->file(); |
| 125 | boardSide = file->side(); |
| 126 | } else if (file != gi->file()) { |
| 127 | if (skip) { |
| 128 | if ((skip = (QMessageBox::question(this, tr("Warning"), tr("Work items from different files!\nWould you like to continue?"), QMessageBox::Yes, QMessageBox::No) == QMessageBox::No))) |
| 129 | return; |
| 130 | } |
| 131 | } |
| 132 | if (static_cast<GiType>(sItem->type()) == GiType::DataSolid) |
| 133 | wPaths.append(gi->paths()); |
| 134 | else |
| 135 | wRawPaths.append(gi->paths()); |
| 136 | break; |
| 137 | case GiType::ShCircle: |
| 138 | case GiType::ShRectangle: |
| 139 | case GiType::ShPolyLine: |
| 140 | case GiType::ShCirArc: |
| 141 | case GiType::ShText: |
| 142 | wRawPaths.append(gi->paths()); |
| 143 | break; |
| 144 | case GiType::Drill: |
| 145 | wPaths.append(gi->paths()); |
| 146 | break; |
| 147 | default: |
| 148 | break; |
| 149 | } |
| 150 | addUsedGi(gi); |
| 151 | } |
| 152 | |
| 153 | if (wRawPaths.empty() && wPaths.empty()) { |
| 154 | QMessageBox::warning(this, tr("Warning"), tr("No selected items for working...")); |
| 155 | return; |
| 156 | } |
| 157 | |
| 158 | GCode::GCodeParams gcp; |
| 159 | gcp.setConvent(ui->rbConventional->isChecked()); |
| 160 | gcp.setSide(side); |
| 161 | gcp.tools.push_back(tool); |
nothing calls this directly
no test coverage detected