Class: PiggyOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/piggy-core/options.rb

Overview

Provide Piggy with user defined settings.

Constant Summary collapse

ProcessorNconvert =

possible values for @image_processor

'nconvert'
ProcessorFxruby =
'fxruby'
ProcessorRmagick =
'rmagick'
SortByTime =

possible values for @sort_order

'time'
SortByName =
'name'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePiggyOptions

Returns a new instance of PiggyOptions.



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/piggy-core/options.rb', line 32

def initialize
  @usePreview = nil
  @useLog = nil
  @useNconvert = nil
  @imageProcessor = nil
  @thumbWidth = nil
  @thumbHeight = nil
  @imageWidth = nil
  @widescreenWidth = nil
  @imageHeight = nil
  @generateFramePage = nil
  @useTable = nil
  @localDestinationPath = nil
  @remoteDestinationPath = nil
  @ftpUser = nil
  @ftpHost = nil
  @ftpHasLocaltime = nil
  @ftpConnectionTimeout = nil
  @ftpTransferTimeout = nil
  @addZip = nil
  @addSlideshow = nil
  @addJavaFxSlideshow = nil
  @preselectDirectories = nil
  @slideshowDelay = nil
  @style = nil
  @debug = nil
  @browser = nil
  @stylesSample = nil
  @useExifComments = nil
  @excludeFilters = nil
  @namingPatterns = nil
  @sortOrder = nil
  initialize_nils_with_default
end

Instance Attribute Details

#addJavaFxSlideshowObject Also known as: addJavaFxSlideshow?

Returns the value of attribute addJavaFxSlideshow.



8
9
10
# File 'lib/piggy-core/options.rb', line 8

def addJavaFxSlideshow
  @addJavaFxSlideshow
end

#addSlideshowObject Also known as: addSlideshow?

Returns the value of attribute addSlideshow.



8
9
10
# File 'lib/piggy-core/options.rb', line 8

def addSlideshow
  @addSlideshow
end

#addZipObject Also known as: addZip?

Returns the value of attribute addZip.



8
9
10
# File 'lib/piggy-core/options.rb', line 8

def addZip
  @addZip
end

#browserObject

Returns the value of attribute browser.



8
9
10
# File 'lib/piggy-core/options.rb', line 8

def browser
  @browser
end

#debugObject Also known as: debug?

Returns the value of attribute debug.



8
9
10
# File 'lib/piggy-core/options.rb', line 8

def debug
  @debug
end

#excludeFiltersObject

Returns the value of attribute excludeFilters.



8
9
10
# File 'lib/piggy-core/options.rb', line 8

def excludeFilters
  @excludeFilters
end

#ftpConnectionTimeoutObject

Returns the value of attribute ftpConnectionTimeout.



8
9
10
# File 'lib/piggy-core/options.rb', line 8

def ftpConnectionTimeout
  @ftpConnectionTimeout
end

#ftpHasLocaltimeObject Also known as: ftpHasLocaltime?

Returns the value of attribute ftpHasLocaltime.



8
9
10
# File 'lib/piggy-core/options.rb', line 8

def ftpHasLocaltime
  @ftpHasLocaltime
end

#ftpHostObject

Returns the value of attribute ftpHost.



8
9
10
# File 'lib/piggy-core/options.rb', line 8

def ftpHost
  @ftpHost
end

#ftpTransferTimeoutObject

Returns the value of attribute ftpTransferTimeout.



8
9
10
# File 'lib/piggy-core/options.rb', line 8

def ftpTransferTimeout
  @ftpTransferTimeout
end

#ftpUserObject

Returns the value of attribute ftpUser.



8
9
10
# File 'lib/piggy-core/options.rb', line 8

def ftpUser
  @ftpUser
end

#generateFramePageObject Also known as: generateFramePage?

Returns the value of attribute generateFramePage.



8
9
10
# File 'lib/piggy-core/options.rb', line 8

def generateFramePage
  @generateFramePage
end

#imageHeightObject

Returns the value of attribute imageHeight.



8
9
10
# File 'lib/piggy-core/options.rb', line 8

def imageHeight
  @imageHeight
end

#imageWidthObject

Returns the value of attribute imageWidth.



8
9
10
# File 'lib/piggy-core/options.rb', line 8

def imageWidth
  @imageWidth
end

#localDestinationPathObject

Returns the value of attribute localDestinationPath.



8
9
10
# File 'lib/piggy-core/options.rb', line 8

def localDestinationPath
  @localDestinationPath
end

#namingPatternsObject

Returns the value of attribute namingPatterns.



8
9
10
# File 'lib/piggy-core/options.rb', line 8

def namingPatterns
  @namingPatterns
end

#preselectDirectoriesObject Also known as: preselectDirectories?

Returns the value of attribute preselectDirectories.



8
9
10
# File 'lib/piggy-core/options.rb', line 8

def preselectDirectories
  @preselectDirectories
end

#remoteDestinationPathObject

Returns the value of attribute remoteDestinationPath.



8
9
10
# File 'lib/piggy-core/options.rb', line 8

def remoteDestinationPath
  @remoteDestinationPath
end

#skipImageProcessingObject

Returns the value of attribute skipImageProcessing.



8
9
10
# File 'lib/piggy-core/options.rb', line 8

def skipImageProcessing
  @skipImageProcessing
end

#slideshowDelayObject

Returns the value of attribute slideshowDelay.



8
9
10
# File 'lib/piggy-core/options.rb', line 8

def slideshowDelay
  @slideshowDelay
end

#sortOrderObject

Returns the value of attribute sortOrder.



8
9
10
# File 'lib/piggy-core/options.rb', line 8

def sortOrder
  @sortOrder
end

#styleObject

Returns the value of attribute style.



8
9
10
# File 'lib/piggy-core/options.rb', line 8

def style
  @style
end

#stylesSampleObject Also known as: stylesSample?

Returns the value of attribute stylesSample.



8
9
10
# File 'lib/piggy-core/options.rb', line 8

def stylesSample
  @stylesSample
end

#thumbHeightObject

Returns the value of attribute thumbHeight.



8
9
10
# File 'lib/piggy-core/options.rb', line 8

def thumbHeight
  @thumbHeight
end

#thumbWidthObject

Returns the value of attribute thumbWidth.



8
9
10
# File 'lib/piggy-core/options.rb', line 8

def thumbWidth
  @thumbWidth
end

#useExifCommentsObject Also known as: useExifComments?

Returns the value of attribute useExifComments.



8
9
10
# File 'lib/piggy-core/options.rb', line 8

def useExifComments
  @useExifComments
end

#useLogObject Also known as: useLog?

Returns the value of attribute useLog.



8
9
10
# File 'lib/piggy-core/options.rb', line 8

def useLog
  @useLog
end

#usePreviewObject Also known as: usePreview?

Returns the value of attribute usePreview.



8
9
10
# File 'lib/piggy-core/options.rb', line 8

def usePreview
  @usePreview
end

#useTableObject Also known as: useTable?

Returns the value of attribute useTable.



8
9
10
# File 'lib/piggy-core/options.rb', line 8

def useTable
  @useTable
end

#widescreenWidthObject

Returns the value of attribute widescreenWidth.



8
9
10
# File 'lib/piggy-core/options.rb', line 8

def widescreenWidth
  @widescreenWidth
end

Instance Method Details

#browser?Boolean

Returns:

  • (Boolean)


129
130
131
# File 'lib/piggy-core/options.rb', line 129

def browser?
  !@browser.nil? && !@browser.empty?
end

#initialize_nils_with_defaultObject Also known as: initializeNilsWithDefault

Public init e. g. after reading some entries from an older config file.



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/piggy-core/options.rb', line 69

def initialize_nils_with_default
  @usePreview = false if @usePreview.nil?
  @useLog = false if @useLog.nil?
  @useNconvert = false if @useNconvert.nil?
  if @imageProcessor.nil?
    @imageProcessor = (@useNconvert ? ProcessorNconvert : ProcessorFxruby)
  end
  @thumbWidth = 100 if @thumbWidth.nil?
  @thumbHeight = 100 if @thumbHeight.nil?
  @imageWidth = 600 if @imageWidth.nil?
  @widescreenWidth = 700 if @widescreenWidth.nil?
  @imageHeight = 520 if @imageHeight.nil?
  @generateFramePage = false if @generateFramePage.nil?
  @useTable = generateFramePage? if @uosPathseTable.nil?
  @localDestinationPath = WinShell.instance.picture_directory if @localDestinationPath.nil?
  @remoteDestinationPath = '' if @remoteDestinationPath.nil?
  @ftpUser = 'anonymous' if @ftpUser.nil?
  @ftpHost = 'ftp.blablabla.de' if @ftpHost.nil?
  @ftpHasLocaltime = false if @ftpHasLocaltime.nil?
  @ftpConnectionTimeout = 10 if @ftpConnectionTimeout.nil?
  @ftpTransferTimeout = 30 if @ftpTransferTimeout.nil?
  @addZip = true if @addZip.nil?
  @addSlideshow = true if @addSlideshow.nil?
  @addJavaFxSlideshow = false if @addJavaFxSlideshow.nil?
  @preselectDirectories = true if @preselectDirectories.nil?
  @slideshowDelay = 5 if @slideshowDelay.nil?
  @style = 'shadow' if @style.nil?
  @debug = false if @debug.nil?
  @browser = '' if @browser.nil?
  @stylesSample = false if @stylesSample.nil?
  @useExifComments = false if @useExifComments.nil?
  @excludeFilters = ['~$', '#$', '^\.'] if @excludeFilters.nil?
  @namingPatterns = ['IMG_.*', 'DSC.*'] if @namingPatterns.nil?
  @sortOrder = SortByName if @sortOrder.nil?
end

#sort_by_time?Boolean

Returns:

  • (Boolean)


133
134
135
# File 'lib/piggy-core/options.rb', line 133

def sort_by_time?
  @sortOrder == SortByTime
end

#use_fxruby!Object



105
106
107
# File 'lib/piggy-core/options.rb', line 105

def use_fxruby!
  @imageProcessor = ProcessorFxruby
end

#use_fxruby?Boolean

Returns:

  • (Boolean)


109
110
111
# File 'lib/piggy-core/options.rb', line 109

def use_fxruby?
  @imageProcessor == ProcessorFxruby
end

#use_nconvert!Object



113
114
115
# File 'lib/piggy-core/options.rb', line 113

def use_nconvert!
  @imageProcessor = ProcessorNconvert
end

#use_nconvert?Boolean

Returns:

  • (Boolean)


117
118
119
# File 'lib/piggy-core/options.rb', line 117

def use_nconvert?
  @imageProcessor == ProcessorNconvert
end

#use_rmagick!Object



121
122
123
# File 'lib/piggy-core/options.rb', line 121

def use_rmagick!
  @imageProcessor = ProcessorRmagick
end

#use_rmagick?Boolean

Returns:

  • (Boolean)


125
126
127
# File 'lib/piggy-core/options.rb', line 125

def use_rmagick?
  @imageProcessor == ProcessorRmagick
end