summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinQt2/MainWindow.cpp
diff options
context:
space:
mode:
authorspxtr <spextear@gmail.com>2015-12-03 20:41:17 -0800
committerspxtr <spextear@gmail.com>2015-12-03 20:41:17 -0800
commita06b0d87a7593ca876284098ad9ac93ba4a119aa (patch)
tree88f0359e370e18beb126cd40a9b7fced5ba666ed /Source/Core/DolphinQt2/MainWindow.cpp
parent8322040c47e87cde407b21633be021ed76d41e5b (diff)
Refactor proxy models and toolbar.
Remove the ugly LARGE_ICON column hack from the table proxy and use a list proxy. Move the toolbar into its own file.
Diffstat (limited to 'Source/Core/DolphinQt2/MainWindow.cpp')
-rw-r--r--Source/Core/DolphinQt2/MainWindow.cpp84
1 files changed, 18 insertions, 66 deletions
diff --git a/Source/Core/DolphinQt2/MainWindow.cpp b/Source/Core/DolphinQt2/MainWindow.cpp
index 09f8f1579b..e8be576fe6 100644
--- a/Source/Core/DolphinQt2/MainWindow.cpp
+++ b/Source/Core/DolphinQt2/MainWindow.cpp
@@ -7,6 +7,7 @@
#include <QFile>
#include <QFileDialog>
#include <QIcon>
+#include <QLineEdit>
#include <QMenu>
#include <QMenuBar>
#include <QMessageBox>
@@ -25,8 +26,8 @@ MainWindow::MainWindow() : QMainWindow(nullptr)
setWindowTitle(tr("Dolphin"));
setWindowIcon(QIcon(Resources::GetMisc(Resources::LOGO_SMALL)));
- MakeToolBar();
MakeGameList();
+ MakeToolBar();
MakeRenderWidget();
MakeStack();
MakeMenus();
@@ -92,8 +93,7 @@ void MainWindow::AddTableColumnsMenu(QMenu* view_menu)
SConfig::GetInstance().m_showRegionColumn,
SConfig::GetInstance().m_showStateColumn,
};
- // - 1 because we never show COL_LARGE_ICON column in the table.
- for (int i = 0; i < GameListModel::NUM_COLS - 1; i++)
+ for (int i = 0; i < GameListModel::NUM_COLS; i++)
{
QAction* action = column_group->addAction(cols_menu->addAction(col_names[i]));
action->setCheckable(true);
@@ -151,12 +151,21 @@ void MainWindow::AddListTypePicker(QMenu* view_menu)
void MainWindow::MakeToolBar()
{
- setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
- m_tool_bar = addToolBar(tr("ToolBar"));
- m_tool_bar->setMovable(false);
- m_tool_bar->setFloatable(false);
-
- PopulateToolBar();
+ m_tool_bar = new ToolBar(this);
+ addToolBar(m_tool_bar);
+
+ connect(m_tool_bar, &ToolBar::OpenPressed, this, &MainWindow::Open);
+ // TODO make this open the config paths dialog, not the current Browse menu.
+ connect(m_tool_bar, &ToolBar::PathsPressed, this, &MainWindow::Browse);
+ connect(m_tool_bar, &ToolBar::PlayPressed, this, &MainWindow::Play);
+ connect(m_tool_bar, &ToolBar::PausePressed, this, &MainWindow::Pause);
+ 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(this, &MainWindow::EmulationStarted, m_tool_bar, &ToolBar::EmulationStarted);
+ connect(this, &MainWindow::EmulationPaused, m_tool_bar, &ToolBar::EmulationPaused);
+ connect(this, &MainWindow::EmulationStopped, m_tool_bar, &ToolBar::EmulationStopped);
}
void MainWindow::MakeGameList()
@@ -182,63 +191,6 @@ void MainWindow::MakeStack()
setCentralWidget(m_stack);
}
-void MainWindow::PopulateToolBar()
-{
- m_tool_bar->clear();
-
- QString dir = QString::fromStdString(File::GetThemeDir(SConfig::GetInstance().theme_name));
- m_tool_bar->addAction(
- QIcon(dir + QStringLiteral("open.png")), tr("Open"),
- this, SLOT(Open()));
- m_tool_bar->addAction(
- QIcon(dir + QStringLiteral("browse.png")), tr("Browse"),
- this, SLOT(Browse()));
-
- m_tool_bar->addSeparator();
-
- QAction* play_action = m_tool_bar->addAction(
- QIcon(dir + QStringLiteral("play.png")), tr("Play"),
- this, SLOT(Play()));
- connect(this, &MainWindow::EmulationStarted, [=](){ play_action->setEnabled(false); });
- connect(this, &MainWindow::EmulationPaused, [=](){ play_action->setEnabled(true); });
- connect(this, &MainWindow::EmulationStopped, [=](){ play_action->setEnabled(true); });
-
- QAction* pause_action = m_tool_bar->addAction(
- QIcon(dir + QStringLiteral("pause.png")), tr("Pause"),
- this, SLOT(Pause()));
- pause_action->setEnabled(false);
- connect(this, &MainWindow::EmulationStarted, [=](){ pause_action->setEnabled(true); });
- connect(this, &MainWindow::EmulationPaused, [=](){ pause_action->setEnabled(false); });
- connect(this, &MainWindow::EmulationStopped, [=](){ pause_action->setEnabled(false); });
-
- QAction* stop_action = m_tool_bar->addAction(
- QIcon(dir + QStringLiteral("stop.png")), tr("Stop"),
- this, SLOT(Stop()));
- stop_action->setEnabled(false);
- connect(this, &MainWindow::EmulationStarted, [=](){ stop_action->setEnabled(true); });
- connect(this, &MainWindow::EmulationPaused, [=](){ stop_action->setEnabled(true); });
- connect(this, &MainWindow::EmulationStopped, [=](){ stop_action->setEnabled(false); });
-
- QAction* fullscreen_action = m_tool_bar->addAction(
- QIcon(dir + QStringLiteral("fullscreen.png")), tr("Full Screen"),
- this, SLOT(FullScreen()));
- fullscreen_action->setEnabled(false);
- connect(this, &MainWindow::EmulationStarted, [=](){ fullscreen_action->setEnabled(true); });
- connect(this, &MainWindow::EmulationStopped, [=](){ fullscreen_action->setEnabled(false); });
-
- QAction* screenshot_action = m_tool_bar->addAction(
- QIcon(dir + QStringLiteral("screenshot.png")), tr("Screen Shot"),
- this, SLOT(ScreenShot()));
- screenshot_action->setEnabled(false);
- connect(this, &MainWindow::EmulationStarted, [=](){ screenshot_action->setEnabled(true); });
- connect(this, &MainWindow::EmulationStopped, [=](){ screenshot_action->setEnabled(false); });
-
- m_tool_bar->addSeparator();
- m_tool_bar->addAction(QIcon(dir + QStringLiteral("config.png")), tr("Settings"))->setEnabled(false);
- m_tool_bar->addAction(QIcon(dir + QStringLiteral("graphics.png")), tr("Graphics"))->setEnabled(false);
- m_tool_bar->addAction(QIcon(dir + QStringLiteral("classic.png")), tr("Controllers"))->setEnabled(false);
-}
-
void MainWindow::Open()
{
QString file = QFileDialog::getOpenFileName(this,