checkboxes for font style

pull/53/head
Zlatin Balevsky 2020-06-03 12:44:56 +01:00
parent 8cbada110e
commit 6740d09479
No known key found for this signature in database
GPG Key ID: A72832072D525E41
3 changed files with 23 additions and 0 deletions

View File

@ -11,6 +11,7 @@ import java.util.logging.Level
import javax.annotation.Nonnull
import javax.swing.JFileChooser
import javax.swing.JOptionPane
import java.awt.Font
import com.muwire.core.Core
import com.muwire.core.MuWireSettings
@ -201,6 +202,12 @@ class OptionsController {
uiSettings.autoFontSize = model.automaticFontSize
uiSettings.fontSize = Integer.parseInt(view.fontSizeField.text)
uiSettings.fontStyle = Font.PLAIN
if (view.fontStyleBoldCheckbox.model.isSelected())
uiSettings.fontStyle |= Font.BOLD
if (view.fontStyleItalicCheckbox.model.isSelected())
uiSettings.fontStyle |= Font.ITALIC
uiSettings.groupByFile = model.groupByFile
boolean clearCancelledDownloads = view.clearCancelledDownloadsCheckbox.model.isSelected()

View File

@ -7,6 +7,8 @@ import griffon.core.artifact.GriffonModel
import griffon.transform.Observable
import griffon.metadata.ArtifactProviderFor
import java.awt.Font
@ArtifactProviderFor(GriffonModel)
class OptionsModel {
@Observable String downloadRetryInterval
@ -36,6 +38,8 @@ class OptionsModel {
@Observable String font
@Observable boolean automaticFontSize
@Observable int customFontSize
@Observable boolean fontStyleBold
@Observable boolean fontStyleItalic
@Observable boolean clearCancelledDownloads
@Observable boolean clearFinishedDownloads
@Observable boolean excludeLocalResult
@ -99,6 +103,8 @@ class OptionsModel {
font = uiSettings.font
automaticFontSize = uiSettings.autoFontSize
customFontSize = uiSettings.fontSize
fontStyleBold = (uiSettings.fontStyle & Font.BOLD) == Font.BOLD
fontStyleItalic = (uiSettings.fontStyle & Font.ITALIC) == Font.ITALIC
clearCancelledDownloads = uiSettings.clearCancelledDownloads
clearFinishedDownloads = uiSettings.clearFinishedDownloads
excludeLocalResult = uiSettings.excludeLocalResult

View File

@ -59,6 +59,8 @@ class OptionsView {
def monitorCheckbox
def fontField
def fontSizeField
def fontStyleBoldCheckbox
def fontStyleItalicCheckbox
def clearCancelledDownloadsCheckbox
def clearFinishedDownloadsCheckbox
def excludeLocalResultCheckbox
@ -221,6 +223,14 @@ class OptionsView {
fontSizeField = textField(text : bind {model.customFontSize}, enabled : bind {!model.automaticFontSize},
constraints : gbc(gridx : 3, gridy : 2, anchor : GridBagConstraints.LINE_END))
label(text : "Font style", constraints: gbc(gridx: 0, gridy: 3, anchor : GridBagConstraints.LINE_START, weightx: 100))
panel(constraints : gbc(gridx: 2, gridy: 3, gridwidth: 2, anchor:GridBagConstraints.LINE_END)) {
fontStyleBoldCheckbox = checkBox(selected : bind {model.fontStyleBold})
label(text: "Bold")
fontStyleItalicCheckbox = checkBox(selected : bind {model.fontStyleItalic})
label(text: "Italic")
}
}
panel (border : titledBorder(title : "Search Settings", border : etchedBorder(), titlePosition : TitledBorder.TOP),
constraints : gbc(gridx : 0, gridy : 1, fill : GridBagConstraints.HORIZONTAL, weightx : 100)) {