diff --git a/src/platform/qt/CMakeLists.txt b/src/platform/qt/CMakeLists.txt index 1798d6295..154c79764 100644 --- a/src/platform/qt/CMakeLists.txt +++ b/src/platform/qt/CMakeLists.txt @@ -13,12 +13,9 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) find_package(Qt5Widgets REQUIRED) -set(UI_FILES Window.ui) set(SOURCE_FILES AudioDevice.cpp Display.cpp GameController.cpp Window.cpp) -qt5_wrap_ui(UI_HEADERS ${UI_FILES}) - -add_executable(QGBAc WIN32 MACOSX_BUNDLE ${UI_FILES} ${UI_HEADERS} main.cpp ${SOURCE_FILES}) +add_executable(QGBAc WIN32 MACOSX_BUNDLE main.cpp ${SOURCE_FILES}) qt5_use_modules(QGBAc Widgets Multimedia OpenGL) target_link_libraries(QGBAc ${OPENGL_LIBRARY} ${BINARY_NAME}) diff --git a/src/platform/qt/Window.cpp b/src/platform/qt/Window.cpp index 5bf0b12a9..3438fd71d 100644 --- a/src/platform/qt/Window.cpp +++ b/src/platform/qt/Window.cpp @@ -2,15 +2,14 @@ #include #include - -extern "C" { -#include "gba.h" -} +#include +#include using namespace QGBA; Window::Window(QWidget* parent) : QMainWindow(parent) { - setupUi(this); + setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + setMinimumSize(240, 160); m_controller = new GameController(this); m_display = new Display(this); @@ -18,7 +17,7 @@ Window::Window(QWidget* parent) : QMainWindow(parent) { connect(m_controller, SIGNAL(frameAvailable(const QImage&)), m_display, SLOT(draw(const QImage&))); connect(m_controller, SIGNAL(audioDeviceAvailable(GBAAudio*)), this, SLOT(setupAudio(GBAAudio*))); - connect(actionOpen, SIGNAL(triggered()), this, SLOT(selectROM())); + setupMenu(menuBar()); } GBAKey Window::mapKey(int qtKey) { @@ -98,3 +97,9 @@ void Window::setupAudio(GBAAudio* audio) { thread->setInput(audio); thread->start(QThread::HighPriority); } + +void Window::setupMenu(QMenuBar* menubar) { + menubar->clear(); + QMenu* fileMenu = menubar->addMenu(tr("&File")); + fileMenu->addAction(tr("Load &ROM"), this, SLOT(selectROM()), QKeySequence::Open); +} diff --git a/src/platform/qt/Window.h b/src/platform/qt/Window.h index c0cc195cb..5888c10d6 100644 --- a/src/platform/qt/Window.h +++ b/src/platform/qt/Window.h @@ -11,11 +11,9 @@ extern "C" { #include "GameController.h" #include "Display.h" -#include "ui_Window.h" - namespace QGBA { -class Window : public QMainWindow, Ui::GBAWindow { +class Window : public QMainWindow { Q_OBJECT public: @@ -33,6 +31,7 @@ private slots: void setupAudio(GBAAudio*); private: + void setupMenu(QMenuBar*); GameController* m_controller; Display* m_display; }; diff --git a/src/platform/qt/Window.ui b/src/platform/qt/Window.ui deleted file mode 100644 index f25f2e996..000000000 --- a/src/platform/qt/Window.ui +++ /dev/null @@ -1,73 +0,0 @@ - - - GBAWindow - - - - 0 - 0 - 240 - 160 - - - - - 0 - 0 - - - - - 240 - 160 - - - - GBA - - - - - 0 - 0 - - - - - 240 - 160 - - - - - - - 0 - 0 - 240 - 22 - - - - false - - - - File - - - - - - - - Open - - - Ctrl+O - - - - - -