Started preliminary work on the new main options menu

This commit is contained in:
mudlord 2008-02-21 05:21:15 +00:00
parent 4dd989f6fe
commit f92dbf47ea
10 changed files with 239 additions and 5 deletions

View File

@ -5,6 +5,7 @@ TARGET = VisualBoyAdvance
TRANSLATIONS += ../../lang/german.ts
TRANSLATIONS += ../../lang/spanish.ts
RESOURCES += ../../src/qt/vba-m.qrc
PRECOMPILED_HEADER = ../../src/qt/precompile.h
@ -20,3 +21,8 @@ SOURCES += ../../src/qt/glwidget.cpp
FORMS += ../../src/qt/sidewidget_cheats.ui
HEADERS += ../../src/qt/sidewidget_cheats.h
SOURCES += ../../src/qt/sidewidget_cheats.cpp
HEADERS += ../../src/qt/MainOptions.h
HEADERS += ../../src/qt/configdialog.h
SOURCES += ../../src/qt/MainOptions.cpp
SOURCES += ../../src/qt/configdialog.cpp

39
src/qt/MainOptions.cpp Normal file
View File

@ -0,0 +1,39 @@
// 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 <QtGui>
#include "MainOptions.h"
VideoOptionsPage::VideoOptionsPage(QWidget *parent)
: QWidget(parent)
{
}
InputOptionsPage::InputOptionsPage(QWidget *parent)
: QWidget(parent)
{
}
SoundOptionsPage::SoundOptionsPage(QWidget *parent)
: QWidget(parent)
{
}

44
src/qt/MainOptions.h Normal file
View File

@ -0,0 +1,44 @@
// 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 MAINOPTIONS_H
#define MAINOPTIONS_H
#include <QWidget>
class VideoOptionsPage : public QWidget
{
public:
VideoOptionsPage(QWidget *parent = 0);
};
class InputOptionsPage : public QWidget
{
public:
InputOptionsPage(QWidget *parent = 0);
};
class SoundOptionsPage : public QWidget
{
public:
SoundOptionsPage(QWidget *parent = 0);
};
#endif

View File

@ -19,6 +19,7 @@
#include "MainWnd.h"
#include "glwidget.h"
#include "configdialog.h"
#include "sidewidget_cheats.h"
@ -34,7 +35,6 @@ MainWnd::MainWnd( QWidget *parent, QApplication *app, QTranslator **trans )
dockWidget_cheats( 0 )
{
createDisplay();
setMinimumSize( 320, 240 );
setWindowTitle( tr( "VBA-M" ) );
@ -248,10 +248,8 @@ void MainWnd::showOpenROM()
void MainWnd::showMainOptions()
{
QString info;
info += tr ( "Placeholder for opening options widget." );
QMessageBox::about( this, tr( "Status" ), info );
ConfigDialog dialog;
dialog.exec();
}

112
src/qt/configdialog.cpp Normal file
View File

@ -0,0 +1,112 @@
/****************************************************************************
**
** Copyright (C) 2005-2007 Trolltech ASA. All rights reserved.
**
** This file is part of the example classes of the Qt Toolkit.
**
** This file may be used under the terms of the GNU General Public
** License version 2.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of
** this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
** http://trolltech.com/products/qt/licenses/licensing/opensource/
**
** If you are unsure which license is appropriate for your use, please
** review the following information:
** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
** or contact the sales department at sales@trolltech.com.
**
** In addition, as a special exception, Trolltech gives you certain
** additional rights. These rights are described in the Trolltech GPL
** Exception version 1.0, which can be found at
** http://www.trolltech.com/products/qt/gplexception/ and in the file
** GPL_EXCEPTION.txt in this package.
**
** In addition, as a special exception, Trolltech, as the sole copyright
** holder for Qt Designer, grants users of the Qt/Eclipse Integration
** plug-in the right for the Qt/Eclipse Integration to link to
** functionality provided by Qt Designer and its related libraries.
**
** Trolltech reserves all rights not expressly granted herein.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
****************************************************************************/
#include <QtGui>
#include "configdialog.h"
#include "MainOptions.h"
ConfigDialog::ConfigDialog()
{
contentsWidget = new QListWidget;
contentsWidget->setViewMode(QListView::IconMode);
contentsWidget->setIconSize(QSize(96, 84));
contentsWidget->setMovement(QListView::Static);
contentsWidget->setMaximumWidth(128);
contentsWidget->setSpacing(12);
pagesWidget = new QStackedWidget;
pagesWidget->addWidget(new VideoOptionsPage);
pagesWidget->addWidget(new SoundOptionsPage);
pagesWidget->addWidget(new InputOptionsPage);
QPushButton *closeButton = new QPushButton(tr("Close"));
createIcons();
contentsWidget->setCurrentRow(0);
connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
QHBoxLayout *horizontalLayout = new QHBoxLayout;
horizontalLayout->addWidget(contentsWidget);
horizontalLayout->addWidget(pagesWidget, 1);
QHBoxLayout *buttonsLayout = new QHBoxLayout;
buttonsLayout->addStretch(1);
buttonsLayout->addWidget(closeButton);
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addLayout(horizontalLayout);
mainLayout->addStretch(1);
mainLayout->addSpacing(12);
mainLayout->addLayout(buttonsLayout);
setLayout(mainLayout);
setWindowTitle(tr("VBA-M Options"));
}
void ConfigDialog::createIcons()
{
QListWidgetItem *VideoButton = new QListWidgetItem(contentsWidget);
VideoButton->setIcon(QIcon(":/resources/video.png"));
VideoButton->setText(tr("Video"));
VideoButton->setTextAlignment(Qt::AlignHCenter);
VideoButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
QListWidgetItem *SoundButton = new QListWidgetItem(contentsWidget);
SoundButton->setIcon(QIcon(":/resources/sound.png"));
SoundButton->setText(tr("Sound"));
SoundButton->setTextAlignment(Qt::AlignHCenter);
SoundButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
QListWidgetItem *InputButton = new QListWidgetItem(contentsWidget);
InputButton->setIcon(QIcon(":/resources/input.png"));
InputButton->setText(tr("Input"));
InputButton->setTextAlignment(Qt::AlignHCenter);
InputButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
connect(contentsWidget,
SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)),
this, SLOT(changePage(QListWidgetItem *, QListWidgetItem*)));
}
void ConfigDialog::changePage(QListWidgetItem *current, QListWidgetItem *previous)
{
if (!current)
current = previous;
pagesWidget->setCurrentIndex(contentsWidget->row(current));
}

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

@ -0,0 +1,28 @@
#ifndef CONFIGDIALOG_H
#define CONFIGDIALOG_H
#include <QDialog>
class QListWidget;
class QListWidgetItem;
class QStackedWidget;
class ConfigDialog : public QDialog
{
Q_OBJECT
public:
ConfigDialog();
public slots:
void changePage(QListWidgetItem *current, QListWidgetItem *previous);
private:
void createIcons();
QListWidget *contentsWidget;
QStackedWidget *pagesWidget;
};
#endif

BIN
src/qt/resources/input.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

BIN
src/qt/resources/sound.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

BIN
src/qt/resources/video.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

7
src/qt/vba-m.qrc Normal file
View File

@ -0,0 +1,7 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
<file>resources/video.png</file>
<file>resources/input.png</file>
<file>resources/sound.png</file>
</qresource>
</RCC>