2015-12-20 05:24:48 +00:00
|
|
|
// Copyright 2015 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2+
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#include <QAction>
|
|
|
|
#include <QActionGroup>
|
|
|
|
|
|
|
|
#include "DolphinQt2/MenuBar.h"
|
2016-01-01 10:29:39 +00:00
|
|
|
#include "DolphinQt2/Settings.h"
|
2015-12-20 05:24:48 +00:00
|
|
|
|
|
|
|
MenuBar::MenuBar(QWidget* parent)
|
|
|
|
: QMenuBar(parent)
|
|
|
|
{
|
|
|
|
AddFileMenu();
|
|
|
|
addMenu(tr("Emulation"));
|
|
|
|
addMenu(tr("Movie"));
|
|
|
|
addMenu(tr("Options"));
|
|
|
|
addMenu(tr("Tools"));
|
|
|
|
AddViewMenu();
|
|
|
|
addMenu(tr("Help"));
|
|
|
|
}
|
|
|
|
|
|
|
|
void MenuBar::AddFileMenu()
|
|
|
|
{
|
|
|
|
QMenu* file_menu = addMenu(tr("File"));
|
|
|
|
file_menu->addAction(tr("Open"), this, SIGNAL(Open()));
|
|
|
|
file_menu->addAction(tr("Exit"), this, SIGNAL(Exit()));
|
|
|
|
}
|
|
|
|
|
|
|
|
void MenuBar::AddViewMenu()
|
|
|
|
{
|
|
|
|
QMenu* view_menu = addMenu(tr("View"));
|
|
|
|
AddGameListTypeSection(view_menu);
|
|
|
|
view_menu->addSeparator();
|
|
|
|
AddTableColumnsMenu(view_menu);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MenuBar::AddGameListTypeSection(QMenu* view_menu)
|
|
|
|
{
|
|
|
|
QAction* table_view = view_menu->addAction(tr("Table"));
|
|
|
|
table_view->setCheckable(true);
|
|
|
|
|
|
|
|
QAction* list_view = view_menu->addAction(tr("List"));
|
|
|
|
list_view->setCheckable(true);
|
|
|
|
|
|
|
|
QActionGroup* list_group = new QActionGroup(this);
|
|
|
|
list_group->addAction(table_view);
|
|
|
|
list_group->addAction(list_view);
|
|
|
|
|
2016-01-01 10:29:39 +00:00
|
|
|
bool prefer_table = Settings().GetPreferredView();
|
|
|
|
table_view->setChecked(prefer_table);
|
|
|
|
list_view->setChecked(!prefer_table);
|
2015-12-20 05:24:48 +00:00
|
|
|
|
|
|
|
connect(table_view, &QAction::triggered, this, &MenuBar::ShowTable);
|
|
|
|
connect(list_view, &QAction::triggered, this, &MenuBar::ShowList);
|
|
|
|
}
|
|
|
|
|
2015-12-20 23:36:39 +00:00
|
|
|
// TODO implement this
|
2015-12-20 05:24:48 +00:00
|
|
|
void MenuBar::AddTableColumnsMenu(QMenu* view_menu)
|
|
|
|
{
|
|
|
|
QActionGroup* column_group = new QActionGroup(this);
|
|
|
|
QMenu* cols_menu = view_menu->addMenu(tr("Table Columns"));
|
|
|
|
column_group->setExclusive(false);
|
|
|
|
|
|
|
|
QStringList col_names{
|
|
|
|
tr("Platform"),
|
|
|
|
tr("ID"),
|
|
|
|
tr("Banner"),
|
|
|
|
tr("Title"),
|
|
|
|
tr("Description"),
|
|
|
|
tr("Maker"),
|
|
|
|
tr("Size"),
|
|
|
|
tr("Country"),
|
|
|
|
tr("Quality")
|
|
|
|
};
|
|
|
|
for (int i = 0; i < col_names.count(); i++)
|
|
|
|
{
|
|
|
|
QAction* action = column_group->addAction(cols_menu->addAction(col_names[i]));
|
|
|
|
action->setCheckable(true);
|
|
|
|
}
|
|
|
|
}
|