MCPcopy Create free account
hub / github.com/actuallyaridan/linux-devmgmt / buildMenus

Method buildMenus

src/ui/MainWindow.cpp:264–370  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

262}
263
264void MainWindow::buildMenus() {
265 auto *fileMenu = menuBar()->addMenu("&File");
266 fileMenu->addAction("E&xit", this, &QWidget::close);
267
268 auto *actionMenu = menuBar()->addMenu("&Action");
269 m_actUpdateDriver = actionMenu->addAction(
270 "Update Driver Software...", [this] {
271 auto idx = m_tree->currentIndex();
272 if (!idx.isValid()) return;
273 QString name = m_model->deviceField(idx, "name").toString();
274 UpdateDriverDialog dlg(name, this);
275 dlg.exec();
276 });
277 m_actDisable = actionMenu->addAction("Disable Device",
278 this, &MainWindow::disableCurrentDevice);
279 m_actUninstall = actionMenu->addAction("Uninstall Device",
280 this, &MainWindow::uninstallCurrentDevice);
281 actionMenu->addSeparator();
282 m_actScan = actionMenu->addAction("&Scan for hardware changes",
283 this, &MainWindow::refresh);
284 actionMenu->addSeparator();
285 m_actProperties = actionMenu->addAction("&Properties",
286 this, &MainWindow::showProperties);
287
288 auto *viewMenu = menuBar()->addMenu("&View");
289 viewMenu->addAction("Devices by &type",
290 [this]{ m_tree->expandToDepth(0); });
291 viewMenu->addAction("Devices by &connection");
292 viewMenu->addSeparator();
293 viewMenu->addAction("&Show hidden devices")->setCheckable(true);
294
295 auto *helpMenu = menuBar()->addMenu("&Help");
296 helpMenu->addAction("&Help Topics");
297 helpMenu->addSeparator();
298 helpMenu->addAction("&About", [this]{
299 QDialog dlg(this);
300 dlg.setWindowTitle("About Device Manager");
301 dlg.setWindowFlags(dlg.windowFlags() & ~Qt::WindowContextHelpButtonHint);
302 dlg.setFixedWidth(340);
303
304 auto *iconLabel = new QLabel;
305 iconLabel->setFixedSize(64, 64);
306 iconLabel->setPixmap(windowIcon().pixmap(64, 64));
307 iconLabel->setAlignment(Qt::AlignCenter);
308
309 auto *nameLabel = new QLabel("Device Manager");
310
311 auto *companyLabel = new QLabel("@actuallyaridan");
312 auto *versionLabel = new QLabel("Version: 2.0.4");
313
314 auto *infoLayout = new QVBoxLayout;
315 infoLayout->addWidget(nameLabel);
316 infoLayout->addWidget(companyLabel);
317 infoLayout->addWidget(versionLabel);
318 infoLayout->addStretch();
319
320 auto *topLayout = new QHBoxLayout;
321 topLayout->addWidget(iconLabel);

Callers

nothing calls this directly

Calls 1

deviceFieldMethod · 0.80

Tested by

no test coverage detected