[qet] [4206] Fix warning about QSettings: now QSettings use native format for windows osx and other unix. |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 4206
Author: blacksun
Date: 2015-09-16 17:11:13 +0200 (Wed, 16 Sep 2015)
Log Message:
-----------
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
Modified Paths:
--------------
trunk/sources/borderproperties.cpp
trunk/sources/conductorproperties.cpp
trunk/sources/configpages.cpp
trunk/sources/diagram.cpp
trunk/sources/diagramprintdialog.cpp
trunk/sources/diagramview.cpp
trunk/sources/editor/elementview.cpp
trunk/sources/editor/qetelementeditor.cpp
trunk/sources/elementspanel.cpp
trunk/sources/exportproperties.cpp
trunk/sources/main.cpp
trunk/sources/properties/reportproperties.cpp
trunk/sources/properties/xrefproperties.cpp
trunk/sources/qetapp.cpp
trunk/sources/qetapp.h
trunk/sources/qetdiagrameditor.cpp
trunk/sources/qetgraphicsitem/element.cpp
trunk/sources/qetgraphicsitem/terminal.cpp
trunk/sources/qetproject.cpp
trunk/sources/recentfiles.cpp
trunk/sources/titleblock/qettemplateeditor.cpp
trunk/sources/titleblockproperties.cpp
Modified: trunk/sources/borderproperties.cpp
===================================================================
--- trunk/sources/borderproperties.cpp 2015-09-16 15:03:12 UTC (rev 4205)
+++ trunk/sources/borderproperties.cpp 2015-09-16 15:11:13 UTC (rev 4206)
@@ -16,7 +16,6 @@
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include "borderproperties.h"
-#include "qetapp.h"
/**
Constructeur. Initialise un objet BorderProperties avec les proprietes par
@@ -126,8 +125,9 @@
* @brief BorderProperties::defaultProperties
* @return the default properties stored in the setting file
*/
-BorderProperties BorderProperties::defaultProperties() {
- QSettings &settings = QETApp::settings();
+BorderProperties BorderProperties::defaultProperties()
+{
+ QSettings settings;
BorderProperties def;
def.fromSettings(settings, "diagrameditor/default");
Modified: trunk/sources/conductorproperties.cpp
===================================================================
--- trunk/sources/conductorproperties.cpp 2015-09-16 15:03:12 UTC (rev 4205)
+++ trunk/sources/conductorproperties.cpp 2015-09-16 15:11:13 UTC (rev 4206)
@@ -16,7 +16,7 @@
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include "conductorproperties.h"
-#include "qetapp.h"
+#include <QPainter>
/**
Constructeur par defaut
@@ -365,8 +365,9 @@
* @brief ConductorProperties::defaultProperties
* @return the default properties stored in the setting file
*/
-ConductorProperties ConductorProperties::defaultProperties() {
- QSettings &settings = QETApp::settings();
+ConductorProperties ConductorProperties::defaultProperties()
+{
+ QSettings settings;
ConductorProperties def;
def.fromSettings(settings, "diagrameditor/defaultconductor");
Modified: trunk/sources/configpages.cpp
===================================================================
--- trunk/sources/configpages.cpp 2015-09-16 15:03:12 UTC (rev 4205)
+++ trunk/sources/configpages.cpp 2015-09-16 15:11:13 UTC (rev 4206)
@@ -19,7 +19,6 @@
#include "borderpropertieswidget.h"
#include "conductorpropertieswidget.h"
#include "titleblockpropertieswidget.h"
-#include "qetapp.h"
#include "bordertitleblock.h"
#include "qeticons.h"
#include "exportpropertieswidget.h"
@@ -27,6 +26,7 @@
#include "ui/xrefpropertieswidget.h"
#include "qetproject.h"
#include "reportproperties.h"
+#include "qetapp.h"
/**
* @brief NewDiagramPage::NewDiagramPage
@@ -135,7 +135,7 @@
}
} else { //Else we save to the default value
- QSettings &settings = QETApp::settings();
+ QSettings settings;
// dimensions des nouveaux schemas
bpw -> properties().toSettings(settings, "diagrameditor/default");
@@ -182,10 +182,10 @@
Constructeur
@param parent QWidget parent
*/
-GeneralConfigurationPage::GeneralConfigurationPage(QWidget *parent) : ConfigPage(parent) {
-
- // acces a la configuration de QElectroTech
- QSettings &settings = QETApp::settings();
+GeneralConfigurationPage::GeneralConfigurationPage(QWidget *parent) : ConfigPage(parent)
+{
+ //Conf of QElectroTech
+ QSettings settings;
bool use_system_colors = settings.value("usesystemcolors", "true").toBool();
bool tabbed = settings.value("diagrameditor/viewmode", "tabbed") == "tabbed";
bool integrate_elements = settings.value("diagrameditor/integrate-elements", true).toBool();
@@ -284,8 +284,9 @@
* @brief GeneralConfigurationPage::applyConf
* Write all configuration in settings file
*/
-void GeneralConfigurationPage::applyConf() {
- QSettings &settings = QETApp::settings();
+void GeneralConfigurationPage::applyConf()
+{
+ QSettings settings;
bool was_using_system_colors = settings.value("usesystemcolors", "true").toBool();
bool must_use_system_colors = use_system_colors_ -> isChecked();
@@ -385,8 +386,9 @@
/**
Applique la configuration de cette page
*/
-void ExportConfigPage::applyConf() {
- QSettings &settings = QETApp::settings();
+void ExportConfigPage::applyConf()
+{
+ QSettings settings;
epw -> exportProperties().toSettings(settings, "export/default");
}
@@ -430,12 +432,14 @@
}
/**
- Applique la configuration de cette page
-*/
-void PrintConfigPage::applyConf() {
+ * @brief PrintConfigPage::applyConf
+ * Apply the config of this page
+ */
+void PrintConfigPage::applyConf()
+{
QString prefix = "print/default";
- QSettings &settings = QETApp::settings();
+ QSettings settings;
epw -> exportProperties().toSettings(settings, prefix);
// annule l'enregistrement de certaines proprietes non pertinentes
Modified: trunk/sources/diagram.cpp
===================================================================
--- trunk/sources/diagram.cpp 2015-09-16 15:03:12 UTC (rev 4205)
+++ trunk/sources/diagram.cpp 2015-09-16 15:11:13 UTC (rev 4206)
@@ -29,7 +29,6 @@
#include "exportdialog.h"
#include "qetgraphicsitem/ghostelement.h"
#include "qetgraphicsitem/independenttextitem.h"
-#include "qetapp.h"
#include "qetgraphicsitem/diagramimageitem.h"
#include "qetgraphicsitem/qetshapeitem.h"
#include "terminal.h"
@@ -137,7 +136,8 @@
p -> setBrush(Qt::NoBrush);
//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 :
border_and_titleblock.insideBorderRect().intersected(r);
Modified: trunk/sources/diagramprintdialog.cpp
===================================================================
--- trunk/sources/diagramprintdialog.cpp 2015-09-16 15:03:12 UTC (rev 4205)
+++ trunk/sources/diagramprintdialog.cpp 2015-09-16 15:11:13 UTC (rev 4206)
@@ -20,7 +20,6 @@
#include <math.h>
#include "diagramschooser.h"
#include "exportproperties.h"
-#include "qetapp.h"
#include "qeticons.h"
#include "qetmessagebox.h"
@@ -536,8 +535,9 @@
configuration. Key/values pairs are associated to the printer for which
they have been set.
*/
-void DiagramPrintDialog::savePageSetupForCurrentPrinter() {
- QSettings &settings = QETApp::settings();
+void DiagramPrintDialog::savePageSetupForCurrentPrinter()
+{
+ QSettings settings;
QString printer_section = settingsSectionName(printer_);
while (!settings.group().isEmpty()) settings.endGroup();
@@ -571,8 +571,9 @@
Load parameters previously set in the "page setup" dialog for the current
printer, if any.
*/
-void DiagramPrintDialog::loadPageSetupForCurrentPrinter() {
- QSettings &settings = QETApp::settings();
+void DiagramPrintDialog::loadPageSetupForCurrentPrinter()
+{
+ QSettings settings;
QString printer_section = settingsSectionName(printer_);
while (!settings.group().isEmpty()) settings.endGroup();
Modified: trunk/sources/diagramview.cpp
===================================================================
--- trunk/sources/diagramview.cpp 2015-09-16 15:03:12 UTC (rev 4205)
+++ trunk/sources/diagramview.cpp 2015-09-16 15:11:13 UTC (rev 4206)
@@ -359,8 +359,10 @@
* 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.
*/
-void DiagramView::zoomOut() {
- if (QETApp::settings().value("diagrameditor/zoom-out-beyond-of-folio", false).toBool() ||
+void DiagramView::zoomOut()
+{
+ QSettings settings;
+ if (settings.value("diagrameditor/zoom-out-beyond-of-folio", false).toBool() ||
(horizontalScrollBar()->maximum() || verticalScrollBar()->maximum()) )
scale(0.85, 0.85);
@@ -380,8 +382,10 @@
* @brief DiagramView::zoomOutSlowly
* Like zoomOut but more slowly
*/
-void DiagramView::zoomOutSlowly() {
- if (QETApp::settings().value("diagrameditor/zoom-out-beyond-of-folio", false).toBool() ||
+void DiagramView::zoomOutSlowly()
+{
+ QSettings settings;
+ if (settings.value("diagrameditor/zoom-out-beyond-of-folio", false).toBool() ||
(horizontalScrollBar()->maximum() || verticalScrollBar()->maximum()) )
scale(0.98, 0.98);
@@ -555,8 +559,10 @@
* @brief DiagramView::gestures
* @return
*/
-bool DiagramView::gestures() const {
- return(QETApp::settings().value("diagramview/gestures", false).toBool());
+bool DiagramView::gestures() const
+{
+ QSettings settings;
+ return(settings.value("diagramview/gestures", false).toBool());
}
/**
Modified: trunk/sources/editor/elementview.cpp
===================================================================
--- trunk/sources/editor/elementview.cpp 2015-09-16 15:03:12 UTC (rev 4205)
+++ trunk/sources/editor/elementview.cpp 2015-09-16 15:11:13 UTC (rev 4206)
@@ -399,8 +399,10 @@
* @brief ElementView::gestures
* @return
*/
-bool ElementView::gestures() const {
- return(QETApp::settings().value("diagramview/gestures", false).toBool());
+bool ElementView::gestures() const
+{
+ QSettings settings;
+ return(settings.value("diagramview/gestures", false).toBool());
}
Modified: trunk/sources/editor/qetelementeditor.cpp
===================================================================
--- trunk/sources/editor/qetelementeditor.cpp 2015-09-16 15:03:12 UTC (rev 4205)
+++ trunk/sources/editor/qetelementeditor.cpp 2015-09-16 15:11:13 UTC (rev 4206)
@@ -1356,9 +1356,13 @@
slot_updateMenus();
}
-/// Lit les parametres de l'editeur d'element
-void QETElementEditor::readSettings() {
- QSettings &settings = QETApp::settings();
+/**
+ * @brief QETElementEditor::readSettings
+ * Read settings
+ */
+void QETElementEditor::readSettings()
+{
+ QSettings settings;
// dimensions et position de la fenetre
QVariant geometry = settings.value("elementeditor/geometry");
@@ -1372,9 +1376,13 @@
ce_scene -> setInformations(settings.value("elementeditor/default-informations", "").toString());
}
-/// Enregistre les parametres de l'editeur d'element
-void QETElementEditor::writeSettings() {
- QSettings &settings = QETApp::settings();
+/**
+ * @brief QETElementEditor::writeSettings
+ * Write the settings
+ */
+void QETElementEditor::writeSettings()
+{
+ QSettings settings;
settings.setValue("elementeditor/geometry", saveGeometry());
settings.setValue("elementeditor/state", saveState());
}
Modified: trunk/sources/elementspanel.cpp
===================================================================
--- trunk/sources/elementspanel.cpp 2015-09-16 15:03:12 UTC (rev 4205)
+++ trunk/sources/elementspanel.cpp 2015-09-16 15:11:13 UTC (rev 4206)
@@ -560,8 +560,10 @@
/**
@return true if freshly integrated elements should be highlighted, false otherwise.
*/
-bool ElementsPanel::mustHighlightIntegratedElements() const {
- return(QETApp::settings().value("diagrameditor/highlight-integrated-elements", true).toBool());
+bool ElementsPanel::mustHighlightIntegratedElements() const
+{
+ QSettings settings;
+ return(settings.value("diagrameditor/highlight-integrated-elements", true).toBool());
}
/**
Modified: trunk/sources/exportproperties.cpp
===================================================================
--- trunk/sources/exportproperties.cpp 2015-09-16 15:03:12 UTC (rev 4205)
+++ trunk/sources/exportproperties.cpp 2015-09-16 15:11:13 UTC (rev 4206)
@@ -16,7 +16,6 @@
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include "exportproperties.h"
-#include "qetapp.h"
#include <QStandardPaths>
@@ -87,8 +86,9 @@
* @brief ExportProperties::defaultProperties
* @return the default properties stored in the setting file
*/
-ExportProperties ExportProperties::defaultExportProperties() {
- QSettings &settings = QETApp::settings();
+ExportProperties ExportProperties::defaultExportProperties()
+{
+ QSettings settings;
ExportProperties def;
def.fromSettings(settings, "export/default");
@@ -100,8 +100,9 @@
* @brief ExportProperties::defaultPrintProperties
* @return the default properties stored in the setting file
*/
-ExportProperties ExportProperties::defaultPrintProperties() {
- QSettings &settings = QETApp::settings();
+ExportProperties ExportProperties::defaultPrintProperties()
+{
+ QSettings settings;
ExportProperties def;
def.fromSettings(settings, "print/default");
Modified: trunk/sources/main.cpp
===================================================================
--- trunk/sources/main.cpp 2015-09-16 15:03:12 UTC (rev 4205)
+++ trunk/sources/main.cpp 2015-09-16 15:11:13 UTC (rev 4206)
@@ -16,12 +16,20 @@
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include "qetapp.h"
+
/**
- Fonction principale du programme QElectroTech
- @param argc nombre de parametres
- @param argv parametres
-*/
-int main(int argc, char **argv) {
- // Creation et execution de l'application
+ * @brief main
+ * Main function of QElectroTech
+ * @param argc : number of paramètres
+ * @param argv : paramètres
+ * @return
+ */
+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());
}
Modified: trunk/sources/properties/reportproperties.cpp
===================================================================
--- trunk/sources/properties/reportproperties.cpp 2015-09-16 15:03:12 UTC (rev 4205)
+++ trunk/sources/properties/reportproperties.cpp 2015-09-16 15:11:13 UTC (rev 4206)
@@ -16,7 +16,7 @@
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include "reportproperties.h"
-#include "qetapp.h"
+#include <QSettings>
ReportProperties::ReportProperties()
{}
@@ -25,7 +25,8 @@
* @brief ReportProperties::defaultProperties
* @return the default properties stored in the setting file
*/
-QString ReportProperties::defaultProperties() {
- QSettings &settings= QETApp::settings();
+QString ReportProperties::defaultProperties()
+{
+ QSettings settings;
return(settings.value("diagrameditor/defaultreportlabel", "%f-%l%c").toString());
}
Modified: trunk/sources/properties/xrefproperties.cpp
===================================================================
--- trunk/sources/properties/xrefproperties.cpp 2015-09-16 15:03:12 UTC (rev 4205)
+++ trunk/sources/properties/xrefproperties.cpp 2015-09-16 15:11:13 UTC (rev 4206)
@@ -103,15 +103,19 @@
* For coil, stored with the string "coil" 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;
QStringList keys;
keys << "coil" << "protection" << "commutator";
- foreach (QString key, keys) {
+ QSettings settings;
+
+ foreach (QString key, keys)
+ {
XRefProperties properties;
QString str("diagrameditor/defaultxref");
- properties.fromSettings(QETApp::settings(), str += key);
+ properties.fromSettings(settings, str += key);
hash.insert(key, properties);
}
Modified: trunk/sources/qetapp.cpp
===================================================================
--- trunk/sources/qetapp.cpp 2015-09-16 15:03:12 UTC (rev 4205)
+++ trunk/sources/qetapp.cpp 2015-09-16 15:11:13 UTC (rev 4206)
@@ -189,8 +189,10 @@
* @return the langage found in setting file
* if nothing was found return the system local.
*/
-QString QETApp::langFromSetting() {
- QString system_language = settings().value("lang", "system").toString();
+QString QETApp::langFromSetting()
+{
+ QSettings settings;
+ QString system_language = settings.value("lang", "system").toString();
if(system_language == "system") {system_language = QLocale::system().name().left(2);}
return system_language;
}
@@ -742,20 +744,19 @@
}
/**
- @param size taille voulue - si aucune taille n'est specifiee, la valeur
- specifiee dans la configuration (diagramsize) est utilisee. La valeur par
- defaut est 9.
- @return la police a utiliser pour rendre les textes sur les schemas
- La famille "Sans Serif" est utilisee par defaut mais peut etre surchargee
- dans la configuration (diagramfont).
-*/
-QFont QETApp::diagramTextsFont(qreal size) {
- // acces a la configuration de l'application
- QSettings &qet_settings = QETApp::settings();
+ * @brief QETApp::diagramTextsFont
+ * The font to use
+ * By default the font is "sans Serif" and size 9.
+ * @param size : the size of font
+ * @return the font to use
+ */
+QFont QETApp::diagramTextsFont(qreal size)
+{
+ QSettings settings;
- // police a utiliser pour le rendu de texte
- QString diagram_texts_family = qet_settings.value("diagramfont", "Sans Serif").toString();
- qreal diagram_texts_size = qet_settings.value("diagramsize", 9.0).toDouble();
+ //Font to use
+ QString diagram_texts_family = settings.value("diagramfont", "Sans Serif").toString();
+ qreal diagram_texts_size = settings.value("diagramsize", 9.0).toDouble();
if (size != -1.0) {
diagram_texts_size = size;
@@ -1379,8 +1380,9 @@
}
/**
- Met en place tout ce qui concerne le style graphique de l'application
-*/
+ * @brief QETApp::initStyle
+ * Setup the gui style
+ */
void QETApp::initStyle() {
initial_palette_ = palette();
@@ -1389,9 +1391,9 @@
// if (qobject_cast<QPlastiqueStyle *>(style())) {
// setStyle(new QETStyle());
// }
-
- // applique ou non les couleurs de l'environnement
- useSystemPalette(settings().value("usesystemcolors", true).toBool());
+ //Apply or not the system style
+ QSettings settings;
+ useSystemPalette(settings.value("usesystemcolors", true).toBool());
}
/**
@@ -1412,9 +1414,6 @@
QDir custom_tbt_dir(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
// note : les icones doivent etre initialisees avant ces instructions (qui creent des menus en interne)
projects_recent_files_ = new RecentFiles("projects");
@@ -1694,11 +1693,6 @@
// }
//}
-/// @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 prefer_collections true pour renvoyer la collection lorsque le
Modified: trunk/sources/qetapp.h
===================================================================
--- trunk/sources/qetapp.h 2015-09-16 15:03:12 UTC (rev 4205)
+++ trunk/sources/qetapp.h 2015-09-16 15:11:13 UTC (rev 4206)
@@ -93,7 +93,6 @@
static QETProject *project(const uint &);
static int projectId(const QETProject *);
static QString configDir();
- static QSettings &settings();
static QString languagesPath();
static QString realPath(const QString &);
static QString symbolicPath(const QString &);
@@ -165,7 +164,6 @@
bool every_template_reduced;
bool every_template_visible;
QSignalMapper signal_map;
- QSettings *qet_settings;
QETArguments qet_arguments_; ///< Comand-line arguments parser
bool non_interactive_execution_; ///< Whether the application will end without any user interaction
QPalette initial_palette_; ///< System color palette
Modified: trunk/sources/qetdiagrameditor.cpp
===================================================================
--- trunk/sources/qetdiagrameditor.cpp 2015-09-16 15:03:12 UTC (rev 4205)
+++ trunk/sources/qetdiagrameditor.cpp 2015-09-16 15:11:13 UTC (rev 4206)
@@ -1666,9 +1666,13 @@
slot_updateWindowsMenu();
}
-/// Lit les parametres de l'editeur de schemas
-void QETDiagramEditor::readSettings() {
- QSettings &settings = QETApp::settings();
+/**
+ * @brief QETDiagramEditor::readSettings
+ * Read the settings
+ */
+void QETDiagramEditor::readSettings()
+{
+ QSettings settings;
// dimensions et position de la fenetre
QVariant geometry = settings.value("diagrameditor/geometry");
@@ -1687,9 +1691,13 @@
}
}
-/// Enregistre les parametres de l'editeur de schemas
-void QETDiagramEditor::writeSettings() {
- QSettings &settings = QETApp::settings();
+/**
+ * @brief QETDiagramEditor::writeSettings
+ * Write the settings
+ */
+void QETDiagramEditor::writeSettings()
+{
+ QSettings settings;
settings.setValue("diagrameditor/geometry", saveGeometry());
settings.setValue("diagrameditor/state", saveState());
}
Modified: trunk/sources/qetgraphicsitem/element.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/element.cpp 2015-09-16 15:03:12 UTC (rev 4205)
+++ trunk/sources/qetgraphicsitem/element.cpp 2015-09-16 15:11:13 UTC (rev 4206)
@@ -16,7 +16,6 @@
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include "element.h"
-#include "qetapp.h"
#include "diagram.h"
#include "conductor.h"
#include "elementtextitem.h"
@@ -89,16 +88,18 @@
}
/**
- Methode principale de dessin de l'element
- @param painter Le QPainter utilise pour dessiner l'elment
- @param options Les options de style a prendre en compte
- @param widget Le widget sur lequel on dessine
-*/
-void Element::paint(QPainter *painter, const QStyleOptionGraphicsItem *options, QWidget *widget) {
+ * @brief Element::paint
+ * @param painter
+ * @param options
+ * @param widget
+ */
+void Element::paint(QPainter *painter, const QStyleOptionGraphicsItem *options, QWidget *widget)
+{
#ifndef Q_OS_WIN
- // corrige un bug de rendu ne se produisant que lors du rendu sur QGraphicsScene sous X11 au zoom par defaut
- static bool must_correct_rendering_bug = QETApp::settings().value("correct-rendering", false).toBool();
+ //Fix visual bug on QGraphicsScene that occur only on X11 with default zoom.
+ QSettings settings;
+ static bool must_correct_rendering_bug = settings.value("correct-rendering", false).toBool();
if (must_correct_rendering_bug) {
Diagram *dia = diagram();
if (dia && options -> levelOfDetail == 1.0 && widget) {
Modified: trunk/sources/qetgraphicsitem/terminal.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/terminal.cpp 2015-09-16 15:03:12 UTC (rev 4205)
+++ trunk/sources/qetgraphicsitem/terminal.cpp 2015-09-16 15:11:13 UTC (rev 4206)
@@ -20,7 +20,6 @@
#include "qetgraphicsitem/element.h"
#include "qetgraphicsitem/conductor.h"
#include "diagramcommands.h"
-#include "qetapp.h"
#include "conductorautonumerotation.h"
QColor Terminal::neutralColor = QColor(Qt::blue);
@@ -229,8 +228,9 @@
p -> save();
#ifndef Q_OS_WIN
- // corrige un bug de rendu ne se produisant que lors du rendu sur QGraphicsScene sous X11 au zoom par defaut
- static bool must_correct_rendering_bug = QETApp::settings().value("correct-rendering", false).toBool();
+ //Fix visual bug on QGraphicsScene that occur only on X11 with default zoom.
+ QSettings settings;
+ static bool must_correct_rendering_bug = settings.value("correct-rendering", false).toBool();
if (must_correct_rendering_bug) {
Diagram *dia = diagram();
if (dia && options -> levelOfDetail == 1.0 && widget) {
Modified: trunk/sources/qetproject.cpp
===================================================================
--- trunk/sources/qetproject.cpp 2015-09-16 15:03:12 UTC (rev 4205)
+++ trunk/sources/qetproject.cpp 2015-09-16 15:11:13 UTC (rev 4206)
@@ -179,7 +179,8 @@
bool QETProject::integrateElementToProject(const ElementsLocation &location, const QETProject *project)
{
//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?
bool elmt_from_project = location.project();
Modified: trunk/sources/recentfiles.cpp
===================================================================
--- trunk/sources/recentfiles.cpp 2015-09-16 15:03:12 UTC (rev 4205)
+++ trunk/sources/recentfiles.cpp 2015-09-16 15:11:13 UTC (rev 4206)
@@ -16,8 +16,8 @@
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include "recentfiles.h"
-#include "qetapp.h"
#include "qeticons.h"
+#include <QMenu>
/**
Constructeur
@@ -111,16 +111,20 @@
}
/**
- Lit la liste des fichiers recents dans la configuration
-*/
-void RecentFiles::extractFilesFromSettings() {
- // oublie la liste des fichiers recents
+ * @brief RecentFiles::extractFilesFromSettings
+ * Read the list of recent file from settings
+ */
+void RecentFiles::extractFilesFromSettings()
+{
+ //Forget the list of recent files
list_.clear();
- // recupere les derniers fichiers ouverts dans la configuration
- for (int i = size_ ; i >= 1 ; -- i) {
+ //Get the last opened file from the settings
+ QSettings settings;
+ for (int i = size_ ; i >= 1 ; -- 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);
}
}
@@ -144,12 +148,16 @@
}
/**
- Ecrit la liste des fichiers recents dans la configuration
-*/
-void RecentFiles::saveFilesToSettings() {
- for (int i = 0 ; i < size_ && i < list_.count() ; ++ i) {
+ * @brief RecentFiles::saveFilesToSettings
+ * Write the list of recent files to settings
+ */
+void RecentFiles::saveFilesToSettings()
+{
+ QSettings settings;
+ for (int i = 0 ; i < size_ && i < list_.count() ; ++ i)
+ {
QString key(identifier_ + "-recentfiles/file" + QString::number(i + 1));
- QETApp::settings().setValue(key, list_[i]);
+ settings.setValue(key, list_[i]);
}
}
Modified: trunk/sources/titleblock/qettemplateeditor.cpp
===================================================================
--- trunk/sources/titleblock/qettemplateeditor.cpp 2015-09-16 15:03:12 UTC (rev 4205)
+++ trunk/sources/titleblock/qettemplateeditor.cpp 2015-09-16 15:11:13 UTC (rev 4206)
@@ -467,8 +467,9 @@
/**
Initialize layouts and widgets
*/
-void QETTitleBlockTemplateEditor::initWidgets() {
- QSettings &settings = QETApp::settings();
+void QETTitleBlockTemplateEditor::initWidgets()
+{
+ QSettings settings;
// undo list on the right
undo_stack_ = new QUndoStack(this);
@@ -579,10 +580,12 @@
}
/**
- Load template editor-related parameters.
-*/
-void QETTitleBlockTemplateEditor::readSettings() {
- QSettings &settings = QETApp::settings();
+ * @brief QETTitleBlockTemplateEditor::readSettings
+ * Read settings
+ */
+void QETTitleBlockTemplateEditor::readSettings()
+{
+ QSettings settings;
// window size and position
QVariant geometry = settings.value("titleblocktemplateeditor/geometry");
@@ -594,10 +597,12 @@
}
/**
- Save template editor-related parameters.
-*/
-void QETTitleBlockTemplateEditor::writeSettings() {
- QSettings &settings = QETApp::settings();
+ * @brief QETTitleBlockTemplateEditor::writeSettings
+ * Write the settings
+ */
+void QETTitleBlockTemplateEditor::writeSettings()
+{
+ QSettings settings;
settings.setValue("titleblocktemplateeditor/geometry", saveGeometry());
settings.setValue("titleblocktemplateeditor/state", saveState());
}
@@ -898,13 +903,16 @@
}
/**
- Save the new preview width to application settings
- @param former_preview_width Unused, former preview width
- @param new_preview_width New preview width
-*/
-void QETTitleBlockTemplateEditor::savePreviewWidthToApplicationSettings(int former_preview_width, int new_preview_width) {
+ * @brief QETTitleBlockTemplateEditor::savePreviewWidthToApplicationSettings
+ * Save the new preview width to application settings
+ * @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)
+{
Q_UNUSED(former_preview_width)
- QETApp::settings().setValue("titleblocktemplateeditor/preview_width", new_preview_width);
+ QSettings settings;
+ settings.setValue("titleblocktemplateeditor/preview_width", new_preview_width);
}
/**
Modified: trunk/sources/titleblockproperties.cpp
===================================================================
--- trunk/sources/titleblockproperties.cpp 2015-09-16 15:03:12 UTC (rev 4205)
+++ trunk/sources/titleblockproperties.cpp 2015-09-16 15:11:13 UTC (rev 4206)
@@ -154,8 +154,9 @@
* @brief TitleBlockProperties::defaultProperties
* Return the default properties stored in the setting file
*/
-TitleBlockProperties TitleBlockProperties::defaultProperties() {
- QSettings &settings = QETApp::settings();
+TitleBlockProperties TitleBlockProperties::defaultProperties()
+{
+ QSettings settings;
TitleBlockProperties def;
def.fromSettings(settings, "diagrameditor/default");