~ubuntu-branches/ubuntu/vivid/psi/vivid

« back to all changes in this revision

Viewing changes to src/options/optionstab.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jan Niehusmann
  • Date: 2008-08-28 18:46:52 UTC
  • mfrom: (1.2.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20080828184652-iiik12dl91nq7cdi
Tags: 0.12-2
Uploading to unstable (Closes: Bug#494352)

Show diffs side-by-side

added added

removed removed

Lines of Context:
75
75
        return (PsiIcon *)IconsetFactory::iconPtr( v_iconName );
76
76
}
77
77
 
78
 
void OptionsTab::applyOptions(Options *)
 
78
void OptionsTab::applyOptions()
79
79
{
80
80
}
81
81
 
82
 
void OptionsTab::restoreOptions(const Options *)
 
82
void OptionsTab::restoreOptions()
83
83
{
84
84
}
85
85
 
106
106
public:
107
107
        OptionsTabWidget(QWidget *parent);
108
108
        void addTab(OptionsTab *);
109
 
        void restoreOptions(const Options *);
 
109
        void restoreOptions();
110
110
 
111
111
signals:
112
112
        void connectDataChanged(QWidget *);
123
123
                bool initialized;
124
124
        };
125
125
        QMap<QWidget *, TabData> w2tab;
126
 
        Options *opt;
127
126
};
128
127
 
129
128
OptionsTabWidget::OptionsTabWidget(QWidget *parent)
130
129
: QTabWidget(parent)
131
130
{
132
131
        connect(this, SIGNAL(currentChanged(QWidget *)), SLOT(updateCurrent(QWidget *)));
133
 
        opt = 0;
134
132
}
135
133
 
136
134
void OptionsTabWidget::addTab(OptionsTab *tab)
146
144
                setTabToolTip(w, tab->desc());
147
145
 
148
146
        w2tab[w] = TabData(tab);
149
 
 
 
147
        
150
148
        if ( tab->tabIcon() )
151
149
                QTabWidget::addTab(w, tab->tabIcon()->icon(), tab->tabName());
152
150
        else
153
151
                QTabWidget::addTab(w, tab->tabName());
154
152
 
155
 
        
156
153
        //FIXME: this is safe for our current use of addTab, but may
157
154
        //be inconvenient in the future (Qt circa 4.2 had a bug which stopped
158
155
        //setCurrentIndex(0); from working)
175
172
                if ( !opttab->stretchable() )
176
173
                        vbox->addStretch();
177
174
 
178
 
                if ( opt ) {
179
 
                        emit noDirty(true);
180
 
                        opttab->restoreOptions(opt);
181
 
                        emit noDirty(false);
182
 
                }
 
175
                emit noDirty(true);
 
176
                opttab->restoreOptions();
 
177
                emit noDirty(false);
 
178
                
183
179
                emit connectDataChanged(tab);
184
180
 
185
181
                tab->show();
187
183
        }
188
184
}
189
185
 
190
 
void OptionsTabWidget::restoreOptions(const Options *o)
 
186
void OptionsTabWidget::restoreOptions()
191
187
{
192
 
        bool doRestore = !opt;
193
 
        opt = (Options *)o;
194
 
 
195
 
        if ( doRestore ) {
196
 
                emit noDirty(true);
197
 
                w2tab[currentPage()].tab->restoreOptions(opt);
198
 
                emit noDirty(false);
199
 
        }
 
188
        emit noDirty(true);
 
189
        w2tab[currentPage()].tab->restoreOptions();
 
190
        emit noDirty(false);
200
191
}
201
192
 
202
193
//----------------------------------------------------------------------------
258
249
        return w;
259
250
}
260
251
 
261
 
void MetaOptionsTab::applyOptions(Options *opt)
 
252
void MetaOptionsTab::applyOptions()
262
253
{
263
254
        Q3PtrListIterator<OptionsTab> it(tabs);
264
 
        for ( ; it.current(); ++it)
265
 
                it.current()->applyOptions(opt);
 
255
        for ( ; it.current(); ++it) {
 
256
                it.current()->applyOptions();
 
257
        }
266
258
}
267
259
 
268
 
void MetaOptionsTab::restoreOptions(const Options *opt)
 
260
void MetaOptionsTab::restoreOptions()
269
261
{
270
262
        if ( w ) {
271
263
                OptionsTabWidget *d = (OptionsTabWidget *)w;
272
 
                d->restoreOptions(opt);
 
264
                d->restoreOptions();
273
265
        }
274
266
 
275
267
        Q3PtrListIterator<OptionsTab> it(tabs);
276
 
        for ( ; it.current(); ++it)
277
 
                it.current()->restoreOptions(opt);
 
268
        for ( ; it.current(); ++it) {
 
269
                it.current()->restoreOptions();
 
270
        }
278
271
}
279
272
 
280
273
void MetaOptionsTab::setData(PsiCon *psi, QWidget *w)