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