Ditch uic

This commit is contained in:
Jeffrey Pfau 2014-01-29 22:23:34 -08:00
parent 3d339b1327
commit a076e88bb5
4 changed files with 14 additions and 86 deletions

View File

@ -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})

View File

@ -2,15 +2,14 @@
#include <QFileDialog>
#include <QKeyEvent>
extern "C" {
#include "gba.h"
}
#include <QKeySequence>
#include <QMenuBar>
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);
}

View File

@ -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;
};

View File

@ -1,73 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>GBAWindow</class>
<widget class="QMainWindow" name="GBAWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>240</width>
<height>160</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Ignored">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="baseSize">
<size>
<width>240</width>
<height>160</height>
</size>
</property>
<property name="windowTitle">
<string>GBA</string>
</property>
<widget class="QWidget" name="centralwidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Ignored">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="baseSize">
<size>
<width>240</width>
<height>160</height>
</size>
</property>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>240</width>
<height>22</height>
</rect>
</property>
<property name="defaultUp">
<bool>false</bool>
</property>
<widget class="QMenu" name="menuFile">
<property name="title">
<string>File</string>
</property>
<addaction name="actionOpen"/>
</widget>
<addaction name="menuFile"/>
</widget>
<action name="actionOpen">
<property name="text">
<string>Open</string>
</property>
<property name="shortcut">
<string>Ctrl+O</string>
</property>
</action>
</widget>
<resources/>
<connections/>
</ui>