1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
/**************************************************************************
* This file is part of the Fraqtive program
* Copyright (C) 2004-2008 Michał Męciński
*
* 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 of the License, or
* (at your option) any later version.
**************************************************************************/
#include "fractaltypedialog.h"
#include "fractalpresenter.h"
#include "fractalmodel.h"
#include "imageview.h"
#include "datafunctions.h"
FractalTypeDialog::FractalTypeDialog( QWidget* parent, const FractalModel* model ) : QDialog( parent )
{
m_ui.setupUi( this );
m_presenter = new FractalPresenter( this );
ImageView* view = new ImageView( m_ui.viewContainer, m_presenter );
m_ui.viewContainer->setView( view );
m_presenter->setView( view );
m_presenter->setPriority( 1 );
m_presenter->setParameters( fractalType(), position() );
m_presenter->setColorSettings( model->gradient(), model->backgroundColor(), model->colorMapping() );
m_presenter->setGeneratorSettings( model->generatorSettings() );
m_presenter->setViewSettings( model->viewSettings() );
setFractalType( model->fractalType() );
m_presenter->setEnabled( true );
}
FractalTypeDialog::~FractalTypeDialog()
{
}
void FractalTypeDialog::setFractalType( const FractalType& type )
{
m_ui.fractalTypeWidget->setFractalType( type );
}
FractalType FractalTypeDialog::fractalType() const
{
return m_ui.fractalTypeWidget->fractalType();
}
Position FractalTypeDialog::position() const
{
return DataFunctions::defaultPosition( fractalType() );
}
void FractalTypeDialog::on_fractalTypeWidget_fractalTypeChanged()
{
m_presenter->setParameters( fractalType(), position() );
}
|