dolphin/Source/Core/DolphinQt2/Config/SettingsWindow.cpp
2018-04-16 23:15:45 +02:00

71 lines
2.1 KiB
C++

// Copyright 2016 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include <QDialogButtonBox>
#include <QPushButton>
#include <QTabWidget>
#include <QVBoxLayout>
#include "DolphinQt2/Config/SettingsWindow.h"
#include "DolphinQt2/MainWindow.h"
#include "DolphinQt2/Resources.h"
#include "DolphinQt2/Settings.h"
#include "DolphinQt2/Settings/AdvancedPane.h"
#include "DolphinQt2/Settings/AudioPane.h"
#include "DolphinQt2/Settings/GameCubePane.h"
#include "DolphinQt2/Settings/GeneralPane.h"
#include "DolphinQt2/Settings/InterfacePane.h"
#include "DolphinQt2/Settings/PathPane.h"
#include "DolphinQt2/Settings/WiiPane.h"
#include "Core/Core.h"
SettingsWindow::SettingsWindow(QWidget* parent) : QDialog(parent)
{
// Set Window Properties
setWindowTitle(tr("Settings"));
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
// Main Layout
QVBoxLayout* layout = new QVBoxLayout;
// Add content to layout before dialog buttons.
m_tab_widget = new QTabWidget();
layout->addWidget(m_tab_widget);
m_tab_widget->addTab(new GeneralPane(), tr("General"));
m_tab_widget->addTab(new InterfacePane(), tr("Interface"));
m_tab_widget->addTab(new AudioPane(), tr("Audio"));
m_tab_widget->addTab(new PathPane(), tr("Paths"));
m_tab_widget->addTab(new GameCubePane(), tr("GameCube"));
auto* wii_pane = new WiiPane;
m_tab_widget->addTab(wii_pane, tr("Wii"));
connect(&Settings::Instance(), &Settings::EmulationStateChanged, [wii_pane](Core::State state) {
wii_pane->OnEmulationStateChanged(state != Core::State::Uninitialized);
});
m_tab_widget->addTab(new AdvancedPane(), tr("Advanced"));
// Dialog box buttons
QDialogButtonBox* close_box = new QDialogButtonBox(QDialogButtonBox::Close);
connect(close_box, &QDialogButtonBox::rejected, this, &QDialog::reject);
layout->addWidget(close_box);
setLayout(layout);
}
void SettingsWindow::SelectAudioPane()
{
m_tab_widget->setCurrentIndex(static_cast<int>(TabIndex::Audio));
}
void SettingsWindow::SelectGeneralPane()
{
m_tab_widget->setCurrentIndex(static_cast<int>(TabIndex::Audio));
}