transfer log works, yay
This commit is contained in:
parent
2232cbdd1e
commit
dedff60119
@ -140,8 +140,16 @@ class UnisonWatcher < Qt::Application
|
|||||||
@active_status = Qt::Action.new("Pause syncing", @menu)
|
@active_status = Qt::Action.new("Pause syncing", @menu)
|
||||||
@active_status.connect(SIGNAL :triggered) { toggle_status }
|
@active_status.connect(SIGNAL :triggered) { toggle_status }
|
||||||
|
|
||||||
|
@current_log_size = File.size(File.expand_path(TRANSFER_LOG))
|
||||||
|
|
||||||
|
@fileview = Qt::TextEdit.new
|
||||||
|
@fileview.plainText = "Watching for changes..."
|
||||||
|
@fileview.readOnly = true
|
||||||
|
@fileview.resize 800, 600
|
||||||
|
@fileview.connect(SIGNAL :textChanged) { @fileview.moveCursor Qt::TextCursor::End }
|
||||||
|
|
||||||
@log = Qt::Action.new("View transfer log", @menu)
|
@log = Qt::Action.new("View transfer log", @menu)
|
||||||
@log.connect(SIGNAL :triggered) { system %{open #{TRANSFER_LOG}} }
|
@log.connect(SIGNAL :triggered) { @fileview.show }
|
||||||
|
|
||||||
quit = Qt::Action.new("Quit", @menu)
|
quit = Qt::Action.new("Quit", @menu)
|
||||||
quit.connect(SIGNAL :triggered) { @exiting = true }
|
quit.connect(SIGNAL :triggered) { @exiting = true }
|
||||||
@ -185,7 +193,6 @@ class UnisonWatcher < Qt::Application
|
|||||||
end
|
end
|
||||||
|
|
||||||
def ui
|
def ui
|
||||||
|
|
||||||
@icon = Qt::SystemTrayIcon.new
|
@icon = Qt::SystemTrayIcon.new
|
||||||
@icon.contextMenu = menu
|
@icon.contextMenu = menu
|
||||||
|
|
||||||
@ -232,7 +239,13 @@ class UnisonWatcher < Qt::Application
|
|||||||
index = 0
|
index = 0
|
||||||
while !@done
|
while !@done
|
||||||
@current_icon = "working-#{index + 1}"
|
@current_icon = "working-#{index + 1}"
|
||||||
|
File.open(File.expand_path(TRANSFER_LOG), 'r') { |fh|
|
||||||
|
fh.seek(@current_log_size)
|
||||||
|
@fileview.plainText = fh.read
|
||||||
|
}
|
||||||
|
|
||||||
update_ui
|
update_ui
|
||||||
|
|
||||||
break if @done
|
break if @done
|
||||||
|
|
||||||
sleep 0.25
|
sleep 0.25
|
||||||
@ -244,6 +257,11 @@ class UnisonWatcher < Qt::Application
|
|||||||
@remote_sync_check = SYNC_CHECK_COUNT
|
@remote_sync_check = SYNC_CHECK_COUNT
|
||||||
@sync_now = false
|
@sync_now = false
|
||||||
@queue.update { [] }
|
@queue.update { [] }
|
||||||
|
|
||||||
|
File.open(File.expand_path(TRANSFER_LOG), 'r') { |fh|
|
||||||
|
fh.seek(@current_log_size)
|
||||||
|
@fileview.plainText = fh.read
|
||||||
|
}
|
||||||
end
|
end
|
||||||
rescue => e
|
rescue => e
|
||||||
puts e.message
|
puts e.message
|
||||||
|
Loading…
Reference in New Issue
Block a user