Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ SCsAbstractHighlightingRule::~SCsAbstractHighlightingRule()

void SCsAbstractHighlightingRule::assignFormat(SCsSyntaxHighlighter *highlighter, const QString &text)
{

Q_UNUSED(highlighter);
Q_UNUSED(text);
}

void SCsAbstractHighlightingRule::setFormat(QTextCharFormat format)
Expand Down
11 changes: 6 additions & 5 deletions sources/plugins/scs/scscodeeditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ along with OSTIS. If not, see <http://www.gnu.org/licenses/>.

#define SPACE_FOR_ERROR_LABEL 20

SCsCodeEditor::SCsCodeEditor(QWidget *parent, SCsErrorTableWidget *errorTable) :
QPlainTextEdit(parent)
,mLastCursorPosition(0)
,mIsTextInsert(false)
,mErrorTable(errorTable)
SCsCodeEditor::SCsCodeEditor(QWidget *parent, SCsErrorTableWidget *errorTable)
: QPlainTextEdit(parent)
, mErrorTable(errorTable)
, mLastCursorPosition(0)
, mIsTextInsert(false)
{
mLineNumberArea = new SCsLineNumberArea(this);
mAnalyzer = new SCsCodeAnalyzer(this);
Expand Down Expand Up @@ -77,6 +77,7 @@ SCsCodeEditor::SCsCodeEditor(QWidget *parent, SCsErrorTableWidget *errorTable) :

void SCsCodeEditor::setDocumentPath(const QString &path)
{
Q_UNUSED(path);
mAnalyzer->parse(toPlainText(), (QStandardItemModel*)mCompleter->model());
}

Expand Down
6 changes: 3 additions & 3 deletions sources/plugins/scs/scscodeerroranalyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

SCsCodeErrorAnalyzer::SCsCodeErrorAnalyzer(SCsCodeEditor* editor, SCsErrorTableWidget *errorTable)
: QObject(editor)
, mEditor(editor)
, mErrorTable(errorTable)
, mAsynchParser(0)
, mErrorTable(errorTable)
, mEditor(editor)
{
Q_CHECK_PTR(mEditor);

Expand All @@ -18,7 +18,7 @@ SCsCodeErrorAnalyzer::SCsCodeErrorAnalyzer(SCsCodeEditor* editor, SCsErrorTableW
connect(mAsynchParser,SIGNAL(parseExceptionsFinished()),SLOT(parseExceptionFinished()));
}

void SCsCodeErrorAnalyzer::parse(QString &text)
void SCsCodeErrorAnalyzer::parse(const QString &text)
{
if (mAsynchParser->doWork() || text.isEmpty())
return;
Expand Down
2 changes: 1 addition & 1 deletion sources/plugins/scs/scscodeerroranalyzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class SCsCodeErrorAnalyzer : public QObject
Q_OBJECT
public:
explicit SCsCodeErrorAnalyzer(SCsCodeEditor* editor, SCsErrorTableWidget *errorTable);
void parse(QString &text);
void parse(const QString &text);

private:
void showError(const QVector<SCsParserException> &exceptions) const;
Expand Down
3 changes: 3 additions & 0 deletions sources/plugins/scs/scserrortablewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ void SCsErrorTableWidget::doubleClickAtCell(int row, int col)
{
if(item(row,0)->type() != ERROR_TABLE_WIDGET_ITEM_TYPE)
return;

Q_UNUSED(col);

SCsErrorTableWidgetItem *item = (SCsErrorTableWidgetItem*) this->item(row,ERROR_TABLE_WIDGET_ITEM_COLUMN);

Q_CHECK_PTR(item);
Expand Down
2 changes: 2 additions & 0 deletions sources/plugins/scs/scsfindwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,14 @@ void SCsFindWidget::updateButtons()

void SCsFindWidget::caseSensitivityChanged(int val)
{
Q_UNUSED(val)
emit find(mSearchEdit->text());
}


void SCsFindWidget::wholeWordChanged(int val)
{
Q_UNUSED(val)
emit find(mSearchEdit->text());
}

Expand Down
48 changes: 31 additions & 17 deletions sources/plugins/scs/scsparser/scsparserexception.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,32 @@ along with OSTIS. If not, see <http://www.gnu.org/licenses/>.

#include "scsparserexception.h"

SCsParserException::SCsParserException():
mLine(-1), mPositionInLine(-1), mExceptionType(-1), mExceptionPlace(SCsParserException::UNDEFINED)
SCsParserException::SCsParserException()
: mExceptionPlace(SCsParserException::UNDEFINED)
, mExceptionType(-1)
, mLine(-1)
, mPositionInLine(-1)
{

}



SCsParserException::SCsParserException(SCsParserException::ExceptionPlace place) :
mLine(-1), mPositionInLine(-1), mExceptionType(-1), mExceptionPlace(place)
SCsParserException::SCsParserException(SCsParserException::ExceptionPlace place)
: mExceptionPlace(place)
, mExceptionType(-1)
, mLine(-1)
, mPositionInLine(-1)
{

}

SCsParserException::SCsParserException(ExceptionPlace place, int line, int positionInLine, ExceptionType exType):
mLine(line)
,mPositionInLine(positionInLine)
,mExceptionType(exType)
,mExceptionPlace(place)
SCsParserException::SCsParserException(ExceptionPlace place, int line, int positionInLine, ExceptionType exType)
: mExceptionPlace(place)
, mExceptionType(exType)
, mLine(line)
, mPositionInLine(positionInLine)

{

}
Expand Down Expand Up @@ -71,24 +78,31 @@ SCsParserException::~SCsParserException()
}


SCsParserToken::SCsParserToken():
mTokenType(0), mLine(-1), mPositionInLine(-1)
SCsParserToken::SCsParserToken()
: mLine(-1)
, mPositionInLine(-1)
, mTokenType(0)
{

}


SCsParserToken::SCsParserToken(int tokenType):
mTokenType(tokenType), mLine(-1), mPositionInLine(-1)
SCsParserToken::SCsParserToken(int tokenType)
: mLine(-1)
, mPositionInLine(-1)
, mTokenType(tokenType)
{

}


SCsParserToken::SCsParserToken(int tokenType, QString tokenText, int line, int positionInLine):
mTokenType(tokenType), mLine(line), mPositionInLine(positionInLine)
SCsParserToken::SCsParserToken(int tokenType,const QString &tokenText, int line, int positionInLine)
: mTokenText(tokenText)
, mLine(line)
, mPositionInLine(positionInLine)
, mTokenType(tokenType)
{
mTokenText = tokenText;

}


Expand Down Expand Up @@ -116,4 +130,4 @@ SCsParserToken& SCsParserToken::operator=(const SCsParserToken& copy)
SCsParserToken::~SCsParserToken()
{

}
}
2 changes: 1 addition & 1 deletion sources/plugins/scs/scsparser/scsparserexception.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class SCsParserToken
};
SCsParserToken();
SCsParserToken(int tokenType);
SCsParserToken(int tokenType, QString tokenText, int line, int positionInLine);
SCsParserToken(int tokenType, const QString &tokenText, int line, int positionInLine);
SCsParserToken(const SCsParserToken& copy);
SCsParserToken& operator=(const SCsParserToken& copy);
virtual ~SCsParserToken();
Expand Down
2 changes: 1 addition & 1 deletion sources/plugins/scs/scsparser/scsparserwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ QSharedPointer<SCsParserTokenArray> SCsParser::getTokens(const QString &text) co

pANTLR3_COMMON_TOKEN tok;
pANTLR3_STRING tokText;
for(int i=0; i<tokens->count; i++)
for(uint i=0; i<tokens->count; i++)
{
tok = (pANTLR3_COMMON_TOKEN) tokens->elements[i].element;
tokText = tok->getText(tok);
Expand Down
18 changes: 12 additions & 6 deletions sources/plugins/scs/scswindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ along with OSTIS. If not, see <http://www.gnu.org/licenses/>.
#include <QShortcut>
#include <QTextCodec>

SCsWindow::SCsWindow(const QString& _windowTitle, QWidget *parent):
QWidget(parent),
mEditor(0),
mHighlighter(0),
mIsSaved(false),
mErrorTable(0)
SCsWindow::SCsWindow(const QString& _windowTitle, QWidget *parent)
: QWidget(parent)
, mEditor(0)
, mHighlighter(0)
, mErrorTable(0)
, mIsSaved(false)
{


Expand Down Expand Up @@ -86,6 +86,8 @@ SCsWindow::SCsWindow(const QString& _windowTitle, QWidget *parent):


connect(mEditor, SIGNAL(textChanged()), this, SLOT(textChanged()));

setWindowTitle(_windowTitle);
}

SCsWindow::~SCsWindow()
Expand Down Expand Up @@ -131,6 +133,8 @@ bool SCsWindow::loadFromFile(const QString &fileName)
}

QTextStream in(&fileIn);
in.setCodec("UTF-8");

mEditor->document()->setPlainText(in.readAll());
mEditor->setDocumentPath(fileName);
fileIn.close();
Expand All @@ -156,6 +160,8 @@ bool SCsWindow::saveToFile(const QString &fileName)
return false;
}
QTextStream out(&fileOut);
out.setCodec("UTF-8");

out << mEditor->document()->toPlainText();
fileOut.close();

Expand Down