mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-22 09:40:52 +01:00
La geometrie et l'etat des fenetres sont desormais enregistrees dans le fichier de configuration.
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@213 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -18,7 +18,16 @@ QETElementEditor::QETElementEditor(QWidget *parent) :
|
|||||||
setupInterface();
|
setupInterface();
|
||||||
setupActions();
|
setupActions();
|
||||||
setupMenus();
|
setupMenus();
|
||||||
showMaximized();
|
|
||||||
|
// la fenetre est maximisee par defaut
|
||||||
|
setMinimumSize(QSize(500, 350));
|
||||||
|
setWindowState(Qt::WindowMaximized);
|
||||||
|
|
||||||
|
// lecture des parametres
|
||||||
|
readSettings();
|
||||||
|
|
||||||
|
// affichage
|
||||||
|
show();
|
||||||
}
|
}
|
||||||
|
|
||||||
QETElementEditor::~QETElementEditor() {
|
QETElementEditor::~QETElementEditor() {
|
||||||
@@ -514,6 +523,7 @@ bool QETElementEditor::canClose() {
|
|||||||
*/
|
*/
|
||||||
void QETElementEditor::closeEvent(QCloseEvent *qce) {
|
void QETElementEditor::closeEvent(QCloseEvent *qce) {
|
||||||
if (canClose()) {
|
if (canClose()) {
|
||||||
|
writeSettings();
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
qce -> accept();
|
qce -> accept();
|
||||||
} else qce -> ignore();
|
} else qce -> ignore();
|
||||||
@@ -574,3 +584,24 @@ void QETElementEditor::slot_updateSelectionFromPartsList() {
|
|||||||
parts_list -> blockSignals(false);
|
parts_list -> blockSignals(false);
|
||||||
ce_scene -> blockSignals(false);
|
ce_scene -> blockSignals(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Lit les parametres de l'editeur d'element
|
||||||
|
void QETElementEditor::readSettings() {
|
||||||
|
QSettings &settings = QETApp::settings();
|
||||||
|
|
||||||
|
// dimensions et position de la fenetre
|
||||||
|
QVariant geometry = settings.value("elementeditor/geometry");
|
||||||
|
if (geometry.isValid()) restoreGeometry(geometry.toByteArray());
|
||||||
|
|
||||||
|
// etat de la fenetre (barres d'outils, docks...)
|
||||||
|
QVariant state = settings.value("elementeditor/state");
|
||||||
|
if (state.isValid()) restoreState(state.toByteArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Enregistre les parametres de l'editeur d'element
|
||||||
|
void QETElementEditor::writeSettings() {
|
||||||
|
QSettings &settings = QETApp::settings();
|
||||||
|
settings.setValue("elementeditor/geometry", saveGeometry());
|
||||||
|
settings.setValue("elementeditor/state", saveState());
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -73,6 +73,8 @@ class QETElementEditor : public QMainWindow {
|
|||||||
void fromFile(const QString &);
|
void fromFile(const QString &);
|
||||||
bool toFile(const QString &);
|
bool toFile(const QString &);
|
||||||
ElementScene *elementScene() const;
|
ElementScene *elementScene() const;
|
||||||
|
void readSettings();
|
||||||
|
void writeSettings();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void closeEvent(QCloseEvent *);
|
void closeEvent(QCloseEvent *);
|
||||||
|
|||||||
@@ -101,6 +101,9 @@ QETApp::QETApp(int &argc, char **argv) : QApplication(argc, argv) {
|
|||||||
setStyle(new QETStyle());
|
setStyle(new QETStyle());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// lit le fichier de configuration
|
||||||
|
qet_settings = new QSettings(configDir() + "qelectrotech.conf", QSettings::IniFormat, this);
|
||||||
|
|
||||||
// Creation et affichage d'un editeur de schema
|
// Creation et affichage d'un editeur de schema
|
||||||
QStringList files;
|
QStringList files;
|
||||||
foreach(QString argument, arguments()) {
|
foreach(QString argument, arguments()) {
|
||||||
@@ -620,3 +623,8 @@ QIcon QETStyle::standardIconImplementation(StandardPixmap standardIcon, const QS
|
|||||||
return(QPlastiqueStyle::standardIconImplementation(standardIcon, option, widget));
|
return(QPlastiqueStyle::standardIconImplementation(standardIcon, option, widget));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @return une reference vers les parametres de QElectroTEch
|
||||||
|
QSettings &QETApp::settings() {
|
||||||
|
return(*(static_cast<QETApp *>(qApp) -> qet_settings));
|
||||||
|
}
|
||||||
|
|||||||
2
qetapp.h
2
qetapp.h
@@ -29,6 +29,7 @@ class QETApp : public QApplication {
|
|||||||
static QString commonElementsDir();
|
static QString commonElementsDir();
|
||||||
static QString customElementsDir();
|
static QString customElementsDir();
|
||||||
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 &);
|
||||||
@@ -71,6 +72,7 @@ class QETApp : public QApplication {
|
|||||||
bool every_element_reduced;
|
bool every_element_reduced;
|
||||||
bool every_element_visible;
|
bool every_element_visible;
|
||||||
QSignalMapper signal_map;
|
QSignalMapper signal_map;
|
||||||
|
QSettings *qet_settings;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void systray(QSystemTrayIcon::ActivationReason);
|
void systray(QSystemTrayIcon::ActivationReason);
|
||||||
|
|||||||
@@ -80,8 +80,7 @@ QETDiagramEditor::QETDiagramEditor(const QStringList &files, QWidget *parent) :
|
|||||||
menus();
|
menus();
|
||||||
|
|
||||||
// la fenetre est maximisee par defaut
|
// la fenetre est maximisee par defaut
|
||||||
setMinimumWidth(500);
|
setMinimumSize(QSize(500, 350));
|
||||||
setMinimumHeight(350);
|
|
||||||
setWindowState(Qt::WindowMaximized);
|
setWindowState(Qt::WindowMaximized);
|
||||||
|
|
||||||
// connexions signaux / slots pour une interface sensee
|
// connexions signaux / slots pour une interface sensee
|
||||||
@@ -92,6 +91,9 @@ QETDiagramEditor::QETDiagramEditor(const QStringList &files, QWidget *parent) :
|
|||||||
// ajout de tous les DiagramView necessaires
|
// ajout de tous les DiagramView necessaires
|
||||||
foreach (DiagramView *sv, diagram_views) addDiagramView(sv);
|
foreach (DiagramView *sv, diagram_views) addDiagramView(sv);
|
||||||
|
|
||||||
|
// lecture des parametres
|
||||||
|
readSettings();
|
||||||
|
|
||||||
// affichage
|
// affichage
|
||||||
show();
|
show();
|
||||||
}
|
}
|
||||||
@@ -123,6 +125,7 @@ void QETDiagramEditor::closeEvent(QCloseEvent *qce) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (can_quit) {
|
if (can_quit) {
|
||||||
|
writeSettings();
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
qce -> accept();
|
qce -> accept();
|
||||||
}
|
}
|
||||||
@@ -941,3 +944,23 @@ void QETDiagramEditor::slot_addText() {
|
|||||||
dv -> addText();
|
dv -> addText();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Lit les parametres de l'editeur de schemas
|
||||||
|
void QETDiagramEditor::readSettings() {
|
||||||
|
QSettings &settings = QETApp::settings();
|
||||||
|
|
||||||
|
// dimensions et position de la fenetre
|
||||||
|
QVariant geometry = settings.value("diagrameditor/geometry");
|
||||||
|
if (geometry.isValid()) restoreGeometry(geometry.toByteArray());
|
||||||
|
|
||||||
|
// etat de la fenetre (barres d'outils, docks...)
|
||||||
|
QVariant state = settings.value("diagrameditor/state");
|
||||||
|
if (state.isValid()) restoreState(state.toByteArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Enregistre les parametres de l'editeur de schemas
|
||||||
|
void QETDiagramEditor::writeSettings() {
|
||||||
|
QSettings &settings = QETApp::settings();
|
||||||
|
settings.setValue("diagrameditor/geometry", saveGeometry());
|
||||||
|
settings.setValue("diagrameditor/state", saveState());
|
||||||
|
}
|
||||||
|
|||||||
@@ -72,6 +72,8 @@ class QETDiagramEditor : public QMainWindow {
|
|||||||
void slot_resetConductors();
|
void slot_resetConductors();
|
||||||
void slot_editDefaultConductors();
|
void slot_editDefaultConductors();
|
||||||
void slot_addText();
|
void slot_addText();
|
||||||
|
void readSettings();
|
||||||
|
void writeSettings();
|
||||||
|
|
||||||
// attributs
|
// attributs
|
||||||
public:
|
public:
|
||||||
|
|||||||
Reference in New Issue
Block a user