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(), currentPseudoSelection, currentSettingsWidget, grid, groups, IMAGE_PATH, layoutIcon, layoutWidget, loadingSavingIcon, loadingSavingWidget, AlertsWidget::loadSettings(), LoadingSavingWidget::loadSettings(), LayoutSettingsWidget::loadSettings(), okButton, reject(), repaintGroup(), saveSettings(), GroupsWidget::setTextWidth(), and updateDialogue().
00033 : 00034 QDialog(parent,name) 00035 { 00036 //store config pointer 00037 this->config = config; 00038 //-- 00039 //set window title 00040 setCaption( tr("Settings")); 00041 //-- 00042 //no icon currently hovered over 00043 currentPseudoSelection = NULL; 00044 //---------------------------------------------- 00045 //create settings widget 00046 layoutWidget = new LayoutSettingsWidget(config, this); 00047 loadingSavingWidget = new LoadingSavingWidget(config, this); 00048 alertsWidget = new AlertsWidget( config, this ); 00049 //---------------------------------------------- 00050 //create iconview and icons for groups 00051 groups = new GroupsWidget( this ); 00052 groups->setItemTextPos( QIconView::Right ); 00053 // groups->setMaxItemWidth(20); 00054 //---- 00055 //construct group labels 00056 QString labels[3]; 00057 labels[0] = tr("Appearance"); 00058 labels[1] = tr("Load/Save"); 00059 labels[2] = tr("Alerts"); 00060 //---- 00061 //find max text width 00062 int maxLabelWidth = 0; 00063 int i; 00064 QFontMetrics fm( qApp->font() ); 00065 for(i=0; i<3; i++) 00066 { 00067 if( fm.width( labels[i] ) > maxLabelWidth ) 00068 maxLabelWidth = fm.width( labels[i] ); 00069 } 00070 groups->setTextWidth( maxLabelWidth ); 00071 //---- 00072 //construct actual group icons 00073 layoutIcon = new GroupIcon( groups, QPixmap(QString(IMAGE_PATH)+"settingsIcons/layout.png" ), 00074 labels[0], layoutWidget ); 00075 layoutIcon->setDragEnabled(false); 00076 //---- 00077 loadingSavingIcon = new GroupIcon( groups, QPixmap(QString(IMAGE_PATH)+"settingsIcons/loadsave.png" ), 00078 labels[1], loadingSavingWidget ); 00079 loadingSavingIcon->setDragEnabled(false); 00080 //---- 00081 alertsIcon = new GroupIcon( groups, QPixmap(QString(IMAGE_PATH)+"settingsIcons/alerts.png" ), 00082 labels[2], alertsWidget ); 00083 alertsIcon->setDragEnabled(false); 00084 //------------------------- 00085 //set default selection 00086 currentSettingsWidget = layoutWidget; 00087 layoutIcon->setSelected(true); 00088 loadingSavingWidget->hide(); 00089 alertsWidget->hide(); 00090 //------------------------- 00091 //connect selectionChanged signal to update which settings dialog is displayed 00092 connect( groups, SIGNAL(selectionChanged(QIconViewItem*)), 00093 SLOT(updateDialogue(QIconViewItem*)) ); 00094 00095 //connect mouse over events to paint pseudo selection in ligher blue 00096 connect( groups, SIGNAL(onItem(QIconViewItem*)), 00097 SLOT(repaintGroup(QIconViewItem*)) ); 00098 00099 //clear any pseudo selection when mouse moves off icons 00100 connect( groups, SIGNAL(onViewport()), 00101 SLOT(clearPseudoSelection()) ); 00102 00103 00104 //create buttons frame and widgets 00105 buttonsFrame = new QFrame( this ); 00106 okButton = new QPushButton( tr("Apply"), buttonsFrame ); 00107 okButton->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); 00108 okButton->setDefault(true); 00109 connect( okButton, SIGNAL(clicked()), SLOT(saveSettings()) ); 00110 cancelButton = new QPushButton( tr("Cancel"), buttonsFrame ); 00111 cancelButton->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); 00112 connect( cancelButton, SIGNAL(clicked()), SLOT(reject()) ); 00113 buttonsGrid = new QGridLayout( buttonsFrame, 1, 5, 0 ); 00114 buttonsGrid->setColStretch( 0, 1 ); 00115 buttonsGrid->addWidget( okButton, 0, 1 ); 00116 buttonsGrid->addColSpacing( 2, 10 ); 00117 buttonsGrid->addWidget( cancelButton, 0, 3 ); 00118 buttonsGrid->setColStretch( 4, 1 ); 00119 //---------------------------------------------- 00120 //place all widgets in a grid 00121 grid = new QGridLayout( this, 5, 5, 0 ); 00122 00123 grid->setRowSpacing(0,8); 00124 00125 grid->addWidget( groups, 1, 1); 00126 grid->addWidget( alertsWidget, 1, 3); 00127 grid->addWidget( layoutWidget, 1, 3); 00128 grid->addWidget( loadingSavingWidget, 1, 3); 00129 grid->setRowStretch( 1, 1 ); 00130 grid->setColStretch( 3, 1 ); 00131 00132 grid->setRowSpacing(2,8); 00133 00134 grid->addMultiCellWidget( buttonsFrame, 3, 3, 0, 4); 00135 00136 grid->setRowSpacing(4,8); 00137 00138 grid->setColSpacing(0,8); 00139 grid->setColSpacing(2,8); 00140 grid->setColSpacing(4,8); 00141 00142 groups->setGridX(1); 00143 groups->arrangeItemsInGrid(); 00144 00145 int maxWidth = 0; 00146 int maxHeight = 0; 00147 00148 layoutWidget->constPolish(); 00149 loadingSavingWidget->constPolish(); 00150 alertsWidget->constPolish(); 00151 groups->constPolish(); 00152 00153 QSize s = layoutWidget->minimumSizeHint(); 00154 if(maxWidth < s.width()) maxWidth = s.width(); 00155 if(maxHeight < s.height()) maxHeight = s.height(); 00156 00157 s = loadingSavingWidget->minimumSizeHint(); 00158 if(maxWidth < s.width()) maxWidth = s.width(); 00159 if(maxHeight < s.height()) maxHeight = s.height(); 00160 00161 s = alertsWidget->minimumSizeHint(); 00162 if(maxWidth < s.width()) maxWidth = s.width(); 00163 if(maxHeight < s.height()) maxHeight = s.height(); 00164 00165 s = groups->minimumSizeHint(); 00166 if(maxHeight < s.height()) maxHeight = s.height(); 00167 00168 maxWidth = maxWidth + s.width(); 00169 maxHeight += okButton->minimumSizeHint().height(); 00170 //add padding 00171 maxWidth += 3*8; 00172 maxHeight += 3*8; 00173 00174 //add a little extra for when text entries need more space 00175 maxWidth += 100; 00176 00177 resize( maxWidth, maxHeight ); 00178 00179 show(); 00180 setFixedSize(size()); 00181 //---------------------------------------------- 00182 //load setting values 00183 layoutWidget->loadSettings(); 00184 loadingSavingWidget->loadSettings(); 00185 alertsWidget->loadSettings(); 00186 //---------------------------------------------- }
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().
00210 { 00211 //if old pseudo selection unselect it 00212 if(currentPseudoSelection != NULL) 00213 { 00214 currentPseudoSelection->setMousedOver(false); 00215 groups->repaintItem(currentPseudoSelection); 00216 currentPseudoSelection = NULL; 00217 } 00218 }
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().
00229 { 00230 QWidget::closeEvent( e ); 00231 emit closed(); 00232 }
void ConfigurationWidget::reject | ( | ) | [private, slot] |
Definition at line 234 of file configurationWidget.cpp.
References closed().
Referenced by ConfigurationWidget().
00235 { 00236 QDialog::reject(); 00237 emit closed(); 00238 }
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().
00199 { 00200 //if old pseudo selection unselect it 00201 clearPseudoSelection(); 00202 00203 //paint new selection 00204 currentPseudoSelection = (GroupIcon*)pseudoSelection; 00205 currentPseudoSelection->setMousedOver(true); 00206 groups->repaintItem(currentPseudoSelection); 00207 }
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().
00221 { 00222 layoutWidget->saveSettings(); 00223 loadingSavingWidget->saveSettings(); 00224 alertsWidget->saveSettings(); 00225 close(); 00226 }
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().
00189 { 00190 //hide current selection 00191 currentSettingsWidget->hide(); 00192 00193 //set current and show 00194 currentSettingsWidget = ((GroupIcon*)selection)->getSettingsWidget(); 00195 currentSettingsWidget->show(); 00196 }
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.
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().