{"action":"created","comment":{"url":"https://api.github.com/repos/Cockatrice/Cockatrice/pulls/comments/34079356","id":34079356,"diff_hunk":"@@ -529,3 +544,203 @@ bool SaveSetsPage::validatePage()\n \n     return true;\n }\n+\n+LoadTokensPage::LoadTokensPage(QWidget *parent)\n+    : OracleWizardPage(parent), nam(0)\n+{\n+    urlLabel = new QLabel(this);\n+    urlLineEdit = new QLineEdit(this);\n+\n+    progressLabel = new QLabel(this);\n+    progressBar = new QProgressBar(this);\n+\n+    urlButton = new QPushButton(this);\n+    connect(urlButton, SIGNAL(clicked()), this, SLOT(actRestoreDefaultUrl()));\n+\n+    QGridLayout *layout = new QGridLayout(this);\n+    layout->addWidget(urlLabel, 0, 0);\n+    layout->addWidget(urlLineEdit, 0, 1);\n+    layout->addWidget(urlButton, 1, 1, Qt::AlignRight);\n+    layout->addWidget(progressLabel, 2, 0);\n+    layout->addWidget(progressBar, 2, 1);\n+\n+    setLayout(layout);\n+}\n+\n+void LoadTokensPage::initializePage()\n+{\n+    urlLineEdit->setText(wizard()->settings->value(\"tokensurl\", TOKENS_URL).toString());\n+\n+    progressLabel->hide();\n+    progressBar->hide();\n+}\n+\n+void LoadTokensPage::retranslateUi()\n+{\n+    setTitle(tr(\"Tokens source selection\"));\n+    setSubTitle(tr(\"Please specify a source for the list of tokens. \"\n+                   \"You can specify an url address that will be download or \"\n+                   \"use an existing file from your computer.\"));\n+\n+    urlLabel->setText(tr(\"Download url:\"));\n+    urlButton->setText(tr(\"Restore default url\"));\n+}\n+\n+void LoadTokensPage::actRestoreDefaultUrl()\n+{\n+    urlLineEdit->setText(TOKENS_URL);\n+}\n+\n+bool LoadTokensPage::validatePage()\n+{\n+    // once the import is finished, we call next(); skip validation\n+    if(wizard()->hasTokensData())\n+        return true;\n+\n+    QUrl url = QUrl::fromUserInput(urlLineEdit->text());\n+    if(!url.isValid())\n+    {\n+        QMessageBox::critical(this, tr(\"Error\"), tr(\"The provided url is not valid.\"));\n+        return false;\n+    }\n+\n+    progressLabel->setText(tr(\"Downloading (0MB)\"));\n+    // show an infinite progressbar\n+    progressBar->setMaximum(0);\n+    progressBar->setMinimum(0);\n+    progressBar->setValue(0);\n+    progressLabel->show();\n+    progressBar->show();\n+\n+    wizard()->disableButtons();\n+    setEnabled(false);\n+\n+    if(!nam)\n+        nam = new QNetworkAccessManager(this);\n+    QNetworkReply *reply = nam->get(QNetworkRequest(url));\n+\n+    connect(reply, SIGNAL(finished()), this, SLOT(actDownloadFinishedTokensFile()));\n+    connect(reply, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(actDownloadProgressTokensFile(qint64, qint64)));\n+\n+    return false;\n+}\n+\n+void LoadTokensPage::actDownloadProgressTokensFile(qint64 received, qint64 total)\n+{\n+    if(total > 0)\n+    {\n+        progressBar->setMaximum(total);\n+        progressBar->setValue(received);\n+    }\n+    progressLabel->setText(tr(\"Downloading (%1MB)\").arg((int) received / 1048576));","path":"oracle/src/oraclewizard.cpp","position":128,"original_position":128,"commit_id":"24aabc4cfeac45a6912c6d5ee0fc5019d7e53ae6","original_commit_id":"24aabc4cfeac45a6912c6d5ee0fc5019d7e53ae6","user":{"login":"Daenyth","id":14644,"avatar_url":"https://avatars.githubusercontent.com/u/14644?v=3","gravatar_id":"","url":"https://api.github.com/users/Daenyth","html_url":"https://github.com/Daenyth","followers_url":"https://api.github.com/users/Daenyth/followers","following_url":"https://api.github.com/users/Daenyth/following{/other_user}","gists_url":"https://api.github.com/users/Daenyth/gists{/gist_id}","starred_url":"https://api.github.com/users/Daenyth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Daenyth/subscriptions","organizations_url":"https://api.github.com/users/Daenyth/orgs","repos_url":"https://api.github.com/users/Daenyth/repos","events_url":"https://api.github.com/users/Daenyth/events{/privacy}","received_events_url":"https://api.github.com/users/Daenyth/received_events","type":"User","site_admin":false},"body":"What's the hardcoded number here?","created_at":"2015-07-07T19:21:54Z","updated_at":"2015-07-07T19:21:54Z","html_url":"https://github.com/Cockatrice/Cockatrice/pull/1227#discussion_r34079356","pull_request_url":"https://api.github.com/repos/Cockatrice/Cockatrice/pulls/1227","_links":{"self":{"href":"https://api.github.com/repos/Cockatrice/Cockatrice/pulls/comments/34079356"},"html":{"href":"https://github.com/Cockatrice/Cockatrice/pull/1227#discussion_r34079356"},"pull_request":{"href":"https://api.github.com/repos/Cockatrice/Cockatrice/pulls/1227"}}},"pull_request":{"url":"https://api.github.com/repos/Cockatrice/Cockatrice/pulls/1227","id":39399361,"html_url":"https://github.com/Cockatrice/Cockatrice/pull/1227","diff_url":"https://github.com/Cockatrice/Cockatrice/pull/1227.diff","patch_url":"https://github.com/Cockatrice/Cockatrice/pull/1227.patch","issue_url":"https://api.github.com/repos/Cockatrice/Cockatrice/issues/1227","number":1227,"state":"open","locked":false,"title":"Oracle: download tokens; fix #915","user":{"login":"ctrlaltca","id":1631111,"avatar_url":"https://avatars.githubusercontent.com/u/1631111?v=3","gravatar_id":"","url":"https://api.github.com/users/ctrlaltca","html_url":"https://github.com/ctrlaltca","followers_url":"https://api.github.com/users/ctrlaltca/followers","following_url":"https://api.github.com/users/ctrlaltca/following{/other_user}","gists_url":"https://api.github.com/users/ctrlaltca/gists{/gist_id}","starred_url":"https://api.github.com/users/ctrlaltca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ctrlaltca/subscriptions","organizations_url":"https://api.github.com/users/ctrlaltca/orgs","repos_url":"https://api.github.com/users/ctrlaltca/repos","events_url":"https://api.github.com/users/ctrlaltca/events{/privacy}","received_events_url":"https://api.github.com/users/ctrlaltca/received_events","type":"User","site_admin":false},"body":"After downloading cards and saving them, oracle will now download @Psithief 's token database and save it, too.\r\nI suggest (if Psithief agrees to this change):\r\n 1. creating a new \"tokens\" repo inside the cockatrice org;\r\n 2. give Psithief commit access to it;\r\n 3. change the default url from his own repo to cockatrice's repo.","created_at":"2015-07-07T18:08:58Z","updated_at":"2015-07-07T19:21:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1fad9a62f07f56f0d4aec4f07c7bd7aebaa75993","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Cockatrice/Cockatrice/pulls/1227/commits","review_comments_url":"https://api.github.com/repos/Cockatrice/Cockatrice/pulls/1227/comments","review_comment_url":"https://api.github.com/repos/Cockatrice/Cockatrice/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Cockatrice/Cockatrice/issues/1227/comments","statuses_url":"https://api.github.com/repos/Cockatrice/Cockatrice/statuses/24aabc4cfeac45a6912c6d5ee0fc5019d7e53ae6","head":{"label":"ctrlaltca:oracle_tokens","ref":"oracle_tokens","sha":"24aabc4cfeac45a6912c6d5ee0fc5019d7e53ae6","user":{"login":"ctrlaltca","id":1631111,"avatar_url":"https://avatars.githubusercontent.com/u/1631111?v=3","gravatar_id":"","url":"https://api.github.com/users/ctrlaltca","html_url":"https://github.com/ctrlaltca","followers_url":"https://api.github.com/users/ctrlaltca/followers","following_url":"https://api.github.com/users/ctrlaltca/following{/other_user}","gists_url":"https://api.github.com/users/ctrlaltca/gists{/gist_id}","starred_url":"https://api.github.com/users/ctrlaltca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ctrlaltca/subscriptions","organizations_url":"https://api.github.com/users/ctrlaltca/orgs","repos_url":"https://api.github.com/users/ctrlaltca/repos","events_url":"https://api.github.com/users/ctrlaltca/events{/privacy}","received_events_url":"https://api.github.com/users/ctrlaltca/received_events","type":"User","site_admin":false},"repo":{"id":20678592,"name":"Cockatrice","full_name":"ctrlaltca/Cockatrice","owner":{"login":"ctrlaltca","id":1631111,"avatar_url":"https://avatars.githubusercontent.com/u/1631111?v=3","gravatar_id":"","url":"https://api.github.com/users/ctrlaltca","html_url":"https://github.com/ctrlaltca","followers_url":"https://api.github.com/users/ctrlaltca/followers","following_url":"https://api.github.com/users/ctrlaltca/following{/other_user}","gists_url":"https://api.github.com/users/ctrlaltca/gists{/gist_id}","starred_url":"https://api.github.com/users/ctrlaltca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ctrlaltca/subscriptions","organizations_url":"https://api.github.com/users/ctrlaltca/orgs","repos_url":"https://api.github.com/users/ctrlaltca/repos","events_url":"https://api.github.com/users/ctrlaltca/events{/privacy}","received_events_url":"https://api.github.com/users/ctrlaltca/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ctrlaltca/Cockatrice","description":"A cross-platform virtual tabletop for multiplayer card games","fork":true,"url":"https://api.github.com/repos/ctrlaltca/Cockatrice","forks_url":"https://api.github.com/repos/ctrlaltca/Cockatrice/forks","keys_url":"https://api.github.com/repos/ctrlaltca/Cockatrice/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ctrlaltca/Cockatrice/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ctrlaltca/Cockatrice/teams","hooks_url":"https://api.github.com/repos/ctrlaltca/Cockatrice/hooks","issue_events_url":"https://api.github.com/repos/ctrlaltca/Cockatrice/issues/events{/number}","events_url":"https://api.github.com/repos/ctrlaltca/Cockatrice/events","assignees_url":"https://api.github.com/repos/ctrlaltca/Cockatrice/assignees{/user}","branches_url":"https://api.github.com/repos/ctrlaltca/Cockatrice/branches{/branch}","tags_url":"https://api.github.com/repos/ctrlaltca/Cockatrice/tags","blobs_url":"https://api.github.com/repos/ctrlaltca/Cockatrice/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ctrlaltca/Cockatrice/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ctrlaltca/Cockatrice/git/refs{/sha}","trees_url":"https://api.github.com/repos/ctrlaltca/Cockatrice/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ctrlaltca/Cockatrice/statuses/{sha}","languages_url":"https://api.github.com/repos/ctrlaltca/Cockatrice/languages","stargazers_url":"https://api.github.com/repos/ctrlaltca/Cockatrice/stargazers","contributors_url":"https://api.github.com/repos/ctrlaltca/Cockatrice/contributors","subscribers_url":"https://api.github.com/repos/ctrlaltca/Cockatrice/subscribers","subscription_url":"https://api.github.com/repos/ctrlaltca/Cockatrice/subscription","commits_url":"https://api.github.com/repos/ctrlaltca/Cockatrice/commits{/sha}","git_commits_url":"https://api.github.com/repos/ctrlaltca/Cockatrice/git/commits{/sha}","comments_url":"https://api.github.com/repos/ctrlaltca/Cockatrice/comments{/number}","issue_comment_url":"https://api.github.com/repos/ctrlaltca/Cockatrice/issues/comments{/number}","contents_url":"https://api.github.com/repos/ctrlaltca/Cockatrice/contents/{+path}","compare_url":"https://api.github.com/repos/ctrlaltca/Cockatrice/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ctrlaltca/Cockatrice/merges","archive_url":"https://api.github.com/repos/ctrlaltca/Cockatrice/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ctrlaltca/Cockatrice/downloads","issues_url":"https://api.github.com/repos/ctrlaltca/Cockatrice/issues{/number}","pulls_url":"https://api.github.com/repos/ctrlaltca/Cockatrice/pulls{/number}","milestones_url":"https://api.github.com/repos/ctrlaltca/Cockatrice/milestones{/number}","notifications_url":"https://api.github.com/repos/ctrlaltca/Cockatrice/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ctrlaltca/Cockatrice/labels{/name}","releases_url":"https://api.github.com/repos/ctrlaltca/Cockatrice/releases{/id}","created_at":"2014-06-10T08:50:45Z","updated_at":"2015-05-07T06:58:21Z","pushed_at":"2015-07-07T18:06:10Z","git_url":"git://github.com/ctrlaltca/Cockatrice.git","ssh_url":"git@github.com:ctrlaltca/Cockatrice.git","clone_url":"https://github.com/ctrlaltca/Cockatrice.git","svn_url":"https://github.com/ctrlaltca/Cockatrice","homepage":"","size":30773,"stargazers_count":1,"watchers_count":1,"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":1,"default_branch":"master"}},"base":{"label":"Cockatrice:master","ref":"master","sha":"db604bce03e2dfdc301680aa33de25b7d3fa5d13","user":{"login":"Cockatrice","id":9746249,"avatar_url":"https://avatars.githubusercontent.com/u/9746249?v=3","gravatar_id":"","url":"https://api.github.com/users/Cockatrice","html_url":"https://github.com/Cockatrice","followers_url":"https://api.github.com/users/Cockatrice/followers","following_url":"https://api.github.com/users/Cockatrice/following{/other_user}","gists_url":"https://api.github.com/users/Cockatrice/gists{/gist_id}","starred_url":"https://api.github.com/users/Cockatrice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Cockatrice/subscriptions","organizations_url":"https://api.github.com/users/Cockatrice/orgs","repos_url":"https://api.github.com/users/Cockatrice/repos","events_url":"https://api.github.com/users/Cockatrice/events{/privacy}","received_events_url":"https://api.github.com/users/Cockatrice/received_events","type":"Organization","site_admin":false},"repo":{"id":2907031,"name":"Cockatrice","full_name":"Cockatrice/Cockatrice","owner":{"login":"Cockatrice","id":9746249,"avatar_url":"https://avatars.githubusercontent.com/u/9746249?v=3","gravatar_id":"","url":"https://api.github.com/users/Cockatrice","html_url":"https://github.com/Cockatrice","followers_url":"https://api.github.com/users/Cockatrice/followers","following_url":"https://api.github.com/users/Cockatrice/following{/other_user}","gists_url":"https://api.github.com/users/Cockatrice/gists{/gist_id}","starred_url":"https://api.github.com/users/Cockatrice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Cockatrice/subscriptions","organizations_url":"https://api.github.com/users/Cockatrice/orgs","repos_url":"https://api.github.com/users/Cockatrice/repos","events_url":"https://api.github.com/users/Cockatrice/events{/privacy}","received_events_url":"https://api.github.com/users/Cockatrice/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Cockatrice/Cockatrice","description":"A cross-platform virtual tabletop for multiplayer card games","fork":false,"url":"https://api.github.com/repos/Cockatrice/Cockatrice","forks_url":"https://api.github.com/repos/Cockatrice/Cockatrice/forks","keys_url":"https://api.github.com/repos/Cockatrice/Cockatrice/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Cockatrice/Cockatrice/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Cockatrice/Cockatrice/teams","hooks_url":"https://api.github.com/repos/Cockatrice/Cockatrice/hooks","issue_events_url":"https://api.github.com/repos/Cockatrice/Cockatrice/issues/events{/number}","events_url":"https://api.github.com/repos/Cockatrice/Cockatrice/events","assignees_url":"https://api.github.com/repos/Cockatrice/Cockatrice/assignees{/user}","branches_url":"https://api.github.com/repos/Cockatrice/Cockatrice/branches{/branch}","tags_url":"https://api.github.com/repos/Cockatrice/Cockatrice/tags","blobs_url":"https://api.github.com/repos/Cockatrice/Cockatrice/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Cockatrice/Cockatrice/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Cockatrice/Cockatrice/git/refs{/sha}","trees_url":"https://api.github.com/repos/Cockatrice/Cockatrice/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Cockatrice/Cockatrice/statuses/{sha}","languages_url":"https://api.github.com/repos/Cockatrice/Cockatrice/languages","stargazers_url":"https://api.github.com/repos/Cockatrice/Cockatrice/stargazers","contributors_url":"https://api.github.com/repos/Cockatrice/Cockatrice/contributors","subscribers_url":"https://api.github.com/repos/Cockatrice/Cockatrice/subscribers","subscription_url":"https://api.github.com/repos/Cockatrice/Cockatrice/subscription","commits_url":"https://api.github.com/repos/Cockatrice/Cockatrice/commits{/sha}","git_commits_url":"https://api.github.com/repos/Cockatrice/Cockatrice/git/commits{/sha}","comments_url":"https://api.github.com/repos/Cockatrice/Cockatrice/comments{/number}","issue_comment_url":"https://api.github.com/repos/Cockatrice/Cockatrice/issues/comments{/number}","contents_url":"https://api.github.com/repos/Cockatrice/Cockatrice/contents/{+path}","compare_url":"https://api.github.com/repos/Cockatrice/Cockatrice/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Cockatrice/Cockatrice/merges","archive_url":"https://api.github.com/repos/Cockatrice/Cockatrice/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Cockatrice/Cockatrice/downloads","issues_url":"https://api.github.com/repos/Cockatrice/Cockatrice/issues{/number}","pulls_url":"https://api.github.com/repos/Cockatrice/Cockatrice/pulls{/number}","milestones_url":"https://api.github.com/repos/Cockatrice/Cockatrice/milestones{/number}","notifications_url":"https://api.github.com/repos/Cockatrice/Cockatrice/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Cockatrice/Cockatrice/labels{/name}","releases_url":"https://api.github.com/repos/Cockatrice/Cockatrice/releases{/id}","created_at":"2011-12-03T20:58:09Z","updated_at":"2015-07-04T05:11:28Z","pushed_at":"2015-07-07T19:01:56Z","git_url":"git://github.com/Cockatrice/Cockatrice.git","ssh_url":"git@github.com:Cockatrice/Cockatrice.git","clone_url":"https://github.com/Cockatrice/Cockatrice.git","svn_url":"https://github.com/Cockatrice/Cockatrice","homepage":"","size":39437,"stargazers_count":275,"watchers_count":275,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":178,"mirror_url":null,"open_issues_count":224,"forks":178,"open_issues":224,"watchers":275,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Cockatrice/Cockatrice/pulls/1227"},"html":{"href":"https://github.com/Cockatrice/Cockatrice/pull/1227"},"issue":{"href":"https://api.github.com/repos/Cockatrice/Cockatrice/issues/1227"},"comments":{"href":"https://api.github.com/repos/Cockatrice/Cockatrice/issues/1227/comments"},"review_comments":{"href":"https://api.github.com/repos/Cockatrice/Cockatrice/pulls/1227/comments"},"review_comment":{"href":"https://api.github.com/repos/Cockatrice/Cockatrice/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Cockatrice/Cockatrice/pulls/1227/commits"},"statuses":{"href":"https://api.github.com/repos/Cockatrice/Cockatrice/statuses/24aabc4cfeac45a6912c6d5ee0fc5019d7e53ae6"}}}}