mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-20 16:20:52 +01:00
Fix warning about QSettings: now QSettings use native format for windows osx and other unix. See Qt documentation for more information.
http://doc.qt.io/qt-5/qsettings.html#details git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4206 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -16,7 +16,6 @@
|
|||||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include "borderproperties.h"
|
#include "borderproperties.h"
|
||||||
#include "qetapp.h"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Constructeur. Initialise un objet BorderProperties avec les proprietes par
|
Constructeur. Initialise un objet BorderProperties avec les proprietes par
|
||||||
@@ -126,8 +125,9 @@ void BorderProperties::fromSettings(QSettings &settings, const QString &prefix)
|
|||||||
* @brief BorderProperties::defaultProperties
|
* @brief BorderProperties::defaultProperties
|
||||||
* @return the default properties stored in the setting file
|
* @return the default properties stored in the setting file
|
||||||
*/
|
*/
|
||||||
BorderProperties BorderProperties::defaultProperties() {
|
BorderProperties BorderProperties::defaultProperties()
|
||||||
QSettings &settings = QETApp::settings();
|
{
|
||||||
|
QSettings settings;
|
||||||
|
|
||||||
BorderProperties def;
|
BorderProperties def;
|
||||||
def.fromSettings(settings, "diagrameditor/default");
|
def.fromSettings(settings, "diagrameditor/default");
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include "conductorproperties.h"
|
#include "conductorproperties.h"
|
||||||
#include "qetapp.h"
|
#include <QPainter>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Constructeur par defaut
|
Constructeur par defaut
|
||||||
@@ -365,8 +365,9 @@ QString ConductorProperties::typeToString(ConductorType t) {
|
|||||||
* @brief ConductorProperties::defaultProperties
|
* @brief ConductorProperties::defaultProperties
|
||||||
* @return the default properties stored in the setting file
|
* @return the default properties stored in the setting file
|
||||||
*/
|
*/
|
||||||
ConductorProperties ConductorProperties::defaultProperties() {
|
ConductorProperties ConductorProperties::defaultProperties()
|
||||||
QSettings &settings = QETApp::settings();
|
{
|
||||||
|
QSettings settings;
|
||||||
|
|
||||||
ConductorProperties def;
|
ConductorProperties def;
|
||||||
def.fromSettings(settings, "diagrameditor/defaultconductor");
|
def.fromSettings(settings, "diagrameditor/defaultconductor");
|
||||||
|
|||||||
@@ -19,7 +19,6 @@
|
|||||||
#include "borderpropertieswidget.h"
|
#include "borderpropertieswidget.h"
|
||||||
#include "conductorpropertieswidget.h"
|
#include "conductorpropertieswidget.h"
|
||||||
#include "titleblockpropertieswidget.h"
|
#include "titleblockpropertieswidget.h"
|
||||||
#include "qetapp.h"
|
|
||||||
#include "bordertitleblock.h"
|
#include "bordertitleblock.h"
|
||||||
#include "qeticons.h"
|
#include "qeticons.h"
|
||||||
#include "exportpropertieswidget.h"
|
#include "exportpropertieswidget.h"
|
||||||
@@ -27,6 +26,7 @@
|
|||||||
#include "ui/xrefpropertieswidget.h"
|
#include "ui/xrefpropertieswidget.h"
|
||||||
#include "qetproject.h"
|
#include "qetproject.h"
|
||||||
#include "reportproperties.h"
|
#include "reportproperties.h"
|
||||||
|
#include "qetapp.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief NewDiagramPage::NewDiagramPage
|
* @brief NewDiagramPage::NewDiagramPage
|
||||||
@@ -135,7 +135,7 @@ void NewDiagramPage::applyConf() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else { //Else we save to the default value
|
} else { //Else we save to the default value
|
||||||
QSettings &settings = QETApp::settings();
|
QSettings settings;
|
||||||
|
|
||||||
// dimensions des nouveaux schemas
|
// dimensions des nouveaux schemas
|
||||||
bpw -> properties().toSettings(settings, "diagrameditor/default");
|
bpw -> properties().toSettings(settings, "diagrameditor/default");
|
||||||
@@ -182,10 +182,10 @@ QString NewDiagramPage::title() const {
|
|||||||
Constructeur
|
Constructeur
|
||||||
@param parent QWidget parent
|
@param parent QWidget parent
|
||||||
*/
|
*/
|
||||||
GeneralConfigurationPage::GeneralConfigurationPage(QWidget *parent) : ConfigPage(parent) {
|
GeneralConfigurationPage::GeneralConfigurationPage(QWidget *parent) : ConfigPage(parent)
|
||||||
|
{
|
||||||
// acces a la configuration de QElectroTech
|
//Conf of QElectroTech
|
||||||
QSettings &settings = QETApp::settings();
|
QSettings settings;
|
||||||
bool use_system_colors = settings.value("usesystemcolors", "true").toBool();
|
bool use_system_colors = settings.value("usesystemcolors", "true").toBool();
|
||||||
bool tabbed = settings.value("diagrameditor/viewmode", "tabbed") == "tabbed";
|
bool tabbed = settings.value("diagrameditor/viewmode", "tabbed") == "tabbed";
|
||||||
bool integrate_elements = settings.value("diagrameditor/integrate-elements", true).toBool();
|
bool integrate_elements = settings.value("diagrameditor/integrate-elements", true).toBool();
|
||||||
@@ -284,8 +284,9 @@ GeneralConfigurationPage::~GeneralConfigurationPage() {
|
|||||||
* @brief GeneralConfigurationPage::applyConf
|
* @brief GeneralConfigurationPage::applyConf
|
||||||
* Write all configuration in settings file
|
* Write all configuration in settings file
|
||||||
*/
|
*/
|
||||||
void GeneralConfigurationPage::applyConf() {
|
void GeneralConfigurationPage::applyConf()
|
||||||
QSettings &settings = QETApp::settings();
|
{
|
||||||
|
QSettings settings;
|
||||||
|
|
||||||
bool was_using_system_colors = settings.value("usesystemcolors", "true").toBool();
|
bool was_using_system_colors = settings.value("usesystemcolors", "true").toBool();
|
||||||
bool must_use_system_colors = use_system_colors_ -> isChecked();
|
bool must_use_system_colors = use_system_colors_ -> isChecked();
|
||||||
@@ -385,8 +386,9 @@ ExportConfigPage::~ExportConfigPage() {
|
|||||||
/**
|
/**
|
||||||
Applique la configuration de cette page
|
Applique la configuration de cette page
|
||||||
*/
|
*/
|
||||||
void ExportConfigPage::applyConf() {
|
void ExportConfigPage::applyConf()
|
||||||
QSettings &settings = QETApp::settings();
|
{
|
||||||
|
QSettings settings;
|
||||||
epw -> exportProperties().toSettings(settings, "export/default");
|
epw -> exportProperties().toSettings(settings, "export/default");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -430,12 +432,14 @@ PrintConfigPage::~PrintConfigPage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Applique la configuration de cette page
|
* @brief PrintConfigPage::applyConf
|
||||||
*/
|
* Apply the config of this page
|
||||||
void PrintConfigPage::applyConf() {
|
*/
|
||||||
|
void PrintConfigPage::applyConf()
|
||||||
|
{
|
||||||
QString prefix = "print/default";
|
QString prefix = "print/default";
|
||||||
|
|
||||||
QSettings &settings = QETApp::settings();
|
QSettings settings;
|
||||||
epw -> exportProperties().toSettings(settings, prefix);
|
epw -> exportProperties().toSettings(settings, prefix);
|
||||||
|
|
||||||
// annule l'enregistrement de certaines proprietes non pertinentes
|
// annule l'enregistrement de certaines proprietes non pertinentes
|
||||||
|
|||||||
@@ -29,7 +29,6 @@
|
|||||||
#include "exportdialog.h"
|
#include "exportdialog.h"
|
||||||
#include "qetgraphicsitem/ghostelement.h"
|
#include "qetgraphicsitem/ghostelement.h"
|
||||||
#include "qetgraphicsitem/independenttextitem.h"
|
#include "qetgraphicsitem/independenttextitem.h"
|
||||||
#include "qetapp.h"
|
|
||||||
#include "qetgraphicsitem/diagramimageitem.h"
|
#include "qetgraphicsitem/diagramimageitem.h"
|
||||||
#include "qetgraphicsitem/qetshapeitem.h"
|
#include "qetgraphicsitem/qetshapeitem.h"
|
||||||
#include "terminal.h"
|
#include "terminal.h"
|
||||||
@@ -137,7 +136,8 @@ void Diagram::drawBackground(QPainter *p, const QRectF &r) {
|
|||||||
p -> setBrush(Qt::NoBrush);
|
p -> setBrush(Qt::NoBrush);
|
||||||
|
|
||||||
//If user allow zoom out beyond of folio, we draw grid outside of border.
|
//If user allow zoom out beyond of folio, we draw grid outside of border.
|
||||||
QRectF rect = QETApp::settings().value("diagrameditor/zoom-out-beyond-of-folio", false).toBool() ?
|
QSettings settings;
|
||||||
|
QRectF rect = settings.value("diagrameditor/zoom-out-beyond-of-folio", false).toBool() ?
|
||||||
r :
|
r :
|
||||||
border_and_titleblock.insideBorderRect().intersected(r);
|
border_and_titleblock.insideBorderRect().intersected(r);
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,6 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "diagramschooser.h"
|
#include "diagramschooser.h"
|
||||||
#include "exportproperties.h"
|
#include "exportproperties.h"
|
||||||
#include "qetapp.h"
|
|
||||||
#include "qeticons.h"
|
#include "qeticons.h"
|
||||||
#include "qetmessagebox.h"
|
#include "qetmessagebox.h"
|
||||||
|
|
||||||
@@ -536,8 +535,9 @@ void DiagramPrintDialog::saveReloadDiagramParameters(Diagram *diagram, const Exp
|
|||||||
configuration. Key/values pairs are associated to the printer for which
|
configuration. Key/values pairs are associated to the printer for which
|
||||||
they have been set.
|
they have been set.
|
||||||
*/
|
*/
|
||||||
void DiagramPrintDialog::savePageSetupForCurrentPrinter() {
|
void DiagramPrintDialog::savePageSetupForCurrentPrinter()
|
||||||
QSettings &settings = QETApp::settings();
|
{
|
||||||
|
QSettings settings;
|
||||||
QString printer_section = settingsSectionName(printer_);
|
QString printer_section = settingsSectionName(printer_);
|
||||||
|
|
||||||
while (!settings.group().isEmpty()) settings.endGroup();
|
while (!settings.group().isEmpty()) settings.endGroup();
|
||||||
@@ -571,8 +571,9 @@ void DiagramPrintDialog::savePageSetupForCurrentPrinter() {
|
|||||||
Load parameters previously set in the "page setup" dialog for the current
|
Load parameters previously set in the "page setup" dialog for the current
|
||||||
printer, if any.
|
printer, if any.
|
||||||
*/
|
*/
|
||||||
void DiagramPrintDialog::loadPageSetupForCurrentPrinter() {
|
void DiagramPrintDialog::loadPageSetupForCurrentPrinter()
|
||||||
QSettings &settings = QETApp::settings();
|
{
|
||||||
|
QSettings settings;
|
||||||
QString printer_section = settingsSectionName(printer_);
|
QString printer_section = settingsSectionName(printer_);
|
||||||
|
|
||||||
while (!settings.group().isEmpty()) settings.endGroup();
|
while (!settings.group().isEmpty()) settings.endGroup();
|
||||||
|
|||||||
@@ -359,8 +359,10 @@ void DiagramView::zoomIn() {
|
|||||||
* If zoom-out-beyond-of-folio is true in common setting, the zoom out is infinite
|
* If zoom-out-beyond-of-folio is true in common setting, the zoom out is infinite
|
||||||
* else zoom out is stopped when the entire folio is visible.
|
* else zoom out is stopped when the entire folio is visible.
|
||||||
*/
|
*/
|
||||||
void DiagramView::zoomOut() {
|
void DiagramView::zoomOut()
|
||||||
if (QETApp::settings().value("diagrameditor/zoom-out-beyond-of-folio", false).toBool() ||
|
{
|
||||||
|
QSettings settings;
|
||||||
|
if (settings.value("diagrameditor/zoom-out-beyond-of-folio", false).toBool() ||
|
||||||
(horizontalScrollBar()->maximum() || verticalScrollBar()->maximum()) )
|
(horizontalScrollBar()->maximum() || verticalScrollBar()->maximum()) )
|
||||||
scale(0.85, 0.85);
|
scale(0.85, 0.85);
|
||||||
|
|
||||||
@@ -380,8 +382,10 @@ void DiagramView::zoomInSlowly() {
|
|||||||
* @brief DiagramView::zoomOutSlowly
|
* @brief DiagramView::zoomOutSlowly
|
||||||
* Like zoomOut but more slowly
|
* Like zoomOut but more slowly
|
||||||
*/
|
*/
|
||||||
void DiagramView::zoomOutSlowly() {
|
void DiagramView::zoomOutSlowly()
|
||||||
if (QETApp::settings().value("diagrameditor/zoom-out-beyond-of-folio", false).toBool() ||
|
{
|
||||||
|
QSettings settings;
|
||||||
|
if (settings.value("diagrameditor/zoom-out-beyond-of-folio", false).toBool() ||
|
||||||
(horizontalScrollBar()->maximum() || verticalScrollBar()->maximum()) )
|
(horizontalScrollBar()->maximum() || verticalScrollBar()->maximum()) )
|
||||||
scale(0.98, 0.98);
|
scale(0.98, 0.98);
|
||||||
|
|
||||||
@@ -555,8 +559,10 @@ void DiagramView::mouseReleaseEvent(QMouseEvent *e) {
|
|||||||
* @brief DiagramView::gestures
|
* @brief DiagramView::gestures
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
bool DiagramView::gestures() const {
|
bool DiagramView::gestures() const
|
||||||
return(QETApp::settings().value("diagramview/gestures", false).toBool());
|
{
|
||||||
|
QSettings settings;
|
||||||
|
return(settings.value("diagramview/gestures", false).toBool());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -399,8 +399,10 @@ void ElementView::mouseReleaseEvent(QMouseEvent *e) {
|
|||||||
* @brief ElementView::gestures
|
* @brief ElementView::gestures
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
bool ElementView::gestures() const {
|
bool ElementView::gestures() const
|
||||||
return(QETApp::settings().value("diagramview/gestures", false).toBool());
|
{
|
||||||
|
QSettings settings;
|
||||||
|
return(settings.value("diagramview/gestures", false).toBool());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1356,9 +1356,13 @@ void QETElementEditor::slot_updateSelectionFromPartsList() {
|
|||||||
slot_updateMenus();
|
slot_updateMenus();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Lit les parametres de l'editeur d'element
|
/**
|
||||||
void QETElementEditor::readSettings() {
|
* @brief QETElementEditor::readSettings
|
||||||
QSettings &settings = QETApp::settings();
|
* Read settings
|
||||||
|
*/
|
||||||
|
void QETElementEditor::readSettings()
|
||||||
|
{
|
||||||
|
QSettings settings;
|
||||||
|
|
||||||
// dimensions et position de la fenetre
|
// dimensions et position de la fenetre
|
||||||
QVariant geometry = settings.value("elementeditor/geometry");
|
QVariant geometry = settings.value("elementeditor/geometry");
|
||||||
@@ -1372,9 +1376,13 @@ void QETElementEditor::readSettings() {
|
|||||||
ce_scene -> setInformations(settings.value("elementeditor/default-informations", "").toString());
|
ce_scene -> setInformations(settings.value("elementeditor/default-informations", "").toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Enregistre les parametres de l'editeur d'element
|
/**
|
||||||
void QETElementEditor::writeSettings() {
|
* @brief QETElementEditor::writeSettings
|
||||||
QSettings &settings = QETApp::settings();
|
* Write the settings
|
||||||
|
*/
|
||||||
|
void QETElementEditor::writeSettings()
|
||||||
|
{
|
||||||
|
QSettings settings;
|
||||||
settings.setValue("elementeditor/geometry", saveGeometry());
|
settings.setValue("elementeditor/geometry", saveGeometry());
|
||||||
settings.setValue("elementeditor/state", saveState());
|
settings.setValue("elementeditor/state", saveState());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -560,8 +560,10 @@ int ElementsPanel::elementsCollectionItemsCount() {
|
|||||||
/**
|
/**
|
||||||
@return true if freshly integrated elements should be highlighted, false otherwise.
|
@return true if freshly integrated elements should be highlighted, false otherwise.
|
||||||
*/
|
*/
|
||||||
bool ElementsPanel::mustHighlightIntegratedElements() const {
|
bool ElementsPanel::mustHighlightIntegratedElements() const
|
||||||
return(QETApp::settings().value("diagrameditor/highlight-integrated-elements", true).toBool());
|
{
|
||||||
|
QSettings settings;
|
||||||
|
return(settings.value("diagrameditor/highlight-integrated-elements", true).toBool());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include "exportproperties.h"
|
#include "exportproperties.h"
|
||||||
#include "qetapp.h"
|
|
||||||
|
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
|
|
||||||
@@ -87,8 +86,9 @@ void ExportProperties::fromSettings(QSettings &settings, const QString &prefix)
|
|||||||
* @brief ExportProperties::defaultProperties
|
* @brief ExportProperties::defaultProperties
|
||||||
* @return the default properties stored in the setting file
|
* @return the default properties stored in the setting file
|
||||||
*/
|
*/
|
||||||
ExportProperties ExportProperties::defaultExportProperties() {
|
ExportProperties ExportProperties::defaultExportProperties()
|
||||||
QSettings &settings = QETApp::settings();
|
{
|
||||||
|
QSettings settings;
|
||||||
|
|
||||||
ExportProperties def;
|
ExportProperties def;
|
||||||
def.fromSettings(settings, "export/default");
|
def.fromSettings(settings, "export/default");
|
||||||
@@ -100,8 +100,9 @@ ExportProperties ExportProperties::defaultExportProperties() {
|
|||||||
* @brief ExportProperties::defaultPrintProperties
|
* @brief ExportProperties::defaultPrintProperties
|
||||||
* @return the default properties stored in the setting file
|
* @return the default properties stored in the setting file
|
||||||
*/
|
*/
|
||||||
ExportProperties ExportProperties::defaultPrintProperties() {
|
ExportProperties ExportProperties::defaultPrintProperties()
|
||||||
QSettings &settings = QETApp::settings();
|
{
|
||||||
|
QSettings settings;
|
||||||
|
|
||||||
ExportProperties def;
|
ExportProperties def;
|
||||||
def.fromSettings(settings, "print/default");
|
def.fromSettings(settings, "print/default");
|
||||||
|
|||||||
@@ -16,12 +16,20 @@
|
|||||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include "qetapp.h"
|
#include "qetapp.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Fonction principale du programme QElectroTech
|
* @brief main
|
||||||
@param argc nombre de parametres
|
* Main function of QElectroTech
|
||||||
@param argv parametres
|
* @param argc : number of paramètres
|
||||||
*/
|
* @param argv : paramètres
|
||||||
int main(int argc, char **argv) {
|
* @return
|
||||||
// Creation et execution de l'application
|
*/
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
//Some setup, notably to use with QSetting.
|
||||||
|
QCoreApplication::setOrganizationName("QElectroTech");
|
||||||
|
QCoreApplication::setOrganizationDomain("qelectrotech.org");
|
||||||
|
QCoreApplication::setApplicationName("QElectroTech");
|
||||||
|
//Creation and execution of the application
|
||||||
return(QETApp(argc, argv).exec());
|
return(QETApp(argc, argv).exec());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include "reportproperties.h"
|
#include "reportproperties.h"
|
||||||
#include "qetapp.h"
|
#include <QSettings>
|
||||||
|
|
||||||
ReportProperties::ReportProperties()
|
ReportProperties::ReportProperties()
|
||||||
{}
|
{}
|
||||||
@@ -25,7 +25,8 @@ ReportProperties::ReportProperties()
|
|||||||
* @brief ReportProperties::defaultProperties
|
* @brief ReportProperties::defaultProperties
|
||||||
* @return the default properties stored in the setting file
|
* @return the default properties stored in the setting file
|
||||||
*/
|
*/
|
||||||
QString ReportProperties::defaultProperties() {
|
QString ReportProperties::defaultProperties()
|
||||||
QSettings &settings= QETApp::settings();
|
{
|
||||||
|
QSettings settings;
|
||||||
return(settings.value("diagrameditor/defaultreportlabel", "%f-%l%c").toString());
|
return(settings.value("diagrameditor/defaultreportlabel", "%f-%l%c").toString());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,15 +103,19 @@ void XRefProperties::fromXml(const QDomElement &xml_element) {
|
|||||||
* For coil, stored with the string "coil" in the returned QHash.
|
* For coil, stored with the string "coil" in the returned QHash.
|
||||||
* For protection, stored with the string "protection" in the returned QHash.
|
* For protection, stored with the string "protection" in the returned QHash.
|
||||||
*/
|
*/
|
||||||
QHash<QString, XRefProperties> XRefProperties::defaultProperties() {
|
QHash<QString, XRefProperties> XRefProperties::defaultProperties()
|
||||||
|
{
|
||||||
QHash <QString, XRefProperties> hash;
|
QHash <QString, XRefProperties> hash;
|
||||||
QStringList keys;
|
QStringList keys;
|
||||||
keys << "coil" << "protection" << "commutator";
|
keys << "coil" << "protection" << "commutator";
|
||||||
|
|
||||||
foreach (QString key, keys) {
|
QSettings settings;
|
||||||
|
|
||||||
|
foreach (QString key, keys)
|
||||||
|
{
|
||||||
XRefProperties properties;
|
XRefProperties properties;
|
||||||
QString str("diagrameditor/defaultxref");
|
QString str("diagrameditor/defaultxref");
|
||||||
properties.fromSettings(QETApp::settings(), str += key);
|
properties.fromSettings(settings, str += key);
|
||||||
hash.insert(key, properties);
|
hash.insert(key, properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -189,8 +189,10 @@ void QETApp::setLanguage(const QString &desired_language) {
|
|||||||
* @return the langage found in setting file
|
* @return the langage found in setting file
|
||||||
* if nothing was found return the system local.
|
* if nothing was found return the system local.
|
||||||
*/
|
*/
|
||||||
QString QETApp::langFromSetting() {
|
QString QETApp::langFromSetting()
|
||||||
QString system_language = settings().value("lang", "system").toString();
|
{
|
||||||
|
QSettings settings;
|
||||||
|
QString system_language = settings.value("lang", "system").toString();
|
||||||
if(system_language == "system") {system_language = QLocale::system().name().left(2);}
|
if(system_language == "system") {system_language = QLocale::system().name().left(2);}
|
||||||
return system_language;
|
return system_language;
|
||||||
}
|
}
|
||||||
@@ -742,20 +744,19 @@ bool QETApp::closeEveryEditor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@param size taille voulue - si aucune taille n'est specifiee, la valeur
|
* @brief QETApp::diagramTextsFont
|
||||||
specifiee dans la configuration (diagramsize) est utilisee. La valeur par
|
* The font to use
|
||||||
defaut est 9.
|
* By default the font is "sans Serif" and size 9.
|
||||||
@return la police a utiliser pour rendre les textes sur les schemas
|
* @param size : the size of font
|
||||||
La famille "Sans Serif" est utilisee par defaut mais peut etre surchargee
|
* @return the font to use
|
||||||
dans la configuration (diagramfont).
|
*/
|
||||||
*/
|
QFont QETApp::diagramTextsFont(qreal size)
|
||||||
QFont QETApp::diagramTextsFont(qreal size) {
|
{
|
||||||
// acces a la configuration de l'application
|
QSettings settings;
|
||||||
QSettings &qet_settings = QETApp::settings();
|
|
||||||
|
|
||||||
// police a utiliser pour le rendu de texte
|
//Font to use
|
||||||
QString diagram_texts_family = qet_settings.value("diagramfont", "Sans Serif").toString();
|
QString diagram_texts_family = settings.value("diagramfont", "Sans Serif").toString();
|
||||||
qreal diagram_texts_size = qet_settings.value("diagramsize", 9.0).toDouble();
|
qreal diagram_texts_size = settings.value("diagramsize", 9.0).toDouble();
|
||||||
|
|
||||||
if (size != -1.0) {
|
if (size != -1.0) {
|
||||||
diagram_texts_size = size;
|
diagram_texts_size = size;
|
||||||
@@ -1379,8 +1380,9 @@ void QETApp::initLanguage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Met en place tout ce qui concerne le style graphique de l'application
|
* @brief QETApp::initStyle
|
||||||
*/
|
* Setup the gui style
|
||||||
|
*/
|
||||||
void QETApp::initStyle() {
|
void QETApp::initStyle() {
|
||||||
initial_palette_ = palette();
|
initial_palette_ = palette();
|
||||||
|
|
||||||
@@ -1389,9 +1391,9 @@ void QETApp::initStyle() {
|
|||||||
// if (qobject_cast<QPlastiqueStyle *>(style())) {
|
// if (qobject_cast<QPlastiqueStyle *>(style())) {
|
||||||
// setStyle(new QETStyle());
|
// setStyle(new QETStyle());
|
||||||
// }
|
// }
|
||||||
|
//Apply or not the system style
|
||||||
// applique ou non les couleurs de l'environnement
|
QSettings settings;
|
||||||
useSystemPalette(settings().value("usesystemcolors", true).toBool());
|
useSystemPalette(settings.value("usesystemcolors", true).toBool());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1412,9 +1414,6 @@ void QETApp::initConfiguration() {
|
|||||||
QDir custom_tbt_dir(QETApp::customTitleBlockTemplatesDir());
|
QDir custom_tbt_dir(QETApp::customTitleBlockTemplatesDir());
|
||||||
if (!custom_tbt_dir.exists()) custom_tbt_dir.mkpath(QETApp::customTitleBlockTemplatesDir());
|
if (!custom_tbt_dir.exists()) custom_tbt_dir.mkpath(QETApp::customTitleBlockTemplatesDir());
|
||||||
|
|
||||||
// lit le fichier de configuration
|
|
||||||
qet_settings = new QSettings(configDir() + "qelectrotech.conf", QSettings::IniFormat, this);
|
|
||||||
|
|
||||||
// fichiers recents
|
// fichiers recents
|
||||||
// note : les icones doivent etre initialisees avant ces instructions (qui creent des menus en interne)
|
// note : les icones doivent etre initialisees avant ces instructions (qui creent des menus en interne)
|
||||||
projects_recent_files_ = new RecentFiles("projects");
|
projects_recent_files_ = new RecentFiles("projects");
|
||||||
@@ -1694,11 +1693,6 @@ void QETApp::printLicense() {
|
|||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
|
|
||||||
/// @return une reference vers les parametres de QElectroTEch
|
|
||||||
QSettings &QETApp::settings() {
|
|
||||||
return(*(instance() -> qet_settings));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@param location adresse virtuelle d'un item (collection, categorie, element, ...)
|
@param location adresse virtuelle d'un item (collection, categorie, element, ...)
|
||||||
@param prefer_collections true pour renvoyer la collection lorsque le
|
@param prefer_collections true pour renvoyer la collection lorsque le
|
||||||
|
|||||||
@@ -93,7 +93,6 @@ class QETApp : public QETSingleApplication {
|
|||||||
static QETProject *project(const uint &);
|
static QETProject *project(const uint &);
|
||||||
static int projectId(const QETProject *);
|
static int projectId(const QETProject *);
|
||||||
static QString configDir();
|
static QString configDir();
|
||||||
static QSettings &settings();
|
|
||||||
static QString languagesPath();
|
static QString languagesPath();
|
||||||
static QString realPath(const QString &);
|
static QString realPath(const QString &);
|
||||||
static QString symbolicPath(const QString &);
|
static QString symbolicPath(const QString &);
|
||||||
@@ -165,7 +164,6 @@ class QETApp : public QETSingleApplication {
|
|||||||
bool every_template_reduced;
|
bool every_template_reduced;
|
||||||
bool every_template_visible;
|
bool every_template_visible;
|
||||||
QSignalMapper signal_map;
|
QSignalMapper signal_map;
|
||||||
QSettings *qet_settings;
|
|
||||||
QETArguments qet_arguments_; ///< Comand-line arguments parser
|
QETArguments qet_arguments_; ///< Comand-line arguments parser
|
||||||
bool non_interactive_execution_; ///< Whether the application will end without any user interaction
|
bool non_interactive_execution_; ///< Whether the application will end without any user interaction
|
||||||
QPalette initial_palette_; ///< System color palette
|
QPalette initial_palette_; ///< System color palette
|
||||||
|
|||||||
@@ -1666,9 +1666,13 @@ void QETDiagramEditor::setTabbedMode() {
|
|||||||
slot_updateWindowsMenu();
|
slot_updateWindowsMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Lit les parametres de l'editeur de schemas
|
/**
|
||||||
void QETDiagramEditor::readSettings() {
|
* @brief QETDiagramEditor::readSettings
|
||||||
QSettings &settings = QETApp::settings();
|
* Read the settings
|
||||||
|
*/
|
||||||
|
void QETDiagramEditor::readSettings()
|
||||||
|
{
|
||||||
|
QSettings settings;
|
||||||
|
|
||||||
// dimensions et position de la fenetre
|
// dimensions et position de la fenetre
|
||||||
QVariant geometry = settings.value("diagrameditor/geometry");
|
QVariant geometry = settings.value("diagrameditor/geometry");
|
||||||
@@ -1687,9 +1691,13 @@ void QETDiagramEditor::readSettings() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Enregistre les parametres de l'editeur de schemas
|
/**
|
||||||
void QETDiagramEditor::writeSettings() {
|
* @brief QETDiagramEditor::writeSettings
|
||||||
QSettings &settings = QETApp::settings();
|
* Write the settings
|
||||||
|
*/
|
||||||
|
void QETDiagramEditor::writeSettings()
|
||||||
|
{
|
||||||
|
QSettings settings;
|
||||||
settings.setValue("diagrameditor/geometry", saveGeometry());
|
settings.setValue("diagrameditor/geometry", saveGeometry());
|
||||||
settings.setValue("diagrameditor/state", saveState());
|
settings.setValue("diagrameditor/state", saveState());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include "element.h"
|
#include "element.h"
|
||||||
#include "qetapp.h"
|
|
||||||
#include "diagram.h"
|
#include "diagram.h"
|
||||||
#include "conductor.h"
|
#include "conductor.h"
|
||||||
#include "elementtextitem.h"
|
#include "elementtextitem.h"
|
||||||
@@ -89,16 +88,18 @@ void Element::displayHelpLine(bool b)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Methode principale de dessin de l'element
|
* @brief Element::paint
|
||||||
@param painter Le QPainter utilise pour dessiner l'elment
|
* @param painter
|
||||||
@param options Les options de style a prendre en compte
|
* @param options
|
||||||
@param widget Le widget sur lequel on dessine
|
* @param widget
|
||||||
*/
|
*/
|
||||||
void Element::paint(QPainter *painter, const QStyleOptionGraphicsItem *options, QWidget *widget) {
|
void Element::paint(QPainter *painter, const QStyleOptionGraphicsItem *options, QWidget *widget)
|
||||||
|
{
|
||||||
|
|
||||||
#ifndef Q_OS_WIN
|
#ifndef Q_OS_WIN
|
||||||
// corrige un bug de rendu ne se produisant que lors du rendu sur QGraphicsScene sous X11 au zoom par defaut
|
//Fix visual bug on QGraphicsScene that occur only on X11 with default zoom.
|
||||||
static bool must_correct_rendering_bug = QETApp::settings().value("correct-rendering", false).toBool();
|
QSettings settings;
|
||||||
|
static bool must_correct_rendering_bug = settings.value("correct-rendering", false).toBool();
|
||||||
if (must_correct_rendering_bug) {
|
if (must_correct_rendering_bug) {
|
||||||
Diagram *dia = diagram();
|
Diagram *dia = diagram();
|
||||||
if (dia && options -> levelOfDetail == 1.0 && widget) {
|
if (dia && options -> levelOfDetail == 1.0 && widget) {
|
||||||
|
|||||||
@@ -20,7 +20,6 @@
|
|||||||
#include "qetgraphicsitem/element.h"
|
#include "qetgraphicsitem/element.h"
|
||||||
#include "qetgraphicsitem/conductor.h"
|
#include "qetgraphicsitem/conductor.h"
|
||||||
#include "diagramcommands.h"
|
#include "diagramcommands.h"
|
||||||
#include "qetapp.h"
|
|
||||||
#include "conductorautonumerotation.h"
|
#include "conductorautonumerotation.h"
|
||||||
|
|
||||||
QColor Terminal::neutralColor = QColor(Qt::blue);
|
QColor Terminal::neutralColor = QColor(Qt::blue);
|
||||||
@@ -229,8 +228,9 @@ void Terminal::paint(QPainter *p, const QStyleOptionGraphicsItem *options, QWidg
|
|||||||
p -> save();
|
p -> save();
|
||||||
|
|
||||||
#ifndef Q_OS_WIN
|
#ifndef Q_OS_WIN
|
||||||
// corrige un bug de rendu ne se produisant que lors du rendu sur QGraphicsScene sous X11 au zoom par defaut
|
//Fix visual bug on QGraphicsScene that occur only on X11 with default zoom.
|
||||||
static bool must_correct_rendering_bug = QETApp::settings().value("correct-rendering", false).toBool();
|
QSettings settings;
|
||||||
|
static bool must_correct_rendering_bug = settings.value("correct-rendering", false).toBool();
|
||||||
if (must_correct_rendering_bug) {
|
if (must_correct_rendering_bug) {
|
||||||
Diagram *dia = diagram();
|
Diagram *dia = diagram();
|
||||||
if (dia && options -> levelOfDetail == 1.0 && widget) {
|
if (dia && options -> levelOfDetail == 1.0 && widget) {
|
||||||
|
|||||||
@@ -179,7 +179,8 @@ QETProject::~QETProject() {
|
|||||||
bool QETProject::integrateElementToProject(const ElementsLocation &location, const QETProject *project)
|
bool QETProject::integrateElementToProject(const ElementsLocation &location, const QETProject *project)
|
||||||
{
|
{
|
||||||
//Integration element must be enable
|
//Integration element must be enable
|
||||||
bool auto_integration_enabled = QETApp::settings().value("diagrameditor/integrate-elements", true).toBool();
|
QSettings settings;
|
||||||
|
bool auto_integration_enabled = settings.value("diagrameditor/integrate-elements", true).toBool();
|
||||||
|
|
||||||
//the element belongs there a project and if so, is this another project of the project given by parameter?
|
//the element belongs there a project and if so, is this another project of the project given by parameter?
|
||||||
bool elmt_from_project = location.project();
|
bool elmt_from_project = location.project();
|
||||||
|
|||||||
@@ -16,8 +16,8 @@
|
|||||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include "recentfiles.h"
|
#include "recentfiles.h"
|
||||||
#include "qetapp.h"
|
|
||||||
#include "qeticons.h"
|
#include "qeticons.h"
|
||||||
|
#include <QMenu>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Constructeur
|
Constructeur
|
||||||
@@ -111,16 +111,20 @@ void RecentFiles::fileWasOpened(const QString &filepath) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Lit la liste des fichiers recents dans la configuration
|
* @brief RecentFiles::extractFilesFromSettings
|
||||||
*/
|
* Read the list of recent file from settings
|
||||||
void RecentFiles::extractFilesFromSettings() {
|
*/
|
||||||
// oublie la liste des fichiers recents
|
void RecentFiles::extractFilesFromSettings()
|
||||||
|
{
|
||||||
|
//Forget the list of recent files
|
||||||
list_.clear();
|
list_.clear();
|
||||||
|
|
||||||
// recupere les derniers fichiers ouverts dans la configuration
|
//Get the last opened file from the settings
|
||||||
for (int i = size_ ; i >= 1 ; -- i) {
|
QSettings settings;
|
||||||
|
for (int i = size_ ; i >= 1 ; -- i)
|
||||||
|
{
|
||||||
QString key(identifier_ + "-recentfiles/file" + QString::number(i));
|
QString key(identifier_ + "-recentfiles/file" + QString::number(i));
|
||||||
QString value(QETApp::settings().value(key, QString()).toString());
|
QString value(settings.value(key, QString()).toString());
|
||||||
insertFile(value);
|
insertFile(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -144,12 +148,16 @@ void RecentFiles::insertFile(const QString &filepath) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Ecrit la liste des fichiers recents dans la configuration
|
* @brief RecentFiles::saveFilesToSettings
|
||||||
*/
|
* Write the list of recent files to settings
|
||||||
void RecentFiles::saveFilesToSettings() {
|
*/
|
||||||
for (int i = 0 ; i < size_ && i < list_.count() ; ++ i) {
|
void RecentFiles::saveFilesToSettings()
|
||||||
|
{
|
||||||
|
QSettings settings;
|
||||||
|
for (int i = 0 ; i < size_ && i < list_.count() ; ++ i)
|
||||||
|
{
|
||||||
QString key(identifier_ + "-recentfiles/file" + QString::number(i + 1));
|
QString key(identifier_ + "-recentfiles/file" + QString::number(i + 1));
|
||||||
QETApp::settings().setValue(key, list_[i]);
|
settings.setValue(key, list_[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -467,8 +467,9 @@ void QETTitleBlockTemplateEditor::initToolbars() {
|
|||||||
/**
|
/**
|
||||||
Initialize layouts and widgets
|
Initialize layouts and widgets
|
||||||
*/
|
*/
|
||||||
void QETTitleBlockTemplateEditor::initWidgets() {
|
void QETTitleBlockTemplateEditor::initWidgets()
|
||||||
QSettings &settings = QETApp::settings();
|
{
|
||||||
|
QSettings settings;
|
||||||
|
|
||||||
// undo list on the right
|
// undo list on the right
|
||||||
undo_stack_ = new QUndoStack(this);
|
undo_stack_ = new QUndoStack(this);
|
||||||
@@ -579,10 +580,12 @@ QString QETTitleBlockTemplateEditor::currentlyEditedTitle() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Load template editor-related parameters.
|
* @brief QETTitleBlockTemplateEditor::readSettings
|
||||||
*/
|
* Read settings
|
||||||
void QETTitleBlockTemplateEditor::readSettings() {
|
*/
|
||||||
QSettings &settings = QETApp::settings();
|
void QETTitleBlockTemplateEditor::readSettings()
|
||||||
|
{
|
||||||
|
QSettings settings;
|
||||||
|
|
||||||
// window size and position
|
// window size and position
|
||||||
QVariant geometry = settings.value("titleblocktemplateeditor/geometry");
|
QVariant geometry = settings.value("titleblocktemplateeditor/geometry");
|
||||||
@@ -594,10 +597,12 @@ void QETTitleBlockTemplateEditor::readSettings() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Save template editor-related parameters.
|
* @brief QETTitleBlockTemplateEditor::writeSettings
|
||||||
*/
|
* Write the settings
|
||||||
void QETTitleBlockTemplateEditor::writeSettings() {
|
*/
|
||||||
QSettings &settings = QETApp::settings();
|
void QETTitleBlockTemplateEditor::writeSettings()
|
||||||
|
{
|
||||||
|
QSettings settings;
|
||||||
settings.setValue("titleblocktemplateeditor/geometry", saveGeometry());
|
settings.setValue("titleblocktemplateeditor/geometry", saveGeometry());
|
||||||
settings.setValue("titleblocktemplateeditor/state", saveState());
|
settings.setValue("titleblocktemplateeditor/state", saveState());
|
||||||
}
|
}
|
||||||
@@ -898,13 +903,16 @@ void QETTitleBlockTemplateEditor::quit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Save the new preview width to application settings
|
* @brief QETTitleBlockTemplateEditor::savePreviewWidthToApplicationSettings
|
||||||
@param former_preview_width Unused, former preview width
|
* Save the new preview width to application settings
|
||||||
@param new_preview_width New preview width
|
* @param former_preview_width : former_preview_width Unused, former preview width
|
||||||
*/
|
* @param new_preview_width : new_preview_width New preview width
|
||||||
void QETTitleBlockTemplateEditor::savePreviewWidthToApplicationSettings(int former_preview_width, int new_preview_width) {
|
*/
|
||||||
|
void QETTitleBlockTemplateEditor::savePreviewWidthToApplicationSettings(int former_preview_width, int new_preview_width)
|
||||||
|
{
|
||||||
Q_UNUSED(former_preview_width)
|
Q_UNUSED(former_preview_width)
|
||||||
QETApp::settings().setValue("titleblocktemplateeditor/preview_width", new_preview_width);
|
QSettings settings;
|
||||||
|
settings.setValue("titleblocktemplateeditor/preview_width", new_preview_width);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -154,8 +154,9 @@ void TitleBlockProperties::fromSettings(QSettings &settings, const QString &pref
|
|||||||
* @brief TitleBlockProperties::defaultProperties
|
* @brief TitleBlockProperties::defaultProperties
|
||||||
* Return the default properties stored in the setting file
|
* Return the default properties stored in the setting file
|
||||||
*/
|
*/
|
||||||
TitleBlockProperties TitleBlockProperties::defaultProperties() {
|
TitleBlockProperties TitleBlockProperties::defaultProperties()
|
||||||
QSettings &settings = QETApp::settings();
|
{
|
||||||
|
QSettings settings;
|
||||||
|
|
||||||
TitleBlockProperties def;
|
TitleBlockProperties def;
|
||||||
def.fromSettings(settings, "diagrameditor/default");
|
def.fromSettings(settings, "diagrameditor/default");
|
||||||
|
|||||||
Reference in New Issue
Block a user