{"action":"created","comment":{"url":"https://api.github.com/repos/ivanershov51/homework/pulls/comments/27994594","id":27994594,"diff_hunk":"@@ -0,0 +1,142 @@\n+#include <QShortcut>\n+#include <QGridLayout>\n+#include \"main_window.h\"\n+\n+\n+MainWindow::MainWindow(QWidget *parent) :\n+    QMainWindow(parent),\n+    centralWidget(new QWidget(this)),\n+    display(new QLineEdit(centralWidget)),\n+    equalsButton(new QPushButton(\"=\", centralWidget)),\n+    dotButton(new QPushButton(\".\", centralWidget)),\n+    currentOperand(CurrentOperand::emptyFirst),\n+    firstOperand(0)\n+{\n+    setWindowTitle(\"Calculator\");\n+    setFixedSize(250, 260);\n+    centralWidget->resize(size());\n+    auto layout = new QGridLayout(centralWidget);\n+    layout->addWidget(display, 0, 0, 1, 4);\n+    QVector<QPushButton*> digitButtons(10);\n+    digitButtons[0] = new QPushButton(\"0\", centralWidget);\n+    for (int i = 1; i < digitButtons.size(); i++)\n+    {\n+        digitButtons[i] = new QPushButton(QString().setNum(i), centralWidget);\n+        layout->addWidget(digitButtons[i], (i + 2) / 3, (i - 1) % 3);\n+    }\n+    QVector<char> operationTexts({plus, minus, multiply, divide});\n+    for (int i = 0; i < operationTexts.size(); i++)\n+    {\n+        operationButtons << new QPushButton(QChar(operationTexts[i]), centralWidget);\n+        layout->addWidget(operationButtons[i], i + 1, 3);\n+    }\n+    layout->addWidget(dotButton, 4, 0);\n+    layout->addWidget(digitButtons[0], 4, 1);\n+    layout->addWidget(equalsButton, 4, 2);\n+\n+    display->setAlignment(Qt::AlignRight);\n+    display->setReadOnly(true);\n+    equalsButton->setEnabled(false);\n+    for(auto widget: centralWidget->findChildren<QWidget*>())\n+    {\n+        QFont font(\"Consolas\");\n+        font.setPointSize(14);\n+        widget->setFont(font);\n+        widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);\n+    }\n+    for(auto button: findChildren<QPushButton*>())\n+        button->setShortcut(button->text());\n+    equalsButton->setShortcut(QStringLiteral(\"Return\"));\n+    for(auto button: operationButtons)\n+        button->setEnabled(false);\n+\n+    auto digitMapper = connectButtons(digitButtons);\n+    connect(digitMapper, SIGNAL(mapped(QString)), this, SLOT(printDotOrDigitChangingWidgets(QString)));\n+    auto operationMapper = connectButtons(operationButtons);\n+    connect(operationMapper, SIGNAL(mapped(QString)), this, SLOT(processOperationPress(QString)));\n+    auto dotSlot = [this]() { dotButton->setEnabled(false); printDotOrDigitChangingWidgets(\".\"); };\n+    connect(dotButton, &QPushButton::clicked, dotSlot);\n+    connect(equalsButton, &QPushButton::clicked, this, &processEqualsPress);\n+}\n+\n+\n+inline QSignalMapper* MainWindow::connectButtons(const QVector<QPushButton*> &buttons)\n+{\n+    auto mapper = new QSignalMapper(centralWidget);\n+    for(auto button: buttons)","path":"semester_2/lab04/4_3/main_window.cpp","position":66,"original_position":66,"commit_id":"47765f00652dc7b9a963b77637c57604aeee8744","original_commit_id":"47765f00652dc7b9a963b77637c57604aeee8744","user":{"login":"jzuken","id":705678,"avatar_url":"https://avatars.githubusercontent.com/u/705678?v=3","gravatar_id":"","url":"https://api.github.com/users/jzuken","html_url":"https://github.com/jzuken","followers_url":"https://api.github.com/users/jzuken/followers","following_url":"https://api.github.com/users/jzuken/following{/other_user}","gists_url":"https://api.github.com/users/jzuken/gists{/gist_id}","starred_url":"https://api.github.com/users/jzuken/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jzuken/subscriptions","organizations_url":"https://api.github.com/users/jzuken/orgs","repos_url":"https://api.github.com/users/jzuken/repos","events_url":"https://api.github.com/users/jzuken/events{/privacy}","received_events_url":"https://api.github.com/users/jzuken/received_events","type":"User","site_admin":false},"body":"тут for, а ниже везде кутешный foreach, давайте уж как-нибудь единообразно итерироваться. for мне больше нравится","created_at":"2015-04-08T17:50:46Z","updated_at":"2015-04-08T17:50:46Z","html_url":"https://github.com/ivanershov51/homework/pull/12#discussion_r27994594","pull_request_url":"https://api.github.com/repos/ivanershov51/homework/pulls/12","_links":{"self":{"href":"https://api.github.com/repos/ivanershov51/homework/pulls/comments/27994594"},"html":{"href":"https://github.com/ivanershov51/homework/pull/12#discussion_r27994594"},"pull_request":{"href":"https://api.github.com/repos/ivanershov51/homework/pulls/12"}}},"pull_request":{"url":"https://api.github.com/repos/ivanershov51/homework/pulls/12","id":32455953,"html_url":"https://github.com/ivanershov51/homework/pull/12","diff_url":"https://github.com/ivanershov51/homework/pull/12.diff","patch_url":"https://github.com/ivanershov51/homework/pull/12.patch","issue_url":"https://api.github.com/repos/ivanershov51/homework/issues/12","number":12,"state":"open","locked":false,"title":"4.3","user":{"login":"ivanershov51","id":11010943,"avatar_url":"https://avatars.githubusercontent.com/u/11010943?v=3","gravatar_id":"","url":"https://api.github.com/users/ivanershov51","html_url":"https://github.com/ivanershov51","followers_url":"https://api.github.com/users/ivanershov51/followers","following_url":"https://api.github.com/users/ivanershov51/following{/other_user}","gists_url":"https://api.github.com/users/ivanershov51/gists{/gist_id}","starred_url":"https://api.github.com/users/ivanershov51/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ivanershov51/subscriptions","organizations_url":"https://api.github.com/users/ivanershov51/orgs","repos_url":"https://api.github.com/users/ivanershov51/repos","events_url":"https://api.github.com/users/ivanershov51/events{/privacy}","received_events_url":"https://api.github.com/users/ivanershov51/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-04-01T20:13:39Z","updated_at":"2015-04-08T17:50:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8d9ce2a0fb8fbbff59aad616860fc48fbdc73d38","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ivanershov51/homework/pulls/12/commits","review_comments_url":"https://api.github.com/repos/ivanershov51/homework/pulls/12/comments","review_comment_url":"https://api.github.com/repos/ivanershov51/homework/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ivanershov51/homework/issues/12/comments","statuses_url":"https://api.github.com/repos/ivanershov51/homework/statuses/47765f00652dc7b9a963b77637c57604aeee8744","head":{"label":"ivanershov51:4.3","ref":"4.3","sha":"47765f00652dc7b9a963b77637c57604aeee8744","user":{"login":"ivanershov51","id":11010943,"avatar_url":"https://avatars.githubusercontent.com/u/11010943?v=3","gravatar_id":"","url":"https://api.github.com/users/ivanershov51","html_url":"https://github.com/ivanershov51","followers_url":"https://api.github.com/users/ivanershov51/followers","following_url":"https://api.github.com/users/ivanershov51/following{/other_user}","gists_url":"https://api.github.com/users/ivanershov51/gists{/gist_id}","starred_url":"https://api.github.com/users/ivanershov51/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ivanershov51/subscriptions","organizations_url":"https://api.github.com/users/ivanershov51/orgs","repos_url":"https://api.github.com/users/ivanershov51/repos","events_url":"https://api.github.com/users/ivanershov51/events{/privacy}","received_events_url":"https://api.github.com/users/ivanershov51/received_events","type":"User","site_admin":false},"repo":{"id":30812735,"name":"homework","full_name":"ivanershov51/homework","owner":{"login":"ivanershov51","id":11010943,"avatar_url":"https://avatars.githubusercontent.com/u/11010943?v=3","gravatar_id":"","url":"https://api.github.com/users/ivanershov51","html_url":"https://github.com/ivanershov51","followers_url":"https://api.github.com/users/ivanershov51/followers","following_url":"https://api.github.com/users/ivanershov51/following{/other_user}","gists_url":"https://api.github.com/users/ivanershov51/gists{/gist_id}","starred_url":"https://api.github.com/users/ivanershov51/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ivanershov51/subscriptions","organizations_url":"https://api.github.com/users/ivanershov51/orgs","repos_url":"https://api.github.com/users/ivanershov51/repos","events_url":"https://api.github.com/users/ivanershov51/events{/privacy}","received_events_url":"https://api.github.com/users/ivanershov51/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ivanershov51/homework","description":"SPbSU homework. 2014 - ..","fork":false,"url":"https://api.github.com/repos/ivanershov51/homework","forks_url":"https://api.github.com/repos/ivanershov51/homework/forks","keys_url":"https://api.github.com/repos/ivanershov51/homework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ivanershov51/homework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ivanershov51/homework/teams","hooks_url":"https://api.github.com/repos/ivanershov51/homework/hooks","issue_events_url":"https://api.github.com/repos/ivanershov51/homework/issues/events{/number}","events_url":"https://api.github.com/repos/ivanershov51/homework/events","assignees_url":"https://api.github.com/repos/ivanershov51/homework/assignees{/user}","branches_url":"https://api.github.com/repos/ivanershov51/homework/branches{/branch}","tags_url":"https://api.github.com/repos/ivanershov51/homework/tags","blobs_url":"https://api.github.com/repos/ivanershov51/homework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ivanershov51/homework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ivanershov51/homework/git/refs{/sha}","trees_url":"https://api.github.com/repos/ivanershov51/homework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ivanershov51/homework/statuses/{sha}","languages_url":"https://api.github.com/repos/ivanershov51/homework/languages","stargazers_url":"https://api.github.com/repos/ivanershov51/homework/stargazers","contributors_url":"https://api.github.com/repos/ivanershov51/homework/contributors","subscribers_url":"https://api.github.com/repos/ivanershov51/homework/subscribers","subscription_url":"https://api.github.com/repos/ivanershov51/homework/subscription","commits_url":"https://api.github.com/repos/ivanershov51/homework/commits{/sha}","git_commits_url":"https://api.github.com/repos/ivanershov51/homework/git/commits{/sha}","comments_url":"https://api.github.com/repos/ivanershov51/homework/comments{/number}","issue_comment_url":"https://api.github.com/repos/ivanershov51/homework/issues/comments{/number}","contents_url":"https://api.github.com/repos/ivanershov51/homework/contents/{+path}","compare_url":"https://api.github.com/repos/ivanershov51/homework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ivanershov51/homework/merges","archive_url":"https://api.github.com/repos/ivanershov51/homework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ivanershov51/homework/downloads","issues_url":"https://api.github.com/repos/ivanershov51/homework/issues{/number}","pulls_url":"https://api.github.com/repos/ivanershov51/homework/pulls{/number}","milestones_url":"https://api.github.com/repos/ivanershov51/homework/milestones{/number}","notifications_url":"https://api.github.com/repos/ivanershov51/homework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ivanershov51/homework/labels{/name}","releases_url":"https://api.github.com/repos/ivanershov51/homework/releases{/id}","created_at":"2015-02-15T00:02:32Z","updated_at":"2015-04-03T09:47:37Z","pushed_at":"2015-04-06T11:52:35Z","git_url":"git://github.com/ivanershov51/homework.git","ssh_url":"git@github.com:ivanershov51/homework.git","clone_url":"https://github.com/ivanershov51/homework.git","svn_url":"https://github.com/ivanershov51/homework","homepage":"http://hwproj.herokuapp.com/courses/1","size":1004,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":0,"default_branch":"master"}},"base":{"label":"ivanershov51:master","ref":"master","sha":"5c665fec5872b915175dc17521a24bc4c5a00444","user":{"login":"ivanershov51","id":11010943,"avatar_url":"https://avatars.githubusercontent.com/u/11010943?v=3","gravatar_id":"","url":"https://api.github.com/users/ivanershov51","html_url":"https://github.com/ivanershov51","followers_url":"https://api.github.com/users/ivanershov51/followers","following_url":"https://api.github.com/users/ivanershov51/following{/other_user}","gists_url":"https://api.github.com/users/ivanershov51/gists{/gist_id}","starred_url":"https://api.github.com/users/ivanershov51/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ivanershov51/subscriptions","organizations_url":"https://api.github.com/users/ivanershov51/orgs","repos_url":"https://api.github.com/users/ivanershov51/repos","events_url":"https://api.github.com/users/ivanershov51/events{/privacy}","received_events_url":"https://api.github.com/users/ivanershov51/received_events","type":"User","site_admin":false},"repo":{"id":30812735,"name":"homework","full_name":"ivanershov51/homework","owner":{"login":"ivanershov51","id":11010943,"avatar_url":"https://avatars.githubusercontent.com/u/11010943?v=3","gravatar_id":"","url":"https://api.github.com/users/ivanershov51","html_url":"https://github.com/ivanershov51","followers_url":"https://api.github.com/users/ivanershov51/followers","following_url":"https://api.github.com/users/ivanershov51/following{/other_user}","gists_url":"https://api.github.com/users/ivanershov51/gists{/gist_id}","starred_url":"https://api.github.com/users/ivanershov51/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ivanershov51/subscriptions","organizations_url":"https://api.github.com/users/ivanershov51/orgs","repos_url":"https://api.github.com/users/ivanershov51/repos","events_url":"https://api.github.com/users/ivanershov51/events{/privacy}","received_events_url":"https://api.github.com/users/ivanershov51/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ivanershov51/homework","description":"SPbSU homework. 2014 - ..","fork":false,"url":"https://api.github.com/repos/ivanershov51/homework","forks_url":"https://api.github.com/repos/ivanershov51/homework/forks","keys_url":"https://api.github.com/repos/ivanershov51/homework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ivanershov51/homework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ivanershov51/homework/teams","hooks_url":"https://api.github.com/repos/ivanershov51/homework/hooks","issue_events_url":"https://api.github.com/repos/ivanershov51/homework/issues/events{/number}","events_url":"https://api.github.com/repos/ivanershov51/homework/events","assignees_url":"https://api.github.com/repos/ivanershov51/homework/assignees{/user}","branches_url":"https://api.github.com/repos/ivanershov51/homework/branches{/branch}","tags_url":"https://api.github.com/repos/ivanershov51/homework/tags","blobs_url":"https://api.github.com/repos/ivanershov51/homework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ivanershov51/homework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ivanershov51/homework/git/refs{/sha}","trees_url":"https://api.github.com/repos/ivanershov51/homework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ivanershov51/homework/statuses/{sha}","languages_url":"https://api.github.com/repos/ivanershov51/homework/languages","stargazers_url":"https://api.github.com/repos/ivanershov51/homework/stargazers","contributors_url":"https://api.github.com/repos/ivanershov51/homework/contributors","subscribers_url":"https://api.github.com/repos/ivanershov51/homework/subscribers","subscription_url":"https://api.github.com/repos/ivanershov51/homework/subscription","commits_url":"https://api.github.com/repos/ivanershov51/homework/commits{/sha}","git_commits_url":"https://api.github.com/repos/ivanershov51/homework/git/commits{/sha}","comments_url":"https://api.github.com/repos/ivanershov51/homework/comments{/number}","issue_comment_url":"https://api.github.com/repos/ivanershov51/homework/issues/comments{/number}","contents_url":"https://api.github.com/repos/ivanershov51/homework/contents/{+path}","compare_url":"https://api.github.com/repos/ivanershov51/homework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ivanershov51/homework/merges","archive_url":"https://api.github.com/repos/ivanershov51/homework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ivanershov51/homework/downloads","issues_url":"https://api.github.com/repos/ivanershov51/homework/issues{/number}","pulls_url":"https://api.github.com/repos/ivanershov51/homework/pulls{/number}","milestones_url":"https://api.github.com/repos/ivanershov51/homework/milestones{/number}","notifications_url":"https://api.github.com/repos/ivanershov51/homework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ivanershov51/homework/labels{/name}","releases_url":"https://api.github.com/repos/ivanershov51/homework/releases{/id}","created_at":"2015-02-15T00:02:32Z","updated_at":"2015-04-03T09:47:37Z","pushed_at":"2015-04-06T11:52:35Z","git_url":"git://github.com/ivanershov51/homework.git","ssh_url":"git@github.com:ivanershov51/homework.git","clone_url":"https://github.com/ivanershov51/homework.git","svn_url":"https://github.com/ivanershov51/homework","homepage":"http://hwproj.herokuapp.com/courses/1","size":1004,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ivanershov51/homework/pulls/12"},"html":{"href":"https://github.com/ivanershov51/homework/pull/12"},"issue":{"href":"https://api.github.com/repos/ivanershov51/homework/issues/12"},"comments":{"href":"https://api.github.com/repos/ivanershov51/homework/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/ivanershov51/homework/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/ivanershov51/homework/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ivanershov51/homework/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/ivanershov51/homework/statuses/47765f00652dc7b9a963b77637c57604aeee8744"}}}}