aboutsummaryrefslogtreecommitdiff
path: root/src/qt_common/abstract/frontend.cpp
blob: 2ed76f8ea942ed4811dcaf0de9598b17d288fef6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later

#include "frontend.h"
#include "qt_common/qt_common.h"

#ifdef YUZU_QT_WIDGETS
#include <QFileDialog>
#endif

namespace QtCommon::Frontend {

StandardButton ShowMessage(
    Icon icon, const QString &title, const QString &text, StandardButtons buttons, QObject *parent)
{
#ifdef YUZU_QT_WIDGETS
    QMessageBox *box = new QMessageBox(icon, title, text, buttons, (QWidget *) parent);
    return static_cast<QMessageBox::StandardButton>(box->exec());
#endif
    // TODO(crueter): If Qt Widgets is disabled...
    // need a way to reference icon/buttons too
}

const QString GetOpenFileName(const QString &title,
                              const QString &dir,
                              const QString &filter,
                              QString *selectedFilter,
                              Options options)
{
#ifdef YUZU_QT_WIDGETS
    return QFileDialog::getOpenFileName((QWidget *) rootObject, title, dir, filter, selectedFilter, options);
#endif
}

const QString GetSaveFileName(const QString &title,
                              const QString &dir,
                              const QString &filter,
                              QString *selectedFilter,
                              Options options)
{
#ifdef YUZU_QT_WIDGETS
    return QFileDialog::getSaveFileName((QWidget *) rootObject, title, dir, filter, selectedFilter, options);
#endif
}

} // namespace QtCommon::Frontend