diff --git a/lang/german.ts b/lang/german.ts index 67e40fad..d8cf2e20 100644 --- a/lang/german.ts +++ b/lang/german.ts @@ -1,11 +1,97 @@ + - QPushButton + MainWnd - - Hello World! - Hallo Welt! + + VBA-M + + + + + &File + &Datei + + + + &Settings + &Einstellungen + + + + &Tools + &Werkzeuge + + + + &Help + &Hilfe + + + + About &OpenGL... + Über &OpenGL... + + + + About &VBA-M... + Über &VBA-M... + + + + About &Qt... + Über &Qt... + + + + This program is licensed under terms of the GNU General Public License. + Dieses Programm ist unter den Bedingungen der GNU General Public License lizenziert. + + + + OpenGL version 2.1 is present. + OpenGL Version 2.1 ist verfügbar. + + + + OpenGL version 2.0 is present. + OpenGL Version 2.0 ist verfügbar. + + + + OpenGL version 1.5 is present. + OpenGL Version 1.5 ist verfügbar. + + + + OpenGL version 1.4 is present. + OpenGL Version 1.4 ist verfügbar. + + + + OpenGL version 1.3 is present. + OpenGL Version 1.3 ist verfügbar. + + + + OpenGL version 1.2 is present. + OpenGL Version 1.2 ist verfügbar. + + + + OpenGL version 1.1 is present. + OpenGL Version 1.1 ist verfügbar. + + + + OpenGL is NOT available! + OpenGL ist NICHT verfügbar! + + + + OpenGL + diff --git a/project/qmake/vba-m.pro b/project/qmake/vba-m.pro index fbf782cc..6d490741 100644 --- a/project/qmake/vba-m.pro +++ b/project/qmake/vba-m.pro @@ -1,6 +1,17 @@ TEMPLATE = app CONFIG += qt +QT += opengl TARGET = VisualBoyAdvance + +PRECOMPILED_HEADER = ../../src/qt/precompile.h + HEADERS += ../../src/qt/main.h SOURCES += ../../src/qt/main.cpp + +HEADERS += ../../src/qt/mainwnd.h +SOURCES += ../../src/qt/mainwnd.cpp + +HEADERS += ../../src/qt/glwidget.h +SOURCES += ../../src/qt/glwidget.cpp + TRANSLATIONS += ../../lang/german.ts diff --git a/project/vc2008/vba-m.vcproj b/project/vc2008/vba-m.vcproj index 927c6a30..f01657a0 100644 --- a/project/vc2008/vba-m.vcproj +++ b/project/vc2008/vba-m.vcproj @@ -24,10 +24,10 @@ > + + + + + + + + + + + + + + + + diff --git a/src/qt/MainWnd.cpp b/src/qt/MainWnd.cpp new file mode 100644 index 00000000..b9c35846 --- /dev/null +++ b/src/qt/MainWnd.cpp @@ -0,0 +1,117 @@ +// VBA-M, A Nintendo Handheld Console Emulator +// Copyright (C) 2008 VBA-M development team +// +// This program 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 Foundation; either version 2, or(at your option) +// any later version. +// +// This program 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 this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#include "mainwnd.h" + +#include "glwidget.h" + +MainWnd::MainWnd( QWidget *parent ) + : QMainWindow( parent ) +{ + createDisplay(); + + setMinimumSize( 320, 240 ); + setWindowTitle( tr( "VBA-M" ) ); + + createMenus(); +} + +MainWnd::~MainWnd() +{ +} + +void MainWnd::createMenus() +{ + QMenu *fileMenu = menuBar()->addMenu( tr( "&File" ) ); + QMenu *settingsMenu = menuBar()->addMenu( tr( "&Settings" ) ); + QMenu *toolsMenu = menuBar()->addMenu( tr( "&Tools" ) ); + QMenu *helpMenu = menuBar()->addMenu( tr( "&Help" ) ); + + QAction *showAboutOpenGLAct = new QAction( tr( "About &OpenGL..." ), this ); + connect( showAboutOpenGLAct, SIGNAL( triggered() ), this, SLOT( showAboutOpenGL() ) ); + helpMenu->addAction( showAboutOpenGLAct ); + + QAction *showAboutAct = new QAction( tr( "About &VBA-M..." ), this ); + connect( showAboutAct, SIGNAL( triggered() ), this, SLOT( showAbout() ) ); + helpMenu->addAction( showAboutAct ); + + QAction *showAboutQtAct = new QAction( tr( "About &Qt..." ), this ); + connect( showAboutQtAct, SIGNAL( triggered() ), this, SLOT( showAboutQt() ) ); + helpMenu->addAction( showAboutQtAct ); +} + +bool MainWnd::createDisplay() +{ + if( !QGLFormat::hasOpenGL() ) return false; + + GLWidget *ogl = new GLWidget( this ); + if( ogl->isValid() ) { + setCentralWidget( ogl ); + return true; + } + + return false; +} + +void MainWnd::showAbout() +{ + QMessageBox::about( this, tr( "VBA-M" ), + tr( "This program is licensed under terms of the GNU General Public License." ) ); +} + +void MainWnd::showAboutQt() +{ + QMessageBox::aboutQt( this ); +} + +void MainWnd::showAboutOpenGL() +{ + QString info; + if( QGLFormat::hasOpenGL() ) { + QGLFormat::OpenGLVersionFlags flags = QGLFormat::openGLVersionFlags(); + if( flags & QGLFormat::OpenGL_Version_2_1 ) { + info = tr( "OpenGL version 2.1 is present." ); + } else + if( flags & QGLFormat::OpenGL_Version_2_0 ) { + info = tr( "OpenGL version 2.0 is present." ); + } else + if( flags & QGLFormat::OpenGL_Version_1_5 ) { + info = tr( "OpenGL version 1.5 is present." ); + } else + if( flags & QGLFormat::OpenGL_Version_1_4 ) { + info = tr( "OpenGL version 1.4 is present." ); + } else + if( flags & QGLFormat::OpenGL_Version_1_3 ) { + info = tr( "OpenGL version 1.3 is present." ); + } else + if( flags & QGLFormat::OpenGL_Version_1_2 ) { + info = tr( "OpenGL version 1.2 is present." ); + } else + if( flags & QGLFormat::OpenGL_Version_1_1 ) { + info = tr( "OpenGL version 1.1 is present." ); + } else + if( flags & QGLFormat::OpenGL_Version_None ) { + info = tr( "OpenGL is NOT available!" ); + } + } else { + info = tr( "OpenGL is NOT available!" ); + } + + QMessageBox *test = new QMessageBox( QMessageBox::NoIcon, tr( "OpenGL" ), info, QMessageBox::NoButton, this ); + test->show(); +} diff --git a/src/qt/MainWnd.h b/src/qt/MainWnd.h new file mode 100644 index 00000000..cbbd102f --- /dev/null +++ b/src/qt/MainWnd.h @@ -0,0 +1,42 @@ +// VBA-M, A Nintendo Handheld Console Emulator +// Copyright (C) 2008 VBA-M development team +// +// This program 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 Foundation; either version 2, or(at your option) +// any later version. +// +// This program 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 this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#ifndef MAINWND_H +#define MAINWND_H + +#include "precompile.h" + +class MainWnd : public QMainWindow +{ + Q_OBJECT + +public: + MainWnd::MainWnd( QWidget *parent = 0 ); + MainWnd::~MainWnd(); + +private: + void createMenus(); + bool createDisplay(); + +private slots: + void showAbout(); + void showAboutQt(); + void showAboutOpenGL(); +}; + +#endif // #ifndef MAINWND_H diff --git a/src/qt/glwidget.cpp b/src/qt/glwidget.cpp new file mode 100644 index 00000000..9d5c6a71 --- /dev/null +++ b/src/qt/glwidget.cpp @@ -0,0 +1,42 @@ +// VBA-M, A Nintendo Handheld Console Emulator +// Copyright (C) 2008 VBA-M development team +// +// This program 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 Foundation; either version 2, or(at your option) +// any later version. +// +// This program 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 this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#include "glwidget.h" + +GLWidget::GLWidget( QWidget *parent ) + : QGLWidget( parent ) +{ +} + +GLWidget::~GLWidget() +{ +} + +void GLWidget::initializeGL() +{ + qglClearColor( QColor( 0xFF, 0x00, 0xFF ) ); +} + +void GLWidget::paintGL() +{ + glClear( GL_COLOR_BUFFER_BIT ); +} + +void GLWidget::resizeGL( int width, int height ) +{ +} diff --git a/src/qt/glwidget.h b/src/qt/glwidget.h new file mode 100644 index 00000000..40fa3735 --- /dev/null +++ b/src/qt/glwidget.h @@ -0,0 +1,38 @@ +// VBA-M, A Nintendo Handheld Console Emulator +// Copyright (C) 2008 VBA-M development team +// +// This program 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 Foundation; either version 2, or(at your option) +// any later version. +// +// This program 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 this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#ifndef GL_WIDGET_H +#define GL_WIDGET_H + +#include "precompile.h" + +class GLWidget : public QGLWidget +{ + Q_OBJECT + +public: + GLWidget( QWidget *parent = 0 ); + ~GLWidget(); + +protected: + void initializeGL(); + void paintGL(); + void resizeGL( int width, int height ); +}; + +#endif // #ifndef GL_WIDGET_H diff --git a/src/qt/main.cpp b/src/qt/main.cpp index f3fca835..dfaba417 100644 --- a/src/qt/main.cpp +++ b/src/qt/main.cpp @@ -1,9 +1,24 @@ +// VBA-M, A Nintendo Handheld Console Emulator +// Copyright (C) 2008 VBA-M development team +// +// This program 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 Foundation; either version 2, or(at your option) +// any later version. +// +// This program 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 this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + #include "main.h" -#include -#include -#include - +#include "mainwnd.h" int main( int argc, char *argv[] ) { @@ -13,9 +28,8 @@ int main( int argc, char *argv[] ) translator.load( "lang/german" ); theApp.installTranslator( &translator ); - QPushButton hello( QPushButton::tr( "Hello World!" ) ); - hello.resize( 192, 48 ); - hello.show(); + MainWnd *mainWnd = new MainWnd(); + mainWnd->show(); return theApp.exec(); } diff --git a/src/qt/main.h b/src/qt/main.h index e843aa43..2240d428 100644 --- a/src/qt/main.h +++ b/src/qt/main.h @@ -1,6 +1,24 @@ +// VBA-M, A Nintendo Handheld Console Emulator +// Copyright (C) 2008 VBA-M development team +// +// This program 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 Foundation; either version 2, or(at your option) +// any later version. +// +// This program 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 this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + #ifndef MAIN_H #define MAIN_H - +#include "precompile.h" #endif // #ifndef MAIN_H diff --git a/src/qt/precompile.h b/src/qt/precompile.h new file mode 100644 index 00000000..fd1ea579 --- /dev/null +++ b/src/qt/precompile.h @@ -0,0 +1,28 @@ +// VBA-M, A Nintendo Handheld Console Emulator +// Copyright (C) 2008 VBA-M development team +// +// This program 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 Foundation; either version 2, or(at your option) +// any later version. +// +// This program 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 this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#ifndef PRECOMPILE_H +#define PRECOMPILE_H + +#if defined __cplusplus +// Add C++ includes here +#include +#include +#endif + +#endif // #ifndef PRECOMPILE_H