author | zecke <zecke> | 2004-05-18 20:08:54 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-05-18 20:08:54 (UTC) |
commit | eb5a5432d79083fdfefb7b9b0c0907abe8807a52 (patch) (unidiff) | |
tree | 5dcf20990b122339f63948d3975d1c25b71f8b81 | |
parent | 8383a8c157825bc1a4c8a13aae7bd66874fe9094 (diff) | |
download | opie-eb5a5432d79083fdfefb7b9b0c0907abe8807a52.zip opie-eb5a5432d79083fdfefb7b9b0c0907abe8807a52.tar.gz opie-eb5a5432d79083fdfefb7b9b0c0907abe8807a52.tar.bz2 |
Fix the layout of the KeyConfig Dialog.
The label with 'Default: %1' is now added as MultiCellWidget and now larger keys
don't make the 'configure key' button go out of display dimnesion
-rw-r--r-- | libopie2/opieui/okeyconfigwidget.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libopie2/opieui/okeyconfigwidget.cpp b/libopie2/opieui/okeyconfigwidget.cpp index 1991381..56f4746 100644 --- a/libopie2/opieui/okeyconfigwidget.cpp +++ b/libopie2/opieui/okeyconfigwidget.cpp | |||
@@ -119,132 +119,132 @@ OKeyConfigWidget::~OKeyConfigWidget() { | |||
119 | /** | 119 | /** |
120 | * @internal | 120 | * @internal |
121 | */ | 121 | */ |
122 | void OKeyConfigWidget::initUi() { | 122 | void OKeyConfigWidget::initUi() { |
123 | QBoxLayout *layout = new QVBoxLayout( this ); | 123 | QBoxLayout *layout = new QVBoxLayout( this ); |
124 | QGridLayout *gridLay = new QGridLayout( 2, 2 ); | 124 | QGridLayout *gridLay = new QGridLayout( 2, 2 ); |
125 | layout->addLayout( gridLay, 10 ); | 125 | layout->addLayout( gridLay, 10 ); |
126 | gridLay->setRowStretch( 1, 10 ); // let only the ListView strecth | 126 | gridLay->setRowStretch( 1, 10 ); // let only the ListView strecth |
127 | 127 | ||
128 | /* | 128 | /* |
129 | * LISTVIEW with the Keys | 129 | * LISTVIEW with the Keys |
130 | */ | 130 | */ |
131 | m_view = new Opie::Ui::OListView( this ); | 131 | m_view = new Opie::Ui::OListView( this ); |
132 | m_view->setFocus(); | 132 | m_view->setFocus(); |
133 | m_view->setAllColumnsShowFocus( true ); | 133 | m_view->setAllColumnsShowFocus( true ); |
134 | m_view->addColumn( tr("Pixmap") ); | 134 | m_view->addColumn( tr("Pixmap") ); |
135 | m_view->addColumn( tr("Name","Name of the Action in the ListView Header" ) ); | 135 | m_view->addColumn( tr("Name","Name of the Action in the ListView Header" ) ); |
136 | m_view->addColumn( tr("Key" ) ); | 136 | m_view->addColumn( tr("Key" ) ); |
137 | m_view->addColumn( tr("Default Key" ) ); | 137 | m_view->addColumn( tr("Default Key" ) ); |
138 | m_view->setRootIsDecorated( true ); | 138 | m_view->setRootIsDecorated( true ); |
139 | connect(m_view, SIGNAL(currentChanged(QListViewItem*)), | 139 | connect(m_view, SIGNAL(currentChanged(QListViewItem*)), |
140 | this, SLOT(slotListViewItem(QListViewItem*)) ); | 140 | this, SLOT(slotListViewItem(QListViewItem*)) ); |
141 | 141 | ||
142 | gridLay->addMultiCellWidget( m_view, 1, 1, 0, 1 ); | 142 | gridLay->addMultiCellWidget( m_view, 1, 1, 0, 1 ); |
143 | 143 | ||
144 | /* | 144 | /* |
145 | * GROUP with button info | 145 | * GROUP with button info |
146 | */ | 146 | */ |
147 | 147 | ||
148 | QGroupBox *box = new QGroupBox( this ); | 148 | QGroupBox *box = new QGroupBox( this ); |
149 | box ->setTitle( tr("Shortcut for Selected Action") ); | 149 | box ->setTitle( tr("Shortcut for Selected Action") ); |
150 | box ->setFrameStyle( QFrame::Box | QFrame::Sunken ); | 150 | box ->setFrameStyle( QFrame::Box | QFrame::Sunken ); |
151 | layout->addWidget( box, 1 ); | 151 | layout->addWidget( box, 1 ); |
152 | 152 | ||
153 | gridLay = new QGridLayout( box, 3, 4 ); | 153 | gridLay = new QGridLayout( box, 3, 4 ); |
154 | gridLay->addRowSpacing( 0, fontMetrics().lineSpacing() ); | 154 | gridLay->addRowSpacing( 0, fontMetrics().lineSpacing() ); |
155 | gridLay->setMargin( 4 ); | 155 | gridLay->setMargin( 4 ); |
156 | 156 | ||
157 | QButtonGroup *gr = new QButtonGroup( box ); | 157 | QButtonGroup *gr = new QButtonGroup( box ); |
158 | gr->hide(); | 158 | gr->hide(); |
159 | gr->setExclusive( true ); | 159 | gr->setExclusive( true ); |
160 | 160 | ||
161 | QRadioButton *rad = new QRadioButton( tr( "&None" ), box ); | 161 | QRadioButton *rad = new QRadioButton( tr( "&None" ), box ); |
162 | connect( rad, SIGNAL(clicked()), | 162 | connect( rad, SIGNAL(clicked()), |
163 | this, SLOT(slotNoKey()) ); | 163 | this, SLOT(slotNoKey()) ); |
164 | gr->insert( rad, 10 ); | 164 | gr->insert( rad, 10 ); |
165 | gridLay->addWidget( rad, 1, 0 ); | 165 | gridLay->addWidget( rad, 1, 0 ); |
166 | m_none = rad; | 166 | m_none = rad; |
167 | 167 | ||
168 | rad = new QRadioButton( tr("&Default" ), box ); | 168 | rad = new QRadioButton( tr("&Default" ), box ); |
169 | connect( rad, SIGNAL(clicked()), | 169 | connect( rad, SIGNAL(clicked()), |
170 | this, SLOT(slotDefaultKey()) ); | 170 | this, SLOT(slotDefaultKey()) ); |
171 | gr->insert( rad, 11 ); | 171 | gr->insert( rad, 11 ); |
172 | gridLay->addWidget( rad, 1, 1 ); | 172 | gridLay->addWidget( rad, 1, 1 ); |
173 | m_def = rad; | 173 | m_def = rad; |
174 | 174 | ||
175 | rad = new QRadioButton( tr("C&ustom"), box ); | 175 | rad = new QRadioButton( tr("C&ustom"), box ); |
176 | connect( rad, SIGNAL(clicked()), | 176 | connect( rad, SIGNAL(clicked()), |
177 | this, SLOT(slotCustomKey()) ); | 177 | this, SLOT(slotCustomKey()) ); |
178 | gr->insert( rad, 12 ); | 178 | gr->insert( rad, 12 ); |
179 | gridLay->addWidget( rad, 1, 2 ); | 179 | gridLay->addWidget( rad, 1, 2 ); |
180 | m_cus = rad; | 180 | m_cus = rad; |
181 | 181 | ||
182 | m_btn = new QPushButton( tr("Configure Key"), box ); | 182 | m_btn = new QPushButton( tr("Configure Key"), box ); |
183 | gridLay->addWidget( m_btn, 1, 4 ); | 183 | gridLay->addWidget( m_btn, 1, 3 ); |
184 | 184 | ||
185 | m_lbl= new QLabel( tr( "Default: " ), box ); | 185 | m_lbl= new QLabel( tr( "Default: " ), box ); |
186 | gridLay->addWidget( m_lbl, 2, 0 ); | 186 | gridLay->addMultiCellWidget( m_lbl, 2, 2, 0, 3 ); |
187 | 187 | ||
188 | connect(m_btn, SIGNAL(clicked()), | 188 | connect(m_btn, SIGNAL(clicked()), |
189 | this, SLOT(slotConfigure())); | 189 | this, SLOT(slotConfigure())); |
190 | 190 | ||
191 | m_box = box; | 191 | m_box = box; |
192 | } | 192 | } |
193 | 193 | ||
194 | /** | 194 | /** |
195 | * Set the ChangeMode. | 195 | * Set the ChangeMode. |
196 | * You need to call this function prior to load | 196 | * You need to call this function prior to load |
197 | * If you call this function past load the behaviour is undefined | 197 | * If you call this function past load the behaviour is undefined |
198 | * But caling load again is safe | 198 | * But caling load again is safe |
199 | */ | 199 | */ |
200 | void OKeyConfigWidget::setChangeMode( enum ChangeMode mode) { | 200 | void OKeyConfigWidget::setChangeMode( enum ChangeMode mode) { |
201 | m_mode = mode; | 201 | m_mode = mode; |
202 | } | 202 | } |
203 | 203 | ||
204 | 204 | ||
205 | /** | 205 | /** |
206 | * return the current mode | 206 | * return the current mode |
207 | */ | 207 | */ |
208 | OKeyConfigWidget::ChangeMode OKeyConfigWidget::changeMode()const { | 208 | OKeyConfigWidget::ChangeMode OKeyConfigWidget::changeMode()const { |
209 | return m_mode; | 209 | return m_mode; |
210 | } | 210 | } |
211 | 211 | ||
212 | 212 | ||
213 | /** | 213 | /** |
214 | * insert these items before calling load | 214 | * insert these items before calling load |
215 | */ | 215 | */ |
216 | void OKeyConfigWidget::insert( const QString& str, OKeyConfigManager* man ) { | 216 | void OKeyConfigWidget::insert( const QString& str, OKeyConfigManager* man ) { |
217 | Opie::Ui::Internal::OKeyConfigWidgetPrivate root( str, man ); | 217 | Opie::Ui::Internal::OKeyConfigWidgetPrivate root( str, man ); |
218 | m_list.append(root); | 218 | m_list.append(root); |
219 | } | 219 | } |
220 | 220 | ||
221 | 221 | ||
222 | /** | 222 | /** |
223 | * loads the items and allows editing them | 223 | * loads the items and allows editing them |
224 | */ | 224 | */ |
225 | void OKeyConfigWidget::load() { | 225 | void OKeyConfigWidget::load() { |
226 | Opie::Ui::Internal::OKeyConfigWidgetPrivateList::Iterator it; | 226 | Opie::Ui::Internal::OKeyConfigWidgetPrivateList::Iterator it; |
227 | for ( it = m_list.begin(); it != m_list.end(); ++it ) { | 227 | for ( it = m_list.begin(); it != m_list.end(); ++it ) { |
228 | OListViewItem *item = new OListViewItem( m_view, (*it).name ); | 228 | OListViewItem *item = new OListViewItem( m_view, (*it).name ); |
229 | OKeyConfigItem::List list = (*it).manager->keyConfigList(); | 229 | OKeyConfigItem::List list = (*it).manager->keyConfigList(); |
230 | for (OKeyConfigItem::List::Iterator keyIt = list.begin(); keyIt != list.end();++keyIt ) | 230 | for (OKeyConfigItem::List::Iterator keyIt = list.begin(); keyIt != list.end();++keyIt ) |
231 | (void )new Opie::Ui::Internal::OKeyListViewItem(*keyIt, (*it).manager, item ); | 231 | (void )new Opie::Ui::Internal::OKeyListViewItem(*keyIt, (*it).manager, item ); |
232 | 232 | ||
233 | } | 233 | } |
234 | } | 234 | } |
235 | 235 | ||
236 | /** | 236 | /** |
237 | * Saves if in Queue Mode. It'll update the supplied | 237 | * Saves if in Queue Mode. It'll update the supplied |
238 | * OKeyConfigManager objects. | 238 | * OKeyConfigManager objects. |
239 | * If in Queue mode it'll just return | 239 | * If in Queue mode it'll just return |
240 | */ | 240 | */ |
241 | void OKeyConfigWidget::save() { | 241 | void OKeyConfigWidget::save() { |
242 | /* | 242 | /* |
243 | * Iterate over all config items | 243 | * Iterate over all config items |
244 | */ | 244 | */ |
245 | QListViewItemIterator it( m_view ); | 245 | QListViewItemIterator it( m_view ); |
246 | while ( it.current() ) { | 246 | while ( it.current() ) { |
247 | if (it.current()->parent() ) { | 247 | if (it.current()->parent() ) { |
248 | Opie::Ui::Internal::OKeyListViewItem *item = static_cast<Opie::Ui::Internal::OKeyListViewItem*>( it.current() ); | 248 | Opie::Ui::Internal::OKeyListViewItem *item = static_cast<Opie::Ui::Internal::OKeyListViewItem*>( it.current() ); |
249 | OKeyConfigManager *man = item->manager(); | 249 | OKeyConfigManager *man = item->manager(); |
250 | man->removeKeyConfig( item->origItem() ); | 250 | man->removeKeyConfig( item->origItem() ); |