Merge pull request #6509 from spycrab/qt_shader_gen

Qt: Show shader generation window
This commit is contained in:
Léo Lam 2018-03-24 09:03:16 +01:00 committed by GitHub
commit 37dbb2e181
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 42 additions and 5 deletions

View File

@ -6,6 +6,7 @@
#include <QAbstractEventDispatcher>
#include <QApplication>
#include <QProgressDialog>
#include "Common/Common.h"
#include "Core/ConfigManager.h"
@ -105,6 +106,7 @@ void Host_UpdateDisasmDialog()
void Host_UpdateProgressDialog(const char* caption, int position, int total)
{
emit Host::GetInstance()->UpdateProgressDialog(QString::fromUtf8(caption), position, total);
}
// We ignore these, and their purpose should be questioned individually.

View File

@ -32,6 +32,7 @@ signals:
void RequestTitle(const QString& title);
void RequestStop();
void RequestRenderSize(int w, int h);
void UpdateProgressDialog(QString label, int position, int maximum);
private:
Host();

View File

@ -93,6 +93,7 @@ MainWindow::MainWindow(std::unique_ptr<BootParameters> boot_parameters) : QMainW
CreateComponents();
ConnectGameList();
ConnectHost();
ConnectToolBar();
ConnectRenderWidget();
ConnectStack();
@ -375,6 +376,12 @@ void MainWindow::ConnectRenderWidget()
connect(m_render_widget, &RenderWidget::Closed, this, &MainWindow::ForceStop);
}
void MainWindow::ConnectHost()
{
connect(Host::GetInstance(), &Host::UpdateProgressDialog, this,
&MainWindow::OnUpdateProgressDialog);
}
void MainWindow::ConnectStack()
{
auto* widget = new QWidget;
@ -1194,3 +1201,24 @@ void MainWindow::ShowMemcardManager()
manager.exec();
}
void MainWindow::OnUpdateProgressDialog(QString title, int progress, int total)
{
if (!m_progress_dialog)
{
m_progress_dialog = new QProgressDialog(m_render_widget);
m_progress_dialog->show();
}
m_progress_dialog->setValue(progress);
m_progress_dialog->setLabelText(title);
m_progress_dialog->setWindowTitle(title);
m_progress_dialog->setMaximum(total);
if (total < 0 || progress >= total)
{
m_progress_dialog->hide();
m_progress_dialog->deleteLater();
m_progress_dialog = nullptr;
}
}

View File

@ -18,10 +18,16 @@
#include "DolphinQt2/RenderWidget.h"
#include "DolphinQt2/ToolBar.h"
class QProgressDialog;
class BreakpointWidget;
struct BootParameters;
class CodeWidget;
class ControllersWindow;
class DragEnterEvent;
class FIFOPlayerWindow;
class GCTASInputWindow;
class GraphicsWindow;
class HotkeyScheduler;
class LogConfigWidget;
class LogWidget;
@ -30,14 +36,10 @@ class NetPlayClient;
class NetPlayDialog;
class NetPlayServer;
class NetPlaySetupDialog;
class RegisterWidget;
class SearchBar;
class SettingsWindow;
class ControllersWindow;
class DragEnterEvent;
class GraphicsWindow;
class RegisterWidget;
class WatchWidget;
class GCTASInputWindow;
class WiiTASInputWindow;
class MainWindow final : public QMainWindow
@ -85,6 +87,7 @@ private:
void CreateComponents();
void ConnectGameList();
void ConnectHost();
void ConnectHotkeys();
void ConnectMenuBar();
void ConnectRenderWidget();
@ -122,6 +125,8 @@ private:
void OnImportNANDBackup();
void OnConnectWiiRemote(int id);
void OnUpdateProgressDialog(QString label, int progress, int total);
void OnPlayRecording();
void OnStartRecording();
void OnStopRecording();
@ -135,6 +140,7 @@ private:
void dropEvent(QDropEvent* event) override;
QSize sizeHint() const override;
QProgressDialog* m_progress_dialog = nullptr;
QStackedWidget* m_stack;
ToolBar* m_tool_bar;
MenuBar* m_menu_bar;