File size: 6,349 Bytes
985c397 | 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 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | /***************************************************************************
* Copyright (c) 2015 FreeCAD Developers *
* Author: Przemo Firszt <przemo@firszt.eu> *
* Author: Bernd Hahnebach <bernd@bimstatik.ch> *
* Based on src/Mod/Fem/Gui/DlgSettingsFemGeneralImp.cpp *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library 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 Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include <QMessageBox>
#include <QStandardPaths>
#include <QThread>
#include <App/Application.h>
#include "DlgSettingsFemCcxImp.h"
#include "ui_DlgSettingsFemCcx.h"
using namespace FemGui;
DlgSettingsFemCcxImp::DlgSettingsFemCcxImp(QWidget* parent)
: PreferencePage(parent)
, ui(new Ui_DlgSettingsFemCcxImp)
{
ui->setupUi(this);
// set ranges
ui->dsb_ccx_time_period->setMaximum(std::numeric_limits<float>::max());
ui->dsb_ccx_initial_time_increment->setMaximum(std::numeric_limits<float>::max());
connect(
ui->fc_ccx_binary_path,
&Gui::PrefFileChooser::fileNameSelected,
this,
&DlgSettingsFemCcxImp::onfileNameSelected
);
}
DlgSettingsFemCcxImp::~DlgSettingsFemCcxImp() = default;
void DlgSettingsFemCcxImp::saveSettings()
{
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath(
"User parameter:BaseApp/Preferences/Mod/Fem/Ccx"
);
hGrp->SetInt("Solver", ui->cmb_solver->currentIndex());
hGrp->SetInt("AnalysisType", ui->cb_analysis_type->currentIndex());
ui->sb_ccx_numcpu->onSave(); // Number of CPUs
ui->cmb_solver->onSave();
ui->cb_ccx_non_lin_geom->onSave();
ui->cb_use_iterations_param->onSave();
ui->cb_static->onSave();
ui->sb_ccx_max_increments->onSave(); // Max number of increments
ui->dsb_ccx_initial_time_increment->onSave(); // Initial time increment
ui->dsb_ccx_time_period->onSave(); // Step time period
ui->dsb_ccx_minimum_time_increment->onSave(); // Minimum time increment
ui->dsb_ccx_maximum_time_increment->onSave(); // Maximum time increment
ui->ckb_pipeline_result->onSave();
ui->ckb_result_format->onSave();
ui->cb_analysis_type->onSave();
ui->cb_BeamShellOutput->onSave(); // Beam shell output 3d or 2d
ui->sb_eigenmode_number->onSave();
ui->dsb_eigenmode_high_limit->onSave();
ui->dsb_eigenmode_low_limit->onSave();
ui->cb_int_editor->onSave();
ui->fc_ext_editor->onSave();
ui->fc_ccx_binary_path->onSave();
ui->cb_split_inp_writer->onSave();
}
void DlgSettingsFemCcxImp::loadSettings()
{
ui->sb_ccx_numcpu->onRestore(); // Number of CPUs
ui->cmb_solver->onRestore();
ui->cb_ccx_non_lin_geom->onRestore();
ui->cb_use_iterations_param->onRestore();
ui->cb_static->onRestore();
ui->sb_ccx_max_increments->onRestore(); // Max number of increments
ui->dsb_ccx_initial_time_increment->onRestore(); // Initial time increment
ui->dsb_ccx_time_period->onRestore(); // Step time period
ui->dsb_ccx_minimum_time_increment->onRestore(); // Minimum time increment
ui->dsb_ccx_maximum_time_increment->onRestore(); // Maximum time increment
ui->ckb_pipeline_result->onRestore();
ui->ckb_result_format->onRestore();
ui->cb_analysis_type->onRestore();
ui->cb_BeamShellOutput->onRestore(); // Beam shell output 3d or 2d
ui->sb_eigenmode_number->onRestore();
ui->dsb_eigenmode_high_limit->onRestore();
ui->dsb_eigenmode_low_limit->onRestore();
ui->cb_int_editor->onRestore();
ui->fc_ext_editor->onRestore();
ui->fc_ccx_binary_path->onRestore();
ui->cb_split_inp_writer->onRestore();
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath(
"User parameter:BaseApp/Preferences/Mod/Fem/Ccx"
);
// determine number of CPU threads
int processor_count = hGrp->GetInt("AnalysisNumCPUs", QThread::idealThreadCount());
ui->sb_ccx_numcpu->setValue(processor_count);
int index = hGrp->GetInt("Solver", 0);
if (index > -1) {
ui->cmb_solver->setCurrentIndex(index);
}
index = hGrp->GetInt("AnalysisType", 0);
if (index > -1) {
ui->cb_analysis_type->setCurrentIndex(index);
}
}
/**
* Sets the strings of the subwidgets using the current language.
*/
void DlgSettingsFemCcxImp::changeEvent(QEvent* e)
{
if (e->type() == QEvent::LanguageChange) {
int c_index = ui->cb_analysis_type->currentIndex();
ui->retranslateUi(this);
ui->cb_analysis_type->setCurrentIndex(c_index);
}
else {
QWidget::changeEvent(e);
}
}
void DlgSettingsFemCcxImp::onfileNameSelected(const QString& fileName)
{
if (!fileName.isEmpty() && QStandardPaths::findExecutable(fileName).isEmpty()) {
QMessageBox::critical(this, tr("CalculiX"), tr("Executable '%1' not found").arg(fileName));
}
}
#include "moc_DlgSettingsFemCcxImp.cpp"
|