AlbumShaper 1.0a3
LayoutSettingsWidget Class Reference

Layout Settings. More...

#include <layoutSettingsWidget.h>

Inheritance diagram for LayoutSettingsWidget:
Collaboration diagram for LayoutSettingsWidget:

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.
 
Q3GridLayout * mainGrid
 
QLabelcategoryLabel
 
Q3FramehorizontalLine
 
Q3VGroupBox * generalSettings
 
QCheckBox * photosBackgroundImage
 
QCheckBox * useAnimation
 
QCheckBox * showTooltips
 
Q3FramesizeFrame
 
Q3GridLayout * manualPlacementGrid
 
Q3VGroupBox * windowPlacementSize
 
QCheckBox * restoreWindowPlacementSize
 
QLabeldefaultWindowSizeLabel
 
QSliderdefaultWindowSizeSlider
 
QSpinBox * defaultWindowSizeValue
 
QLabeldefaultWindowPlacementLabel
 
QComboBox * defaultWindowPlacement
 

Detailed Description

Layout Settings.

Definition at line 45 of file layoutSettingsWidget.h.

Constructor & Destructor Documentation

◆ LayoutSettingsWidget()

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

Definition at line 36 of file layoutSettingsWidget.cpp.

38 : QWidget( parent, name)
39{
40 this->config = config;
41
42 categoryLabel = new QLabel( tr("Appearance:"), this);
43 QFont labelFont = categoryLabel->font();
44 labelFont.setWeight(QFont::Bold);
45 categoryLabel->setFont( labelFont );
46
47 horizontalLine = new Q3Frame(this);
48 horizontalLine->setLineWidth(2);
49 horizontalLine->setMidLineWidth(1);
50 horizontalLine->setFrameStyle( Q3Frame::HLine | Q3Frame::Raised );
51 //----------------
52 //General Settings:
53 //-display image animations
54 //-display tooltips
55 generalSettings = new Q3VGroupBox( tr("General"), this);
56 useAnimation = new QCheckBox( tr("Use animation"), generalSettings);
57 showTooltips = new QCheckBox( tr("Show tooltips"), generalSettings);
58 //----------------
59 //Window placement and size Settings:
60 //-restore old placement and size
61 //-preset default size (% of screen size) and placement
62 windowPlacementSize = new Q3VGroupBox( tr("Window Placement and Size"), this);
63 restoreWindowPlacementSize = new QCheckBox( tr("Restore window placement and size"), windowPlacementSize);
64
66 defaultWindowSizeLabel = new QLabel( tr("% of Screen:"), sizeFrame);
67 defaultWindowSizeSlider = new QSlider(Qt::Horizontal, sizeFrame);
68 defaultWindowSizeSlider->setMinValue(1);
69 defaultWindowSizeSlider->setMaxValue(100);
70 defaultWindowSizeValue = new QSpinBox(1,100,1,sizeFrame);
71 defaultWindowSizeValue->setSuffix("%");
72
73 defaultWindowPlacementLabel = new QLabel( tr("Placement:"), sizeFrame);
74 defaultWindowPlacement = new QComboBox( sizeFrame );
75 defaultWindowPlacement->insertItem( tr("Center") );
76 defaultWindowPlacement->insertItem( tr("Top Left") );
77 defaultWindowPlacement->insertItem( tr("Top Right") );
78 defaultWindowPlacement->insertItem( tr("Bottom Left") );
79 defaultWindowPlacement->insertItem( tr("Bottom Right") );
80
81 //update spinbox value when slider moves
82 connect( defaultWindowSizeSlider, SIGNAL(valueChanged(int)),
83 this, SLOT(defaultSizeSliderMoved(int)) );;
84
85 //update slider when spinbox changes
86 connect( defaultWindowSizeValue, SIGNAL(valueChanged(int)),
87 this, SLOT(defaultSizeSpinboxChanged(int)) );;
88
89 //disable manual window size/placement settings when auto save position/location is checked
90 connect( restoreWindowPlacementSize, SIGNAL(toggled(bool)),
91 this, SLOT(toggleDefaultSizeEnabled(bool)) );;
92 //----------------
93 //place window placement/size control in box grid
94 manualPlacementGrid = new Q3GridLayout( sizeFrame, 2, 3, 0);
96
99 manualPlacementGrid->setColStretch(1, 1);
101
103 manualPlacementGrid->addMultiCellWidget(defaultWindowPlacement, 1, 1, 1, 2, Qt::AlignLeft);
104 //----------------
105 //Setup larger boxes in overall grid
106 mainGrid = new Q3GridLayout( this, 5, 1, 0);
107 mainGrid->setSpacing( WIDGET_SPACING );
108
109 mainGrid->addWidget( categoryLabel, 0, 0, Qt::AlignLeft );
110 mainGrid->addWidget( horizontalLine, 1, 0 );
111 mainGrid->addWidget( generalSettings, 2, 0 );
112 mainGrid->addWidget( windowPlacementSize, 3, 0 );
113 mainGrid->setRowStretch( 4, 1 );
114}
Q3GridLayout * manualPlacementGrid
Configuration * config
Backend config object pointer.
void defaultSizeSpinboxChanged(int val)
QCheckBox * restoreWindowPlacementSize
Q3VGroupBox * windowPlacementSize
#define WIDGET_SPACING
Definition config.h:31

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

Member Function Documentation

◆ defaultSizeSliderMoved

void LayoutSettingsWidget::defaultSizeSliderMoved ( int val)
privateslot

Definition at line 116 of file layoutSettingsWidget.cpp.

117{
118 //update spinbox
119 defaultWindowSizeValue->setValue( v );
120}

References defaultWindowSizeValue.

Referenced by LayoutSettingsWidget().

◆ defaultSizeSpinboxChanged

void LayoutSettingsWidget::defaultSizeSpinboxChanged ( int val)
privateslot

Definition at line 122 of file layoutSettingsWidget.cpp.

123{
124 //update slider
125 defaultWindowSizeSlider->setValue( v );
126}

References defaultWindowSizeSlider.

Referenced by LayoutSettingsWidget().

◆ loadSettings()

void LayoutSettingsWidget::loadSettings ( )

Definition at line 151 of file layoutSettingsWidget.cpp.

152{
153 useAnimation->setChecked( config->getBool( "layout", "animation" ));
154 showTooltips->setChecked( config->getBool( "layout", "showTooltips" ));
155 restoreWindowPlacementSize->setChecked( config->getBool( "layout", "restoreWindowPlacementSize" ));
156 defaultWindowSizeValue->setValue( config->getInt( "layout", "defaultWindowSize" ));
157 defaultWindowPlacement->setCurrentItem( config->getInt( "layout", "defaultWindowPlacement" ) );
158}
bool getBool(QString group, QString key)
Fetch bool setting.
int getInt(QString group, QString key)
Fetch int setting.

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

Referenced by ConfigurationWidget::ConfigurationWidget().

◆ saveSettings()

void LayoutSettingsWidget::saveSettings ( )

Definition at line 160 of file layoutSettingsWidget.cpp.

161{
162 //set setting values in config object so they are properly saved to disk
163 config->setBool( "layout", "animation", useAnimation->isChecked() );
164 config->setBool( "layout", "showTooltips", showTooltips->isChecked() );
165 config->setBool( "layout", "restoreWindowPlacementSize", restoreWindowPlacementSize->isChecked());
166 config->setInt( "layout", "defaultWindowSize", defaultWindowSizeValue->value() );
167 config->setInt( "layout", "defaultWindowPlacement", defaultWindowPlacement->currentItem() );
168
169 //apply setting changes to application behavior
170 //QToolTip::setGloballyEnabled( config->getBool( "layout", "showTooltips" ) );
171 ((Window*)qApp->mainWidget())->getTitle()->useAnimation( config->getBool( "layout", "animation" ) );
172}
void setInt(QString group, QString key, int val)
Set int setting.
void setBool(QString group, QString key, bool val)
Set bool setting.
Top level widget, encapsulates the title widget, the layout widget, and the toolbar widget.
Definition window.h:40

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

Referenced by ConfigurationWidget::saveSettings().

◆ setDefaults()

void LayoutSettingsWidget::setDefaults ( Configuration * config)
static

Definition at line 133 of file layoutSettingsWidget.cpp.

134{
135 config->setBool( "layout", "animation", true );
136 config->setBool( "layout", "showTooltips", true );
137 config->setBool( "layout", "restoreWindowPlacementSize", true);
138 //----
139 QDesktopWidget *desktop = QApplication::desktop();
140 int width = (8*desktop->width()) / 10;
141 int height = (8*desktop->height()) / 10;
142 config->setInt( "layout", "windowWidth", width );
143 config->setInt( "layout", "windowHeight", height );
144 config->setInt( "layout", "windowPosX", (desktop->width() - width) / 2 );
145 config->setInt( "layout", "windowPosY", (desktop->height() - height) / 2 );
146 //----
147 config->setInt( "layout", "defaultWindowSize", 80 );
148 config->setString( "layout", "defaultWindowPlacement", 0 );
149}
int width
Definition blur.cpp:79
int height
Definition blur.cpp:79
void setString(QString group, QString key, QString value)
Sets a setting value, if group does not exist it is created, if setting does not exist it is also cre...

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

Referenced by Window::Window().

◆ toggleDefaultSizeEnabled

void LayoutSettingsWidget::toggleDefaultSizeEnabled ( bool b)
privateslot

Definition at line 128 of file layoutSettingsWidget.cpp.

129{
130 sizeFrame->setDisabled(b);
131}
long b

References b, and sizeFrame.

Referenced by LayoutSettingsWidget().

Member Data Documentation

◆ categoryLabel

QLabel* LayoutSettingsWidget::categoryLabel
private

Definition at line 66 of file layoutSettingsWidget.h.

Referenced by LayoutSettingsWidget().

◆ config

Configuration* LayoutSettingsWidget::config
private

Backend config object pointer.

Definition at line 61 of file layoutSettingsWidget.h.

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

◆ defaultWindowPlacement

QComboBox* LayoutSettingsWidget::defaultWindowPlacement
private

Definition at line 86 of file layoutSettingsWidget.h.

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

◆ defaultWindowPlacementLabel

QLabel* LayoutSettingsWidget::defaultWindowPlacementLabel
private

Definition at line 85 of file layoutSettingsWidget.h.

Referenced by LayoutSettingsWidget().

◆ defaultWindowSizeLabel

QLabel* LayoutSettingsWidget::defaultWindowSizeLabel
private

Definition at line 81 of file layoutSettingsWidget.h.

Referenced by LayoutSettingsWidget().

◆ defaultWindowSizeSlider

QSlider* LayoutSettingsWidget::defaultWindowSizeSlider
private

Definition at line 82 of file layoutSettingsWidget.h.

Referenced by defaultSizeSpinboxChanged(), and LayoutSettingsWidget().

◆ defaultWindowSizeValue

QSpinBox* LayoutSettingsWidget::defaultWindowSizeValue
private

◆ generalSettings

Q3VGroupBox* LayoutSettingsWidget::generalSettings
private

Definition at line 70 of file layoutSettingsWidget.h.

Referenced by LayoutSettingsWidget().

◆ horizontalLine

Q3Frame* LayoutSettingsWidget::horizontalLine
private

Definition at line 67 of file layoutSettingsWidget.h.

Referenced by LayoutSettingsWidget().

◆ mainGrid

Q3GridLayout* LayoutSettingsWidget::mainGrid
private

Definition at line 63 of file layoutSettingsWidget.h.

Referenced by LayoutSettingsWidget().

◆ manualPlacementGrid

Q3GridLayout* LayoutSettingsWidget::manualPlacementGrid
private

Definition at line 77 of file layoutSettingsWidget.h.

Referenced by LayoutSettingsWidget().

◆ photosBackgroundImage

QCheckBox* LayoutSettingsWidget::photosBackgroundImage
private

Definition at line 71 of file layoutSettingsWidget.h.

◆ restoreWindowPlacementSize

QCheckBox* LayoutSettingsWidget::restoreWindowPlacementSize
private

Definition at line 79 of file layoutSettingsWidget.h.

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

◆ showTooltips

QCheckBox* LayoutSettingsWidget::showTooltips
private

Definition at line 73 of file layoutSettingsWidget.h.

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

◆ sizeFrame

Q3Frame* LayoutSettingsWidget::sizeFrame
private

Definition at line 76 of file layoutSettingsWidget.h.

Referenced by LayoutSettingsWidget(), and toggleDefaultSizeEnabled().

◆ useAnimation

QCheckBox* LayoutSettingsWidget::useAnimation
private

Definition at line 72 of file layoutSettingsWidget.h.

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

◆ windowPlacementSize

Q3VGroupBox* LayoutSettingsWidget::windowPlacementSize
private

Definition at line 78 of file layoutSettingsWidget.h.

Referenced by LayoutSettingsWidget().


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