AlbumShaper  1.0a3
Public Member Functions | Static Public Member Functions | Private Slots | Private Attributes
LayoutSettingsWidget Class Reference

Layout Settings. More...

#include <layoutSettingsWidget.h>

Inheritance diagram for LayoutSettingsWidget:
Inheritance graph
[legend]
Collaboration diagram for LayoutSettingsWidget:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 LayoutSettingsWidget (Configuration *config, QWidget *parent=0, const char *name=0)
void loadSettings ()
void saveSettings ()

Static Public Member Functions

static void setDefaults (Configuration *config)

Private Slots

void defaultSizeSliderMoved (int val)
void defaultSizeSpinboxChanged (int val)
void toggleDefaultSizeEnabled (bool b)

Private Attributes

Configurationconfig
 Backend config object pointer.
QGridLayout * mainGrid
QLabelcategoryLabel
QFramehorizontalLine
QVGroupBox * generalSettings
QCheckBox * photosBackgroundImage
QCheckBox * useAnimation
QCheckBox * showTooltips
QFramesizeFrame
QGridLayout * manualPlacementGrid
QVGroupBox * windowPlacementSize
QCheckBox * restoreWindowPlacementSize
QLabeldefaultWindowSizeLabel
QSliderdefaultWindowSizeSlider
QSpinBox * defaultWindowSizeValue
QLabeldefaultWindowPlacementLabel
QComboBox * defaultWindowPlacement

Detailed Description

Layout Settings.

Definition at line 41 of file layoutSettingsWidget.h.


Constructor & Destructor Documentation

LayoutSettingsWidget::LayoutSettingsWidget ( Configuration config,
QWidget parent = 0,
const char *  name = 0 
)

Definition at line 33 of file layoutSettingsWidget.cpp.

References categoryLabel, config, defaultSizeSliderMoved(), defaultSizeSpinboxChanged(), defaultWindowPlacement, defaultWindowPlacementLabel, defaultWindowSizeLabel, defaultWindowSizeSlider, defaultWindowSizeValue, generalSettings, horizontalLine, mainGrid, manualPlacementGrid, restoreWindowPlacementSize, showTooltips, sizeFrame, toggleDefaultSizeEnabled(), useAnimation, WIDGET_SPACING, and windowPlacementSize.

                                                               : QWidget( parent, name)
{
  this->config = config;

  categoryLabel = new QLabel( tr("Appearance:"), this);
  QFont labelFont = categoryLabel->font();
  labelFont.setWeight(QFont::Bold);
  categoryLabel->setFont( labelFont );

  horizontalLine = new QFrame(this);
  horizontalLine->setLineWidth(2);
  horizontalLine->setMidLineWidth(1);
  horizontalLine->setFrameStyle( QFrame::HLine | QFrame::Raised );
  //----------------
  //General Settings:
  //-display image animations
  //-display tooltips
  generalSettings = new QVGroupBox( tr("General"), this);
  useAnimation = new QCheckBox( tr("Use animation"), generalSettings);
  showTooltips = new QCheckBox( tr("Show tooltips"), generalSettings);
  //----------------
  //Window placement and size Settings:
  //-restore old placement and size
  //-preset default size (% of screen size) and placement
  windowPlacementSize = new QVGroupBox( tr("Window Placement and Size"), this);
  restoreWindowPlacementSize = new QCheckBox( tr("Restore window placement and size"), windowPlacementSize);

  sizeFrame = new QFrame(windowPlacementSize);
  defaultWindowSizeLabel = new QLabel( tr("% of Screen:"), sizeFrame);
  defaultWindowSizeSlider = new QSlider(Qt::Horizontal, sizeFrame);
  defaultWindowSizeSlider->setMinValue(1);
  defaultWindowSizeSlider->setMaxValue(100);
  defaultWindowSizeValue = new QSpinBox(1,100,1,sizeFrame);
  defaultWindowSizeValue->setSuffix("%");

  defaultWindowPlacementLabel = new QLabel( tr("Placement:"), sizeFrame);
  defaultWindowPlacement = new QComboBox( sizeFrame );
  defaultWindowPlacement->insertItem( tr("Center") );
  defaultWindowPlacement->insertItem( tr("Top Left") );
  defaultWindowPlacement->insertItem( tr("Top Right") );
  defaultWindowPlacement->insertItem( tr("Bottom Left") );
  defaultWindowPlacement->insertItem( tr("Bottom Right") );

  //update spinbox value when slider moves
  connect( defaultWindowSizeSlider, SIGNAL(valueChanged(int)),
                   this, SLOT(defaultSizeSliderMoved(int)) );;

  //update slider when spinbox changes
  connect( defaultWindowSizeValue, SIGNAL(valueChanged(int)),
                   this, SLOT(defaultSizeSpinboxChanged(int)) );;

  //disable manual window size/placement settings when auto save position/location is checked
  connect( restoreWindowPlacementSize, SIGNAL(toggled(bool)),
                   this, SLOT(toggleDefaultSizeEnabled(bool)) );;
  //----------------
  //place window placement/size control in box grid
  manualPlacementGrid = new QGridLayout( sizeFrame, 2, 3, 0);  
  manualPlacementGrid->setSpacing( WIDGET_SPACING );

  manualPlacementGrid->addWidget(defaultWindowSizeLabel,  0, 0);
  manualPlacementGrid->addWidget(defaultWindowSizeSlider, 0, 1);
  manualPlacementGrid->setColStretch(1, 1);
  manualPlacementGrid->addWidget(defaultWindowSizeValue,  0, 2);

  manualPlacementGrid->addWidget(defaultWindowPlacementLabel,     1, 0);
  manualPlacementGrid->addMultiCellWidget(defaultWindowPlacement, 1, 1, 1, 2, Qt::AlignLeft);
  //----------------
  //Setup larger boxes in overall grid
  mainGrid = new QGridLayout( this, 5, 1, 0);
  mainGrid->setSpacing( WIDGET_SPACING );
  
  mainGrid->addWidget( categoryLabel,       0, 0, Qt::AlignLeft );
  mainGrid->addWidget( horizontalLine,      1, 0 );
  mainGrid->addWidget( generalSettings,     2, 0 );
  mainGrid->addWidget( windowPlacementSize, 3, 0 );
  mainGrid->setRowStretch( 4, 1 );
}

Member Function Documentation

void LayoutSettingsWidget::defaultSizeSliderMoved ( int  val) [private, slot]

Definition at line 113 of file layoutSettingsWidget.cpp.

References defaultWindowSizeValue.

Referenced by LayoutSettingsWidget().

{
  //update spinbox
  defaultWindowSizeValue->setValue( v );
}
void LayoutSettingsWidget::defaultSizeSpinboxChanged ( int  val) [private, slot]

Definition at line 119 of file layoutSettingsWidget.cpp.

References defaultWindowSizeSlider.

Referenced by LayoutSettingsWidget().

{
  //update slider
  defaultWindowSizeSlider->setValue( v );
}
void LayoutSettingsWidget::loadSettings ( )

Definition at line 148 of file layoutSettingsWidget.cpp.

References config, defaultWindowPlacement, defaultWindowSizeValue, Configuration::getBool(), Configuration::getInt(), restoreWindowPlacementSize, showTooltips, and useAnimation.

Referenced by ConfigurationWidget::ConfigurationWidget().

{
  useAnimation->setChecked( config->getBool( "layout", "animation" ));
  showTooltips->setChecked( config->getBool( "layout", "showTooltips" ));
  restoreWindowPlacementSize->setChecked( config->getBool( "layout", "restoreWindowPlacementSize" ));
  defaultWindowSizeValue->setValue( config->getInt( "layout", "defaultWindowSize" ));
  defaultWindowPlacement->setCurrentItem( config->getInt( "layout", "defaultWindowPlacement" ) );
}
void LayoutSettingsWidget::saveSettings ( )

Definition at line 157 of file layoutSettingsWidget.cpp.

References config, defaultWindowPlacement, defaultWindowSizeValue, Configuration::getBool(), restoreWindowPlacementSize, Configuration::setBool(), Configuration::setInt(), showTooltips, and useAnimation.

Referenced by ConfigurationWidget::saveSettings().

{
  //set setting values in config object so they are properly saved to disk
  config->setBool( "layout", "animation", useAnimation->isChecked() );
  config->setBool( "layout", "showTooltips", showTooltips->isChecked() );
  config->setBool( "layout", "restoreWindowPlacementSize", restoreWindowPlacementSize->isChecked());
  config->setInt( "layout", "defaultWindowSize", defaultWindowSizeValue->value() );
  config->setInt( "layout", "defaultWindowPlacement", defaultWindowPlacement->currentItem() );

  //apply setting changes to application behavior
  QToolTip::setGloballyEnabled( config->getBool( "layout", "showTooltips" ) );
  ((Window*)qApp->mainWidget())->getTitle()->useAnimation( config->getBool( "layout", "animation" ) );
}
void LayoutSettingsWidget::setDefaults ( Configuration config) [static]

Definition at line 130 of file layoutSettingsWidget.cpp.

References height, Configuration::setBool(), Configuration::setInt(), Configuration::setString(), and width.

Referenced by Window::Window().

{
  config->setBool( "layout", "animation", true );
  config->setBool( "layout", "showTooltips", true );
  config->setBool( "layout", "restoreWindowPlacementSize", true);
  //----
  QDesktopWidget *desktop = QApplication::desktop();
  int width = (8*desktop->width()) / 10;
  int height = (8*desktop->height()) / 10;
  config->setInt( "layout", "windowWidth", width );
  config->setInt( "layout", "windowHeight", height );
  config->setInt( "layout", "windowPosX", (desktop->width() - width) / 2 );
  config->setInt( "layout", "windowPosY", (desktop->height() - height) / 2 );
  //----
  config->setInt( "layout", "defaultWindowSize", 80 );
  config->setString( "layout", "defaultWindowPlacement", 0 );
}
void LayoutSettingsWidget::toggleDefaultSizeEnabled ( bool  b) [private, slot]

Definition at line 125 of file layoutSettingsWidget.cpp.

References sizeFrame.

Referenced by LayoutSettingsWidget().

{
  sizeFrame->setDisabled(b);
}

Member Data Documentation

Definition at line 62 of file layoutSettingsWidget.h.

Referenced by LayoutSettingsWidget().

Backend config object pointer.

Definition at line 57 of file layoutSettingsWidget.h.

Referenced by LayoutSettingsWidget(), loadSettings(), and saveSettings().

Definition at line 82 of file layoutSettingsWidget.h.

Referenced by LayoutSettingsWidget(), loadSettings(), and saveSettings().

Definition at line 81 of file layoutSettingsWidget.h.

Referenced by LayoutSettingsWidget().

Definition at line 77 of file layoutSettingsWidget.h.

Referenced by LayoutSettingsWidget().

Definition at line 78 of file layoutSettingsWidget.h.

Referenced by defaultSizeSpinboxChanged(), and LayoutSettingsWidget().

Definition at line 66 of file layoutSettingsWidget.h.

Referenced by LayoutSettingsWidget().

Definition at line 63 of file layoutSettingsWidget.h.

Referenced by LayoutSettingsWidget().

QGridLayout* LayoutSettingsWidget::mainGrid [private]

Definition at line 59 of file layoutSettingsWidget.h.

Referenced by LayoutSettingsWidget().

Definition at line 73 of file layoutSettingsWidget.h.

Referenced by LayoutSettingsWidget().

Definition at line 67 of file layoutSettingsWidget.h.

Definition at line 75 of file layoutSettingsWidget.h.

Referenced by LayoutSettingsWidget(), loadSettings(), and saveSettings().

QCheckBox* LayoutSettingsWidget::showTooltips [private]

Definition at line 69 of file layoutSettingsWidget.h.

Referenced by LayoutSettingsWidget(), loadSettings(), and saveSettings().

Definition at line 72 of file layoutSettingsWidget.h.

Referenced by LayoutSettingsWidget(), and toggleDefaultSizeEnabled().

QCheckBox* LayoutSettingsWidget::useAnimation [private]

Definition at line 68 of file layoutSettingsWidget.h.

Referenced by LayoutSettingsWidget(), loadSettings(), and saveSettings().

Definition at line 74 of file layoutSettingsWidget.h.

Referenced by LayoutSettingsWidget().


The documentation for this class was generated from the following files: