DolphinQt2: move Path from toolbar to a pane

This commit is contained in:
Michael Maltese 2017-05-31 01:08:04 -07:00
parent b296393644
commit 688f5ed267
10 changed files with 34 additions and 68 deletions

View File

@ -32,7 +32,6 @@ set(SRCS
Config/Mapping/WiimoteEmuExtension.cpp
Config/Mapping/WiimoteEmuGeneral.cpp
Config/Mapping/WiimoteEmuMotionControl.cpp
Config/PathDialog.cpp
Config/PropertiesDialog.cpp
Config/SettingsWindow.cpp
GameList/GameFile.cpp
@ -44,6 +43,7 @@ set(SRCS
QtUtils/ElidedButton.cpp
Settings/GeneralPane.cpp
Settings/InterfacePane.cpp
Settings/PathPane.cpp
)
list(APPEND LIBS core uicommon)

View File

@ -6,6 +6,7 @@
#include "DolphinQt2/Settings.h"
#include "DolphinQt2/Settings/GeneralPane.h"
#include "DolphinQt2/Settings/InterfacePane.h"
#include "DolphinQt2/Settings/PathPane.h"
SettingsWindow::SettingsWindow(QWidget* parent) : QDialog(parent)
{
@ -53,6 +54,7 @@ void SettingsWindow::SetupSettingsWidget()
// Panes initalised here
m_settings_outer->addWidget(new GeneralPane);
m_settings_outer->addWidget(new InterfacePane);
m_settings_outer->addWidget(new PathPane);
}
void SettingsWindow::MakeUnfinishedWarning()
@ -87,6 +89,7 @@ void SettingsWindow::MakeCategoryList()
AddCategoryToList(tr("General"), QStringLiteral("config.png"));
AddCategoryToList(tr("Interface"), QStringLiteral("browse.png"));
AddCategoryToList(tr("Paths"), QStringLiteral("browse.png"));
connect(m_categories, &QListWidget::currentItemChanged, this, &SettingsWindow::changePage);
}

View File

@ -75,7 +75,6 @@
<QtMoc Include="Config\Mapping\MappingWidget.h" />
<QtMoc Include="Config\Mapping\MappingWindow.h" />
<QtMoc Include="Config\InfoWidget.h" />
<QtMoc Include="Config\PathDialog.h" />
<QtMoc Include="Config\PropertiesDialog.h" />
<QtMoc Include="Config\SettingsWindow.h" />
<QtMoc Include="GameList\GameFile.h" />
@ -113,7 +112,6 @@
<ClCompile Include="$(QtMocOutPrefix)MappingWidget.cpp" />
<ClCompile Include="$(QtMocOutPrefix)MappingWindow.cpp" />
<ClCompile Include="$(QtMocOutPrefix)MenuBar.cpp" />
<ClCompile Include="$(QtMocOutPrefix)PathDialog.cpp" />
<ClCompile Include="$(QtMocOutPrefix)PropertiesDialog.cpp" />
<ClCompile Include="$(QtMocOutPrefix)DoubleClickEventFilter.cpp" />
<ClCompile Include="$(QtMocOutPrefix)RenderWidget.cpp" />
@ -135,7 +133,6 @@
<ClCompile Include="Config\Mapping\WiimoteEmuExtension.cpp" />
<ClCompile Include="Config\Mapping\WiimoteEmuGeneral.cpp" />
<ClCompile Include="Config\Mapping\WiimoteEmuMotionControl.cpp" />
<ClCompile Include="Config\PathDialog.cpp" />
<ClCompile Include="Config\PropertiesDialog.cpp" />
<ClCompile Include="Config\SettingsWindow.cpp" />
<ClCompile Include="GameList\GameFile.cpp" />
@ -155,6 +152,7 @@
<ClCompile Include="Settings.cpp" />
<ClCompile Include="Settings\GeneralPane.cpp" />
<ClCompile Include="Settings\InterfacePane.cpp" />
<ClCompile Include="Settings\PathPane.cpp" />
<ClCompile Include="ToolBar.cpp" />
</ItemGroup>
<!--Put standard C/C++ headers here-->

View File

@ -60,12 +60,6 @@
<ClCompile Include="Settings.cpp" />
<ClCompile Include="ToolBar.cpp" />
<ClCompile Include="Host.cpp" />
<ClCompile Include="$(QtMocOutPrefix)PathDialog.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
<ClCompile Include="Config\PathDialog.cpp">
<Filter>Config</Filter>
</ClCompile>
<ClCompile Include="AboutDialog.cpp" />
<ClCompile Include="$(QtMocOutPrefix)AboutDialog.cpp">
<Filter>Generated Files</Filter>
@ -106,6 +100,9 @@
<ClCompile Include="Settings\InterfacePane.cpp">
<Filter>Settings</Filter>
</ClCompile>
<ClCompile Include="Settings\PathPane.cpp">
<Filter>Settings</Filter>
</ClCompile>
<ClCompile Include="$(QtMocOutPrefix)MappingWidget.cpp" />
<ClCompile Include="$(QtMocOutPrefix)MappingWindow.cpp" />
<ClCompile Include="Config\Mapping\GCKeyboardEmu.cpp" />
@ -148,9 +145,6 @@
<QtMoc Include="GameList\GameTracker.h">
<Filter>GameList</Filter>
</QtMoc>
<QtMoc Include="Config\PathDialog.h">
<Filter>Config</Filter>
</QtMoc>
<QtMoc Include="AboutDialog.h" />
<QtMoc Include="Config\SettingsWindow.h" />
<QtMoc Include="Config\PropertiesDialog.h" />

View File

@ -22,7 +22,6 @@
#include "DolphinQt2/AboutDialog.h"
#include "DolphinQt2/Config/ControllersWindow.h"
#include "DolphinQt2/Config/PathDialog.h"
#include "DolphinQt2/Config/SettingsWindow.h"
#include "DolphinQt2/Host.h"
#include "DolphinQt2/MainWindow.h"
@ -82,7 +81,6 @@ void MainWindow::CreateComponents()
m_game_list = new GameList(this);
m_render_widget = new RenderWidget;
m_stack = new QStackedWidget(this);
m_paths_dialog = new PathDialog(this);
m_controllers_window = new ControllersWindow(this);
m_settings_window = new SettingsWindow(this);
}
@ -139,7 +137,6 @@ void MainWindow::ConnectToolBar()
connect(m_tool_bar, &ToolBar::StopPressed, this, &MainWindow::Stop);
connect(m_tool_bar, &ToolBar::FullScreenPressed, this, &MainWindow::FullScreen);
connect(m_tool_bar, &ToolBar::ScreenShotPressed, this, &MainWindow::ScreenShot);
connect(m_tool_bar, &ToolBar::PathsPressed, this, &MainWindow::ShowPathsDialog);
connect(m_tool_bar, &ToolBar::SettingsPressed, this, &MainWindow::ShowSettingsWindow);
connect(m_tool_bar, &ToolBar::ControllersPressed, this, &MainWindow::ShowControllersWindow);
@ -345,13 +342,6 @@ void MainWindow::HideRenderWidget()
m_render_widget->hide();
}
void MainWindow::ShowPathsDialog()
{
m_paths_dialog->show();
m_paths_dialog->raise();
m_paths_dialog->activateWindow();
}
void MainWindow::ShowControllersWindow()
{
m_controllers_window->show();

View File

@ -14,7 +14,6 @@
#include "DolphinQt2/RenderWidget.h"
#include "DolphinQt2/ToolBar.h"
class PathDialog;
class SettingsWindow;
class ControllersWindow;
@ -71,7 +70,6 @@ private:
void ShowRenderWidget();
void HideRenderWidget();
void ShowPathsDialog();
void ShowSettingsWindow();
void ShowControllersWindow();
void ShowAboutDialog();
@ -84,7 +82,6 @@ private:
bool m_rendering_to_main;
int m_state_slot = 1;
PathDialog* m_paths_dialog;
ControllersWindow* m_controllers_window;
SettingsWindow* m_settings_window;
};

View File

@ -2,22 +2,18 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include <QAction>
#include <QDialogButtonBox>
#include <QDir>
#include <QFileDialog>
#include <QFont>
#include <QGroupBox>
#include <QLabel>
#include <QLineEdit>
#include <QListWidget>
#include <QPushButton>
#include <QSize>
#include <QVBoxLayout>
#include "DolphinQt2/Config/PathDialog.h"
#include "DolphinQt2/Settings.h"
#include "DolphinQt2/Settings/PathPane.h"
PathDialog::PathDialog(QWidget* parent) : QDialog(parent)
PathPane::PathPane(QWidget* parent) : QWidget(parent)
{
setWindowTitle(tr("Paths"));
@ -25,14 +21,10 @@ PathDialog::PathDialog(QWidget* parent) : QDialog(parent)
layout->addWidget(MakeGameFolderBox());
layout->addLayout(MakePathsLayout());
QDialogButtonBox* ok_box = new QDialogButtonBox(QDialogButtonBox::Ok);
connect(ok_box, &QDialogButtonBox::accepted, this, &PathDialog::accept);
layout->addWidget(ok_box);
setLayout(layout);
}
void PathDialog::Browse()
void PathPane::Browse()
{
QString dir =
QFileDialog::getExistingDirectory(this, tr("Select a Directory"), QDir::currentPath());
@ -40,7 +32,7 @@ void PathDialog::Browse()
Settings::Instance().AddPath(dir);
}
void PathDialog::BrowseDefaultGame()
void PathPane::BrowseDefaultGame()
{
QString file = QFileDialog::getOpenFileName(
this, tr("Select a Game"), QDir::currentPath(),
@ -53,7 +45,7 @@ void PathDialog::BrowseDefaultGame()
}
}
void PathDialog::BrowseDVDRoot()
void PathPane::BrowseDVDRoot()
{
QString dir = QFileDialog::getExistingDirectory(this, tr("Select DVD Root"), QDir::currentPath());
if (!dir.isEmpty())
@ -63,7 +55,7 @@ void PathDialog::BrowseDVDRoot()
}
}
void PathDialog::BrowseApploader()
void PathPane::BrowseApploader()
{
QString file = QFileDialog::getOpenFileName(this, tr("Select an Apploader"), QDir::currentPath(),
tr("Apploaders (*.img)"));
@ -74,7 +66,7 @@ void PathDialog::BrowseApploader()
}
}
void PathDialog::BrowseWiiNAND()
void PathPane::BrowseWiiNAND()
{
QString dir =
QFileDialog::getExistingDirectory(this, tr("Select Wii NAND Root"), QDir::currentPath());
@ -85,7 +77,7 @@ void PathDialog::BrowseWiiNAND()
}
}
QGroupBox* PathDialog::MakeGameFolderBox()
QGroupBox* PathPane::MakeGameFolderBox()
{
QGroupBox* game_box = new QGroupBox(tr("Game Folders"));
game_box->setMinimumSize(QSize(400, 250));
@ -112,14 +104,14 @@ QGroupBox* PathDialog::MakeGameFolderBox()
hlayout->addWidget(remove);
vlayout->addLayout(hlayout);
connect(add, &QPushButton::clicked, this, &PathDialog::Browse);
connect(remove, &QPushButton::clicked, this, &PathDialog::RemovePath);
connect(add, &QPushButton::clicked, this, &PathPane::Browse);
connect(remove, &QPushButton::clicked, this, &PathPane::RemovePath);
game_box->setLayout(vlayout);
return game_box;
}
QGridLayout* PathDialog::MakePathsLayout()
QGridLayout* PathPane::MakePathsLayout()
{
auto& settings = Settings::Instance();
QGridLayout* layout = new QGridLayout;
@ -129,7 +121,7 @@ QGridLayout* PathDialog::MakePathsLayout()
connect(m_game_edit, &QLineEdit::editingFinished,
[=, &settings] { settings.SetDefaultGame(m_game_edit->text()); });
QPushButton* game_open = new QPushButton;
connect(game_open, &QPushButton::clicked, this, &PathDialog::BrowseDefaultGame);
connect(game_open, &QPushButton::clicked, this, &PathPane::BrowseDefaultGame);
layout->addWidget(new QLabel(tr("Default Game")), 0, 0);
layout->addWidget(m_game_edit, 0, 1);
layout->addWidget(game_open, 0, 2);
@ -138,7 +130,7 @@ QGridLayout* PathDialog::MakePathsLayout()
connect(m_dvd_edit, &QLineEdit::editingFinished,
[=, &settings] { settings.SetDVDRoot(m_dvd_edit->text()); });
QPushButton* dvd_open = new QPushButton;
connect(dvd_open, &QPushButton::clicked, this, &PathDialog::BrowseDVDRoot);
connect(dvd_open, &QPushButton::clicked, this, &PathPane::BrowseDVDRoot);
layout->addWidget(new QLabel(tr("DVD Root")), 1, 0);
layout->addWidget(m_dvd_edit, 1, 1);
layout->addWidget(dvd_open, 1, 2);
@ -147,7 +139,7 @@ QGridLayout* PathDialog::MakePathsLayout()
connect(m_app_edit, &QLineEdit::editingFinished,
[=, &settings] { settings.SetApploader(m_app_edit->text()); });
QPushButton* app_open = new QPushButton;
connect(app_open, &QPushButton::clicked, this, &PathDialog::BrowseApploader);
connect(app_open, &QPushButton::clicked, this, &PathPane::BrowseApploader);
layout->addWidget(new QLabel(tr("Apploader")), 2, 0);
layout->addWidget(m_app_edit, 2, 1);
layout->addWidget(app_open, 2, 2);
@ -156,7 +148,7 @@ QGridLayout* PathDialog::MakePathsLayout()
connect(m_nand_edit, &QLineEdit::editingFinished,
[=, &settings] { settings.SetWiiNAND(m_nand_edit->text()); });
QPushButton* nand_open = new QPushButton;
connect(nand_open, &QPushButton::clicked, this, &PathDialog::BrowseWiiNAND);
connect(nand_open, &QPushButton::clicked, this, &PathPane::BrowseWiiNAND);
layout->addWidget(new QLabel(tr("Wii NAND Root")), 3, 0);
layout->addWidget(m_nand_edit, 3, 1);
layout->addWidget(nand_open, 3, 2);
@ -164,7 +156,7 @@ QGridLayout* PathDialog::MakePathsLayout()
return layout;
}
void PathDialog::RemovePath()
void PathPane::RemovePath()
{
auto item = m_path_list->currentItem();
if (!item)

View File

@ -4,26 +4,24 @@
#pragma once
#include <QDialog>
#include <QGridLayout>
#include <QGroupBox>
#include <QHBoxLayout>
#include <QListWidget>
#include <QWidget>
class PathDialog final : public QDialog
class QGridLayout;
class QGroupBox;
class QLineEdit;
class QListWidget;
class PathPane final : public QWidget
{
Q_OBJECT
public:
explicit PathDialog(QWidget* parent = nullptr);
explicit PathPane(QWidget* parent = nullptr);
public slots:
private:
void Browse();
void BrowseDefaultGame();
void BrowseDVDRoot();
void BrowseApploader();
void BrowseWiiNAND();
private:
QGroupBox* MakeGameFolderBox();
QGridLayout* MakePathsLayout();
void RemovePath();

View File

@ -79,9 +79,6 @@ void ToolBar::MakeActions()
addSeparator();
m_paths_action = addAction(tr("Paths"), this, SIGNAL(PathsPressed()));
widgetForAction(m_paths_action)->setMinimumWidth(button_width);
m_config_action = addAction(tr("Settings"), this, SIGNAL(SettingsPressed()));
widgetForAction(m_config_action)->setMinimumWidth(button_width);
@ -93,7 +90,6 @@ void ToolBar::MakeActions()
void ToolBar::UpdateIcons()
{
m_open_action->setIcon(Resources::GetScaledThemeIcon("open"));
m_paths_action->setIcon(Resources::GetScaledThemeIcon("browse"));
m_play_action->setIcon(Resources::GetScaledThemeIcon("play"));
m_pause_action->setIcon(Resources::GetScaledThemeIcon("pause"));
m_stop_action->setIcon(Resources::GetScaledThemeIcon("stop"));

View File

@ -28,7 +28,6 @@ signals:
void FullScreenPressed();
void ScreenShotPressed();
void PathsPressed();
void SettingsPressed();
void ControllersPressed();
@ -42,7 +41,6 @@ private:
QAction* m_stop_action;
QAction* m_fullscreen_action;
QAction* m_screenshot_action;
QAction* m_paths_action;
QAction* m_config_action;
QAction* m_controllers_action;
};