AlbumShaper
1.0a3
|
Configuration/Settings Interface. More...
#include <configurationWidget.h>
Signals | |
void | closed () |
Public Member Functions | |
ConfigurationWidget (Configuration *config, QWidget *parent=0, const char *name=0) | |
Private Slots | |
void | updateDialogue (QIconViewItem *selection) |
updates shown settings dialogue based on newly selected group | |
void | repaintGroup (QIconViewItem *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 | |
Configuration * | config |
Backend config object pointer. | |
QGridLayout * | grid |
Grid widgets place in. | |
GroupsWidget * | groups |
list of subalbums | |
LoadingSavingWidget * | loadingSavingWidget |
settings widgets | |
LayoutSettingsWidget * | layoutWidget |
AlertsWidget * | alertsWidget |
QWidget * | currentSettingsWidget |
GroupIcon * | currentPseudoSelection |
GroupIcon * | alertsIcon |
settings icons | |
GroupIcon * | layoutIcon |
GroupIcon * | loadingSavingIcon |
QFrame * | buttonsFrame |
QPushButton * | okButton |
QPushButton * | cancelButton |
QGridLayout * | buttonsGrid |
Configuration/Settings Interface.
Definition at line 35 of file configurationWidget.h.
ConfigurationWidget::ConfigurationWidget | ( | Configuration * | config, |
QWidget * | parent = 0 , |
||
const char * | name = 0 |
||
) |
Definition at line 30 of file configurationWidget.cpp.
References alertsIcon, alertsWidget, buttonsFrame, buttonsGrid, cancelButton, clearPseudoSelection(), config, currentPseudoSelection, currentSettingsWidget, grid, groups, IMAGE_PATH, layoutIcon, layoutWidget, loadingSavingIcon, loadingSavingWidget, AlertsWidget::loadSettings(), LoadingSavingWidget::loadSettings(), LayoutSettingsWidget::loadSettings(), okButton, reject(), repaintGroup(), saveSettings(), GroupsWidget::setTextWidth(), and updateDialogue().
: QDialog(parent,name) { //store config pointer this->config = config; //-- //set window title setCaption( tr("Settings")); //-- //no icon currently hovered over currentPseudoSelection = NULL; //---------------------------------------------- //create settings widget layoutWidget = new LayoutSettingsWidget(config, this); loadingSavingWidget = new LoadingSavingWidget(config, this); alertsWidget = new AlertsWidget( config, this ); //---------------------------------------------- //create iconview and icons for groups groups = new GroupsWidget( this ); groups->setItemTextPos( QIconView::Right ); // groups->setMaxItemWidth(20); //---- //construct group labels QString labels[3]; labels[0] = tr("Appearance"); labels[1] = tr("Load/Save"); labels[2] = tr("Alerts"); //---- //find max text width int maxLabelWidth = 0; int i; QFontMetrics fm( qApp->font() ); for(i=0; i<3; i++) { if( fm.width( labels[i] ) > maxLabelWidth ) maxLabelWidth = fm.width( labels[i] ); } groups->setTextWidth( maxLabelWidth ); //---- //construct actual group icons layoutIcon = new GroupIcon( groups, QPixmap(QString(IMAGE_PATH)+"settingsIcons/layout.png" ), labels[0], layoutWidget ); layoutIcon->setDragEnabled(false); //---- loadingSavingIcon = new GroupIcon( groups, QPixmap(QString(IMAGE_PATH)+"settingsIcons/loadsave.png" ), labels[1], loadingSavingWidget ); loadingSavingIcon->setDragEnabled(false); //---- alertsIcon = new GroupIcon( groups, QPixmap(QString(IMAGE_PATH)+"settingsIcons/alerts.png" ), labels[2], alertsWidget ); alertsIcon->setDragEnabled(false); //------------------------- //set default selection currentSettingsWidget = layoutWidget; layoutIcon->setSelected(true); loadingSavingWidget->hide(); alertsWidget->hide(); //------------------------- //connect selectionChanged signal to update which settings dialog is displayed connect( groups, SIGNAL(selectionChanged(QIconViewItem*)), SLOT(updateDialogue(QIconViewItem*)) ); //connect mouse over events to paint pseudo selection in ligher blue connect( groups, SIGNAL(onItem(QIconViewItem*)), SLOT(repaintGroup(QIconViewItem*)) ); //clear any pseudo selection when mouse moves off icons connect( groups, SIGNAL(onViewport()), SLOT(clearPseudoSelection()) ); //create buttons frame and widgets buttonsFrame = new QFrame( this ); okButton = new QPushButton( tr("Apply"), buttonsFrame ); okButton->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); okButton->setDefault(true); connect( okButton, SIGNAL(clicked()), SLOT(saveSettings()) ); cancelButton = new QPushButton( tr("Cancel"), buttonsFrame ); cancelButton->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); connect( cancelButton, SIGNAL(clicked()), SLOT(reject()) ); buttonsGrid = new QGridLayout( buttonsFrame, 1, 5, 0 ); buttonsGrid->setColStretch( 0, 1 ); buttonsGrid->addWidget( okButton, 0, 1 ); buttonsGrid->addColSpacing( 2, 10 ); buttonsGrid->addWidget( cancelButton, 0, 3 ); buttonsGrid->setColStretch( 4, 1 ); //---------------------------------------------- //place all widgets in a grid grid = new QGridLayout( this, 5, 5, 0 ); grid->setRowSpacing(0,8); grid->addWidget( groups, 1, 1); grid->addWidget( alertsWidget, 1, 3); grid->addWidget( layoutWidget, 1, 3); grid->addWidget( loadingSavingWidget, 1, 3); grid->setRowStretch( 1, 1 ); grid->setColStretch( 3, 1 ); grid->setRowSpacing(2,8); grid->addMultiCellWidget( buttonsFrame, 3, 3, 0, 4); grid->setRowSpacing(4,8); grid->setColSpacing(0,8); grid->setColSpacing(2,8); grid->setColSpacing(4,8); groups->setGridX(1); groups->arrangeItemsInGrid(); int maxWidth = 0; int maxHeight = 0; layoutWidget->constPolish(); loadingSavingWidget->constPolish(); alertsWidget->constPolish(); groups->constPolish(); QSize s = layoutWidget->minimumSizeHint(); if(maxWidth < s.width()) maxWidth = s.width(); if(maxHeight < s.height()) maxHeight = s.height(); s = loadingSavingWidget->minimumSizeHint(); if(maxWidth < s.width()) maxWidth = s.width(); if(maxHeight < s.height()) maxHeight = s.height(); s = alertsWidget->minimumSizeHint(); if(maxWidth < s.width()) maxWidth = s.width(); if(maxHeight < s.height()) maxHeight = s.height(); s = groups->minimumSizeHint(); if(maxHeight < s.height()) maxHeight = s.height(); maxWidth = maxWidth + s.width(); maxHeight += okButton->minimumSizeHint().height(); //add padding maxWidth += 3*8; maxHeight += 3*8; //add a little extra for when text entries need more space maxWidth += 100; resize( maxWidth, maxHeight ); show(); setFixedSize(size()); //---------------------------------------------- //load setting values layoutWidget->loadSettings(); loadingSavingWidget->loadSettings(); alertsWidget->loadSettings(); //---------------------------------------------- }
void ConfigurationWidget::clearPseudoSelection | ( | ) | [private, slot] |
clears any pseudo selections
Definition at line 209 of file configurationWidget.cpp.
References currentPseudoSelection, groups, and GroupIcon::setMousedOver().
Referenced by ConfigurationWidget(), and repaintGroup().
{ //if old pseudo selection unselect it if(currentPseudoSelection != NULL) { currentPseudoSelection->setMousedOver(false); groups->repaintItem(currentPseudoSelection); currentPseudoSelection = NULL; } }
void ConfigurationWidget::closed | ( | ) | [signal] |
Referenced by closeEvent(), and reject().
void ConfigurationWidget::closeEvent | ( | QCloseEvent * | e | ) | [private] |
Definition at line 228 of file configurationWidget.cpp.
References closed().
{ QWidget::closeEvent( e ); emit closed(); }
void ConfigurationWidget::reject | ( | ) | [private, slot] |
Definition at line 234 of file configurationWidget.cpp.
References closed().
Referenced by ConfigurationWidget().
{ QDialog::reject(); emit closed(); }
void ConfigurationWidget::repaintGroup | ( | QIconViewItem * | pseudoSelection | ) | [private, slot] |
repaints a group icon if move is moved over it
Definition at line 198 of file configurationWidget.cpp.
References clearPseudoSelection(), currentPseudoSelection, groups, and GroupIcon::setMousedOver().
Referenced by ConfigurationWidget().
{ //if old pseudo selection unselect it clearPseudoSelection(); //paint new selection currentPseudoSelection = (GroupIcon*)pseudoSelection; currentPseudoSelection->setMousedOver(true); groups->repaintItem(currentPseudoSelection); }
void ConfigurationWidget::saveSettings | ( | ) | [private, slot] |
Definition at line 220 of file configurationWidget.cpp.
References alertsWidget, layoutWidget, loadingSavingWidget, AlertsWidget::saveSettings(), LoadingSavingWidget::saveSettings(), and LayoutSettingsWidget::saveSettings().
Referenced by ConfigurationWidget().
{ layoutWidget->saveSettings(); loadingSavingWidget->saveSettings(); alertsWidget->saveSettings(); close(); }
void ConfigurationWidget::updateDialogue | ( | QIconViewItem * | selection | ) | [private, slot] |
updates shown settings dialogue based on newly selected group
Definition at line 188 of file configurationWidget.cpp.
References currentSettingsWidget.
Referenced by ConfigurationWidget().
{ //hide current selection currentSettingsWidget->hide(); //set current and show currentSettingsWidget = ((GroupIcon*)selection)->getSettingsWidget(); currentSettingsWidget->show(); }
GroupIcon* ConfigurationWidget::alertsIcon [private] |
settings icons
Definition at line 83 of file configurationWidget.h.
Referenced by ConfigurationWidget().
AlertsWidget* ConfigurationWidget::alertsWidget [private] |
Definition at line 76 of file configurationWidget.h.
Referenced by ConfigurationWidget(), and saveSettings().
QFrame* ConfigurationWidget::buttonsFrame [private] |
Definition at line 86 of file configurationWidget.h.
Referenced by ConfigurationWidget().
QGridLayout* ConfigurationWidget::buttonsGrid [private] |
Definition at line 88 of file configurationWidget.h.
Referenced by ConfigurationWidget().
QPushButton * ConfigurationWidget::cancelButton [private] |
Definition at line 87 of file configurationWidget.h.
Referenced by ConfigurationWidget().
Configuration* ConfigurationWidget::config [private] |
Backend config object pointer.
Definition at line 65 of file configurationWidget.h.
Referenced by ConfigurationWidget().
Definition at line 80 of file configurationWidget.h.
Referenced by clearPseudoSelection(), ConfigurationWidget(), and repaintGroup().
Definition at line 77 of file configurationWidget.h.
Referenced by ConfigurationWidget(), and updateDialogue().
QGridLayout* ConfigurationWidget::grid [private] |
Grid widgets place in.
Definition at line 68 of file configurationWidget.h.
Referenced by ConfigurationWidget().
GroupsWidget* ConfigurationWidget::groups [private] |
list of subalbums
Definition at line 71 of file configurationWidget.h.
Referenced by clearPseudoSelection(), ConfigurationWidget(), and repaintGroup().
GroupIcon * ConfigurationWidget::layoutIcon [private] |
Definition at line 83 of file configurationWidget.h.
Referenced by ConfigurationWidget().
Definition at line 75 of file configurationWidget.h.
Referenced by ConfigurationWidget(), and saveSettings().
GroupIcon * ConfigurationWidget::loadingSavingIcon [private] |
Definition at line 83 of file configurationWidget.h.
Referenced by ConfigurationWidget().
settings widgets
Definition at line 74 of file configurationWidget.h.
Referenced by ConfigurationWidget(), and saveSettings().
QPushButton* ConfigurationWidget::okButton [private] |
Definition at line 87 of file configurationWidget.h.
Referenced by ConfigurationWidget().