/[svn]/qsampler/trunk/src/qsamplerOptions.cpp
ViewVC logotype

Diff of /qsampler/trunk/src/qsamplerOptions.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2028 by capela, Wed Nov 4 18:59:57 2009 UTC revision 2077 by capela, Wed Mar 31 09:07:30 2010 UTC
# Line 1  Line 1 
1  // qsamplerOptions.cpp  // qsamplerOptions.cpp
2  //  //
3  /****************************************************************************  /****************************************************************************
4     Copyright (C) 2004-2009, rncbc aka Rui Nuno Capela. All rights reserved.     Copyright (C) 2004-2010, rncbc aka Rui Nuno Capela. All rights reserved.
5     Copyright (C) 2007, Christian Schoenebeck     Copyright (C) 2007, Christian Schoenebeck
6    
7     This program is free software; you can redistribute it and/or     This program is free software; you can redistribute it and/or
# Line 356  bool Options::parse_args ( const QString Line 356  bool Options::parse_args ( const QString
356  //---------------------------------------------------------------------------  //---------------------------------------------------------------------------
357  // Widget geometry persistence helper methods.  // Widget geometry persistence helper methods.
358    
359  void Options::loadWidgetGeometry ( QWidget *pWidget )  void Options::loadWidgetGeometry ( QWidget *pWidget, bool bVisible )
360  {  {
361          // Try to restore old form window positioning.          // Try to restore old form window positioning.
362          if (pWidget) {          if (pWidget) {
363                  QPoint fpos;                  QPoint wpos;
364                  QSize  fsize;                  QSize  wsize;
                 bool bVisible;  
365                  m_settings.beginGroup("/Geometry/" + pWidget->objectName());                  m_settings.beginGroup("/Geometry/" + pWidget->objectName());
366                  fpos.setX(m_settings.value("/x", -1).toInt());                  wpos.setX(m_settings.value("/x", -1).toInt());
367                  fpos.setY(m_settings.value("/y", -1).toInt());                  wpos.setY(m_settings.value("/y", -1).toInt());
368                  fsize.setWidth(m_settings.value("/width", -1).toInt());                  wsize.setWidth(m_settings.value("/width", -1).toInt());
369                  fsize.setHeight(m_settings.value("/height", -1).toInt());                  wsize.setHeight(m_settings.value("/height", -1).toInt());
370                  bVisible = m_settings.value("/visible", false).toBool();                  if (!bVisible) bVisible = m_settings.value("/visible", false).toBool();
371                  m_settings.endGroup();                  m_settings.endGroup();
372                  if (fpos.x() > 0 && fpos.y() > 0)                  if (wpos.x() > 0 && wpos.y() > 0)
373                          pWidget->move(fpos);                          pWidget->move(wpos);
374                  if (fsize.width() > 0 && fsize.height() > 0)                  if (wsize.width() > 0 && wsize.height() > 0)
375                          pWidget->resize(fsize);                          pWidget->resize(wsize);
376                  else          //      else
377                          pWidget->adjustSize();          //              pWidget->adjustSize();
378                  if (bVisible)                  if (bVisible)
379                          pWidget->show();                          pWidget->show();
380                  else          //      else
381                          pWidget->hide();          //              pWidget->hide();
382          }          }
383  }  }
384    
385    
386  void Options::saveWidgetGeometry ( QWidget *pWidget )  void Options::saveWidgetGeometry ( QWidget *pWidget, bool bVisible )
387  {  {
388          // Try to save form window position...          // Try to save form window position...
389          // (due to X11 window managers ideossincrasies, we better          // (due to X11 window managers ideossincrasies, we better
390          // only save the form geometry while its up and visible)          // only save the form geometry while its up and visible)
391          if (pWidget) {          if (pWidget) {
392                  m_settings.beginGroup("/Geometry/" + pWidget->objectName());                  m_settings.beginGroup("/Geometry/" + pWidget->objectName());
393                  bool bVisible = pWidget->isVisible();                  const QPoint& wpos  = pWidget->pos();
394                  const QPoint& fpos  = pWidget->pos();                  const QSize&  wsize = pWidget->size();
395                  const QSize&  fsize = pWidget->size();                  if (!bVisible) bVisible = pWidget->isVisible();
396                  m_settings.setValue("/x", fpos.x());                  m_settings.setValue("/x", wpos.x());
397                  m_settings.setValue("/y", fpos.y());                  m_settings.setValue("/y", wpos.y());
398                  m_settings.setValue("/width", fsize.width());                  m_settings.setValue("/width", wsize.width());
399                  m_settings.setValue("/height", fsize.height());                  m_settings.setValue("/height", wsize.height());
400                  m_settings.setValue("/visible", bVisible);                  m_settings.setValue("/visible", bVisible);
401                  m_settings.endGroup();                  m_settings.endGroup();
402          }          }

Legend:
Removed from v.2028  
changed lines
  Added in v.2077

  ViewVC Help
Powered by ViewVC