(Qt) Combine all Qt files into one (ui_qt.cpp)

This commit is contained in:
twinaphex 2021-03-08 00:56:55 +01:00
parent ea3e9ee1c6
commit b83596fcd4
8 changed files with 3443 additions and 3582 deletions

View File

@ -487,11 +487,7 @@ endif
ifeq ($(HAVE_QT), 1)
OBJ += ui/drivers/ui_qt.o \
ui/drivers/qt/ui_qt_application.o \
ui/drivers/qt/ui_qt_window.o \
ui/drivers/qt/ui_qt_browser_window.o \
ui/drivers/qt/ui_qt_load_core_window.o \
ui/drivers/qt/ui_qt_msg_window.o \
ui/drivers/qt/gridview.o \
ui/drivers/qt/coreoptionsdialog.o \
ui/drivers/qt/filedropwidget.o \

View File

@ -51,11 +51,7 @@ UI
#include "../ui/drivers/ui_qt.cpp"
#include "../ui/drivers/qt/ui_qt_window.cpp"
#include "../ui/drivers/qt/ui_qt_load_core_window.cpp"
#include "../ui/drivers/qt/ui_qt_browser_window.cpp"
#include "../ui/drivers/qt/ui_qt_msg_window.cpp"
#include "../ui/drivers/qt/ui_qt_application.cpp"
#include "../ui/drivers/qt/gridview.cpp"
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL)
#include "../ui/drivers/qt/shaderparamsdialog.cpp"

View File

@ -1,162 +0,0 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2011-2017 - Daniel De Matteis
* Copyright (C) 2016-2019 - Brad Parker
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <QApplication>
#include <QAbstractEventDispatcher>
#ifndef CXX_BUILD
extern "C" {
#endif
#include "../../ui_companion_driver.h"
#include "../../../retroarch.h"
#include "../../../verbosity.h"
#include "../../../version.h"
#include "../../../frontend/frontend.h"
#include "../../../tasks/tasks_internal.h"
#include <retro_timers.h>
#ifdef Q_OS_UNIX
#include <locale.h>
#endif
#ifndef CXX_BUILD
}
#endif
#include "../ui_qt.h"
static AppHandler *app_handler;
static ui_application_qt_t ui_application;
/* ARGB 16x16 */
static const unsigned retroarch_qt_icon_data[] = {
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0x00000000,0x00000000,0x00000000,
0x00000000,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0x00000000,0x00000000,
0x00000000,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0x00000000,0x00000000,
0x00000000,0xff333333,0xff333333,0xff333333,0xfff2f2f2,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xfff2f2f2,0xff333333,0xff333333,0xff333333,0x00000000,0x00000000,
0x00000000,0xff333333,0xfff2f2f2,0xff333333,0xff333333,0xfff2f2f2,0xff333333,0xff333333,0xff333333,0xfff2f2f2,0xff333333,0xff333333,0xfff2f2f2,0xff333333,0x00000000,0x00000000,
0x00000000,0xff333333,0xfff2f2f2,0xff333333,0xfff2f2f2,0xfff2f2f2,0xfff2f2f2,0xfff2f2f2,0xfff2f2f2,0xfff2f2f2,0xfff2f2f2,0xff333333,0xfff2f2f2,0xff333333,0x00000000,0x00000000,
0x00000000,0xff333333,0xfff2f2f2,0xfff2f2f2,0xfff2f2f2,0xff333333,0xfff2f2f2,0xfff2f2f2,0xfff2f2f2,0xff333333,0xfff2f2f2,0xfff2f2f2,0xfff2f2f2,0xff333333,0x00000000,0x00000000,
0x00000000,0xff333333,0xfff2f2f2,0xfff2f2f2,0xfff2f2f2,0xfff2f2f2,0xfff2f2f2,0xfff2f2f2,0xfff2f2f2,0xfff2f2f2,0xfff2f2f2,0xfff2f2f2,0xfff2f2f2,0xff333333,0x00000000,0x00000000,
0x00000000,0xff333333,0xff333333,0xfff2f2f2,0xfff2f2f2,0xfff2f2f2,0xfff2f2f2,0xfff2f2f2,0xfff2f2f2,0xfff2f2f2,0xfff2f2f2,0xfff2f2f2,0xff333333,0xff333333,0x00000000,0x00000000,
0x00000000,0xff333333,0xff333333,0xff333333,0xfff2f2f2,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xfff2f2f2,0xff333333,0xff333333,0xff333333,0x00000000,0x00000000,
0x00000000,0xff333333,0xff333333,0xfff2f2f2,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xfff2f2f2,0xff333333,0xff333333,0x00000000,0x00000000,
0x00000000,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0x00000000,0x00000000,
0x00000000,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0x00000000,0x00000000,
0x00000000,0x00000000,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0xff333333,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000
};
AppHandler::AppHandler(QObject *parent) :
QObject(parent)
{
}
AppHandler::~AppHandler()
{
}
void AppHandler::exit()
{
ui_application_qt.exiting = true;
if (qApp)
qApp->closeAllWindows();
}
bool AppHandler::isExiting() const
{
return ui_application_qt.exiting;
}
void AppHandler::onLastWindowClosed()
{
}
static void* ui_application_qt_initialize(void)
{
/* These must last for the lifetime of the QApplication */
static int app_argc = 1;
static char app_name[] = "retroarch";
static char *app_argv[] = { app_name, NULL };
app_handler = new AppHandler();
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
/* HiDpi supported since Qt 5.6 */
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#endif
/* Create QApplication() before calling QApplication::setStyle()
* to ensure that plugin path is determined correctly */
ui_application.app = new QApplication(app_argc, app_argv);
QApplication::setStyle("fusion");
ui_application.app->setOrganizationName("libretro");
ui_application.app->setApplicationName("RetroArch");
ui_application.app->setApplicationVersion(PACKAGE_VERSION);
ui_application.app->connect(ui_application.app, SIGNAL(lastWindowClosed()),
app_handler, SLOT(onLastWindowClosed()));
#ifdef Q_OS_UNIX
setlocale(LC_NUMERIC, "C");
#endif
{
/* Can't declare the pixmap at the top, because: "QPixmap: Must construct a QGuiApplication before a QPixmap" */
QImage iconImage(16, 16, QImage::Format_ARGB32);
QPixmap iconPixmap;
unsigned char *bits = iconImage.bits();
memcpy(bits, retroarch_qt_icon_data, 16 * 16 * sizeof(unsigned));
iconPixmap = QPixmap::fromImage(iconImage);
ui_application.app->setWindowIcon(QIcon(iconPixmap));
}
return &ui_application;
}
static void ui_application_qt_process_events(void)
{
QAbstractEventDispatcher *dispatcher = QApplication::eventDispatcher();
if (dispatcher && dispatcher->hasPendingEvents())
QApplication::processEvents();
}
static void ui_application_qt_quit(void)
{
if (app_handler)
app_handler->exit();
}
#ifdef HAVE_MAIN
#if defined(__cplusplus) && !defined(CXX_BUILD)
extern "C"
#endif
int main(int argc, char *argv[])
{
return rarch_main(argc, argv, NULL);
}
#endif
ui_application_t ui_application_qt = {
ui_application_qt_initialize,
ui_application_qt_process_events,
ui_application_qt_quit,
false,
"qt"
};

View File

@ -1,42 +0,0 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2011-2017 - Daniel De Matteis
* Copyright (C) 2016-2019 - Brad Parker
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdint.h>
#include <boolean.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <QtWidgets/QFileDialog>
#include <QtCore/QString>
#include "../../ui_companion_driver.h"
static bool ui_browser_window_qt_open(ui_browser_window_state_t *state)
{
return true;
}
static bool ui_browser_window_qt_save(ui_browser_window_state_t *state)
{
return false;
}
ui_browser_window_t ui_browser_window_qt = {
ui_browser_window_qt_open,
ui_browser_window_qt_save,
"qt"
};

View File

@ -1,109 +0,0 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2011-2017 - Daniel De Matteis
* Copyright (C) 2016-2019 - Brad Parker
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdint.h>
#include <boolean.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <QtWidgets/QMessageBox>
#include "../../ui_companion_driver.h"
static enum ui_msg_window_response ui_msg_window_qt_response(ui_msg_window_state *state, QMessageBox::StandardButtons response)
{
switch (response)
{
case QMessageBox::Ok:
return UI_MSG_RESPONSE_OK;
case QMessageBox::Cancel:
return UI_MSG_RESPONSE_CANCEL;
case QMessageBox::Yes:
return UI_MSG_RESPONSE_YES;
case QMessageBox::No:
return UI_MSG_RESPONSE_NO;
default:
break;
}
switch (state->buttons)
{
case UI_MSG_WINDOW_OK:
return UI_MSG_RESPONSE_OK;
case UI_MSG_WINDOW_OKCANCEL:
return UI_MSG_RESPONSE_CANCEL;
case UI_MSG_WINDOW_YESNO:
return UI_MSG_RESPONSE_NO;
case UI_MSG_WINDOW_YESNOCANCEL:
return UI_MSG_RESPONSE_CANCEL;
default:
break;
}
return UI_MSG_RESPONSE_NA;
}
static QFlags<QMessageBox::StandardButton>
ui_msg_window_qt_buttons(ui_msg_window_state *state)
{
switch (state->buttons)
{
case UI_MSG_WINDOW_OK:
return QMessageBox::Ok;
case UI_MSG_WINDOW_OKCANCEL:
return QMessageBox::Cancel;
case UI_MSG_WINDOW_YESNO:
return (QMessageBox::Yes | QMessageBox::No);
case UI_MSG_WINDOW_YESNOCANCEL:
return (QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
}
return QMessageBox::NoButton;
}
static enum ui_msg_window_response
ui_msg_window_qt_error(ui_msg_window_state *state)
{
QFlags<QMessageBox::StandardButton> flags = ui_msg_window_qt_buttons(state);
return ui_msg_window_qt_response(state, QMessageBox::critical((QWidget*)state->window, state->title, state->text, flags));
}
static enum ui_msg_window_response ui_msg_window_qt_information(ui_msg_window_state *state)
{
QFlags<QMessageBox::StandardButton> flags = ui_msg_window_qt_buttons(state);
return ui_msg_window_qt_response(state, QMessageBox::information((QWidget*)state->window, state->title, state->text, flags));
}
static enum ui_msg_window_response ui_msg_window_qt_question(ui_msg_window_state *state)
{
QFlags<QMessageBox::StandardButton> flags = ui_msg_window_qt_buttons(state);
return ui_msg_window_qt_response(state, QMessageBox::question((QWidget*)state->window, state->title, state->text, flags));
}
static enum ui_msg_window_response ui_msg_window_qt_warning(ui_msg_window_state *state)
{
QFlags<QMessageBox::StandardButton> flags = ui_msg_window_qt_buttons(state);
return ui_msg_window_qt_response(state, QMessageBox::warning((QWidget*)state->window, state->title, state->text, flags));
}
ui_msg_window_t ui_msg_window_qt = {
ui_msg_window_qt_error,
ui_msg_window_qt_information,
ui_msg_window_qt_question,
ui_msg_window_qt_warning,
"qt"
};

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -144,11 +144,6 @@ typedef struct ui_companion_driver
const char *ident;
} ui_companion_driver_t;
extern ui_browser_window_t ui_browser_window_qt;
extern ui_msg_window_t ui_msg_window_qt;
extern ui_window_t ui_window_qt;
extern ui_application_t ui_application_qt;
extern ui_companion_driver_t ui_companion_cocoa;
extern ui_companion_driver_t ui_companion_cocoatouch;
extern ui_companion_driver_t ui_companion_qt;