finalize some stuff, make it ready for use

This commit is contained in:
John Bintz 2012-06-05 20:21:13 -04:00
parent 53ab8e23bc
commit ce5128b244
11 changed files with 46 additions and 18 deletions

View File

@ -1,5 +0,0 @@
desc 'Build app'
task :build_app do
cp_r 'skel/UnisonWatch.app', '.'
end

BIN
assets/unison.icns Normal file

Binary file not shown.

BIN
bin/setfileicon Executable file

Binary file not shown.

View File

@ -4,16 +4,19 @@ module Unison
new(*args).run(&block)
end
def initialize(profiles, log)
@profiles, @log = profiles, log
def initialize(config, log)
@config, @log = config, log
end
def run(&block)
Thread.new do
begin
@profiles.each do |profile|
#system %{bash -c 'unison -log -logfile #{@log} -batch #{profile} 2>>#{@log}.stderr >>#{@log}.stdout'}
system %{bash -c 'unison -log -logfile #{@log} -batch #{profile}'}
@config.profiles.each do |profile|
system %{bash -c '#{@config.unison_binary} -ui text -log -logfile #{@log} -batch #{profile}'}
if $?.exitstatus != 0
system %{bash -c '#{@config.unison_binary} -ui graphic #{profile}'}
end
end
block.call

View File

@ -30,6 +30,8 @@ module Unison
end
File.chmod(0755, "UnisonWatch.app/Contents/MacOS/UnisonWatch")
system %{bin/setfileicon assets/unison.icns UnisonWatch.app}
end
no_tasks do

View File

@ -14,7 +14,11 @@ module Unison
end
def self.skel_data
{ 'profiles' => [], 'time_between_checks' => DEFAULT_TIME_BETWEEN_CHECKS }
{
'profiles' => [],
'time_between_checks' => DEFAULT_TIME_BETWEEN_CHECKS,
'unison_binary' => '/usr/bin/unison'
}
end
def set_profile(profile, is_set)
@ -63,6 +67,15 @@ module Unison
save
end
def unison_binary
data['unison_binary']
end
def unison_binary=(binary)
data['unison_binary'] = binary
save
end
def data
@data.update { |d| d || YAML.load_file(@file) }
@data.value

0
lib/unison/ui/about.rb Normal file
View File

View File

@ -15,6 +15,11 @@ module Unison
self.connect(SIGNAL(:textChanged), &method(:on_text_change))
end
def show
super
self.raise
end
def on_text_change
self.moveCursor Qt::TextCursor::End
end

View File

@ -9,6 +9,11 @@ module Unison
generate
end
def show
super
self.raise
end
def generate
layout = Qt::GridLayout.new
@ -35,8 +40,14 @@ module Unison
count_field = Qt::LineEdit.new(@config.time_between_checks.to_s)
count_field.connect(SIGNAL "textChanged(QString)") { |string| @config.time_between_checks = string.to_i }
binary_label = Qt::Label.new("Unison binary:")
binary_field = Qt::LineEdit.new(@config.unison_binary)
binary_field.connect(SIGNAL "textChanged(QString)") { |string| @config.unison_binary = string }
fields_layout.addWidget(count_label, 0, 0)
fields_layout.addWidget(count_field, 0, 1)
fields_layout.addWidget(binary_label, 1, 0)
fields_layout.addWidget(binary_field, 1, 1)
performance_group_layout.addWidget(fields)
layout.addWidget(profile_group, 0, 0)

View File

@ -3,11 +3,10 @@ require 'forwardable'
module Unison
class Watcher < Qt::Application
TRANSFER_LOG = '~/unison.log'
SYNC_CHECK_TIME = 0.1
SYNC_CHECK_TIME = 0.05
extend Forwardable
def_delegators :@config, :profiles
def initialize(profiles, *args)
super(*args)
@ -22,7 +21,7 @@ module Unison
end
def time_between_checks
@config.time_between_checks * 10
@config.time_between_checks * 20
end
def <<(dirs)
@ -30,7 +29,7 @@ module Unison
end
def processed_profiles
@processed_profiles ||= Unison::Profile.process(profiles)
@processed_profiles ||= Unison::Profile.process(@config.profiles)
end
def watch
@ -68,7 +67,7 @@ module Unison
end
def ui
@icon = Unison::UI::Icon.new(menu, self, profiles, File.join(Unison.root, 'assets'))
@icon = Unison::UI::Icon.new(menu, self, @config.profiles, File.join(Unison.root, 'assets'))
@config.on_update { @icon.profiles = @config.profiles }
@current_icon = 'idle'
@ -129,7 +128,7 @@ module Unison
@done = false
Unison::Bridge.run(profiles, TRANSFER_LOG) { @done = true }
Unison::Bridge.run(@config, TRANSFER_LOG) { @done = true }
show_working

View File

@ -7,7 +7,7 @@
<key>CFBundleGetInfoString</key>
<string>Unison Watch</string>
<key>CFBundleIdentifier</key>
<string>webapps.webrunner</string>
<string>unisonwatch</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>