Merge pull request #3021 from waddlesplash/dolphin-qt-fixup

DolphinQt: Use more C++11, add more sanity to VS projects.
This commit is contained in:
Lioncash 2015-09-12 00:36:35 -04:00
commit 4643da73a3
7 changed files with 60 additions and 94 deletions

View File

@ -5,28 +5,13 @@
<ClCompile Include="Host.cpp" />
<ClCompile Include="Main.cpp" />
<ClCompile Include="MainWindow.cpp" />
<ClCompile Include="SystemInfo.cpp" />
<ClCompile Include="Utils\Resources.cpp">
<Filter>Utils</Filter>
</ClCompile>
<ClCompile Include="Utils\Utils.cpp">
<Filter>Utils</Filter>
</ClCompile>
<ClCompile Include="SystemInfo.cpp" />
<ClCompile Include="VideoInterface\RenderWidget.cpp">
<Filter>VideoInterface</Filter>
</ClCompile>
<ClCompile Include="$(QtMocOutPrefix)AboutDialog.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
<ClCompile Include="$(QtMocOutPrefix)MainWindow.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
<ClCompile Include="$(QtMocOutPrefix)RenderWidget.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
<ClCompile Include="$(QtMocOutPrefix)SystemInfo.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
<ClCompile Include="GameList\GameFile.cpp">
<Filter>GameList</Filter>
</ClCompile>
@ -39,6 +24,18 @@
<ClCompile Include="GameList\GameTree.cpp">
<Filter>GameList</Filter>
</ClCompile>
<ClCompile Include="VideoInterface\RenderWidget.cpp">
<Filter>VideoInterface</Filter>
</ClCompile>
<ClCompile Include="$(QtMocOutPrefix)MainWindow.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
<ClCompile Include="$(QtMocOutPrefix)RenderWidget.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
<ClCompile Include="$(QtMocOutPrefix)SystemInfo.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
<ClCompile Include="$(QtMocOutPrefix)GameGrid.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
@ -48,6 +45,9 @@
<ClCompile Include="$(QtMocOutPrefix)GameTree.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
<ClCompile Include="$(QtMocOutPrefix)AboutDialog.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<QtMoc Include="AboutDialog.h" />
@ -64,9 +64,6 @@
<QtUi Include="GameList\*.ui">
<Filter>GameList</Filter>
</QtUi>
<QtUi Include="*.ui" />
<QtUi Include="*.ui" />
<QtUi Include="GameList\*.ui" />
</ItemGroup>
<ItemGroup>
<Text Include="CMakeLists.txt" />

View File

@ -22,7 +22,7 @@ DGameGrid::DGameGrid(QWidget* parent_widget) :
m_ui->setupUi(this);
SetViewStyle(STYLE_GRID);
connect(this, SIGNAL(itemActivated(QListWidgetItem*)), this, SIGNAL(StartGame()));
connect(this, &QListWidget::itemActivated, this, &DGameGrid::StartGame);
}
DGameGrid::~DGameGrid()

View File

@ -27,15 +27,15 @@ DGameTracker::DGameTracker(QWidget* parent_widget)
: QStackedWidget(parent_widget),
m_watcher(new QFileSystemWatcher(this))
{
connect(m_watcher, SIGNAL(directoryChanged(QString)), this, SLOT(ScanForGames()));
connect(m_watcher, &QFileSystemWatcher::directoryChanged, this, &DGameTracker::ScanForGames);
m_tree_widget = new DGameTree(this);
addWidget(m_tree_widget);
connect(m_tree_widget, SIGNAL(StartGame()), this, SIGNAL(StartGame()));
connect(m_tree_widget, &DGameTree::StartGame, this, &DGameTracker::StartGame);
m_grid_widget = new DGameGrid(this);
addWidget(m_grid_widget);
connect(m_grid_widget, SIGNAL(StartGame()), this, SIGNAL(StartGame()));
connect(m_grid_widget, &DGameGrid::StartGame, this, &DGameTracker::StartGame);
SetViewStyle(STYLE_LIST);
}

View File

@ -24,7 +24,7 @@ DGameTree::DGameTree(QWidget* parent_widget) :
setIconSize(QSize(BANNER_WIDTH, BANNER_HEIGHT));
sortByColumn(COL_TITLE, Qt::AscendingOrder);
connect(this, SIGNAL(itemActivated(QTreeWidgetItem*, int)), this, SLOT(ItemActivated(QTreeWidgetItem*)));
connect(this, &QTreeWidget::itemActivated, this, &DGameTree::ItemActivated);
}
DGameTree::~DGameTree()

View File

@ -54,30 +54,48 @@ DMainWindow::DMainWindow(QWidget* parent_widget)
OnGameListStyleChanged();
// Connect all the signals/slots
connect(this, SIGNAL(CoreStateChanged(Core::EState)), this, SLOT(OnCoreStateChanged(Core::EState)));
connect(this, &DMainWindow::CoreStateChanged, this, &DMainWindow::OnCoreStateChanged);
connect(m_ui->actionOpen, SIGNAL(triggered()), this, SLOT(OnOpen()));
connect(m_ui->actionBrowse, SIGNAL(triggered()), this, SLOT(OnBrowse()));
connect(m_ui->actionExit, SIGNAL(triggered()), this, SLOT(OnExit()));
connect(m_ui->actionOpen, &QAction::triggered, this, [&]() {
QString filename = ShowFileDialog();
if (!filename.isNull())
StartGame(filename);
});
connect(m_ui->actionBrowse, &QAction::triggered, this, &DMainWindow::OnBrowse);
connect(m_ui->actionExit, &QAction::triggered, this, &DMainWindow::OnExit);
connect(m_ui->actionListView, SIGNAL(triggered()), this, SLOT(OnGameListStyleChanged()));
connect(m_ui->actionTreeView, SIGNAL(triggered()), this, SLOT(OnGameListStyleChanged()));
connect(m_ui->actionGridView, SIGNAL(triggered()), this, SLOT(OnGameListStyleChanged()));
connect(m_ui->actionIconView, SIGNAL(triggered()), this, SLOT(OnGameListStyleChanged()));
connect(m_ui->actionListView, &QAction::triggered, this, &DMainWindow::OnGameListStyleChanged);
connect(m_ui->actionTreeView, &QAction::triggered, this, &DMainWindow::OnGameListStyleChanged);
connect(m_ui->actionGridView, &QAction::triggered, this, &DMainWindow::OnGameListStyleChanged);
connect(m_ui->actionIconView, &QAction::triggered, this, &DMainWindow::OnGameListStyleChanged);
connect(m_ui->actionPlay, SIGNAL(triggered()), this, SLOT(OnPlay()));
connect(m_ui->actionPlay_mnu, SIGNAL(triggered()), this, SLOT(OnPlay()));
connect(m_game_tracker, SIGNAL(StartGame()), this, SLOT(OnPlay()));
connect(m_ui->actionStop, SIGNAL(triggered()), this, SLOT(OnStop()));
connect(m_ui->actionStop_mnu, SIGNAL(triggered()), this, SLOT(OnStop()));
connect(m_ui->actionReset, SIGNAL(triggered()), this, SLOT(OnReset()));
connect(m_ui->actionPlay, &QAction::triggered, this, &DMainWindow::OnPlay);
connect(m_ui->actionPlay_mnu, &QAction::triggered, this, &DMainWindow::OnPlay);
connect(m_game_tracker, &DGameTracker::StartGame, this, &DMainWindow::OnPlay);
connect(m_ui->actionStop, &QAction::triggered, this, &DMainWindow::OnStop);
connect(m_ui->actionStop_mnu, &QAction::triggered, this, &DMainWindow::OnStop);
connect(m_ui->actionReset, &QAction::triggered, this, &DMainWindow::OnReset);
connect(m_ui->actionWebsite, SIGNAL(triggered()), this, SLOT(OnOpenWebsite()));
connect(m_ui->actionOnlineDocs, SIGNAL(triggered()), this, SLOT(OnOpenDocs()));
connect(m_ui->actionGitHub, SIGNAL(triggered()), this, SLOT(OnOpenGitHub()));
connect(m_ui->actionSystemInfo, SIGNAL(triggered()), this, SLOT(OnOpenSystemInfo()));
connect(m_ui->actionAbout, SIGNAL(triggered()), this, SLOT(OnOpenAbout()));
connect(m_ui->actionAboutQt, SIGNAL(triggered()), this, SLOT(OnOpenAboutQt()));
connect(m_ui->actionWebsite, &QAction::triggered, this, [&]() {
QDesktopServices::openUrl(QUrl(SL("https://dolphin-emu.org/")));
});
connect(m_ui->actionOnlineDocs, &QAction::triggered, this, [&]() {
QDesktopServices::openUrl(QUrl(SL("https://dolphin-emu.org/docs/guides/")));
});
connect(m_ui->actionGitHub, &QAction::triggered, this, [&]() {
QDesktopServices::openUrl(QUrl(SL("https://github.com/dolphin-emu/dolphin")));
});
connect(m_ui->actionSystemInfo, &QAction::triggered, this, [&]() {
DSystemInfo* dlg = new DSystemInfo(this);
dlg->open();
});
connect(m_ui->actionAbout, &QAction::triggered, this, [&]() {
DAboutDialog* dlg = new DAboutDialog(this);
dlg->open();
});
connect(m_ui->actionAboutQt, &QAction::triggered, this, [&]() {
QApplication::aboutQt();
});
// Update GUI items
emit CoreStateChanged(Core::CORE_UNINITIALIZED);
@ -198,13 +216,6 @@ void DMainWindow::DoStartPause()
m_render_widget->setCursor(Qt::BlankCursor);
}
void DMainWindow::OnOpen()
{
QString filename = ShowFileDialog();
if (!filename.isNull())
StartGame(filename);
}
void DMainWindow::OnBrowse()
{
std::string path = ShowFolderDialog().toStdString();
@ -349,36 +360,3 @@ void DMainWindow::UpdateIcons()
// Play/Pause is handled in OnCoreStateChanged().
m_ui->actionStop->setIcon(Resources::GetIcon(Resources::TOOLBAR_STOP));
}
// Help menu
void DMainWindow::OnOpenWebsite()
{
QDesktopServices::openUrl(QUrl(SL("https://dolphin-emu.org/")));
}
void DMainWindow::OnOpenDocs()
{
QDesktopServices::openUrl(QUrl(SL("https://dolphin-emu.org/docs/guides/")));
}
void DMainWindow::OnOpenGitHub()
{
QDesktopServices::openUrl(QUrl(SL("https://github.com/dolphin-emu/dolphin")));
}
void DMainWindow::OnOpenSystemInfo()
{
DSystemInfo* dlg = new DSystemInfo(this);
dlg->open();
}
void DMainWindow::OnOpenAbout()
{
DAboutDialog* dlg = new DAboutDialog(this);
dlg->open();
}
void DMainWindow::OnOpenAboutQt()
{
QApplication::aboutQt();
}

View File

@ -43,7 +43,6 @@ private slots:
void OnCoreStateChanged(Core::EState state);
// Main toolbar
void OnOpen();
void OnBrowse();
void OnExit();
void OnPlay();
@ -52,14 +51,6 @@ private slots:
// View menu
void OnGameListStyleChanged();
// Help menu
void OnOpenWebsite();
void OnOpenDocs();
void OnOpenGitHub();
void OnOpenSystemInfo();
void OnOpenAbout();
void OnOpenAboutQt();
// Misc.
void UpdateIcons();

View File

@ -27,7 +27,7 @@ DSystemInfo::DSystemInfo(QWidget* parent_widget) :
UpdateSystemInfo();
QPushButton* btn = m_ui->buttonBox->addButton(tr("Copy"), QDialogButtonBox::ActionRole);
connect(btn, SIGNAL(pressed()), this, SLOT(CopyPressed()));
connect(btn, &QPushButton::pressed, this, &DSystemInfo::CopyPressed);
}
DSystemInfo::~DSystemInfo()