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

View File

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

View File

@ -27,15 +27,15 @@ DGameTracker::DGameTracker(QWidget* parent_widget)
: QStackedWidget(parent_widget), : QStackedWidget(parent_widget),
m_watcher(new QFileSystemWatcher(this)) 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); m_tree_widget = new DGameTree(this);
addWidget(m_tree_widget); 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); m_grid_widget = new DGameGrid(this);
addWidget(m_grid_widget); 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); SetViewStyle(STYLE_LIST);
} }

View File

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

View File

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

View File

@ -27,7 +27,7 @@ DSystemInfo::DSystemInfo(QWidget* parent_widget) :
UpdateSystemInfo(); UpdateSystemInfo();
QPushButton* btn = m_ui->buttonBox->addButton(tr("Copy"), QDialogButtonBox::ActionRole); 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() DSystemInfo::~DSystemInfo()