~ubuntu-branches/ubuntu/utopic/psi/utopic

« back to all changes in this revision

Viewing changes to src/options/optionstab.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jan Niehusmann
  • Date: 2010-02-19 09:37:12 UTC
  • mfrom: (6.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20100219093712-e225xvm1wjcf1cgi
Tags: 0.14-2
* comment out only function which uses va_list to work around build
  problems on armel
* Set Standards-Version to 3.8.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
//----------------------------------------------------------------------------
12
12
 
13
13
OptionsTab::OptionsTab(QObject *parent, const char *name)
14
 
: QObject(parent, name)
 
14
: QObject(parent)
15
15
{
 
16
        setObjectName(name);
16
17
}
17
18
 
18
19
OptionsTab::OptionsTab(QObject *parent, QByteArray _id, QByteArray _parentId, QString _name, QString _desc, QString _tabIconName, QString _iconName)
19
 
: QObject(parent, _name.latin1())
 
20
: QObject(parent)
20
21
{
 
22
        setObjectName(_name);
21
23
        v_id = _id;
22
24
        v_parentId = _parentId;
23
25
        v_name = _name;
138
140
 
139
141
        // the widget will have no parent; it will be reparented
140
142
        // when inserting it with "addTab"
141
 
        QWidget *w = new QWidget(NULL, tab->name().latin1());
 
143
        QWidget *w = new QWidget(0);
 
144
        w->setObjectName(tab->name());
142
145
 
143
146
        if ( !tab->desc().isEmpty() )
144
 
                setTabToolTip(w, tab->desc());
 
147
                setTabToolTip(indexOf(w), tab->desc());
145
148
 
146
149
        w2tab[w] = TabData(tab);
147
150
        
160
163
void OptionsTabWidget::updateCurrent(QWidget *w)
161
164
{
162
165
        if ( !w2tab[w].initialized ) {
163
 
                QVBoxLayout *vbox = new QVBoxLayout(w, 5);
 
166
                QVBoxLayout *vbox = new QVBoxLayout(w);
 
167
                vbox->setMargin(5);
164
168
                OptionsTab *opttab = w2tab[w].tab;
165
169
 
166
170
                QWidget *tab = opttab->widget();
167
171
                if ( !tab )
168
172
                        return;
169
173
 
170
 
                tab->reparent(w, 0, QPoint(0, 0));
 
174
                tab->setParent(w);
171
175
                vbox->addWidget(tab);
172
176
                if ( !opttab->stretchable() )
173
177
                        vbox->addStretch();
186
190
void OptionsTabWidget::restoreOptions()
187
191
{
188
192
        emit noDirty(true);
189
 
        w2tab[currentPage()].tab->restoreOptions();
 
193
        w2tab[currentWidget()].tab->restoreOptions();
190
194
        emit noDirty(false);
191
195
}
192
196
 
208
212
 
209
213
MetaOptionsTab::~MetaOptionsTab()
210
214
{
 
215
        qDeleteAll(tabs);
 
216
 
211
217
        if ( w )
212
218
                delete w;
213
219
}
215
221
void MetaOptionsTab::init()
216
222
{
217
223
        w = 0;
218
 
        tabs.setAutoDelete(true);
219
224
}
220
225
 
221
226
void MetaOptionsTab::addTab(OptionsTab *tab)
239
244
        connect(w, SIGNAL(connectDataChanged(QWidget *)), SIGNAL(connectDataChanged(QWidget *)));
240
245
        connect(w, SIGNAL(noDirty(bool)), SIGNAL(noDirty(bool)));
241
246
 
242
 
        Q3PtrListIterator<OptionsTab> it(tabs);
243
 
        for ( ; it.current(); ++it)
244
 
                t->addTab(it.current());
 
247
        foreach(OptionsTab* tab, tabs) {
 
248
                t->addTab(tab);
 
249
        }
245
250
 
246
251
        // set the current widget to 0, otherwise qt4 will show no widget
247
252
        t->setCurrentIndex(0);
251
256
 
252
257
void MetaOptionsTab::applyOptions()
253
258
{
254
 
        Q3PtrListIterator<OptionsTab> it(tabs);
255
 
        for ( ; it.current(); ++it) {
256
 
                it.current()->applyOptions();
 
259
        foreach(OptionsTab* tab, tabs) {
 
260
                tab->applyOptions();
257
261
        }
258
262
}
259
263
 
264
268
                d->restoreOptions();
265
269
        }
266
270
 
267
 
        Q3PtrListIterator<OptionsTab> it(tabs);
268
 
        for ( ; it.current(); ++it) {
269
 
                it.current()->restoreOptions();
 
271
        foreach(OptionsTab* tab, tabs) {
 
272
                tab->restoreOptions();
270
273
        }
271
274
}
272
275
 
273
276
void MetaOptionsTab::setData(PsiCon *psi, QWidget *w)
274
277
{
275
 
        Q3PtrListIterator<OptionsTab> it(tabs);
276
 
        for ( ; it.current(); ++it)
277
 
                it.current()->setData(psi, w);
 
278
        foreach(OptionsTab* tab, tabs) {
 
279
                tab->setData(psi, w);
 
280
        }
278
281
}
279
282
 
280
283
#include "optionstab.moc"