Qt: Pass QStrings by reference in HostInterface
This commit is contained in:
parent
fd8ed08307
commit
e5740a5632
|
@ -33,12 +33,12 @@ MainWindow::~MainWindow()
|
||||||
Assert(!m_display_widget);
|
Assert(!m_display_widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::reportError(QString message)
|
void MainWindow::reportError(const QString& message)
|
||||||
{
|
{
|
||||||
QMessageBox::critical(nullptr, tr("DuckStation Error"), message, QMessageBox::Ok);
|
QMessageBox::critical(nullptr, tr("DuckStation Error"), message, QMessageBox::Ok);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::reportMessage(QString message)
|
void MainWindow::reportMessage(const QString& message)
|
||||||
{
|
{
|
||||||
m_ui.statusBar->showMessage(message, 2000);
|
m_ui.statusBar->showMessage(message, 2000);
|
||||||
}
|
}
|
||||||
|
@ -129,7 +129,7 @@ void MainWindow::onSystemPerformanceCountersUpdated(float speed, float fps, floa
|
||||||
QStringLiteral("%1ms average, %2ms worst").arg(average_frame_time, 0, 'f', 2).arg(worst_frame_time, 0, 'f', 2));
|
QStringLiteral("%1ms average, %2ms worst").arg(average_frame_time, 0, 'f', 2).arg(worst_frame_time, 0, 'f', 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onRunningGameChanged(QString filename, QString game_code, QString game_title)
|
void MainWindow::onRunningGameChanged(const QString& filename, const QString& game_code, const QString& game_title)
|
||||||
{
|
{
|
||||||
m_host_interface->populateSaveStateMenus(game_code.toStdString().c_str(), m_ui.menuLoadState, m_ui.menuSaveState);
|
m_host_interface->populateSaveStateMenus(game_code.toStdString().c_str(), m_ui.menuLoadState, m_ui.menuSaveState);
|
||||||
if (game_title.isEmpty())
|
if (game_title.isEmpty())
|
||||||
|
|
|
@ -22,8 +22,8 @@ public:
|
||||||
~MainWindow();
|
~MainWindow();
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void reportError(QString message);
|
void reportError(const QString& message);
|
||||||
void reportMessage(QString message);
|
void reportMessage(const QString& message);
|
||||||
void createDisplayWindow(QThread* worker_thread, bool use_debug_device);
|
void createDisplayWindow(QThread* worker_thread, bool use_debug_device);
|
||||||
void destroyDisplayWindow();
|
void destroyDisplayWindow();
|
||||||
void toggleFullscreen();
|
void toggleFullscreen();
|
||||||
|
@ -32,7 +32,7 @@ private Q_SLOTS:
|
||||||
void onEmulationPaused(bool paused);
|
void onEmulationPaused(bool paused);
|
||||||
void onSystemPerformanceCountersUpdated(float speed, float fps, float vps, float average_frame_time,
|
void onSystemPerformanceCountersUpdated(float speed, float fps, float vps, float average_frame_time,
|
||||||
float worst_frame_time);
|
float worst_frame_time);
|
||||||
void onRunningGameChanged(QString filename, QString game_code, QString game_title);
|
void onRunningGameChanged(const QString& filename, const QString& game_code, const QString& game_title);
|
||||||
|
|
||||||
void onStartDiscActionTriggered();
|
void onStartDiscActionTriggered();
|
||||||
void onChangeDiscFromFileActionTriggered();
|
void onChangeDiscFromFileActionTriggered();
|
||||||
|
|
|
@ -167,11 +167,11 @@ QtDisplayWindow* QtHostInterface::createDisplayWindow()
|
||||||
return m_display_window;
|
return m_display_window;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtHostInterface::bootSystemFromFile(QString filename)
|
void QtHostInterface::bootSystemFromFile(const QString& filename)
|
||||||
{
|
{
|
||||||
if (!isOnWorkerThread())
|
if (!isOnWorkerThread())
|
||||||
{
|
{
|
||||||
QMetaObject::invokeMethod(this, "bootSystemFromFile", Qt::QueuedConnection, Q_ARG(QString, filename));
|
QMetaObject::invokeMethod(this, "bootSystemFromFile", Qt::QueuedConnection, Q_ARG(const QString&, filename));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -527,7 +527,7 @@ void QtHostInterface::pauseSystem(bool paused)
|
||||||
emit emulationPaused(paused);
|
emit emulationPaused(paused);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtHostInterface::changeDisc(QString new_disc_filename) {}
|
void QtHostInterface::changeDisc(const QString& new_disc_filename) {}
|
||||||
|
|
||||||
void QtHostInterface::populateSaveStateMenus(const char* game_code, QMenu* load_menu, QMenu* save_menu)
|
void QtHostInterface::populateSaveStateMenus(const char* game_code, QMenu* load_menu, QMenu* save_menu)
|
||||||
{
|
{
|
||||||
|
@ -579,11 +579,11 @@ void QtHostInterface::populateSaveStateMenus(const char* game_code, QMenu* load_
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtHostInterface::loadState(QString filename)
|
void QtHostInterface::loadState(const QString& filename)
|
||||||
{
|
{
|
||||||
if (!isOnWorkerThread())
|
if (!isOnWorkerThread())
|
||||||
{
|
{
|
||||||
QMetaObject::invokeMethod(this, "loadState", Qt::QueuedConnection, Q_ARG(QString, filename));
|
QMetaObject::invokeMethod(this, "loadState", Qt::QueuedConnection, Q_ARG(const QString&, filename));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,8 +61,8 @@ public:
|
||||||
void populateSaveStateMenus(const char* game_code, QMenu* load_menu, QMenu* save_menu);
|
void populateSaveStateMenus(const char* game_code, QMenu* load_menu, QMenu* save_menu);
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void errorReported(QString message);
|
void errorReported(const QString& message);
|
||||||
void messageReported(QString message);
|
void messageReported(const QString& message);
|
||||||
void emulationStarted();
|
void emulationStarted();
|
||||||
void emulationStopped();
|
void emulationStopped();
|
||||||
void emulationPaused(bool paused);
|
void emulationPaused(bool paused);
|
||||||
|
@ -72,17 +72,17 @@ Q_SIGNALS:
|
||||||
void toggleFullscreenRequested();
|
void toggleFullscreenRequested();
|
||||||
void systemPerformanceCountersUpdated(float speed, float fps, float vps, float avg_frame_time,
|
void systemPerformanceCountersUpdated(float speed, float fps, float vps, float avg_frame_time,
|
||||||
float worst_frame_time);
|
float worst_frame_time);
|
||||||
void runningGameChanged(QString filename, QString game_code, QString game_title);
|
void runningGameChanged(const QString& filename, const QString& game_code, const QString& game_title);
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void applySettings();
|
void applySettings();
|
||||||
void bootSystemFromFile(QString filename);
|
void bootSystemFromFile(const QString& filename);
|
||||||
void bootSystemFromBIOS();
|
void bootSystemFromBIOS();
|
||||||
void destroySystem(bool save_resume_state = false, bool block_until_done = false);
|
void destroySystem(bool save_resume_state = false, bool block_until_done = false);
|
||||||
void resetSystem();
|
void resetSystem();
|
||||||
void pauseSystem(bool paused);
|
void pauseSystem(bool paused);
|
||||||
void changeDisc(QString new_disc_filename);
|
void changeDisc(const QString& new_disc_filename);
|
||||||
void loadState(QString filename);
|
void loadState(const QString& filename);
|
||||||
void loadState(bool global, qint32 slot);
|
void loadState(bool global, qint32 slot);
|
||||||
void saveState(bool global, qint32 slot, bool block_until_done = false);
|
void saveState(bool global, qint32 slot, bool block_until_done = false);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue