Skip to content

Commit

Permalink
autosave config & fix a regression
Browse files Browse the repository at this point in the history
  • Loading branch information
marguerite committed Nov 18, 2014
1 parent e0d827c commit c16157e
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 3 deletions.
4 changes: 2 additions & 2 deletions BiliConfig.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ def initialize(name="biligui.conf", path=$configPath)

end

def write(key, value)
def put(key, value)

# if Key exists, then we should delete
if @configEntries.key?(key) then

billMove(@config,"! line.index(key)")
biliMove(@config,"! line.index('" + key + "')")

end

Expand Down
2 changes: 2 additions & 0 deletions BiliFile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ def biliMove(file, newfile=file, condition)

tmp = file + ".tmp"

p condition

open(file, 'r') do |f0|
open(tmp, 'w') do |f1|
f0.each_line do |line|
Expand Down
9 changes: 9 additions & 0 deletions BiliWidgets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class BiliGui < Qt::MainWindow

slots 'clear()'
slots 'bilidanChoose()'
slots 'bilidanAutoSave()'
slots 'bilidanPlay()'
slots 'bilidanLogOut()'
slots 'bilidanLogErr()'
Expand Down Expand Up @@ -131,6 +132,7 @@ def init_ui
grid_Settings.addWidget bilidanButton, 0, 2, 1, 1
grid_Settings.setColumnStretch 0, 0

connect @bilidanPath, SIGNAL('textChanged(const QString)'), self, SLOT('bilidanAutoSave()')
connect bilidanButton, SIGNAL('clicked()'), self, SLOT('bilidanChoose()')

# player thread
Expand Down Expand Up @@ -212,6 +214,13 @@ def bilidanChoose
end
end

def bilidanAutoSave

p @bilidanPath.text
@@configw.put("BilidanPath", @bilidanPath.text)

end

def biliWeb

@biliweb = Qt::WebView.new
Expand Down
3 changes: 3 additions & 0 deletions doc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
0.0.10
* autosave bilidan path in input area
* regression: can not set biligui config
0.0.9
* make it themeable (external stylesheet .qss)
* clean module usage, don't need to create wrapper classes
Expand Down
1 change: 0 additions & 1 deletion doc/TODO
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* play history
* query url to get title & author
* BiliDaemon.rb to run background tasks
** autosave config
* Playlist merge
** find all saved playlists
** merge into a temp big one
Expand Down

0 comments on commit c16157e

Please sign in to comment.