|
@@ -0,0 +1,61 @@
|
|
1
|
+@* Advanced settings configuration.
|
|
2
|
+
|
|
3
|
+\noindent Sometimes a feature has a sensible default that should be used the
|
|
4
|
+vast majority of the time but sometimes requires some other setting to be
|
|
5
|
+available in a reasonably accessible way.
|
|
6
|
+
|
|
7
|
+@<Class declarations@>=
|
|
8
|
+class AdvancedSettingsWidget : public QWidget@/
|
|
9
|
+{@/
|
|
10
|
+ @[Q_OBJECT@]@;
|
|
11
|
+ public:@/
|
|
12
|
+ AdvancedSettingsWidget();
|
|
13
|
+ @[public slots:@]@/
|
|
14
|
+ void enableDiagnosticLogging(bool enabled);
|
|
15
|
+};
|
|
16
|
+
|
|
17
|
+@ At present the advanced settings consist only of an option to redirect
|
|
18
|
+diagnostic output to a file. This should normally be disabled as it supresses
|
|
19
|
+console output and there is no mechanism within \pn{} for periodically removing
|
|
20
|
+the files generated. It is, however, useful for producing a diagnostic file
|
|
21
|
+that can be attached to an email if someone is encountering an issue that they
|
|
22
|
+are not able to resolve on their own. It is especially useful on Microsoft
|
|
23
|
+Windows where this output is not otherwise available unless Typica is run from
|
|
24
|
+software development tools most people do not have installed.
|
|
25
|
+
|
|
26
|
+@<AdvancedSettingsWidget implementation@>=
|
|
27
|
+AdvancedSettingsWidget::AdvancedSettingsWidget() : QWidget(NULL)
|
|
28
|
+{
|
|
29
|
+ QSettings settings;
|
|
30
|
+ QFormLayout *layout = new QFormLayout;
|
|
31
|
+ QCheckBox *logDiagnostics = new QCheckBox;
|
|
32
|
+ logDiagnostics->setCheckState(
|
|
33
|
+ settings.value("settings/advanced/logging", false).toBool() ?
|
|
34
|
+ Qt::Checked : Qt::Unchecked);
|
|
35
|
+ connect(logDiagnostics, SIGNAL(toggled(bool)), this, SLOT(enableDiagnosticLogging(bool)));
|
|
36
|
+ layout->addRow(tr("Enable diagnostic logging"), logDiagnostics);
|
|
37
|
+ setLayout(layout);
|
|
38
|
+}
|
|
39
|
+
|
|
40
|
+@ Changes to this setting should take effect immediately. It should also be
|
|
41
|
+written to |QSettings| so the feature can be correctly enabled or not.
|
|
42
|
+
|
|
43
|
+@<AdvancedSettingsWidget implementation@>=
|
|
44
|
+void AdvancedSettingsWidget::enableDiagnosticLogging(bool enabled)
|
|
45
|
+{
|
|
46
|
+ QSettings settings;
|
|
47
|
+ settings.setValue("settings/advanced/logging", enabled);
|
|
48
|
+ if(enabled)
|
|
49
|
+ {
|
|
50
|
+ qInstallMsgHandler(messageFileOutput);
|
|
51
|
+ }
|
|
52
|
+ else
|
|
53
|
+ {
|
|
54
|
+ qInstallMsgHandler(0);
|
|
55
|
+ }
|
|
56
|
+}
|
|
57
|
+
|
|
58
|
+@ Currently the implementation is brought into typica.cpp.
|
|
59
|
+
|
|
60
|
+@<Class implementations@>=
|
|
61
|
+@<AdvancedSettingsWidget implementation@>
|