129 const ThemeColors& c = impl_->themeManager->colors();
131 QMenuBar* bar = I.mainWindow->menuBar();
132 bar->setNativeMenuBar(
false);
134 QString(
"QMenuBar { background-color: %1; color: %2; border-bottom: 1px solid %3; "
135 "padding: 2px 0; spacing: 2px; }"
136 "QMenuBar::item { padding: 5px 12px; border-radius: 4px; }"
137 "QMenuBar::item:selected { background-color: %4; }"
138 "QMenuBar::item:pressed { background-color: %5; color: %6; }")
149 I.fileMenu = bar->addMenu(tr(
"&File"));
150 impl_->themeManager->styleMenu(I.fileMenu);
152 auto* addGameAction = I.fileMenu->addAction(tr(
"&Add Game..."));
153 addGameAction->setShortcut(QKeySequence(QStringLiteral(
"Ctrl+N")));
154 connect(addGameAction, &QAction::triggered,
this, [
this]() { emit
addGameRequested(); });
156 auto* importGamesAction = I.fileMenu->addAction(tr(
"&Import Games..."));
157 importGamesAction->setShortcut(QKeySequence(QStringLiteral(
"Ctrl+I")));
158 connect(importGamesAction, &QAction::triggered,
this,
161 I.fileMenu->addSeparator();
163 auto* exportImportAction = I.fileMenu->addAction(tr(
"E&xport/Import Library..."));
164 connect(exportImportAction, &QAction::triggered,
this,
167 I.fileMenu->addSeparator();
169 auto* settingsAction = I.fileMenu->addAction(tr(
"&Settings..."));
170 settingsAction->setShortcut(QKeySequence(QStringLiteral(
"Ctrl+,")));
171 connect(settingsAction, &QAction::triggered,
this, [
this]() { emit
settingsRequested(); });
173 I.fileMenu->addSeparator();
175 auto* exitAction = I.fileMenu->addAction(tr(
"E&xit"));
176 exitAction->setShortcut(QKeySequence(QStringLiteral(
"Ctrl+Q")));
177 connect(exitAction, &QAction::triggered,
this, [
this]() { emit
exitRequested(); });
182 I.gameMenu = bar->addMenu(tr(
"&Game"));
183 impl_->themeManager->styleMenu(I.gameMenu);
184 connect(I.gameMenu, &QMenu::aboutToShow,
this,
188 II.gameMenu->clear();
189 impl_->themeManager->styleMenu(II.gameMenu);
191 if (II.selectedGameId.empty())
193 auto* noGame = II.gameMenu->addAction(tr(
"No game selected"));
194 noGame->setEnabled(false);
198 const Game* game = II.libraryController->getGame(II.selectedGameId);
202 const std::string gameId = II.selectedGameId;
214 II.gameMenu->addSeparator();
218 II.gameMenu->addSeparator();
221 II.gameMenu->addSeparator();
226 II.gameMenu->addSeparator();
234 I.viewMenu = bar->addMenu(tr(
"&View"));
235 impl_->themeManager->styleMenu(I.viewMenu);
237 I.viewMenu, &QMenu::aboutToShow,
this,
241 II.viewMenu->clear();
242 impl_->themeManager->styleMenu(II.viewMenu);
245 auto* listAction = II.viewMenu->addAction(tr(
"&List View"));
246 listAction->setShortcut(QKeySequence(QStringLiteral(
"Ctrl+1")));
247 listAction->setCheckable(true);
248 listAction->setChecked(II.currentViewMode == ViewMode::List);
249 connect(listAction, &QAction::triggered, this,
250 [this]() { emit viewModeSelected(ViewMode::List); });
252 auto* gridAction = II.viewMenu->addAction(tr(
"&Grid View"));
253 gridAction->setShortcut(QKeySequence(QStringLiteral(
"Ctrl+2")));
254 gridAction->setCheckable(
true);
256 connect(gridAction, &QAction::triggered,
this,
259 auto* compactAction = II.viewMenu->addAction(tr(
"&Compact View"));
260 compactAction->setShortcut(QKeySequence(QStringLiteral(
"Ctrl+3")));
261 compactAction->setCheckable(
true);
263 connect(compactAction, &QAction::triggered,
this,
266 II.viewMenu->addSeparator();
269 auto* sortMenu = II.viewMenu->addMenu(tr(
"&Sort By"));
270 impl_->themeManager->styleMenu(sortMenu);
271 auto addSort = [&](
const QString& name,
SortOption opt)
273 auto* a = sortMenu->addAction(name);
274 a->setCheckable(
true);
275 a->setChecked(II.currentSort == opt);
276 connect(a, &QAction::triggered,
this, [
this, opt]() { emit sortSelected(opt); });
284 II.viewMenu->addSeparator();
288 auto addPanelToggle =
289 [&](
const QString& label,
const QString& shortcut,
const QString& panelName)
291 auto* action = II.viewMenu->addAction(label);
292 if (!shortcut.isEmpty())
293 action->setShortcut(QKeySequence(shortcut));
294 action->setCheckable(
true);
295 action->setChecked(II.isPanelVisible(panelName));
296 connect(action, &QAction::triggered,
this,
297 [
this, panelName]() { emit panelToggleRequested(panelName); });
299 addPanelToggle(tr(
"&Sidebar"), QStringLiteral(
"Ctrl+H"), QStringLiteral(
"sidebar"));
300 addPanelToggle(tr(
"&Details Panel"), QStringLiteral(
"Ctrl+D"),
301 QStringLiteral(
"details"));
302#ifdef HAVE_QTERMWIDGET
303 addPanelToggle(tr(
"System &Monitor"), QString(), QStringLiteral(
"monitor"));
306 if (II.settingsController &&
307 II.settingsController->getAppSettings().enableHomeAssistant)
309 addPanelToggle(tr(
"&Home Assistant"), QStringLiteral(
"Ctrl+Shift+H"),
310 QStringLiteral(
"ha"));
314 II.viewMenu->addSeparator();
317 auto* hamburgerAction = II.viewMenu->addAction(tr(
"Use &Hamburger Menu"));
318 hamburgerAction->setCheckable(
true);
319 QSettings viewSettings;
320 hamburgerAction->setChecked(viewSettings.value(
"ui/useHamburgerMenu",
false).toBool());
321 connect(hamburgerAction, &QAction::triggered,
this,
325 s.setValue(
"ui/useHamburgerMenu", checked);
326 emit menuModeToggled(checked);
329 II.viewMenu->addSeparator();
332 auto* zoomInAction = II.viewMenu->addAction(tr(
"Zoom &In"));
333 zoomInAction->setShortcut(QKeySequence(QStringLiteral(
"Ctrl++")));
334 connect(zoomInAction, &QAction::triggered,
this, [
this]() { emit zoomInRequested(); });
336 auto* zoomOutAction = II.viewMenu->addAction(tr(
"Zoom &Out"));
337 zoomOutAction->setShortcut(QKeySequence(QStringLiteral(
"Ctrl+-")));
338 connect(zoomOutAction, &QAction::triggered,
this,
339 [
this]() { emit zoomOutRequested(); });
341 auto* zoomResetAction = II.viewMenu->addAction(tr(
"&Reset Zoom"));
342 zoomResetAction->setShortcut(QKeySequence(QStringLiteral(
"Ctrl+0")));
343 connect(zoomResetAction, &QAction::triggered,
this,
344 [
this]() { emit zoomResetRequested(); });
346 II.viewMenu->addSeparator();
349 auto* themeMenu = II.viewMenu->addMenu(tr(
"&Theme"));
350 impl_->themeManager->styleMenu(themeMenu);
351 QString currentThemeId = impl_->themeManager->currentThemeId();
352 for (
const auto& themeId : impl_->themeManager->getAvailableThemeIds())
354 const Theme* theme = impl_->themeManager->getTheme(themeId);
357 auto* action = themeMenu->addAction(theme->
displayName);
358 action->setCheckable(
true);
359 action->setChecked(themeId == currentThemeId);
360 connect(action, &QAction::triggered,
this,
361 [
this, themeId]() { emit themeSelected(themeId); });
364 II.viewMenu->addSeparator();
366 auto* refreshAction = II.viewMenu->addAction(tr(
"Re&fresh Library"));
367 refreshAction->setShortcut(QKeySequence(QStringLiteral(
"F5")));
368 connect(refreshAction, &QAction::triggered,
this,
369 [
this]() { emit refreshLibraryRequested(); });
375 I.toolsMenu = bar->addMenu(tr(
"&Tools"));
376 impl_->themeManager->styleMenu(I.toolsMenu);
378 auto* installLutrisAction = I.toolsMenu->addAction(tr(
"Install from &Lutris..."));
379 installLutrisAction->setShortcut(QKeySequence(QStringLiteral(
"Ctrl+L")));
380 connect(installLutrisAction, &QAction::triggered,
this,
381 [
this]() { emit installFromLutrisRequested(); });
383 auto* manageRunnersAction = I.toolsMenu->addAction(tr(
"Manage &Runners..."));
384 connect(manageRunnersAction, &QAction::triggered,
this,
385 [
this]() { emit manageRunnersRequested(); });
387 I.toolsMenu->addSeparator();
389 auto* libraryStatsAction = I.toolsMenu->addAction(tr(
"Library &Statistics..."));
390 connect(libraryStatsAction, &QAction::triggered,
this,
391 [
this]() { emit libraryStatisticsRequested(); });
393 auto* downloadQueueAction = I.toolsMenu->addAction(tr(
"&Download Queue..."));
394 connect(downloadQueueAction, &QAction::triggered,
this,
395 [
this]() { emit downloadQueueRequested(); });
397 I.toolsMenu->addSeparator();
401 auto* systemInfoAction = I.toolsMenu->addAction(tr(
"S&ystem Info..."));
403 systemInfoAction, &QAction::triggered,
this,
411 : (sys.canUseFsync() ? tr(
"Fsync")
412 : (sys.kernel.supportsEsync ? tr(
"Esync") : tr(
"None")));
413 QString info = QString(
"<h3>System Information</h3>"
415 "<tr><td><b>GPU:</b></td><td>%1</td></tr>"
416 "<tr><td><b>Vulkan:</b></td><td>%2</td></tr>"
417 "<tr><td><b>CPU:</b></td><td>%3 (%4 cores)</td></tr>"
418 "<tr><td><b>Sync Method:</b></td><td>%5</td></tr>"
419 "<tr><td><b>GameMode:</b></td><td>%6</td></tr>"
420 "<tr><td><b>MangoHud:</b></td><td>%7</td></tr>"
421 "<tr><td><b>Gamescope:</b></td><td>%8</td></tr>"
423 .arg(QString::fromStdString(sys.gpu.model))
424 .arg(sys.gpu.hasVulkanSupport() ? tr(
"Available") : tr(
"Not found"))
425 .arg(QString::fromStdString(sys.cpu.model))
426 .arg(sys.cpu.coreCount)
428 .arg(sys.tools.gameMode ? tr(
"Available") : tr(
"Not installed"))
429 .arg(sys.tools.mangoHud ? tr(
"Available") : tr(
"Not installed"))
430 .arg(sys.tools.gamescope ? tr(
"Available") : tr(
"Not installed"));
431 QMessageBox msgBox(II.mainWindow);
432 msgBox.setWindowTitle(tr(
"System Information"));
433 msgBox.setTextFormat(Qt::RichText);
434 msgBox.setText(info);
435 msgBox.setIcon(QMessageBox::Information);
442 I.helpMenu = bar->addMenu(tr(
"&Help"));
443 impl_->themeManager->styleMenu(I.helpMenu);
445 auto* shortcutsAction = I.helpMenu->addAction(tr(
"&Keyboard Shortcuts"));
446 shortcutsAction->setShortcut(QKeySequence(QStringLiteral(
"Ctrl+/")));
447 connect(shortcutsAction, &QAction::triggered,
this,
454 auto* commandPaletteAction = I.helpMenu->addAction(tr(
"&Command Palette..."));
455 commandPaletteAction->setShortcut(QKeySequence(QStringLiteral(
"Ctrl+Shift+P")));
456 connect(commandPaletteAction, &QAction::triggered,
this,
457 [
this]() { emit commandPaletteRequested(); });
459 I.helpMenu->addSeparator();
461 auto* aboutAction = I.helpMenu->addAction(tr(
"&About Game Launcher"));
462 connect(aboutAction, &QAction::triggered,
this,
466 QMessageBox::about(II.mainWindow, tr(
"About Game Launcher"),
467 tr(
"Game Launcher v1.0.0\n\n"
468 "A Linux game launcher with Steam integration,\n"
469 "Proton/Wine support, and CachyOS optimizations.\n\n"
470 "Built with Qt6 and the core library."));