2018-05-24 18:08:06 +00:00
|
|
|
/*
|
2025-01-04 13:37:40 +01:00
|
|
|
Copyright 2006-2025 The QElectroTech Team
|
2018-05-24 18:08:06 +00:00
|
|
|
This file is part of QElectroTech.
|
|
|
|
|
|
|
|
QElectroTech 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.
|
|
|
|
|
|
|
|
QElectroTech 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 General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
#include "generalconfigurationpage.h"
|
2020-12-09 15:28:43 +01:00
|
|
|
|
2020-12-10 21:19:45 +01:00
|
|
|
#include "../../qetapp.h"
|
|
|
|
#include "../../qeticons.h"
|
2018-05-24 18:08:06 +00:00
|
|
|
#include "ui_generalconfigurationpage.h"
|
2021-12-04 14:38:41 +01:00
|
|
|
#include "../../utils/qetsettings.h"
|
2018-05-24 18:08:06 +00:00
|
|
|
|
2019-03-08 20:07:00 +00:00
|
|
|
#include <QFileDialog>
|
2020-12-09 15:28:43 +01:00
|
|
|
#include <QFontDialog>
|
|
|
|
#include <QSettings>
|
2018-05-24 18:08:06 +00:00
|
|
|
|
|
|
|
/**
|
2020-08-16 11:19:36 +02:00
|
|
|
@brief GeneralConfigurationPage::GeneralConfigurationPage
|
|
|
|
@param parent
|
|
|
|
*/
|
2018-05-24 18:08:06 +00:00
|
|
|
GeneralConfigurationPage::GeneralConfigurationPage(QWidget *parent) :
|
|
|
|
ConfigPage(parent),
|
|
|
|
ui(new Ui::GeneralConfigurationPage)
|
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
|
|
|
|
|
|
|
QSettings settings;
|
|
|
|
|
2021-12-04 14:38:41 +01:00
|
|
|
//Appearance tab
|
|
|
|
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ###Qt 6:remove
|
|
|
|
ui->m_hdpi_round_policy_widget->setDisabled(true);
|
|
|
|
#else
|
|
|
|
ui->m_hdpi_round_policy_cb->addItem(tr("Arrondi supérieur pour 0.5 et plus"), QLatin1String("Round"));
|
|
|
|
ui->m_hdpi_round_policy_cb->addItem(tr("Toujours arrondi supérieur"), QLatin1String("Ceil"));
|
|
|
|
ui->m_hdpi_round_policy_cb->addItem(tr("Toujours arrondi inférieur"), QLatin1String("Floor"));
|
|
|
|
ui->m_hdpi_round_policy_cb->addItem(tr("Arrondi supérieur pour 0.75 et plus"), QLatin1String("RoundPreferFloor"));
|
|
|
|
ui->m_hdpi_round_policy_cb->addItem(tr("Pas d'arrondi"), QLatin1String("PassThrough"));
|
|
|
|
switch (QetSettings::hdpiScaleFactorRoundingPolicy()) {
|
|
|
|
case Qt::HighDpiScaleFactorRoundingPolicy::Round:
|
|
|
|
ui->m_hdpi_round_policy_cb->setCurrentIndex(0);
|
|
|
|
break;
|
|
|
|
case Qt::HighDpiScaleFactorRoundingPolicy::Ceil:
|
|
|
|
ui->m_hdpi_round_policy_cb->setCurrentIndex(1);
|
|
|
|
break;
|
|
|
|
case Qt::HighDpiScaleFactorRoundingPolicy::Floor:
|
|
|
|
ui->m_hdpi_round_policy_cb->setCurrentIndex(2);
|
|
|
|
break;
|
|
|
|
case Qt::HighDpiScaleFactorRoundingPolicy::RoundPreferFloor:
|
|
|
|
ui->m_hdpi_round_policy_cb->setCurrentIndex(3);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ui->m_hdpi_round_policy_cb->setCurrentIndex(4);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
#endif
|
2019-03-02 21:45:09 +00:00
|
|
|
ui->DiagramEditor_xGrid_sb->setValue(settings.value("diagrameditor/Xgrid", 10).toInt());
|
|
|
|
ui->DiagramEditor_yGrid_sb->setValue(settings.value("diagrameditor/Ygrid", 10).toInt());
|
|
|
|
ui->DiagramEditor_xKeyGrid_sb->setValue(settings.value("diagrameditor/key_Xgrid", 10).toInt());
|
|
|
|
ui->DiagramEditor_yKeyGrid_sb->setValue(settings.value("diagrameditor/key_Ygrid", 10).toInt());
|
|
|
|
ui->DiagramEditor_xKeyGridFine_sb->setValue(settings.value("diagrameditor/key_fine_Xgrid", 1).toInt());
|
|
|
|
ui->DiagramEditor_yKeyGridFine_sb->setValue(settings.value("diagrameditor/key_fine_Ygrid", 1).toInt());
|
2025-03-07 20:16:21 +01:00
|
|
|
ui->DiagramEditor_Grid_PointSize_min_sb->setValue(settings.value("diagrameditor/grid_pointsize_min", 1).toInt());
|
|
|
|
ui->DiagramEditor_Grid_PointSize_max_sb->setValue(settings.value("diagrameditor/grid_pointsize_max", 1).toInt());
|
2019-08-17 12:58:24 +02:00
|
|
|
ui->m_use_system_color_cb->setChecked(settings.value("usesystemcolors", "true").toBool());
|
2018-05-24 18:08:06 +00:00
|
|
|
bool tabbed = settings.value("diagrameditor/viewmode", "tabbed") == "tabbed";
|
|
|
|
if(tabbed)
|
|
|
|
ui->m_use_tab_mode_rb->setChecked(true);
|
|
|
|
else
|
2020-07-15 20:20:07 +02:00
|
|
|
ui->m_use_windows_mode_rb->setChecked(true);
|
2018-05-24 18:08:06 +00:00
|
|
|
ui->m_zoom_out_beyond_folio->setChecked(settings.value("diagrameditor/zoom-out-beyond-of-folio", false).toBool());
|
|
|
|
ui->m_use_gesture_trackpad->setChecked(settings.value("diagramview/gestures", false).toBool());
|
|
|
|
ui->m_save_label_paste->setChecked(settings.value("diagramcommands/erase-label-on-copy", true).toBool());
|
|
|
|
ui->m_use_folio_label->setChecked(settings.value("genericpanel/folio", true).toBool());
|
|
|
|
ui->m_export_terminal->setChecked(settings.value("nomenclature-exportlist", true).toBool());
|
2018-09-22 10:39:36 +00:00
|
|
|
ui->m_border_0->setChecked(settings.value("border-columns_0", false).toBool());
|
2018-05-24 18:08:06 +00:00
|
|
|
ui->m_autosave_sb->setValue(settings.value("diagrameditor/autosave-interval", 0).toInt());
|
|
|
|
|
2025-05-18 14:15:20 +02:00
|
|
|
QString fontInfos = settings.value("diagramitemfont", "Liberation Sans").toString() + " " +
|
|
|
|
settings.value("diagramitemsize", "9").toString() + " (" +
|
|
|
|
settings.value("diagramitemstyle", "Regular").toString() + ")";
|
2018-05-24 18:08:06 +00:00
|
|
|
ui->m_font_pb->setText(fontInfos);
|
2019-03-08 20:07:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
//Dynamic element text item
|
|
|
|
ui->m_dyn_text_rotation_sb->setValue(settings.value("diagrameditor/dynamic_text_rotation", 0).toInt());
|
|
|
|
ui->m_dyn_text_width_sb->setValue(settings.value("diagrameditor/dynamic_text_width", -1).toInt());
|
|
|
|
if (settings.contains("diagrameditor/dynamic_text_font"))
|
|
|
|
{
|
|
|
|
QFont font;
|
|
|
|
font.fromString(settings.value("diagrameditor/dynamic_text_font").toString());
|
|
|
|
|
|
|
|
QString fontInfos = font.family() + " " +
|
|
|
|
QString::number(font.pointSize()) + " (" +
|
|
|
|
font.styleName() + ")";
|
|
|
|
ui->m_dyn_text_font_pb->setText(fontInfos);
|
2025-05-18 14:15:20 +02:00
|
|
|
} else { ui->m_dyn_text_font_pb->setText("Liberation Sans 9 (Regular)"); }
|
2019-03-08 20:07:00 +00:00
|
|
|
|
|
|
|
//Independent text item
|
|
|
|
ui->m_indi_text_rotation_sb->setValue(settings.value("diagrameditor/independent_text_rotation",0).toInt());
|
|
|
|
if (settings.contains("diagrameditor/independent_text_font"))
|
|
|
|
{
|
|
|
|
QFont font;
|
|
|
|
font.fromString(settings.value("diagrameditor/independent_text_font").toString());
|
|
|
|
|
|
|
|
QString fontInfos = font.family() + " " +
|
|
|
|
QString::number(font.pointSize()) + " (" +
|
|
|
|
font.styleName() + ")";
|
|
|
|
ui->m_indi_text_font_pb->setText(fontInfos);
|
2025-05-18 14:15:20 +02:00
|
|
|
} else { ui->m_indi_text_font_pb->setText("Liberation Sans 9 (Regular)"); }
|
2018-10-26 23:42:49 +00:00
|
|
|
|
2018-05-24 18:08:06 +00:00
|
|
|
ui->m_highlight_integrated_elements->setChecked(settings.value("diagrameditor/highlight-integrated-elements", true).toBool());
|
|
|
|
ui->m_default_elements_info->setPlainText(settings.value("elementeditor/default-informations", "").toString());
|
2024-04-24 18:02:00 +02:00
|
|
|
/*
|
|
|
|
Nombre maximum de primitives affichees par la "liste des parties"
|
|
|
|
Au-dela, un petit message est affiche, indiquant que ce nombre a ete depasse
|
|
|
|
et que la liste ne sera donc pas mise a jour.
|
|
|
|
*/
|
|
|
|
ui->MaxPartsElementEditorList_sb->setValue(settings.value("elementeditor/max-parts-element-editor-list", 200).toInt());
|
2025-03-07 20:16:21 +01:00
|
|
|
ui->ElementEditor_Grid_PointSize_min_sb->setValue(settings.value("elementeditor/grid_pointsize_min", 1).toInt());
|
|
|
|
ui->ElementEditor_Grid_PointSize_max_sb->setValue(settings.value("elementeditor/grid_pointsize_max", 1).toInt());
|
|
|
|
|
2018-07-25 17:34:50 +00:00
|
|
|
QString path = settings.value("elements-collections/common-collection-path", "default").toString();
|
|
|
|
if (path != "default")
|
|
|
|
{
|
|
|
|
ui->m_common_elmt_path_cb->blockSignals(true);
|
|
|
|
ui->m_common_elmt_path_cb->setCurrentIndex(1);
|
|
|
|
ui->m_common_elmt_path_cb->setItemData(1, path, Qt::DisplayRole);
|
|
|
|
ui->m_common_elmt_path_cb->blockSignals(false);
|
|
|
|
}
|
|
|
|
|
2023-12-09 12:02:04 +01:00
|
|
|
path = settings.value("elements-collections/company-collection-path", "default").toString();
|
|
|
|
if (path != "default")
|
|
|
|
{
|
|
|
|
ui->m_company_elmt_path_cb->blockSignals(true);
|
|
|
|
ui->m_company_elmt_path_cb->setCurrentIndex(1);
|
|
|
|
ui->m_company_elmt_path_cb->setItemData(1, path, Qt::DisplayRole);
|
|
|
|
ui->m_company_elmt_path_cb->blockSignals(false);
|
|
|
|
}
|
|
|
|
|
2023-12-16 09:32:44 +01:00
|
|
|
path = settings.value("elements-collections/company-tbt-path", "default").toString();
|
|
|
|
if (path != "default")
|
|
|
|
{
|
|
|
|
ui->m_company_tbt_path_cb->blockSignals(true);
|
|
|
|
ui->m_company_tbt_path_cb->setCurrentIndex(1);
|
|
|
|
ui->m_company_tbt_path_cb->setItemData(1, path, Qt::DisplayRole);
|
|
|
|
ui->m_company_tbt_path_cb->blockSignals(false);
|
|
|
|
}
|
|
|
|
|
2018-07-25 17:34:50 +00:00
|
|
|
path = settings.value("elements-collections/custom-collection-path", "default").toString();
|
|
|
|
if (path != "default")
|
|
|
|
{
|
|
|
|
ui->m_custom_elmt_path_cb->blockSignals(true);
|
|
|
|
ui->m_custom_elmt_path_cb->setCurrentIndex(1);
|
|
|
|
ui->m_custom_elmt_path_cb->setItemData(1, path, Qt::DisplayRole);
|
|
|
|
ui->m_custom_elmt_path_cb->blockSignals(false);
|
|
|
|
}
|
|
|
|
|
2018-11-25 09:55:11 +00:00
|
|
|
|
|
|
|
path = settings.value("elements-collections/custom-tbt-path", "default").toString();
|
|
|
|
if (path != "default")
|
|
|
|
{
|
|
|
|
ui->m_custom_tbt_path_cb->blockSignals(true);
|
|
|
|
ui->m_custom_tbt_path_cb->setCurrentIndex(1);
|
|
|
|
ui->m_custom_tbt_path_cb->setItemData(1, path, Qt::DisplayRole);
|
|
|
|
ui->m_custom_tbt_path_cb->blockSignals(false);
|
|
|
|
}
|
|
|
|
|
2018-08-03 16:35:40 +00:00
|
|
|
fillLang();
|
2018-05-24 18:08:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GeneralConfigurationPage::~GeneralConfigurationPage()
|
|
|
|
{
|
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-08-16 11:19:36 +02:00
|
|
|
@brief GeneralConfigurationPage::applyConf
|
|
|
|
Write all configuration in settings file
|
|
|
|
*/
|
2018-05-24 18:08:06 +00:00
|
|
|
void GeneralConfigurationPage::applyConf()
|
|
|
|
{
|
|
|
|
QSettings settings;
|
|
|
|
|
2019-03-08 20:07:00 +00:00
|
|
|
//GLOBAL
|
2018-05-24 18:08:06 +00:00
|
|
|
bool was_using_system_colors = settings.value("usesystemcolors", "true").toBool();
|
|
|
|
bool must_use_system_colors = ui->m_use_system_color_cb->isChecked();
|
|
|
|
settings.setValue("usesystemcolors", must_use_system_colors);
|
|
|
|
if (was_using_system_colors != must_use_system_colors) {
|
|
|
|
QETApp::instance()->useSystemPalette(must_use_system_colors);
|
|
|
|
}
|
2019-03-08 20:07:00 +00:00
|
|
|
settings.setValue("border-columns_0",ui->m_border_0->isChecked());
|
2018-05-24 18:08:06 +00:00
|
|
|
settings.setValue("lang", ui->m_lang_cb->itemData(ui->m_lang_cb->currentIndex()).toString());
|
2019-03-08 20:07:00 +00:00
|
|
|
|
2021-12-04 14:38:41 +01:00
|
|
|
//hdpi
|
2021-12-04 19:12:11 +01:00
|
|
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
2021-12-04 14:38:41 +01:00
|
|
|
QetSettings::setHdpiScaleFactorRoundingPolicy(ui->m_hdpi_round_policy_cb->currentData().toString());
|
|
|
|
QGuiApplication::setHighDpiScaleFactorRoundingPolicy(QetSettings::hdpiScaleFactorRoundingPolicy());
|
2021-12-04 19:12:11 +01:00
|
|
|
#endif
|
2021-12-04 14:38:41 +01:00
|
|
|
|
2019-03-08 20:07:00 +00:00
|
|
|
//ELEMENT EDITOR
|
2018-05-24 18:08:06 +00:00
|
|
|
settings.setValue("elementeditor/default-informations", ui->m_default_elements_info->toPlainText());
|
2024-04-24 18:02:00 +02:00
|
|
|
settings.setValue("elementeditor/max-parts-element-editor-list", ui->MaxPartsElementEditorList_sb->value());
|
2025-03-07 20:16:21 +01:00
|
|
|
settings.setValue("elementeditor/grid_pointsize_min", ui->ElementEditor_Grid_PointSize_min_sb->value());
|
|
|
|
settings.setValue("elementeditor/grid_pointsize_max", ui->ElementEditor_Grid_PointSize_max_sb->value());
|
2019-03-08 20:07:00 +00:00
|
|
|
|
|
|
|
//DIAGRAM VIEW
|
2018-05-24 18:08:06 +00:00
|
|
|
settings.setValue("diagramview/gestures", ui->m_use_gesture_trackpad->isChecked());
|
2019-03-08 20:07:00 +00:00
|
|
|
|
|
|
|
//DIAGRAM COMMAND
|
2018-05-24 18:08:06 +00:00
|
|
|
settings.setValue("diagramcommands/erase-label-on-copy", ui->m_save_label_paste->isChecked());
|
2019-03-08 20:07:00 +00:00
|
|
|
|
|
|
|
//GENERIC PANEL
|
2018-05-24 18:08:06 +00:00
|
|
|
settings.setValue("genericpanel/folio",ui->m_use_folio_label->isChecked());
|
2019-03-08 20:07:00 +00:00
|
|
|
|
|
|
|
//NOMENCLATURE
|
2018-05-24 18:08:06 +00:00
|
|
|
settings.setValue("nomenclature/terminal-exportlist",ui->m_export_terminal->isChecked());
|
2019-03-08 20:07:00 +00:00
|
|
|
|
2024-04-24 18:02:00 +02:00
|
|
|
|
2019-03-08 20:07:00 +00:00
|
|
|
//DIAGRAM EDITOR
|
|
|
|
QString view_mode = ui->m_use_tab_mode_rb->isChecked() ? "tabbed" : "windowed";
|
|
|
|
settings.setValue("diagrameditor/viewmode", view_mode) ;
|
|
|
|
settings.setValue("diagrameditor/highlight-integrated-elements", ui->m_highlight_integrated_elements->isChecked());
|
|
|
|
settings.setValue("diagrameditor/zoom-out-beyond-of-folio", ui->m_zoom_out_beyond_folio->isChecked());
|
2018-05-24 18:08:06 +00:00
|
|
|
settings.setValue("diagrameditor/autosave-interval", ui->m_autosave_sb->value());
|
2019-03-08 20:07:00 +00:00
|
|
|
//Grid step and key navigation
|
2019-03-02 21:45:09 +00:00
|
|
|
settings.setValue("diagrameditor/Xgrid", ui->DiagramEditor_xGrid_sb->value());
|
|
|
|
settings.setValue("diagrameditor/Ygrid", ui->DiagramEditor_yGrid_sb->value());
|
|
|
|
settings.setValue("diagrameditor/key_Xgrid", ui->DiagramEditor_xKeyGrid_sb->value());
|
|
|
|
settings.setValue("diagrameditor/key_Ygrid", ui->DiagramEditor_yKeyGrid_sb->value());
|
|
|
|
settings.setValue("diagrameditor/key_fine_Xgrid", ui->DiagramEditor_xKeyGridFine_sb->value());
|
|
|
|
settings.setValue("diagrameditor/key_fine_Ygrid", ui->DiagramEditor_yKeyGridFine_sb->value());
|
2025-03-07 20:16:21 +01:00
|
|
|
settings.setValue("diagrameditor/grid_pointsize_min", ui->DiagramEditor_Grid_PointSize_min_sb->value());
|
|
|
|
settings.setValue("diagrameditor/grid_pointsize_max", ui->DiagramEditor_Grid_PointSize_max_sb->value());
|
2019-03-08 20:07:00 +00:00
|
|
|
//Dynamic text item
|
|
|
|
settings.setValue("diagrameditor/dynamic_text_rotation", ui->m_dyn_text_rotation_sb->value());
|
|
|
|
settings.setValue("diagrameditor/dynamic_text_width", ui->m_dyn_text_width_sb->value());
|
|
|
|
//Independent text item
|
|
|
|
settings.setValue("diagrameditor/independent_text_rotation", ui->m_indi_text_rotation_sb->value());
|
2019-02-24 15:44:47 +00:00
|
|
|
|
2019-03-08 20:07:00 +00:00
|
|
|
//ELEMENTS COLLECTION
|
2018-08-03 16:35:40 +00:00
|
|
|
QString path = settings.value("elements-collections/common-collection-path").toString();
|
2018-07-25 17:34:50 +00:00
|
|
|
if (ui->m_common_elmt_path_cb->currentIndex() == 1)
|
|
|
|
{
|
|
|
|
QString path = ui->m_common_elmt_path_cb->currentText();
|
|
|
|
QDir dir(path);
|
|
|
|
settings.setValue("elements-collections/common-collection-path",
|
|
|
|
dir.exists() ? path : "default");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
settings.setValue("elements-collections/common-collection-path", "default");
|
|
|
|
}
|
2018-08-03 16:35:40 +00:00
|
|
|
if (path != settings.value("elements-collections/common-collection-path").toString()) {
|
2021-12-04 12:22:47 +01:00
|
|
|
QETApp::resetCollectionsPath();
|
2018-08-03 16:35:40 +00:00
|
|
|
}
|
2025-05-18 14:15:20 +02:00
|
|
|
|
2023-12-09 12:02:04 +01:00
|
|
|
path = settings.value("elements-collections/company-collection-path").toString();
|
|
|
|
if (ui->m_company_elmt_path_cb->currentIndex() == 1)
|
|
|
|
{
|
|
|
|
QString path = ui->m_company_elmt_path_cb->currentText();
|
|
|
|
QDir dir(path);
|
|
|
|
settings.setValue("elements-collections/company-collection-path",
|
|
|
|
dir.exists() ? path : "default");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
settings.setValue("elements-collections/company-collection-path", "default");
|
|
|
|
}
|
|
|
|
if (path != settings.value("elements-collections/company-collection-path").toString()) {
|
|
|
|
QETApp::resetCollectionsPath();
|
|
|
|
}
|
|
|
|
|
2018-08-03 16:35:40 +00:00
|
|
|
path = settings.value("elements-collections/custom-collection-path").toString();
|
2018-07-25 17:34:50 +00:00
|
|
|
if (ui->m_custom_elmt_path_cb->currentIndex() == 1)
|
|
|
|
{
|
|
|
|
QString path = ui->m_custom_elmt_path_cb->currentText();
|
|
|
|
QDir dir(path);
|
|
|
|
settings.setValue("elements-collections/custom-collection-path",
|
|
|
|
dir.exists() ? path : "default");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
settings.setValue("elements-collections/custom-collection-path", "default");
|
|
|
|
}
|
2018-08-03 16:35:40 +00:00
|
|
|
if (path != settings.value("elements-collections/custom-collection-path").toString()) {
|
2021-12-04 12:22:47 +01:00
|
|
|
QETApp::resetCollectionsPath();
|
2018-08-03 16:35:40 +00:00
|
|
|
}
|
2018-11-25 10:47:36 +00:00
|
|
|
|
2023-12-16 09:32:44 +01:00
|
|
|
path = settings.value("elements-collections/company-tbt-path").toString();
|
|
|
|
if (ui->m_company_tbt_path_cb->currentIndex() == 1)
|
|
|
|
{
|
|
|
|
QString path = ui->m_company_tbt_path_cb->currentText();
|
|
|
|
QDir dir(path);
|
|
|
|
settings.setValue("elements-collections/company-tbt-path",
|
|
|
|
dir.exists() ? path : "default");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
settings.setValue("elements-collections/company-tbt-path", "default");
|
|
|
|
}
|
|
|
|
if (path != settings.value("elements-collections/company-tbt-path").toString()) {
|
|
|
|
QETApp::resetCollectionsPath();
|
|
|
|
}
|
|
|
|
|
2018-11-25 10:47:36 +00:00
|
|
|
path = settings.value("elements-collections/custom-tbt-path").toString();
|
2018-11-25 09:55:11 +00:00
|
|
|
if (ui->m_custom_tbt_path_cb->currentIndex() == 1)
|
|
|
|
{
|
|
|
|
QString path = ui->m_custom_tbt_path_cb->currentText();
|
|
|
|
QDir dir(path);
|
2018-11-25 10:47:36 +00:00
|
|
|
settings.setValue("elements-collections/custom-tbt-path",
|
2018-11-25 09:55:11 +00:00
|
|
|
dir.exists() ? path : "default");
|
|
|
|
}
|
|
|
|
else {
|
2018-11-25 10:47:36 +00:00
|
|
|
settings.setValue("elements-collections/custom-tbt-path", "default");
|
2018-11-25 09:55:11 +00:00
|
|
|
}
|
2018-11-25 10:47:36 +00:00
|
|
|
if (path != settings.value("elements-collections/custom-tbt-path").toString()) {
|
2021-12-04 12:22:47 +01:00
|
|
|
QETApp::resetCollectionsPath();
|
2018-11-25 09:55:11 +00:00
|
|
|
}
|
2018-05-24 18:08:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-08-16 11:19:36 +02:00
|
|
|
@brief GeneralConfigurationPage::title
|
|
|
|
@return The title of this page
|
|
|
|
*/
|
2020-09-07 22:03:40 +02:00
|
|
|
QString GeneralConfigurationPage::title() const
|
|
|
|
{
|
2018-05-24 18:08:06 +00:00
|
|
|
return(tr("Général", "configuration page title"));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-08-16 11:19:36 +02:00
|
|
|
@brief GeneralConfigurationPage::icon
|
|
|
|
@return The icon of this page
|
|
|
|
*/
|
2020-09-07 22:03:40 +02:00
|
|
|
QIcon GeneralConfigurationPage::icon() const
|
|
|
|
{
|
2018-05-24 18:08:06 +00:00
|
|
|
return(QET::Icons::Settings);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-08-16 11:19:36 +02:00
|
|
|
@brief GeneralConfigurationPage::fillLang
|
|
|
|
fill all available lang
|
|
|
|
*/
|
2018-05-24 18:08:06 +00:00
|
|
|
void GeneralConfigurationPage::fillLang()
|
|
|
|
{
|
2020-09-07 22:03:40 +02:00
|
|
|
ui->m_lang_cb->addItem(QET::Icons::translation, tr("Système"), "system");
|
2018-05-24 18:08:06 +00:00
|
|
|
ui->m_lang_cb->insertSeparator(1);
|
|
|
|
|
|
|
|
// all lang available on lang directory
|
2021-01-30 10:22:07 +01:00
|
|
|
ui->m_lang_cb->addItem(QET::Icons::sa, tr("Arabe"), "ar");
|
2024-03-28 15:16:11 +01:00
|
|
|
ui->m_lang_cb->addItem(QET::Icons::br, tr("Brézilien"), "pt_BR");
|
2020-09-07 22:03:40 +02:00
|
|
|
ui->m_lang_cb->addItem(QET::Icons::catalonia, tr("Catalan"), "ca");
|
|
|
|
ui->m_lang_cb->addItem(QET::Icons::cs, tr("Tchèque"), "cs");
|
|
|
|
ui->m_lang_cb->addItem(QET::Icons::de, tr("Allemand"), "de");
|
|
|
|
ui->m_lang_cb->addItem(QET::Icons::da, tr("Danois"), "da");
|
|
|
|
ui->m_lang_cb->addItem(QET::Icons::gr, tr("Grec"), "el");
|
|
|
|
ui->m_lang_cb->addItem(QET::Icons::en, tr("Anglais"), "en");
|
|
|
|
ui->m_lang_cb->addItem(QET::Icons::es, tr("Espagnol"), "es");
|
|
|
|
ui->m_lang_cb->addItem(QET::Icons::fr, tr("Français"), "fr");
|
|
|
|
ui->m_lang_cb->addItem(QET::Icons::hr, tr("Croate"), "hr");
|
|
|
|
ui->m_lang_cb->addItem(QET::Icons::it, tr("Italien"), "it");
|
|
|
|
ui->m_lang_cb->addItem(QET::Icons::jp, tr("Japonais"), "ja");
|
|
|
|
ui->m_lang_cb->addItem(QET::Icons::pl, tr("Polonais"), "pl");
|
|
|
|
ui->m_lang_cb->addItem(QET::Icons::pt, tr("Portugais"), "pt");
|
|
|
|
ui->m_lang_cb->addItem(QET::Icons::ro, tr("Roumains"), "ro");
|
|
|
|
ui->m_lang_cb->addItem(QET::Icons::ru, tr("Russe"), "ru");
|
|
|
|
ui->m_lang_cb->addItem(QET::Icons::sl, tr("Slovène"), "sl");
|
|
|
|
ui->m_lang_cb->addItem(QET::Icons::nl, tr("Pays-Bas"), "nl");
|
|
|
|
ui->m_lang_cb->addItem(QET::Icons::no, tr("Norvege"), "nb");
|
2025-01-05 13:55:48 +01:00
|
|
|
ui->m_lang_cb->addItem(QET::Icons::nl_BE, tr("Belgique-Flemish"), "nl_BE");
|
2020-09-07 22:03:40 +02:00
|
|
|
ui->m_lang_cb->addItem(QET::Icons::tr, tr("Turc"), "tr");
|
|
|
|
ui->m_lang_cb->addItem(QET::Icons::hu, tr("Hongrois"), "hu");
|
2021-01-29 17:12:44 +01:00
|
|
|
ui->m_lang_cb->addItem(QET::Icons::mn, tr("Mongol"), "mn");
|
2022-12-19 13:04:19 +01:00
|
|
|
ui->m_lang_cb->addItem(QET::Icons::uk, tr("Ukrainien"), "uk");
|
2023-08-27 12:36:08 +02:00
|
|
|
ui->m_lang_cb->addItem(QET::Icons::zh, tr("Chinois"), "zh");
|
2024-09-08 16:01:20 +02:00
|
|
|
ui->m_lang_cb->addItem(QET::Icons::se, tr("Suédois"), "sv");
|
2018-05-24 18:08:06 +00:00
|
|
|
//set current index to the lang found in setting file
|
|
|
|
//if lang doesn't exist set to system
|
|
|
|
QSettings settings;
|
|
|
|
for (int i=0; i<ui->m_lang_cb->count(); i++)
|
|
|
|
{
|
|
|
|
if (ui->m_lang_cb->itemData(i).toString() == settings.value("lang").toString())
|
|
|
|
{
|
|
|
|
ui->m_lang_cb->setCurrentIndex(i);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ui->m_lang_cb->setCurrentIndex(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-08-16 11:19:36 +02:00
|
|
|
@brief GeneralConfigurationPage::on_m_font_pb_clicked
|
|
|
|
Apply font to config
|
|
|
|
*/
|
2018-05-24 18:08:06 +00:00
|
|
|
void GeneralConfigurationPage::on_m_font_pb_clicked()
|
|
|
|
{
|
|
|
|
bool ok;
|
|
|
|
QSettings settings;
|
2025-05-18 14:15:20 +02:00
|
|
|
QFont curFont = QFont(settings.value("diagramitemfont", "Liberation Sans").toString());
|
|
|
|
curFont.setPointSizeF(settings.value("diagramitemsize", "9").toInt());
|
|
|
|
curFont.setStyleName (settings.value("diagramitemstyle", "Regular").toString());
|
|
|
|
QFont font = QFontDialog::getFont(&ok, curFont, this);
|
2018-05-24 18:08:06 +00:00
|
|
|
if (ok)
|
|
|
|
{
|
|
|
|
settings.setValue("diagramitemfont", font.family());
|
|
|
|
settings.setValue("diagramitemsize", font.pointSize());
|
|
|
|
settings.setValue("diagramitemweight", font.weight());
|
|
|
|
settings.setValue("diagramitemstyle", font.styleName());
|
|
|
|
QString fontInfos = settings.value("diagramitemfont").toString() + " " +
|
2020-07-15 20:20:07 +02:00
|
|
|
settings.value("diagramitemsize").toString() + " (" +
|
|
|
|
settings.value("diagramitemstyle").toString() + ")";
|
|
|
|
ui->m_font_pb->setText(fontInfos);
|
2018-05-24 18:08:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-26 23:42:49 +00:00
|
|
|
/**
|
2020-08-16 11:19:36 +02:00
|
|
|
@brief GeneralConfigurationPage::m_dyn_text_font_pb_clicked
|
|
|
|
Apply font to config
|
|
|
|
*/
|
2019-03-08 20:07:00 +00:00
|
|
|
void GeneralConfigurationPage::on_m_dyn_text_font_pb_clicked()
|
2018-10-26 23:42:49 +00:00
|
|
|
{
|
|
|
|
bool ok;
|
|
|
|
QSettings settings;
|
2025-05-18 14:15:20 +02:00
|
|
|
QFont curFont;
|
|
|
|
curFont.fromString(settings.value("diagrameditor/dynamic_text_font", "Liberation Sans,9,-1,5,50,0,0,0,0,0,Regular").toString());
|
|
|
|
QFont font = QFontDialog::getFont(&ok, curFont, this);
|
2018-10-26 23:42:49 +00:00
|
|
|
if (ok)
|
|
|
|
{
|
2019-03-08 20:07:00 +00:00
|
|
|
settings.setValue("diagrameditor/dynamic_text_font", font.toString());
|
|
|
|
QString fontInfos = font.family() + " " +
|
|
|
|
QString::number(font.pointSize()) + " (" +
|
|
|
|
font.styleName() + ")";
|
|
|
|
ui->m_dyn_text_font_pb->setText(fontInfos);
|
2018-10-26 23:42:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-07-15 15:06:46 +02:00
|
|
|
|
2018-07-25 17:34:50 +00:00
|
|
|
|
|
|
|
void GeneralConfigurationPage::on_m_common_elmt_path_cb_currentIndexChanged(int index)
|
|
|
|
{
|
2020-07-15 20:20:07 +02:00
|
|
|
if (index == 1)
|
2018-07-25 17:34:50 +00:00
|
|
|
{
|
2025-01-28 19:01:32 +01:00
|
|
|
QString path = QFileDialog::getExistingDirectory(this, tr("Chemin de la collection commune"), QETApp::documentDir());
|
2018-07-25 17:34:50 +00:00
|
|
|
if (!path.isEmpty()) {
|
|
|
|
ui->m_common_elmt_path_cb->setItemData(1, path, Qt::DisplayRole);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
ui->m_common_elmt_path_cb->setCurrentIndex(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-12-09 12:02:04 +01:00
|
|
|
void GeneralConfigurationPage::on_m_company_elmt_path_cb_currentIndexChanged(int index)
|
|
|
|
{
|
|
|
|
if (index == 1)
|
|
|
|
{
|
2025-01-28 19:01:32 +01:00
|
|
|
QString path = QFileDialog::getExistingDirectory(this, tr("Chemin de la collection company"), QETApp::documentDir());
|
2023-12-09 12:02:04 +01:00
|
|
|
if (!path.isEmpty()) {
|
|
|
|
ui->m_company_elmt_path_cb->setItemData(1, path, Qt::DisplayRole);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
ui->m_company_elmt_path_cb->setCurrentIndex(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-25 17:34:50 +00:00
|
|
|
void GeneralConfigurationPage::on_m_custom_elmt_path_cb_currentIndexChanged(int index)
|
|
|
|
{
|
2020-07-15 20:20:07 +02:00
|
|
|
if (index == 1)
|
2018-07-25 17:34:50 +00:00
|
|
|
{
|
2025-01-28 19:01:32 +01:00
|
|
|
QString path = QFileDialog::getExistingDirectory(this, tr("Chemin de la collection utilisateur"), QETApp::documentDir());
|
2018-07-25 17:34:50 +00:00
|
|
|
if (!path.isEmpty()) {
|
|
|
|
ui->m_custom_elmt_path_cb->setItemData(1, path, Qt::DisplayRole);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
ui->m_custom_elmt_path_cb->setCurrentIndex(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-10-26 23:42:49 +00:00
|
|
|
|
2023-12-16 09:32:44 +01:00
|
|
|
void GeneralConfigurationPage::on_m_company_tbt_path_cb_currentIndexChanged(int index)
|
|
|
|
{
|
|
|
|
if (index == 1)
|
|
|
|
{
|
2025-01-28 19:01:32 +01:00
|
|
|
QString path = QFileDialog::getExistingDirectory(this, tr("Chemin des cartouches company"), QETApp::documentDir());
|
2023-12-16 09:32:44 +01:00
|
|
|
if (!path.isEmpty()) {
|
|
|
|
ui->m_company_tbt_path_cb->setItemData(1, path, Qt::DisplayRole);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
ui->m_company_tbt_path_cb->setCurrentIndex(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-11-25 09:55:11 +00:00
|
|
|
void GeneralConfigurationPage::on_m_custom_tbt_path_cb_currentIndexChanged(int index)
|
|
|
|
{
|
2020-07-15 20:20:07 +02:00
|
|
|
if (index == 1)
|
2018-11-25 09:55:11 +00:00
|
|
|
{
|
2025-01-28 19:01:32 +01:00
|
|
|
QString path = QFileDialog::getExistingDirectory(this, tr("Chemin des cartouches utilisateur"), QETApp::documentDir());
|
2018-11-25 09:55:11 +00:00
|
|
|
if (!path.isEmpty()) {
|
|
|
|
ui->m_custom_tbt_path_cb->setItemData(1, path, Qt::DisplayRole);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
ui->m_custom_tbt_path_cb->setCurrentIndex(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-03-08 20:07:00 +00:00
|
|
|
void GeneralConfigurationPage::on_m_indi_text_font_pb_clicked()
|
|
|
|
{
|
|
|
|
bool ok;
|
|
|
|
QSettings settings;
|
2025-05-18 14:15:20 +02:00
|
|
|
QFont curFont;
|
|
|
|
curFont.fromString(settings.value("diagrameditor/independent_text_font", "Liberation Sans,9,-1,5,50,0,0,0,0,0,Regular").toString());
|
|
|
|
QFont font = QFontDialog::getFont(&ok, curFont, this);
|
2019-03-08 20:07:00 +00:00
|
|
|
if (ok)
|
|
|
|
{
|
|
|
|
settings.setValue("diagrameditor/independent_text_font", font.toString());
|
|
|
|
QString fontInfos = font.family() + " " +
|
|
|
|
QString::number(font.pointSize()) + " (" +
|
|
|
|
font.styleName() + ")";
|
|
|
|
ui->m_indi_text_font_pb->setText(fontInfos);
|
|
|
|
}
|
|
|
|
}
|
2023-10-12 20:46:09 +02:00
|
|
|
|
|
|
|
void GeneralConfigurationPage::on_MaxPartsElementEditorList_sb_valueChanged(int value)
|
|
|
|
{
|
2024-04-24 18:02:00 +02:00
|
|
|
if (value > 500) {
|
|
|
|
ui->MaxPartsElementEditorList_sb->setToolTip(tr("To high values might lead to crashes of the application."));
|
|
|
|
ui->MaxPartsElementEditorList_sb->setStyleSheet("background-color: orange");
|
|
|
|
} else {
|
|
|
|
ui->MaxPartsElementEditorList_sb->setToolTip("");
|
|
|
|
ui->MaxPartsElementEditorList_sb->setStyleSheet("");
|
|
|
|
}
|
2023-10-12 20:46:09 +02:00
|
|
|
}
|
2025-03-07 20:16:21 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
@brief GeneralConfigurationPage::on_DiagramEditor_Grid_PointSize_min_sb_valueChanged
|
|
|
|
the min-value of the max-SpinBox has to be limited:
|
|
|
|
may not be smaller than current value of min-SpinBox
|
|
|
|
@param value - the new value of the min-SpinBox
|
|
|
|
*/
|
|
|
|
void GeneralConfigurationPage::on_DiagramEditor_Grid_PointSize_min_sb_valueChanged(int value)
|
|
|
|
{
|
|
|
|
ui->DiagramEditor_Grid_PointSize_max_sb->setMinimum(std::max(1, value));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
@brief GeneralConfigurationPage::on_ElementEditor_Grid_PointSize_min_sb_valueChanged
|
|
|
|
the min-value of the max-SpinBox has to be limited:
|
|
|
|
may not be smaller than current value of min-SpinBox
|
|
|
|
@param value - the new value of the min-SpinBox
|
|
|
|
*/
|
|
|
|
void GeneralConfigurationPage::on_ElementEditor_Grid_PointSize_min_sb_valueChanged(int value)
|
|
|
|
{
|
|
|
|
ui->ElementEditor_Grid_PointSize_max_sb->setMinimum(std::max(1, value));
|
|
|
|
}
|