LayoutSettingsWidget Class Reference

#include <layoutSettingsWidget.h>

Inheritance diagram for LayoutSettingsWidget:

[legend]
Collaboration diagram for LayoutSettingsWidget:
[legend]
List of all members.

Detailed Description

Layout Settings.

Definition at line 41 of file layoutSettingsWidget.h.

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


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.

00035                                                                : QWidget( parent, name)
00036 {
00037   this->config = config;
00038 
00039   categoryLabel = new QLabel( tr("Appearance:"), this);
00040   QFont labelFont = categoryLabel->font();
00041   labelFont.setWeight(QFont::Bold);
00042   categoryLabel->setFont( labelFont );
00043 
00044   horizontalLine = new QFrame(this);
00045   horizontalLine->setLineWidth(2);
00046   horizontalLine->setMidLineWidth(1);
00047   horizontalLine->setFrameStyle( QFrame::HLine | QFrame::Raised );
00048   //----------------
00049   //General Settings:
00050   //-display image animations
00051   //-display tooltips
00052   generalSettings = new QVGroupBox( tr("General"), this);
00053   useAnimation = new QCheckBox( tr("Use animation"), generalSettings);
00054   showTooltips = new QCheckBox( tr("Show tooltips"), generalSettings);
00055   //----------------
00056   //Window placement and size Settings:
00057   //-restore old placement and size
00058   //-preset default size (% of screen size) and placement
00059   windowPlacementSize = new QVGroupBox( tr("Window Placement and Size"), this);
00060   restoreWindowPlacementSize = new QCheckBox( tr("Restore window placement and size"), windowPlacementSize);
00061 
00062   sizeFrame = new QFrame(windowPlacementSize);
00063   defaultWindowSizeLabel = new QLabel( tr("% of Screen:"), sizeFrame);
00064   defaultWindowSizeSlider = new QSlider(Qt::Horizontal, sizeFrame);
00065   defaultWindowSizeSlider->setMinValue(1);
00066   defaultWindowSizeSlider->setMaxValue(100);
00067   defaultWindowSizeValue = new QSpinBox(1,100,1,sizeFrame);
00068   defaultWindowSizeValue->setSuffix("%");
00069 
00070   defaultWindowPlacementLabel = new QLabel( tr("Placement:"), sizeFrame);
00071   defaultWindowPlacement = new QComboBox( sizeFrame );
00072   defaultWindowPlacement->insertItem( tr("Center") );
00073   defaultWindowPlacement->insertItem( tr("Top Left") );
00074   defaultWindowPlacement->insertItem( tr("Top Right") );
00075   defaultWindowPlacement->insertItem( tr("Bottom Left") );
00076   defaultWindowPlacement->insertItem( tr("Bottom Right") );
00077 
00078   //update spinbox value when slider moves
00079   connect( defaultWindowSizeSlider, SIGNAL(valueChanged(int)),
00080                    this, SLOT(defaultSizeSliderMoved(int)) );;
00081 
00082   //update slider when spinbox changes
00083   connect( defaultWindowSizeValue, SIGNAL(valueChanged(int)),
00084                    this, SLOT(defaultSizeSpinboxChanged(int)) );;
00085 
00086   //disable manual window size/placement settings when auto save position/location is checked
00087   connect( restoreWindowPlacementSize, SIGNAL(toggled(bool)),
00088                    this, SLOT(toggleDefaultSizeEnabled(bool)) );;
00089   //----------------
00090   //place window placement/size control in box grid
00091   manualPlacementGrid = new QGridLayout( sizeFrame, 2, 3, 0);  
00092   manualPlacementGrid->setSpacing( WIDGET_SPACING );
00093 
00094   manualPlacementGrid->addWidget(defaultWindowSizeLabel,  0, 0);
00095   manualPlacementGrid->addWidget(defaultWindowSizeSlider, 0, 1);
00096   manualPlacementGrid->setColStretch(1, 1);
00097   manualPlacementGrid->addWidget(defaultWindowSizeValue,  0, 2);
00098 
00099   manualPlacementGrid->addWidget(defaultWindowPlacementLabel,     1, 0);
00100   manualPlacementGrid->addMultiCellWidget(defaultWindowPlacement, 1, 1, 1, 2, Qt::AlignLeft);
00101   //----------------
00102   //Setup larger boxes in overall grid
00103   mainGrid = new QGridLayout( this, 5, 1, 0);
00104   mainGrid->setSpacing( WIDGET_SPACING );
00105   
00106   mainGrid->addWidget( categoryLabel,       0, 0, Qt::AlignLeft );
00107   mainGrid->addWidget( horizontalLine,      1, 0 );
00108   mainGrid->addWidget( generalSettings,     2, 0 );
00109   mainGrid->addWidget( windowPlacementSize, 3, 0 );
00110   mainGrid->setRowStretch( 4, 1 );
00111 }


Member Function Documentation

void LayoutSettingsWidget::setDefaults ( Configuration config  )  [static]

Definition at line 130 of file layoutSettingsWidget.cpp.

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

Referenced by Window::Window().

00131 {
00132   config->setBool( "layout", "animation", true );
00133   config->setBool( "layout", "showTooltips", true );
00134   config->setBool( "layout", "restoreWindowPlacementSize", true);
00135   //----
00136   QDesktopWidget *desktop = QApplication::desktop();
00137   int width = (8*desktop->width()) / 10;
00138   int height = (8*desktop->height()) / 10;
00139   config->setInt( "layout", "windowWidth", width );
00140   config->setInt( "layout", "windowHeight", height );
00141   config->setInt( "layout", "windowPosX", (desktop->width() - width) / 2 );
00142   config->setInt( "layout", "windowPosY", (desktop->height() - height) / 2 );
00143   //----
00144   config->setInt( "layout", "defaultWindowSize", 80 );
00145   config->setString( "layout", "defaultWindowPlacement", 0 );
00146 }

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().

00149 {
00150   useAnimation->setChecked( config->getBool( "layout", "animation" ));
00151   showTooltips->setChecked( config->getBool( "layout", "showTooltips" ));
00152   restoreWindowPlacementSize->setChecked( config->getBool( "layout", "restoreWindowPlacementSize" ));
00153   defaultWindowSizeValue->setValue( config->getInt( "layout", "defaultWindowSize" ));
00154   defaultWindowPlacement->setCurrentItem( config->getInt( "layout", "defaultWindowPlacement" ) );
00155 }

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().

00158 {
00159   //set setting values in config object so they are properly saved to disk
00160   config->setBool( "layout", "animation", useAnimation->isChecked() );
00161   config->setBool( "layout", "showTooltips", showTooltips->isChecked() );
00162   config->setBool( "layout", "restoreWindowPlacementSize", restoreWindowPlacementSize->isChecked());
00163   config->setInt( "layout", "defaultWindowSize", defaultWindowSizeValue->value() );
00164   config->setInt( "layout", "defaultWindowPlacement", defaultWindowPlacement->currentItem() );
00165 
00166   //apply setting changes to application behavior
00167   QToolTip::setGloballyEnabled( config->getBool( "layout", "showTooltips" ) );
00168   ((Window*)qApp->mainWidget())->getTitle()->useAnimation( config->getBool( "layout", "animation" ) );
00169 }

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

Definition at line 113 of file layoutSettingsWidget.cpp.

References defaultWindowSizeValue.

Referenced by LayoutSettingsWidget().

00114 {
00115   //update spinbox
00116   defaultWindowSizeValue->setValue( v );
00117 }

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

Definition at line 119 of file layoutSettingsWidget.cpp.

References defaultWindowSizeSlider.

Referenced by LayoutSettingsWidget().

00120 {
00121   //update slider
00122   defaultWindowSizeSlider->setValue( v );
00123 }

void LayoutSettingsWidget::toggleDefaultSizeEnabled ( bool  b  )  [private, slot]

Definition at line 125 of file layoutSettingsWidget.cpp.

References sizeFrame.

Referenced by LayoutSettingsWidget().

00126 {
00127   sizeFrame->setDisabled(b);
00128 }


Member Data Documentation

Configuration* LayoutSettingsWidget::config [private]

Backend config object pointer.

Definition at line 57 of file layoutSettingsWidget.h.

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

QGridLayout* LayoutSettingsWidget::mainGrid [private]

Definition at line 59 of file layoutSettingsWidget.h.

Referenced by LayoutSettingsWidget().

QLabel* LayoutSettingsWidget::categoryLabel [private]

Definition at line 62 of file layoutSettingsWidget.h.

Referenced by LayoutSettingsWidget().

QFrame* LayoutSettingsWidget::horizontalLine [private]

Definition at line 63 of file layoutSettingsWidget.h.

Referenced by LayoutSettingsWidget().

QVGroupBox* LayoutSettingsWidget::generalSettings [private]

Definition at line 66 of file layoutSettingsWidget.h.

Referenced by LayoutSettingsWidget().

QCheckBox* LayoutSettingsWidget::photosBackgroundImage [private]

Definition at line 67 of file layoutSettingsWidget.h.

QCheckBox* LayoutSettingsWidget::useAnimation [private]

Definition at line 68 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().

QFrame* LayoutSettingsWidget::sizeFrame [private]

Definition at line 72 of file layoutSettingsWidget.h.

Referenced by LayoutSettingsWidget(), and toggleDefaultSizeEnabled().

QGridLayout* LayoutSettingsWidget::manualPlacementGrid [private]

Definition at line 73 of file layoutSettingsWidget.h.

Referenced by LayoutSettingsWidget().

QVGroupBox* LayoutSettingsWidget::windowPlacementSize [private]

Definition at line 74 of file layoutSettingsWidget.h.

Referenced by LayoutSettingsWidget().

QCheckBox* LayoutSettingsWidget::restoreWindowPlacementSize [private]

Definition at line 75 of file layoutSettingsWidget.h.

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

QLabel* LayoutSettingsWidget::defaultWindowSizeLabel [private]

Definition at line 77 of file layoutSettingsWidget.h.

Referenced by LayoutSettingsWidget().

QSlider* LayoutSettingsWidget::defaultWindowSizeSlider [private]

Definition at line 78 of file layoutSettingsWidget.h.

Referenced by defaultSizeSpinboxChanged(), and LayoutSettingsWidget().

QSpinBox* LayoutSettingsWidget::defaultWindowSizeValue [private]

Definition at line 79 of file layoutSettingsWidget.h.

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

QLabel* LayoutSettingsWidget::defaultWindowPlacementLabel [private]

Definition at line 81 of file layoutSettingsWidget.h.

Referenced by LayoutSettingsWidget().

QComboBox* LayoutSettingsWidget::defaultWindowPlacement [private]

Definition at line 82 of file layoutSettingsWidget.h.

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


The documentation for this class was generated from the following files:
Generated on Wed Jan 24 05:38:10 2007 for AlbumShaper by  doxygen 1.5.1