warnings fixed

This commit is contained in:
Zira project 2019-12-13 01:46:01 +05:00
parent 8d34ba8838
commit 7d770cac9c
47 changed files with 107 additions and 185 deletions

View File

@ -15,7 +15,6 @@ class Breadcrumbs : public QWidget
Q_OBJECT
public:
explicit Breadcrumbs(Editor * codeEditor);
~Breadcrumbs();
QSize sizeHint() const override;
void setText(QString txt);
QString getText();

View File

@ -14,7 +14,6 @@ class CompletePopup : public QListWidget
Q_OBJECT
public:
explicit CompletePopup(QWidget * parent);
~CompletePopup();
void clearItems();
void addItem(QString str, QString data, QString delimiter = "");
void showPopup(int cursLeft, int cursTop, int viewLeft, int viewTop, int viewWidth, int viewHeight, int blockHeight);

View File

@ -15,7 +15,7 @@ class CreateFileDialog : public QDialog
Q_OBJECT
public:
CreateFileDialog(QWidget * parent);
~CreateFileDialog();
~CreateFileDialog() override;
void setDirectory(QString path);
void setName(QString path);
QString getDirectory();

View File

@ -15,7 +15,7 @@ class CreateFolderDialog : public QDialog
Q_OBJECT
public:
CreateFolderDialog(QWidget * parent);
~CreateFolderDialog();
~CreateFolderDialog() override;
void setDirectory(QString path);
void setName(QString path);
QString getDirectory();

View File

@ -15,7 +15,7 @@ class CreateProjectDialog : public QDialog
Q_OBJECT
public:
CreateProjectDialog(QWidget * parent);
~CreateProjectDialog();
~CreateProjectDialog() override;
void setDirectory(QString path);
void setName(QString name);
void setLintEnabled(bool enabled);

View File

@ -25,8 +25,8 @@ class Editor : public QTextEdit
{
Q_OBJECT
public:
Editor(Settings * settings, HighlightWords * highlightWords, CompleteWords * completeWords, HelpWords * helpWords, QWidget * parent = 0);
~Editor();
Editor(Settings * settings, HighlightWords * highlightWords, CompleteWords * completeWords, HelpWords * helpWords, QWidget * parent = nullptr);
~Editor() override;
void init();
void lineNumberAreaPaintEvent(QPaintEvent *event);
void lineMarkAreaPaintEvent(QPaintEvent *event);

View File

@ -15,7 +15,6 @@ class EditorTab : public QWidget
Q_OBJECT
public:
explicit EditorTab(QWidget *parent = nullptr);
~EditorTab();
void setEditor(Editor * editor);
Editor * getEditor();
signals:

View File

@ -15,7 +15,6 @@ class EditorTabs : public QObject
Q_OBJECT
public:
EditorTabs(QTabWidget * widget, Settings * settings, HighlightWords * highlightWords, CompleteWords * completeWords, HelpWords * helpWords);
~EditorTabs();
void createTab(QString filepath, bool initHighlight = true);
bool closeWindowAllowed();
Editor * getActiveEditor();

View File

@ -15,7 +15,7 @@ class EditProjectDialog : public QDialog
Q_OBJECT
public:
EditProjectDialog(QWidget * parent);
~EditProjectDialog();
~EditProjectDialog() override;
void setPath(QString path);
void setName(QString name);
void setLintEnabled(bool enabled);

View File

@ -17,7 +17,6 @@ class FileBrowser : public QObject
Q_OBJECT
public:
FileBrowser(QTreeWidget * widget, QLineEdit * line, Settings * settings);
~FileBrowser();
void showCreateFileDialog(QString startDir = "");
void showCreateFolderDialog(QString startDir = "");
void showCreateProjectDialog(bool phpLintEnabled, bool phpCSEnabled, QString startDir = "");

View File

@ -15,8 +15,8 @@ class HelpDialog : public QDialog
Q_OBJECT
public:
explicit HelpDialog(QWidget *parent = 0);
~HelpDialog();
explicit HelpDialog(QWidget *parent = nullptr);
~HelpDialog() override;
void shortcutsContent();
void aboutContent();
private:

View File

@ -43,7 +43,6 @@ class Highlight : public QObject
Q_OBJECT
public:
Highlight(Settings * settings, HighlightWords * HW, QTextDocument * parent);
~Highlight();
void rehighlight();
void rehighlightBlock(QTextBlock & block);
void highlightChanges(QTextCursor curs);

View File

@ -13,7 +13,6 @@ class HighlightData : public QTextBlockUserData
{
public:
HighlightData();
~HighlightData();
void reset();
QString stringBlock;
QString mode;

View File

@ -15,7 +15,6 @@ class LineNumber : public QWidget
Q_OBJECT
public:
explicit LineNumber(Editor * editor);
~LineNumber();
QSize sizeHint() const override;
protected:
void paintEvent(QPaintEvent *event) override;

View File

@ -46,8 +46,8 @@ class MainWindow : public QMainWindow
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
explicit MainWindow(QWidget *parent = nullptr);
~MainWindow() override;
static int const EXIT_CODE_RESTART;
protected:
void closeEvent(QCloseEvent *event) override;

View File

@ -19,7 +19,6 @@ class Navigator : public QObject
Q_OBJECT
public:
explicit Navigator(QTreeWidget * widget, Settings * settings);
~Navigator();
void build(ParsePHP::ParseResult result);
void build(ParseJS::ParseResult result);
void build(ParseCSS::ParseResult result);

View File

@ -13,6 +13,7 @@ class Parse
{
public:
Parse();
virtual ~Parse();
virtual void prepare(QString & text);
virtual QString strip(QRegularExpressionMatch & match, QString & text, int group);
virtual int getLine(QString & text, int offset);

View File

@ -19,7 +19,6 @@ class ParserWorker : public QObject
Q_OBJECT
public:
explicit ParserWorker(Settings * settings, QObject *parent = nullptr);
~ParserWorker();
protected:
void parseProjectDir(QString dir, QStringList & files);
void parseProjectFile(QString file, QVariantMap & map);

View File

@ -11,7 +11,6 @@ class Popup : public QWidget
Q_OBJECT
public:
explicit Popup(Settings * settings, QWidget *parent = nullptr);
~Popup();
QSize sizeHint() const override;
void displayText(int x, int y, QString text);
void displayError(int x, int y, QString text);

View File

@ -21,7 +21,6 @@ class QuickAccess : public QFrame
Q_OBJECT
public:
explicit QuickAccess(Settings * settings, QWidget *parent = nullptr);
~QuickAccess();
QSize sizeHint() const override;
void slideIn(int x, int y, int width, int height);
void slideOut();

View File

@ -15,7 +15,7 @@ class SearchDialog : public QDialog
Q_OBJECT
public:
SearchDialog(QWidget * parent);
~SearchDialog();
~SearchDialog() override;
void setDirectory(QString path);
void setText(QString text);
void setExtensions(QString text);

View File

@ -22,7 +22,6 @@ class Settings : public QObject
Q_OBJECT
public:
Settings(QObject *parent = nullptr);
~Settings();
void applyLightColors();
void applyDarkColors();
void set(std::string k, std::string v);

View File

@ -16,7 +16,7 @@ class SettingsDialog : public QDialog
Q_OBJECT
public:
SettingsDialog(Settings * settings, QWidget * parent);
~SettingsDialog();
~SettingsDialog() override;
std::unordered_map<std::string, std::string> getData();
private:
Ui::SettingsDialog * ui;

View File

@ -14,7 +14,6 @@ class Tooltip : public QLabel
Q_OBJECT
public:
Tooltip();
~Tooltip();
protected:
void mousePressEvent(QMouseEvent *e) override;
};

View File

@ -7,6 +7,9 @@
#ifndef TYPES_H
#define TYPES_H
#include <list>
#include <unordered_map>
typedef std::list<std::unordered_map<std::string, std::string>> WordsMapList;
#endif // TYPES_H

View File

@ -12,11 +12,6 @@ Breadcrumbs::Breadcrumbs(Editor * codeEditor) : QWidget(codeEditor)
setCursor(Qt::PointingHandCursor);
}
Breadcrumbs::~Breadcrumbs()
{
}
QSize Breadcrumbs::sizeHint() const {
return QSize(0, editor->breadcrumbsHeight());
}

View File

@ -27,11 +27,6 @@ CompletePopup::CompletePopup(QWidget * parent) : QListWidget(parent)
textStartPos = -1;
}
CompletePopup::~CompletePopup()
{
}
void CompletePopup::setTextStartPos(int pos)
{
textStartPos = pos;

View File

@ -705,7 +705,7 @@ QString Editor::cleanUpText(QString blockText)
bOffset = bStart + bLength;
}
} while (bStart>=0);
bStart = -1, bLength = -1, bOffset = 0;
bStart = -1; bLength = -1; bOffset = 0;
do {
QRegularExpressionMatch match = strExpr.match(blockText, bOffset);
bStart = match.capturedStart();
@ -755,7 +755,7 @@ void Editor::showTooltip(int x, int y, QString text, bool richText, int fixedWid
int extraLinesCo = 0;
for (int i=0; i<strippedList.size(); i++) {
int textLineW = fm.width(strippedList.at(i)) + mm.left() + mm.right() + 1;
if (textLineW > tooltipWidth) extraLinesCo += std::ceil((double)textLineW / tooltipWidth)-1;
if (textLineW > tooltipWidth) extraLinesCo += std::ceil(static_cast<double>(textLineW) / tooltipWidth)-1;
}
tooltipLabel.setFixedHeight(fm.height()*(strippedList.size()+extraLinesCo) + mm.top() + mm.bottom());
if (richText) tooltipLabel.setTextFormat(Qt::RichText);
@ -1989,7 +1989,7 @@ QChar Editor::findPrevCharNonSpaceAtCursos(QTextCursor & curs)
int pos = curs.positionInBlock();
if (pos >= blockText.size()) continue;
prevChar = blockText[pos];
if (!iswspace(prevChar.toLatin1())) {
if (!prevChar.isSpace()) {
break;
}
}
@ -2008,7 +2008,7 @@ QChar Editor::findNextCharNonSpaceAtCursos(QTextCursor & curs)
int pos = curs.positionInBlock();
if (pos >= blockText.size()) continue;
nextChar = blockText[pos];
if (!iswspace(nextChar.toLatin1())) {
if (!nextChar.isSpace()) {
break;
}
}
@ -2026,7 +2026,7 @@ QString Editor::findPrevWordNonSpaceAtCursor(QTextCursor & curs, std::string mod
int pos = curs.positionInBlock();
if (pos >= blockText.size()) continue;
QChar c = blockText[pos];
if (prevText.size() == 0 && iswspace(c.toLatin1())) continue;
if (prevText.size() == 0 && c.isSpace()) continue;
if (mode == MODE_PHP || mode == MODE_JS) {
if (isalnum(c.toLatin1()) || c=="$" || c=="_") {
prevText = c + prevText;
@ -2062,7 +2062,7 @@ QString Editor::findNextWordNonSpaceAtCursor(QTextCursor & curs, std::string mod
int pos = curs.positionInBlock();
if (pos >= blockText.size()) continue;
QChar c = blockText[pos];
if (nextText.size() == 0 && iswspace(c.toLatin1())) continue;
if (nextText.size() == 0 && c.isSpace()) continue;
if (mode == MODE_PHP || mode == MODE_JS) {
if (isalnum(c.toLatin1()) || c=="$" || c=="_") {
nextText += c;
@ -2150,7 +2150,7 @@ QString Editor::completeClassNamePHPAtCursor(QTextCursor & curs, QString prevWor
void Editor::showCompletePopup()
{
int blockHeight = document()->documentLayout()->blockBoundingRect(textCursor().block()).height();
int blockHeight = static_cast<int>(document()->documentLayout()->blockBoundingRect(textCursor().block()).height());
int viewLeft = viewport()->geometry().left();
int viewTop = viewport()->geometry().top();
int viewWidth = viewport()->geometry().width();
@ -3006,7 +3006,7 @@ QString Editor::detectCompleteTypeAtCursorPHP(QTextCursor & curs, QString nsName
if (_cls.name == "\\"+ns+clsName) {
QString parentClass = _cls.parent;
if (parentClass.size() > 0 && parentClass.at(0) == "\\") parentClass = parentClass.mid(1);
if (parentClass > 0) {
if (parentClass.size() > 0) {
prevType = parentClass;
}
break;
@ -3421,11 +3421,11 @@ void Editor::tooltip(int offset)
QChar prevChar = '\0', prevPrevChar = '\0';
int cursorTextPos = cursPos;
if (cursPos > 1 && blockText[cursPos-1] == ":" && blockText[cursPos-2] == ":") {
prevChar = ':', prevPrevChar = ':';
prevChar = ':'; prevPrevChar = ':';
cursPos -= 2;
while (cursPos > 0) {
QChar _prevChar = blockText[cursPos-1];
if (!iswspace(_prevChar.toLatin1())) break;
if (!_prevChar.isSpace()) break;
cursPos--;
}
}
@ -3462,7 +3462,7 @@ void Editor::tooltip(int offset)
if (_cls.name == "\\"+ns+clsName) {
QString parentClass = _cls.parent;
if (parentClass.size() > 0 && parentClass.at(0) == "\\") parentClass = parentClass.mid(1);
if (parentClass > 0) {
if (parentClass.size() > 0) {
prevText = parentClass;
}
break;
@ -3782,7 +3782,7 @@ int Editor::findFirstVisibleBlockIndex()
for(int i = 0; i < document()->blockCount(); i++)
{
QTextBlock block = curs.block();
int block_y = document()->documentLayout()->blockBoundingRect(block).y();
int block_y = static_cast<int>(document()->documentLayout()->blockBoundingRect(block).y());
if (verticalScrollBar()->sliderPosition()<=block_y) {
return i;
}
@ -3798,7 +3798,7 @@ int Editor::findLastVisibleBlockIndex()
for(int i = 0; i < document()->blockCount(); i++)
{
QTextBlock block = curs.block();
int block_y = document()->documentLayout()->blockBoundingRect(block).y();
int block_y = static_cast<int>(document()->documentLayout()->blockBoundingRect(block).y());
if (size().height()+verticalScrollBar()->sliderPosition()<=block_y) {
return i;
}
@ -3816,7 +3816,7 @@ int Editor::getFirstVisibleBlockIndex()
slider_pos -= fRect.y();
if (slider_pos<=0) return 0;
if (document()->blockCount()<2) return 0;
int block_d = slider_pos / fRect.height() + 1;
int block_d = static_cast<int>(slider_pos / fRect.height()) + 1;
return block_d;
}
@ -3826,7 +3826,7 @@ int Editor::getLastVisibleBlockIndex()
int slider_pos = verticalScrollBar()->sliderPosition();
QTextBlock first = document()->findBlockByNumber(0);
QRectF fRect = document()->documentLayout()->blockBoundingRect(first);
int block_d = (size().height() + slider_pos) / fRect.height();
int block_d = static_cast<int>((size().height() + slider_pos) / fRect.height());
if (block_d >= document()->blockCount()) block_d = document()->blockCount()-1;
return block_d;
}
@ -3913,12 +3913,12 @@ void Editor::lineMarkAreaPaintEvent(QPaintEvent *event)
top += document()->documentMargin() - verticalScrollBar()->sliderPosition();
} else {
QTextBlock prev_block = document()->findBlockByNumber(blockNumber-1);
int prev_y = document()->documentLayout()->blockBoundingRect(prev_block).y();
int prev_h = document()->documentLayout()->blockBoundingRect(prev_block).height();
int prev_y = static_cast<int>(document()->documentLayout()->blockBoundingRect(prev_block).y());
int prev_h = static_cast<int>(document()->documentLayout()->blockBoundingRect(prev_block).height());
top += prev_y + prev_h - verticalScrollBar()->sliderPosition();
}
int bottom = top + document()->documentLayout()->blockBoundingRect(block).height();
int bottom = top + static_cast<int>(document()->documentLayout()->blockBoundingRect(block).height());
while (block.isValid() && top <= event->rect().bottom()) {
if (block.isVisible()) {
@ -3946,7 +3946,7 @@ void Editor::lineMarkAreaPaintEvent(QPaintEvent *event)
}
block = block.next();
top = bottom;
bottom = top + document()->documentLayout()->blockBoundingRect(block).height();
bottom = top + static_cast<int>(document()->documentLayout()->blockBoundingRect(block).height());
blockNumber++;
}
}
@ -4025,12 +4025,12 @@ void Editor::lineNumberAreaPaintEvent(QPaintEvent *event)
top += document()->documentMargin() - verticalScrollBar()->sliderPosition();
} else {
QTextBlock prev_block = document()->findBlockByNumber(blockNumber-1);
int prev_y = document()->documentLayout()->blockBoundingRect(prev_block).y();
int prev_h = document()->documentLayout()->blockBoundingRect(prev_block).height();
int prev_y = static_cast<int>(document()->documentLayout()->blockBoundingRect(prev_block).y());
int prev_h = static_cast<int>(document()->documentLayout()->blockBoundingRect(prev_block).height());
top += prev_y + prev_h - verticalScrollBar()->sliderPosition();
}
int bottom = top + document()->documentLayout()->blockBoundingRect(block).height();
int bottom = top + static_cast<int>(document()->documentLayout()->blockBoundingRect(block).height());
while (block.isValid() && top <= event->rect().bottom()) {
if (block.isVisible()) {
@ -4040,7 +4040,7 @@ void Editor::lineNumberAreaPaintEvent(QPaintEvent *event)
}
block = block.next();
top = bottom;
bottom = top + document()->documentLayout()->blockBoundingRect(block).height();
bottom = top + static_cast<int>(document()->documentLayout()->blockBoundingRect(block).height());
blockNumber++;
}
}
@ -4243,7 +4243,7 @@ void Editor::highlightCloseTagPair(QString tagName, int pos, QList<QTextEdit::Ex
QTextCursor cursorPair = textCursor();
_found = false;
_start = -1, _length = 0, _offset = 0;
_start = -1; _length = 0; _offset = 0;
QString blockTextPair = cleanUpText(cursorPair.block().text());
do {
QRegularExpressionMatch _match = tagExpr.match(blockTextPair, _offset);
@ -4336,7 +4336,7 @@ void Editor::highlightOpenTagPair(QString tagName, int pos, QList<QTextEdit::Ext
QTextCursor cursorPair = textCursor();
_found = false;
_start = -1, _length = 0, _offset = 0;
_start = -1; _length = 0; _offset = 0;
QString blockTextPair = cleanUpText(cursorPair.block().text());
do {
QRegularExpressionMatch _match = tagExpr.match(blockTextPair, _offset);
@ -4443,7 +4443,7 @@ void Editor::highlightPHPCloseSpecialTagPair(QString tagName, int pos, QList<QTe
}
} while(start>=0);
if (!sFound) break;
offset = 0, start = -1;
offset = 0; start = -1;
do {
QRegularExpressionMatch match = openTagExpr.match(blockText, offset);
start = match.capturedStart();
@ -4570,7 +4570,7 @@ void Editor::highlightPHPOpenSpecialTagPair(QString tagName, int pos, QList<QTex
}
} while(start>=0);
if (!sFound) break;
offset = 0, start = -1;
offset = 0; start = -1;
do {
QRegularExpressionMatch match = closeTagExpr.match(blockText, offset);
start = match.capturedStart();
@ -4701,7 +4701,7 @@ void Editor::highlightExtras(QChar prevChar, QChar nextChar, QChar cursorTextPre
if (search->isVisible() && searchString.size() > 0) {
static_cast<LineMap *>(lineMap)->clearMarks();
QTextCursor searchWordCursor(document());
QTextDocument::FindFlags findFlags = 0;
QTextDocument::FindFlags findFlags = nullptr;
if (searchCaSe) findFlags |= QTextDocument::FindCaseSensitively;
if (searchWord) findFlags |= QTextDocument::FindWholeWords;
searchWordCursor.movePosition(QTextCursor::Start, QTextCursor::MoveAnchor);
@ -4852,7 +4852,7 @@ void Editor::searchText(QString searchTxt, bool CaSe, bool Word, bool RegE, bool
else curs.movePosition(QTextCursor::End, QTextCursor::MoveAnchor);
}
if (backwards && curs.positionInBlock() == 0) curs.movePosition(QTextCursor::PreviousCharacter, QTextCursor::MoveAnchor); // bug ?
QTextDocument::FindFlags flags = 0;
QTextDocument::FindFlags flags = nullptr;
if (CaSe) flags |= QTextDocument::FindCaseSensitively;
if (Word) flags |= QTextDocument::FindWholeWords;
if (backwards) flags |= QTextDocument::FindBackward;
@ -4903,7 +4903,7 @@ void Editor::replaceAllText(QString searchTxt, QString replaceTxt, bool CaSe, bo
if (searchTxt.size() == 0) return;
curs.movePosition(QTextCursor::Start, QTextCursor::MoveAnchor);
curs.beginEditBlock();
QTextDocument::FindFlags flags = 0;
QTextDocument::FindFlags flags = nullptr;
if (CaSe) flags |= QTextDocument::FindCaseSensitively;
if (Word) flags |= QTextDocument::FindWholeWords;
QTextCursor resCurs;
@ -4962,7 +4962,7 @@ void Editor::gotoLine(int line, bool focus) {
int pos = cursor.positionInBlock();
if (pos >= blockText.size()) break;
QChar c = blockText[pos];
if (!iswspace(c.toLatin1())) break;
if (!c.isSpace()) break;
} while(cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::MoveAnchor));
setTextCursor(cursor);
if (focus) setFocus();
@ -5045,12 +5045,12 @@ void Editor::showLineMark(int y)
top += document()->documentMargin() - verticalScrollBar()->sliderPosition();
} else {
QTextBlock prev_block = document()->findBlockByNumber(blockNumber-1);
int prev_y = document()->documentLayout()->blockBoundingRect(prev_block).y();
int prev_h = document()->documentLayout()->blockBoundingRect(prev_block).height();
int prev_y = static_cast<int>(document()->documentLayout()->blockBoundingRect(prev_block).y());
int prev_h = static_cast<int>(document()->documentLayout()->blockBoundingRect(prev_block).height());
top += prev_y + prev_h - verticalScrollBar()->sliderPosition();
}
int bottom = top + document()->documentLayout()->blockBoundingRect(block).height();
int bottom = top + static_cast<int>(document()->documentLayout()->blockBoundingRect(block).height());
QString tooltipText = "";
while (block.isValid() && top < y) {
@ -5073,7 +5073,7 @@ void Editor::showLineMark(int y)
}
block = block.next();
top = bottom;
bottom = top + document()->documentLayout()->blockBoundingRect(block).height();
bottom = top + static_cast<int>(document()->documentLayout()->blockBoundingRect(block).height());
blockNumber++;
}
@ -5108,12 +5108,12 @@ void Editor::addLineMark(int y)
top += document()->documentMargin() - verticalScrollBar()->sliderPosition();
} else {
QTextBlock prev_block = document()->findBlockByNumber(blockNumber-1);
int prev_y = document()->documentLayout()->blockBoundingRect(prev_block).y();
int prev_h = document()->documentLayout()->blockBoundingRect(prev_block).height();
int prev_y = static_cast<int>(document()->documentLayout()->blockBoundingRect(prev_block).y());
int prev_h = static_cast<int>(document()->documentLayout()->blockBoundingRect(prev_block).height());
top += prev_y + prev_h - verticalScrollBar()->sliderPosition();
}
int bottom = top + document()->documentLayout()->blockBoundingRect(block).height();
int bottom = top + static_cast<int>(document()->documentLayout()->blockBoundingRect(block).height());
bool changed = false;
while (block.isValid() && top < y) {
@ -5141,7 +5141,7 @@ void Editor::addLineMark(int y)
}
block = block.next();
top = bottom;
bottom = top + document()->documentLayout()->blockBoundingRect(block).height();
bottom = top + static_cast<int>(document()->documentLayout()->blockBoundingRect(block).height());
blockNumber++;
}
@ -5251,7 +5251,7 @@ void Editor::cleanForSave()
int pos = curs.positionInBlock();
if (pos <= 0) break;
QChar c = blockText.at(pos-1);
if (!iswspace(c.toLatin1())) break;
if (!c.isSpace()) break;
} while(curs.movePosition(QTextCursor::PreviousCharacter, QTextCursor::KeepAnchor));
if (curs.hasSelection()) {
curs.deleteChar();
@ -5719,7 +5719,7 @@ void Editor::scrollToMiddle(QTextCursor cursor, int line)
int v = verticalScrollBar()->value();
int firstVisibleBlockIndex = getFirstVisibleBlockIndex();
int lastVisibleBlockIndex = getLastVisibleBlockIndex();
int blockHeight = document()->documentLayout()->blockBoundingRect(cursor.block()).height();
int blockHeight = static_cast<int>(document()->documentLayout()->blockBoundingRect(cursor.block()).height());
int visibleBlocksCount = lastVisibleBlockIndex - firstVisibleBlockIndex;
int middleLine = firstVisibleBlockIndex + visibleBlocksCount / 2 + 1;
if (middleLine > line) {

View File

@ -15,22 +15,17 @@ EditorTab::EditorTab(QWidget *parent) : QWidget(parent)
setLayout(layout);
}
EditorTab::~EditorTab()
{
}
void EditorTab::setEditor(Editor * editor)
{
if (layout() == 0) return;
if (layout() == nullptr) return;
layout()->addWidget(editor);
}
Editor * EditorTab::getEditor()
{
if (layout() == 0 || layout()->count() != 1) return nullptr;
if (layout() == nullptr || layout()->count() != 1) return nullptr;
QLayoutItem * textEditItem = layout()->itemAt(0);
if (textEditItem == 0) return nullptr;
if (textEditItem == nullptr) return nullptr;
QWidget * textEdit = textEditItem->widget();
if (textEdit == nullptr) return nullptr;
Editor * textEditor = static_cast<Editor *>(textEdit);

View File

@ -40,11 +40,6 @@ EditorTabs::EditorTabs(QTabWidget * widget, Settings * settings, HighlightWords
tabWidget->setCursor(Qt::ArrowCursor);
}
EditorTabs::~EditorTabs()
{
}
Editor * EditorTabs::getActiveEditor()
{
return editor;
@ -53,7 +48,7 @@ Editor * EditorTabs::getActiveEditor()
Editor * EditorTabs::getTabEditor(int index)
{
QWidget * tab = tabWidget->widget(index);
if (tab == 0) return nullptr;
if (tab == nullptr) return nullptr;
EditorTab * editorTab = static_cast<EditorTab *>(tab);
return editorTab->getEditor();
}
@ -160,7 +155,7 @@ void EditorTabs::closeTab(int index)
QWidget * tab = tabWidget->widget(index);
tabWidget->removeTab(index);
// switchTab slot called here (emit blocked)
if (tab != 0) tab->deleteLater();
if (tab != nullptr) tab->deleteLater();
// update indexes
for (int i=0; i<tabWidget->count(); i++) {
Editor * textEditor = getTabEditor(i);

View File

@ -32,17 +32,12 @@ const QString FB_ACTION_NAME_PASTE = "fb_paste";
FileBrowser::FileBrowser(QTreeWidget * widget, QLineEdit * line, Settings * settings):
treeWidget(widget), pathLine(line)
{
fbpath = "", fbcopypath = "", fbcutpath = "";
fbcopyitem = nullptr, fbcutitem = nullptr;
fbpath = ""; fbcopypath = ""; fbcutpath = "";
fbcopyitem = nullptr; fbcutitem = nullptr;
fileBrowserHomeDir = QString::fromStdString(settings->get("file_browser_home"));
initFileBrowser(fileBrowserHomeDir);
}
FileBrowser::~FileBrowser()
{
}
void FileBrowser::initFileBrowser(QString homeDir)
{
if (homeDir.size() == 0) {
@ -67,7 +62,7 @@ void FileBrowser::initFileBrowser(QString homeDir)
void FileBrowser::buildFileBrowserTree(QString startDir, QTreeWidgetItem * parent)
{
if (parent == nullptr) {
fbcopyitem = nullptr, fbcutitem = nullptr;
fbcopyitem = nullptr; fbcutitem = nullptr;
}
if (startDir.size() > 1 && startDir.at(startDir.size()-1) == "/") startDir = startDir.mid(0, startDir.size()-1);
QFileInfo startDirInfo(startDir);
@ -155,7 +150,7 @@ void FileBrowser::fileBrowserCollapsed(QTreeWidgetItem * item)
void FileBrowser::fileBrowserDoubleClicked(QTreeWidgetItem * item, int column)
{
if (item == 0) return;
if (item == nullptr) return;
if (column != 0) return;
QString path = item->data(0, Qt::UserRole).toString();
if (path.size() == 0) return;
@ -252,7 +247,7 @@ void FileBrowser::fileBrowserContextMenuRequested(QPoint p)
if (disabled || item == nullptr) deleteAction->setDisabled(true);
QAction * selectedAction = menu.exec(treeWidget->viewport()->mapToGlobal(p));
if (selectedAction == 0) return;
if (selectedAction == nullptr) return;
QString actionName = selectedAction->data().toString();
if (actionName.size() == 0) return;
@ -346,8 +341,8 @@ void FileBrowser::fbDeleteRequested(QTreeWidgetItem * item)
emit fileDeleted(path);
}
}
fbcopypath = "", fbcutpath = "";
fbcopyitem = nullptr, fbcutitem = nullptr;
fbcopypath = ""; fbcutpath = "";
fbcopyitem = nullptr; fbcutitem = nullptr;
}
void FileBrowser::fileBrowserItemChanged(QTreeWidgetItem * item, int col)
@ -389,8 +384,8 @@ void FileBrowser::fileBrowserItemChanged(QTreeWidgetItem * item, int col)
if (parent != nullptr) fbReloadItem(parent);
else rebuildFileBrowserTree(path);
}
fbcopypath = "", fbcutpath = "";
fbcopyitem = nullptr, fbcutitem = nullptr;
fbcopypath = ""; fbcutpath = "";
fbcopyitem = nullptr; fbcutitem = nullptr;
}
void FileBrowser::fileBrowserItemSelectionChanged()
@ -468,8 +463,8 @@ void FileBrowser::fbPasteItem(QTreeWidgetItem * item)
// reload
fbReloadItem(item);
}
fbcopypath = "", fbcutpath = "";
fbcopyitem = nullptr, fbcutitem = nullptr;
fbcopypath = ""; fbcutpath = "";
fbcopyitem = nullptr; fbcutitem = nullptr;
} else {
QMessageBox msgBox;
msgBox.setText(QObject::tr("File or folder with such name already exists."));
@ -494,8 +489,8 @@ void FileBrowser::fbPasteItem(QTreeWidgetItem * item)
}
emit fileDeleted(fbcutpath);
}
fbcopypath = "", fbcutpath = "";
fbcopyitem = nullptr, fbcutitem = nullptr;
fbcopypath = ""; fbcutpath = "";
fbcopyitem = nullptr; fbcutitem = nullptr;
} else {
QMessageBox msgBox;
msgBox.setText(QObject::tr("File or folder with such name already exists."));
@ -530,8 +525,8 @@ void FileBrowser::showCreateFileDialog(QString startDir)
msgBox.setText(QObject::tr("File or folder with such name already exists."));
msgBox.exec();
}
fbcopypath = "", fbcutpath = "";
fbcopyitem = nullptr, fbcutitem = nullptr;
fbcopypath = ""; fbcutpath = "";
fbcopyitem = nullptr; fbcutitem = nullptr;
}
void FileBrowser::showCreateFolderDialog(QString startDir)
@ -560,8 +555,8 @@ void FileBrowser::showCreateFolderDialog(QString startDir)
msgBox.setText(QObject::tr("File or folder with such name already exists."));
msgBox.exec();
}
fbcopypath = "", fbcutpath = "";
fbcopyitem = nullptr, fbcutitem = nullptr;
fbcopypath = ""; fbcutpath = "";
fbcopyitem = nullptr; fbcutitem = nullptr;
}
void FileBrowser::showCreateProjectDialog(bool phpLintEnabled, bool phpCSEnabled, QString startDir)
@ -586,8 +581,8 @@ void FileBrowser::showCreateProjectDialog(bool phpLintEnabled, bool phpCSEnabled
msgBox.setText(QObject::tr("Folder with such name not found."));
msgBox.exec();
}
fbcopypath = "", fbcutpath = "";
fbcopyitem = nullptr, fbcutitem = nullptr;
fbcopypath = ""; fbcutpath = "";
fbcopyitem = nullptr; fbcutitem = nullptr;
}
void FileBrowser::showEditProjectDialog(QString title, QString path, bool phpLintEnabled, bool phpCSEnabled)
@ -606,8 +601,8 @@ void FileBrowser::showEditProjectDialog(QString title, QString path, bool phpLin
bool csEnabled = dialog.getCSEnabled();
if (name.size() == 0) return;
emit projectEditRequested(name, path, lintEnabled, csEnabled);
fbcopypath = "", fbcutpath = "";
fbcopyitem = nullptr, fbcutitem = nullptr;
fbcopypath = ""; fbcutpath = "";
fbcopyitem = nullptr; fbcutitem = nullptr;
}
void FileBrowser::openProject(QString startDir)
@ -623,8 +618,8 @@ void FileBrowser::openProject(QString startDir)
msgBox.setText(QObject::tr("Folder with such name not found."));
msgBox.exec();
}
fbcopypath = "", fbcutpath = "";
fbcopyitem = nullptr, fbcutitem = nullptr;
fbcopypath = ""; fbcutpath = "";
fbcopyitem = nullptr; fbcutitem = nullptr;
}
void FileBrowser::refreshFileBrowserDirectory(QString directory)
@ -657,7 +652,7 @@ bool FileBrowser::eventFilter(QObject *watched, QEvent *event)
{
// refresh file browser selected item
if(watched == treeWidget && event->type() == QEvent::KeyRelease) {
QKeyEvent * keyEvent = (QKeyEvent *)event;
QKeyEvent * keyEvent = static_cast<QKeyEvent *>(event);
if (keyEvent->key() == Qt::Key_Return || keyEvent->key() == Qt::Key_Escape || keyEvent->key() == Qt::Key_Tab) {
fileBrowserRemoveEmptyItems();
}

View File

@ -90,11 +90,6 @@ Highlight::Highlight(Settings * settings, HighlightWords * hWords, QTextDocument
HW = hWords;
}
Highlight::~Highlight()
{
}
void Highlight::setFormat(int start, int count, const QTextCharFormat &format)
{
if (start < 0 || start >= formatChanges.count()) return;
@ -609,7 +604,7 @@ void Highlight::highlightChar(int start, const QTextCharFormat format)
void Highlight::changeBlockState()
{
if (highlightVarsMode || firstRunMode) return;
cBlock.setUserState(++block_state);
cBlock.setUserState(static_cast<int>(++block_state));
}
bool Highlight::detectMode(const QChar & c, int pos, bool isWSpace, bool isLast)
@ -3252,7 +3247,7 @@ bool Highlight::parseBlock(const QString & text)
bool isLast = (i == text.size()-1) ? true : false;
bool isAlpha = isalpha(c.toLatin1()) > 0 || c == "_" ? true : false;
bool isAlnum = isalnum(c.toLatin1()) > 0 || c == "_" ? true : false;
bool isWSpace = iswspace(c.toLatin1()) > 0 ? true : false;
bool isWSpace = c.isSpace();
// detect highlight mode
if (parseMode(c, i, isWSpace, isLast, pMode, pState)) continue;

View File

@ -11,11 +11,6 @@ HighlightData::HighlightData()
reset();
}
HighlightData::~HighlightData()
{
}
void HighlightData::reset()
{
stringBlock = "";

View File

@ -100,13 +100,13 @@ void LineMark::mousePressEvent(QMouseEvent *event)
}
int LineMark::getErrorsCount() {
return errors.size();
return static_cast<int>(errors.size());
}
int LineMark::getWarningsCount() {
return warnings.size();
return static_cast<int>(warnings.size());
}
int LineMark::getMarksCount() {
return marks.size();
return static_cast<int>(marks.size());
}

View File

@ -12,11 +12,6 @@ LineNumber::LineNumber(Editor * codeEditor) : QWidget(codeEditor)
setCursor(Qt::ArrowCursor);
}
LineNumber::~LineNumber()
{
}
QSize LineNumber::sizeHint() const {
return QSize(editor->lineNumberAreaWidth(), 0);
}

View File

@ -31,7 +31,7 @@ const int OUTPUT_TAB_MESSAGES_INDEX = 0;
const int OUTPUT_TAB_HELP_INDEX = 1;
const int OUTPUT_TAB_SEARCH_INDEX = 2;
const int OUTPUT_TAB_GIT_INDEX = 3;
const int OUTPUT_TAB_TODO_INDEX = 4;
//const int OUTPUT_TAB_TODO_INDEX = 4;
const int PROJECT_LOAD_DELAY = 500;

View File

@ -14,11 +14,6 @@ Navigator::Navigator(QTreeWidget * widget, Settings * /*settings*/) : treeWidget
connect(treeWidget, SIGNAL(itemCollapsed(QTreeWidgetItem*)), this, SLOT(navigatorCollapsed(QTreeWidgetItem*)));
}
Navigator::~Navigator()
{
}
void Navigator::clear()
{
treeWidget->clear();
@ -430,7 +425,7 @@ void Navigator::build(ParseCSS::ParseResult result)
void Navigator::navigatorDoubleClicked(QTreeWidgetItem * item, int column)
{
if (item == 0) return;
if (item == nullptr) return;
if (column != 0) return;
int line = item->data(0, Qt::UserRole).toInt();
if (line == 0) return;
@ -439,12 +434,12 @@ void Navigator::navigatorDoubleClicked(QTreeWidgetItem * item, int column)
void Navigator::navigatorExpanded(QTreeWidgetItem * item)
{
if (item == 0) return;
if (item == nullptr) return;
treeWidget->resizeColumnToContents(0);
}
void Navigator::navigatorCollapsed(QTreeWidgetItem * item)
{
if (item == 0) return;
if (item == nullptr) return;
treeWidget->resizeColumnToContents(0);
}

View File

@ -15,6 +15,11 @@ Parse::Parse()
backtickExpression = QRegularExpression("(?:^|[^\\\\])[`](.*?[^\\\\])[`]", QRegularExpression::DotMatchesEverythingOption);
}
Parse::~Parse()
{
}
void Parse::prepare(QString & text)
{
text.replace("\\\\", " ");
@ -57,7 +62,7 @@ int Parse::getFirstNotEmptyLineTo(QString & text, int offset)
while(offsetPart > 0) {
offsetPart--;
QChar c = textPart[offsetPart];
if (!std::iswspace(c.toLatin1())) {
if (!c.isSpace()) {
line = getLine(textPart, offsetPart+1);
break;
}

View File

@ -14,7 +14,6 @@ const int EXPECT_MEDIA = 1;
const int EXPECT_KEYFRAMES = 2;
const int EXPECT_FONT_FACE = 3;
const int EXPECT_FONT_FAMILY = 4;
const int EXPECT_COMMENT = 5;
std::unordered_map<std::string, std::string> ParseCSS::mainTags = {};

View File

@ -12,7 +12,6 @@ const int EXPECT_FUNCTION = 0;
const int EXPECT_VARIABLE = 1;
const int EXPECT_CONST = 2;
const int EXPECT_CONST_VALUE = 3;
const int EXPECT_COMMENT = 4;
ParseJS::ParseJS()
{
@ -584,7 +583,7 @@ void ParseJS::parseCode(QString & code, QString & origText)
QString argName, argDefault;
argsList = current_function_args.split(",");
for (int i=0; i<argsList.size(); i++) {
argName = "", argDefault = "";
argName = ""; argDefault = "";
argsDefaultsList = argsList.at(i).trimmed().split("=");
if (argsDefaultsList.size() == 2) {
argDefault = argsDefaultsList.at(1).trimmed();

View File

@ -26,7 +26,6 @@ const int EXPECT_FUNCTION_RETURN_TYPE = 12;
const int EXPECT_VARIABLE = 13;
const int EXPECT_CONST = 14;
const int EXPECT_CONST_VALUE = 15;
const int EXPECT_COMMENT = 16;
const QString IMPORT_TYPE_CLASS = "class";
const QString IMPORT_TYPE_FUNCTION = "function";
@ -1328,7 +1327,7 @@ void ParsePHP::parseCode(QString & code, QString & origText, int textOffset)
QString argType, argName, argDefault;
argsList = current_function_args.split(",");
for (int i=0; i<argsList.size(); i++) {
argType = "", argName = "", argDefault = "";
argType = ""; argName = ""; argDefault = "";
argsDefaultsList = argsList.at(i).trimmed().split("=");
if (argsDefaultsList.size() == 2) {
argDefault = argsDefaultsList.at(1).trimmed();

View File

@ -97,11 +97,6 @@ ParserWorker::ParserWorker(Settings * settings, QObject *parent) : QObject(paren
quickBreaked = false;
}
ParserWorker::~ParserWorker()
{
}
void ParserWorker::disable()
{
enabled = false;

View File

@ -56,11 +56,6 @@ Popup::Popup(Settings * settings, QWidget *parent) : QWidget(parent)
hide();
}
Popup::~Popup()
{
}
QSize Popup::sizeHint() const {
return QSize(WIDGET_MIN_WIDTH, WIDGET_MIN_HEIGHT);
}

View File

@ -77,11 +77,6 @@ QuickAccess::QuickAccess(Settings * settings, QWidget *parent) : QFrame(parent)
resultsList->setFont(outputFont);
}
QuickAccess::~QuickAccess()
{
}
QSize QuickAccess::sizeHint() const {
return QSize(WIDGET_MIN_WIDTH, WIDGET_MIN_HEIGHT);
}
@ -503,7 +498,7 @@ void QuickAccess::quickFound(QString text, QString info, QString file, int line)
bool QuickAccess::eventFilter(QObject *watched, QEvent *event)
{
if(watched == findEdit && event->type() == QEvent::KeyPress) {
QKeyEvent * keyEvent = (QKeyEvent *)event;
QKeyEvent * keyEvent = static_cast<QKeyEvent *>(event);
if (keyEvent->key() == Qt::Key_Down && resultsList->count() > 0) {
int current = resultsList->currentRow();
if (current < resultsList->count()-1) current++;
@ -519,7 +514,7 @@ bool QuickAccess::eventFilter(QObject *watched, QEvent *event)
}
}
if(watched == resultsList && event->type() == QEvent::KeyPress) {
QKeyEvent * keyEvent = (QKeyEvent *)event;
QKeyEvent * keyEvent = static_cast<QKeyEvent *>(event);
if (keyEvent->key() == Qt::Key_Down && resultsList->count() > 0 && resultsList->currentRow() == resultsList->count()-1) {
resultsList->setCurrentRow(0);
return true;

View File

@ -77,11 +77,6 @@ Settings::Settings(QObject * parent) : QObject(parent)
};
}
Settings::~Settings()
{
}
void Settings::applyLightColors()
{
data["editor_line_number_bg_color"] = "#eeeeee";

View File

@ -133,11 +133,11 @@ std::unordered_map<std::string, std::string> SettingsDialog::getData()
if (ui->filesEncodingLineEdit->text().size() > 0) {
std::string encoding = ui->filesEncodingLineEdit->text().toStdString();
if (QTextCodec::codecForName(encoding.c_str()) != 0) dataMap["editor_encoding"] = encoding;
if (QTextCodec::codecForName(encoding.c_str()) != nullptr) dataMap["editor_encoding"] = encoding;
}
if (ui->filesFallbackEncodingLineEdit->text().size() > 0) {
std::string encoding = ui->filesFallbackEncodingLineEdit->text().toStdString();
if (QTextCodec::codecForName(encoding.c_str()) != 0) dataMap["editor_fallback_encoding"] = encoding;
if (QTextCodec::codecForName(encoding.c_str()) != nullptr) dataMap["editor_fallback_encoding"] = encoding;
}
if (newLineMode == NEW_LINE_LF || newLineMode == NEW_LINE_CR || newLineMode == NEW_LINE_CRLF) dataMap["editor_new_line_mode"] = newLineMode;

View File

@ -11,11 +11,6 @@ Tooltip::Tooltip()
}
Tooltip::~Tooltip()
{
}
void Tooltip::mousePressEvent(QMouseEvent * /*e*/)
{
hide();