Browse Source
[qt] frontend abstraction and message box early handling
[qt] frontend abstraction and message box early handling
Signed-off-by: crueter <crueter@eden-emu.dev>pull/94/head
8 changed files with 136 additions and 47 deletions
-
1src/CMakeLists.txt
-
5src/frontend_common/firmware_manager.h
-
6src/qt_common/CMakeLists.txt
-
59src/qt_common/qt_common.cpp
-
16src/qt_common/qt_common.h
-
25src/qt_common/qt_frontend_util.cpp
-
29src/qt_common/qt_frontend_util.h
-
24src/yuzu/main.cpp
5
src/frontend_common/firmware_manager.h
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,25 @@ |
|||||
|
#include "qt_frontend_util.h"
|
||||
|
|
||||
|
namespace QtCommon::Frontend { |
||||
|
QMessageBox::StandardButton ShowMessage(QMessageBox::Icon icon, |
||||
|
const QString &title, |
||||
|
const QString &text, |
||||
|
QMessageBox::StandardButtons buttons, |
||||
|
QWidget *parent) |
||||
|
{ |
||||
|
#ifdef YUZU_QT_WIDGETS
|
||||
|
QMessageBox *box = new QMessageBox(icon, title, text, buttons, parent); |
||||
|
return static_cast<QMessageBox::StandardButton>(box->exec()); |
||||
|
#endif
|
||||
|
} |
||||
|
|
||||
|
QMessageBox::StandardButton ShowMessage(QMessageBox::Icon icon, |
||||
|
const char *title, |
||||
|
const char *text, |
||||
|
QMessageBox::StandardButtons buttons, |
||||
|
QWidget *parent) |
||||
|
{ |
||||
|
return ShowMessage(icon, qApp->tr(title), qApp->tr(text), buttons, parent); |
||||
|
} |
||||
|
|
||||
|
} // namespace QtCommon::Frontend
|
||||
@ -0,0 +1,29 @@ |
|||||
|
#ifndef QT_FRONTEND_UTIL_H |
||||
|
#define QT_FRONTEND_UTIL_H |
||||
|
|
||||
|
#include <QGuiApplication> |
||||
|
#include <QMessageBox> |
||||
|
|
||||
|
#ifdef YUZU_QT_WIDGETS |
||||
|
#include <QWidget> |
||||
|
#endif |
||||
|
|
||||
|
/** |
||||
|
* manages common functionality e.g. message boxes and such for Qt/QML |
||||
|
*/ |
||||
|
namespace QtCommon::Frontend { |
||||
|
Q_NAMESPACE |
||||
|
|
||||
|
QMessageBox::StandardButton ShowMessage(QMessageBox::Icon icon, |
||||
|
const QString &title, |
||||
|
const QString &text, |
||||
|
QMessageBox::StandardButtons buttons = QMessageBox::NoButton, |
||||
|
QWidget *parent = nullptr); |
||||
|
|
||||
|
QMessageBox::StandardButton ShowMessage(QMessageBox::Icon icon, |
||||
|
const char *title, |
||||
|
const char *text, |
||||
|
QMessageBox::StandardButtons buttons = QMessageBox::NoButton, |
||||
|
QWidget *parent = nullptr); |
||||
|
} // namespace QtCommon::Frontend |
||||
|
#endif // QT_FRONTEND_UTIL_H |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue