mirror of
https://github.com/ConjureETS/LOG750-LAB2.git
synced 2026-03-24 03:21:19 +00:00
58 lines
1.7 KiB
C++
58 lines
1.7 KiB
C++
#include "mainwindow.h"
|
|
#include "ui_mainwindow.h"
|
|
#include <QBoxLayout>
|
|
#include <QColorDialog>
|
|
#include <QActionGroup>
|
|
|
|
namespace {
|
|
Viewer* view;
|
|
}
|
|
|
|
MainWindow::MainWindow(QWidget *parent) :
|
|
QMainWindow(parent),
|
|
ui(new Ui::MainWindow),
|
|
colordialog(new QColorDialog)
|
|
{
|
|
ui->setupUi(this);
|
|
|
|
lightTypeGroup = new QActionGroup(this);
|
|
lightTypeGroup->addAction(ui->actionGouraud);
|
|
lightTypeGroup->addAction(ui->actionPhong);
|
|
|
|
minFilterGroup = new QActionGroup(this);
|
|
minFilterGroup->addAction(ui->actionMinLin);
|
|
minFilterGroup->addAction(ui->actionMinNear);
|
|
|
|
magFilterGroup = new QActionGroup(this);
|
|
magFilterGroup->addAction(ui->actionMagLinear);
|
|
magFilterGroup->addAction(ui->actionMagNear);
|
|
|
|
connect(ui->pushButton, SIGNAL(clicked(bool)), this, SLOT(onColorPickerActivate()));
|
|
}
|
|
|
|
MainWindow::~MainWindow()
|
|
{
|
|
delete ui;
|
|
}
|
|
|
|
void MainWindow::addViewer(Viewer* viewer)
|
|
{
|
|
QLayout *layout = new QHBoxLayout;
|
|
layout->addWidget(viewer);
|
|
ui->frame->setLayout(layout);
|
|
|
|
// actionGouraud shouldn't need one, since they are mutual
|
|
connect(ui->actionPhong, SIGNAL(toggled(bool)), viewer, SLOT(setPhong(bool)));
|
|
connect(ui->actionMagLinear, SIGNAL(toggled(bool)), viewer, SLOT(setMagLinear(bool)));
|
|
connect(ui->actionMinLin, SIGNAL(toggled(bool)), viewer, SLOT(setMinLinear(bool)));
|
|
|
|
connect(ui->actionNormal_Maps, SIGNAL(toggled(bool)), viewer, SLOT(toggleNormalMaps(bool)));
|
|
|
|
connect(ui->action_delete, SIGNAL(clicked(bool)), viewer, SLOT(deleteSelected()));
|
|
connect(viewer, SIGNAL(cubeSelected(bool)), ui->action_delete, SLOT(setEnabled(bool)));
|
|
}
|
|
|
|
void MainWindow::onColorPickerActivate(){
|
|
colordialog->open();
|
|
}
|