Mercurial > minori
diff src/gui/window.cpp @ 51:75c804f713b2
window: add about window,
*: use tr() when applicable (useful for i18n)
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Mon, 25 Sep 2023 20:29:26 -0400 |
parents | e613772f41d5 |
children | 466ac9870df9 |
line wrap: on
line diff
--- a/src/gui/window.cpp Mon Sep 25 13:50:56 2023 -0400 +++ b/src/gui/window.cpp Mon Sep 25 20:29:26 2023 -0400 @@ -3,6 +3,7 @@ #include "core/session.h" #include "gui/dark_theme.h" #include "gui/dialog/settings.h" +#include "gui/dialog/about.h" #include "gui/pages/anime_list.h" #include "gui/pages/now_playing.h" #include "gui/pages/statistics.h" @@ -37,15 +38,15 @@ main_widget = new QWidget(parent); SideBar* sidebar = new SideBar(main_widget); - sidebar->AddItem("Now Playing", SideBar::CreateIcon(":/icons/16x16/film.png")); + sidebar->AddItem(tr("Now Playing"), SideBar::CreateIcon(":/icons/16x16/film.png")); sidebar->AddSeparator(); - sidebar->AddItem("Anime List", SideBar::CreateIcon(":/icons/16x16/document-list.png")); - sidebar->AddItem("History", SideBar::CreateIcon(":/icons/16x16/clock-history-frame.png")); - sidebar->AddItem("Statistics", SideBar::CreateIcon(":/icons/16x16/chart.png")); + sidebar->AddItem(tr("Anime List"), SideBar::CreateIcon(":/icons/16x16/document-list.png")); + sidebar->AddItem(tr("History"), SideBar::CreateIcon(":/icons/16x16/clock-history-frame.png")); + sidebar->AddItem(tr("Statistics"), SideBar::CreateIcon(":/icons/16x16/chart.png")); sidebar->AddSeparator(); - sidebar->AddItem("Search", SideBar::CreateIcon(":/icons/16x16/magnifier.png")); - sidebar->AddItem("Seasons", SideBar::CreateIcon(":/icons/16x16/calendar.png")); - sidebar->AddItem("Torrents", SideBar::CreateIcon(":/icons/16x16/feed.png")); + sidebar->AddItem(tr("Search"), SideBar::CreateIcon(":/icons/16x16/magnifier.png")); + sidebar->AddItem(tr("Seasons"), SideBar::CreateIcon(":/icons/16x16/calendar.png")); + sidebar->AddItem(tr("Torrents"), SideBar::CreateIcon(":/icons/16x16/feed.png")); sidebar->setFixedWidth(128); sidebar->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); @@ -67,26 +68,26 @@ /* Menu Bar */ QAction* action; QMenuBar* menubar = new QMenuBar(parent); - QMenu* menu = menubar->addMenu("&File"); + QMenu* menu = menubar->addMenu(tr("&File")); - QMenu* submenu = menu->addMenu("&Library folders"); - action = submenu->addAction("&Add new folder..."); + QMenu* submenu = menu->addMenu(tr("&Library folders")); + action = submenu->addAction(tr("&Add new folder...")); - action = menu->addAction("&Scan available episodes"); + action = menu->addAction(tr("&Scan available episodes")); menu->addSeparator(); - action = menu->addAction("Play &next episode"); + action = menu->addAction(tr("Play &next episode")); action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_N)); - action = menu->addAction("Play &random episode"); + action = menu->addAction(tr("Play &random episode")); action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_R)); menu->addSeparator(); - action = menu->addAction("E&xit", qApp, &QApplication::quit); + action = menu->addAction(tr("E&xit"), qApp, &QApplication::quit); - menu = menubar->addMenu("&Services"); - action = menu->addAction("Synchronize &list", [this, stack] { + menu = menubar->addMenu(tr("&Services")); + action = menu->addAction(tr("Synchronize &list"), [this, stack] { Services::Synchronize(); ((AnimeListWidget*)stack->widget((int)Pages::ANIME_LIST))->Refresh(); }); @@ -94,75 +95,75 @@ menu->addSeparator(); - submenu = menu->addMenu("&AniList"); - action = submenu->addAction("Go to my &profile"); - action = submenu->addAction("Go to my &stats"); + submenu = menu->addMenu(tr("&AniList")); + action = submenu->addAction(tr("Go to my &profile")); + action = submenu->addAction(tr("Go to my &stats")); - submenu = menu->addMenu("&Kitsu"); - action = submenu->addAction("Go to my &feed"); - action = submenu->addAction("Go to my &library"); - action = submenu->addAction("Go to my &profile"); + submenu = menu->addMenu(tr("&Kitsu")); + action = submenu->addAction(tr("Go to my &feed")); + action = submenu->addAction(tr("Go to my &library")); + action = submenu->addAction(tr("Go to my &profile")); - submenu = menu->addMenu("&MyAnimeList"); - action = submenu->addAction("Go to my p&anel"); - action = submenu->addAction("Go to my &profile"); - action = submenu->addAction("Go to my &history"); + submenu = menu->addMenu(tr("&MyAnimeList")); + action = submenu->addAction(tr("Go to my p&anel")); + action = submenu->addAction(tr("Go to my &profile")); + action = submenu->addAction(tr("Go to my &history")); - menu = menubar->addMenu("&Tools"); - submenu = menu->addMenu("&Export anime list"); - action = submenu->addAction("Export as &Markdown..."); - action = submenu->addAction("Export as MyAnimeList &XML..."); + menu = menubar->addMenu(tr("&Tools")); + submenu = menu->addMenu(tr("&Export anime list")); + action = submenu->addAction(tr("Export as &Markdown...")); + action = submenu->addAction(tr("Export as MyAnimeList &XML...")); menu->addSeparator(); - action = menu->addAction("Enable anime &recognition"); + action = menu->addAction(tr("Enable anime &recognition")); action->setCheckable(true); - action = menu->addAction("Enable auto &sharing"); + action = menu->addAction(tr("Enable auto &sharing")); action->setCheckable(true); - action = menu->addAction("Enable &auto synchronization"); + action = menu->addAction(tr("Enable &auto synchronization")); action->setCheckable(true); menu->addSeparator(); - action = menu->addAction("&Settings", [this] { + action = menu->addAction(tr("&Settings"), [this] { SettingsDialog dialog(this); dialog.exec(); }); action->setMenuRole(QAction::PreferencesRole); - menu = menubar->addMenu("&View"); + menu = menubar->addMenu(tr("&View")); std::map<QAction*, int> page_to_index_map = {}; QActionGroup* pages_group = new QActionGroup(this); pages_group->setExclusive(true); - action = pages_group->addAction(menu->addAction("&Now Playing")); + action = pages_group->addAction(menu->addAction(tr("&Now Playing"))); action->setCheckable(true); page_to_index_map[action] = 0; - action = pages_group->addAction(menu->addAction("&Anime List")); + action = pages_group->addAction(menu->addAction(tr("&Anime List"))); page_to_index_map[action] = 1; action->setCheckable(true); action->setChecked(true); - action = pages_group->addAction(menu->addAction("&History")); + action = pages_group->addAction(menu->addAction(tr("&History"))); action->setCheckable(true); page_to_index_map[action] = 2; - action = pages_group->addAction(menu->addAction("&Statistics")); + action = pages_group->addAction(menu->addAction(tr("&Statistics"))); action->setCheckable(true); page_to_index_map[action] = 3; - action = pages_group->addAction(menu->addAction("S&earch")); + action = pages_group->addAction(menu->addAction(tr("S&earch"))); action->setCheckable(true); page_to_index_map[action] = 4; - action = pages_group->addAction(menu->addAction("Se&asons")); + action = pages_group->addAction(menu->addAction(tr("Se&asons"))); action->setCheckable(true); page_to_index_map[action] = 5; - action = pages_group->addAction(menu->addAction("&Torrents")); + action = pages_group->addAction(menu->addAction(tr("&Torrents"))); action->setCheckable(true); page_to_index_map[action] = 6; @@ -176,10 +177,14 @@ } }); menu->addSeparator(); - menu->addAction("Show sidebar"); + menu->addAction(tr("Show sidebar")); - menu = menubar->addMenu("&Help"); - action = menu->addAction("About &Qt", qApp, [this] { qApp->aboutQt(); }); + menu = menubar->addMenu(tr("&Help")); + action = menu->addAction(tr("About Minori"), this, [this] { + AboutWindow dialog(this); + dialog.exec(); + }); + action = menu->addAction(tr("About &Qt"), qApp, &QApplication::aboutQt); action->setMenuRole(QAction::AboutQtRole); setMenuBar(menubar);