gustavo-iniguez-goya / opensnitch

OpenSnitch is a GNU/Linux application firewall
GNU General Public License v3.0
397 stars 20 forks source link

Fixes for the General tab #95

Closed themighty1 closed 3 years ago

themighty1 commented 4 years ago

Fixes the following things in the General tab:

This does not fix the currently observed erratic behaviour of the scrollbar when scrolling to the bottom of the view.

gustavo-iniguez-goya commented 4 years ago

ok, this is good. When using the up and down keys works perfect, but when using the mouse to scroll up and down it behaves a little bit weird. It goes back constantly to the last selected row, which is correct, but it's a bit annoying. There should be a way to unselect the row so the original behavior is restored.

Maybe we could add a contextual menu when clicking on a row with the text "monitor" or "follow". Or add a button like wireshark has image to "lock" the view or move freely.

All in all I like how the viewport is locked to a list of rows.

Regarding #model.rowCount() returns a maximum of 256, probably a qt bug, using a workaround:, you can check if there're more rows to fetch:

if view.model().canFetchMore():
    view.model().fetchMore()
themighty1 commented 4 years ago

Thanks for the input.

while view.model().canFetchMore():
     view.model().fetchMore() 

did the trick. I can fill the whole view with the data, so that when I scrolled to the bottom of the view, there's no more scrollbar jumping.

However ~ every 1 minute we need to make an extra fetchMore() call because the db grows. An extra fetchMore() call takes 0.5 ms. After 24 hours of running we'll have ~1 sec delay in refreshing the view. This is not sustainable.

The problem with QSqlQueryModel is that there is no way to cache the previous query's result and only add new data to the model. Each time there is new data in the db, we have to perform a full-blown query with fetchMore().

Unless there is something that I have overlooked with QSqlQueryModel, I could implement a custom QStandardItemModel which internally uses QSqlQuery to get the most recent 256 entries (no need to fetchMore()) and adds the new entries to the model.

gustavo-iniguez-goya commented 4 years ago

Unless there is something that I have overlooked with QSqlQueryModel, I could implement a custom QStandardItemModel which internally uses QSqlQuery to get the most recent 256 entries (no need to fetchMore()) and adds the new entries to the model.

ok, that's fine for me.

themighty1 commented 3 years ago

Closing this in favor of https://github.com/evilsocket/opensnitch/pull/306