diff -r e8f500c881af -r 7ee47a65f1ad Seafood/mainwindow.cpp --- a/Seafood/mainwindow.cpp Thu Mar 25 16:21:13 2010 -0700 +++ b/Seafood/mainwindow.cpp Thu Mar 25 16:49:34 2010 -0700 @@ -2,8 +2,10 @@ #include #include #include +#include #include #include +#include #include "Fishes.h" #include "mainwindow.h" @@ -15,8 +17,11 @@ ui(new Ui::MainWindow) { ui->setupUi(this); + setContextMenuPolicy(Qt::NoContextMenu); Fishes *f = new Fishes(); + this->stackedWidget = new QStackedWidget; + this->tabWidget = new QTabWidget; // QIcon icon = new QIcon(":/database/icons/weather-sunny.svg"); // this->tabWidget->setTabIcon(1, icon); @@ -32,7 +37,17 @@ this->worstList = new QListWidget; this->worstList->addItems(f->GetWorst()); this->tabWidget->addTab(this->worstList, "worst"); - setCentralWidget(tabWidget); + + this->stackedWidget->addWidget(tabWidget); // associated with EListPage + + this->ecoDetails = new QWebView; + this->ecoDetails->setHtml("Eco Details
  • not yet implemented
"); + + this->stackedWidget->addWidget(this->ecoDetails); // associated with EEcoPage + + this->stackedWidget->addWidget(ui->centralWidget); // associated with ENutritionPage + + setCentralWidget(stackedWidget); } MainWindow::~MainWindow() @@ -42,9 +57,18 @@ void MainWindow::createMenus() { + + ecoAction = new QAction(tr("&eco details"),this); + menuBar()->addAction(ecoAction); + connect(ecoAction, SIGNAL(triggered()),this, SLOT(displayEcoDetails())); + nuAction = new QAction(tr("&Nutrition"),this); menuBar()->addAction(nuAction); - connect(nuAction, SIGNAL(triggered()),this, SLOT(displayVersion())); + connect(nuAction, SIGNAL(triggered()),this, SLOT(displayNutrition())); + + fishesAction = new QAction(tr("&List Fishes"),this); + menuBar()->addAction(fishesAction); + connect(fishesAction, SIGNAL(triggered()),this, SLOT(displayList())); verAction = new QAction(tr("&Version"),this); menuBar()->addAction(verAction); @@ -57,7 +81,23 @@ void MainWindow::displayVersion() { - QMessageBox::information(this,"Qt Version", qVersion()); +// QMessageBox::information(this,"Qt Version", qVersion()); + QMessageBox::information(this,"selected item", "NYI"); +} + +void MainWindow::displayNutrition() +{ + this->stackedWidget->setCurrentIndex(MainWindow::ENutritionPage); +} + +void MainWindow::displayEcoDetails() +{ + this->stackedWidget->setCurrentIndex(MainWindow::EEcoPage); +} + +void MainWindow::displayList() +{ + this->stackedWidget->setCurrentIndex(MainWindow::EListPage); } void MainWindow::displayPath()