Skip to content

Я пытался сделать хоть что-нибудь#11

Open
Imbrionofsocks wants to merge 2 commits into
hBuzzy:masterfrom
Imbrionofsocks:TetrisTask
Open

Я пытался сделать хоть что-нибудь#11
Imbrionofsocks wants to merge 2 commits into
hBuzzy:masterfrom
Imbrionofsocks:TetrisTask

Conversation

@Imbrionofsocks

Copy link
Copy Markdown

No description provided.

@hBuzzy hBuzzy left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Исправить замечания.

P.S.
Где-то я уже явно видел части кода. Внесите больше своего все же.

Comment thread tetrisform.cpp
#include "tetrisform.h"
#include "ui_tetrisform.h"

tetrisForm::tetrisForm(QWidget *parent) :

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Названия классов с большой буквы

Comment thread main.cpp
QApplication app(argc, argv);
TetrixWindow window;
window.show();
QMediaPlayer *player = new QMediaPlayer;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В отрыве можно подумать, что это какой-то игрок, уточните, что это все же mediaPlayer

Comment thread tetrismainwindow.h
Comment on lines +22 to +29
TetrisBoard *board;
QLabel *nextPieceLabel;
QLCDNumber *scoreLcd;
QLCDNumber *levelLcd;
QLCDNumber *linesLcd;
QPushButton *startButton;
QPushButton *quitButton;
QPushButton *pauseButton;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

У полей с модификаторами доступа private и protected добавляем постфикс "_".

QPushButton *pauseButton -> QPushButton *pauseButton_ и т.д.

Comment thread tetrixboard.cpp
Comment on lines +25 to +34
return QSize(BoardWidth * 15 + frameWidth() * 2,
BoardHeight * 15 + frameWidth() * 2);
}

QSize TetrixBoard::minimumSizeHint() const

{
return QSize(BoardWidth * 5 + frameWidth() * 2,
BoardHeight * 5 + frameWidth() * 2);
}

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

15, 5, 2 - магические числа, выделите в поля или переменные.

Comment thread tetrixboard.cpp

void TetrixBoard::start()
{

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Лишняя пустая строка

Comment thread tetrixpiece.h
#ifndef TETRIXPIECE_H
#define TETRIXPIECE_H

enum TetrixShape { NoShape, ZShape, SShape, LineShape, TShape, SquareShape,

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Перечисления именуем как и константы с префиксом "k". NoShape -> kNoShape

Comment thread tetrixpiece.h
enum TetrixShape { NoShape, ZShape, SShape, LineShape, TShape, SquareShape,
LShape, MirroredLShape };

class TetrixPiece

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Добавление во всех классах слова Tetrix или Tetris быть не должно. Абсолютно бесполезное уточнение, если только сам класс не является тетрисом по факту или его непосредственной частью.

Comment thread tetrixpiece.h
Comment on lines +15 to +23
TetrixShape shape() const { return pieceShape; }
int x(int index) const { return coords[index][0]; }
int y(int index) const { return coords[index][1]; }
int minX() const;
int maxX() const;
int minY() const;
int maxY() const;
TetrixPiece rotatedLeft() const;
TetrixPiece rotatedRight() const;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Реализация в cpp. Все методы должны именоваться или начинать именование с глаголов. Если метод что-то возвращает, обычно это глагол get.

Comment thread tetrixwindow.cpp
Comment on lines +9 to +10


Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не больше одной пустой строки.

Comment thread tetrixwindow.h
Comment on lines +23 to +28
TetrixBoard *board;
QLabel *nextPieceLabel;
QLCDNumber *scoreLcd;
QLCDNumber *linesLcd;
QPushButton *startButton;
QPushButton *quitButton;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

У приватных полей постфикс "_".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants