AlbumShaper 1.0a3
ConfigurationWidget Class Reference

Configuration/Settings Interface. More...

#include <configurationWidget.h>

Inheritance diagram for ConfigurationWidget:
Collaboration diagram for ConfigurationWidget:

Signals

void closed ()
 

Public Member Functions

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

Private Slots

void updateDialogue (Q3IconViewItem *selection)
 updates shown settings dialogue based on newly selected group
 
void repaintGroup (Q3IconViewItem *pseudoSelection)
 repaints a group icon if move is moved over it
 
void clearPseudoSelection ()
 clears any pseudo selections
 
void saveSettings ()
 
void reject ()
 

Private Member Functions

void closeEvent (QCloseEvent *e)
 

Private Attributes

Configurationconfig
 Backend config object pointer.
 
Q3GridLayout * grid
 Grid widgets place in.
 
GroupsWidgetgroups
 list of subalbums
 
LoadingSavingWidgetloadingSavingWidget
 settings widgets
 
LayoutSettingsWidgetlayoutWidget
 
AlertsWidgetalertsWidget
 
QWidgetcurrentSettingsWidget
 
GroupIconcurrentPseudoSelection
 
GroupIconalertsIcon
 settings icons
 
GroupIconlayoutIcon
 
GroupIconloadingSavingIcon
 
Q3FramebuttonsFrame
 
QPushButton * okButton
 
QPushButton * cancelButton
 
Q3GridLayout * buttonsGrid
 

Detailed Description

Configuration/Settings Interface.

Definition at line 39 of file configurationWidget.h.

Constructor & Destructor Documentation

◆ ConfigurationWidget()

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

Definition at line 34 of file configurationWidget.cpp.

36 :
37 QDialog(parent,name)
38{
39 //store config pointer
40 this->config = config;
41 //--
42 //set window title
43 setCaption( tr("Settings"));
44 //--
45 //no icon currently hovered over
47 //----------------------------------------------
48 //create settings widget
51 alertsWidget = new AlertsWidget( config, this );
52 //----------------------------------------------
53 //create iconview and icons for groups
54 groups = new GroupsWidget( this );
55 groups->setItemTextPos( Q3IconView::Right );
56// groups->setMaxItemWidth(20);
57 //----
58 //construct group labels
59 QString labels[3];
60 labels[0] = tr("Appearance");
61 labels[1] = tr("Load/Save");
62 labels[2] = tr("Alerts");
63 //----
64 //find max text width
65 int maxLabelWidth = 0;
66 int i;
67 QFontMetrics fm( qApp->font() );
68 for(i=0; i<3; i++)
69 {
70 if( fm.width( labels[i] ) > maxLabelWidth )
71 maxLabelWidth = fm.width( labels[i] );
72 }
73 groups->setTextWidth( maxLabelWidth );
74 //----
75 //construct actual group icons
76 layoutIcon = new GroupIcon( groups, QPixmap(QString(IMAGE_PATH)+"settingsIcons/layout.png" ),
77 labels[0], layoutWidget );
78 layoutIcon->setDragEnabled(false);
79 //----
80 loadingSavingIcon = new GroupIcon( groups, QPixmap(QString(IMAGE_PATH)+"settingsIcons/loadsave.png" ),
81 labels[1], loadingSavingWidget );
82 loadingSavingIcon->setDragEnabled(false);
83 //----
84 alertsIcon = new GroupIcon( groups, QPixmap(QString(IMAGE_PATH)+"settingsIcons/alerts.png" ),
85 labels[2], alertsWidget );
86 alertsIcon->setDragEnabled(false);
87 //-------------------------
88 //set default selection
90 layoutIcon->setSelected(true);
91 loadingSavingWidget->hide();
92 alertsWidget->hide();
93 //-------------------------
94 //connect selectionChanged signal to update which settings dialog is displayed
95 connect( groups, SIGNAL(selectionChanged(Q3IconViewItem*)),
97
98 //connect mouse over events to paint pseudo selection in ligher blue
99 connect( groups, SIGNAL(onItem(Q3IconViewItem*)),
101
102 //clear any pseudo selection when mouse moves off icons
103 connect( groups, SIGNAL(onViewport()),
104 SLOT(clearPseudoSelection()) );
105
106
107 //create buttons frame and widgets
108 buttonsFrame = new Q3Frame( this );
109 okButton = new QPushButton( tr("Apply"), buttonsFrame );
110 okButton->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
111 okButton->setDefault(true);
112 connect( okButton, SIGNAL(clicked()), SLOT(saveSettings()) );
113 cancelButton = new QPushButton( tr("Cancel"), buttonsFrame );
114 cancelButton->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
115 connect( cancelButton, SIGNAL(clicked()), SLOT(reject()) );
116 buttonsGrid = new Q3GridLayout( buttonsFrame, 1, 5, 0 );
117 buttonsGrid->setColStretch( 0, 1 );
118 buttonsGrid->addWidget( okButton, 0, 1 );
119 buttonsGrid->addColSpacing( 2, 10 );
120 buttonsGrid->addWidget( cancelButton, 0, 3 );
121 buttonsGrid->setColStretch( 4, 1 );
122 //----------------------------------------------
123 //place all widgets in a grid
124 grid = new Q3GridLayout( this, 5, 5, 0 );
125
126 grid->setRowSpacing(0,8);
127
128 grid->addWidget( groups, 1, 1);
129 grid->addWidget( alertsWidget, 1, 3);
130 grid->addWidget( layoutWidget, 1, 3);
131 grid->addWidget( loadingSavingWidget, 1, 3);
132 grid->setRowStretch( 1, 1 );
133 grid->setColStretch( 3, 1 );
134
135 grid->setRowSpacing(2,8);
136
137 grid->addMultiCellWidget( buttonsFrame, 3, 3, 0, 4);
138
139 grid->setRowSpacing(4,8);
140
141 grid->setColSpacing(0,8);
142 grid->setColSpacing(2,8);
143 grid->setColSpacing(4,8);
144
145 groups->setGridX(1);
146 groups->arrangeItemsInGrid();
147
148 int maxWidth = 0;
149 int maxHeight = 0;
150
151 layoutWidget->constPolish();
152 loadingSavingWidget->constPolish();
153 alertsWidget->constPolish();
154 groups->constPolish();
155
156 QSize s = layoutWidget->minimumSizeHint();
157 if(maxWidth < s.width()) maxWidth = s.width();
158 if(maxHeight < s.height()) maxHeight = s.height();
159
160 s = loadingSavingWidget->minimumSizeHint();
161 if(maxWidth < s.width()) maxWidth = s.width();
162 if(maxHeight < s.height()) maxHeight = s.height();
163
164 s = alertsWidget->minimumSizeHint();
165 if(maxWidth < s.width()) maxWidth = s.width();
166 if(maxHeight < s.height()) maxHeight = s.height();
167
168 s = groups->minimumSizeHint();
169 if(maxHeight < s.height()) maxHeight = s.height();
170
171 maxWidth = maxWidth + s.width();
172 maxHeight += okButton->minimumSizeHint().height();
173 //add padding
174 maxWidth += 3*8;
175 maxHeight += 3*8;
176
177 //add a little extra for when text entries need more space
178 maxWidth += 100;
179
180 resize( maxWidth, maxHeight );
181
182 show();
183 setFixedSize(size());
184 //----------------------------------------------
185 //load setting values
189 //----------------------------------------------
190}
Alerts Settings.
void loadSettings()
GroupIcon * currentPseudoSelection
void clearPseudoSelection()
clears any pseudo selections
Q3GridLayout * grid
Grid widgets place in.
void updateDialogue(Q3IconViewItem *selection)
updates shown settings dialogue based on newly selected group
Configuration * config
Backend config object pointer.
LoadingSavingWidget * loadingSavingWidget
settings widgets
GroupIcon * alertsIcon
settings icons
void repaintGroup(Q3IconViewItem *pseudoSelection)
repaints a group icon if move is moved over it
AlertsWidget * alertsWidget
GroupsWidget * groups
list of subalbums
LayoutSettingsWidget * layoutWidget
Displays group icon and text, also contains pointer to widget for setting group settings.
Definition groupIcon.h:31
Displays group icon and text, also contains pointer to widget for setting group settings.
void setTextWidth(int val)
Loading/Saving Settings.
QString IMAGE_PATH
Definition config.cpp:18

References alertsIcon, alertsWidget, buttonsFrame, buttonsGrid, cancelButton, clearPseudoSelection(), config, currentPseudoSelection, currentSettingsWidget, grid, groups, IMAGE_PATH, layoutIcon, layoutWidget, loadingSavingIcon, loadingSavingWidget, AlertsWidget::loadSettings(), LayoutSettingsWidget::loadSettings(), LoadingSavingWidget::loadSettings(), okButton, reject(), repaintGroup(), saveSettings(), GroupsWidget::setTextWidth(), and updateDialogue().

Member Function Documentation

◆ clearPseudoSelection

void ConfigurationWidget::clearPseudoSelection ( )
privateslot

clears any pseudo selections

Definition at line 213 of file configurationWidget.cpp.

214{
215 //if old pseudo selection unselect it
216 if(currentPseudoSelection != NULL)
217 {
219 groups->repaintItem(currentPseudoSelection);
221 }
222}
void setMousedOver(bool val)
Definition groupIcon.cpp:72

References currentPseudoSelection, groups, and GroupIcon::setMousedOver().

Referenced by ConfigurationWidget(), and repaintGroup().

◆ closed

void ConfigurationWidget::closed ( )
signal

Referenced by closeEvent(), and reject().

◆ closeEvent()

void ConfigurationWidget::closeEvent ( QCloseEvent * e)
private

Definition at line 232 of file configurationWidget.cpp.

233{
234 QWidget::closeEvent( e );
235 emit closed();
236}

References closed().

◆ reject

void ConfigurationWidget::reject ( )
privateslot

Definition at line 238 of file configurationWidget.cpp.

239{
240 QDialog::reject();
241 emit closed();
242}

References closed().

Referenced by ConfigurationWidget().

◆ repaintGroup

void ConfigurationWidget::repaintGroup ( Q3IconViewItem * pseudoSelection)
privateslot

repaints a group icon if move is moved over it

Definition at line 202 of file configurationWidget.cpp.

203{
204 //if old pseudo selection unselect it
206
207 //paint new selection
208 currentPseudoSelection = (GroupIcon*)pseudoSelection;
210 groups->repaintItem(currentPseudoSelection);
211}

References clearPseudoSelection(), currentPseudoSelection, groups, and GroupIcon::setMousedOver().

Referenced by ConfigurationWidget().

◆ saveSettings

◆ updateDialogue

void ConfigurationWidget::updateDialogue ( Q3IconViewItem * selection)
privateslot

updates shown settings dialogue based on newly selected group

Definition at line 192 of file configurationWidget.cpp.

193{
194 //hide current selection
195 currentSettingsWidget->hide();
196
197 //set current and show
198 currentSettingsWidget = ((GroupIcon*)selection)->getSettingsWidget();
199 currentSettingsWidget->show();
200}

References currentSettingsWidget.

Referenced by ConfigurationWidget().

Member Data Documentation

◆ alertsIcon

GroupIcon* ConfigurationWidget::alertsIcon
private

settings icons

Definition at line 87 of file configurationWidget.h.

Referenced by ConfigurationWidget().

◆ alertsWidget

AlertsWidget* ConfigurationWidget::alertsWidget
private

Definition at line 80 of file configurationWidget.h.

Referenced by ConfigurationWidget(), and saveSettings().

◆ buttonsFrame

Q3Frame* ConfigurationWidget::buttonsFrame
private

Definition at line 90 of file configurationWidget.h.

Referenced by ConfigurationWidget().

◆ buttonsGrid

Q3GridLayout* ConfigurationWidget::buttonsGrid
private

Definition at line 92 of file configurationWidget.h.

Referenced by ConfigurationWidget().

◆ cancelButton

QPushButton * ConfigurationWidget::cancelButton
private

Definition at line 91 of file configurationWidget.h.

Referenced by ConfigurationWidget().

◆ config

Configuration* ConfigurationWidget::config
private

Backend config object pointer.

Definition at line 69 of file configurationWidget.h.

Referenced by ConfigurationWidget().

◆ currentPseudoSelection

GroupIcon* ConfigurationWidget::currentPseudoSelection
private

Definition at line 84 of file configurationWidget.h.

Referenced by clearPseudoSelection(), ConfigurationWidget(), and repaintGroup().

◆ currentSettingsWidget

QWidget* ConfigurationWidget::currentSettingsWidget
private

Definition at line 81 of file configurationWidget.h.

Referenced by ConfigurationWidget(), and updateDialogue().

◆ grid

Q3GridLayout* ConfigurationWidget::grid
private

Grid widgets place in.

Definition at line 72 of file configurationWidget.h.

Referenced by ConfigurationWidget().

◆ groups

GroupsWidget* ConfigurationWidget::groups
private

list of subalbums

Definition at line 75 of file configurationWidget.h.

Referenced by clearPseudoSelection(), ConfigurationWidget(), and repaintGroup().

◆ layoutIcon

GroupIcon * ConfigurationWidget::layoutIcon
private

Definition at line 87 of file configurationWidget.h.

Referenced by ConfigurationWidget().

◆ layoutWidget

LayoutSettingsWidget* ConfigurationWidget::layoutWidget
private

Definition at line 79 of file configurationWidget.h.

Referenced by ConfigurationWidget(), and saveSettings().

◆ loadingSavingIcon

GroupIcon * ConfigurationWidget::loadingSavingIcon
private

Definition at line 87 of file configurationWidget.h.

Referenced by ConfigurationWidget().

◆ loadingSavingWidget

LoadingSavingWidget* ConfigurationWidget::loadingSavingWidget
private

settings widgets

Definition at line 78 of file configurationWidget.h.

Referenced by ConfigurationWidget(), and saveSettings().

◆ okButton

QPushButton* ConfigurationWidget::okButton
private

Definition at line 91 of file configurationWidget.h.

Referenced by ConfigurationWidget().


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