better handling for sys/vfs/rootobject
Signed-off-by: crueter <crueter@eden-emu.dev>
This commit is contained in:
parent
4356e80e50
commit
c65f075638
15 changed files with 286 additions and 291 deletions
|
@ -6,8 +6,10 @@
|
|||
|
||||
#include <QGuiApplication>
|
||||
#include <QMessageBox>
|
||||
#include "qt_common/qt_common.h"
|
||||
|
||||
#ifdef YUZU_QT_WIDGETS
|
||||
#include <QFileDialog>
|
||||
#include <QWidget>
|
||||
#endif
|
||||
|
||||
|
@ -15,8 +17,27 @@
|
|||
* manages common functionality e.g. message boxes and such for Qt/QML
|
||||
*/
|
||||
namespace QtCommon::Frontend {
|
||||
|
||||
Q_NAMESPACE
|
||||
|
||||
#ifdef YUZU_QT_WIDGETS
|
||||
using Options = QFileDialog::Options;
|
||||
using Option = QFileDialog::Option;
|
||||
#else
|
||||
enum Option {
|
||||
ShowDirsOnly = 0x00000001,
|
||||
DontResolveSymlinks = 0x00000002,
|
||||
DontConfirmOverwrite = 0x00000004,
|
||||
DontUseNativeDialog = 0x00000008,
|
||||
ReadOnly = 0x00000010,
|
||||
HideNameFilterDetails = 0x00000020,
|
||||
DontUseCustomDirectoryIcons = 0x00000040
|
||||
};
|
||||
Q_ENUM_NS(Option)
|
||||
Q_DECLARE_FLAGS(Options, Option)
|
||||
Q_FLAG_NS(Options)
|
||||
#endif
|
||||
|
||||
// TODO(crueter) widgets-less impl, choices et al.
|
||||
QMessageBox::StandardButton ShowMessage(QMessageBox::Icon icon,
|
||||
const QString &title,
|
||||
|
@ -24,45 +45,47 @@ QMessageBox::StandardButton ShowMessage(QMessageBox::Icon icon,
|
|||
QMessageBox::StandardButtons buttons = QMessageBox::NoButton,
|
||||
QObject *parent = nullptr);
|
||||
|
||||
QMessageBox::StandardButton Information(QObject *parent,
|
||||
const QString &title,
|
||||
const QString &text,
|
||||
QMessageBox::StandardButtons buttons = QMessageBox::Ok);
|
||||
#define UTIL_OVERRIDES(level) \
|
||||
inline QMessageBox::StandardButton level(QObject *parent, \
|
||||
const QString &title, \
|
||||
const QString &text, \
|
||||
QMessageBox::StandardButtons buttons = QMessageBox::Ok) \
|
||||
{ \
|
||||
return ShowMessage(QMessageBox::level, title, text, buttons, parent); \
|
||||
} \
|
||||
inline QMessageBox::StandardButton level(QObject *parent, \
|
||||
const char *title, \
|
||||
const char *text, \
|
||||
QMessageBox::StandardButtons buttons \
|
||||
= QMessageBox::Ok) \
|
||||
{ \
|
||||
return ShowMessage(QMessageBox::level, tr(title), tr(text), buttons, parent); \
|
||||
} \
|
||||
inline QMessageBox::StandardButton level(const char *title, \
|
||||
const char *text, \
|
||||
QMessageBox::StandardButtons buttons \
|
||||
= QMessageBox::Ok) \
|
||||
{ \
|
||||
return ShowMessage(QMessageBox::level, tr(title), tr(text), buttons, rootObject); \
|
||||
} \
|
||||
inline QMessageBox::StandardButton level(const QString title, \
|
||||
const QString &text, \
|
||||
QMessageBox::StandardButtons buttons \
|
||||
= QMessageBox::Ok) \
|
||||
{ \
|
||||
return ShowMessage(QMessageBox::level, title, text, buttons, rootObject); \
|
||||
}
|
||||
|
||||
QMessageBox::StandardButton Warning(QObject *parent,
|
||||
const QString &title,
|
||||
const QString &text,
|
||||
QMessageBox::StandardButtons buttons = QMessageBox::Ok);
|
||||
UTIL_OVERRIDES(Information)
|
||||
UTIL_OVERRIDES(Warning)
|
||||
UTIL_OVERRIDES(Critical)
|
||||
UTIL_OVERRIDES(Question)
|
||||
|
||||
QMessageBox::StandardButton Critical(QObject *parent,
|
||||
const QString &title,
|
||||
const QString &text,
|
||||
QMessageBox::StandardButtons buttons = QMessageBox::Ok);
|
||||
|
||||
QMessageBox::StandardButton Question(QObject *parent,
|
||||
const QString &title,
|
||||
const QString &text,
|
||||
QMessageBox::StandardButtons buttons = QMessageBox::Ok);
|
||||
|
||||
QMessageBox::StandardButton Information(QObject *parent,
|
||||
const char *title,
|
||||
const char *text,
|
||||
QMessageBox::StandardButtons buttons = QMessageBox::Ok);
|
||||
|
||||
QMessageBox::StandardButton Warning(QObject *parent,
|
||||
const char *title,
|
||||
const char *text,
|
||||
QMessageBox::StandardButtons buttons = QMessageBox::Ok);
|
||||
|
||||
QMessageBox::StandardButton Critical(QObject *parent,
|
||||
const char *title,
|
||||
const char *text,
|
||||
QMessageBox::StandardButtons buttons = QMessageBox::Ok);
|
||||
|
||||
QMessageBox::StandardButton Question(QObject *parent,
|
||||
const char *title,
|
||||
const char *text,
|
||||
QMessageBox::StandardButtons buttons = QMessageBox::Ok);
|
||||
const QString GetOpenFileName(const QString &title,
|
||||
const QString &dir,
|
||||
const QString &filter,
|
||||
QString *selectedFilter = nullptr,
|
||||
Options options = Options());
|
||||
|
||||
} // namespace QtCommon::Frontend
|
||||
#endif // QT_FRONTEND_UTIL_H
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue