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.annotation.Nonnull
|
||||||
import javax.swing.JFileChooser
|
import javax.swing.JFileChooser
|
||||||
import javax.swing.JOptionPane
|
import javax.swing.JOptionPane
|
||||||
|
import java.awt.Font
|
||||||
|
|
||||||
import com.muwire.core.Core
|
import com.muwire.core.Core
|
||||||
import com.muwire.core.MuWireSettings
|
import com.muwire.core.MuWireSettings
|
||||||
|
@ -201,6 +202,12 @@ class OptionsController {
|
||||||
uiSettings.autoFontSize = model.automaticFontSize
|
uiSettings.autoFontSize = model.automaticFontSize
|
||||||
uiSettings.fontSize = Integer.parseInt(view.fontSizeField.text)
|
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
|
uiSettings.groupByFile = model.groupByFile
|
||||||
|
|
||||||
boolean clearCancelledDownloads = view.clearCancelledDownloadsCheckbox.model.isSelected()
|
boolean clearCancelledDownloads = view.clearCancelledDownloadsCheckbox.model.isSelected()
|
||||||
|
|
|
@ -7,6 +7,8 @@ import griffon.core.artifact.GriffonModel
|
||||||
import griffon.transform.Observable
|
import griffon.transform.Observable
|
||||||
import griffon.metadata.ArtifactProviderFor
|
import griffon.metadata.ArtifactProviderFor
|
||||||
|
|
||||||
|
import java.awt.Font
|
||||||
|
|
||||||
@ArtifactProviderFor(GriffonModel)
|
@ArtifactProviderFor(GriffonModel)
|
||||||
class OptionsModel {
|
class OptionsModel {
|
||||||
@Observable String downloadRetryInterval
|
@Observable String downloadRetryInterval
|
||||||
|
@ -36,6 +38,8 @@ class OptionsModel {
|
||||||
@Observable String font
|
@Observable String font
|
||||||
@Observable boolean automaticFontSize
|
@Observable boolean automaticFontSize
|
||||||
@Observable int customFontSize
|
@Observable int customFontSize
|
||||||
|
@Observable boolean fontStyleBold
|
||||||
|
@Observable boolean fontStyleItalic
|
||||||
@Observable boolean clearCancelledDownloads
|
@Observable boolean clearCancelledDownloads
|
||||||
@Observable boolean clearFinishedDownloads
|
@Observable boolean clearFinishedDownloads
|
||||||
@Observable boolean excludeLocalResult
|
@Observable boolean excludeLocalResult
|
||||||
|
@ -99,6 +103,8 @@ class OptionsModel {
|
||||||
font = uiSettings.font
|
font = uiSettings.font
|
||||||
automaticFontSize = uiSettings.autoFontSize
|
automaticFontSize = uiSettings.autoFontSize
|
||||||
customFontSize = uiSettings.fontSize
|
customFontSize = uiSettings.fontSize
|
||||||
|
fontStyleBold = (uiSettings.fontStyle & Font.BOLD) == Font.BOLD
|
||||||
|
fontStyleItalic = (uiSettings.fontStyle & Font.ITALIC) == Font.ITALIC
|
||||||
clearCancelledDownloads = uiSettings.clearCancelledDownloads
|
clearCancelledDownloads = uiSettings.clearCancelledDownloads
|
||||||
clearFinishedDownloads = uiSettings.clearFinishedDownloads
|
clearFinishedDownloads = uiSettings.clearFinishedDownloads
|
||||||
excludeLocalResult = uiSettings.excludeLocalResult
|
excludeLocalResult = uiSettings.excludeLocalResult
|
||||||
|
|
|
@ -59,6 +59,8 @@ class OptionsView {
|
||||||
def monitorCheckbox
|
def monitorCheckbox
|
||||||
def fontField
|
def fontField
|
||||||
def fontSizeField
|
def fontSizeField
|
||||||
|
def fontStyleBoldCheckbox
|
||||||
|
def fontStyleItalicCheckbox
|
||||||
def clearCancelledDownloadsCheckbox
|
def clearCancelledDownloadsCheckbox
|
||||||
def clearFinishedDownloadsCheckbox
|
def clearFinishedDownloadsCheckbox
|
||||||
def excludeLocalResultCheckbox
|
def excludeLocalResultCheckbox
|
||||||
|
@ -221,6 +223,14 @@ class OptionsView {
|
||||||
fontSizeField = textField(text : bind {model.customFontSize}, enabled : bind {!model.automaticFontSize},
|
fontSizeField = textField(text : bind {model.customFontSize}, enabled : bind {!model.automaticFontSize},
|
||||||
constraints : gbc(gridx : 3, gridy : 2, anchor : GridBagConstraints.LINE_END))
|
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),
|
panel (border : titledBorder(title : "Search Settings", border : etchedBorder(), titlePosition : TitledBorder.TOP),
|
||||||
constraints : gbc(gridx : 0, gridy : 1, fill : GridBagConstraints.HORIZONTAL, weightx : 100)) {
|
constraints : gbc(gridx : 0, gridy : 1, fill : GridBagConstraints.HORIZONTAL, weightx : 100)) {
|
||||||
|
|
Loading…
Reference in New Issue