Path: blob/devel/ElmerGUI/Application/vtkpost/preferences.cpp
3203 views
/*****************************************************************************1* *2* Elmer, A Finite Element Software for Multiphysical Problems *3* *4* Copyright 1st April 1995 - , CSC - IT Center for Science Ltd., Finland *5* *6* This program is free software; you can redistribute it and/or *7* modify it under the terms of the GNU General Public License *8* as published by the Free Software Foundation; either version 2 *9* of the License, or (at your option) any later version. *10* *11* This program is distributed in the hope that it will be useful, *12* but WITHOUT ANY WARRANTY; without even the implied warranty of *13* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *14* GNU General Public License for more details. *15* *16* You should have received a copy of the GNU General Public License *17* along with this program (in file fem/GPL-2); if not, write to the *18* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *19* Boston, MA 02110-1301, USA. *20* *21*****************************************************************************/2223/*****************************************************************************24* *25* ElmerGUI preferences *26* *27*****************************************************************************28* *29* Authors: Mikko Lyly, Juha Ruokolainen and Peter R�back *30* Email: [email protected] *31* Web: http://www.csc.fi/elmer *32* Address: CSC - IT Center for Science Ltd. *33* Keilaranta 14 *34* 02101 Espoo, Finland *35* *36* Original Date: 15 Mar 2008 *37* *38*****************************************************************************/3940#include <QtGui>41#include <QColorDialog>42#include <iostream>43#include "vtkpost.h"44#include "preferences.h"4546using namespace std;4748Preferences::Preferences(QWidget *parent)49: QDialog(parent)50{51ui.setupUi(this);5253connect(ui.cancelButton, SIGNAL(clicked()), this, SLOT(cancelButtonClicked()));54connect(ui.okButton, SIGNAL(clicked()), this, SLOT(okButtonClicked()));55connect(ui.applyButton, SIGNAL(clicked()), this, SLOT(applyButtonClicked()));5657setWindowIcon(QIcon(":/icons/Mesh3D.png"));5859ui.cancelButton->setIcon(QIcon::fromTheme("dialog-error-round"));60ui.applyButton->setIcon(QIcon::fromTheme("view-refresh"));61ui.okButton->setIcon(QIcon::fromTheme("dialog-accept"));6263setMeshPointColor(Qt::gray);64setMeshEdgeColor(Qt::darkGray);65setFeatureEdgeColor(Qt::black);66connect(ui.meshPointColorButton, SIGNAL(clicked()), this, SLOT(meshPointColorButtonClicked()));67connect(ui.meshEdgeColorButton, SIGNAL(clicked()), this, SLOT(meshEdgeColorButtonClicked()));68connect(ui.featureEdgeColorButton, SIGNAL(clicked()), this, SLOT(featureEdgeColorButtonClicked()));69// connect(ui.meshPointsGroup, SIGNAL(toggled(bool)), this, SLOT(meshPointToggled(bool)));70// connect(ui.meshEdgesGroup, SIGNAL(toggled(bool)), this, SLOT(meshEdgeToggled(bool)));71// connect(ui.featureGroup, SIGNAL(toggled(bool)), this, SLOT(featureEdgeToggled(bool)));72}7374Preferences::~Preferences()75{76}7778void Preferences::okButtonClicked()79{80emit(redrawSignal());81close();82}8384void Preferences::applyButtonClicked()85{86emit(redrawSignal());87}8889void Preferences::cancelButtonClicked()90{91close();92}939495// Public slots:96//---------------97int Preferences::GetFeatureAngle()98{99return ui.angleSpin->value();100}101102void Preferences::UseSurfaceMeshForPoints(bool b)103{104ui.meshPointsSurface->setChecked(b);105}106void Preferences::UseVolumeMeshForPoints(bool b)107{108ui.meshPointsVolume->setChecked(b);109}110void Preferences::SetPointSize(int n)111{112ui.pointSize->setValue(n);113}114void Preferences::SetPointQuality(int n)115{116ui.pointQuality->setValue(n);117}118void Preferences::UseClipPlaneForPoints(bool b)119{120ui.meshPointsClip->setChecked(b);121}122123void Preferences::UseSurfaceMeshForEdges(bool b)124{125ui.meshEdgesSurface->setChecked(b);126}127128void Preferences::UseVolumeMeshForEdges(bool b)129{130ui.meshEdgesVolume->setChecked(b);131}132133void Preferences::UseTubeFilterForEdges(bool b)134{135ui.meshEdgeTubes->setChecked(b);136}137138void Preferences::UseClipPlaneForEdges(bool b)139{140ui.meshEdgesClip->setChecked(b);141}142143void Preferences::SetLineWidthForEdges(int n)144{145ui.meshLineWidth->setValue(n);146}147148void Preferences::SetTubeQualityForEdges(int n)149{150ui.meshEdgeTubeQuality->setValue(n);151}152153void Preferences::SetTubeRadiusForEdges(int n)154{155ui.meshEdgeTubeRadius->setValue(n);156}157158void Preferences::UseSurfaceMeshForFeatureEdges(bool b)159{160ui.surfaceRButton->setChecked(b);161}162163void Preferences::UseVolumeMeshForFeatureEdges(bool b)164{165ui.volumeRButton->setChecked(b);166}167168void Preferences::UseTubeFilterForFeatureEdges(bool b)169{170ui.featureEdgeTubes->setChecked(b);171}172173void Preferences::UseClipPlaneForFeatureEdges(bool b)174{175ui.featureEdgesClip->setChecked(b);176}177178void Preferences::DrawBoundaryEdges(bool b)179{180ui.drawBoundaryEdges->setChecked(b);181}182183void Preferences::SetFeatureAngle(int n)184{185ui.angleSpin->setValue(n);186}187188void Preferences::SetLineWidthForFeatureEdges(int n)189{190ui.lineWidthSpin->setValue(n);191}192193void Preferences::SetTubeQualityForFeatureEdges(int n)194{195ui.featureEdgeTubeQuality->setValue(n);196}197198void Preferences::SetTubeRadiusForFeatureEdges(int n)199{200ui.featureEdgeTubeRadius->setValue(n);201}202203void Preferences::SetClipPlaneOx(double f)204{205ui.clipPointX->setText(QString::number(f));206}207208void Preferences::SetClipPlaneOy(double f)209{210ui.clipPointY->setText(QString::number(f));211}212213void Preferences::SetClipPlaneOz(double f)214{215ui.clipPointZ->setText(QString::number(f));216}217218void Preferences::SetClipPlaneNx(double f)219{220ui.clipNormalX->setText(QString::number(f));221}222223void Preferences::SetClipPlaneNy(double f)224{225ui.clipNormalY->setText(QString::number(f));226}227228void Preferences::SetClipPlaneNz(double f)229{230ui.clipNormalZ->setText(QString::number(f));231}232233void Preferences::meshPointColorButtonClicked()234{235setMeshPointColor(QColorDialog::getColor(meshPointColor));236}237238void Preferences::setMeshPointColor(QColor color){239if(!color.isValid()) return;240241meshPointColor = color;242243QPalette plt(ui.meshPointColorLabel->palette());244plt.setColor(QPalette::WindowText, meshPointColor);245ui.meshPointColorLabel->setPalette(plt);246}247248void Preferences::meshEdgeColorButtonClicked()249{250setMeshEdgeColor(QColorDialog::getColor(meshEdgeColor));251}252253void Preferences::setMeshEdgeColor(QColor color){254if(!color.isValid()) return;255256meshEdgeColor = color;257258QPalette plt(ui.meshEdgeColorLabel->palette());259plt.setColor(QPalette::WindowText, meshEdgeColor);260ui.meshEdgeColorLabel->setPalette(plt);261}262263void Preferences::featureEdgeColorButtonClicked()264{265setFeatureEdgeColor(QColorDialog::getColor(featureEdgeColor));266}267268void Preferences::setFeatureEdgeColor(QColor color){269if(!color.isValid()) return;270271featureEdgeColor = color;272273QPalette plt(ui.featureEdgeColorLabel->palette());274plt.setColor(QPalette::WindowText, featureEdgeColor);275ui.featureEdgeColorLabel->setPalette(plt);276}277278QColor Preferences::getMeshPointColor(){279return meshPointColor;280}281282QColor Preferences::getMeshEdgeColor(){283return meshEdgeColor;284}285286QColor Preferences::getFeatureEdgeColor(){287return featureEdgeColor;288}289290void Preferences::meshPointToggled(bool checked)291{292293}294295void Preferences::meshEdgeToggled(bool checked)296{297298}299300void Preferences::featureEdgeToggled(bool checked)301{302303}304305