| 219 | } |
| 220 | |
| 221 | void MainWindow::createActionsFile() |
| 222 | { |
| 223 | fileMenu = menuBar()->addMenu(tr("&File")); |
| 224 | fileMenu->setObjectName(QStringLiteral("fileMenu")); |
| 225 | |
| 226 | fileToolBar = addToolBar(tr("File")); |
| 227 | fileToolBar->setObjectName(QStringLiteral("fileToolBar")); |
| 228 | fileToolBar->setToolTip(tr("File")); |
| 229 | |
| 230 | fileToolBar->setContextMenuPolicy(Qt::CustomContextMenu); |
| 231 | connect(fileToolBar, &QToolBar::customContextMenuRequested, this, &MainWindow::customContextMenuForToolBar); |
| 232 | |
| 233 | { // New |
| 234 | auto action = fileMenu->addAction(QIcon::fromTheme("project-development-new-template"), tr("&New project"), this, &MainWindow::newFile); |
| 235 | action->setShortcuts(QKeySequence::New); |
| 236 | action->setStatusTip(tr("Create a new file")); |
| 237 | fileToolBar->addAction(QIcon::fromTheme("project-development-new-template"), tr("&New project"), this, &MainWindow::newFile); |
| 238 | } |
| 239 | { // Open |
| 240 | auto action = fileMenu->addAction(QIcon::fromTheme("document-open"), tr("&Open..."), this, &MainWindow::open); |
| 241 | action->setShortcuts(QKeySequence::Open); |
| 242 | action->setStatusTip(tr("Open an existing file")); |
| 243 | fileToolBar->addAction(QIcon::fromTheme("document-open"), tr("&Open..."), this, &MainWindow::open); |
| 244 | } |
| 245 | { // Save |
| 246 | auto action = fileMenu->addAction(QIcon::fromTheme("document-save"), tr("&Save project"), this, &MainWindow::save); |
| 247 | action->setShortcuts(QKeySequence::Save); |
| 248 | action->setStatusTip(tr("Save the document to disk")); |
| 249 | fileToolBar->addAction(QIcon::fromTheme("document-save"), tr("&Save project"), this, &MainWindow::save); |
| 250 | } |
| 251 | { // Save As |
| 252 | auto action = fileMenu->addAction(QIcon::fromTheme("document-save-as"), tr("Save project &As..."), this, &MainWindow::saveAs); |
| 253 | action->setShortcuts(QKeySequence::SaveAs); |
| 254 | action->setStatusTip(tr("Save the document under a new name")); |
| 255 | fileToolBar->addAction(QIcon::fromTheme("document-save-as"), tr("Save project &As..."), this, &MainWindow::saveAs); |
| 256 | } |
| 257 | { // Close project |
| 258 | m_closeAllAct = fileMenu->addAction(QIcon::fromTheme("document-close"), tr("&Close project \"%1\""), this, &MainWindow::closeProject); |
| 259 | m_closeAllAct->setShortcuts(QKeySequence::Close); |
| 260 | m_closeAllAct->setStatusTip(tr("Close project")); |
| 261 | // m_closeAllAct->setEnabled(false); |
| 262 | fileToolBar->addAction(QIcon::fromTheme("document-close"), tr("&Close project \"%1\"").arg(""), this, &MainWindow::closeProject); |
| 263 | } |
| 264 | |
| 265 | fileMenu->addSeparator(); |
| 266 | fileToolBar->addSeparator(); |
| 267 | |
| 268 | { // Save Selected Tool Paths |
| 269 | auto action = fileMenu->addAction(QIcon::fromTheme("document-save-all"), tr("&Save Selected Tool Paths..."), this, &MainWindow::saveSelectedGCodeFiles); |
| 270 | action->setStatusTip(tr("Save selected toolpaths")); |
| 271 | fileToolBar->addAction(QIcon::fromTheme("document-save-all"), tr("&Save Selected Tool Paths..."), this, &MainWindow::saveSelectedGCodeFiles); |
| 272 | } |
| 273 | { // Export PDF |
| 274 | auto action = fileMenu->addAction(QIcon::fromTheme("acrobat"), tr("&Export PDF..."), App::scene(), &Scene::RenderPdf); |
| 275 | action->setStatusTip(tr("Export to PDF file")); |
| 276 | fileToolBar->addAction(QIcon::fromTheme("acrobat"), tr("&Export PDF..."), App::scene(), &Scene::RenderPdf); |
| 277 | } |
| 278 |
nothing calls this directly
no test coverage detected