Class: GeneralSettingsPage

Inherits:
Qt::Widget
  • Object
show all
Defined in:
lib/settings.rb

Instance Method Summary collapse

Constructor Details

#initialize(parent = nil) ⇒ GeneralSettingsPage

Returns a new instance of GeneralSettingsPage.



46
47
48
49
# File 'lib/settings.rb', line 46

def initialize(parent=nil)
    super(parent)
    createWidget
end

Instance Method Details

#autoFetchChanged(state) ⇒ Object



94
95
96
97
# File 'lib/settings.rb', line 94

def autoFetchChanged(state)
    @downloadUrl.enabled = state == Qt::Checked
    @openDownloadDir.enabled = state == Qt::Checked
end

#autoUnpackChanged(state) ⇒ Object



100
101
102
103
# File 'lib/settings.rb', line 100

def autoUnpackChanged(state)
    @unpackUrl.enabled = state == Qt::Checked
    @openUnpackDir.enabled = state == Qt::Checked
end

#createWidgetObject



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/settings.rb', line 51

def createWidget
    @autoFetchCheckBox = Qt::CheckBox.new(i18n("Always Download gem in same directory."))
    @downloadUrl = FolderSelectorLineEdit.new
    @downloadUrl.enabled = false
    connect(@autoFetchCheckBox, SIGNAL('stateChanged(int)'),
            self, SLOT('autoFetchChanged(int)'))

    @autoUnpackCheckBox = Qt::CheckBox.new(i18n("Always Unpack gem in same directory."))
    @unpackUrl = FolderSelectorLineEdit.new
    @unpackUrl.enabled = false
    connect(@autoUnpackCheckBox, SIGNAL('stateChanged(int)'),
            self, SLOT('autoUnpackChanged(int)'))
    @installLatestCheckBox = Qt::CheckBox.new(i18n("Always Install latest version to skip version selection."))
    @downloadLatestCheckBox = Qt::CheckBox.new(i18n("Always Download latest version to skip version selection."))

    @openDownloadDir = KDE::PushButton.new(KDE::Icon.new('folder'), 'Open')
    @openUnpackDir = KDE::PushButton.new(KDE::Icon.new('folder'), 'Open')
    connect(@openDownloadDir, SIGNAL(:clicked), self, SLOT(:openDownloadDir))
    connect(@openUnpackDir, SIGNAL(:clicked), self, SLOT(:openUnpackDir))

    # objectNames
    #  'kcfg_' + class Settings's instance name.
    @autoFetchCheckBox.objectName = 'kcfg_autoFetchFlag'
    @downloadUrl.objectName = 'kcfg_autoFetchDir'
    @autoUnpackCheckBox.objectName = 'kcfg_autoUnpackFlag'
    @unpackUrl.objectName = 'kcfg_autoUnpackDir'
    @installLatestCheckBox.objectName = 'kcfg_installLatestFlag'
    @downloadLatestCheckBox.objectName = 'kcfg_downloadLatestFlag'

    # layout
    lo = Qt::VBoxLayout.new do |l|
        l.addWidget(@installLatestCheckBox)
        l.addWidget(@downloadLatestCheckBox)
        l.addWidget(@autoFetchCheckBox)
        l.addWidgets('   ', @downloadUrl, @openDownloadDir)
        l.addWidget(@autoUnpackCheckBox)
        l.addWidgets('   ', @unpackUrl, @openUnpackDir)
        l.addStretch
    end
    setLayout(lo)
end

#openDownloadDirObject



106
107
108
# File 'lib/settings.rb', line 106

def openDownloadDir
    openDirectory(@downloadUrl.text)
end

#openUnpackDirObject



111
112
113
# File 'lib/settings.rb', line 111

def openUnpackDir
    openDirectory(@unpackUrl.text)
end