Changeset View
Changeset View
Standalone View
Standalone View
src/kgraphviewerConfigDialog.cpp
Show All 10 Lines | 1 | /* This file is part of KGraphViewer. | |||
---|---|---|---|---|---|
11 | General Public License for more details. | 11 | General Public License for more details. | ||
12 | 12 | | |||
13 | You should have received a copy of the GNU General Public License | 13 | You should have received a copy of the GNU General Public License | ||
14 | along with this program; if not, write to the Free Software | 14 | along with this program; if not, write to the Free Software | ||
15 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 15 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
16 | 02110-1301, USA | 16 | 02110-1301, USA | ||
17 | */ | 17 | */ | ||
18 | 18 | | |||
19 | | ||||
20 | #include "kgraphviewer_debug.h" | | |||
21 | #include "kgraphviewerConfigDialog.h" | 19 | #include "kgraphviewerConfigDialog.h" | ||
20 | #include "kgraphviewer_debug.h" | ||||
22 | #include "kgraphviewersettings.h" | 21 | #include "kgraphviewersettings.h" | ||
23 | #include "ui_preferencesReload.h" | 22 | #include "ui_preferencesAppearance.h" | ||
24 | #include "ui_preferencesParsing.h" | | |||
25 | #include "ui_preferencesOpenInExistingWindow.h" | 23 | #include "ui_preferencesOpenInExistingWindow.h" | ||
24 | #include "ui_preferencesParsing.h" | ||||
25 | #include "ui_preferencesReload.h" | ||||
26 | #include "ui_preferencesReopenPreviouslyOpenedFiles.h" | 26 | #include "ui_preferencesReopenPreviouslyOpenedFiles.h" | ||
27 | #include "ui_preferencesAppearance.h" | | |||
28 | 27 | | |||
28 | #include <QDebug> | ||||
29 | #include <QFileDialog> | 29 | #include <QFileDialog> | ||
30 | #include <kconfig.h> | | |||
31 | #include <QUrl> | | |||
32 | #include <QTabWidget> | 30 | #include <QTabWidget> | ||
33 | #include <kparts/partmanager.h> | 31 | #include <QUrl> | ||
32 | #include <kconfig.h> | ||||
34 | #include <kedittoolbar.h> | 33 | #include <kedittoolbar.h> | ||
35 | #include <QDebug> | 34 | #include <kparts/partmanager.h> | ||
36 | 35 | | |||
37 | #include <KService> | | |||
38 | #include <KPluginFactory> | 36 | #include <KPluginFactory> | ||
37 | #include <KService> | ||||
39 | #include <QMessageBox> | 38 | #include <QMessageBox> | ||
40 | #include <QStatusBar> | 39 | #include <QStatusBar> | ||
41 | #include <kconfigdialog.h> | 40 | #include <kconfigdialog.h> | ||
42 | #include <klocalizedstring.h> | 41 | #include <klocalizedstring.h> | ||
43 | 42 | | |||
44 | //#include <kapp.h> | 43 | //#include <kapp.h> | ||
45 | //#include <dcopclient.h> | 44 | //#include <dcopclient.h> | ||
46 | 45 | | |||
47 | #include <iostream> | | |||
48 | #include <QDialogButtonBox> | 46 | #include <QDialogButtonBox> | ||
47 | #include <iostream> | ||||
49 | 48 | | |||
50 | KgvConfigurationDialog::KgvConfigurationDialog (QWidget *parent, const QString& name, KConfigSkeleton *config) : | 49 | KgvConfigurationDialog::KgvConfigurationDialog(QWidget *parent, const QString &name, KConfigSkeleton *config) | ||
51 | KConfigDialog(parent, name, config), | 50 | : KConfigDialog(parent, name, config) | ||
52 | m_changed(false), | 51 | , m_changed(false) | ||
53 | parsingWidget(new Ui::KGraphViewerPreferencesParsingWidget()), | 52 | , parsingWidget(new Ui::KGraphViewerPreferencesParsingWidget()) | ||
54 | reloadWidget(new Ui::KGraphViewerPreferencesReloadWidget()), | 53 | , reloadWidget(new Ui::KGraphViewerPreferencesReloadWidget()) | ||
55 | openingWidget(new Ui::KGraphViewerPreferencesOpenInExistingWindowWidget()), | 54 | , openingWidget(new Ui::KGraphViewerPreferencesOpenInExistingWindowWidget()) | ||
56 | reopeningWidget(new Ui::KGraphViewerPreferencesReopenPreviouslyOpenedFilesWidget()), | 55 | , reopeningWidget(new Ui::KGraphViewerPreferencesReopenPreviouslyOpenedFilesWidget()) | ||
57 | appearanceWidget(new Ui::KGraphViewerPreferencesAppearanceWidget()) | 56 | , appearanceWidget(new Ui::KGraphViewerPreferencesAppearanceWidget()) | ||
58 | { | 57 | { | ||
59 | QWidget* page4 = new QWidget(); | 58 | QWidget *page4 = new QWidget(); | ||
60 | appearanceWidget->setupUi(page4); | 59 | appearanceWidget->setupUi(page4); | ||
61 | QWidget* page0 = new QWidget(); | 60 | QWidget *page0 = new QWidget(); | ||
62 | parsingWidget->setupUi(page0); | 61 | parsingWidget->setupUi(page0); | ||
63 | QWidget* page1 = new QWidget(); | 62 | QWidget *page1 = new QWidget(); | ||
64 | reloadWidget->setupUi(page1); | 63 | reloadWidget->setupUi(page1); | ||
65 | QWidget* page2 = new QWidget(); | 64 | QWidget *page2 = new QWidget(); | ||
66 | openingWidget->setupUi(page2); | 65 | openingWidget->setupUi(page2); | ||
67 | QWidget* page3 = new QWidget(); | 66 | QWidget *page3 = new QWidget(); | ||
68 | reopeningWidget->setupUi(page3); | 67 | reopeningWidget->setupUi(page3); | ||
69 | 68 | | |||
70 | appearanceWidget->kcolorbutton->setColor(KGraphViewerSettings::backgroundColor()); | 69 | appearanceWidget->kcolorbutton->setColor(KGraphViewerSettings::backgroundColor()); | ||
71 | appearanceWidget->kcolorbutton->setDefaultColor(KGraphViewerSettings::backgroundColor()); | 70 | appearanceWidget->kcolorbutton->setDefaultColor(KGraphViewerSettings::backgroundColor()); | ||
72 | addPage( page4, i18n("Appearance"), "preferences-other", i18n("Appearance"), false); | 71 | addPage(page4, i18n("Appearance"), "preferences-other", i18n("Appearance"), false); | ||
73 | addPage( page0, i18n("Parsing"), "preferences-other", i18n("Parsing"), false); | 72 | addPage(page0, i18n("Parsing"), "preferences-other", i18n("Parsing"), false); | ||
74 | addPage( page1, i18n("Reloading"), "view-refresh", i18n("Reloading"), false); | 73 | addPage(page1, i18n("Reloading"), "view-refresh", i18n("Reloading"), false); | ||
75 | addPage( page2, i18n("Opening"), "document-open", i18n("Opening"), false); | 74 | addPage(page2, i18n("Opening"), "document-open", i18n("Opening"), false); | ||
76 | addPage( page3, i18n("Session Management"), "preferences-other", i18n("Session Management"), false); | 75 | addPage(page3, i18n("Session Management"), "preferences-other", i18n("Session Management"), false); | ||
77 | connect(parsingWidget->parsingMode, &QGroupBox::clicked, | 76 | connect(parsingWidget->parsingMode, &QGroupBox::clicked, this, &KgvConfigurationDialog::settingChanged); | ||
78 | this, &KgvConfigurationDialog::settingChanged); | 77 | connect(reloadWidget->reloadOnChangeMode, &QGroupBox::clicked, this, &KgvConfigurationDialog::settingChanged); | ||
79 | connect(reloadWidget->reloadOnChangeMode, &QGroupBox::clicked, | 78 | connect(openingWidget->openInExistingWindowMode, &QGroupBox::clicked, this, &KgvConfigurationDialog::settingChanged); | ||
80 | this, &KgvConfigurationDialog::settingChanged); | 79 | connect(reopeningWidget->reopenPreviouslyOpenedFilesMode, &QGroupBox::clicked, this, &KgvConfigurationDialog::settingChanged); | ||
81 | connect(openingWidget->openInExistingWindowMode, &QGroupBox::clicked, | 80 | connect(appearanceWidget->kcolorbutton, &KColorButton::changed, this, &KgvConfigurationDialog::slotBackgroundColorChanged); | ||
82 | this, &KgvConfigurationDialog::settingChanged); | | |||
83 | connect(reopeningWidget->reopenPreviouslyOpenedFilesMode, &QGroupBox::clicked, | | |||
84 | this, &KgvConfigurationDialog::settingChanged); | | |||
85 | connect(appearanceWidget->kcolorbutton, &KColorButton::changed, | | |||
86 | this, &KgvConfigurationDialog::slotBackgroundColorChanged); | | |||
87 | } | 81 | } | ||
88 | 82 | | |||
89 | KgvConfigurationDialog::~KgvConfigurationDialog () | 83 | KgvConfigurationDialog::~KgvConfigurationDialog() | ||
90 | { | 84 | { | ||
91 | } | 85 | } | ||
92 | 86 | | |||
93 | void KgvConfigurationDialog::settingChanged(int) | 87 | void KgvConfigurationDialog::settingChanged(int) | ||
94 | { | 88 | { | ||
95 | // std::cerr << "KgvConfigurationDialog::settingChanged" << std::endl; | 89 | // std::cerr << "KgvConfigurationDialog::settingChanged" << std::endl; | ||
96 | m_changed = true; | 90 | m_changed = true; | ||
97 | } | 91 | } | ||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Line(s) | 134 | case 1: // yes | |||
141 | KGraphViewerSettings::setReopenPreviouslyOpenedFilesMode("yes"); | 135 | KGraphViewerSettings::setReopenPreviouslyOpenedFilesMode("yes"); | ||
142 | break; | 136 | break; | ||
143 | case 2: // ask | 137 | case 2: // ask | ||
144 | KGraphViewerSettings::setReopenPreviouslyOpenedFilesMode("ask"); | 138 | KGraphViewerSettings::setReopenPreviouslyOpenedFilesMode("ask"); | ||
145 | break; | 139 | break; | ||
146 | default: ; | 140 | default: ; | ||
147 | }*/ | 141 | }*/ | ||
148 | //@TODO to port | 142 | //@TODO to port | ||
149 | //KGraphViewerSettings::writeConfig(); | 143 | // KGraphViewerSettings::writeConfig(); | ||
150 | } | 144 | } | ||
151 | 145 | | |||
152 | void KgvConfigurationDialog::updateWidgets() | 146 | void KgvConfigurationDialog::updateWidgets() | ||
153 | { | 147 | { | ||
154 | m_changed = false; | 148 | m_changed = false; | ||
155 | qCDebug(KGRAPHVIEWER_LOG) << " openInExistingWindowMode: " << KGraphViewerSettings::openInExistingWindowMode(); | 149 | qCDebug(KGRAPHVIEWER_LOG) << " openInExistingWindowMode: " << KGraphViewerSettings::openInExistingWindowMode(); | ||
156 | // if (KGraphViewerSettings::openInExistingWindowMode() == "no") | 150 | // if (KGraphViewerSettings::openInExistingWindowMode() == "no") | ||
157 | // openingWidget->openInExistingWindowMode->setButton(0); | 151 | // openingWidget->openInExistingWindowMode->setButton(0); | ||
158 | // else if (KGraphViewerSettings::openInExistingWindowMode() == "yes") | 152 | // else if (KGraphViewerSettings::openInExistingWindowMode() == "yes") | ||
159 | // openingWidget->openInExistingWindowMode->setButton(1); | 153 | // openingWidget->openInExistingWindowMode->setButton(1); | ||
160 | // else if (KGraphViewerSettings::openInExistingWindowMode() == "ask") | 154 | // else if (KGraphViewerSettings::openInExistingWindowMode() == "ask") | ||
161 | // openingWidget->openInExistingWindowMode->setButton(2); | 155 | // openingWidget->openInExistingWindowMode->setButton(2); | ||
162 | 156 | | |||
163 | | ||||
164 | // std::cerr << " reloadOnChangeMode: " << KGraphViewerSettings::reloadOnChangeMode() << std::endl; | 157 | // std::cerr << " reloadOnChangeMode: " << KGraphViewerSettings::reloadOnChangeMode() << std::endl; | ||
165 | // if (KGraphViewerSettings::reloadOnChangeMode() == "no") | 158 | // if (KGraphViewerSettings::reloadOnChangeMode() == "no") | ||
166 | // reloadWidget->reloadOnChangeMode->setButton(0); | 159 | // reloadWidget->reloadOnChangeMode->setButton(0); | ||
167 | // else if (KGraphViewerSettings::reloadOnChangeMode() == "yes") | 160 | // else if (KGraphViewerSettings::reloadOnChangeMode() == "yes") | ||
168 | // reloadWidget->reloadOnChangeMode->setButton(1); | 161 | // reloadWidget->reloadOnChangeMode->setButton(1); | ||
169 | // else if (KGraphViewerSettings::reloadOnChangeMode() == "ask") | 162 | // else if (KGraphViewerSettings::reloadOnChangeMode() == "ask") | ||
170 | // reloadWidget->reloadOnChangeMode->setButton(2); | 163 | // reloadWidget->reloadOnChangeMode->setButton(2); | ||
171 | 164 | | |||
172 | // std::cerr << " reopenPreviouslyOpenedFilesMode: " << KGraphViewerSettings::reopenPreviouslyOpenedFilesMode() << std::endl; | 165 | // std::cerr << " reopenPreviouslyOpenedFilesMode: " << KGraphViewerSettings::reopenPreviouslyOpenedFilesMode() << std::endl; | ||
173 | /* if (KGraphViewerSettings::reopenPreviouslyOpenedFilesMode() == "no") | 166 | /* if (KGraphViewerSettings::reopenPreviouslyOpenedFilesMode() == "no") | ||
174 | reopeningWidget->reopenPreviouslyOpenedFilesMode->setButton(0); | 167 | reopeningWidget->reopenPreviouslyOpenedFilesMode->setButton(0); | ||
175 | else if (KGraphViewerSettings::reopenPreviouslyOpenedFilesMode() == "yes") | 168 | else if (KGraphViewerSettings::reopenPreviouslyOpenedFilesMode() == "yes") | ||
176 | reopeningWidget->reopenPreviouslyOpenedFilesMode->setButton(1); | 169 | reopeningWidget->reopenPreviouslyOpenedFilesMode->setButton(1); | ||
177 | else if (KGraphViewerSettings::reopenPreviouslyOpenedFilesMode() == "ask") | 170 | else if (KGraphViewerSettings::reopenPreviouslyOpenedFilesMode() == "ask") | ||
178 | reopeningWidget->reopenPreviouslyOpenedFilesMode->setButton(2);*/ | 171 | reopeningWidget->reopenPreviouslyOpenedFilesMode->setButton(2);*/ | ||
179 | } | 172 | } | ||
180 | 173 | | |||
181 | void KgvConfigurationDialog::slotBackgroundColorChanged(const QColor& color) | 174 | void KgvConfigurationDialog::slotBackgroundColorChanged(const QColor &color) | ||
182 | { | 175 | { | ||
183 | KGraphViewerSettings::setBackgroundColor(color); | 176 | KGraphViewerSettings::setBackgroundColor(color); | ||
184 | emit backgroundColorChanged(color); | 177 | emit backgroundColorChanged(color); | ||
185 | } | 178 | } |