AbstractSettingsApplication.st
changeset 6427 b2a6087bbedf
parent 6426 d769436f958c
child 6428 76dfcf8cb841
--- a/AbstractSettingsApplication.st	Sun Nov 27 23:16:31 2005 +0100
+++ b/AbstractSettingsApplication.st	Tue Nov 29 18:02:35 2005 +0100
@@ -172,6 +172,14 @@
 	privateIn:AbstractSettingsApplication
 !
 
+AbstractSettingsApplication subclass:#SQLServerSettingsAppl
+	instanceVariableNames:'sqlServerEnabled sqlSmalltalkServerEnabled sqlLogging
+		sqlErrorLogging hasSQLServer sqlErrorDebugging sqlServerPort'
+	classVariableNames:''
+	poolDictionaries:''
+	privateIn:AbstractSettingsApplication
+!
+
 AbstractSettingsApplication subclass:#STCCompilerSettingsAppl
 	instanceVariableNames:'cc ccOptions stcIncludes linkCommand stc linkArgs linkSharedArgs
 		canLoadBinaries stcDefines stcLibraries stcOptions stcLibraryPath
@@ -7191,7 +7199,7 @@
           label: 'RDoIt Server Settings'
           name: 'RDoIt Server Settings'
           min: (Point 10 10)
-          bounds: (Rectangle 14 46 614 596)
+          bounds: (Rectangle 0 0 600 550)
         )
         component: 
        (SpecCollection
@@ -7247,7 +7255,7 @@
                           acceptOnPointerLeave: true
                         )
                        (LabelSpec
-                          label: 'Port-number for tcp socket; path-string for unix domain socket.'
+                          label: 'Port# for Tcp Socket; Path for Unix Domain Socket (Unix only).'
                           name: 'Label3'
                           layout: (LayoutFrame 150 0 28 0 596 0 50 0)
                           translateLabel: true
@@ -7325,7 +7333,6 @@
 !AbstractSettingsApplication::RDoItServerSettingsAppl methodsFor:'actions'!
 
 basicSaveSettings
-
     |shouldRun portOrPath|
 
     portOrPath := self rDoitServerPortOrPath value.
@@ -7378,7 +7385,6 @@
 !AbstractSettingsApplication::RDoItServerSettingsAppl methodsFor:'aspects'!
 
 rDoitErrorDebugging
-
     rDoitErrorDebugging isNil ifTrue:[
         rDoitErrorDebugging := true asValue.
         rDoitErrorDebugging onChangeSend:#updateModifiedChannel to:self
@@ -7387,7 +7393,6 @@
 !
 
 rDoitErrorLogging
-
     rDoitErrorLogging isNil ifTrue:[
         rDoitErrorLogging := true asValue.
         rDoitErrorLogging onChangeSend:#updateModifiedChannel to:self
@@ -7396,7 +7401,6 @@
 !
 
 rDoitLogging
-
     rDoitLogging isNil ifTrue:[
         rDoitLogging := true asValue.
         rDoitLogging onChangeSend:#updateModifiedChannel to:self
@@ -7405,7 +7409,6 @@
 !
 
 rDoitServerPortOrPath
-
     rDoitServerPortOrPath isNil ifTrue:[
         rDoitServerPortOrPath := ValueHolder new.
         rDoitServerPortOrPath onChangeSend:#updateModifiedChannel to:self
@@ -7414,7 +7417,6 @@
 !
 
 rDoitsEnabled
-
     rDoitsEnabled isNil ifTrue:[
         rDoitsEnabled := true asValue.
         rDoitsEnabled onChangeSend:#rDoitsEnabledChanged to:self
@@ -7431,21 +7433,11 @@
             rDoitServerPortOrPath value:(RDoItServer defaultPortNumberOrPath)
         ]
     ]
-!
-
-update:something with:aParameter from:changedObject
-    changedObject == self rDoitsEnabled ifTrue:[
-        self rDoitsEnabledChanged.
-        ^ self.
-    ].
-
-    super update:something with:aParameter from:changedObject
 ! !
 
 !AbstractSettingsApplication::RDoItServerSettingsAppl methodsFor:'queries'!
 
 hasRDoitServer
-
     ^ RDoItServer notNil and:[RDoItServer isLoaded]
 !
 
@@ -7466,6 +7458,358 @@
     ^ false
 ! !
 
+!AbstractSettingsApplication::SQLServerSettingsAppl class methodsFor:'image specs'!
+
+defaultIcon
+    "This resource specification was automatically generated
+     by the ImageEditor of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the ImageEditor may not be able to read the specification."
+
+    "
+     self defaultIcon inspect
+     ImageEditor openOnClass:self andSelector:#defaultIcon
+     Icon flushCachedIcons
+    "
+
+    <resource: #image>
+
+    ^Icon
+        constantNamed:#'Expecco::ExpeccoIconLibrary class defaultIcon'
+        ifAbsentPut:[(Depth8Image new) width: 24; height: 24; photometric:(#palette); bitsPerSample:(#[8]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
+H"H"H @@@@@@@@@@@@@@@@@@@@@"H"H"@@@@@@@@@@@@@@@@@@@@@@@@@@@"H"H"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@BH"@@@@@@@@@@@@J"(*J"(*@@@@
+@@@@@BH"@@@@@@@@J"(*@@@@@@@@J"(*@@@@H"H"@@@@@B(*@@@@@@@@@@@@@@@@J"("H"H"@@@@J @@@@@@@@@@@@@@@@@@@@@*H"H"@BH@H"(*@@@@@@@@
+@@@@@@@@J"("H"H"@BH(H" $J"(*J @@@@@*J"(*H"H"H"H"@BH(H" $ABTJIB(*J"("H"H"H"H"H"H"@BH(H" $ABT%IBP(JBH"H"H"H"H"H"H"@@@(J" $
+A@PDIBP(JBH"H"H"H"H*H"H"@BH@H"(*IBP$IBP(JBH"H"H"J"("H"H"@BH(H" $J"(*J"P(JBH*J"(*H"H"H"H"@BH(H" $ABTJIB(*J"("H"H"H"H"H"H"
+@BH(H" $ABT%IBP(JBH"H"H"H"H"H"H"@@@(J" $A@PDIBP(JBH"H"H"H"H*H"H"@@@@@B(*IBP$IBP(JBH"H"H"J"(@H"H"H"H"H"H"J"(*IBP(JBH"J"(*
+H"H"H"H"H"H"H"H"@@@@J"(*J"(*@@@@@@@@@BH"H"H"H"H"@@@@@@@@@@@@@@@@@@@@@BH"H"H"H"H"@@@@@@@@@@@@@@@@@@@@@BH"H"H"H"H"@@@@@@@@
+@@@@@@@@@@@@@BH"H"H"H"H"@@@@@@@@@@@@@@@@@@@@@BH"') ; colorMapFromArray:#[224 189 75 255 253 212 114 169 125 244 219 172 224 180 55 105 195 48 255 253 194 253 210 112 27 163 14 139 188 141 254 253 153 67 140 42 245 230 190 245 250 242 238 222 158 240 212 96 254 253 228 249 239 209 254 233 132 135 224 88 62 138 68 241 209 144 254 198 97 148 180 81 255 227 154 39 125 38 61 166 37 216 172 46 46 153 24 113 206 71 25 131 15 240 198 86 79 187 37 254 243 141 102 77 2 69 123 9 205 154 5 249 235 113 225 193 100 218 179 65 130 98 3 10 113 5 0 0 0]; mask:((Depth1Image new) width: 24; height: 24; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@G8@@??@C??0G??8G??8G??8G??8G??8G??8G??8G??8G??8G??8G??8C??0@??@@G8@@@@@@@@@@@@@@@@@') ; yourself); yourself]
+! !
+
+!AbstractSettingsApplication::SQLServerSettingsAppl class methodsFor:'interface specs'!
+
+windowSpec
+    "This resource specification was automatically generated
+     by the UIPainter of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the UIPainter may not be able to read the specification."
+
+    "
+     UIPainter new openOnClass:AbstractSettingsApplication::SQLServerSettingsAppl andSelector:#windowSpec
+     AbstractSettingsApplication::SQLServerSettingsAppl new openInterface:#windowSpec
+     AbstractSettingsApplication::SQLServerSettingsAppl open
+    "
+
+    <resource: #canvas>
+
+    ^ 
+     #(FullSpec
+        name: windowSpec
+        window: 
+       (WindowSpec
+          label: 'RDoIt Server Settings'
+          name: 'RDoIt Server Settings'
+          min: (Point 10 10)
+          bounds: (Rectangle 0 0 600 550)
+        )
+        component: 
+       (SpecCollection
+          collection: (
+           (VerticalPanelViewSpec
+              name: 'VerticalPanel2'
+              layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
+              horizontalLayout: fit
+              verticalLayout: top
+              horizontalSpace: 3
+              verticalSpace: 3
+              component: 
+             (SpecCollection
+                collection: (
+                 (ViewSpec
+                    name: 'EnableBox'
+                    component: 
+                   (SpecCollection
+                      collection: (
+                       (CheckBoxSpec
+                          label: 'SQL Server Enabled'
+                          name: 'EnableCheckBox'
+                          layout: (LayoutFrame 5 0 0 0 -5 1 22 0)
+                          enableChannel: hasRDoitServerClass
+                          model: sqlServerEnabled
+                          translateLabel: true
+                        )
+                       )
+                     
+                    )
+                    extent: (Point 600 25)
+                  )
+                 (ViewSpec
+                    name: 'PortBox'
+                    component: 
+                   (SpecCollection
+                      collection: (
+                       (LabelSpec
+                          label: 'MySQL Port:'
+                          name: 'Label2'
+                          layout: (LayoutFrame 5 0 0 0 150 0 22 0)
+                          translateLabel: true
+                          adjust: right
+                        )
+                       (InputFieldSpec
+                          name: 'EntryField1'
+                          layout: (LayoutFrame 150 0 0 0 -5 1 22 0)
+                          enableChannel: rDoitsEnabled
+                          model: sqlServerPort
+                          acceptOnReturn: true
+                          acceptOnTab: true
+                          acceptOnLostFocus: true
+                          acceptOnPointerLeave: true
+                        )
+                       (LabelSpec
+                          label: 'MySQL Port-Number (ODBC)'
+                          name: 'Label3'
+                          layout: (LayoutFrame 150 0 28 0 596 0 50 0)
+                          translateLabel: true
+                          adjust: left
+                        )
+                       )
+                     
+                    )
+                    extent: (Point 600 72)
+                  )
+                 (ViewSpec
+                    name: 'LogErrorsBox'
+                    component: 
+                   (SpecCollection
+                      collection: (
+                       (CheckBoxSpec
+                          label: 'Log errors'
+                          name: 'ErrorLoggingCheckBox'
+                          layout: (LayoutFrame 25 0 0 0 -5 1 22 0)
+                          enableChannel: rDoitsEnabled
+                          model: sqlErrorLogging
+                          translateLabel: true
+                        )
+                       )
+                     
+                    )
+                    extent: (Point 600 25)
+                  )
+                 (ViewSpec
+                    name: 'LogRequestsBox'
+                    component: 
+                   (SpecCollection
+                      collection: (
+                       (CheckBoxSpec
+                          label: 'Log requests'
+                          name: 'LogRequestsCheckBox'
+                          layout: (LayoutFrame 25 0 0 0 -5 1 22 0)
+                          enableChannel: rDoitsEnabled
+                          model: sqlLogging
+                          translateLabel: true
+                        )
+                       )
+                     
+                    )
+                    extent: (Point 600 24)
+                  )
+                 (ViewSpec
+                    name: 'DebugErrorsBox'
+                    component: 
+                   (SpecCollection
+                      collection: (
+                       (CheckBoxSpec
+                          label: 'Debug errors'
+                          name: 'DebugErrorsCheckBox'
+                          layout: (LayoutFrame 25 0 0 0 -5 1 22 0)
+                          enableChannel: rDoitsEnabled
+                          model: sqlErrorDebugging
+                          translateLabel: true
+                        )
+                       )
+                     
+                    )
+                    extent: (Point 600 23)
+                  )
+                 (ViewSpec
+                    name: 'EnableSmalltalkBox'
+                    component: 
+                   (SpecCollection
+                      collection: (
+                       (CheckBoxSpec
+                          label: 'Virtual Smalltalk Table Enabled'
+                          name: 'EnableSmalltalkCheckBox'
+                          layout: (LayoutFrame 25 0 0 0 -5 1 22 0)
+                          enableChannel: rDoitsEnabled
+                          model: sqlSmalltalkServerEnabled
+                          translateLabel: true
+                        )
+                       )
+                     
+                    )
+                    extent: (Point 600 24)
+                  )
+                 )
+               
+              )
+            )
+           )
+         
+        )
+      )
+! !
+
+!AbstractSettingsApplication::SQLServerSettingsAppl methodsFor:'actions'!
+
+basicSaveSettings
+    |shouldRun port|
+
+    port := self sqlServerPort value.
+    port isNumber ifFalse:[
+        port := port asInteger.
+    ].
+
+    SQLServer::SQLServer defaultPort:port.
+    SQLServer::SQLServer logging:self sqlLogging value.
+    SQLServer::SQLServer errorLogging:self sqlErrorLogging value.
+    SQLServer::SQLServer errorCatching:(self sqlErrorDebugging value not).
+    SQLServer::SQLServer smalltalkServerEnabled:(self sqlSmalltalkServerEnabled value not).
+
+    shouldRun := self sqlServerEnabled value.
+    shouldRun ~~ SQLServer::SQLServer serverRunning ifTrue:[
+        shouldRun ifFalse:[
+            SQLServer::SQLServer stop
+        ] ifTrue:[
+            SQLServer::SQLServer start.
+            "/ must wait a bit; give it a chance to
+            "/ really start (before checking)
+            Delay waitForSeconds:1.
+            SQLServer::SQLServer serverRunning ifFalse:[
+                self warn:'SQLServer startup failed (see stderr).'
+            ]
+        ]
+    ].
+!
+
+helpFilename
+    ^ 'Launcher/communicationsSettings.html'
+!
+
+readSettings
+    (self hasSQLServer and:[SQLServer::SQLServer isLoaded]) ifTrue:[
+        self sqlServerEnabled value:SQLServer::SQLServer serverRunning.
+        self sqlSmalltalkServerEnabled value:SQLServer::SQLServer isSmalltalkServerEnabled.
+        self sqlLogging value:SQLServer::SQLServer isLogging.
+        self sqlErrorLogging value:SQLServer::SQLServer isErrorLogging.
+        self sqlErrorDebugging value:SQLServer::SQLServer isErrorCatching not.
+        self sqlServerPort value:SQLServer::SQLServer defaultPort
+    ] ifFalse:[
+        self sqlServerEnabled value:false.
+        self sqlSmalltalkServerEnabled value:false.
+        self sqlLogging value:false.
+        self sqlErrorLogging value:false.
+        self sqlErrorDebugging value:false.
+        self sqlServerPort value:nil
+    ].
+    self modifiedChannel value:false
+! !
+
+!AbstractSettingsApplication::SQLServerSettingsAppl methodsFor:'aspects'!
+
+sqlErrorDebugging
+    sqlErrorDebugging isNil ifTrue:[
+        sqlErrorDebugging := true asValue.
+        sqlErrorDebugging onChangeSend:#updateModifiedChannel to:self
+    ].
+    ^ sqlErrorDebugging.
+!
+
+sqlErrorLogging
+    sqlErrorLogging isNil ifTrue:[
+        sqlErrorLogging := true asValue.
+        sqlErrorLogging onChangeSend:#updateModifiedChannel to:self
+    ].
+    ^ sqlErrorLogging.
+!
+
+sqlLogging
+    sqlLogging isNil ifTrue:[
+        sqlLogging := true asValue.
+        sqlLogging onChangeSend:#updateModifiedChannel to:self
+    ].
+    ^ sqlLogging.
+!
+
+sqlServerEnabled
+    sqlServerEnabled isNil ifTrue:[
+        sqlServerEnabled := true asValue.
+        sqlServerEnabled onChangeSend:#sqlServerEnabledChanged to:self
+    ].
+    ^ sqlServerEnabled.
+!
+
+sqlServerPort
+    sqlServerPort isNil ifTrue:[
+        sqlServerPort := ValueHolder new.
+        sqlServerPort onChangeSend:#updateModifiedChannel to:self
+    ].
+    ^ sqlServerPort.
+!
+
+sqlSmalltalkServerEnabled
+    sqlSmalltalkServerEnabled isNil ifTrue:[
+        sqlSmalltalkServerEnabled := true asValue.
+        sqlSmalltalkServerEnabled onChangeSend:#sqlSmalltalkServerEnabledChanged to:self
+    ].
+    ^ sqlSmalltalkServerEnabled.
+! !
+
+!AbstractSettingsApplication::SQLServerSettingsAppl methodsFor:'change & update'!
+
+sqlServerEnabledChanged
+    self updateModifiedChannel.
+    self sqlServerEnabled value ifTrue:[
+        sqlServerPort value isEmptyOrNil ifTrue:[
+            sqlServerPort value:(SQLServer::SQLServer defaultPort)
+        ]
+    ]
+!
+
+sqlSmalltalkServerEnabledChanged
+    self updateModifiedChannel.
+    self sqlSmalltalkServerEnabled value ifTrue:[
+        sqlServerPort value isEmptyOrNil ifTrue:[
+            sqlServerPort value:(SQLServer::SQLServer defaultPort)
+        ]
+    ]
+! !
+
+!AbstractSettingsApplication::SQLServerSettingsAppl methodsFor:'queries'!
+
+hasSQLServer
+    ^ SQLServer::SQLServer notNil and:[SQLServer::SQLServer isLoaded]
+!
+
+hasSQLServerClass
+    ^ SQLServer::SQLServer notNil
+!
+
+hasUnsavedChanges
+    (self hasSQLServer and:[SQLServer::SQLServer isLoaded]) ifTrue:[
+        self sqlServerEnabled value ~= SQLServer::SQLServer serverRunning ifTrue:[^ true].
+        SQLServer::SQLServer serverRunning ifTrue:[
+            self sqlSmalltalkServerEnabled value ~= SQLServer::SQLServer isSmalltalkServerEnabled ifTrue:[^ true].
+            self sqlLogging value ~= SQLServer::SQLServer isLogging ifTrue:[^ true].
+            self sqlErrorLogging value ~= SQLServer::SQLServer isErrorLogging ifTrue:[^ true].
+            self sqlErrorDebugging value ~= SQLServer::SQLServer isErrorCatching not ifTrue:[^ true].
+            self sqlServerPort value ~= SQLServer::SQLServer defaultPort ifTrue:[^ true].
+        ]
+    ].
+    ^ false
+! !
+
 !AbstractSettingsApplication::STCCompilerSettingsAppl class methodsFor:'defaults'!
 
 stcCompilationOptions
@@ -11454,5 +11798,5 @@
 !AbstractSettingsApplication class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/AbstractSettingsApplication.st,v 1.204 2005-11-27 22:16:31 stefan Exp $'
-! !
+    ^ '$Header: /cvs/stx/stx/libtool/AbstractSettingsApplication.st,v 1.205 2005-11-29 17:02:15 cg Exp $'
+! !