Changeset View
Changeset View
Standalone View
Standalone View
kstars/kstarsactions.cpp
Show First 20 Lines • Show All 995 Lines • ▼ Show 20 Line(s) | 967 | { | |||
---|---|---|---|---|---|
996 | updateTime(); | 996 | updateTime(); | ||
997 | } | 997 | } | ||
998 | } | 998 | } | ||
999 | delete locationdialog; | 999 | delete locationdialog; | ||
1000 | } | 1000 | } | ||
1001 | 1001 | | |||
1002 | void KStars::slotViewOps() | 1002 | void KStars::slotViewOps() | ||
1003 | { | 1003 | { | ||
1004 | //An instance of your dialog could be already created and could be cached, | 1004 | // An instance of your dialog could be already created and could be cached, | ||
1005 | //in which case you want to display the cached dialog instead of creating | 1005 | // in which case you want to display the cached dialog instead of creating | ||
1006 | //another one | 1006 | // another one | ||
1007 | if (KConfigDialog::showDialog("settings")) | 1007 | prepareOps()->show(); | ||
1008 | return; | 1008 | } | ||
1009 | | ||||
1010 | KConfigDialog* KStars::prepareOps() | ||||
1011 | { | ||||
1012 | KConfigDialog *dialog = KConfigDialog::exists("settings"); | ||||
1013 | if (nullptr != dialog) | ||||
1014 | return dialog; | ||||
1009 | 1015 | | |||
1010 | //KConfigDialog didn't find an instance of this dialog, so lets create it : | 1016 | // KConfigDialog didn't find an instance of this dialog, so lets create it : | ||
1011 | KConfigDialog *dialog = new KConfigDialog(this, "settings", Options::self()); | 1017 | dialog = new KConfigDialog(this, "settings", Options::self()); | ||
1018 | | ||||
TallFurryMan: KConfigDialog management is here. I call prepareOps() when initializing actions in the KStars… | |||||
1012 | // For some reason the dialog does not resize to contents | 1019 | // For some reason the dialog does not resize to contents | ||
1013 | // so we set initial 'resonable' size here. Any better way to do this? | 1020 | // so we set initial 'resonable' size here. Any better way to do this? | ||
1014 | dialog->resize(800, 600); | 1021 | dialog->resize(800, 600); | ||
1015 | #ifdef Q_OS_OSX | 1022 | #ifdef Q_OS_OSX | ||
1016 | dialog->setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint); | 1023 | dialog->setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint); | ||
1017 | #endif | 1024 | #endif | ||
1018 | 1025 | | |||
1019 | connect(dialog, SIGNAL(settingsChanged(QString)), this, SLOT(slotApplyConfigChanges())); | 1026 | connect(dialog, SIGNAL(settingsChanged(QString)), this, SLOT(slotApplyConfigChanges())); | ||
▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Line(s) | 1074 | #endif | |||
1068 | 1075 | | |||
1069 | opsxplanet = new OpsXplanet(this); | 1076 | opsxplanet = new OpsXplanet(this); | ||
1070 | page = dialog->addPage(opsxplanet, i18n("Xplanet"), "kstars_xplanet"); | 1077 | page = dialog->addPage(opsxplanet, i18n("Xplanet"), "kstars_xplanet"); | ||
1071 | page->setIcon(QIcon::fromTheme("kstars_xplanet")); | 1078 | page->setIcon(QIcon::fromTheme("kstars_xplanet")); | ||
1072 | 1079 | | |||
1073 | page = dialog->addPage(opadvanced, i18n("Advanced"), "kstars_advanced"); | 1080 | page = dialog->addPage(opadvanced, i18n("Advanced"), "kstars_advanced"); | ||
1074 | page->setIcon(QIcon::fromTheme("kstars_advanced")); | 1081 | page->setIcon(QIcon::fromTheme("kstars_advanced")); | ||
1075 | 1082 | | |||
1076 | dialog->show(); | 1083 | return dialog; | ||
1077 | } | 1084 | } | ||
1078 | 1085 | | |||
1079 | void KStars::slotApplyConfigChanges() | 1086 | void KStars::slotApplyConfigChanges() | ||
1080 | { | 1087 | { | ||
1081 | Options::self()->save(); | 1088 | Options::self()->save(); | ||
1082 | 1089 | | |||
1083 | applyConfig(); | 1090 | applyConfig(); | ||
1084 | 1091 | | |||
▲ Show 20 Lines • Show All 844 Lines • Show Last 20 Lines |
KConfigDialog management is here. I call prepareOps() when initializing actions in the KStars class, and this pre-creates the dialog.
The only change that produces is that the dialog is in cache before actually opening the dialog.