mirror of https://github.com/zlatinb/muwire
checkboxes for font style
parent
8cbada110e
commit
6740d09479
|
@ -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()
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)) {
|
||||
|
|
Loading…
Reference in New Issue