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();
|
||||
setupActions();
|
||||
setupMenus();
|
||||
showMaximized();
|
||||
|
||||
// la fenetre est maximisee par defaut
|
||||
setMinimumSize(QSize(500, 350));
|
||||
setWindowState(Qt::WindowMaximized);
|
||||
|
||||
// lecture des parametres
|
||||
readSettings();
|
||||
|
||||
// affichage
|
||||
show();
|
||||
}
|
||||
|
||||
QETElementEditor::~QETElementEditor() {
|
||||
@@ -514,6 +523,7 @@ bool QETElementEditor::canClose() {
|
||||
*/
|
||||
void QETElementEditor::closeEvent(QCloseEvent *qce) {
|
||||
if (canClose()) {
|
||||
writeSettings();
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
qce -> accept();
|
||||
} else qce -> ignore();
|
||||
@@ -574,3 +584,24 @@ void QETElementEditor::slot_updateSelectionFromPartsList() {
|
||||
parts_list -> 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 &);
|
||||
bool toFile(const QString &);
|
||||
ElementScene *elementScene() const;
|
||||
void readSettings();
|
||||
void writeSettings();
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *);
|
||||
|
||||
@@ -101,6 +101,9 @@ QETApp::QETApp(int &argc, char **argv) : QApplication(argc, argv) {
|
||||
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
|
||||
QStringList files;
|
||||
foreach(QString argument, arguments()) {
|
||||
@@ -620,3 +623,8 @@ QIcon QETStyle::standardIconImplementation(StandardPixmap standardIcon, const QS
|
||||
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 customElementsDir();
|
||||
static QString configDir();
|
||||
static QSettings &settings();
|
||||
static QString languagesPath();
|
||||
static QString realPath(const QString &);
|
||||
static QString symbolicPath(const QString &);
|
||||
@@ -71,6 +72,7 @@ class QETApp : public QApplication {
|
||||
bool every_element_reduced;
|
||||
bool every_element_visible;
|
||||
QSignalMapper signal_map;
|
||||
QSettings *qet_settings;
|
||||
|
||||
public slots:
|
||||
void systray(QSystemTrayIcon::ActivationReason);
|
||||
|
||||
@@ -80,8 +80,7 @@ QETDiagramEditor::QETDiagramEditor(const QStringList &files, QWidget *parent) :
|
||||
menus();
|
||||
|
||||
// la fenetre est maximisee par defaut
|
||||
setMinimumWidth(500);
|
||||
setMinimumHeight(350);
|
||||
setMinimumSize(QSize(500, 350));
|
||||
setWindowState(Qt::WindowMaximized);
|
||||
|
||||
// connexions signaux / slots pour une interface sensee
|
||||
@@ -92,6 +91,9 @@ QETDiagramEditor::QETDiagramEditor(const QStringList &files, QWidget *parent) :
|
||||
// ajout de tous les DiagramView necessaires
|
||||
foreach (DiagramView *sv, diagram_views) addDiagramView(sv);
|
||||
|
||||
// lecture des parametres
|
||||
readSettings();
|
||||
|
||||
// affichage
|
||||
show();
|
||||
}
|
||||
@@ -123,6 +125,7 @@ void QETDiagramEditor::closeEvent(QCloseEvent *qce) {
|
||||
}
|
||||
}
|
||||
if (can_quit) {
|
||||
writeSettings();
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
qce -> accept();
|
||||
}
|
||||
@@ -941,3 +944,23 @@ void QETDiagramEditor::slot_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_editDefaultConductors();
|
||||
void slot_addText();
|
||||
void readSettings();
|
||||
void writeSettings();
|
||||
|
||||
// attributs
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user