mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-30 15:50:52 +01:00
Diagram editor, add two news feature:
1- QET create a backup file, use to restor the project when a crash occur 2- User can enable and edit autosave. git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5374 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
204
sources/ui/configpage/generalconfigurationpage.cpp
Normal file
204
sources/ui/configpage/generalconfigurationpage.cpp
Normal file
@@ -0,0 +1,204 @@
|
||||
/*
|
||||
Copyright 2006-2018 The QElectroTech Team
|
||||
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"
|
||||
#include "ui_generalconfigurationpage.h"
|
||||
#include "qeticons.h"
|
||||
#include "qetapp.h"
|
||||
|
||||
#include <QSettings>
|
||||
#include <QFontDialog>
|
||||
|
||||
/**
|
||||
* @brief GeneralConfigurationPage::GeneralConfigurationPage
|
||||
* @param parent
|
||||
*/
|
||||
GeneralConfigurationPage::GeneralConfigurationPage(QWidget *parent) :
|
||||
ConfigPage(parent),
|
||||
ui(new Ui::GeneralConfigurationPage)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
QSettings settings;
|
||||
|
||||
ui->m_use_system_color_cb->setChecked(settings.value("usesystemcolors", "true").toBool());
|
||||
bool tabbed = settings.value("diagrameditor/viewmode", "tabbed") == "tabbed";
|
||||
if(tabbed)
|
||||
ui->m_use_tab_mode_rb->setChecked(true);
|
||||
else
|
||||
ui->m_use_windows_mode_rb->setChecked(true);
|
||||
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());
|
||||
ui->m_autosave_sb->setValue(settings.value("diagrameditor/autosave-interval", 0).toInt());
|
||||
|
||||
QString fontInfos = settings.value("diagramitemfont").toString() + " " +
|
||||
settings.value("diagramitemsize").toString() + " (" +
|
||||
settings.value("diagramitemstyle").toString() + ")";
|
||||
ui->m_font_pb->setText(fontInfos);
|
||||
|
||||
QString foliolistfontInfos = settings.value("foliolistfont").toString() + " " +
|
||||
settings.value("foliolistsize").toString() + " (" +
|
||||
settings.value("folioliststyle").toString() + ")";
|
||||
ui->m_folio_list_pb->setText(foliolistfontInfos);
|
||||
|
||||
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());
|
||||
|
||||
fillLang();
|
||||
}
|
||||
|
||||
GeneralConfigurationPage::~GeneralConfigurationPage()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief GeneralConfigurationPage::applyConf
|
||||
* Write all configuration in settings file
|
||||
*/
|
||||
void GeneralConfigurationPage::applyConf()
|
||||
{
|
||||
QSettings settings;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
settings.setValue("lang", ui->m_lang_cb->itemData(ui->m_lang_cb->currentIndex()).toString());
|
||||
|
||||
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("elementeditor/default-informations", ui->m_default_elements_info->toPlainText());
|
||||
settings.setValue("diagramview/gestures", ui->m_use_gesture_trackpad->isChecked());
|
||||
settings.setValue("diagramcommands/erase-label-on-copy", ui->m_save_label_paste->isChecked());
|
||||
settings.setValue("diagrameditor/zoom-out-beyond-of-folio", ui->m_zoom_out_beyond_folio->isChecked());
|
||||
settings.setValue("genericpanel/folio",ui->m_use_folio_label->isChecked());
|
||||
settings.setValue("nomenclature/terminal-exportlist",ui->m_export_terminal->isChecked());
|
||||
settings.setValue("diagrameditor/autosave-interval", ui->m_autosave_sb->value());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief GeneralConfigurationPage::title
|
||||
* @return The title of this page
|
||||
*/
|
||||
QString GeneralConfigurationPage::title() const {
|
||||
return(tr("Général", "configuration page title"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief GeneralConfigurationPage::icon
|
||||
* @return The icon of this page
|
||||
*/
|
||||
QIcon GeneralConfigurationPage::icon() const {
|
||||
return(QET::Icons::Settings);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief GeneralConfigurationPage::fillLang
|
||||
* fill all available lang
|
||||
*/
|
||||
void GeneralConfigurationPage::fillLang()
|
||||
{
|
||||
ui->m_lang_cb->addItem(QET::Icons::translation, tr("Système"), "system");
|
||||
ui->m_lang_cb->insertSeparator(1);
|
||||
|
||||
// all lang available on lang directory
|
||||
ui->m_lang_cb->addItem(QET::Icons::ar, tr("Arabe"), "ar");
|
||||
ui->m_lang_cb->addItem(QET::Icons::br, tr("Brézilien"), "pt_br");
|
||||
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::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::be, tr("Belgique-Flemish"), "be");
|
||||
|
||||
//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);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief GeneralConfigurationPage::on_m_font_pb_clicked
|
||||
* Apply font to config
|
||||
*/
|
||||
void GeneralConfigurationPage::on_m_font_pb_clicked()
|
||||
{
|
||||
bool ok;
|
||||
QSettings settings;
|
||||
QFont font = QFontDialog::getFont(&ok, QFont("Sans Serif", 9), this);
|
||||
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() + " " +
|
||||
settings.value("diagramitemsize").toString() + " (" +
|
||||
settings.value("diagramitemstyle").toString() + ")";
|
||||
ui->m_font_pb->setText(fontInfos);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief GeneralConfigurationPage::on_m_folio_list_pb_clicked
|
||||
* Apply font to summary pages
|
||||
*/
|
||||
void GeneralConfigurationPage::on_m_folio_list_pb_clicked()
|
||||
{
|
||||
bool ok;
|
||||
QSettings settings;
|
||||
QFont font = QFontDialog::getFont(&ok, QFont("Sans Serif", 9), this);
|
||||
if (ok)
|
||||
{
|
||||
settings.setValue("foliolistfont", font.family());
|
||||
settings.setValue("foliolistsize", font.pointSize());
|
||||
settings.setValue("foliolistweight", font.weight());
|
||||
settings.setValue("folioliststyle", font.styleName());
|
||||
QString fontInfos = settings.value("foliolistfont").toString() + " " +
|
||||
settings.value("foliolistsize").toString() + " (" +
|
||||
settings.value("folioliststyle").toString() + ")";
|
||||
ui->m_folio_list_pb->setText(fontInfos);
|
||||
}
|
||||
}
|
||||
51
sources/ui/configpage/generalconfigurationpage.h
Normal file
51
sources/ui/configpage/generalconfigurationpage.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
Copyright 2006-2018 The QElectroTech Team
|
||||
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/>.
|
||||
*/
|
||||
#ifndef GENERALCONFIGURATIONPAGE_H
|
||||
#define GENERALCONFIGURATIONPAGE_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "configpage.h"
|
||||
|
||||
namespace Ui {
|
||||
class GeneralConfigurationPage;
|
||||
}
|
||||
|
||||
class GeneralConfigurationPage : public ConfigPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit GeneralConfigurationPage(QWidget *parent = 0);
|
||||
~GeneralConfigurationPage();
|
||||
|
||||
virtual void applyConf() override;
|
||||
virtual QString title() const override;
|
||||
virtual QIcon icon() const override;
|
||||
|
||||
private slots:
|
||||
void on_m_font_pb_clicked();
|
||||
void on_m_folio_list_pb_clicked();
|
||||
|
||||
private:
|
||||
void fillLang();
|
||||
|
||||
private:
|
||||
Ui::GeneralConfigurationPage *ui;
|
||||
};
|
||||
|
||||
#endif // GENERALCONFIGURATIONPAGE_H
|
||||
229
sources/ui/configpage/generalconfigurationpage.ui
Normal file
229
sources/ui/configpage/generalconfigurationpage.ui
Normal file
@@ -0,0 +1,229 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>GeneralConfigurationPage</class>
|
||||
<widget class="QWidget" name="GeneralConfigurationPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>827</width>
|
||||
<height>662</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Général</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Apparence</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="m_use_system_color_cb">
|
||||
<property name="text">
|
||||
<string>Utiliser les couleurs du système</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Projets</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="8" column="2">
|
||||
<widget class="QPushButton" name="m_font_pb">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Interval de la sauvegarde automatique (appliqué au prochain lancement de QElectroTech)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="2">
|
||||
<widget class="QPushButton" name="m_folio_list_pb">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QCheckBox" name="m_save_label_paste">
|
||||
<property name="text">
|
||||
<string>Ne pas conserver les labels des éléments lors des copier coller</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QRadioButton" name="m_use_tab_mode_rb">
|
||||
<property name="text">
|
||||
<string>Utilisé des onglets (appliqué au proc&hain lancement de QElectroTech)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="m_use_gesture_trackpad">
|
||||
<property name="text">
|
||||
<string>Utiliser les gestes du pavé tactile</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Police des champs textes des pages sommaires</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Police des champs de texte</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QCheckBox" name="m_export_terminal">
|
||||
<property name="text">
|
||||
<string>Exporter les bornes dans la nomenclature</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="2">
|
||||
<widget class="QSpinBox" name="m_autosave_sb">
|
||||
<property name="frame">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="specialValueText">
|
||||
<string>Désactivé</string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string comment="minute"> min</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QRadioButton" name="m_use_windows_mode_rb">
|
||||
<property name="text">
|
||||
<string>Utiliser des fenêtres (appliqué au prochain lancement de &QElectroTech)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="m_zoom_out_beyond_folio">
|
||||
<property name="text">
|
||||
<string>Autoriser le dézoom au delà du folio</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QCheckBox" name="m_use_folio_label">
|
||||
<property name="text">
|
||||
<string>Utiliser les labels de folio à la place de leurs ID</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
<string>Gestion des éléments</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="m_highlight_integrated_elements">
|
||||
<property name="text">
|
||||
<string>Mettre en valeur dans le panel les éléments fraîchement intégrés</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Chaque élément embarque des informations sur ses auteurs, sa licence, ou tout autre renseignement que vous jugerez utile dans un champ libre.
|
||||
Vous pouvez spécifier ici la valeur par défaut de ce champ pour les éléments que vous créerez :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="m_default_elements_info"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_4">
|
||||
<property name="title">
|
||||
<string>Langue</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QComboBox" name="m_lang_cb"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Appliqué au prochain lancement de QElectroTech</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Reference in New Issue
Block a user