finalize some stuff, make it ready for use
This commit is contained in:
parent
53ab8e23bc
commit
ce5128b244
5
Rakefile
5
Rakefile
@ -1,5 +0,0 @@
|
|||||||
desc 'Build app'
|
|
||||||
task :build_app do
|
|
||||||
cp_r 'skel/UnisonWatch.app', '.'
|
|
||||||
end
|
|
||||||
|
|
BIN
assets/unison.icns
Normal file
BIN
assets/unison.icns
Normal file
Binary file not shown.
BIN
bin/setfileicon
Executable file
BIN
bin/setfileicon
Executable file
Binary file not shown.
@ -4,16 +4,19 @@ module Unison
|
|||||||
new(*args).run(&block)
|
new(*args).run(&block)
|
||||||
end
|
end
|
||||||
|
|
||||||
def initialize(profiles, log)
|
def initialize(config, log)
|
||||||
@profiles, @log = profiles, log
|
@config, @log = config, log
|
||||||
end
|
end
|
||||||
|
|
||||||
def run(&block)
|
def run(&block)
|
||||||
Thread.new do
|
Thread.new do
|
||||||
begin
|
begin
|
||||||
@profiles.each do |profile|
|
@config.profiles.each do |profile|
|
||||||
#system %{bash -c 'unison -log -logfile #{@log} -batch #{profile} 2>>#{@log}.stderr >>#{@log}.stdout'}
|
system %{bash -c '#{@config.unison_binary} -ui text -log -logfile #{@log} -batch #{profile}'}
|
||||||
system %{bash -c 'unison -log -logfile #{@log} -batch #{profile}'}
|
|
||||||
|
if $?.exitstatus != 0
|
||||||
|
system %{bash -c '#{@config.unison_binary} -ui graphic #{profile}'}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
block.call
|
block.call
|
||||||
|
@ -30,6 +30,8 @@ module Unison
|
|||||||
end
|
end
|
||||||
|
|
||||||
File.chmod(0755, "UnisonWatch.app/Contents/MacOS/UnisonWatch")
|
File.chmod(0755, "UnisonWatch.app/Contents/MacOS/UnisonWatch")
|
||||||
|
|
||||||
|
system %{bin/setfileicon assets/unison.icns UnisonWatch.app}
|
||||||
end
|
end
|
||||||
|
|
||||||
no_tasks do
|
no_tasks do
|
||||||
|
@ -14,7 +14,11 @@ module Unison
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.skel_data
|
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
|
end
|
||||||
|
|
||||||
def set_profile(profile, is_set)
|
def set_profile(profile, is_set)
|
||||||
@ -63,6 +67,15 @@ module Unison
|
|||||||
save
|
save
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def unison_binary
|
||||||
|
data['unison_binary']
|
||||||
|
end
|
||||||
|
|
||||||
|
def unison_binary=(binary)
|
||||||
|
data['unison_binary'] = binary
|
||||||
|
save
|
||||||
|
end
|
||||||
|
|
||||||
def data
|
def data
|
||||||
@data.update { |d| d || YAML.load_file(@file) }
|
@data.update { |d| d || YAML.load_file(@file) }
|
||||||
@data.value
|
@data.value
|
||||||
|
0
lib/unison/ui/about.rb
Normal file
0
lib/unison/ui/about.rb
Normal file
@ -15,6 +15,11 @@ module Unison
|
|||||||
self.connect(SIGNAL(:textChanged), &method(:on_text_change))
|
self.connect(SIGNAL(:textChanged), &method(:on_text_change))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
super
|
||||||
|
self.raise
|
||||||
|
end
|
||||||
|
|
||||||
def on_text_change
|
def on_text_change
|
||||||
self.moveCursor Qt::TextCursor::End
|
self.moveCursor Qt::TextCursor::End
|
||||||
end
|
end
|
||||||
|
@ -9,6 +9,11 @@ module Unison
|
|||||||
generate
|
generate
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
super
|
||||||
|
self.raise
|
||||||
|
end
|
||||||
|
|
||||||
def generate
|
def generate
|
||||||
layout = Qt::GridLayout.new
|
layout = Qt::GridLayout.new
|
||||||
|
|
||||||
@ -35,8 +40,14 @@ module Unison
|
|||||||
count_field = Qt::LineEdit.new(@config.time_between_checks.to_s)
|
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 }
|
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_label, 0, 0)
|
||||||
fields_layout.addWidget(count_field, 0, 1)
|
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)
|
performance_group_layout.addWidget(fields)
|
||||||
|
|
||||||
layout.addWidget(profile_group, 0, 0)
|
layout.addWidget(profile_group, 0, 0)
|
||||||
|
@ -3,11 +3,10 @@ require 'forwardable'
|
|||||||
module Unison
|
module Unison
|
||||||
class Watcher < Qt::Application
|
class Watcher < Qt::Application
|
||||||
TRANSFER_LOG = '~/unison.log'
|
TRANSFER_LOG = '~/unison.log'
|
||||||
SYNC_CHECK_TIME = 0.1
|
SYNC_CHECK_TIME = 0.05
|
||||||
|
|
||||||
extend Forwardable
|
extend Forwardable
|
||||||
|
|
||||||
def_delegators :@config, :profiles
|
|
||||||
def initialize(profiles, *args)
|
def initialize(profiles, *args)
|
||||||
super(*args)
|
super(*args)
|
||||||
|
|
||||||
@ -22,7 +21,7 @@ module Unison
|
|||||||
end
|
end
|
||||||
|
|
||||||
def time_between_checks
|
def time_between_checks
|
||||||
@config.time_between_checks * 10
|
@config.time_between_checks * 20
|
||||||
end
|
end
|
||||||
|
|
||||||
def <<(dirs)
|
def <<(dirs)
|
||||||
@ -30,7 +29,7 @@ module Unison
|
|||||||
end
|
end
|
||||||
|
|
||||||
def processed_profiles
|
def processed_profiles
|
||||||
@processed_profiles ||= Unison::Profile.process(profiles)
|
@processed_profiles ||= Unison::Profile.process(@config.profiles)
|
||||||
end
|
end
|
||||||
|
|
||||||
def watch
|
def watch
|
||||||
@ -68,7 +67,7 @@ module Unison
|
|||||||
end
|
end
|
||||||
|
|
||||||
def ui
|
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 }
|
@config.on_update { @icon.profiles = @config.profiles }
|
||||||
|
|
||||||
@current_icon = 'idle'
|
@current_icon = 'idle'
|
||||||
@ -129,7 +128,7 @@ module Unison
|
|||||||
|
|
||||||
@done = false
|
@done = false
|
||||||
|
|
||||||
Unison::Bridge.run(profiles, TRANSFER_LOG) { @done = true }
|
Unison::Bridge.run(@config, TRANSFER_LOG) { @done = true }
|
||||||
|
|
||||||
show_working
|
show_working
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<key>CFBundleGetInfoString</key>
|
<key>CFBundleGetInfoString</key>
|
||||||
<string>Unison Watch</string>
|
<string>Unison Watch</string>
|
||||||
<key>CFBundleIdentifier</key>
|
<key>CFBundleIdentifier</key>
|
||||||
<string>webapps.webrunner</string>
|
<string>unisonwatch</string>
|
||||||
<key>CFBundleInfoDictionaryVersion</key>
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
<string>6.0</string>
|
<string>6.0</string>
|
||||||
<key>CFBundleName</key>
|
<key>CFBundleName</key>
|
||||||
|
Loading…
Reference in New Issue
Block a user