{"action":"created","comment":{"url":"https://api.github.com/repos/qbittorrent/qBittorrent/pulls/comments/54870727","id":54870727,"diff_hunk":"@@ -71,62 +75,94 @@ SpeedPlotView::SpeedPlotView(QWidget *parent)\n void SpeedPlotView::setGraphEnable(GraphID id, bool enable)\n {\n     m_properties[id].m_enable = enable;\n+    this->viewport()->update();\n }\n \n-void SpeedPlotView::pushXPoint(double x)\n+void SpeedPlotView::pushPoint(SpeedPlotView::PointData point)\n {\n-    while (m_xData.size() >= m_maxCapacity)\n-        m_xData.pop_front();\n+    m_counter30Min = (m_counter30Min + 1) % 3;\n+    m_counter6Hour = (m_counter6Hour + 1) % 6;\n \n-    m_xData.append(x);\n-}\n+    m_data5Min.push_back(point);\n \n-void SpeedPlotView::pushYPoint(GraphID id, double y)\n-{\n-    while (m_yData[id].size() >= m_maxCapacity)\n-        m_yData[id].pop_front();\n+    if (m_counter30Min == 0) {\n+        m_data30Min.push_back(point);\n+    }\n+    else {\n+        m_data30Min.back().x = (m_data30Min.back().x * m_counter30Min + point.x) / (m_counter30Min + 1);\n+        for (int id = UP; id < NB_GRAPHS; ++id) {\n+            m_data30Min.back().y[id] = (m_data30Min.back().y[id] * m_counter30Min + point.y[id]) / (m_counter30Min + 1);\n+        }\n+    }\n \n-    m_yData[id].append(y);\n+    if (m_counter6Hour == 0) {\n+        m_data6Hour.push_back(point);\n+    }\n+    else {\n+        m_data6Hour.back().x = (m_data6Hour.back().x * m_counter6Hour + point.x) / (m_counter6Hour + 1);\n+        for (int id = UP; id < NB_GRAPHS; ++id) {\n+            m_data6Hour.back().y[id] = (m_data6Hour.back().y[id] * m_counter6Hour + point.y[id]) / (m_counter6Hour + 1);\n+        }\n+    }\n }\n \n void SpeedPlotView::setViewableLastPoints(TimePeriod period)\n {\n+    m_period = period;\n+\n     switch (period) {\n     case SpeedPlotView::MIN1:\n-        m_viewablePointsCount = SpeedPlotView::MIN1_SEC;\n+        m_viewablePointsCount = MIN1_SEC;\n         break;\n     case SpeedPlotView::MIN5:\n-        m_viewablePointsCount = SpeedPlotView::MIN5_SEC;\n+        m_viewablePointsCount = MIN5_SEC;\n         break;\n     case SpeedPlotView::MIN30:\n-        m_viewablePointsCount = SpeedPlotView::MIN30_SEC;\n+        m_viewablePointsCount = MIN30_BUF_SIZE;\n         break;\n     case SpeedPlotView::HOUR6:\n-        m_viewablePointsCount = SpeedPlotView::HOUR6_SEC;\n-        break;\n-    default:\n+        m_viewablePointsCount = HOUR6_BUF_SIZE;\n         break;\n     }\n+\n+    this->viewport()->update();\n }\n \n void SpeedPlotView::replot()\n {\n-    this->viewport()->update();\n+    if (m_period == MIN1 || m_period == MIN5 ||\n+            (m_period == MIN30 && m_counter30Min == 2) ||\n+            (m_period == HOUR6 && m_counter6Hour == 5))\n+        this->viewport()->update();","path":"src/gui/properties/speedplotview.cpp","position":93,"original_position":93,"commit_id":"515090bf04e10ebe71c3356874aaf214ea00911d","original_commit_id":"515090bf04e10ebe71c3356874aaf214ea00911d","user":{"login":"glassez","id":5063477,"avatar_url":"https://avatars.githubusercontent.com/u/5063477?v=3","gravatar_id":"","url":"https://api.github.com/users/glassez","html_url":"https://github.com/glassez","followers_url":"https://api.github.com/users/glassez/followers","following_url":"https://api.github.com/users/glassez/following{/other_user}","gists_url":"https://api.github.com/users/glassez/gists{/gist_id}","starred_url":"https://api.github.com/users/glassez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glassez/subscriptions","organizations_url":"https://api.github.com/users/glassez/orgs","repos_url":"https://api.github.com/users/glassez/repos","events_url":"https://api.github.com/users/glassez/events{/privacy}","received_events_url":"https://api.github.com/users/glassez/received_events","type":"User","site_admin":false},"body":"`this`?","created_at":"2016-03-03T12:01:29Z","updated_at":"2016-03-03T12:01:29Z","html_url":"https://github.com/qbittorrent/qBittorrent/pull/4261#discussion_r54870727","pull_request_url":"https://api.github.com/repos/qbittorrent/qBittorrent/pulls/4261","_links":{"self":{"href":"https://api.github.com/repos/qbittorrent/qBittorrent/pulls/comments/54870727"},"html":{"href":"https://github.com/qbittorrent/qBittorrent/pull/4261#discussion_r54870727"},"pull_request":{"href":"https://api.github.com/repos/qbittorrent/qBittorrent/pulls/4261"}}},"pull_request":{"url":"https://api.github.com/repos/qbittorrent/qBittorrent/pulls/4261","id":52752883,"html_url":"https://github.com/qbittorrent/qBittorrent/pull/4261","diff_url":"https://github.com/qbittorrent/qBittorrent/pull/4261.diff","patch_url":"https://github.com/qbittorrent/qBittorrent/pull/4261.patch","issue_url":"https://api.github.com/repos/qbittorrent/qBittorrent/issues/4261","number":4261,"state":"open","locked":false,"title":"SpeedPlotView: speedup","user":{"login":"onto","id":768585,"avatar_url":"https://avatars.githubusercontent.com/u/768585?v=3","gravatar_id":"","url":"https://api.github.com/users/onto","html_url":"https://github.com/onto","followers_url":"https://api.github.com/users/onto/followers","following_url":"https://api.github.com/users/onto/following{/other_user}","gists_url":"https://api.github.com/users/onto/gists{/gist_id}","starred_url":"https://api.github.com/users/onto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/onto/subscriptions","organizations_url":"https://api.github.com/users/onto/orgs","repos_url":"https://api.github.com/users/onto/repos","events_url":"https://api.github.com/users/onto/events{/privacy}","received_events_url":"https://api.github.com/users/onto/received_events","type":"User","site_admin":false},"body":"Two changes:\r\n* Replace QQueue by boost::circular_buffer\r\n* Reduce number of points to draw (join points with equal Х coordinate)\r\n\r\nNeed testing.","created_at":"2015-12-05T11:12:46Z","updated_at":"2016-03-03T12:01:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3866134f2412b79932c0ded531270a839678edb4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/qbittorrent/qBittorrent/pulls/4261/commits","review_comments_url":"https://api.github.com/repos/qbittorrent/qBittorrent/pulls/4261/comments","review_comment_url":"https://api.github.com/repos/qbittorrent/qBittorrent/pulls/comments{/number}","comments_url":"https://api.github.com/repos/qbittorrent/qBittorrent/issues/4261/comments","statuses_url":"https://api.github.com/repos/qbittorrent/qBittorrent/statuses/515090bf04e10ebe71c3356874aaf214ea00911d","head":{"label":"onto:master","ref":"master","sha":"515090bf04e10ebe71c3356874aaf214ea00911d","user":{"login":"onto","id":768585,"avatar_url":"https://avatars.githubusercontent.com/u/768585?v=3","gravatar_id":"","url":"https://api.github.com/users/onto","html_url":"https://github.com/onto","followers_url":"https://api.github.com/users/onto/followers","following_url":"https://api.github.com/users/onto/following{/other_user}","gists_url":"https://api.github.com/users/onto/gists{/gist_id}","starred_url":"https://api.github.com/users/onto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/onto/subscriptions","organizations_url":"https://api.github.com/users/onto/orgs","repos_url":"https://api.github.com/users/onto/repos","events_url":"https://api.github.com/users/onto/events{/privacy}","received_events_url":"https://api.github.com/users/onto/received_events","type":"User","site_admin":false},"repo":{"id":30827211,"name":"qBittorrent","full_name":"onto/qBittorrent","owner":{"login":"onto","id":768585,"avatar_url":"https://avatars.githubusercontent.com/u/768585?v=3","gravatar_id":"","url":"https://api.github.com/users/onto","html_url":"https://github.com/onto","followers_url":"https://api.github.com/users/onto/followers","following_url":"https://api.github.com/users/onto/following{/other_user}","gists_url":"https://api.github.com/users/onto/gists{/gist_id}","starred_url":"https://api.github.com/users/onto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/onto/subscriptions","organizations_url":"https://api.github.com/users/onto/orgs","repos_url":"https://api.github.com/users/onto/repos","events_url":"https://api.github.com/users/onto/events{/privacy}","received_events_url":"https://api.github.com/users/onto/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/onto/qBittorrent","description":"qBittorrent BitTorrent client","fork":true,"url":"https://api.github.com/repos/onto/qBittorrent","forks_url":"https://api.github.com/repos/onto/qBittorrent/forks","keys_url":"https://api.github.com/repos/onto/qBittorrent/keys{/key_id}","collaborators_url":"https://api.github.com/repos/onto/qBittorrent/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/onto/qBittorrent/teams","hooks_url":"https://api.github.com/repos/onto/qBittorrent/hooks","issue_events_url":"https://api.github.com/repos/onto/qBittorrent/issues/events{/number}","events_url":"https://api.github.com/repos/onto/qBittorrent/events","assignees_url":"https://api.github.com/repos/onto/qBittorrent/assignees{/user}","branches_url":"https://api.github.com/repos/onto/qBittorrent/branches{/branch}","tags_url":"https://api.github.com/repos/onto/qBittorrent/tags","blobs_url":"https://api.github.com/repos/onto/qBittorrent/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/onto/qBittorrent/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/onto/qBittorrent/git/refs{/sha}","trees_url":"https://api.github.com/repos/onto/qBittorrent/git/trees{/sha}","statuses_url":"https://api.github.com/repos/onto/qBittorrent/statuses/{sha}","languages_url":"https://api.github.com/repos/onto/qBittorrent/languages","stargazers_url":"https://api.github.com/repos/onto/qBittorrent/stargazers","contributors_url":"https://api.github.com/repos/onto/qBittorrent/contributors","subscribers_url":"https://api.github.com/repos/onto/qBittorrent/subscribers","subscription_url":"https://api.github.com/repos/onto/qBittorrent/subscription","commits_url":"https://api.github.com/repos/onto/qBittorrent/commits{/sha}","git_commits_url":"https://api.github.com/repos/onto/qBittorrent/git/commits{/sha}","comments_url":"https://api.github.com/repos/onto/qBittorrent/comments{/number}","issue_comment_url":"https://api.github.com/repos/onto/qBittorrent/issues/comments{/number}","contents_url":"https://api.github.com/repos/onto/qBittorrent/contents/{+path}","compare_url":"https://api.github.com/repos/onto/qBittorrent/compare/{base}...{head}","merges_url":"https://api.github.com/repos/onto/qBittorrent/merges","archive_url":"https://api.github.com/repos/onto/qBittorrent/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/onto/qBittorrent/downloads","issues_url":"https://api.github.com/repos/onto/qBittorrent/issues{/number}","pulls_url":"https://api.github.com/repos/onto/qBittorrent/pulls{/number}","milestones_url":"https://api.github.com/repos/onto/qBittorrent/milestones{/number}","notifications_url":"https://api.github.com/repos/onto/qBittorrent/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/onto/qBittorrent/labels{/name}","releases_url":"https://api.github.com/repos/onto/qBittorrent/releases{/id}","deployments_url":"https://api.github.com/repos/onto/qBittorrent/deployments","created_at":"2015-02-15T12:46:16Z","updated_at":"2016-01-17T17:11:14Z","pushed_at":"2016-02-27T10:24:45Z","git_url":"git://github.com/onto/qBittorrent.git","ssh_url":"git@github.com:onto/qBittorrent.git","clone_url":"https://github.com/onto/qBittorrent.git","svn_url":"https://github.com/onto/qBittorrent","homepage":"http://www.qbittorrent.org","size":117412,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"qbittorrent:master","ref":"master","sha":"654c8edc6b0183dfb6c2ded772b563820310e331","user":{"login":"qbittorrent","id":2131270,"avatar_url":"https://avatars.githubusercontent.com/u/2131270?v=3","gravatar_id":"","url":"https://api.github.com/users/qbittorrent","html_url":"https://github.com/qbittorrent","followers_url":"https://api.github.com/users/qbittorrent/followers","following_url":"https://api.github.com/users/qbittorrent/following{/other_user}","gists_url":"https://api.github.com/users/qbittorrent/gists{/gist_id}","starred_url":"https://api.github.com/users/qbittorrent/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qbittorrent/subscriptions","organizations_url":"https://api.github.com/users/qbittorrent/orgs","repos_url":"https://api.github.com/users/qbittorrent/repos","events_url":"https://api.github.com/users/qbittorrent/events{/privacy}","received_events_url":"https://api.github.com/users/qbittorrent/received_events","type":"Organization","site_admin":false},"repo":{"id":3351871,"name":"qBittorrent","full_name":"qbittorrent/qBittorrent","owner":{"login":"qbittorrent","id":2131270,"avatar_url":"https://avatars.githubusercontent.com/u/2131270?v=3","gravatar_id":"","url":"https://api.github.com/users/qbittorrent","html_url":"https://github.com/qbittorrent","followers_url":"https://api.github.com/users/qbittorrent/followers","following_url":"https://api.github.com/users/qbittorrent/following{/other_user}","gists_url":"https://api.github.com/users/qbittorrent/gists{/gist_id}","starred_url":"https://api.github.com/users/qbittorrent/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qbittorrent/subscriptions","organizations_url":"https://api.github.com/users/qbittorrent/orgs","repos_url":"https://api.github.com/users/qbittorrent/repos","events_url":"https://api.github.com/users/qbittorrent/events{/privacy}","received_events_url":"https://api.github.com/users/qbittorrent/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/qbittorrent/qBittorrent","description":"qBittorrent BitTorrent client","fork":false,"url":"https://api.github.com/repos/qbittorrent/qBittorrent","forks_url":"https://api.github.com/repos/qbittorrent/qBittorrent/forks","keys_url":"https://api.github.com/repos/qbittorrent/qBittorrent/keys{/key_id}","collaborators_url":"https://api.github.com/repos/qbittorrent/qBittorrent/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/qbittorrent/qBittorrent/teams","hooks_url":"https://api.github.com/repos/qbittorrent/qBittorrent/hooks","issue_events_url":"https://api.github.com/repos/qbittorrent/qBittorrent/issues/events{/number}","events_url":"https://api.github.com/repos/qbittorrent/qBittorrent/events","assignees_url":"https://api.github.com/repos/qbittorrent/qBittorrent/assignees{/user}","branches_url":"https://api.github.com/repos/qbittorrent/qBittorrent/branches{/branch}","tags_url":"https://api.github.com/repos/qbittorrent/qBittorrent/tags","blobs_url":"https://api.github.com/repos/qbittorrent/qBittorrent/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/qbittorrent/qBittorrent/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/qbittorrent/qBittorrent/git/refs{/sha}","trees_url":"https://api.github.com/repos/qbittorrent/qBittorrent/git/trees{/sha}","statuses_url":"https://api.github.com/repos/qbittorrent/qBittorrent/statuses/{sha}","languages_url":"https://api.github.com/repos/qbittorrent/qBittorrent/languages","stargazers_url":"https://api.github.com/repos/qbittorrent/qBittorrent/stargazers","contributors_url":"https://api.github.com/repos/qbittorrent/qBittorrent/contributors","subscribers_url":"https://api.github.com/repos/qbittorrent/qBittorrent/subscribers","subscription_url":"https://api.github.com/repos/qbittorrent/qBittorrent/subscription","commits_url":"https://api.github.com/repos/qbittorrent/qBittorrent/commits{/sha}","git_commits_url":"https://api.github.com/repos/qbittorrent/qBittorrent/git/commits{/sha}","comments_url":"https://api.github.com/repos/qbittorrent/qBittorrent/comments{/number}","issue_comment_url":"https://api.github.com/repos/qbittorrent/qBittorrent/issues/comments{/number}","contents_url":"https://api.github.com/repos/qbittorrent/qBittorrent/contents/{+path}","compare_url":"https://api.github.com/repos/qbittorrent/qBittorrent/compare/{base}...{head}","merges_url":"https://api.github.com/repos/qbittorrent/qBittorrent/merges","archive_url":"https://api.github.com/repos/qbittorrent/qBittorrent/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/qbittorrent/qBittorrent/downloads","issues_url":"https://api.github.com/repos/qbittorrent/qBittorrent/issues{/number}","pulls_url":"https://api.github.com/repos/qbittorrent/qBittorrent/pulls{/number}","milestones_url":"https://api.github.com/repos/qbittorrent/qBittorrent/milestones{/number}","notifications_url":"https://api.github.com/repos/qbittorrent/qBittorrent/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/qbittorrent/qBittorrent/labels{/name}","releases_url":"https://api.github.com/repos/qbittorrent/qBittorrent/releases{/id}","deployments_url":"https://api.github.com/repos/qbittorrent/qBittorrent/deployments","created_at":"2012-02-04T09:37:46Z","updated_at":"2016-03-02T23:00:39Z","pushed_at":"2016-03-03T09:15:04Z","git_url":"git://github.com/qbittorrent/qBittorrent.git","ssh_url":"git@github.com:qbittorrent/qBittorrent.git","clone_url":"https://github.com/qbittorrent/qBittorrent.git","svn_url":"https://github.com/qbittorrent/qBittorrent","homepage":"http://www.qbittorrent.org","size":125512,"stargazers_count":1576,"watchers_count":1576,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":438,"mirror_url":null,"open_issues_count":1416,"forks":438,"open_issues":1416,"watchers":1576,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/qbittorrent/qBittorrent/pulls/4261"},"html":{"href":"https://github.com/qbittorrent/qBittorrent/pull/4261"},"issue":{"href":"https://api.github.com/repos/qbittorrent/qBittorrent/issues/4261"},"comments":{"href":"https://api.github.com/repos/qbittorrent/qBittorrent/issues/4261/comments"},"review_comments":{"href":"https://api.github.com/repos/qbittorrent/qBittorrent/pulls/4261/comments"},"review_comment":{"href":"https://api.github.com/repos/qbittorrent/qBittorrent/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/qbittorrent/qBittorrent/pulls/4261/commits"},"statuses":{"href":"https://api.github.com/repos/qbittorrent/qBittorrent/statuses/515090bf04e10ebe71c3356874aaf214ea00911d"}}}}