Commit 80d35c03 authored by Robert Knight's avatar Robert Knight

Delay loading settings dialog pages until they are used.

svn path=/trunk/KDE/kdebase/apps/konsole/; revision=675998
parent 15cdc7b1
......@@ -61,6 +61,11 @@ EditProfileDialog::EditProfileDialog(QWidget* parent)
_ui = new Ui::EditProfileDialog();
_ui->setupUi(mainWidget());
_pageInvalidated.resize( _ui->tabWidget->count() );
connect( _ui->tabWidget , SIGNAL(currentChanged(int)) , this ,
SLOT(ensurePageLoaded(int)) );
_tempProfile = new Profile;
qDebug() << "Is modal = " << isModal();
......@@ -109,11 +114,14 @@ void EditProfileDialog::setProfile(const QString& key)
setCaption( i18n("Edit Profile \"%1\"",info->name()) );
// setup each page of the dialog
setupGeneralPage(info);
setupAppearancePage(info);
setupKeyboardPage(info);
setupScrollingPage(info);
setupAdvancedPage(info);
_pageInvalidated.fill(true);
ensurePageLoaded( _ui->tabWidget->currentIndex() );
// setupGeneralPage(info);
// setupAppearancePage(info);
// setupKeyboardPage(info);
// setupScrollingPage(info);
// setupAdvancedPage(info);
if ( _tempProfile )
{
......@@ -121,6 +129,33 @@ void EditProfileDialog::setProfile(const QString& key)
_tempProfile = new Profile;
}
}
void EditProfileDialog::ensurePageLoaded(int page)
{
const Profile* info = SessionManager::instance()->profile(_profileKey);
Q_ASSERT( _pageInvalidated.count() > page );
Q_ASSERT( info );
if ( _pageInvalidated[page] )
{
QWidget* pageWidget = _ui->tabWidget->widget(page);
if ( pageWidget == _ui->generalTab )
setupGeneralPage(info);
else if ( pageWidget == _ui->appearanceTab )
setupAppearancePage(info);
else if ( pageWidget == _ui->scrollingTab )
setupScrollingPage(info);
else if ( pageWidget == _ui->keyboardTab )
setupKeyboardPage(info);
else if ( pageWidget == _ui->advancedTab )
setupAdvancedPage(info);
else
Q_ASSERT(false);
_pageInvalidated[page] = false;
}
}
void EditProfileDialog::setupGeneralPage(const Profile* info)
{
_ui->profileNameEdit->setText( info->name() );
......
......@@ -87,6 +87,9 @@ protected:
virtual bool eventFilter(QObject* watched , QEvent* event);
private slots:
// sets up the specified tab page if necessary
void ensurePageLoaded(int);
// saves changes to profile
void save();
......@@ -187,6 +190,7 @@ private:
Profile* _tempProfile;
QString _profileKey;
QVector<bool> _pageInvalidated;
QHash<int,QVariant> _previewedProperties;
};
......
......@@ -39,7 +39,7 @@
<property name="usesScrollButtons" >
<bool>false</bool>
</property>
<widget class="QWidget" name="tab" >
<widget class="QWidget" name="generalTab" >
<attribute name="title" >
<string>General</string>
</attribute>
......@@ -317,7 +317,7 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2" >
<widget class="QWidget" name="appearanceTab" >
<attribute name="title" >
<string>Appearance</string>
</attribute>
......@@ -492,7 +492,7 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_3" >
<widget class="QWidget" name="keyboardTab" >
<attribute name="title" >
<string>Keyboard Setup</string>
</attribute>
......@@ -574,7 +574,7 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_5" >
<widget class="QWidget" name="scrollingTab" >
<attribute name="title" >
<string>Scrolling</string>
</attribute>
......@@ -744,7 +744,7 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_4" >
<widget class="QWidget" name="advancedTab" >
<attribute name="title" >
<string>Advanced</string>
</attribute>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment