Skip to content

Commit

Permalink
Refactor #26
Browse files Browse the repository at this point in the history
  • Loading branch information
DionysusBenstein committed Jul 1, 2018
1 parent 130d9e1 commit ae3e715
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 22 deletions.
2 changes: 1 addition & 1 deletion AppBar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Rectangle {

Text {
id: headerText
text: "Counter v2.4.3"
text: "Counter v2.4.4"
font.family: robotoMediumFont.name
font.pointSize: 15
color: "white"
Expand Down
16 changes: 0 additions & 16 deletions Counter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,22 +74,6 @@ int Counter::lengthWithoutSigns(const QString str) const
return counter;
}

//Метод считающий строки
int Counter::linesCounter(const QString str) const
{
int counter = 1;

for (int i = 0; i < str.length(); ++i)
{
if (str[i] == '\n')
{
counter++;
}
}

return counter;
}

//Метод подсчёта слов
int Counter::wordsCounter(const QString str) const
{
Expand Down
3 changes: 0 additions & 3 deletions Counter.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ class Counter : public QObject
//Метод подсчёта символов без знаков
Q_INVOKABLE int lengthWithoutSigns(const QString str) const;

//Метод считающий строки
Q_INVOKABLE int linesCounter(const QString str) const;

//Метод подсчёта слов
Q_INVOKABLE int wordsCounter(const QString str) const;

Expand Down
4 changes: 2 additions & 2 deletions main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,10 @@ ApplicationWindow {
counterBackEnd.lengthWithoutSpaces(input.text)
} else if (signsCounter.checked) {
counterBackEnd.lengthWithoutSigns(input.text)
} else if (linesCounter.checked) {
counterBackEnd.linesCounter(input.text)
} else if (wordsCounter.checked) {
counterBackEnd.wordsCounter(input.text)
} else if (linesCounter.checked) {
input.lineCount.toString()
} else {
input.text.length.toString()
}
Expand Down

0 comments on commit ae3e715

Please sign in to comment.