mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-09-13 20:23:04 +02: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:
parent
3e1c6b8f56
commit
1a7e3ac8e1
@ -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 @@ void BorderProperties::fromSettings(QSettings &settings, const QString &prefix)
|
||||
* @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");
|
||||
|
@ -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 @@ QString ConductorProperties::typeToString(ConductorType t) {
|
||||
* @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");
|
||||
|
@ -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 @@ void NewDiagramPage::applyConf() {
|
||||
}
|
||||
|
||||
} 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 @@ QString NewDiagramPage::title() const {
|
||||
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 @@ GeneralConfigurationPage::~GeneralConfigurationPage() {
|
||||
* @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 @@ ExportConfigPage::~ExportConfigPage() {
|
||||
/**
|
||||
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 @@ PrintConfigPage::~PrintConfigPage() {
|
||||
}
|
||||
|
||||
/**
|
||||
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
|
||||
|
@ -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 @@ void Diagram::drawBackground(QPainter *p, const QRectF &r) {
|
||||
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);
|
||||
|
||||
|
@ -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 @@ void DiagramPrintDialog::saveReloadDiagramParameters(Diagram *diagram, const Exp
|
||||
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 @@ void DiagramPrintDialog::savePageSetupForCurrentPrinter() {
|
||||
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();
|
||||
|
@ -359,8 +359,10 @@ void DiagramView::zoomIn() {
|
||||
* 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 @@ void DiagramView::zoomInSlowly() {
|
||||
* @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 @@ void DiagramView::mouseReleaseEvent(QMouseEvent *e) {
|
||||
* @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());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -399,8 +399,10 @@ void ElementView::mouseReleaseEvent(QMouseEvent *e) {
|
||||
* @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());
|
||||
}
|
||||
|
||||
|
||||
|
@ -1356,9 +1356,13 @@ void QETElementEditor::slot_updateSelectionFromPartsList() {
|
||||
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 @@ void QETElementEditor::readSettings() {
|
||||
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());
|
||||
}
|
||||
|
@ -560,8 +560,10 @@ int ElementsPanel::elementsCollectionItemsCount() {
|
||||
/**
|
||||
@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());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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 @@ void ExportProperties::fromSettings(QSettings &settings, const QString &prefix)
|
||||
* @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 @@ ExportProperties ExportProperties::defaultExportProperties() {
|
||||
* @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");
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -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 @@ ReportProperties::ReportProperties()
|
||||
* @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());
|
||||
}
|
||||
|
@ -103,15 +103,19 @@ void XRefProperties::fromXml(const QDomElement &xml_element) {
|
||||
* 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);
|
||||
}
|
||||
|
||||
|
@ -189,8 +189,10 @@ void QETApp::setLanguage(const QString &desired_language) {
|
||||
* @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 @@ bool QETApp::closeEveryEditor() {
|
||||
}
|
||||
|
||||
/**
|
||||
@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 @@ 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() {
|
||||
initial_palette_ = palette();
|
||||
|
||||
@ -1389,9 +1391,9 @@ void QETApp::initStyle() {
|
||||
// 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 @@ void QETApp::initConfiguration() {
|
||||
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 @@ 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 prefer_collections true pour renvoyer la collection lorsque le
|
||||
|
@ -93,7 +93,6 @@ class QETApp : public QETSingleApplication {
|
||||
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 @@ class QETApp : public QETSingleApplication {
|
||||
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
|
||||
|
@ -1666,9 +1666,13 @@ void QETDiagramEditor::setTabbedMode() {
|
||||
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 @@ void QETDiagramEditor::readSettings() {
|
||||
}
|
||||
}
|
||||
|
||||
/// 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());
|
||||
}
|
||||
|
@ -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 @@ void Element::displayHelpLine(bool b)
|
||||
}
|
||||
|
||||
/**
|
||||
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) {
|
||||
|
@ -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 @@ void Terminal::paint(QPainter *p, const QStyleOptionGraphicsItem *options, QWidg
|
||||
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) {
|
||||
|
@ -179,7 +179,8 @@ QETProject::~QETProject() {
|
||||
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();
|
||||
|
@ -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 @@ void RecentFiles::fileWasOpened(const QString &filepath) {
|
||||
}
|
||||
|
||||
/**
|
||||
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 @@ void RecentFiles::insertFile(const QString &filepath) {
|
||||
}
|
||||
|
||||
/**
|
||||
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]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -467,8 +467,9 @@ void QETTitleBlockTemplateEditor::initToolbars() {
|
||||
/**
|
||||
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 @@ QString QETTitleBlockTemplateEditor::currentlyEditedTitle() const {
|
||||
}
|
||||
|
||||
/**
|
||||
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 @@ void QETTitleBlockTemplateEditor::readSettings() {
|
||||
}
|
||||
|
||||
/**
|
||||
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 @@ void QETTitleBlockTemplateEditor::quit() {
|
||||
}
|
||||
|
||||
/**
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -154,8 +154,9 @@ void TitleBlockProperties::fromSettings(QSettings &settings, const QString &pref
|
||||
* @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");
|
||||
|
Loading…
x
Reference in New Issue
Block a user