USE precompiled header
ADDED basic menu
ADDED OpenGL frame
ADDED german translation
This commit is contained in:
spacy51 2008-02-09 17:16:37 +00:00
parent 4a61da3136
commit 3d2fe9980f
10 changed files with 444 additions and 15 deletions

View File

@ -1,11 +1,97 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS><TS version="1.1" language="de_DE">
<defaultcodec></defaultcodec>
<context>
<name>QPushButton</name>
<name>MainWnd</name>
<message>
<location filename="../src/qt/main.cpp" line="16"/>
<source>Hello World!</source>
<translation>Hallo Welt!</translation>
<location filename="../src/qt/mainwnd.cpp" line="73"/>
<source>VBA-M</source>
<translation></translation>
</message>
<message>
<location filename="../src/qt/mainwnd.cpp" line="40"/>
<source>&amp;File</source>
<translation>&amp;Datei</translation>
</message>
<message>
<location filename="../src/qt/mainwnd.cpp" line="41"/>
<source>&amp;Settings</source>
<translation>&amp;Einstellungen</translation>
</message>
<message>
<location filename="../src/qt/mainwnd.cpp" line="42"/>
<source>&amp;Tools</source>
<translation>&amp;Werkzeuge</translation>
</message>
<message>
<location filename="../src/qt/mainwnd.cpp" line="43"/>
<source>&amp;Help</source>
<translation>&amp;Hilfe</translation>
</message>
<message>
<location filename="../src/qt/mainwnd.cpp" line="45"/>
<source>About &amp;OpenGL...</source>
<translation>Über &amp;OpenGL...</translation>
</message>
<message>
<location filename="../src/qt/mainwnd.cpp" line="49"/>
<source>About &amp;VBA-M...</source>
<translation>Über &amp;VBA-M...</translation>
</message>
<message>
<location filename="../src/qt/mainwnd.cpp" line="53"/>
<source>About &amp;Qt...</source>
<translation>Über &amp;Qt...</translation>
</message>
<message>
<location filename="../src/qt/mainwnd.cpp" line="74"/>
<source>This program is licensed under terms of the GNU General Public License.</source>
<translation>Dieses Programm ist unter den Bedingungen der GNU General Public License lizenziert.</translation>
</message>
<message>
<location filename="../src/qt/mainwnd.cpp" line="88"/>
<source>OpenGL version 2.1 is present.</source>
<translation>OpenGL Version 2.1 ist verfügbar.</translation>
</message>
<message>
<location filename="../src/qt/mainwnd.cpp" line="91"/>
<source>OpenGL version 2.0 is present.</source>
<translation>OpenGL Version 2.0 ist verfügbar.</translation>
</message>
<message>
<location filename="../src/qt/mainwnd.cpp" line="94"/>
<source>OpenGL version 1.5 is present.</source>
<translation>OpenGL Version 1.5 ist verfügbar.</translation>
</message>
<message>
<location filename="../src/qt/mainwnd.cpp" line="97"/>
<source>OpenGL version 1.4 is present.</source>
<translation>OpenGL Version 1.4 ist verfügbar.</translation>
</message>
<message>
<location filename="../src/qt/mainwnd.cpp" line="100"/>
<source>OpenGL version 1.3 is present.</source>
<translation>OpenGL Version 1.3 ist verfügbar.</translation>
</message>
<message>
<location filename="../src/qt/mainwnd.cpp" line="103"/>
<source>OpenGL version 1.2 is present.</source>
<translation>OpenGL Version 1.2 ist verfügbar.</translation>
</message>
<message>
<location filename="../src/qt/mainwnd.cpp" line="106"/>
<source>OpenGL version 1.1 is present.</source>
<translation>OpenGL Version 1.1 ist verfügbar.</translation>
</message>
<message>
<location filename="../src/qt/mainwnd.cpp" line="112"/>
<source>OpenGL is NOT available!</source>
<translation>OpenGL ist NICHT verfügbar!</translation>
</message>
<message>
<location filename="../src/qt/mainwnd.cpp" line="115"/>
<source>OpenGL</source>
<translation></translation>
</message>
</context>
</TS>

View File

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

View File

@ -24,10 +24,10 @@
>
<Tool
Name="VCNMakeTool"
BuildCommandLine="qmake -makefile -win32 -Wall ../qmake/vba-m.pro&#x0D;&#x0A;nmake debug&#x0D;&#x0A;lupdate ../qmake/vba-m.pro"
BuildCommandLine="qmake -makefile -win32 -Wall ..\qmake\vba-m.pro&#x0D;&#x0A;nmake debug&#x0D;&#x0A;lupdate ..\qmake\vba-m.pro"
ReBuildCommandLine=""
CleanCommandLine="nmake distclean&#x0D;&#x0A;rmdir /S /Q debug&#x0D;&#x0A;rmdir /S /Q release&#x0D;&#x0A;"
Output="$(OutDir)/VisualBoyAdvance.exe"
Output="$(OutDir)\VisualBoyAdvance.exe"
PreprocessorDefinitions="WIN32;_DEBUG"
IncludeSearchPath=""
ForcedIncludes=""
@ -47,7 +47,7 @@
BuildCommandLine="qmake -makefile -win32 -Wall ..\qmake\vba-m.pro&#x0D;&#x0A;nmake release&#x0D;&#x0A;upx -9 &quot;$(TargetPath)&quot;&#x0D;&#x0A;lrelease ..\qmake\vba-m.pro&#x0D;&#x0A;echo &quot;Copying translation files to release directory...&quot;&#x0D;&#x0A;mkdir $(OutDir)\lang&#x0D;&#x0A;copy /Y ..\..\lang\*.qm $(OutDir)\lang"
ReBuildCommandLine=""
CleanCommandLine="nmake distclean&#x0D;&#x0A;rmdir /S /Q debug&#x0D;&#x0A;rmdir /S /Q release&#x0D;&#x0A;"
Output="$(OutDir)/VisualBoyAdvance.exe"
Output="$(OutDir)\VisualBoyAdvance.exe"
PreprocessorDefinitions="WIN32;NDEBUG"
IncludeSearchPath=""
ForcedIncludes=""
@ -62,6 +62,7 @@
<Files>
<Filter
Name="GUI"
Filter="cpp;h"
>
<Filter
Name="main"
@ -75,6 +76,18 @@
>
</File>
</Filter>
<Filter
Name="MainWnd"
>
<File
RelativePath="..\..\src\qt\mainwnd.cpp"
>
</File>
<File
RelativePath="..\..\src\qt\mainwnd.h"
>
</File>
</Filter>
</Filter>
<Filter
Name="Makefile"
@ -94,6 +107,26 @@
>
</File>
</Filter>
<Filter
Name="Other"
>
<File
RelativePath="..\..\src\qt\precompile.h"
>
</File>
<Filter
Name="OpenGL"
>
<File
RelativePath="..\..\src\qt\glwidget.cpp"
>
</File>
<File
RelativePath="..\..\src\qt\glwidget.h"
>
</File>
</Filter>
</Filter>
</Files>
<Globals>
</Globals>

117
src/qt/MainWnd.cpp Normal file
View File

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

42
src/qt/MainWnd.h Normal file
View File

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

42
src/qt/glwidget.cpp Normal file
View File

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

38
src/qt/glwidget.h Normal file
View File

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

View File

@ -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 <QApplication>
#include <QPushButton>
#include <QTranslator>
#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();
}

View File

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

28
src/qt/precompile.h Normal file
View File

@ -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 <QtGui>
#include <QtOpenGL>
#endif
#endif // #ifndef PRECOMPILE_H